Commit Graph

2893 Commits

Author SHA1 Message Date
roboomp 92e574cb02 fix(session): surface empty handoff generation as failure not cancel
The #7904 fix stopped masking provider errors as "Handoff cancelled", but
an empty or whitespace-only generation still fell through: whitespace-only
text passed the `!handoffText` guard and produced a bogus handoff, while
empty text returned undefined which the interactive /handoff caller mapped
to "Handoff cancelled" with no detail and no log entry.

Treat empty/whitespace-only output as a real failure: a user-initiated
handoff throws "Handoff generation produced no content" (surfaced as
"Handoff failed: ...") and logs it; auto-handoff keeps returning undefined
so maintenance falls back to context-full compaction. Also log genuine
handoff failures in the command controller so they persist for debugging.

Fixes #7993
2026-08-08 08:21:16 +00:00
can1357 7cebe901b7 refactor(coding-agent): narrowed over-exported internal symbols
- 28 symbols across discovery, mcp header policy, agent-hub projection and
  rendering, the agent registry, shell tokenizing and changelog comparison
  were exported but referenced only inside their own module; they are now
  module-private, shrinking the deep-import surface.
- Kept AGENT_PLUGIN_MANIFEST_SCHEMA, AGENT_PLUGIN_MCP_SCHEMA,
  parseAgentPluginManifest, clearAgentPluginRootCache and mergeMCPHeaders
  exported: each is a seam for tests that defend real parsing or header
  precedence behavior.
- Nothing reachable from an explicit exports entry or public barrel changed.
2026-08-08 06:32:01 +02:00
can1357 e0ec404de6 refactor(coding-agent): split theme module by responsibility
- theme.ts mixed symbol presets, JSON schema, color math, the Theme class,
  loading, global state, appearance handling and TUI adapters in 3171 lines.
- Symbols, schema, color, theme-class, loader and tui-adapters are now
  siblings; theme.ts keeps global state, the watcher, appearance handling and
  HTML export at 745 lines, with all 44 exports intact.
- Left appearance and export-colors in place: both read private mutable
  auto-theme state, so extracting them would have required new exported
  internals or DI rather than a straight move.
2026-08-08 06:32:01 +02:00
roboomp 4981eba1c2 fix(task): refreshed agent definitions without restart
Published per-cwd discovery snapshots to existing task tools and refreshed them from TUI, ACP, and Agent Control Center reload paths.

Added regressions for existing and future task tools across TUI and ACP reloads.

Fixes #7940
2026-08-07 23:38:25 +02:00
can1357 0e8142ad0e Merge PR #7904: fix(session): surface real handoff errors instead of false cancel (@roboomp) 2026-08-07 14:52:57 +02:00
roboomp 1e6638d8cd fix(session): surfaced real handoff errors instead of false cancel
The handoff catch in session-handoff.ts and the /handoff handler in
command-controller.ts mapped any error named AbortError to "Handoff
cancelled" regardless of whether the handoff signal was actually
aborted. Providers throw name-AbortError errors on non-user conditions
(stalls, idle timeouts, nested resolution failures), so a genuine
generation failure surfaced as a user cancellation and hid the cause.

Only report "Handoff cancelled" when handoffSignal.aborted is set;
re-throw the real error otherwise. The controller now trusts the
normalized "Handoff cancelled" message and drops its own AbortError
check so re-thrown provider failures render as "Handoff failed: ...".

