← Catalog

@piotr-oles/pi-bash-timeout

Pi Agent extension: inject a default bash timeout and append timeout policy guidance to the system prompt

Package

Install

Install with PiG

pig install npm:@piotr-oles/pi-bash-timeout

Install with Pi

pi install npm:@piotr-oles/pi-bash-timeout
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 1.0.1 (README.md). PiG does not review it.

@piotr-oles/pi-bash-timeout

Pi Agent extension that gives the bash tool a sane default timeout and tells the model about the timeout policy.

It intercepts the host bash tool via the tool_call event and injects a default timeout (in seconds) when the model omits it or passes a non-positive value. It also appends a "Bash Tool Timeout Policy" section to the system prompt via before_agent_start so the model sets explicit timeouts for long-running commands.

Behavior

CaseResult
timeout omittedinject default
timeout <= 0treated as missing, inject default
timeout in rangepreserved
timeout above maxcapped to max

Non-bash tool calls are never touched.

Configuration

Both pi flags and env vars are supported. Precedence: flag > env var > built-in default. Invalid or non-positive values are ignored and fall through to the next source.

SettingFlagEnv varDefault
Default timeout (s)pi-bash-timeout-defaultPI_BASH_DEFAULT_TIMEOUT_SECONDS120
Maximum timeout (s)pi-bash-timeout-maxPI_BASH_MAX_TIMEOUT_SECONDS600

Explicit timeout values above max are capped. If max resolves lower than default, it is raised to default.

Thanks

Ported from code-yeongyu/pi-bash-timeout and adapted to this repo (pi flags, upstream isToolCallEventType guard, in-place input mutation, colocated tests).

Development

npm install
npm test
npm run typecheck
npm run check

To test changes manually, pass the source entry point directly to pi:

pi -e packages/pi-bash-timeout/src/index.ts