{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/ValueObject\/ExecutionMetrics.php",
"old_string": "\/\/ @responsibility: Immutables Value Object für Ausführungs-Metriken (Tokens + Kosten + Dauer)\n\nfinal class ExecutionMetrics",
"new_string": "\/\/ @responsibility: Immutables Value Object für Ausführungs-Metriken (Tokens + Kosten + Dauer)\n\nuse Domain\\Constants;\n\nfinal class ExecutionMetrics"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/ValueObject\/ExecutionMetrics.php",
"oldString": "\/\/ @responsibility: Immutables Value Object für Ausführungs-Metriken (Tokens + Kosten + Dauer)\n\nfinal class ExecutionMetrics",
"newString": "\/\/ @responsibility: Immutables Value Object für Ausführungs-Metriken (Tokens + Kosten + Dauer)\n\nuse Domain\\Constants;\n\nfinal class ExecutionMetrics",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\ValueObject;\n\n\/\/ @responsibility: Immutables Value Object für Ausführungs-Metriken (Tokens + Kosten + Dauer)\n\nfinal class ExecutionMetrics\n{\n private function __construct(\n private TokenCount $tokens,\n private ?float $costUsd,\n private ?int $durationMs\n ) {\n }\n\n public static function create(TokenCount $tokens, ?float $costUsd = null, ?int $durationMs = null): self\n {\n return new self($tokens, $costUsd, $durationMs);\n }\n\n public static function zero(): self\n {\n return new self(TokenCount::zero(), null, null);\n }\n\n public static function fromEstimation(string $request, string $response): self\n {\n $inputTokens = max(1, (int) (strlen($request) \/ 4));\n $outputTokens = max(1, (int) (strlen($response) \/ 4));\n\n return new self(TokenCount::create($inputTokens, $outputTokens), null, null);\n }\n\n public function tokens(): TokenCount\n {\n return $this->tokens;\n }\n\n public function costUsd(): ?float\n {\n return $this->costUsd;\n }\n\n public function durationMs(): ?int\n {\n return $this->durationMs;\n }\n\n public function withCost(float $costUsd): self\n {\n return new self($this->tokens, $costUsd, $this->durationMs);\n }\n\n public function withDuration(int $durationMs): self\n {\n return new self($this->tokens, $this->costUsd, $durationMs);\n }\n\n public function withTokens(TokenCount $tokens): self\n {\n return new self($tokens, $this->costUsd, $this->durationMs);\n }\n\n public function hasCost(): bool\n {\n return $this->costUsd !== null;\n }\n\n public function hasDuration(): bool\n {\n return $this->durationMs !== null;\n }\n\n public function format(): string\n {\n $parts = [$this->tokens->format()];\n\n if ($this->costUsd !== null) {\n $parts[] = sprintf('$%.4f', $this->costUsd);\n }\n\n if ($this->durationMs !== null) {\n if ($this->durationMs < 1000) {\n $parts[] = \"{$this->durationMs}ms\";\n } else {\n $parts[] = sprintf('%.2fs', $this->durationMs \/ 1000);\n }\n }\n\n return implode(' | ', $parts);\n }\n\n public function toArray(): array\n {\n return [\n 'tokens_input' => $this->tokens->input(),\n 'tokens_output' => $this->tokens->output(),\n 'tokens_total' => $this->tokens->total(),\n 'cost_usd' => $this->costUsd,\n 'duration_ms' => $this->durationMs,\n ];\n }\n}\n",
"structuredPatch": [
{
"oldStart": 6,
"oldLines": 6,
"newStart": 6,
"newLines": 8,
"lines": [
" ",
" \/\/ @responsibility: Immutables Value Object für Ausführungs-Metriken (Tokens + Kosten + Dauer)",
" ",
"+use Domain\\Constants;",
"+",
" final class ExecutionMetrics",
" {",
" private function __construct("
]
}
],
"userModified": false,
"replaceAll": false
}
}