Files
Genarrative/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_models.rs
T
k88936 839051f532
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 1m50s
Project CI / Backend tests (pull_request) Failing after 24s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m47s
Project CI / Repository checks (pull_request) Failing after 21s
Project CI / Frontend tests (pull_request) Successful in 2m38s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 3m41s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m23s
Project CI / Native shell tests (pull_request) Successful in 6m20s
退役AGC独立Agent Runtime与CLI执行面
- 删除 agent/runtime_driver、runtime_protocol、runtime_tools、runtime_actions、runtime_state、runtime_adapter、context_compaction、collaboration、delegation、goal 等自建 Runtime 执行面及专属测试与 fixture
- CliCommand 收敛为 LlmStatus | EnvironmentCheck | PreviewServe,删除 --agent-run / --agent-task / --agent-goal-* / --agent-resume / --agent-context-compact 等 CLI 与 Tauri 命令白名单条目
- 外部 Runner 收缩为编辑器桥 RPC 与 runner.attach_gui_owner + GUI owner 参与锁 / watchdog,保留 --agent-runner
- 前端删除 AgentRuntime* / AgentGoal* 状态与命令调用链,移除 agent-runtime real-e2e / steer / smoke / llm-transient-fault 脚本与对应 CI job
- 内置工具错误收口为 typed error,抽取 agent/tool/error.rs 共享错误供各工具复用
- 新增 agent/redaction.rs、runtime_models.rs、json_sidecar.rs、task_lock.rs、process_identity.rs、art_manifest.rs、design_session.rs、direct_events.rs
- 同步更新 ADR、decision-log、Runtime V1.1、App 实施计划、本地开发运维、pitfalls 与 CI 脚本
2026-10-02 15:23:12 +08:00

143 lines
5.4 KiB
Rust

use super::*;
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AgentRuntimeToolAction {
#[serde(default)]
pub(crate) tool: String,
#[serde(default)]
pub(crate) reason: Option<String>,
#[serde(default)]
pub(crate) input: serde_json::Value,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AgentRuntimeToolObservation {
pub(crate) tool: String,
pub(crate) status: String,
pub(crate) summary: String,
pub(crate) detail: Option<String>,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub(crate) struct AgentRuntimeProjectRevision {
pub(crate) schema_version: String,
pub(crate) project_id: String,
pub(crate) revision: u64,
pub(crate) updated_at: u64,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub(crate) struct AgentRuntimeProviderRequestSnapshot {
pub(in crate::agent) project_id: String,
pub(in crate::agent) agent_id: String,
pub(in crate::agent) task_id: String,
pub(in crate::agent) session_id: String,
pub(in crate::agent) run_id: String,
pub(in crate::agent) source: String,
pub(in crate::agent) goal_id: Option<String>,
pub(in crate::agent) goal_revision: u64,
pub(in crate::agent) goal_snapshot_fingerprint: String,
pub(in crate::agent) applied_steer_cursor: u64,
pub(in crate::agent) request_kind: String,
pub(in crate::agent) request_slot: String,
pub(in crate::agent) web_search_enabled: bool,
pub(in crate::agent) allow_idle_context_compaction: bool,
}
impl AgentRuntimeProviderRequestSnapshot {
pub(in crate::agent) fn with_request_slot(&self, request_slot: impl Into<String>) -> Self {
let mut snapshot = self.clone();
snapshot.request_slot = request_slot.into();
snapshot
}
pub(in crate::agent) fn with_web_search_enabled(&self, web_search_enabled: bool) -> Self {
let mut snapshot = self.clone();
snapshot.web_search_enabled = web_search_enabled;
snapshot
}
pub(super) fn with_idle_context_compaction(&self, allow: bool) -> Self {
let mut snapshot = self.clone();
snapshot.allow_idle_context_compaction = allow;
snapshot
}
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub(crate) struct AgentRuntimeVerificationGate {
pub(crate) schema_version: String,
pub(crate) project_id: String,
pub(crate) agent_id: String,
pub(crate) run_id: String,
pub(crate) requires_verification: bool,
pub(crate) mutation_revision: Option<u64>,
pub(crate) verified_revision: Option<u64>,
pub(crate) last_mutation_tool: Option<String>,
pub(crate) last_verification_tool: Option<String>,
pub(crate) last_verification_status: Option<String>,
/// `last_verification_*` is deliberately the most recent verification so
/// preview failures can drive the repair loop. Keep the static smoke
/// result separately: a successful `preview.validate` must not erase the
/// proof that the exact same revision passed `game.static_smoke`.
#[serde(default)]
pub(crate) static_smoke_verified_revision: Option<u64>,
/// Bind the durable static-smoke credential to the exact entry bytes.
/// A project revision alone is insufficient because files can be changed
/// outside the Runtime mutation path without advancing that revision.
#[serde(default)]
pub(crate) static_smoke_verified_game_index_sha256: Option<String>,
#[serde(default)]
pub(crate) failed_playtest_revision: Option<u64>,
pub(crate) updated_at: u64,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AgentRuntimePendingToolAction {
pub(crate) schema_version: String,
pub(crate) fingerprint_version: String,
pub(crate) agent_id: String,
pub(crate) task_id: String,
pub(crate) session_id: String,
pub(crate) run_id: String,
pub(crate) source: String,
#[serde(default = "default_agent_runtime_run_profile")]
pub(crate) run_profile: String,
#[serde(default)]
pub(crate) run_profile_binding_fingerprint: String,
pub(crate) task: String,
#[serde(default)]
pub(crate) goal_id: Option<String>,
#[serde(default)]
pub(crate) goal_revision: u64,
#[serde(default)]
pub(crate) goal_snapshot_fingerprint: String,
pub(crate) loop_iteration: u32,
pub(crate) action_index: u32,
pub(crate) occurrence_nonce: u64,
pub(crate) thinking_summary: String,
pub(crate) plan: Vec<String>,
pub(crate) fallback_response: String,
pub(crate) observations: Vec<AgentRuntimeToolObservation>,
pub(crate) project_revision_before: AgentRuntimeProjectRevision,
pub(crate) verification_gate_before: AgentRuntimeVerificationGate,
pub(crate) planned_repository_context_fingerprint: String,
#[serde(default)]
pub(crate) planned_steer_cursor: u64,
pub(crate) action: AgentRuntimeToolAction,
pub(crate) action_id: String,
pub(crate) action_fingerprint: String,
pub(crate) input_summary: Option<String>,
#[serde(default)]
pub(crate) execution_mode: String,
pub(crate) status: String,
pub(crate) observation: Option<AgentRuntimeToolObservation>,
pub(crate) created_at: u64,
pub(crate) updated_at: u64,
}