> */ public function listOpen(): array { $response = $this->request()->get('/api/rest/issues', [ 'status' => 'new', ]); if (! $response->successful()) { throw new RuntimeException("Mantis listOpen failed: {$response->status()}"); } $issues = $response->json('issues'); return is_array($issues) ? array_values(array_filter($issues, 'is_array')) : []; } public function note(int $ticketId, string $text): void { $response = $this->request()->post("/api/rest/issues/{$ticketId}/notes", [ 'text' => $text, ]); if (! $response->successful()) { throw new RuntimeException("Mantis note failed: {$response->status()}"); } } public function close(int $ticketId, string $resolution = 'fixed'): void { $response = $this->request()->patch("/api/rest/issues/{$ticketId}", [ 'status' => [ 'name' => 'closed', ], 'resolution' => [ 'name' => $resolution, ], ]); if (! $response->successful()) { throw new RuntimeException("Mantis close failed: {$response->status()}"); } } private function request(): PendingRequest { return Http::acceptJson() ->baseUrl($this->resolveBaseUrl()) ->withHeaders([ 'Authorization' => $this->resolveToken(), ]) ->timeout(15); } private function resolveBaseUrl(): string { return rtrim( $this->baseUrl ?? (string) config('agentic.mantis.base_url', 'https://tasks.lthn.sh'), '/', ); } private function resolveToken(): string { return $this->token ?? (string) config('agentic.mantis.token'); } }