{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatResponse.php",
"content": "<?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 ) {\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"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatResponse.php",
"content": "<?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 ) {\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": [],
"originalFile": null
}
}