mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 16:02:55 +00:00
* feat(agent-launch): let a caller reserve the chat session and carry session picks to a terminal launch * fix(agent-launch): keep a caller-minted session id named for its agent, and mint the fallback the same way * test(mobile): model the older host from the launch fields, not the refined schema * docs(agent-launch): describe the reserved session id as conversation identity, not placement The caller mints the session id so it knows which conversation it started; tab placement is not keyed on it. Also puts the terminal surface's doc comment back on createTerminalSurface. * docs(agent-launch): say a terminal launch reads the session picks on the wire contract The `sessionOptions` field doc still said a terminal launch ignores them, which this branch changed. * fix(agent-launch): check a reserved session id's token after the agent name, not the whole id A hyphenated agent name failed the one-token check, so any session id for such an agent was refused at the wire, while every other agent without a chat has its id ignored on the terminal.
25 lines
1004 B
TypeScript
25 lines
1004 B
TypeScript
import type { AgentLaunchPreferences } from './agent-session-host-authority'
|
|
|
|
/** Session options as the model, effort and mode a launch starts with; one converter for every lane,
|
|
* so a structured create and a terminal launch read the same picks the same way. */
|
|
export function toAgentLaunchPreferences(
|
|
sessionOptions: Readonly<Record<string, unknown>> | null | undefined
|
|
): AgentLaunchPreferences | undefined {
|
|
if (!sessionOptions) {
|
|
return undefined
|
|
}
|
|
const readString = (key: keyof AgentLaunchPreferences): string | undefined => {
|
|
const value = sessionOptions[key]
|
|
return typeof value === 'string' && value.trim() ? value.trim() : undefined
|
|
}
|
|
const model = readString('model')
|
|
const effort = readString('effort')
|
|
const mode = readString('mode')
|
|
const preferences: AgentLaunchPreferences = {
|
|
...(model ? { model } : {}),
|
|
...(effort ? { effort } : {}),
|
|
...(mode ? { mode } : {})
|
|
}
|
|
return Object.keys(preferences).length > 0 ? preferences : undefined
|
|
}
|