prompts: update D-Bus operational model with all methods, signals, and examples
This commit is contained in:
parent
590dbb5b4a
commit
17f28647b8
|
|
@ -25,34 +25,75 @@ Each entry: `id\tstate\tmodel\tagent`
|
|||
|
||||
**Inter-Agent Communication**: Use `PeerSubmit` to send a prompt to another session. Always provide a return path (e.g., [message from $OLLIE_SESSION_ID]).
|
||||
|
||||
# Session Management (D-Bus)
|
||||
|
||||
All session operations go through the D-Bus interface. No filesystem writes for session control.
|
||||
|
||||
## Methods
|
||||
|
||||
All session operations go through the D-Bus interface.
|
||||
|
||||
### Session Lifecycle
|
||||
|
||||
| Method | Args | Returns | Purpose |
|
||||
|---|---|---|---|
|
||||
| `CreateSession` | cwd, backend, model, agent | session_id | Create a new session |
|
||||
| `CreateSession` | cwd, backend, model, agent, system_prompt | session_id | Create a new session |
|
||||
| `ListSessions` | — | array of "id\tstate\tmodel\tagent" | Discover sessions |
|
||||
| `KillSession` | session_id | success | Terminate a session |
|
||||
| `RenameSession` | session_id, new_name | success | Rename a session |
|
||||
| `Submit` | session_id, prompt | success | Submit a prompt to an agent |
|
||||
| `Interrupt` | session_id | success | Interrupt current agent turn |
|
||||
| `GetState` | session_id | state | Current state: idle, thinking, calling: \<tool\> |
|
||||
| `GetChat` | session_id, offset | text, new_offset | Read chat output |
|
||||
| `GetUsage` | session_id | usage | Token usage stats |
|
||||
| `GetCost` | session_id | cost | Cost tracking |
|
||||
| `GetConfig` | session_id | key=value pairs | Read session config |
|
||||
| `SetConfig` | session_id, key, value | success | Change a config setting |
|
||||
| `GetContext` | session_id | JSONL messages | Full conversation context |
|
||||
| `KillSession` | session_id | bool | Terminate a session |
|
||||
| `RenameSession` | session_id, new_name | bool | Rename a session |
|
||||
|
||||
### Agent Interaction
|
||||
|
||||
| Method | Args | Returns | Purpose |
|
||||
|---|---|---|---|
|
||||
| `Submit` | session_id, prompt | bool | Submit a prompt to an agent |
|
||||
| `Interrupt` | session_id | bool | Interrupt current agent turn |
|
||||
| `Compact` | session_id | bool | Compact conversation history |
|
||||
| `ClearContext` | session_id | bool | Clear conversation history |
|
||||
|
||||
### Session State
|
||||
|
||||
| Method | Args | Returns | Purpose |
|
||||
|---|---|---|---|
|
||||
| `GetState` | session_id | state | Current state: `idle`, `thinking`, `calling: <tool>` |
|
||||
| `GetChat` | session_id, offset | text, new_offset | Read chat output from byte offset |
|
||||
| `GetConfig` | session_id | key=value text | Read session config (model, backend, agent, cwd, state) |
|
||||
| `SetConfig` | session_id, key, value | bool | Change a config setting (model, cwd) |
|
||||
| `GetContext` | session_id | JSONL | Full conversation context as JSONL messages |
|
||||
| `GetContextSize` | session_id | string | Context token size |
|
||||
| `GetUsage` | session_id | string | Token usage stats |
|
||||
| `GetCost` | session_id | string | Cost tracking |
|
||||
| `GetEnv` | session_id | key=value text | Session environment variables |
|
||||
| `GetPlan` | session_id | string | Read session plan |
|
||||
| `SetPlan` | session_id, plan | bool | Write session plan |
|
||||
| `GetSystemPrompt` | session_id | string | Rendered system prompt |
|
||||
| `GetPreviousPrompt` | session_id | string | Previous prompt text |
|
||||
|
||||
### Peers
|
||||
|
||||
| Method | Args | Returns | Purpose |
|
||||
|---|---|---|---|
|
||||
| `PeerAdd` | session_id, peer_id | bool | Add peer relationship |
|
||||
| `PeerRemove` | session_id, peer_id | bool | Remove peer relationship |
|
||||
| `PeerList` | session_id | array of peer_ids | List peers |
|
||||
| `PeerSubmit` | session_id, peer_id, prompt | bool | Send prompt to peer |
|
||||
|
||||
### Detached Processes
|
||||
|
||||
| Method | Args | Returns | Purpose |
|
||||
|---|---|---|---|
|
||||
| `DetachProcess` | session_id | bool | Detach current running process to background |
|
||||
| `ListDetached` | session_id | array of "pid\tcmd\tstarted\tstatus" | List background processes |
|
||||
| `SignalDetached` | session_id, pid, signal | bool | Send signal (TERM, KILL) to detached process |
|
||||
| `GetDetachedOutput` | session_id, pid | string | Read output from detached process |
|
||||
| `DismissDetached` | session_id, pid | bool | Dismiss a finished detached process |
|
||||
|
||||
### Global Services
|
||||
|
||||
| Method | Args | Returns | Purpose |
|
||||
|---|---|---|---|
|
||||
| `ListBackends` | — | array of names | Available backends |
|
||||
| `ListModels` | session_id | array of names | Models for session's backend |
|
||||
| `ListAgents` | — | array of names | Available agent definitions |
|
||||
| `PeerAdd` | session_id, peer_id | success | Add peer relationship |
|
||||
| `PeerRemove` | session_id, peer_id | success | Remove peer relationship |
|
||||
| `PeerList` | session_id | array of peer_ids | List peers |
|
||||
| `PeerSubmit` | session_id, peer_id, prompt | success | Send prompt to peer |
|
||||
| `Generate` | prompt, system, backend, model | string | One-shot LLM generation (no session needed) |
|
||||
| `Route` | task, backend | "backend=X model=Y" | Pick a backend+model for a task |
|
||||
| `Complete` | cwd, file, prefix, suffix, context | string | Code completion |
|
||||
|
||||
## Signals
|
||||
|
||||
|
|
@ -60,8 +101,11 @@ All session operations go through the D-Bus interface. No filesystem writes for
|
|||
|---|---|---|
|
||||
| `SessionCreated` | session_id | New session appeared |
|
||||
| `SessionKilled` | session_id | Session terminated |
|
||||
| `StateChanged` | session_id, new_state | Agent state transition |
|
||||
| `ChatUpdated` | session_id, offset, new_text | New output available |
|
||||
| `SessionRenamed` | old_id, new_id | Session renamed |
|
||||
| `StateChanged` | session_id, state | Agent state transition |
|
||||
| `ChatUpdated` | session_id, offset, text | New chat output available |
|
||||
| `ProcessDetached` | session_id | A process was detached |
|
||||
| `ProcessExited` | session_id, pid, exit_code | A detached process finished |
|
||||
|
||||
## Operations
|
||||
|
||||
|
|
@ -70,62 +114,43 @@ All session operations go through the D-Bus interface. No filesystem writes for
|
|||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.ListSessions
|
||||
|
||||
# Create a session (returns session_id)
|
||||
# Create a session
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.CreateSession \
|
||||
string:"$PWD" string:"" string:"" string:"default"
|
||||
|
||||
# Create a named session (backend + model + agent)
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.CreateSession \
|
||||
string:"$PWD" string:"openrouter" string:"anthropic/claude-sonnet-4" string:"worker"
|
||||
|
||||
# Kill a session
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.KillSession \
|
||||
string:"SESSION_ID"
|
||||
|
||||
# Rename a session
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.RenameSession \
|
||||
string:"SESSION_ID" string:"new-name"
|
||||
string:"$PWD" string:"" string:"" string:"default" string:""
|
||||
|
||||
# Submit a prompt
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.Submit \
|
||||
string:"SESSION_ID" string:"your prompt here"
|
||||
|
||||
# Get current state
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.GetState \
|
||||
string:"SESSION_ID"
|
||||
|
||||
# Get chat output (use gdbus for tuple return)
|
||||
# Get chat output (use gdbus for multi-return)
|
||||
gdbus call --session --dest org.ollie.SessionManager \
|
||||
--object-path /org/ollie/SessionManager \
|
||||
--method org.ollie.SessionManager.GetChat "SESSION_ID" 0
|
||||
|
||||
# Read session config
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.GetConfig \
|
||||
string:"SESSION_ID"
|
||||
# One-shot generation (no session)
|
||||
gdbus call --session --dest org.ollie.SessionManager \
|
||||
--object-path /org/ollie/SessionManager \
|
||||
--method org.ollie.SessionManager.Generate "summarize this" "" "" ""
|
||||
|
||||
# Change config
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.SetConfig \
|
||||
string:"SESSION_ID" string:"model" string:"gpt-4o"
|
||||
# Route a task
|
||||
gdbus call --session --dest org.ollie.SessionManager \
|
||||
--object-path /org/ollie/SessionManager \
|
||||
--method org.ollie.SessionManager.Route "implement login page" ""
|
||||
|
||||
# Code completion
|
||||
gdbus call --session --dest org.ollie.SessionManager \
|
||||
--object-path /org/ollie/SessionManager \
|
||||
--method org.ollie.SessionManager.Complete "$PWD" "main.go" "func " "" ""
|
||||
|
||||
# Send prompt to peer
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.PeerSubmit \
|
||||
string:"MY_SESSION" string:"PEER_SESSION" string:"your prompt"
|
||||
|
||||
# List available backends
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.ListBackends
|
||||
|
||||
# List available models
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.ListModels \
|
||||
# Kill a session
|
||||
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
|
||||
/org/ollie/SessionManager org.ollie.SessionManager.KillSession \
|
||||
string:"SESSION_ID"
|
||||
```
|
||||
|
|
|
|||
Reference in New Issue