Fixes #7903
2026-08-07 12:00:06 +00:00
can1357 850225a694 style: applied biome formatting after community fix merges 2026-08-07 13:40:52 +02:00
can1357 e6b1bd78d4 fix(status-line): clean up session accent metadata 2026-08-07 13:39:54 +02:00
can1357 ce122d7818 Merge PR #7867: fix(status-line): honor sessionAccent toggle for session_name segment (@CaelumSea) 2026-08-07 13:39:53 +02:00
can1357 0060ebacb1 Merge PR #7783: fix(acp): resolve session/load across legacy session directories (@roboomp) 2026-08-07 13:39:53 +02:00
can1357 9637a2cb0c Merge PR #7774: fix(tui): gate built-in renderers by tool provenance (@roboomp) 2026-08-07 13:37:57 +02:00
can1357 544fbd27dd fix(tui): preserve remapped expand key in tree selector 2026-08-07 13:37:57 +02:00
can1357 6e728f81de Merge PR #7840: fix(tui): make Ctrl+O expand tool output regardless of focus (@roboomp) 2026-08-07 13:37:57 +02:00
can1357 4beb58a39b fix(tree): make bookkeeping rows searchable 2026-08-07 13:37:57 +02:00
can1357 93f3c5c51c Merge PR #7782: fix(tree): stop rendering bookkeeping entries as empty rows (@ParadaCarleton) 2026-08-07 13:37:57 +02:00
can1357 68dece477f Merge PR #7772: fix(session): handle subscription-cap retry exhaustion (@roboomp) 2026-08-07 13:37:54 +02:00
Caelum d1ed93d8a2 fix(status-line): carry effective sessionAccent into SegmentContext and honor it for session_name
Address review feedback: the segment previously read the setting from ctx.session.settings, a second source of truth that could disagree with the component's effectiveSettings.sessionAccent and crashed lightweight test fixtures lacking a settings manager. Resolve the value once in #buildSegmentContext from the effective settings and pass it through SegmentContext.sessionAccent so the name segment and the gap-fill divider consume the same value. Add regression assertions for the enabled and disabled branches and a changelog entry.
2026-08-07 12:23:19 +08:00
Caelum 844e1fda33 fix(status-line): honor sessionAccent toggle for session_name segment
The session_name segment rendered the session name text with getSessionAccentHex unconditionally, ignoring the statusLine.sessionAccent setting. The adjacent gap-fill divider (component.ts) already gated on sessionAccent !== false, so disabling the setting only removed the accent-colored divider line while the session name itself stayed hash-colored - an inconsistent half-off state.

Read the setting via ctx.session.settings.get (same pattern already used by the goal segment in this file at line 206) and fall back to the theme accent color when disabled, matching the divider behavior.
2026-08-07 12:23:19 +08:00
roboomp 42322041c4 fix(tui): make ctrl+o expand tool output regardless of focus
app.tools.expand (Ctrl+O) was wired only through the editor's input path,
so when a tool-approval prompt or other selection dialog took keyboard
focus the key was delivered to that component and never reached the expand
handler — a large truncated edit could not be expanded while the user was
deciding whether to approve or deny it.

Promote the shortcut to a global TUI input listener (matching the existing
debug and branch/copy shortcuts) so it fires regardless of focus. It defers
when the main transcript is not the active surface (a fullscreen/anchored
overlay: agent hub, transcript viewer, log viewer, model picker) or when the
focused component rebinds Ctrl+O for its own use (the tree selector's filter
cycle). The editor-scoped handler is removed as a clean cutover.

