{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatResponse.php",
"old_string": " 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 ];\n }",
"new_string": " 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 }"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatResponse.php",
"oldString": " 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 ];\n }",
"newString": " 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 }",
"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 ];\n }\n}\n",
"structuredPatch": [
{
"oldStart": 119,
"oldLines": 6,
"newStart": 119,
"newLines": 7,
"lines": [
" ],",
" 'duration_seconds' => $this->durationSeconds,",
" 'error' => $this->error,",
"+ 'quality_validation' => $this->qualityValidation,",
" ];",
" }",
" }"
]
}
],
"userModified": false,
"replaceAll": false
}
}