дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
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]>
35 рядки
1.4 KiB
Rust
35 рядки
1.4 KiB
Rust
use openidea_plugin::{Error, NewTask, RecordedSession, host, mock::MockHost};
|
|
|
|
#[test]
|
|
fn start_task_needs_agents_and_returns_a_task_id() {
|
|
let mock = MockHost::install().with_capabilities(&[]);
|
|
let task = NewTask { provider: "claude".into(), prompt: "investigate this".into(), fork: None };
|
|
assert!(matches!(host::start_agent_task(&task), Err(Error::Denied(c)) if c == "agents"));
|
|
let mock = mock.with_capabilities(&["agents"]);
|
|
let id = host::start_agent_task(&task).unwrap();
|
|
assert!(!id.is_empty(), "start-task returns the new task id");
|
|
let recorded = mock.agent_tasks();
|
|
assert_eq!(recorded.len(), 1);
|
|
assert_eq!(recorded[0].provider, "claude");
|
|
assert_eq!(recorded[0].prompt, "investigate this");
|
|
assert!(recorded[0].fork.is_none());
|
|
}
|
|
|
|
#[test]
|
|
fn start_task_carries_a_recorded_session_fork() {
|
|
let mock = MockHost::install();
|
|
let task = NewTask {
|
|
provider: "claude".into(),
|
|
prompt: "continue the recording".into(),
|
|
fork: Some(RecordedSession {
|
|
session_id: "11111111-1111-4111-8111-111111111111".into(),
|
|
cwd: "/project".into(),
|
|
}),
|
|
};
|
|
host::start_agent_task(&task).unwrap();
|
|
let recorded = mock.agent_tasks();
|
|
let fork = recorded[0].fork.as_ref().unwrap();
|
|
assert_eq!(fork.session_id, "11111111-1111-4111-8111-111111111111");
|
|
assert_eq!(fork.cwd, "/project");
|
|
}
|