Файли
openidea/sdk/rust/openidea-plugin/wit/agents.wit
T
Charlie.Weiтаcharli117 83a3b1208a feat(plugins): hover-card actions and a plugin agent-task API (1.21) (#8221)
Two additive plugin API 1.21 features. decorations.set-actionable puts up to 4 buttons on a plugin decoration's Markdown hover card; each runs one of the plugin's declared commands as if from Find Action (no new capability; undeclared commands fail the call; stale documents don't run). agents.start-task (agents capability, invoking window, trusted project) creates a task that opens in the Agents window with the prompt prefilled and unsent, optionally continuing a recorded session like fork-session. Checked-in components rebuilt; bindings regenerated.

Co-authored-by: charli117 <[email protected]>
2026-12-05 21:17:50 +08:00

38 рядки
2.1 KiB
Plaintext

package openidea:[email protected];
/// Forking recorded native agent sessions into new tasks (API 1.18). Requires
/// the `agents` capability. The session must belong to the invoking window's
/// project and have been recorded in `cwd`; the host builds the fork invocation
/// and names the fork's id for claude (codex assigns its own).
interface agents {
use types.{error};
/// Fork the recorded session `session-id` of `agent` (a native provider,
/// `claude` or `codex`) into a new task in the open project, returning the
/// new task id. `cwd` must be where the session was recorded. The first
/// turn continues the recording as the agent's own fork.
fork-session: func(agent: string, session-id: string, cwd: string) -> result<string, error>;
/// A recorded native session to continue as a fork (API 1.21). The host validates
/// it and builds the fork invocation itself, like `fork-session`; a plugin never
/// puts tokens on an agent's command line.
record recorded-session {
/// The recorded session's id; the task's provider must be the agent that recorded it.
session-id: string,
/// Where it was recorded (same rule as fork-session).
cwd: string,
}
/// A new task a plugin starts (API 1.21). The host does NOT send the prompt: the
/// task opens in the Agents window with the provider selected and the prompt in
/// its message field, focused, for the user to review and send.
record new-task {
provider: string,
/// Without `fork`, must be non-empty; the host rejects an empty prompt.
prompt: string,
/// Continue a recorded native session as a fork, like fork-session.
fork: option<recorded-session>,
}
/// Start a new task in the invoking window's project and return its id (API 1.21).
/// Requires the `agents` capability. The task is created unsent; the user reviews
/// the prompt in the Agents window and sends it. With `fork`, the recorded session
/// is validated and continued exactly as `fork-session` does.
start-task: func(task: new-task) -> result<string, error>;
}