{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/ValueObject\/SessionMetadata.php",
"old_string": " \/**\n * @param array<string> $collections\n *\/\n private static function validateCollections(array $collections): void\n {\n if (empty($collections)) {\n throw new InvalidArgumentException('Collections cannot be empty');\n }\n\n foreach ($collections as $collection) {\n if (trim($collection) === '') {\n throw new InvalidArgumentException('Each collection must be a non-empty string');\n }\n }\n }",
"new_string": " \/**\n * @param array<string> $collections\n *\/\n private static function validateCollections(array $collections): void\n {\n \/\/ Empty collections allowed - user can chat without RAG context\n foreach ($collections as $collection) {\n if (trim($collection) === '') {\n throw new InvalidArgumentException('Each collection must be a non-empty string');\n }\n }\n }"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/ValueObject\/SessionMetadata.php",
"oldString": " \/**\n * @param array<string> $collections\n *\/\n private static function validateCollections(array $collections): void\n {\n if (empty($collections)) {\n throw new InvalidArgumentException('Collections cannot be empty');\n }\n\n foreach ($collections as $collection) {\n if (trim($collection) === '') {\n throw new InvalidArgumentException('Each collection must be a non-empty string');\n }\n }\n }",
"newString": " \/**\n * @param array<string> $collections\n *\/\n private static function validateCollections(array $collections): void\n {\n \/\/ Empty collections allowed - user can chat without RAG context\n foreach ($collections as $collection) {\n if (trim($collection) === '') {\n throw new InvalidArgumentException('Each collection must be a non-empty string');\n }\n }\n }",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\ValueObject;\n\n\/\/ @responsibility: Immutable Value Object für Chat-Session-Metadaten (Model, Collections, Context, etc.)\n\nuse InvalidArgumentException;\n\nfinal class SessionMetadata\n{\n \/**\n * @param array<string> $collections\n *\/\n private function __construct(\n private string $model,\n private array $collections,\n private int $contextLimit,\n private float $temperature,\n private int $maxTokens\n ) {\n }\n\n \/**\n * @param array<string> $collections\n *\/\n public static function create(\n string $model = 'claude-opus-4-5-20251101',\n array $collections = ['documents'],\n int $contextLimit = 5,\n float $temperature = 0.7,\n int $maxTokens = 4096\n ): self {\n self::validateModel($model);\n self::validateCollections($collections);\n self::validateContextLimit($contextLimit);\n self::validateTemperature($temperature);\n self::validateMaxTokens($maxTokens);\n\n return new self($model, $collections, $contextLimit, $temperature, $maxTokens);\n }\n\n public function getModel(): string\n {\n return $this->model;\n }\n\n \/**\n * @return array<string>\n *\/\n public function getCollections(): array\n {\n return $this->collections;\n }\n\n public function getContextLimit(): int\n {\n return $this->contextLimit;\n }\n\n public function getTemperature(): float\n {\n return $this->temperature;\n }\n\n public function getMaxTokens(): int\n {\n return $this->maxTokens;\n }\n\n public function withModel(string $model): self\n {\n self::validateModel($model);\n\n return new self($model, $this->collections, $this->contextLimit, $this->temperature, $this->maxTokens);\n }\n\n \/**\n * @param array<string> $collections\n *\/\n public function withCollections(array $collections): self\n {\n self::validateCollections($collections);\n\n return new self($this->model, $collections, $this->contextLimit, $this->temperature, $this->maxTokens);\n }\n\n public function withContextLimit(int $contextLimit): self\n {\n self::validateContextLimit($contextLimit);\n\n return new self($this->model, $this->collections, $contextLimit, $this->temperature, $this->maxTokens);\n }\n\n public function withTemperature(float $temperature): self\n {\n self::validateTemperature($temperature);\n\n return new self($this->model, $this->collections, $this->contextLimit, $temperature, $this->maxTokens);\n }\n\n public function withMaxTokens(int $maxTokens): self\n {\n self::validateMaxTokens($maxTokens);\n\n return new self($this->model, $this->collections, $this->contextLimit, $this->temperature, $maxTokens);\n }\n\n private static function validateModel(string $model): void\n {\n if (trim($model) === '') {\n throw new InvalidArgumentException('Model cannot be empty');\n }\n }\n\n \/**\n * @param array<string> $collections\n *\/\n private static function validateCollections(array $collections): void\n {\n if (empty($collections)) {\n throw new InvalidArgumentException('Collections cannot be empty');\n }\n\n foreach ($collections as $collection) {\n if (trim($collection) === '') {\n throw new InvalidArgumentException('Each collection must be a non-empty string');\n }\n }\n }\n\n private static function validateContextLimit(int $contextLimit): void\n {\n if ($contextLimit < 1 || $contextLimit > 20) {\n throw new InvalidArgumentException('Context limit must be between 1 and 20');\n }\n }\n\n private static function validateTemperature(float $temperature): void\n {\n if ($temperature < 0.0 || $temperature > 1.0) {\n throw new InvalidArgumentException('Temperature must be between 0.0 and 1.0');\n }\n }\n\n private static function validateMaxTokens(int $maxTokens): void\n {\n if ($maxTokens < 1 || $maxTokens > 100000) {\n throw new InvalidArgumentException('Max tokens must be between 1 and 100000');\n }\n }\n\n public function equals(self $other): bool\n {\n return $this->model === $other->model\n && $this->collections === $other->collections\n && $this->contextLimit === $other->contextLimit\n && abs($this->temperature - $other->temperature) < 0.0001\n && $this->maxTokens === $other->maxTokens;\n }\n}\n",
"structuredPatch": [
{
"oldStart": 119,
"oldLines": 10,
"newStart": 119,
"newLines": 7,
"lines": [
" *\/",
" private static function validateCollections(array $collections): void",
" {",
"- if (empty($collections)) {",
"- throw new InvalidArgumentException('Collections cannot be empty');",
"- }",
"-",
"+ \/\/ Empty collections allowed - user can chat without RAG context",
" foreach ($collections as $collection) {",
" if (trim($collection) === '') {",
" throw new InvalidArgumentException('Each collection must be a non-empty string');"
]
}
],
"userModified": false,
"replaceAll": false
}
}