Expand description
The launcher: pair, the tab wrappers, the terminal walk, install-launcher and the pure
Windows resolvers (spec “Launcher”), and resume and attach (Task 19), which reuse
claim_file, write_wrapper, controller_env and LauncherCtx::before_claim.
Re-exports§
pub use posix::quote_sh;pub use posix::select_terminal;pub use posix::system_parent_chain;pub use posix::tab_command;pub use posix::wrapper_script_posix;pub use posix::Terminal;pub use posix::BOOT_ID_EXPR_POSIX;pub use posix::STARTTIME_EXPR_POSIX;pub use windows::cmd_line;pub use windows::cmd_wrap;pub use windows::controller_command;pub use windows::controller_process;pub use windows::quote_ps;pub use windows::resolve_executable;pub use windows::select_windows_shell;pub use windows::strip_verbatim;pub use windows::wrapper_script_ps1;pub use windows::wt_directory_arg;pub use windows::WindowsShell;
Modules§
- posix
- The POSIX tab wrapper, the shell expressions it embeds, and the terminal walk and tab commands.
- windows
- Windows rules that are pure text and path logic, compiled on every platform so the Linux and macOS
legs test them: the verbatim-prefix strip, the
wtdirectory argument,PATHEXTresolution, thecmd.exe /cwrap and the.ps1wrapper.
Structs§
- Capture
Transport 🔒 - A transport that records the body of the one
session.createcall, so the dry run shows exactly whatEngine::session_create(policy, model, lock rules and all) would send. - Launcher
Ctx - Lock
Guard 🔒 - Deletes the
resume-lockit was handed on drop, whatever wayresumeends. - Pair
Args - Staged 🔒
- Wrapper
Input
Enums§
Constants§
- EXIT_
NOTICE - The notice posted into the worker session when the controller exits (spec Launcher step 5).
- NOT_
OFFERED - What
pair,resume,attachandinstall-launcherprint on the OpenCode host.
Functions§
- announce_
tab 🔒 - attach
attach <session-id | pair-id>.- attach_
pair 🔒 - attach_
pair_ 🔒run - attach_
session 🔒 - bind_
controller 🔒 claude-pidfrom the child’s pid, boot id and start time.- check_
pair_ 🔒id - conflict 🔒
- controller_
env - Spec step 5’s environment, shared with
resume.OPENCODE_CTL_SERVERis the EMPTY string when there is noserver_url(never omitted:Commandinherits the parent environment, and a stale value would point the controller at another server; empty = the background service). - controller_
missing 🔒 - controller_
unavailable 🔒 - create_
args 🔒 - delete_
older_ 🔒generations pair.<id>.g<k>.*for everyk < n: the tabs of older generations.- dry_
create_ 🔒body - dry_run 🔒
- ensure_
bin_ 🔒dir - install_
launcher - install_
launcher_ as install-launcher [--force]for a platform flag (so the Windows copy rules run on every leg).- install_
windows_ 🔒copy - Windows: an in-use copy is first renamed to
.old(whichgcdeletes), then the running exe is copied over and the.sourcefile written. - invalid 🔒
- is_
missing_ 🔒program - launcher_
guard 🔒 - live_
controller 🔒 - mint_
pair_ 🔒id - open_
pair_ 🔒log <home>/logs/pair-<id>.log, scoped to this thread; a failed open is a stderr warning (plan decision 10) and the run continues.- open_
tab 🔒 - Spec step 4’s last action: the wrapper in a new tab of
t; returns the tab process’s pid. - opencode_
missing 🔒 - pair
pair: spec Launcher steps 1-5. The order at the top is: mint the id, validate,OPENCODE_NOT_FOUNDwhen there is no binary, open the log, then step 1;--dry-runwrites, spawns and calls nothing.- pair_
file 🔒 - parse_
attach_ args attach <session-id | pair-id>-> the target.- parse_
pair_ args pair [directory] [--model m] [--title t] [--controller c] [--no-tab] [--dry-run] [-- <controller args>].- parse_
resume_ args resume <pair-id> [--controller c] [-- <controller args>]-> (pair id, controller, args).- pick_
controller 🔒 --controller, else the record’s, else the host constant (anattachrecord hasNone).- post_
exit_ 🔒notice session.synthetic{text, resume: false}with no client id; one retry with the same body on the id-collision conflict. Failure is logged, never fatal.- print_
closing 🔒 - remove_
if_ 🔒present - replace_
with_ 🔒symlink - resolve_
controller 🔒 - resolve_
directory 🔒 - resume
resume <pair-id>with the record’s (else the host’s) controller.- resume_
run 🔒 - resume_
with resumewith an explicit--controller(which wins over the record and the host constant).- rollback 🔒
- Remove what a failed step 3 or 4 left: the session, then every
pair.<id>.*file. - run 🔒
- same_
bytes 🔒 - say 🔒
- stage 🔒
- Steps 3 and 4: the terminal, the record (once), the wrapper and the tab. A failure is returned for the caller to roll back.
- stage_
attached 🔒 - The new record (
controller: null, generation 1,tabfrom the terminal walk), then the wrapper, then the tab. - step5 🔒
- Step 5: the controller, as a child with inherited stdio. Shared with
resume, which passes theresume-lockit holds: deleted onceclaude-pidis written. - system_
path_ has name(orname.exe,.cmd,.baton Windows) found as a file in a directory ofPATH.- system_
spawn_ and_ wait - The controller: spawn with inherited stdio, hand the pid to
on_pid, wait. - system_
spawn_ detached - The terminal tab: spawned and left to run; the child is reaped on a thread so it never lingers as a zombie of this long-lived process.
- tab_
argv_ 🔒command - tab_
plan 🔒 - utc_
hhmm 🔒 - validate_
launch_ values - “Values that reach a shell” (spec Launcher): ids match their patterns, a newline is refused
everywhere,
;in the directory on Windows (wtsplits its command line on it), and on Windows a controller argument with acmd.exemetacharacter. Nothing is written before this passes. - wrapper_
path - wrapper_
text 🔒 - write_
wrapper - The ONE wrapper writer:
claim_file(path, bytes, 0o700), with U+FEFF prepended for a.ps1(powershell.exe5.1 decodes a BOM-less script as the ANSI code page).Ok(false): it exists.
Type Aliases§
- Spawn
AndWait Fn dyn Fn(&mut Command, &mut dyn FnMut(u32)) -> io::Result<ExitStatus>.