perf(cli): keep the session caller check off the actor codec's module graph

The check runs at the CLI entry for every command, and the actor codec pulls zod through the session
record. Compare the session's own spellings as plain strings instead.
This commit is contained in:
Brennan Benson
2026-09-25 18:41:26 -07:00
parent 1729a904cf
commit 0c439edc4a
+5 -3
View File
@@ -11,7 +11,6 @@
import type { CommandSpec, IdentityFlag } from './command-spec'
import { RuntimeClientError } from './runtime/types'
import { readInjectedAgentSessionId } from '../shared/agent-session-caller-env'
import { normalizeOrchestrationActor } from '../shared/orchestration-actor'
import { isStructuredWorkerHandle } from '../shared/structured-worker-handle'
export function refuseConflictingSessionCallerFlags(
@@ -42,10 +41,13 @@ export function refuseConflictingSessionCallerFlags(
const IDENTITY_FLAGS: readonly IdentityFlag[] = ['from', 'terminal']
/** The session's own spellings, plus the handle a structured worker session was minted. */
/**
* The session's own spellings, plus the handle a structured worker session was minted. Plain
* strings: this runs at the CLI entry for every command, before the actor codec's module graph.
*/
function namesInjectedSession(value: string, sessionId: string, env: NodeJS.ProcessEnv): boolean {
return (
normalizeOrchestrationActor(value)?.id === sessionId || value === injectedSessionAddress(env)
value === sessionId || value === `session:${sessionId}` || value === injectedSessionAddress(env)
)
}