feat: add basic prompt submit hook (#694)

This commit is contained in:
jnjpng
2026-01-26 17:41:51 -08:00
committed by GitHub
parent 5776c55728
commit 2edf2bd4b1
3 changed files with 32 additions and 1 deletions

View File

@@ -4522,6 +4522,12 @@ export default function App({
return { submitted: false };
}
// Capture successful hook feedback to inject into agent context
const userPromptSubmitHookFeedback =
hookResult.feedback.length > 0
? `${SYSTEM_REMINDER_OPEN}\n${hookResult.feedback.join("\n")}\n${SYSTEM_REMINDER_CLOSE}`
: "";
// Capture the generation at submission time, BEFORE any async work.
// This allows detecting if ESC was pressed during async operations.
const submissionGeneration = conversationGenerationRef.current;
@@ -6433,7 +6439,7 @@ ${SYSTEM_REMINDER_CLOSE}
lastNotifiedModeRef.current = currentMode;
}
// Combine reminders with content (session context first, then permission mode, then plan mode, then ralph mode, then skill unload, then bash commands, then memory reminder)
// Combine reminders with content (session context first, then permission mode, then plan mode, then ralph mode, then skill unload, then bash commands, then hook feedback, then memory reminder)
const allReminders =
sessionContextReminder +
permissionModeAlert +
@@ -6441,6 +6447,7 @@ ${SYSTEM_REMINDER_CLOSE}
ralphModeReminder +
skillUnloadReminder +
bashCommandPrefix +
userPromptSubmitHookFeedback +
memoryReminderContent;
const messageContent =
allReminders && typeof contentParts === "string"