pub struct SwarmTask {
pub id: TaskId,
pub group_id: Option<GroupId>,
pub goal: String,
pub context: Value,
}Expand description
Orchestrator に投入する汎用タスク
run_task() で渡すと、Manager がこれを読み取って Guidance を生成する。
goal と context で任意のタスクを表現できる。
§Example
ⓘ
// シンプルなタスク
let task = SwarmTask::new("Process the data");
// コンテキスト付きタスク
let task = SwarmTask::new("Find the auth handler")
.with_context(serde_json::json!({
"target_path": "/path/to/repo",
"max_depth": 3,
"expected": "src/auth/handler.rs:42"
}));
let result = orchestrator.run_task(task);Fields§
§id: TaskIdタスク ID(1回のタスク実行を識別)
group_id: Option<GroupId>グループ ID(同条件の複数試行をグループ化、Learn 用)
goal: String目標(何を達成するか)
context: Value追加コンテキスト(タスク固有のデータ)
Implementations§
Source§impl SwarmTask
impl SwarmTask
pub fn new(goal: impl Into<String>) -> SwarmTask
Sourcepub fn with_context(self, context: Value) -> SwarmTask
pub fn with_context(self, context: Value) -> SwarmTask
コンテキストを設定
Sourcepub fn with_group_id(self, group_id: GroupId) -> SwarmTask
pub fn with_group_id(self, group_id: GroupId) -> SwarmTask
グループ ID を設定(同条件の複数試行をグループ化)
Sourcepub fn get<T>(&self, key: &str) -> Option<T>where
T: DeserializeOwned,
pub fn get<T>(&self, key: &str) -> Option<T>where
T: DeserializeOwned,
コンテキストから値を取得
Sourcepub fn initial_context(&self) -> Option<&str>
pub fn initial_context(&self) -> Option<&str>
Sourcepub fn with_initial_context(self, ctx: impl Into<String>) -> SwarmTask
pub fn with_initial_context(self, ctx: impl Into<String>) -> SwarmTask
初期コンテキストを設定
探索の起点となるキーワード/パスを設定する。
Sourcepub fn initial_contexts(&self) -> Vec<&str>
pub fn initial_contexts(&self) -> Vec<&str>
初期コンテキストのリストを取得
複数の初期ターゲットがある場合に使用。 単一値の場合は1要素のVecとして返す。
Sourcepub fn with_initial_contexts<I, S>(self, contexts: I) -> SwarmTask
pub fn with_initial_contexts<I, S>(self, contexts: I) -> SwarmTask
複数の初期コンテキストを設定
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SwarmTask
impl RefUnwindSafe for SwarmTask
impl Send for SwarmTask
impl Sync for SwarmTask
impl Unpin for SwarmTask
impl UnwindSafe for SwarmTask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more