mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-25 08:52:12 +00:00
* feat(agent): add /btw side questions * fix(agent): gate and log /btw reviews * feat(btw): isolate side-question delivery * test(reply): update route reply runtime mocks * fix(btw): complete side-result delivery across clients * fix(gateway): handle streamed btw side results * fix(telegram): unblock btw side questions * fix(reply): make external btw replies explicit * fix(chat): keep btw side results ephemeral in internal history * fix(btw): address remaining review feedback * fix(chat): preserve btw history on mobile refresh * fix(acp): keep btw replies out of prompt history * refactor(btw): narrow side questions to live channels * fix(btw): preserve channel typing indicators * fix(btw): keep side questions isolated in chat * fix(outbound): restore typed channel send deps * fix(btw): avoid blocking replies on transcript persistence * fix(btw): keep side questions fast * docs(commands): document btw slash command * docs(changelog): add btw side questions entry * test(outbound): align session transcript mocks
27 lines
721 B
TypeScript
27 lines
721 B
TypeScript
import { normalizeCommandBody, type CommandNormalizeOptions } from "../commands-registry.js";
|
|
|
|
const BTW_COMMAND_RE = /^\/btw(?::|\s|$)/i;
|
|
|
|
export function isBtwRequestText(text?: string, options?: CommandNormalizeOptions): boolean {
|
|
if (!text) {
|
|
return false;
|
|
}
|
|
const normalized = normalizeCommandBody(text, options).trim();
|
|
return BTW_COMMAND_RE.test(normalized);
|
|
}
|
|
|
|
export function extractBtwQuestion(
|
|
text?: string,
|
|
options?: CommandNormalizeOptions,
|
|
): string | null {
|
|
if (!text) {
|
|
return null;
|
|
}
|
|
const normalized = normalizeCommandBody(text, options).trim();
|
|
const match = normalized.match(/^\/btw(?:\s+(.*))?$/i);
|
|
if (!match) {
|
|
return null;
|
|
}
|
|
return match[1]?.trim() ?? "";
|
|
}
|