File size: 683 Bytes
4c76b0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/** Authorization captured when a trusted sessions_spawn request selects a model. */
export type SubagentLaunchAuthorization = {
  modelOverride: {
    provider?: string;
    model: string;
  };
};

/** Applies only the exact model choice authorized during spawn planning. */
export function applySubagentLaunchAuthorization(
  request: Record<string, unknown>,
  authorization?: SubagentLaunchAuthorization,
): Record<string, unknown> {
  const modelOverride = authorization?.modelOverride;
  if (!modelOverride) {
    return request;
  }
  return {
    ...request,
    ...(modelOverride.provider ? { provider: modelOverride.provider } : {}),
    model: modelOverride.model,
  };
}