(value: unknown)
| 49 | } |
| 50 | |
| 51 | function stableStringify(value: unknown): string { |
| 52 | if (value === null || value === undefined) return String(value); |
| 53 | if (typeof value !== "object") return JSON.stringify(value); |
| 54 | if (Array.isArray(value)) return `[${value.map((v) => stableStringify(v)).join(",")}]`; |
| 55 | const record = value as Record<string, unknown>; |
| 56 | const keys = Object.keys(record).sort(); |
| 57 | return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify(record[k])}`).join(",")}}`; |
| 58 | } |
| 59 | |
| 60 | function computeOperationKey(toolName: string, params: Record<string, unknown>): string { |
| 61 | // "Exact match" key: stable stringify + hash for compact storage. |
no outgoing calls
no test coverage detected