mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
fix(voice): refuse unrequested Gemini tool calls and share pointer turns
in push-to-talk, answer a Gemini tool call that arrives with no input, reply or tool result outstanding with a failure instead of running it, and refuse every other call in the reply it starts, including one after unprompted speech; the reply stays tracked so the next input retires it and its late boundary cannot close the user's turn in push-to-talk, a caption that arrives after its turn ended no longer opens a reply, so the next request is not retired with its tool calls discarded open mic cannot tell either case from a new reply and stays unchanged check packet ownership after the narration callback before queuing tools, and raise the per-connection call history to 4096 IDs move the pointer turn event, context item and announcement into pointerContext so the OpenAI and Gemini controllers share them, and drop the Gemini token route's copy of the shared exact-Origin comparison
This commit is contained in:
1 parent
bd2342dc81
commit
1c727842df
7 files changed
+448
-91
No files matched your search
@@ -17,6 +17,7 @@ export function isGeminiRequestOriginAllowed(
|
||||
typeof host !== 'string' ||
|
||||
typeof origin !== 'string' ||
|
||||
!host ||
|
||||
!origin ||
|
||||
/[\s/?#@\\]/.test(host)
|
||||
)
|
||||
return false;
|
||||
@@ -31,29 +32,14 @@ export function isGeminiRequestOriginAllowed(
|
||||
}).ok
|
||||
)
|
||||
return false;
|
||||
// The shared gate compares a present Origin exactly with this authority;
|
||||
// this route also requires the Origin and an allowed Host.
|
||||
const boundHost = String(configuredHost || '')
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
if (
|
||||
!isAllowedHost(host, resolveAllowedHosts(configuredAllowedHosts), [
|
||||
boundHost,
|
||||
])
|
||||
)
|
||||
return false;
|
||||
try {
|
||||
const authority = new URL(`${protocol}//${host}`);
|
||||
const source = new URL(origin);
|
||||
return (
|
||||
source.origin === authority.origin &&
|
||||
source.username === '' &&
|
||||
source.password === '' &&
|
||||
source.pathname === '/' &&
|
||||
source.search === '' &&
|
||||
source.hash === ''
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return isAllowedHost(host, resolveAllowedHosts(configuredAllowedHosts), [
|
||||
boundHost,
|
||||
]);
|
||||
}
|
||||
|
||||
/** Admit only the existing input gesture; callers cannot supply model/setup. */
|
||||
|
||||
Reference in new issue
Block a user