Skip to content

Providers phase 2c-1: promptDelivery capability — provider-owned prompt protocols - #399

Merged
Juliusolsson05 merged 1 commit into
mainfrom
refactor/providers-phase2c-prompt-delivery
Jul 6, 2026
Merged

Juliusolsson05 merged 1 commit into
mainfrom
refactor/providers-phase2c-prompt-delivery

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

Part of #394 (phase 2c, first slice). Follows #398.

What

  • MainProviderConfig.deliverPrompt — required registry capability; a provider that doesn't declare its delivery protocol fails compilation.
  • providers/{claude,codex}/runtime/promptDelivery.ts — the two opposite protocols move to their owners with all WHY blocks intact (Codex: readiness-gate before paste + atomic paste+Enter; Claude: paste → [Pasted text #N] confirm → separate Enter).
  • SessionManager.deliverPromptToAgent(sessionId, prompt) — the one provider-agnostic entry point; terminal/unknown sessions fail loudly instead of the old fall-through to a protocol-free paste (Plug-and-play provider architecture: modularize and standardize all provider implementations #394 §4.2).
  • MCP's submitPrompt (both call sites) deleted in favor of the manager call.

The protocols consume the typed AgentSession optionals (awaitReadyForPrompt / awaitPastePlaceholder) that phase 2a promoted onto the contract — this is the first capability that pays off that interface.

Verification

  • tsc --noEmit clean on both tsconfig projects
  • electron-vite build clean
  • vitest 170/170

Not in this slice (rest of phase 2c)

Composer-side paste protocol unification (useComposerKeybinds' three submit routes), spawn-arg builder, setup/binary descriptor, labels/glyphs/resumeCommand.

🤖 Generated with Claude Code

Extracts the per-provider prompt-delivery protocols out of MCP's
inline submitPrompt into provider-owned implementations, routed
through one provider-agnostic manager entry point.

Before: createBuiltInMcpServer.submitPrompt held both protocols as
inline branches — Codex (readiness-gate BEFORE paste, then ONE atomic
paste+Enter write, because CodexHeadless accounts the prompt as
submitted on the paste bytes) and Claude (paste WITHOUT Enter, await
the [Pasted text #N] placeholder, then a separate Enter). A third
provider fell through to a protocol-free paste+Enter with no
readiness gate and no confirmation (#394 §4.2) — the delivery
"succeeded" until it silently didn't.

After:
- MainProviderConfig.deliverPrompt (required capability) with the
  PromptDeliveryIo bag: the live AgentSession (whose typed optionals
  awaitReadyForPrompt / awaitPastePlaceholder are exactly the probes
  the protocols need — phase 2a made them part of the contract), a
  liveness-aware write, sessionId, prompt.
- providers/{claude,codex}/runtime/promptDelivery.ts own their
  protocols; every WHY block moved with the code.
- SessionManager.deliverPromptToAgent resolves the entry, fails LOUD
  for terminal/unknown sessions, and dispatches through
  getMainProvider — compile-enforced for every registered provider
  via the Record<AgentProviderKind, MainProviderConfig> registry.
- MCP's two call sites shrink to manager.deliverPromptToAgent(...);
  the local submitPrompt is gone.

Note the missing-probe cases are now explicit failures ("has no
readiness probe / paste-placeholder probe") instead of the old
manager methods' no-headless kinds threading through — same
observable outcome for orchestration (delivery not confirmed), but
the message names the actual gap.

Verified: tsc clean on both projects, electron-vite build clean,
vitest 170/170 (pre-existing voice-dictation harness quirk aside).

Part of #394.

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