{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatResponse.php",
"old_string": "<?php\n\nnamespace UseCases\\Chat;\n\n\/**\n * ChatResponse - DTO for chat message results\n *\n * Contains the AI response and all associated metadata.\n *\/\nfinal class ChatResponse",
"new_string": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Ergebnisobjekt für Chat-Nachrichten mit Metadaten\n\nfinal class ChatResponse"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatResponse.php",
"oldString": "<?php\n\nnamespace UseCases\\Chat;\n\n\/**\n * ChatResponse - DTO for chat message results\n *\n * Contains the AI response and all associated metadata.\n *\/\nfinal class ChatResponse",
"newString": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Ergebnisobjekt für Chat-Nachrichten mit Metadaten\n\nfinal class ChatResponse",
"originalFile": "<?php\n\nnamespace UseCases\\Chat;\n\n\/**\n * ChatResponse - DTO for chat message results\n *\n * Contains the AI response and all associated metadata.\n *\/\nfinal class ChatResponse\n{\n public function __construct(\n private string $answer,\n private array $sources = [],\n private ?int $tokensInput = null,\n private ?int $tokensOutput = null,\n private ?float $durationSeconds = null,\n private ?string $error = null,\n private ?array $qualityValidation = null,\n ) {\n }\n\n public function getQualityValidation(): ?array\n {\n return $this->qualityValidation;\n }\n\n public function withQualityValidation(array $validation): self\n {\n return new self(\n answer: $this->answer,\n sources: $this->sources,\n tokensInput: $this->tokensInput,\n tokensOutput: $this->tokensOutput,\n durationSeconds: $this->durationSeconds,\n error: $this->error,\n qualityValidation: $validation,\n );\n }\n\n public function getAnswer(): string\n {\n return $this->answer;\n }\n\n public function getSources(): array\n {\n return $this->sources;\n }\n\n public function getTokensInput(): ?int\n {\n return $this->tokensInput;\n }\n\n public function getTokensOutput(): ?int\n {\n return $this->tokensOutput;\n }\n\n public function getDurationSeconds(): ?float\n {\n return $this->durationSeconds;\n }\n\n public function getError(): ?string\n {\n return $this->error;\n }\n\n public function hasError(): bool\n {\n return $this->error !== null;\n }\n\n \/**\n * Create from AI service response array\n *\/\n public static function fromServiceResponse(array $result, ?float $duration = null): self\n {\n if (isset($result['error'])) {\n return new self(\n answer: '',\n error: $result['error'],\n );\n }\n\n return new self(\n answer: $result['answer'] ?? '',\n sources: $result['sources'] ?? [],\n tokensInput: $result['usage']['input_tokens'] ?? null,\n tokensOutput: $result['usage']['output_tokens'] ?? null,\n durationSeconds: $duration,\n );\n }\n\n \/**\n * Create error response\n *\/\n public static function error(string $message): self\n {\n return new self(\n answer: '',\n error: $message,\n );\n }\n\n \/**\n * Convert to array for view rendering\n *\/\n public function toArray(): array\n {\n return [\n 'answer' => $this->answer,\n 'sources' => $this->sources,\n 'usage' => [\n 'input_tokens' => $this->tokensInput,\n 'output_tokens' => $this->tokensOutput,\n ],\n 'duration_seconds' => $this->durationSeconds,\n 'error' => $this->error,\n 'quality_validation' => $this->qualityValidation,\n ];\n }\n}\n",
"structuredPatch": [
{
"oldStart": 1,
"oldLines": 12,
"newStart": 1,
"newLines": 11,
"lines": [
" <?php",
" ",
"+declare(strict_types=1);",
"+",
" namespace UseCases\\Chat;",
" ",
"-\/**",
"- * ChatResponse - DTO for chat message results",
"- *",
"- * Contains the AI response and all associated metadata.",
"- *\/",
"+\/\/ @responsibility: Ergebnisobjekt für Chat-Nachrichten mit Metadaten",
"+",
" final class ChatResponse",
" {",
" public function __construct("
]
}
],
"userModified": false,
"replaceAll": false
}
}