agent/php/Mcp/Tools/Agent/Session/SessionContinue.php
Snider bb88604045 feat(core): wire Core framework into agentic + monitor subsystems
Phase 2 of Core DI migration:
- Add *core.Core field + SetCore() to PrepSubsystem and monitor.Subsystem
- Register agentic/monitor/brain as Core services with lifecycle hooks
- Mark SetCompletionNotifier and SetNotifier as deprecated (removed in Phase 3)
- Fix monitor test to match actual event names
- initServices() now wires Core refs before legacy callbacks

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 14:44:53 +00:00

73 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Core\Mod\Agentic\Mcp\Tools\Agent\Session;
use Core\Mod\Agentic\Actions\Session\ContinueSession;
use Core\Mod\Agentic\Mcp\Tools\Agent\AgentTool;
/**
* Continue from a previous session (multi-agent handoff).
*/
class SessionContinue extends AgentTool
{
protected string $category = 'session';
protected array $scopes = ['write'];
public function name(): string
{
return 'session_continue';
}
public function description(): string
{
return 'Continue from a previous session (multi-agent handoff)';
}
public function inputSchema(): array
{
return [
'type' => 'object',
'properties' => [
'previous_session_id' => [
'type' => 'string',
'description' => 'Session ID to continue from',
],
'agent_type' => [
'type' => 'string',
'description' => 'New agent type taking over',
],
],
'required' => ['previous_session_id', 'agent_type'],
];
}
public function handle(array $args, array $context = []): array
{
try {
$session = ContinueSession::run(
$args['previous_session_id'] ?? '',
$args['agent_type'] ?? '',
);
$inheritedContext = $session->context_summary ?? [];
return $this->success([
'session' => [
'session_id' => $session->session_id,
'agent_type' => $session->agent_type,
'status' => $session->status,
'plan' => $session->plan?->slug,
],
'continued_from' => $inheritedContext['continued_from'] ?? null,
'previous_agent' => $inheritedContext['previous_agent'] ?? null,
'handoff_notes' => $inheritedContext['handoff_notes'] ?? null,
'inherited_context' => $inheritedContext['inherited_context'] ?? null,
]);
} catch (\InvalidArgumentException $e) {
return $this->error($e->getMessage());
}
}
}