UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

20 lines • 1 kB
import { UnknownCommandError } from "../../core/unknown-command.js"; /** A `/...` submission typed after leading whitespace is sent as text instead of checked as a command. */ export function submitsCommandAsText(text, details) { return text.startsWith("/") && details !== undefined && /^\s/.test(details.rawText); } /** * Turn an unknown-command rejection into editor feedback: the submitted text goes back into an empty * editor, the rejection is shown with the confirm hint, and submitting the same text again sends it as * a message. Returns `false` for any other error. */ export function reportUnknownCommand(error, submittedText, target) { if (!(error instanceof UnknownCommandError)) return false; if (target.editor.getText().trim() === "") target.editor.setText(submittedText); target.armConfirmation(submittedText); target.showWarning(`${error.message}\n${target.confirmHint}`); return true; } //# sourceMappingURL=unknown-command-feedback.js.map