|
Entropic 2.3.8
Local-first agentic inference engine
|
Orchestrates child loop creation and execution. More...
#include <entropic/core/delegation.h>
Public Member Functions | |
| DelegationManager (RunChildLoopFn run_child, void *run_child_data, const TierResolutionInterface &tier_resolution, const std::filesystem::path &repo_dir={}, SandboxManager *sandbox_mgr=nullptr) | |
| Construct with engine loop callback and tier resolution. | |
| void | set_todo_callbacks (const TodoCallbacks &callbacks) |
| Set todo list save/restore callbacks. | |
| void | set_dir_swap (ScopedSandbox::SwapDirFn swap_fn, void *user_data) |
| Set directory swap callback for ScopedSandbox. | |
| void | set_storage (const struct StorageInterface *storage) |
| Set storage interface for delegation record persistence. | |
| void | set_delegation_callbacks (ent_decision_t(*on_start)(const ent_delegation_request_t *, void *), ent_decision_t(*on_complete)(const ent_delegation_result_t *, void *), void *user_data) |
| Set delegation start/complete callbacks (gh#29, v2.1.5). | |
| DelegationResult | execute_delegation (LoopContext &parent_ctx, const std::string &target_tier, const std::string &task, std::optional< int > max_turns=std::nullopt) |
| Run a child inference loop for the target tier. | |
| DelegationResult | execute_resume_delegation (LoopContext &parent_ctx, const std::string &target_tier, const std::string &task, std::vector< Message > seed_history, std::optional< int > max_turns=std::nullopt) |
| Resume a prior delegation with pre-loaded conversation history. | |
| DelegationResult | execute_pipeline (LoopContext &parent_ctx, const std::vector< std::string > &stages, const std::string &task) |
| Run a multi-stage delegation pipeline sequentially. | |
Orchestrates child loop creation and execution.
Builds a fresh LoopContext for the target tier, runs the engine's loop to completion, and extracts the final assistant message as the delegation result. Manages worktree lifecycle (create, merge, discard) and todo list save/restore across child contexts.
Definition at line 105 of file delegation.h.
| entropic::DelegationManager::DelegationManager | ( | RunChildLoopFn | run_child, |
| void * | run_child_data, | ||
| const TierResolutionInterface & | tier_resolution, | ||
| const std::filesystem::path & | repo_dir = {}, |
||
| SandboxManager * | sandbox_mgr = nullptr |
||
| ) |
Construct with engine loop callback and tier resolution.
gh#33 (v2.1.6): pre-2.1.6 this constructor owned a fresh SandboxManager per delegation. The manager is now engine-scoped and supplied as a non-owning pointer by the caller (AgentEngine); passing nullptr disables sandboxing for the delegation.
| run_child | Callback to run child engine loop. |
| run_child_data | Opaque pointer for run_child. |
| tier_resolution | Tier resolution interface. |
| repo_dir | Optional repo root (informational; used for ScopedSandbox dir-swap and storage record metadata). |
| sandbox_mgr | Non-owning, engine-scoped sandbox manager. May be nullptr (delegation runs without an isolated sandbox). |
| run_child | Callback to run child engine loop. |
| run_child_data | Opaque pointer for run_child. |
| tier_resolution | Tier resolution interface. |
| repo_dir | Optional project root (informational metadata). |
| sandbox_mgr | Non-owning, engine-scoped sandbox manager. |
Definition at line 40 of file delegation.cpp.
| DelegationResult entropic::DelegationManager::execute_delegation | ( | LoopContext & | parent_ctx, |
| const std::string & | target_tier, | ||
| const std::string & | task, | ||
| std::optional< int > | max_turns = std::nullopt |
||
| ) |
Run a child inference loop for the target tier.
| parent_ctx | Parent loop context. |
| target_tier | Tier name to delegate to. |
| task | Task description for the child. |
| max_turns | Optional iteration limit for child loop. |
| parent_ctx | Parent loop context. |
| target_tier | Tier name to delegate to. |
| task | Task description for the child. |
| max_turns | Optional iteration limit. |
Definition at line 350 of file delegation.cpp.
| DelegationResult entropic::DelegationManager::execute_pipeline | ( | LoopContext & | parent_ctx, |
| const std::vector< std::string > & | stages, | ||
| const std::string & | task | ||
| ) |
Run a multi-stage delegation pipeline sequentially.
| parent_ctx | Parent loop context. |
| stages | Ordered list of tier names. |
| task | Task description (shared across stages). |
Issue #11 (v2.1.4): each stage now receives the prior stage's output as a [PRIOR STAGE OUTPUT] block in its task message (forward-carry semantics — the original intent that pre-2.1.4 was lost to per-stage isolation).
| parent_ctx | Parent loop context. |
| stages | Ordered list of tier names. |
| task | Task description. |
Definition at line 547 of file delegation.cpp.
| DelegationResult entropic::DelegationManager::execute_resume_delegation | ( | LoopContext & | parent_ctx, |
| const std::string & | target_tier, | ||
| const std::string & | task, | ||
| std::vector< Message > | seed_history, | ||
| std::optional< int > | max_turns = std::nullopt |
||
| ) |
Resume a prior delegation with pre-loaded conversation history.
Run a resumed child delegation with seed history (gh#32, v2.1.6).
gh#32 (v2.1.6): Seeds the child context with seed_history (loaded from storage by the engine), then appends the supplied task as a fresh user message. Subsequent run_child semantics are identical to execute_delegation. The first system message from the loaded history is preserved; if absent, the tier's default system prompt is prepended so the child still has its identity context.
| parent_ctx | Parent loop context. |
| target_tier | Tier resolved by the engine from storage. |
| task | New sub-task to append to history. |
| seed_history | Pre-loaded conversation messages. |
| max_turns | Optional iteration limit. |
Definition at line 452 of file delegation.cpp.
| void entropic::DelegationManager::set_delegation_callbacks | ( | ent_decision_t(*)(const ent_delegation_request_t *, void *) | on_start, |
| ent_decision_t(*)(const ent_delegation_result_t *, void *) | on_complete, | ||
| void * | user_data | ||
| ) |
Set delegation start/complete callbacks (gh#29, v2.1.5).
Set delegation start/complete callbacks.
Forwarded by the engine from entropic_set_delegation_callbacks. on_start is invoked before each child loop runs and may veto the delegation (REJECT). on_complete receives the sandbox patch artifact; ACCEPT means the consumer applied it (sandbox is discarded), REJECT or NULL means the engine writes the patch to <session>/pending/<id>.patch as a default-deny fallback.
| on_start | Pre-delegation gate (nullable). |
| on_complete | Post-delegation result (nullable). |
| user_data | Forwarded to both callbacks. |
| on_start | Pre-delegation gate (nullable). |
| on_complete | Post-delegation result (nullable). |
| user_data | Forwarded to both callbacks. |
Definition at line 94 of file delegation.cpp.
| void entropic::DelegationManager::set_dir_swap | ( | ScopedSandbox::SwapDirFn | swap_fn, |
| void * | user_data | ||
| ) |
Set directory swap callback for ScopedSandbox.
| swap_fn | Directory swap callback. |
| user_data | Opaque pointer for swap_fn. |
| swap_fn | Directory swap callback. |
| user_data | Opaque pointer for swap_fn. |
Definition at line 70 of file delegation.cpp.
| void entropic::DelegationManager::set_storage | ( | const struct StorageInterface * | storage | ) |
Set storage interface for delegation record persistence.
| storage | Storage callbacks (nullable). |
| storage | Storage callbacks (nullable). |
Definition at line 82 of file delegation.cpp.
| void entropic::DelegationManager::set_todo_callbacks | ( | const TodoCallbacks & | callbacks | ) |
Set todo list save/restore callbacks.
| callbacks | Todo callbacks. |
| callbacks | Todo callbacks. |
Definition at line 59 of file delegation.cpp.