This repository has been archived on 2026-03-09. You can view files and clone it, but cannot push or open issues or pull requests.
php-agentic/Actions/Forge/AssignAgent.php
Snider 6ac515d80e feat: add AssignAgent, ManagePullRequest, ReportToIssue actions
AssignAgent activates a plan and starts an agent session.
ManagePullRequest evaluates PR state/CI checks and merges when ready.
ReportToIssue posts progress comments on Forgejo issues.

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

40 lines
940 B
PHP

<?php
/*
* Core PHP Framework
*
* Licensed under the European Union Public Licence (EUPL) v1.2.
* See LICENSE file for details.
*/
declare(strict_types=1);
namespace Core\Mod\Agentic\Actions\Forge;
use Core\Actions\Action;
use Core\Mod\Agentic\Actions\Session\StartSession;
use Core\Mod\Agentic\Models\AgentPlan;
use Core\Mod\Agentic\Models\AgentSession;
/**
* Assign an agent to a plan and start a session.
*
* Activates the plan if it is still in draft status, then
* delegates to StartSession to create the working session.
*
* Usage:
* $session = AssignAgent::run($plan, 'opus', $workspaceId);
*/
class AssignAgent
{
use Action;
public function handle(AgentPlan $plan, string $agentType, int $workspaceId): AgentSession
{
if ($plan->status !== AgentPlan::STATUS_ACTIVE) {
$plan->activate();
}
return StartSession::run($agentType, $plan->slug, $workspaceId);
}
}