What happened?
The example examples/extensions/reload-runtime.ts demonstrates an LLM-callable tool that queues /reload-runtime via sendUserMessage:
pi.sendUserMessage("/reload-runtime", { deliverAs: "followUp" });
return { content: [{ type: "text", text: "Queued /reload-runtime as a follow-up command." }] };
This does not work. The /reload-runtime string is sent to the LLM as a literal user message instead of dispatching the command.
The root cause is that sendUserMessage calls prompt() with expandPromptTemplates: false (agent-session.ts:1178), which skips the command dispatch branch at line 811:
if (expandPromptTemplates && text.startsWith("/")) {
const handled = await this._tryExecuteExtensionCommand(text);
Steps to reproduce
- Enable the shipped
reload-runtime example extension
- Ask the agent to reload its runtime (
trigger the reload_runtime tool)
- Observe that
/reload-runtime is sent to the LLM as text, not executed as a command
Expected behavior
/reload-runtime dispatched as a slash commands
Version
0.57.1
What happened?
The example
examples/extensions/reload-runtime.tsdemonstrates an LLM-callable tool that queues/reload-runtimeviasendUserMessage:This does not work. The
/reload-runtimestring is sent to the LLM as a literal user message instead of dispatching the command.The root cause is that
sendUserMessagecallsprompt()withexpandPromptTemplates: false(agent-session.ts:1178), which skips the command dispatch branch at line811:Steps to reproduce
reload-runtimeexample extensiontrigger the reload_runtime tool)/reload-runtimeis sent to the LLM as text, not executed as a commandExpected behavior
/reload-runtimedispatched as a slash commandsVersion
0.57.1