* feat: add prek pre-commit hooks and dependabot Pre-commit hooks (via prek): - Basic hygiene: trailing-whitespace, end-of-file-fixer, check-yaml, check-added-large-files, check-merge-conflict - Security: detect-secrets, zizmor (GitHub Actions audit) - Linting: shellcheck, actionlint, oxlint, swiftlint - Formatting: oxfmt, swiftformat Dependabot: - npm and GitHub Actions ecosystems - Grouped updates (production/development/actions) - 7-day cooldown for supply chain protection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add prek install instruction to AGENTS.md --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
34 lines
1011 B
TypeScript
34 lines
1011 B
TypeScript
import type { CallId, CallRecord } from "../types.js";
|
|
|
|
export function getCallByProviderCallId(params: {
|
|
activeCalls: Map<CallId, CallRecord>;
|
|
providerCallIdMap: Map<string, CallId>;
|
|
providerCallId: string;
|
|
}): CallRecord | undefined {
|
|
const callId = params.providerCallIdMap.get(params.providerCallId);
|
|
if (callId) {
|
|
return params.activeCalls.get(callId);
|
|
}
|
|
|
|
for (const call of params.activeCalls.values()) {
|
|
if (call.providerCallId === params.providerCallId) {
|
|
return call;
|
|
}
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
export function findCall(params: {
|
|
activeCalls: Map<CallId, CallRecord>;
|
|
providerCallIdMap: Map<string, CallId>;
|
|
callIdOrProviderCallId: string;
|
|
}): CallRecord | undefined {
|
|
const directCall = params.activeCalls.get(params.callIdOrProviderCallId);
|
|
if (directCall) return directCall;
|
|
return getCallByProviderCallId({
|
|
activeCalls: params.activeCalls,
|
|
providerCallIdMap: params.providerCallIdMap,
|
|
providerCallId: params.callIdOrProviderCallId,
|
|
});
|
|
}
|