Documentation
¶
Overview ¶
Package shellwait recognizes provider shell commands that block on external work, so a session can be redirected to a daemon-owned monitor instead. It inspects parsed commands rather than text, so a quoted mention of a watch in a commit message or a search pattern is not a wait.
Index ¶
Constants ¶
const ( // MinDelaySeconds is the shortest wait that is redirected. It matches the // smallest timer monitor, so every denied delay has a monitor replacement. MinDelaySeconds = 5 // MaxDelaySeconds is the longest timer monitor. MaxDelaySeconds = 86400 )
const HookCommandName = "shell-wait-hook"
HookCommandName is the hidden CLI verb a provider PreToolUse hook runs.
Variables ¶
This section is empty.
Functions ¶
func DenyReason ¶
DenyReason names the exact daemon-owned replacement for a detected wait.
Types ¶
type Finding ¶
type Finding struct {
Kind Kind
// Argv is the unwrapped command for KindWatch.
Argv []string
// Source is the full command line for KindPoll, and for a KindWatch whose Argv
// alone would lose its directory, environment, or dynamic arguments.
Source string
// Shell runs Source: bash, whose syntax Detect parses, or powershell.
Shell string
// Exact marks a KindWatch that Argv alone reproduces.
Exact bool
// DelaySeconds is the delay for KindSleep.
DelaySeconds int
// PullRequest marks a KindWatch on a pull request, which has a daemon-owned monitor of its own.
PullRequest bool
}
Finding describes one detected wait and the data its redirect needs.
func Detect ¶
Detect reports the first wait in a POSIX shell command line. An unparsable command is allowed: the guard fails open.
func DetectPowerShell ¶
DetectPowerShell reports the first wait in a PowerShell command line. It reads statements token by token because the POSIX parser rejects PowerShell loops.
func DetectToolInput ¶
func DetectToolInput(raw json.RawMessage) (Finding, bool)
DetectToolInput reads a provider-native shell tool input. It accepts the command string of a Bash tool, the argv array Codex reports, and the command-plus-args shape of an ACP terminal/create request.