omp packages

@giladbarnea/pi-pretty-codemode0.2.1

Intent summaries and syntax-highlighted nested tool results for Pi Code Mode.

GitHub Actions Published 2 days ago MIT ~243 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme


last_updated: 2026-11-30T14-38

Pretty Codemode

Intent summaries and syntax-highlighted nested tool results for Pi Code Mode.

Install

pi install npm:@giladbarnea/pi-pretty-codemode

For development, install the local checkout instead. Enable one source, then run /reload in existing Pi sessions.

Requires Node 24+ and supports Pi 1.5.x and 1.6.x.

One Code Mode display

Start a script with an intent comment, immediately after // @options: when present:

// intent: Inspect configuration and check service health
await Promise.allSettled([
  tools.read({ path: "settings.ts" }),
  tools.bash({ command: "npm test" }),
]);
text({ checked: true });

The extension adds this convention to the agent's tool guidelines. A completed opening comment appears during input streaming. With an intent, a collapsed call shows its purpose, child-status counts and timing. Expand with Pi's tool-output shortcut, normally Ctrl+O, to see the JavaScript, captured child results and script output. Failed scripts keep their error output visible. Scripts without an opening intent retain their previews.

Child results come from Pi's real nested execution events and IDs. Reads get source colors, Bash gets command/result boxes, and mutations show captured diff details when available. The script's printed output stays separate. Recognized JSON gets colors, but output text is never matched to a tool by order, filenames or content.

Source-provided terminal formatting and control characters are removed for display; the renderer applies its own syntax and diff colors. This does not alter captured or programmatic data.

This extension does not replace tool definitions, execution or model-visible results. Write diffs use details supplied by an installed mutation renderer, such as Kendex. Without those details, the actual write result remains visible. Nested Bash commands use pi-pretty-bash's shared tree-sitter highlighter with Pi theme colors, the same as direct Bash: quoted heredocs labelled with a language get that language's colors, and commands over its size budget stay plain and complete.

Current limits

  • Captures live in memory for the latest 32 Code Mode runs, up to 256 child calls per run. These limits count records, not payload bytes.
  • Reload, session changes and tree navigation clear live captures. Expanded history still shows the formatted Script output box and Pi's saved nested-call summaries. Pi does not save nested tool output, so that output is only available from live captures.
  • Nested images show a placeholder. Images printed by the script remain Pi-owned.
  • Expansion applies to the Code Mode call, not independently to each child.
  • Expanded views format JavaScript only for the newest 256 Code Mode calls, including saved calls. Older calls show the JavaScript as written. Formatting is display-only.

The accepted prototype is now a first-class package. Visual hierarchy and repeated-input feedback remain to be addressed. Persistence, payload-byte budgets and additional interaction behavior are separate decisions.

Development

npm ci --ignore-scripts
npm run check

Tests require Bun. Unit/rendering fixtures are self-contained. The suite exercises actual SDK execution, structured child results, partial output, cancellation, expansion, padding and intent comments.

To test reload and resume in real Pi, run uv run -p python3 tests/saved-history.py regular and repeat with fullscreen. This uses a private tmux server and an offline fixture provider.

  • index.ts: registers the guideline, capture invalidation and Code Mode renderer.
  • src/capture.ts: observes nested execution events.
  • src/render.ts: owns the Code Mode display.
  • src/intent.ts: reads the opening comment.
  • src/renderers/: child and layout helpers.

License

MIT.