Chat: offer the session's Claude Code skills and slash commands in the palette
The server reads the commands Claude Code's initialize response lists (bundled, user, project, plugin and claude.ai-synced skills plus CLI commands, with descriptions and argument hints), drops terminal-only ones, and serves them per chat over a new chat_commands request without waiting for a CLI start. The composer palette lists them after the recorded commands; choosing one inserts "/<name> " and sending passes it to the harness as an ordinary prompt. Codex, OpenCode and Pi chats reply with an empty list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,10 @@ const (
|
||||
// ChatModels lists the models the chat's harness can switch to; its request
|
||||
// body is ChatQuery (the session id).
|
||||
ChatModels = "chat_models"
|
||||
// ChatCommands lists the slash commands and skills the chat's harness
|
||||
// session offers; its request body is ChatQuery (the session id). A harness
|
||||
// that reports none replies with an empty list.
|
||||
ChatCommands = "chat_commands"
|
||||
// ChatModelSelect switches one session's model for subsequent turns.
|
||||
ChatModelSelect = "chat_model"
|
||||
// ChatModes lists the permission modes the chat's harness offers (Claude
|
||||
@@ -267,6 +271,16 @@ const (
|
||||
ChatMessageKindNotice = "notice"
|
||||
)
|
||||
|
||||
// ChatCommand is one slash command or skill the chat's harness session offers.
|
||||
// Name is the word after the slash; the operator sends "/<Name> <args>" as an
|
||||
// ordinary prompt and the harness expands it. ArgumentHint is the harness's
|
||||
// usage hint for the arguments, if any.
|
||||
type ChatCommand struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
ArgumentHint string `json:"argument_hint,omitempty"`
|
||||
}
|
||||
|
||||
// ChatModel is one model the current chat harness can switch to. ID is the
|
||||
// provider's model id, Provider its provider id, Name the harness's display name.
|
||||
type ChatModel struct {
|
||||
|
||||
@@ -248,6 +248,8 @@ type Message struct {
|
||||
ChatBackends []string `json:"chat_backends,omitempty"`
|
||||
// ChatModels is the chat_models reply: models the session's harness offers.
|
||||
ChatModels []ChatModel `json:"chat_models,omitempty"`
|
||||
// ChatCommands is the chat_commands reply: the session's slash commands.
|
||||
ChatCommands []ChatCommand `json:"chat_commands,omitempty"`
|
||||
// ModelRequest is the chat_model body and echoed selection.
|
||||
ModelRequest *ChatModelRequest `json:"chat_model,omitempty"`
|
||||
// ChatModes is the chat_modes reply: the permission modes the session's
|
||||
|
||||
Reference in New Issue
Block a user