Commit Graph

316 Commits

Author SHA1 Message Date
Mario Zechner
018b40c30c fix: align OpenAI cache affinity and use uuidv7 session ids 2026-04-14 23:20:13 +02:00
Aliou Diallo
ec4d413fc9 fix(coding-agent): custom models for built-in providers and list-models error surfacing (#3072)
* fix(coding-agent): surface models.json load errors on stderr in --list-models

When models.json has validation errors, --list-models silently
discarded custom models and overrides without any user-visible
feedback. Now prints the error to stderr via chalk.yellow warning
before listing available models.

* fix(coding-agent): allow custom models for built-in providers in models.json

Built-in providers (openrouter, anthropic, etc.) already have api and
baseUrl on every model, and auth comes from env vars / auth storage.
Relax validation so custom models under built-in providers don't need
redundant baseUrl, apiKey, or api fields. Inherit them from the first
built-in model for that provider.

fixes #2921

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-14 20:32:18 +02:00
Aliou Diallo
2d3ed0cfa7 fix(coding-agent): use npm view for update checks on non-default registries (#3164)
Previously, getLatestNpmVersion() hardcoded a fetch to
registry.npmjs.org, which 404s for packages on alternate
registries (private, Verdaccio, GitHub Packages, etc.).
The error was silently swallowed, so users never saw update
notifications for these packages.

Replace the direct fetch with
via the existing runCommandCapture helper. This uses the same
registry resolution as npm install (reads .npmrc config chain),
respects the npmCommand setting, and runs with this.cwd for
correct .npmrc lookup.
2026-04-14 20:20:14 +02:00
Aliou Diallo
ac37d4d439 feat(coding-agent): support multiple --append-system-prompt flags (#3171) 2026-04-14 20:19:11 +02:00
Mario Zechner
96916f2cad fix(coding-agent): warn on Anthropic subscription auth 2026-04-08 18:46:40 +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
080af6fc06 fix(coding-agent): handle missing session cwd 2026-04-05 21:24:32 +02:00
Mario Zechner
a7acef92a7 fix(coding-agent): resource collision precedence, user/project skills override package skills
Sort resolved resources by precedence rank (project settings > project auto >
user settings > user auto > package) so first-wins collision logic produces
correct results. Also reorder CLI paths to prepend instead of append.

fixes #2781
2026-04-04 21:28:38 +02:00
Mario Zechner
fbd35a4660 Renamed test 2026-04-04 21:07:08 +02:00
Mario Zechner
5e5eeb9603 fix(coding-agent): handle async fs.watch error events in theme watcher
closes #2791
2026-04-04 20:51:34 +02:00
Mario Zechner
9f9277ccdd refactor(coding-agent): replace AgentSessionRuntimeHost with closure-based AgentSessionRuntime
- Replace AgentSessionRuntimeHost and bootstrap abstractions with AgentSessionRuntime
- Runtime creation is now closure-based via CreateAgentSessionRuntimeFactory
- Factory closes over process-global fixed inputs, recreates cwd-bound services per effective cwd
- Session config (model, thinking, tools, scoped models) re-resolved per target cwd
- CLI resource paths resolved once at startup as absolute paths
- Swap lifecycle: teardown old, create next, apply next (hard fail on creation error)
- Unified diagnostics model (info/warning/error) for args, services, session resolution, resources
- No logging or process exits inside creation/parsing logic
- Removed session_directory support
- Removed session_switch and session_fork extension events (use session_start with reason)
- Moved package/config CLI to package-manager-cli.ts
- Fixed theme init for --resume session picker
- Fixed flaky reftable footer test (content-based polling)
- Fixed silent drop of unknown single-dash CLI flags
- Added error diagnostics for missing explicit CLI resource paths
- Updated SDK docs, examples, plans, exports, tests, changelog

fixes #2753
2026-04-03 20:14:12 +02:00
Mario Zechner
746f770b10 test(coding-agent): add session lifecycle characterization suite 2026-04-01 22:59:49 +02:00
Mario Zechner
957f21cea8 test(coding-agent): add queue characterization coverage 2026-04-01 14:31:02 +02:00
Mario Zechner
5ce0d15b66 fix(coding-agent): resolve theme export variables closes #2707 2026-03-31 14:41:50 +02:00
Mario Zechner
d86122cbd3 refactor(coding-agent): add runtime host for session switching closes #2024 2026-03-31 13:49:57 +02:00
warren
84d2b51a2e feat(coding-agent): add label timestamps to the session tree (#2691) 2026-03-30 15:56:37 +02:00
Mario Zechner
cbe1a8b732 fix(agent): simplify state API and update consumers fixes #2633 2026-03-30 12:43:34 +02:00
Mario Zechner
350d17d1f3 Merge branch 'main' of https://github.com/badlogic/pi-mono 2026-03-29 21:09:04 +02:00
Mario Zechner
ef6af5ebbd feat(ai,coding-agent): add faux provider and ModelRegistry factories 2026-03-29 21:08:50 +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
7e1dd8880c fix(coding-agent): restore extension input source semantics 2026-03-29 19:28:04 +02:00
Duncan Ogilvie
1ee0d28d7b fix(coding-agent): properly queue extension messages (#2674) 2026-03-29 19:23:40 +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
7d4faa080d fix: expose abort signal to extensions closes #2660 2026-03-28 22:25:06 +01: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
eeace79715 fix(coding-agent): preserve kept messages across repeated compaction closes #2608 2026-03-27 03:36:57 +01:00
Mario Zechner
161ad18287 fix(coding-agent): unify compaction UI events closes #2617 2026-03-27 03:14:24 +01:00
Mario Zechner
1ba899f6a6 fix(coding-agent): honor custom renderers for built-in tool overrides closes #2595 2026-03-27 03:10:13 +01:00
Mario Zechner
20a57e7599 feat(coding-agent): support multi-edit in edit tool 2026-03-27 02:21:09 +01:00
Mario Zechner
7a786d88aa fix(coding-agent): resolve models.json auth per request closes #1835 2026-03-27 00:47:40 +01:00
Mario Zechner
7e94d36a44 fix(coding-agent): add follow-up docs, changelog, and precedence tests closes #2429 2026-03-26 00:28:30 +01:00
Sam
2b1fc90cd7 feat(coding-agent): Add sessionDir support in settings.json (#2598)
Users can now set sessionDir in global or project settings.json instead
of passing --session-dir on every invocation. CLI flag takes precedence,
then settings.json, then extension hooks.

Closes #2429

Co-authored-by: Sam Collins <81678+smcllns@users.noreply.github.com>
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-03-26 00:03:36 +01:00
Mario Zechner
1dbe61b06f test(coding-agent): use valid PNG fixture for read tool 2026-03-25 22:22:48 +01:00
Mario Zechner
a6cfcdac18 test(coding-agent): fix showLoadedResources mocks 2026-03-25 22:18:58 +01:00
Mario Zechner
0a395a149a test(coding-agent): stabilize git update branch setup 2026-03-25 22:15:19 +01:00
Mario Zechner
ebe437081e fix(coding-agent): emit session_shutdown in print mode closes #2576 2026-03-24 23:50:47 +01:00
Mario Zechner
d08ab9b9c1 fix(coding-agent): recompute interactive bash preview width closes #2569 2026-03-24 20:09:43 +01:00
Mario Zechner
13b771e591 fix(coding-agent): reduce git update fetch noise closes #2548 2026-03-24 03:23:00 +01:00
Mario Zechner
835296b1d7 fix(coding-agent): expose rpc context usage closes #2550 2026-03-24 03:08:51 +01:00
Mario Zechner
a8a58ff26b fix(coding-agent): disambiguate duplicate slash commands, fixes #1061 2026-03-23 02:33:52 +01:00
Mario Zechner
4e5af01d73 fix(coding-agent): unify source provenance, closes #1734 2026-03-23 02:02:42 +01:00
Mario Zechner
883862a354 test(coding-agent): add AgentSession test harness with faux provider
Adds a reusable test harness for AgentSession runtime testing:

- Faux stream function with declarative response sequencing (text,
  tool calls, thinking, errors, custom usage, delays)
- Token-level streaming with realistic delta events (3-5 char chunks)
- One-call session factory with real in-memory dependencies
- Event capture with type-filtered access
- 14 self-tests covering text, tool calls, errors, retry, streaming
  deltas, thinking, event ordering, persistence

ref #2023
2026-03-23 02:02:34 +01:00
Mario Zechner
d501b9ca26 fix(coding-agent): attach source info to resources and commands, fixes #1734 2026-03-23 00:52:55 +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
f1fe49a641 fix(coding-agent): reserve stdout in print and json mode closes #2482 2026-03-22 21:21:29 +01:00
Mario Zechner
74073e5227 fix(coding-agent): skip no-op git package reinstalls
closes #2503
2026-03-22 19:19:47 +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
eda1082d4b fix(coding-agent): update project npm packages
closes #2459
2026-03-20 19:36:06 +01:00