feat(tool-metadata): add shared metadata contract and bridge

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-16 13:51:58 +09:00
parent 80e73f5727
commit a1842f2de7
10 changed files with 646 additions and 0 deletions
@@ -0,0 +1,26 @@
import { log } from "../../shared/logger"
export interface ToolCallIDCarrier {
callID?: string
callId?: string
call_id?: string
}
function normalizeCallID(value: unknown): string | undefined {
if (typeof value !== "string") {
return undefined
}
const trimmed = value.trim()
return trimmed === "" ? undefined : trimmed
}
export function resolveToolCallID(ctx: ToolCallIDCarrier): string | undefined {
const resolved = normalizeCallID(ctx.callID) ?? normalizeCallID(ctx.callId) ?? normalizeCallID(ctx.call_id)
if (!resolved) {
log("[tool-metadata-store] Missing tool call ID for metadata correlation")
}
return resolved
}