Skip to content
pi-c Artifact [b7f6dc2653]
Login

Artifact [b7f6dc2653]

Artifact b7f6dc2653bd28d944d12f68cb271db9c7be57eb80cd5a0eaae45af7a252510c:


RPC commands

The commands pic --mode rpc reads on stdin, one JSON object per line, with Pi's fields, responses and errors (Pi's docs/rpc.md and docs/rpc-commands.md). How the mode behaves is in RPC mode.

Command What it does
prompt send a message (with images and streamingBehavior)
steer steer the running request
follow_up queue a message for after the running request
abort stop the running request
clear_queue drop queued steering and follow-ups
new_session start a new conversation
get_state the session's state
get_messages the conversation's messages
set_model switch model; applies from the next request; persist: true also saves it as the model new conversations start on; pic's credential: a key label of the model's provider, used from the next request (saved too with persist); pic's profile: a profile's name in place of provider and modelId, with its key and thinking level
get_profiles pic's: data.profiles, each one's name, model, credential (provider:label or null) and thinking
cycle_model the next model
get_available_models models whose provider has a key, then the saved endpoints' models, which carry endpoint
set_thinking_level set the thinking level; applies from the next request
cycle_thinking_level the next thinking level
get_available_thinking_levels the model's supported levels
set_steering_mode how steering is delivered
set_follow_up_mode how follow-ups are delivered
compact compact now, outside any request
set_auto_compaction the compaction.enabled setting
set_auto_retry saved as Pi's retry.enabled
abort_retry stop waiting for a retry
bash run a command and journal it
abort_bash stop the running bash command
get_session_stats tokens and cost
export_html the conversation as an HTML page
switch_session continue another conversation: a conversation id, or a file pic export --pi wrote, as sessionPath
fork fork from an entry
clone duplicate the conversation
rewind pic's: entryId (a user message), mode (both, conversation, files), forcePartial; or undo
get_fork_messages the messages a fork can start from
get_entries the conversation's own path
get_tree the conversation's own path, as a tree
get_last_assistant_text the last reply's text
set_session_name name the conversation
archive_session, unarchive_session pic's: session (optional; the current conversation): out of the lists until unarchived or sent a message, or back; data.session, data.archived, data.archivedMs (archiving)
get_commands prompt templates and skills; pic adds a template's argumentHint and, given contextWindow, skillsWarning: what the skill listing's budget cuts
extension_ui_response id, and value, confirmed or cancelled: answers the question with that id, as answer_ask does (questions)
login provider: its subscription sign-in in the browser; messages on stderr, the redirect completes it; a locked store is opened with unlock first
logout provider: remove its stored sign-in or key, or pic's label: that key; data.removed
unlock pic's: passphrase: open the credential store (RPC never asks on a terminal); a store with no passphrase yet is made with it, and data.created is true
get_credentials pic's: provider (optional); data.credentials, each key's provider, label, kind, active, state (ok, invalid, credit, limited, unknown) and, when known, status, until, checked, remaining with currency, probed (the last free check), reason, left (what is left: kind money or none, amount, currency, source, as_of, stale), expires_at, days_left, expiry_source, expired, rotated_at; never a value; and data.bindings, each rule's pattern, provider, label
set_credential pic's: provider, label: this RPC process's requests to the provider use that key from the next one; persist: true also saves it as pic auth use does; data.provider, label, persist, changed
add_credential pic's: provider, label (optional: the provider's own), key, use (optional: also make it the provider's), expires_at (optional): store an API key, sealed; the same key again changes nothing; data.provider, label, kind, changed, active; never the key
set_credential_expiry pic's: provider, label, expires_at (a date, an RFC 3339 time, 30d, or null for none): record when that key expires; data.expires_at, expiry_source
set_model_credential pic's: pattern, label (null removes it): a saved rule, the models pattern matches use that key of their provider; data.pattern, provider, label, changed
check_credentials pic's: provider, active (optional): run the free checks now; data.checked and get_credentials's credentials
get_auth_status each stored credential's provider, type, label, createdAt, lastUsedAt; never a value
get_providers pic's: data.providers, every provider pic knows
get_endpoints pic's: data.endpoints, each saved endpoint's name, url, hasKey, models (id, owned_by), fetchedAt and the last failed fetch's error
add_endpoint pic's: name, url (and key, sealed under the name, or user and password, sealed for HTTP Basic): save it and fetch its models; data.count, or data.error when the fetch failed (the endpoint is kept)
remove_endpoint pic's: name: forget it and its key; data.removed
refresh_endpoints pic's: name (optional: every one): fetch the lists again; data.endpoints, each name, count and error (null when it worked; a failure keeps the old list)
get_mcp_servers pic's: data.servers, each MCP server's name, source (user, or the project file), transport, url or command, cwd, headers and env (names only), description, exposure, timeout, enabled, era, error, listedAt and tools (name, tool, readOnly), as saved; nothing is connected
add_mcp_server pic's: args, pic mcp add's arguments as strings: save the server (sealing its values) and list its tools; data.servers, each name, count, era and error (null when it was reached; one not reached is kept)
remove_mcp_server pic's: name: forget it and its sealed values; data.removed; a project's server is an error
refresh_mcp_servers pic's: name (optional: every enabled one): connect and list the tools again; data.servers, each name, count, era and error
set_codemode pic's: enabled: the codemode tool on or off for this process and what it starts, and for the open conversation, whose tools change with it; data.enabled
set_mcp_server_enabled pic's: name, enabled: turn the server on or off from the next request; data.name, data.enabled; a project's server is an error
get_context_files pic's: data.files, the instruction files every request reads
list_files pic's: dir (the workspace), maxEntries (20000), maxDepth (8); data.entries, each [path, isFolder, depth], breadth first, without what the ignore files leave out
get_help pic's: topic (optional); data.topics and the topic's text (null when there is none)
get_changelog pic's: data.text, the changelog
get_compaction_settings pic's: model (optional); data.compaction and data.branchSummary as the settings apply
get_setting pic's: key; data.value, or null when unset
set_setting pic's: key and value (null removes it), or key, path and json for one field of a JSON setting; a key in the settings list takes only what it allows (a field by its dotted name too), others pass
get_settings pic's: since, setting (optional); data.version and data.settings, each row's id, key, field, group, name, kind (choice, number, text, picker), values and labels or min and max, unit, default, defaultLabel, description, applies, stored, value and valid; data.unchanged true when version still equals since
get_trust pic's: path; data.trusted: 1, 0, or -1 undecided
set_trust pic's: path, trusted
get_scoped_models pic's: data.patterns, Ctrl+P's scope
set_scoped_models pic's: patterns replaces the scope; [] clears it
get_recent_models pic's: limit (10); data.models, each model and usedMs, the latest use first, from the journals of the workspaces used last
report_bug pic's: description (and workspace, session, model); kept on this machine; data.id
get_remote_phones pic's: data.count, the phones paired for remote control
get_hooks pic's: data.configured, whether any hook is configured
proc_start pic's: kind, command, pid (and pgid, workspace, session): records a process a client started, for pic ps; data.id
proc_end pic's: id, exitCode, signal: marks it ended
get_wakes pic's: session (the conversation; all for the journal's), fire (fire what is due first, and start its requests); data.wakes, each id, name (L1), kind, session, prompt, everyMs, state, why, creator, fires, dueMs, firedMs, createdMs, expiresMs, cost, tokens, waiting, late; data.fired, data.nextDueMs, data.nowMs (loops)
create_wake pic's: prompt, every (5m; none: 10 minutes), session (none: a new, empty conversation); the loop starts now; or kind monitor with command, done, restart, its command started now; or kind goal with prompt (what is true when it is met), check, rounds, its first round now; data.wake, data.session, data.wakes
pause_wake pic's: id (L1); data.wake, data.wakes
resume_wake pic's: id; it keeps its due time, so one paused past it runs at once
stop_wake pic's: id; it ends for good
approve_wake pic's: id: a loop or goal the model asked for (listed with asking true) starts, and the conversation is told
decline_wake pic's: id: it ends, declined, and the conversation is told
get_asks pic's: session (none: the conversation), all (every conversation's); data.asks, the questions waiting on a person, each id, session, kind (confirm, select, input), title, body, options (each label, destructive, default), placeholder, createdMs, expiresMs, state, version, and wake (L1) for a loop's or goal's OK (questions)
get_permission_mode pic's: data.permissionMode (allow, ask-edits, ask-all, read-only) and data.allowed, the tools allowed for the conversation (permissions)
set_permission_mode pic's: mode: the conversation's permission mode, committed before the answer; data as get_permission_mode's; refused before the conversation has a message
answer_ask pic's: ask (its id), value (true or false, a label, text of at most 4,000 characters, or null to dismiss it), by (terminal from the terminal interface; else rpc); data.result answered, already_answered or expired, and data.standing (state, value, answeredBy) when not this answer
pause_wakes pic's: session: every loop of the conversation paused (/stop); data.paused, data.wakes