Skip to content

refactor(site/src/pages/AgentsPage): extract the composer runtime from AgentChatInput - #30632

Closed
DanielleMaywood wants to merge 1 commit into
refactor/agents-chat-input-ref-importfrom
refactor/agents-composer-runtime
Closed

DanielleMaywood wants to merge 1 commit into
refactor/agents-chat-input-ref-importfrom
refactor/agents-composer-runtime

Conversation

@DanielleMaywood

Copy link
Copy Markdown
Collaborator

Part 4 of the stack that splits #30545 into small mergeable PRs. Depends on #30629.

Moves the composer runtime out of AgentChatInput.tsx into components/AgentComposer/:

  • context.ts: the bindings types and the public state/actions/meta contract.
  • useComposerRuntime.ts: submission coordination, derived send/stop state, and send shortcut labels.
  • useComposerEditor.ts: the delegating inputRef handle, prompt history session, and speech input.
  • composerFiles.ts: a plain function for file routing and upload readiness.

AgentChatInput keeps its exact public props, calls useComposerRuntime, and reads state and actions from it. The UI (options menu, badges, frame, mobile dropdown geometry, Escape handling) stays in AgentChatInput for later PRs.

There is no intended behavior change. The existing AgentChatInput tests and stories pass unmodified, and this PR adds no tests.

Key decisions
  • This base's behavior is kept, not the prototype's fixes. hasModelOptions still gates sending. File routing keeps the current workspace-required and unsupported-type branches and toasts. An empty Enter still promotes the first queued message while editing history. Speech start has no new guard. Escape handling is unchanged. File bindings keep their current optional fields, so the upload-union and required workspaceUploads changes stay in their own PRs.
  • Prompt history is one session state keyed by remountKey. A remount now ends the session by derivation, which replaces the old reset effect and its refs. Arrow and Escape navigation produce the same results.
  • The post-send refocus effect moves into the runtime. It reads the editor ref, so it lives in the hook that owns that ref. Focus timing is unchanged (focus(), not focusWhenEditable()).
  • ComposerContext and useAgentComposer are deferred to the compound UI PR. Nothing would consume them yet, and knip rejects unused exports. Only the contract types that have consumers are exported.
  • AgentChatInput destructures meta before rendering. meta holds the editor ref, so the React Compiler refs lint rejects meta.x reads in JSX.
  • Read-only views still hide both buttons. AgentChatInput combines state.showSendButton/state.showStopButton with its own readOnlyNotice check, which keeps that concept out of the runtime.

Generated by Coder Agents on behalf of @DanielleMaywood.

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

CODAGT-1405

@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

Closing stack until can be re-prioritized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant