Commit Graph

366 Commits

Author SHA1 Message Date
Mario Zechner 1cc303d053 fix(coding-agent): add replacement-session callbacks closes #2860 2026-04-22 12:13:54 +02:00
Mario Zechner a900d25119 feat(tui,coding-agent): add OSC 9;4 terminal progress indicators
Emit OSC 9;4 progress start/end sequences during agent streaming and
compaction so terminals (iTerm2, WezTerm, Windows Terminal, Kitty, etc.)
show activity in their tab bar.

Made with love for @lucasmeijer
2026-04-22 11:55:52 +02:00
Samuel Painter ee462dd70d fix(coding-agent): sanitize markdown links in exported session HTML (#3532)
marked v15 does not filter dangerous URL protocols. The default link
renderer passes href values through verbatim, so markdown like
`[click](javascript:alert(1))` renders as a clickable XSS link in
shared/exported session HTML.

Add custom link and image renderers that:
- Block javascript:, vbscript:, and data: protocol URLs
- Escape href/title/alt attributes via escapeHtml()

Also escape img.mimeType in session image rendering to prevent
attribute breakout from crafted session JSONL.

Fixes #3531
2026-04-22 10:53:03 +02:00
Mario Zechner 60290b0d75 fix(coding-agent): expand ~ in sessionDir
closes #3514
2026-04-22 00:21:57 +02:00
Mario Zechner e58d631c89 Reapply "fix(ai): own Anthropic SSE parsing to avoid SDK JSON.parse hard-failures"
This reverts commit fc9220d2de.
2026-04-21 23:42:19 +02:00
Mario Zechner fc9220d2de Revert "fix(ai): own Anthropic SSE parsing to avoid SDK JSON.parse hard-failures"
This reverts commit 4b926a30a2.
2026-04-21 23:19:52 +02:00
Aliou Diallo 81de426f96 test(coding-agent): fix showLoadedResources mocks (#3518)
Add getCommandDiagnostics and getShortcutDiagnostics mocks to fix
'Cannot read properties of undefined' errors in InteractiveMode tests.

regression from 32a305cb
2026-04-21 23:05:38 +02:00
Mario Zechner 4b926a30a2 fix(ai): own Anthropic SSE parsing to avoid SDK JSON.parse hard-failures
Bypass the Anthropic SDK streaming parser entirely. Use
client.messages.create().asResponse() and decode the SSE stream
ourselves with defensive JSON parsing that repairs invalid escape
sequences and control characters inside string literals.

- Switch from SDK .stream() to .asResponse() + pi-owned SSE decoder
- Add repairJson() / parseJsonWithRepair() to json-parse.ts
- Add anthropic-sse-parsing.test.ts regression for malformed tool deltas
- Update github-copilot-anthropic.test.ts mock to match new call path
- Update deprecated claude-3-5-haiku-20241022 refs to claude-haiku-4-5
- Remove stale non-reasoning model test

fixes #3175
2026-04-21 23:00:56 +02:00
Mario Zechner 12d7161884 fix(coding-agent): add session_shutdown reasons closes #2863 2026-04-20 23:11:08 +02:00
Douglas Stephen 1891b9ac01 feat: Expose BuildSystemPromptOptions on before-agent-start event. (#3473)
Resolves: #3463
2026-04-20 23:06:47 +02:00
Mario Zechner e4f7fe7bb7 feat(coding-agent): batch package updates
closes #2980
2026-04-20 22:56:26 +02:00
Mario Zechner c40efa9bab fix(coding-agent): resolve shell config from session settings
Stop shell resolution from consulting ambient process.cwd() during bash execution and use the active session's shellPath setting instead.

closes #3452
2026-04-20 22:32:11 +02:00
Mario Zechner 5a4e22ea44 fix(coding-agent): remove process-cwd tool singletons and use tool-name allowlists
- switch SDK/CLI tool selection to name-based allowlists
- apply allowlists across built-in, extension, and SDK tools
- remove ambient process.cwd defaults from core tooling and resource helpers
- update tests, examples, and TUI callers for explicit cwd plumbing
- add regression coverage for extension tool filtering

closes #3452
closes #2835
2026-04-20 22:05:28 +02:00
Mario Zechner 27c1544839 fix(coding-agent): use tool-name allowlists and remove cwd-bound singletons
- treat tools as a global allowlist across built-in, extension, and SDK tools
- remove process-cwd singleton tool usage from SDK and CLI paths
- add regression coverage for extension tool filtering

closes #3452
closes #2835
2026-04-20 22:05:28 +02:00
Mario Zechner b73212616d fix(coding-agent): skip redundant npm package updates
closes #3000
2026-04-20 19:12:52 +02:00
Mario Zechner 3054fd7a3b fix(ai,coding-agent): support anthropic-style cache control for openai compatibles closes #3392 2026-04-20 17:12:05 +02:00
Mario Zechner 61579214c8 fix(coding-agent): handle symlinked session selector paths closes #3364 2026-04-20 16:25:12 +02:00
Mario Zechner d56e5aea0b fix(coding-agent): detect Windows pnpm global installs closes #3378 2026-04-20 15:59:57 +02:00
Mario Zechner da6a81d398 fix(coding-agent): reuse session thinking for compaction closes #3438 2026-04-20 15:09:50 +02:00
Mario Zechner 5ea8a276eb fix(coding-agent): preserve share page tool output indentation closes #3440 2026-04-20 14:46:37 +02:00
Marek Pazik d4e2e563ae feat(coding-agent): make scoped models and tree filter shortcuts configurable (#3343)
- Add app.models.{save,enableAll,clearAll,toggleProvider,reorderUp,reorderDown}
- Add app.tree.filter.{default,noTools,userOnly,labeledOnly,all,cycleForward,cycleBackward}
- Migrate scoped-models-selector cancel to tui.select.cancel
- Prefer reserved actions on key collision in extension shortcut conflict check
2026-04-20 14:35:30 +02:00
Mario Zechner d554409b1f fix(coding-agent): split /clone from /fork UX
closes #2962
2026-04-20 14:33:32 +02:00
Mario Zechner 62c1c4031c fix(coding-agent): add OpenRouter attribution headers
closes #3414
2026-04-20 14:14:36 +02:00
Armin Ronacher 23569e304b feat(coding-agent): add fork position and duplicate session option (#3431) 2026-04-20 14:13:34 +02:00
Ramiz Wachtler 2b45243817 fix(coding-agent): avoid duplicate symlinked skills in pi config (#3417)
- dedupe resolved skill entries by canonical path (realpathSync) with raw-path fallback matching loadSkills()

- preserve precedence by applying skill dedupe after resource precedence sorting (first winner retained)

- add tests to verify expected behavior

- closes #3405
2026-04-20 13:23:00 +02:00
Danila Poyarkov a2ec01e12f fix(coding-agent): coerce stringified JSON edits in edit tool (#3370)
Some models (Opus 4.6, GLM-5.1) send the edits parameter as a JSON
string instead of a parsed array. This fails AJV validation with
'must be array' and models fall back to sed/python.

Parse stringified edits in prepareEditArguments before validation.
2026-04-18 18:29:23 +02:00
Neon 182d4ceea3 fix manifest glob expansion and add regression test (#3350) 2026-04-18 13:16:39 +02:00
Mario Zechner 3cea63cf29 fix(coding-agent): resolve captured commands on close closes #3027 2026-04-17 16:45:05 +02:00
Mario Zechner c15e4d4913 fix(coding-agent): retry connection lost errors
closes #3317
2026-04-17 16:45:05 +02:00
Armin Ronacher 32a305cb9b fix(coding-agent): disambiguate compact extension labels
closes #3308
2026-04-17 09:46:47 +02:00
Mario Zechner ef1fcfcec2 fix(coding-agent): omit devDependencies when installing packages (fixes #3009) 2026-04-17 01:21:31 +02:00
Mario Zechner 3ba0d85fa2 fix(coding-agent): restore assistant/user turn spacing 2026-04-17 00:52:14 +02:00
Mario Zechner b2ed851e84 Merge branch 'main' of https://github.com/badlogic/pi-mono
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
2026-04-17 00:28:14 +02:00
Mario Zechner b0490310c3 fix(coding-agent): stabilize user message OSC 133 padding closes #3090 2026-04-17 00:22:39 +02:00
Armin Ronacher 165603189b fix(coding-agent): parse quoted import paths and missing files 2026-04-17 00:02:14 +02:00
Mario Zechner 1d4fdbad26 fix(coding-agent): scope nested .gitignore rules to their subtree in find
The find tool previously collected every .gitignore under the search
path and passed them to fd via --ignore-file. fd treats --ignore-file
entries as a single global ignore source, so rules from a/.gitignore
also filtered files under sibling b/.

Drop the manual collection and pass --no-require-git instead, which
makes fd apply hierarchical .gitignore semantics whether or not a git
repo is present.

closes #3303
2026-04-16 23:03:41 +02:00
Andrés Vinueza aa25726ebf feat(coding-agent,tui): support argument-hint frontmatter in prompt templates (#2780)
* feat(coding-agent,tui): support argument-hint frontmatter in prompt templates

Parse argument-hint from prompt template frontmatter and display it
in the autocomplete dropdown description, matching Claude Code's
convention for custom commands.

Frontmatter format:
  ---
  description: Code review
  argument-hint: "[file | #PR | PR-URL]"
  ---

The hint renders in the description column of the autocomplete list:
  review   [file | #PR | PR-URL] — Code review

Closes #2761

* docs(coding-agent,tui): add argument-hint documentation, tests, and built-in hints

- Document argument-hint frontmatter in prompt-templates.md with <required>/[optional] convention
- Add argument-hint to built-in prompts: pr, is, wr
- Expand tests: required/optional hints, missing hints, empty hints, special characters
- Add changelog entries for coding-agent and tui
2026-04-16 23:02:35 +02:00
Mario Zechner c5451af749 fix(coding-agent): make find tool match path-based glob patterns
fd --glob matches against the basename unless --full-path is set, so
patterns containing '/' (e.g. 'src/**/*.spec.ts') silently returned no
results. When the pattern contains '/', switch fd into --full-path mode
and prepend '**/' unless the pattern already starts with '/', '**/', or
is '**'. Basename patterns keep the default matcher.

closes #3302
2026-04-16 22:53:45 +02:00
Mario Zechner 7b45c52807 fix(coding-agent): restore verbose startup expansion
closes #3147
2026-04-16 21:42:57 +02:00
Armin Ronacher f822408c77 fix(coding-agent): compact startup header and resource listings (#3267)
Use ctrl+o expansion for startup help and loaded resources, with compact comma-separated collapsed lists and full expanded context paths.

fixes #3147
2026-04-16 21:37:20 +02:00
Mario Zechner d131fcd4ba feat(coding-agent): add after_provider_response hook closes #3128 2026-04-16 20:28:08 +02:00
Mario Zechner e9ba9e2ebc fix(coding-agent): harden find cancellation and grep match formatting closes #3148 2026-04-16 13:15:58 +02:00
Mario Zechner 624a7f794f fix(coding-agent): handle ctrl+z on windows closes #3191 2026-04-16 12:33:47 +02:00
Mario Zechner e189b23964 feat(coding-agent): add --no-context-files flag
closes #3253
2026-04-16 10:59:32 +02:00
Mario Zechner 33e632dfce fix(coding-agent): stabilize edit tool redraw test 2026-04-15 23:54:34 +02:00
Mario Zechner 01b98a27af test(coding-agent): make rpc preflight error assertion path-agnostic 2026-04-15 23:39:10 +02:00
Mario Zechner f7cd613ee4 fix(coding-agent): stabilize edit diff previews closes #3134 2026-04-15 23:11:50 +02:00
Mario Zechner 441c12956a fix(coding-agent): emit rpc prompt response after preflight closes #3049 2026-04-15 22:09:17 +02:00
Mario Zechner 17585b7f0b fix(coding-agent): preserve scoped model order closes #3217 2026-04-15 17:13:06 +02:00
Jack Rose d22c120b82 handle lower case am/pm in macos screenshot names (#3194) 2026-04-15 12:00:46 +02:00