Commit Graph

84 Commits

Author SHA1 Message Date
Mario Zechner 1235c0ec64 fix(agent): decouple agent streams from compat
closes #6851
2026-07-20 17:54:36 +02:00
David Brailovsky 2fd3868401 add usage info to branch summary, compaction and tool result entries (#6671)
* add usage info to branch summary entries

* add usage to compaction entries

* allow custom tools to report llm usage in tool results

* allow observing and patching usage in tool_result hooks

* agent-harness: save usage in entries

for compaction, branch summaries and tool results
2026-07-20 16:41:43 +02:00
Mario Zechner f1a466b19d feat(coding-agent): add llama.cpp router integration 2026-07-17 16:25:00 +02:00
Armin Ronacher b97ed20210 fix(coding-agent): explain clone failure for unsaved sessions 2026-07-16 19:06:56 +02:00
Mario Zechner fab309e955 fix(coding-agent): refresh model catalogs in picker 2026-07-15 12:35:29 +02:00
Mario Zechner cd7cad4ee2 feat(coding-agent): merge origin/main into model runtime facade 2026-07-15 12:25:36 +02:00
Mario Zechner 9993c96907 feat(coding-agent): replace model registry with model runtime
Move provider auth and OAuth flows onto pi-ai Models, compose models.json and extension overlays through ModelRuntime, and retain ModelRegistry as an extension compatibility facade.
2026-07-14 17:48:45 +02:00
David Brailovsky 7303cbac5d fix branch summary when using ambient auth (#6595)
allow null apiKey. uses the same auth flow like compaction

fixes #6324
2026-07-13 10:49:10 +02:00
Armin Ronacher 3d8f74357c feat(ai): support message-anchored tool loading (#6474)
This adds cache-friendly dynamic tool loading anchored to tool results. Purely additive active-tool changes are recorded with `addedToolNames`, allowing supported Anthropic and OpenAI Responses models to load tool definitions at the point they become available instead of placing them in the cached prompt prefix.

It retains safe fallback behavior for unsupported models and non-additive changes but it will wipe caches.
2026-07-10 23:52:54 +02:00
Armin Ronacher 3ea064ea2a fix: support Bedrock API key login 2026-07-10 19:34:11 +02:00
Mario Zechner fbdd46389c feat(ai): add max thinking level 2026-07-09 22:30:53 +02:00
Armin Ronacher a98778e21c test(coding-agent): fix interactive mode fixture 2026-07-09 21:01:50 +02:00
Armin Ronacher 3f9aa5d10b feat(coding-agent): add prompt cache miss tracking (#6427)
Detect prompt cache misses per turn by comparing each assistant message's
cache reads against the previous request's prompt tokens (core/cache-stats.ts).
Significant misses emit a warning-colored transcript notice at the turn they
occur, noting idle gaps past the cache TTL and model switches when relevant.

/session gained cache statistics: a compact token/cache breakdown with hit
rate, a $-prefixed cost section with per-model cost breakdown, and the
cumulative cost re-billed due to cache misses.
2026-07-09 14:12:57 +02:00
Mario Zechner e9fa5a68a1 fix(coding-agent): add settled agent lifecycle event
closes #6363
2026-07-09 12:42:08 +02:00
Victor Araújo b3dff19a04 feat(coding-agent): add InlineExtension type for named inline extension factories (#6267)
* feat(coding-agent): add InlineExtension type for named inline extension factories

* test(coding-agent): update utilities and add regression test for InlineExtension
2026-07-06 20:59:37 +02:00
Armin Ronacher 8c0ccd14b3 fix(ai,agent,coding-agent): normalize null message content at ingestion boundaries (#6343)
The Message types require content to always be present, but untyped JS
extension tools, hand-built histories, and old or hand-edited session
files can violate that contract, crashing rendering, compaction, and
provider request conversion with 'content is not iterable'.

Normalize null/missing content to an empty array at the ingestion
boundaries instead of guarding every consumer:

- transformMessages (choke point before every provider request)
- createToolResultMessage in the agent loop
- session entry loading (message and custom_message entries)
- extension custom messages (sendCustomMessage, before_agent_start)
- message_end extension replacements

fixes #6259, fixes #6276
2026-07-06 20:47:08 +02:00
Mario Zechner ba10b60b51 fix(coding-agent): add entry renderers for session entries 2026-07-01 11:30:26 +02:00
Mario Zechner fd6659dd5d fix(coding-agent): preserve run prompt during tool refresh
closes #6162
2026-06-30 14:08:48 +02:00
Mat e547bb9f41 fix(coding-agent): refresh session state before next turn 2026-06-30 13:56:04 +02:00
Alexey Zaytsev 6564d94717 feat(coding-agent): add configurable assistant output padding
Closes #6168
2026-06-30 11:44:34 +02:00
Alexey Zaytsev 726a9c526c fix(coding-agent): emit session name changes to extensions 2026-06-30 00:40:15 -05:00
Michael Yu 73581ea995 fix(coding-agent): avoid pre-prompt compaction continue 2026-06-25 21:43:03 +08:00
Armin Ronacher 371adcf371 fix(coding-agent): retry explicit provider retry errors
closes #6019
2026-06-24 18:14:06 +02:00
haoqixu c5440162b8 fix(coding-agent): show resources before messages when resuming session 2026-06-24 20:41:34 +08:00
Mario Zechner 129eb460cd feat(ai): complete models runtime migration 2026-06-23 15:29:46 +02:00
Mario Zechner 7fedc3324e Merge pull request #5999 from haoqixu/fix-5996
fix(coding-agent): normalize session names
2026-06-23 15:15:52 +02:00
haoqixu 7c1ef87756 fix(coding-agent): normalize session names 2026-06-23 19:14:02 +08:00
Mario Zechner abbd911693 Merge main into model-registry 2026-06-22 14:00:18 +02:00
Enrico 5b9b70d29c feat(coding-agent): add compaction reason and willRetry to extension compact events (#5962)
session_before_compact and session_compact now carry
reason ("manual" | "threshold" | "overflow") and willRetry, matching
what the RPC protocol already exposes via auto_compaction_start/end.
Extensions can now distinguish manual /compact from threshold
auto-compaction and overflow recovery through the public API instead
of monkeypatching AgentSession internals.
2026-06-22 10:36:16 +02:00
Armin Ronacher 2417adb46a fix(coding-agent): preserve startup extension UI
closes #5943
2026-06-21 23:19:34 +02:00
Armin Ronacher 5505316ea2 fix(coding-agent): cache extension imports for session switches
Closes #5905.
2026-06-20 21:07:45 +02:00
Armin Ronacher c60f6a8ab3 feat(coding-agent): expose post-compaction token estimates
closes #5877
2026-06-18 23:01:10 +02:00
Armin Ronacher 7d08c81a09 fix(coding-agent): avoid empty compaction summaries
closes #4811
2026-06-18 22:17:57 +02:00
Armin Ronacher 6b9f3f492f fix(coding-agent): avoid retrying successful overflow compaction
closes #5720
2026-06-18 19:30:14 +02:00
Armin Ronacher d0b46764b1 feat(coding-agent): add automatic theme mode (#5874) 2026-06-18 17:13:47 +02:00
Vegard Stikbakke 51f7523587 fix(coding-agent): include RPC request id on unknown commands
closes #5868
2026-06-18 10:44:59 +02:00
Joseph Mearman 3fa4095629 fix: drain stdout before resolving when a child holds the pipe past exit (#5753) 2026-06-15 09:55:45 +02:00
Armin Ronacher ba0ec61563 fix(coding-agent): restore terminal on SIGTERM
closes #5724
2026-06-15 00:47:35 +02:00
Armin Ronacher 9e9fc79478 fix(coding-agent): treat uppercase config values as literals
closes #5661
2026-06-13 21:24:22 +02:00
Armin Ronacher 6102dd2084 fix(coding-agent): handle missing export themes
closes #5596
2026-06-12 17:56:43 +02:00
Mario Zechner 8a0903ebf2 feat(ai): compat entrypoint, core-only root barrel (phase 5)
The root barrel is now core-only and side-effect free: types,
createModels/createProvider, auth substrate, lazyStream/lazyApi, faux,
utils. Generated catalogs, api-registry, env-api-keys, images, global
stream functions, and per-API lazy wrappers leave the root.

New @earendil-works/pi-ai/compat preserves the old surface verbatim as
a strict superset of the root: api-dispatch stream/complete with env
key injection, the builtin registration side effect (skip-if-present so
it cannot clobber earlier overrides), deprecated getModel/getModels/
getProviders aliases of the new getBuiltin* reads in providers/all,
lazy api wrappers + setBedrockProviderModule, and image generation.
Compat dies with the coding-agent ModelManager migration.

Packaging: exports map gains ./compat, ./providers/*, ./api/*;
sideEffects array lists only the effectful modules.

Old-global imports across agent/coding-agent/examples and pi-ai tests
switch to /compat (path-only; compat is a superset). The coding-agent
extension loader resolves the pi-ai ROOT specifier to compat, so
existing user extensions using the old global API keep working at
runtime until compat is removed. vitest configs alias /compat to src;
browser smoke imports old globals from /compat.
2026-06-10 21:17:12 +02:00
Mario Zechner 9632bddd38 fix(coding-agent): stabilize OAuth login prompt rows
closes #5433
2026-06-09 13:41:08 +02:00
Alexey Zaytsev 8216cca5a7 Add system prompt options to extension commands 2026-06-01 15:42:56 -05:00
Mario Zechner 778f519b23 Remove leading spaces from resume session hint 2026-05-29 23:30:02 +02:00
Michael Yu 17e9e87576 feat(coding-agent): print resume hint on interactive exit 2026-05-29 15:56:42 +08:00
Mario Zechner 9380d5f2e4 feat(coding-agent): add exclude tools option closes #5109 2026-05-28 23:49:18 +02:00
Mario Zechner b64f3f5eae fix(coding-agent): run extension cleanup and restore terminal on signal exits
Signal-triggered shutdown (SIGTERM/SIGHUP) now emits session_shutdown
before any terminal writes, and SIGHUP no longer hard-exits, so extension
resources (e.g. sockets) are released and the terminal is restored even
when the terminal is gone. A genuinely dead terminal still exits without
hot-spinning via the EIO error path.

closes #5080
2026-05-28 23:19:27 +02:00
Mario Zechner 8e77f8797b Merge pull request #5115 from DanielThomas/dannyt/sendUserMessage-agent-end
fix(coding-agent): drain follow-ups queued during agent_end
2026-05-28 10:47:31 +02:00
Danny Thomas a29a7902e9 fix(coding-agent): drain follow-ups queued during agent_end
When an extension queues a follow-up during `agent_end` it
gets stuck on the follow-up queue until after the next user
message.

Add a hasQueuedMessages() check to _handlePostAgentRun
so the existing while/continue loop drains them.

- One-line fix in _handlePostAgentRun
- Integration test in agent-session-queue
- git-merge-and-resolve example extension with tests
2026-05-28 18:27:39 +10:00
Mario Zechner cbe8625528 Fix input event streaming behavior semantics 2026-05-28 10:13:06 +02:00