Repository navigation
Providers phase 2c-1: promptDelivery capability — provider-owned prompt protocols - #399
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).submitPrompt(both call sites) deleted in favor of the manager call.The protocols consume the typed
AgentSessionoptionals (awaitReadyForPrompt/awaitPastePlaceholder) that phase 2a promoted onto the contract — this is the first capability that pays off that interface.Verification
tsc --noEmitclean on both tsconfig projectselectron-vite buildcleanvitest170/170Not 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