Commit Graph

71 Commits

Author SHA1 Message Date
Armin Ronacher ae9450dc51 chore(ts): use source import extensions 2026-05-20 00:04:03 +02:00
Armin Ronacher 29b3417a7a fix(windows): hide bash helper consoles
closes #4699
2026-05-18 23:21:22 +02:00
Armin Ronacher 2829146dde chore(deps): Kill small dependencies (#4467) 2026-05-13 10:44:56 +02:00
Armin Ronacher 3421726e86 fix(coding-agent): disambiguate resource paths 2026-05-08 00:16:28 +02:00
Mario Zechner 3e5ad67e0f chore: migrate pi packages to earendil works scope 2026-05-07 15:59:42 +02:00
Armin Ronacher 6b18cdbac1 fix(coding-agent): stream bash output incrementally (#4165)
fixes #4145
2026-05-04 19:06:07 +02:00
Armin Ronacher e355696d8a fix(coding-agent): show compact read line ranges 2026-05-04 09:39:12 +02:00
Mario Zechner 324aa1d647 fix(coding-agent): render compact read calls directly
Render compact read classifications in the call row and leave the collapsed result row empty. The previous implementation used shared renderer state to let renderResult hide renderCall, which leaked an internal ReadRenderState type through the tool definition and coupled two render phases unnecessarily. The call renderer has all context needed to choose the compact presentation itself.
2026-05-04 00:52:56 +02:00
Armin Ronacher 588639fa97 feat(read): compact resource read rendering 2026-05-02 21:20:26 +02:00
Mario Zechner 3ffc2b4306 fix(coding-agent): avoid duplicate blocked edit output
closes #3830
2026-04-30 22:50:40 +02:00
Mario Zechner 3d43d2e175 fix(coding-agent): stop tool argument injection
closes #4018
2026-04-30 21:31:43 +02:00
pica 24dec9fcd5 fix(coding-agent): remove detached: true on Windows to fix pwsh.exe stdio (#4013)
On Windows, spawn(..., { detached: true }) prevents pwsh.exe (PowerShell) from
producing any stdout/stderr through pipe streams. This is because detached creates
a new process group which breaks pwsh's console host communication.

bash.exe and other cygwin/msys2 shells are unaffected by detached: true, but
they don't need it either -- on Windows, killProcessTree() already uses
taskkill /F /T /PID which kills the process tree by PID regardless of
whether the process was spawned detached.

The detached flag only matters on Unix, where kill(-pid, SIGKILL) requires a
process group that is only created via detached: true.

Fixes #4012
2026-04-30 20:59:02 +02:00
Mario Zechner ebdf3cf451 Adjusts #3955, better error message 2026-04-30 12:33:02 +02:00
Ramiz Wachtler 43ee9b77ed fix(coding-agent): report edit access failures correctly (#3955)
* fix(coding-agent): report edit access failures correctly closes #3894

- classify edit and edit-preview access errors by errno
- add regressions for missing, permission, and fallback cases
- document the fix in the coding-agent changelog

* chore: get rid of CHANGELOG.md entry

* refactor(coding-agent): apply review suggestions - use single error msg

* refactor(coding-agent): clean up test cases
2026-04-30 12:31:29 +02:00
Armin Ronacher 35ff2689ee fix(typebox): migrate to v1 with extension compat (#3474)
* fix(typebox): migrate to v1 with extension compat

Replace AJV-based validation with TypeBox-native validation, keep legacy extension imports working (including @sinclair/typebox/compiler), and restore coercion for serialized/plain JSON schemas.

This change closes #3112.

* fix(typebox): use canonical imports and harden coercion

Switch first-party code to canonical typebox imports while retaining legacy extension aliases in the loader.

Remove obsolete runtime codegen guards, expand serialized JSON-schema coercion coverage, and update related tests and fixtures.

Fixes #3112.

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-22 19:59:33 +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 2f4f283cc2 fix(ai,coding-agent): preserve non-vision image placeholders closes #3429 2026-04-20 16:52:27 +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
Aliou Diallo bfa11a50e4 feat(agent,coding-agent): per-tool executionMode override for sequential tool execution (#3345)
* feat(agent,coding-agent): add per-tool executionMode field to AgentTool and ToolDefinition

Add optional executionMode?: ToolExecutionMode to AgentTool and
ToolDefinition interfaces. Propagate through wrapToolDefinition and
createToolDefinitionFromAgentTool. No behavioral change yet — agent
loop will read this field in a follow-up.

* feat(agent): support per-tool executionMode override for sequential execution

When a tool defines executionMode='sequential', the agent loop
forces sequential execution of all tool calls in that batch,
even if the global config is parallel.

* feat(coding-agent): re-export ToolExecutionMode from @mariozechner/pi-agent-core

Makes the type available to extensions that want to set
executionMode on tool definitions.

* feat(coding-agent): add tic-tac-toe extension example with executionMode: sequential

Demonstrates per-tool executionMode: the agent plays via move/play
tool calls that share a cursor. Without sequential execution, play
can resolve before earlier moves finish, landing on the wrong cell.
2026-04-18 00:45:57 +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
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 e9ba9e2ebc fix(coding-agent): harden find cancellation and grep match formatting closes #3148 2026-04-16 13:15:58 +02:00
Armin Ronacher 9b7948c4c8 fix(coding-agent): kill tracked detached bash children on shutdown 2026-04-16 00:12:14 +02:00
Mario Zechner f7cd613ee4 fix(coding-agent): stabilize edit diff previews closes #3134 2026-04-15 23:11:50 +02:00
Jack Rose d22c120b82 handle lower case am/pm in macos screenshot names (#3194) 2026-04-15 12:00:46 +02:00
Mario Zechner 52d16d5a31 fix(coding-agent): persist bash output on line truncation closes #2852 2026-04-05 23:28:49 +02:00
Mario Zechner b5f425ad15 feat(agent,coding-agent): add prepareArguments hook for pre-validation argument preparation
Add AgentTool.prepareArguments and ToolDefinition.prepareArguments hook
that runs before schema validation in the agent loop. This lets tools
silently accept legacy argument shapes from resumed old sessions without
polluting the public schema.

The built-in edit tool uses this to fold legacy top-level oldText/newText
into edits[] when resuming sessions that predate the edits-only schema.

- AgentTool/ToolDefinition: typed prepareArguments returning Static<TParameters>
- agent-loop: prepareToolCallArguments() runs before validateToolArguments()
- edit tool: prepareEditArguments folds legacy fields, validateEditInput is strict
- Documented in extensions.md with edit-tool example
2026-03-29 21:06:22 +02:00
Mario Zechner 0f9db44aff fix(coding-agent): avoid full redraw on large edit results closes #2664 2026-03-29 13:00:46 +02:00
Mario Zechner e773527b3a fix(coding-agent): simplify edit tool input closes #2639 2026-03-28 22:10:34 +01:00
Mario Zechner f456a7a4db fix(coding-agent): restore compaction summary and dedupe edit errors 2026-03-27 04:00:21 +01:00
Mario Zechner a0734bd162 fix(coding-agent): tighten skill discovery and edit diffs closes #2603 2026-03-27 03:48:28 +01:00
Mario Zechner 20a57e7599 feat(coding-agent): support multi-edit in edit tool 2026-03-27 02:21:09 +01:00
Mario Zechner d38ad0cd6b fix(coding-agent): preserve file mutation queue ordering 2026-03-25 23:05:04 +01:00
Mario Zechner a78882d8b8 fix(coding-agent): enforce safe auto-resized image limits closes #2055 2026-03-22 21:48:34 +01:00
Mario Zechner 235b247f1f fix(coding-agent): built-in tools work like extension tools
Export readToolDefinition / createReadToolDefinition and the equivalent built-in ToolDefinition APIs from @mariozechner/pi-coding-agent.
2026-03-22 04:20:38 +01:00
Mario Zechner 74a46fc7ea fix(coding-agent): queue file mutations across edit and write
closes #2327
2026-03-20 01:55:30 +01:00
Duncan Ogilvie 25b185f398 fix(coding-agent): fix windows hanging when descendants inherit stdout/stderr handles (#2389) 2026-03-19 08:34:52 +01:00
Mario Zechner 9651e4114d feat(coding-agent): expose local bash operations closes #2299 2026-03-18 00:41:57 +01:00
Mario Zechner 700bcf3455 fix(coding-agent): normalize fuzzy edit matching and run touched tests closes #2044 2026-03-15 19:15:38 +01:00
badlogic 4f81c3c28d fix(coding-agent,tui): stabilize windows shell/path handling
fixes #1775

fixes #1769
2026-03-14 05:36:21 +01:00
Mario Zechner c9a20a3aa4 fix(coding-agent): normalize @ path prefixes closes #1206 2026-02-02 23:56:20 +01:00
Mario Zechner 86b43c8eac feat(coding-agent): add bash spawn hook 2026-02-01 23:17:51 +01:00
G a8a0f4b9fb feat(coding-agent): type ToolCallEvent.input per tool
Matches ToolResultEvent pattern with typed inputs via discriminated union.

- Export *ToolInput types from tool schemas
- Add *ToolCallEvent interfaces for each built-in tool
- Add isToolCallEventType() guard with overloads for built-ins

Direct narrowing (event.toolName === "bash") doesn't work due to
CustomToolCallEvent.toolName: string overlapping with literals.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 19:13:52 +01:00
Mario Zechner 4edb506df8 fix(coding-agent): handle macOS filenames with curly quotes and NFD Unicode
Fixes #1078

- Add tryNFDVariant() to normalize paths to NFD form
- Add tryCurlyQuoteVariant() to convert straight quotes to curly quotes
- Try combined NFD + curly quote variant for French macOS screenshots
- Add comprehensive tests for path-utils
2026-01-29 22:58:22 +01:00
Mario Zechner 89636cfe6e fix(coding-agent): improve read tool description for full file reads 2026-01-24 23:15:11 +01:00
Mario Zechner b846a4bfcf feat(coding-agent): ResourceLoader, package management, and /reload command (#645)
- Add ResourceLoader interface and DefaultResourceLoader implementation
- Add PackageManager for npm/git extension sources with install/remove/update
- Add session.reload() and session.bindExtensions() APIs
- Add /reload command in interactive mode
- Add CLI flags: --skill, --theme, --prompt-template, --no-themes, --no-prompt-templates
- Add pi install/remove/update commands for extension management
- Refactor settings.json to use arrays for skills, prompts, themes
- Remove legacy SkillsSettings source flags and filters
- Update SDK examples and documentation for ResourceLoader pattern
- Add theme registration and loadThemeFromPath for dynamic themes
- Add getShellEnv to include bin dir in PATH for bash commands
2026-01-22 13:49:38 +01:00
Mario Zechner 4068bc556a chore: simplify codex prompt handling 2026-01-17 21:53:01 +01:00
Mario Zechner fbb74bb29e fix(ai): filter empty error assistant messages in transformMessages
When 429/500 errors occur during tool execution, empty assistant messages
with stopReason='error' get persisted. These break the tool_use -> tool_result
chain for Claude/Gemini APIs.

Added centralized filtering in transformMessages to skip assistant messages
with empty content and no tool calls. Provider-level filters remain for
defense-in-depth.
2026-01-16 22:35:50 +01:00