pub struct TaskContext {
pub tick: u64,
pub workers: HashMap<WorkerId, WorkerSummary>,
pub success_rate: f64,
pub progress: f64,
pub escalations: Vec<(WorkerId, Escalation)>,
pub available_actions: Option<ActionsConfig>,
pub v2_guidances: Option<Vec<Guidance>>,
pub excluded_actions: Vec<String>,
pub previous_guidances: HashMap<WorkerId, Arc<Guidance>>,
pub done_workers: HashSet<WorkerId>,
pub metadata: HashMap<String, Value>,
}Expand description
タスク状況(Analyzer が生成、Manager が消費)
§構成
- ベース情報: tick, workers, success_rate, progress, escalations, available_actions
- 探索情報: v2_guidances, excluded_actions
- 拡張 KV: metadata で任意の追加情報を格納
§使用例
let context = TaskContext::new(tick)
.with_worker(WorkerSummary::new(WorkerId(0)).with_phase(WorkerPhase::Working))
.with_progress(0.5)
.insert("llm_summary", "探索フェーズ中");Fields§
§tick: u64現在の tick
workers: HashMap<WorkerId, WorkerSummary>各 Worker の状態サマリ
success_rate: f64成功率 (0.0 - 1.0)
progress: f64進捗 (0.0 - 1.0)
escalations: Vec<(WorkerId, Escalation)>Escalation 一覧(WorkerId, Escalation)
available_actions: Option<ActionsConfig>利用可能なアクション
v2_guidances: Option<Vec<Guidance>>ExplorationSpaceV2 から生成された Guidance
select_nodes() → Guidance 変換で直接生成。 Manager はこれをそのまま Worker に配布できる。
excluded_actions: Vec<String>除外すべきアクション(成功済み/クローズ済み)- プロンプトから除外
previous_guidances: HashMap<WorkerId, Arc<Guidance>>前回の Guidance(Worker ID -> Arc
Orchestrator が Manager.prepare() 呼び出し前に設定。 Manager は prepare() でこれを使って ResolvedContext に ManagerInstruction を埋め込む。 Arc で共有することでクローン時のディープコピーを回避。
done_workers: HashSet<WorkerId>Goal Action(Terminal Action)を達成した Worker これらのWorkerは Manager.prepare() でリクエスト対象から除外される
metadata: HashMap<String, Value>追加メタデータ(軽量LLM分析結果等)
Implementations§
Source§impl TaskContext
impl TaskContext
Sourcepub fn with_worker(self, summary: WorkerSummary) -> Self
pub fn with_worker(self, summary: WorkerSummary) -> Self
Worker サマリを追加
Sourcepub fn with_success_rate(self, rate: f64) -> Self
pub fn with_success_rate(self, rate: f64) -> Self
成功率を設定
Sourcepub fn with_progress(self, progress: f64) -> Self
pub fn with_progress(self, progress: f64) -> Self
進捗を設定
Sourcepub fn with_escalation(
self,
worker_id: WorkerId,
escalation: Escalation,
) -> Self
pub fn with_escalation( self, worker_id: WorkerId, escalation: Escalation, ) -> Self
Escalation を追加
Sourcepub fn with_actions(self, actions: ActionsConfig) -> Self
pub fn with_actions(self, actions: ActionsConfig) -> Self
利用可能なアクションを設定
Sourcepub fn with_previous_guidances(
self,
guidances: HashMap<WorkerId, Arc<Guidance>>,
) -> Self
pub fn with_previous_guidances( self, guidances: HashMap<WorkerId, Arc<Guidance>>, ) -> Self
前回の Guidance を設定(Arc で共有)
Sourcepub fn with_previous_guidance(
self,
worker_id: WorkerId,
guidance: Arc<Guidance>,
) -> Self
pub fn with_previous_guidance( self, worker_id: WorkerId, guidance: Arc<Guidance>, ) -> Self
単一 Worker の前回 Guidance を追加
Sourcepub fn has_escalations(&self) -> bool
pub fn has_escalations(&self) -> bool
Escalation があるか
Sourcepub fn has_escalation_for(&self, worker_id: WorkerId) -> bool
pub fn has_escalation_for(&self, worker_id: WorkerId) -> bool
特定の Worker が Escalation 中かどうか
Sourcepub fn worker(&self, id: WorkerId) -> Option<&WorkerSummary>
pub fn worker(&self, id: WorkerId) -> Option<&WorkerSummary>
特定 Worker の情報を取得
Sourcepub fn escalated_worker_count(&self) -> usize
pub fn escalated_worker_count(&self) -> usize
Escalation 中の Worker 数を取得
Sourcepub fn worker_ids(&self) -> Vec<WorkerId>
pub fn worker_ids(&self) -> Vec<WorkerId>
Worker ID 一覧を取得
Source§impl TaskContext
impl TaskContext
Sourcepub fn has_exploration(&self) -> bool
pub fn has_exploration(&self) -> bool
探索が有効か(v2_guidances がある場合)
Sourcepub fn filter_for_workers(&self, worker_ids: &[WorkerId]) -> TaskContext
pub fn filter_for_workers(&self, worker_ids: &[WorkerId]) -> TaskContext
指定した Worker のみを含むフィルタ済み TaskContext を作成
Manager のパーティショニングで使用。 各 Manager は担当する Worker のみの TaskContext を受け取る。
Trait Implementations§
Source§impl Clone for TaskContext
impl Clone for TaskContext
Source§fn clone(&self) -> TaskContext
fn clone(&self) -> TaskContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaskContext
impl Debug for TaskContext
Auto Trait Implementations§
impl Freeze for TaskContext
impl RefUnwindSafe for TaskContext
impl Send for TaskContext
impl Sync for TaskContext
impl Unpin for TaskContext
impl UnwindSafe for TaskContext
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
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>
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>
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