Foundation slice for Mantis #841 php/Mod/Agent RFC implementation: * CompleteTask now wraps in DB::transaction with idempotent credit awards and safe current_task_id clearing * Credits/{Award,GetBalance,GetCreditHistory} updated for agent_id + fleet_task_id ledger support and richer balance totals * GenerateCommand canonical agentic:generate wiring; legacy duplicate no longer registered * Boot wires brain:clean / brain:prune / brain:reindex * EmbedMemory exits early when memory already indexed * 3 follow-on fleet migrations reconcile fleet_nodes pointer column, fleet_tasks/credit_entries fk/index hygiene, fleet+credit constraints * 4 foundation tests under php/tests/Feature/Mod/Agent/ php -l clean on all modified files. pest unrunnable in sandbox (no vendor/). Foundation slice only: remaining model/action parity, full MCP tool/ service sweep, fleet controller auth-context, and 41-tool/45-action surface left for follow-up tickets. Co-authored-by: Codex <noreply@openai.com> Closes tasks.lthn.sh/view.php?id=841
49 lines
1,023 B
PHP
49 lines
1,023 B
PHP
<?php
|
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Core\Mod\Agentic\Models;
|
|
|
|
use Core\Tenant\Concerns\BelongsToWorkspace;
|
|
use Core\Tenant\Models\Workspace;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class CreditEntry extends Model
|
|
{
|
|
use BelongsToWorkspace;
|
|
|
|
protected $fillable = [
|
|
'workspace_id',
|
|
'fleet_node_id',
|
|
'fleet_task_id',
|
|
'agent_id',
|
|
'task_type',
|
|
'amount',
|
|
'balance_after',
|
|
'description',
|
|
];
|
|
|
|
protected $casts = [
|
|
'fleet_task_id' => 'integer',
|
|
'amount' => 'integer',
|
|
'balance_after' => 'integer',
|
|
];
|
|
|
|
public function workspace(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Workspace::class);
|
|
}
|
|
|
|
public function fleetNode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(FleetNode::class);
|
|
}
|
|
|
|
public function fleetTask(): BelongsTo
|
|
{
|
|
return $this->belongsTo(FleetTask::class);
|
|
}
|
|
}
|