PicoBot/src/agent/mod.rs
xiaoxixi 554d4b15ac feat: wire run quota and signal delivery persistence; remove redundant compat code
- RunQuota now enforced: background admission acquires the run permit
  (global→session) and the runner holds it until terminal commit;
  foreground never takes run permits so nested limit=1 cannot deadlock
- RuntimeAdmission activity guard held by background runners for the
  whole run; admission checked before any durable write
- signal_contract_json/signal_delivery persisted at run admission so
  definition-level steer delivery actually takes effect (was silently
  falling back to queue)
- terminal completion payload carries the run's emitted signal IDs
  (design §12.3) so the main Agent can recognise duplicates
- ROOT caller_scope_id is the literal "ROOT" (design §9.6)
- legacy general delegation returns a deprecation/migration hint

Cleanup:
- remove unused AgentCaller enum and run_parallel wrapper
- remove unreachable http_get_only prompt machinery (http_request is
  RootOnly and never enters sub-agent registries)
- drop never-read EmittedSignal fields; derive WakeupSource from
  TurnInputSource instead of duplicating match arms
- replace the /stop oneshot compatibility bridge with a plain turn_busy
  flag; the worker's forced-cancel path now selects on the cancellation
  token (implementation doc §11.1)

Version 1.8.0
2026-08-11 15:24:49 +08:00

35 lines
1.2 KiB
Rust

pub mod agent_loop;
pub mod catalog;
pub mod context_compressor;
pub mod coordinator;
pub mod definition;
pub mod gate;
pub mod inbox;
pub mod media_handler;
pub mod projection;
pub mod run;
pub mod steering;
pub mod sub_agent;
pub mod system_prompt;
pub mod turn_event;
pub use agent_loop::{AgentError, AgentLoop, AgentProcessResult};
pub use catalog::{AgentCatalog, AgentCatalogError};
pub use context_compressor::{ContextCompressor, estimate_tokens};
pub use coordinator::{AgentCoordinator, CoordinatorError};
pub use definition::{AgentDefinition, AgentLimits};
pub use gate::ExecutionGate;
pub use inbox::{AgentInboxNotifier, AgentInboxWakeTarget};
pub use projection::AgentProjectionHub;
pub use run::{AgentBudget, AgentExecutionContext};
pub use steering::{SteeringDrain, SteeringPushError, TurnInput, TurnInputSource, TurnMailbox};
pub use sub_agent::{
DelegateContext, ExecutionMode, SubAgentConfig, SubAgentError, SubAgentManager, SubAgentResult,
TaskNotification, TaskStatus,
};
pub use system_prompt::{
PromptContext, PromptSection, SystemPromptBuilder, build_sub_agent_system_prompt,
build_system_prompt,
};
pub use turn_event::{AgentTurnContext, TurnEmitError, TurnEmitter, TurnEvent};