Fixes #7837
2026-08-06 13:55:34 +00:00
can1357 d9d911a58d fix(coding-agent): kept mid-turn command deferral silent
- Reverted the status-line acknowledgment added for deferred panel
  commands: showStatus mounts a Spacer+Text into the transcript, and any
  mid-turn transcript mount re-renders rows below the growing live block,
  duplicating them in native scrollback (issues #4806/#6767).
- The queue still flushes at every settle, terminal or not.
2026-08-06 14:18:50 +02:00
ParadaCarleton ecaefd54d7 fix(tree): stop rendering bookkeeping entries as empty rows
Seven session entry types — title_change, credential_pin, mode_change,
service_tier_change, ttsr_injection, reset_boundary and session_init —
fell through #getEntryDisplayText's default branch to the empty string,
and none of them were in the default view's hidden set. Each one drew as
a bare bullet: a row you cannot read, cannot identify and cannot explain
the gap it leaves in the thread.

Hide them in the default and no-tools views, alongside the settings
entries they resemble, and give every one of them a label for `all`
mode. The default branch now falls back to the entry type rather than
the empty string, so a type added later degrades to a dull row instead
of an invisible one. Service tier renders its per-family map, and says
"(default)" when the tier was cleared instead of printing null.
2026-08-05 19:08:54 -07:00
roboomp 07bb0ac51f fix(acp): resolve session/load across legacy session directories
session/load and session/resume resolved a session only within the
directory re-derived from cwd (SessionManager.list(cwd)), so sessions
stored under the legacy/hashed project-directory scheme (17.2.5+,
reverted in #7656) were unreachable and threw "ACP session not found"
despite existing on disk.

#findStoredSession now falls back to a global by-id scan (listAll,
already used by the fork path) when the cwd-scoped lookup misses. The
session id is globally unique and #openStoredSession reopens the file
with the request cwd, so no directory-scheme knowledge is needed.

Fixes #7779
2026-08-06 02:08:49 +00:00
roboomp 931f61867c fix(tui): gated built-in renderers by tool provenance
- Routed session tool provenance through live and rebuilt transcript render paths.
- Kept same-named extension tools on the generic renderer while preserving native tool rendering.
- Added regression coverage for an external recall result collision.

Fixes #7770
2026-08-06 01:36:25 +00:00
roboomp f6c5a43a1f fix(session): handled subscription-cap retry exhaustion
- Classified subscription and plan rate caps as credential-rotatable usage limits while preserving transient per-minute throttles.

- Applied reason-specific backoff to transient rate limits and collapsed exhausted retry attempts behind one budget-labeled terminal error.

- Covered classification, delay selection, persisted transcript aggregation, and retry event propagation.

Fixes #7767
2026-08-06 01:31:22 +00:00
can1357 a6918d3397 Merge PR #7669: fix(catalog): exposed low effort tier for deepseek-v4-flash (@roboomp) 2026-08-05 22:16:29 +02:00
can1357 1e3419ebac Merge PR #7688: fix(tui): detach plan approval dispatch from serialized event chain (@roboomp) 2026-08-05 22:16:28 +02:00
can1357 677b6f10f5 Merge PR #7735: fix(coding-agent): return ToolInfo[] from getAllTools extension API (@roboomp) 2026-08-05 22:15:46 +02:00
can1357 dd1035fe98 Merge PR #7665: fix(model-hub): separate status glyph from role label (@jamesarch) 2026-08-05 21:50:25 +02:00
can1357 8e53c6bb50 Merge PR #7699: fix(coding-agent): cancelled stale mcp oauth reauthorization (@brymko) 2026-08-05 21:50:23 +02:00
can1357 0d243ea425 Merge PR #7746: fix(tui): surface deferred command output instead of failing silently (@mvid) 2026-08-05 21:50:01 +02:00
Mantas Vidutis ebdda043b8 Merge upstream/main into fix/deferred-command-output-feedback 2026-08-05 11:43:17 -07:00
Mantas Vidutis 006933ef06 docs(coding-agent): align presentCommandOutput doc with settle-time flush 2026-08-05 11:13:27 -07:00
roboomp 83496b8211 fix(coding-agent): returned ToolInfo[] from getAllTools extension API
The ExtensionAPI getAllTools() wired to session.getAllToolNames(),
returning bare tool-name strings. Upstream @earendil-works/pi-coding-agent
promises ToolInfo[] with sourceInfo, so extensions loaded through the
legacy-pi shim (e.g. gentle-pi) crashed on t.sourceInfo.source at every
session start.

Added SourceInfo/ToolInfo types plus SessionTools.getAllToolInfos(), which
returns { name, description, parameters, sourceInfo } and classifies each
tool as builtin/mcp/sdk/extension. Rewired every getAllTools action site
(interactive, acp, print/rpc, subagent executor) and the example extension.

Fixes #7732
2026-08-05 15:42:06 +00:00
can1357 e9888367d1 refactor: migrated packages to internal utility modules and removed external dependencies
- Implemented in-house, zero-dependency utility modules in `pi-utils` covering DOM manipulation, markdown parsing, templating, browser automation helpers, and terminal buffers.
- Migrated packages across the repository to consume the new internal utilities and `omptype` schema validators instead of external dependencies.
- Removed multiple external runtime and development dependencies including Zod, Marked, LRU cache, Turndown, and Puppeteer browser packages.
2026-08-05 13:39:09 +02:00
brymko 9e898fa185 fix(coding-agent): cancelled stale mcp oauth reauthorization
Repeated /mcp reauth commands could remain blocked by a prior
unfinished login because each command receives a fresh controller.
Coordinate flows through session-shared state so a replacement cancels
and cleans up the old flow before proceeding.
2026-08-05 18:46:49 +08:00
roboomp a785811a64 fix(tui): detach plan approval dispatch from serialized event chain
After the fullscreen Plan Review closed on approve-and-execute, the
conversation view stayed blank while the plan ran. The propose write's
tool_execution_end handler runs inside EventController's serialized
dispatch chain and awaited handlePlanApproval, which awaits session.prompt
for the entire execution turn, so every later agent_start/message_start/
tool/message_update event queued behind it until the run finished.

Detach the approval dispatch so the dispatch link settles immediately and
the execution turn's events render live. Follow-up to #5688, which only
moved the overlay close before the still-blocking dispatch.

Fixes #7684
2026-08-05 09:18:12 +00:00
roboomp 230275faa2 fix(tui): displayed off thinking state
Shift-Tab entered the off state correctly, but both status-line render paths suppressed its label. Render off explicitly so users can distinguish disabled reasoning from a missing option.

Fixes #7668
2026-08-05 06:16:48 +00:00
jamesarch d6ab7291d1 fix(model-hub): separate status glyph from role label
Under the `nerd` symbol preset, `status.enabled` and `status.shadowed` are
Nerd Font private-use icons (U+F111 / U+F10C). Those glyphs are drawn two
cells wide, but `visibleWidth` counts them as one: `tui/utils.ts` pins
`ambiguousIsNarrow: true`, and the PUA block is East_Asian_Width=Ambiguous.

With no separator the icon overhangs into the next cell and swallows the
label's first character, so the role chips in the model browser and model
hub render as `efault` / `ision` / `lan` / `ask` / `dvisor` instead of
`default` / `vision` / `plan` / `task` / `advisor`.

The adjacent `status.success` check on the very same line already carries a
leading space and renders correctly, which isolates the missing separator
as the cause rather than the glyph itself.

Role-chip assertions in test/model-hub.test.ts are updated for the new
spacing, and the change is recorded under CHANGELOG `[Unreleased]`.

Constraint: lint
Confidence: high
Scope-risk: low
2026-08-05 09:31:52 +08:00
Kyle McCleary 5cc4f5c93a Merge main into refactor/agent-hub-fullscreen 2026-08-04 18:15:42 -07:00
Kyle McCleary 3180fd3d7f fix(coding-agent): complete Agent Hub inspector metadata 2026-08-04 17:20:00 -07:00
Kyle McCleary 8e5f619502 fix(coding-agent): harden Agent Hub lifecycle and persistence 2026-08-04 16:29:15 -07:00
can1357 94c838faea Merge PR #7539: fix(coding-agent): complete usage-aware fallback integration (@eggpeat) 2026-08-05 01:12:02 +02:00
can1357 783739e618 Merge PR #7542: fix(coding-agent): coalesce streaming message_update handler work per render window (#7443) (@szavadsky) 2026-08-05 01:12:01 +02:00
can1357 0cf5d55ac0 Merge PR #7629: fix(coding-agent): retry buffered print streams (@roboomp) 2026-08-05 01:12:00 +02:00
can1357 43666b3b1a fix(cli): follow promise resolver convention 2026-08-05 01:11:59 +02:00
can1357 e4684325a3 Merge PR #7637: fix(cli): flush final json record before print-mode exit (@roboomp) 2026-08-05 01:11:59 +02:00
can1357 772fe8fa6e Merge PR #7500: perf(agent-hub): bound roster rendering to viewport (@hancens1024) 2026-08-05 01:11:59 +02:00
Slava Zavadsky 326fb24367 fix(coding-agent): chain every queued dispatch onto the current tail
The previous #runSerialized waited on the shared #dispatchTail, then ran
unconditionally: when two or more events queued behind an in-flight run,
each resumed from the same settled await and started its own run in
parallel, defeating the ordering guarantee for a burst landing in one
coalescing window (message_end + agent_end behind a suspended flush).

Each waiter now chains its own link onto the current tail
(tail.then(run, run)), so queued runs start strictly one after another;
the idle path still runs synchronously, preserving the flush timing the
coalescing tests assert on. The in-flight flag clears only when the
settling link is still the tail, so a later chained link's settle does
not clear it early.

Regression test: two message_end events queued behind a suspended window
flush stay serialized (init call count steps 1 -> 2 -> 3 as each gate
opens); fails on the previous implementation.
2026-08-04 17:42:54 -04:00
Slava Zavadsky 50ee839c51 fix(modes): serialize dispatch so a stream tail cannot overtake the coalesced flush
AgentSession.#emit fires listeners fire-and-forget, and the coalesced
message_update flush fires from its own 33ms timer — neither path awaited
the other. A rapid stream tail (message_update -> message_end ->
agent_end) could therefore run the end handlers while the flush was
suspended mid-await, agent_end removing streamingComponent before
#handleMessageEnd finalizes and records the final message (issue #7443
follow-up).

- #runSerialized chains listener dispatch and the timer flush through one
  promise chain; an in-flight run holds later events until it completes.
  Idle dispatch stays synchronous (no added microtask), preserving the
  timing the coalescing tests assert on.
- Regression test: a message_end landing while the window flush is
  suspended on init is queued behind it (initCalls 1 while suspended,
  then 2), where the pristine code ran both concurrently (2 while
  suspended). Fails without the fix.
2026-08-04 16:35:56 -04:00
Mantas Vidutis ced87b907b fix(tui): flush queued command panels at a non-terminal settle
Reaching the `isTerminal === false` branch means the superseded-turn guard
above it already passed, so `session.isStreaming` is false: a command
issued from that point mounts immediately while panels queued earlier in
the turn stay in `#pendingCommandOutput` until some later terminal
agent_end. Newer output rendered ahead of older, and the queued panel
could strand for minutes on an async fan-out that keeps settling
non-terminally.

Flush there too. The transcript is quiescent at a settle, which is the
condition #4806 wanted, and the notice now says "until the agent pauses"
rather than promising the current turn.
2026-08-04 11:47:54 -07:00