agent/php/Mcp/Data/QuotaResult.php
Snider 09054fbdab feat(mcp): implement §3 Services (ToolRegistry + McpQuotaService + QueryAuditService + ToolDependencyService) (#851)
Additive-only — no existing files modified.

- ToolRegistry: register/resolve/listTools/buildDependencyGraph
  - Singleton via registerSingleton() entry point (no Boot.php wire-in
    per scope; tests cover the binding path)
- McpQuotaService: workspace-scoped checkQuota/consume/reset
- QueryAuditService: log/query/aggregate (expects mcp_audit_entries
  table; tests create inline as migration was out-of-scope)
- ToolDependencyService: validateDependencies via graph traversal

Data DTOs: ToolMetadata, QuotaResult, AuditEntry as readonly.
Pest Feature tests _Good/_Bad/_Ugly per AX-10.
pest skipped (vendor binaries missing).

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=851
2026-04-25 05:14:15 +01:00

35 lines
828 B
PHP

<?php
// SPDX-License-Identifier: EUPL-1.2
declare(strict_types=1);
namespace Core\Mod\Agentic\Mcp\Data;
use Carbon\CarbonImmutable;
final readonly class QuotaResult
{
public function __construct(
public string $workspaceId,
public string $period,
public int $limit,
public int $used,
public int $remaining,
public CarbonImmutable $resetAt,
public bool $exceeded,
) {}
public function toArray(): array
{
return [
'workspace_id' => $this->workspaceId,
'period' => $this->period,
'limit' => $this->limit,
'used' => $this->used,
'remaining' => $this->remaining,
'reset_at' => $this->resetAt->toIso8601String(),
'exceeded' => $this->exceeded,
];
}
}