Files
orca/src/main/ipc/desktop-renderer-runtime-capabilities.ts
T
Brennan Benson 32a53d3ec6 feat(native-chat): image messages wait in the queue like text (#28655)
* feat(native-chat): image messages wait in the queue like text

A message with images now queues behind the running turn and the cards
ahead of it, instead of skipping the queue. Cards show an image icon and
count, an image-only card names its image, and editing a card's text keeps
its images. The host publishes no card holding an image to a client that
has not advertised agent-session.queued-image-cards.v1, since released
clients edit by copying a card's text and deleting the card.

* test(native-chat): an image follow-up queues like text

* fix(native-chat): project queued images before phone frame limits

* fix(native-chat): preserve image sends from older clients

* Clarify direct text recovery at send admission

* fix(native-chat): expose queued image names to keyboard users
2026-10-17 00:07:29 -07:00

74 lines
4.4 KiB
TypeScript

import { AGENT_SESSION_CURRENT_REQUESTS_CLIENT_CAPABILITY } from '../../shared/agent-session-current-requests-capability'
import {
AGENT_SESSION_ACCEPTED_SEND_RUNTIME_CAPABILITY,
AGENT_SESSION_BACKGROUND_TASK_ROW_STOP_CAPABILITY,
AGENT_SESSION_BACKGROUND_TASK_STOP_CAPABILITY,
AGENT_SESSION_PENDING_SEND_RESULT_RUNTIME_CAPABILITY,
AGENT_SESSION_QUEUED_IMAGE_CARDS_CLIENT_CAPABILITY,
AGENT_SESSION_SNAPSHOT_CATCH_UP_CLIENT_CAPABILITY,
AGENT_SESSION_TURN_ITEM_CAPABILITY,
CLAUDE_STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY,
PI_STRUCTURED_DIALOGS_RUNTIME_CAPABILITY,
REPO_SEARCH_QUALIFIED_REFS_RUNTIME_CAPABILITY,
STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY,
STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY,
STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY,
type RuntimeCapability
} from '../../shared/protocol-version'
import { AGENT_SESSION_CREATE_MESSAGE_RUNTIME_CAPABILITY } from '../../shared/agent-session-create-capabilities'
import { AGENT_SESSION_OPTIONAL_MODEL_CLIENT_CAPABILITY } from '../../shared/agent-session-optional-model-capability'
import {
AGENT_LAUNCH_PROMPT_UNCONFIRMED_RUNTIME_CAPABILITY,
AGENT_LAUNCH_RUNTIME_CAPABILITY,
AGENT_LAUNCH_TAB_CLOSED_CLIENT_CAPABILITY
} from '../../shared/agent-launch-runtime-capability'
import { AGENT_SESSION_BACKGROUND_TASK_CHILD_VIEWS_CAPABILITY } from '../../shared/agent-session-background-task-child-views-capability'
import { TERMINAL_QUICK_COMMAND_LONG_PROMPTS_RUNTIME_CAPABILITY } from '../../shared/terminal-quick-command-capabilities'
/**
* What the desktop renderer advertises when it calls its own main process over `runtime:call`.
*
* Main and the renderer ship as one build, so nothing here is about version skew — the renderer
* arrives as `clientKind: 'runtime'`, not in the `clientKind === undefined` population, so any
* capability the host uses as an authorization gate has to be named here or the method is refused.
* That is why this stays a curated set rather than the remote list: several remote-only entries
* would change local behaviour if adopted (`SESSION_TAB_CLOSE_INTENT` alone would start refusing
* an unattributed desktop tab close), the lists remain curated for those reasons.
*
* One constant, not one list per dispatch path: the unary and streaming handlers held separate
* copies, and a capability added to one and missed on the other is invisible until a user hits it.
*/
export const DESKTOP_RENDERER_RUNTIME_CLIENT_CAPABILITIES: readonly RuntimeCapability[] = [
AGENT_SESSION_CREATE_MESSAGE_RUNTIME_CAPABILITY,
AGENT_SESSION_CURRENT_REQUESTS_CLIENT_CAPABILITY,
AGENT_SESSION_BACKGROUND_TASK_STOP_CAPABILITY,
AGENT_SESSION_PENDING_SEND_RESULT_RUNTIME_CAPABILITY,
AGENT_SESSION_ACCEPTED_SEND_RUNTIME_CAPABILITY,
// The renderer settles acknowledged echoes from the read cursor even when a snapshot skips them.
AGENT_SESSION_SNAPSHOT_CATCH_UP_CLIENT_CAPABILITY,
AGENT_SESSION_TURN_ITEM_CAPABILITY,
AGENT_SESSION_BACKGROUND_TASK_ROW_STOP_CAPABILITY,
AGENT_SESSION_BACKGROUND_TASK_CHILD_VIEWS_CAPABILITY,
// Its queued cards show their images, and Edit keeps them.
AGENT_SESSION_QUEUED_IMAGE_CARDS_CLIENT_CAPABILITY,
STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY,
CLAUDE_STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY,
AGENT_SESSION_OPTIONAL_MODEL_CLIENT_CAPABILITY,
// The renderer reads `agentSession.agents` and renders a chat tab of any agent its host lists.
STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY,
PI_STRUCTURED_DIALOGS_RUNTIME_CAPABILITY,
STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY,
REPO_SEARCH_QUALIFIED_REFS_RUNTIME_CAPABILITY,
// Without this `supportsAgentLaunch` refuses the renderer outright, while the same renderer
// targeting a remote host is admitted — the asymmetry this constant exists to close.
AGENT_LAUNCH_RUNTIME_CAPABILITY,
// A replay after a restart mid-delivery answers the running agent with an `unconfirmed` prompt,
// which the desktop reads, rather than refusing it as unknown.
AGENT_LAUNCH_PROMPT_UNCONFIRMED_RUNTIME_CAPABILITY,
// A launch whose tab the user closed is answered as exactly that, which the desktop stays silent
// on, rather than as unknown, which it would report as a failure.
AGENT_LAUNCH_TAB_CLOSED_CLIENT_CAPABILITY,
// Same build as its host, so it reads every quick-command prompt the host stores.
TERMINAL_QUICK_COMMAND_LONG_PROMPTS_RUNTIME_CAPABILITY
] as const