Skip to content

Providers phase 2c-4: composer submit protocol as a provider capability - #402

Merged
Juliusolsson05 merged 1 commit into
mainfrom
refactor/providers-phase2c4-composer
Jul 6, 2026
Merged

Juliusolsson05 merged 1 commit into
mainfrom
refactor/providers-phase2c4-composer

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

Part of #394 — completes phase 2c. Follows #401.

What

  • composerSubmit(io) capability + supportsImageAttachments / usesOptimisticUserEcho flags on the renderer registry.
  • Claude's three submit routes (images / paste-like with the event-driven paste-commit wait / plain) move to providers/claude/renderer/composerSubmit.ts; Codex's atomic bracketed-paste+Enter to its counterpart. Every race WHY block moved verbatim — the protocols are byte-identical to the inlined versions.
  • useComposerKeybinds keeps only kind-agnostic machinery (pasteId journal, baseline capture, clear/preserve-draft).
  • TileLeaf's unknown-kind→claude coercion (Plug-and-play provider architecture: modularize and standardize all provider implementations #394 §4.7) → isAgentProviderKind + documented DEFAULT_PROVIDER back-compat.
  • Image-attachment gating (paste handler, pill strip, post-submit clear) is one capability flag instead of three 'claude' literals.

Verification

  • tsc --noEmit clean on both projects; electron-vite build clean; vitest 170/170.
  • ⚠️ This is the paste-race path. The moves are verbatim, but a manual smoke before/at merge is cheap insurance: paste a multiline prompt into a Claude pane (should commit placeholder then submit), submit a prompt into a Codex pane (single write, optimistic row reconciles). The paste-debug journal (route:* events) will confirm routing went through the new modules.

🤖 Generated with Claude Code

Completes phase 2c: the last inline provider fork in the composer
moves behind the registry.

- RendererProviderCapabilities gains composerSubmit(io) plus two
  flags: supportsImageAttachments (gates draft accumulation, the pill
  strip, and post-submit clearing — was three `provider === 'claude'`
  literals) and usesOptimisticUserEcho (Codex's optimistic user entry
  at submit; the STORE calls stay at the call site so providers never
  import the workspace store).

- providers/claude/renderer/composerSubmit.ts owns Claude's three
  routes — images (750ms wall-clock fallback; event-driven detection
  deliberately disabled because image expansion never shows the text
  placeholder), paste-like (bracketed paste, then Enter only after
  the TUI visibly committed the paste — #279/#90), plain fast path.
  providers/codex/renderer/composerSubmit.ts owns the atomic
  bracketed-paste+Enter write that fixed Codex swallowing \r. Every
  race WHY block moved verbatim; the protocols are byte-identical to
  the inlined versions.

- useComposerKeybinds keeps only kind-agnostic machinery: pasteId
  minting + paste-debug journal, streaming-baseline capture, composer
  clearing, draft preservation on throw. The paste-debug isPasteLike
  heuristic still uses CLAUDE_PASTE_THRESHOLD on purpose — it's a
  diagnostic field kept stable so historical dumps stay comparable.

- TileLeaf's `kind === 'codex' ? 'codex' : 'claude'` derivation (which
  silently coerced any future provider to claude, #394 §4.7) becomes
  isAgentProviderKind + DEFAULT_PROVIDER back-compat.

Verified: tsc clean on both projects, electron-vite build clean,
vitest 170/170. NOTE: the moved protocols are verbatim, but this is
the paste-race path — a manual smoke (multiline paste into a Claude
pane; prompt submit into a Codex pane) is recommended on first run.

Part of #394. Phase 2c complete.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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