mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 14:01:06 +00:00
Remove allowDuringStreaming flag - commands always run immediately
Hook commands now always execute immediately, even during streaming. If a command needs to interact with the LLM, it uses pi.sendMessage() which handles queueing automatically. This simplifies the API and eliminates the issue of queued slash commands being sent to the LLM instead of executing.
This commit is contained in:
parent
f8352bb7d7
commit
575c875475
5 changed files with 66 additions and 78 deletions
|
|
@ -744,13 +744,13 @@ export class InteractiveMode {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check if this hook command can run during streaming (not queued)
|
||||
if (text.startsWith("/") && this.session.hookRunner && this.session.isStreaming) {
|
||||
// Hook commands always run immediately, even during streaming
|
||||
// (if they need to interact with LLM, they use pi.sendMessage which handles queueing)
|
||||
if (text.startsWith("/") && this.session.hookRunner) {
|
||||
const spaceIndex = text.indexOf(" ");
|
||||
const commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);
|
||||
const command = this.session.hookRunner.getCommand(commandName);
|
||||
if (command?.allowDuringStreaming) {
|
||||
// Execute hook command right away
|
||||
if (command) {
|
||||
this.editor.addToHistory(text);
|
||||
this.editor.setText("");
|
||||
await this.session.prompt(text);
|
||||
|
|
@ -758,7 +758,7 @@ export class InteractiveMode {
|
|||
}
|
||||
}
|
||||
|
||||
// Queue message if agent is streaming
|
||||
// Queue regular messages if agent is streaming
|
||||
if (this.session.isStreaming) {
|
||||
await this.session.queueMessage(text);
|
||||
this.updatePendingMessagesDisplay();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue