Skip to main content

Module opencode_ask

Module opencode_ask 

Source
Expand description

Client interceptor for the ask verb on an opencode target (x-51f6), plus the headless one-shot dispatch (dispatch_opencode_once).

opencode is hosted two ways: an interactive PTY pane (the ask resume path, which stays refused - no stateful client-side resume in v1) and a headless one-shot opencode run --dangerously-skip-permissions "<prompt>" (this module’s dispatch_opencode_once, substrate headless). The one-shot is STATELESS like agy: plain-text stdout, no session id minted here, no registry row, no --continue resume from this path. It reuses the shared subprocess_ask primitives (stdin /dev/null, watchdog, process-group SIGINT) rather than duplicating agy’s error taxonomy.

ask (resume-by-name) still refuses: it names the real limitation instead of falling through to bin/client.rs’s unresolvable_ask_exit “provider is required for new agent” text (wrong - the agent exists - and a dead end). Mirrors crate::agy_ask::maybe_run_agy_ask’s shape.

Structs§

AskOutcome
Stdout/stderr/exit triple returned to the client (mirror of the sibling provider AskOutcomes; each module owns its own nominal type).

Functions§

dispatch_opencode_once
Orchestrate one opencode spawn --substrate headless: validate, fail-closed registry + name-collision check, then run opencode run and return the reply. STATELESS by design - opencode’s own --session/--continue resume is a pane/interactive concern, not this one-shot; name labels the log + events.
maybe_run_opencode_ask
Returns None for a non-opencode target (fall through to the next provider’s ask hook), or Some(2) after printing the refusal.