mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 22:03:45 +00:00
Add get_commands RPC for headless clients (#995)
* Add get_commands RPC for headless clients Headless clients like Emacs can now query which commands are available. Previously they could only discover file-based prompt templates by scanning the filesystem; extension commands and skills were invisible. The response includes each command's name, description, and source (extension, template, or skill). Commands appear in the same order as the TUI's autocomplete: extension commands first, then templates, then skills. Built-in TUI commands (/settings, /fork, etc.) are excluded since they require the interactive UI. Commands like /compact have dedicated RPC equivalents instead. * Add location and path to get_commands response Clients can show where commands come from (user/project/path) and display file paths in tooltips. The data is already available on templates and skills - just exposing it.
This commit is contained in:
parent
c67b582fc4
commit
0ad189f12a
6 changed files with 135 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ import type { ImageContent } from "@mariozechner/pi-ai";
|
|||
import type { SessionStats } from "../../core/agent-session.js";
|
||||
import type { BashResult } from "../../core/bash-executor.js";
|
||||
import type { CompactionResult } from "../../core/compaction/index.js";
|
||||
import type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc-types.js";
|
||||
import type { RpcCommand, RpcResponse, RpcSessionState, RpcSlashCommand } from "./rpc-types.js";
|
||||
|
||||
// ============================================================================
|
||||
// Types
|
||||
|
|
@ -370,6 +370,14 @@ export class RpcClient {
|
|||
return this.getData<{ messages: AgentMessage[] }>(response).messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available commands (extension commands, prompt templates, skills).
|
||||
*/
|
||||
async getCommands(): Promise<RpcSlashCommand[]> {
|
||||
const response = await this.send({ type: "get_commands" });
|
||||
return this.getData<{ commands: RpcSlashCommand[] }>(response).commands;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Helpers
|
||||
// =========================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue