Commit Graph

2409 Commits

Author SHA1 Message Date
can1357 98c6564db6 fix(coding-agent): fixed IRC handoff await behavior to prevent stale mailbox relays
- Fixed `IrcBus.send` to avoid queueing successful outbound messages and buffer only failures.
- Fixed IRC `send` await handling to use cancellable waiters with `drainPending: false` and abort-on-empty recipients.
- Fixed relay behavior to skip main-agent-originated messages and prevent duplicate outbound IRC relay cards.
- Added tests covering subagent-only relay routing, await-time fresh replies, and failure mailbox counts.
2026-06-10 23:56:38 +02:00
can1357 72c12ff9c2 feat(task): migrated task tool to batch-first mode with shared context
- Replaced task-simple-mode with a `task.batch` setting enabled by default.
- Updated task schema to use batch `{agent, context, tasks[]}` payloads.
- Migrated task execution to spawn one async job per task and merge outputs.
- Removed per-call schema passing while preserving legacy flat task calls.
2026-06-10 23:47:28 +02:00
can1357 0e92185217 Merge remote-tracking branch 'origin/farm/a61a3aee/fix-shake-loop-token-metric-divergence' 2026-06-10 23:46:59 +02:00
can1357 681479c8c9 feat(coding-agent): removed startup input buffering and simplified interactive initialization
- Removed `StartupInput` pre-TUI buffering and replay, and read startup input directly each loop.
- Removed pre-startup model/provider/LSP discovery and startup handoff into session setup.
- Updated `WelcomeComponent` to use per-instance tips and show `No recent sessions` when empty.
- Documented task option removals and startup splash/input behavior changes in `CHANGELOG.md`.
2026-06-10 23:42:39 +02:00
roboomp 7fa0eeb43d fix(agent): break shake auto-continue loop on token-metric divergence
The shake-strategy post-shake threshold check was reading
#estimatePendingPromptTokens([]) while #checkCompaction triggered on
calculateContextTokens(assistantMessage.usage). The local estimator
ignored block.thinkingSignature payloads (OpenAI Responses encrypted
reasoning items, Anthropic signed thinking blocks, etc.), so on a
thinking-heavy session the estimate sat ~0.9–2× below provider-reported
usage. Once the two straddled the threshold, the #2119 dead-loop guard
never fired, shake reported 'handled', and #scheduleAutoContinuePrompt
re-injected the auto-continue developer prompt every turn — 53 injections
in a real 25-minute repro session before an external timeout.

Thread the trigger's provider-anchored contextTokens through
#runAutoCompaction → #runAutoShake for the threshold and incomplete
paths, then evaluate residual pressure as triggerContextTokens −
result.tokensFreed with an 80% recovery-band hysteresis. Re-checking
against the raw threshold (even on the corrected metric) would still let
shake reclaim a trickle of the previous turn's elidable blocks and land
just under the line every turn; the band closes that oscillation.

As defense in depth, estimateTokens() now charges thinkingSignature and
redactedThinking.data alongside the visible thinking text so every
other site that uses the estimator (idle compaction, pre-prompt check,
status line) tracks provider usage on replay.

New regression test pins the contract; existing dispatch test bumped
its mocked tokensFreed so its happy-path scenario lands inside the new
recovery band.

Fixes #2275
2026-06-10 21:18:46 +00:00
can1357 a4f83d6aad fix(coding-agent): respect screenshot format from save path extension 2026-06-10 23:17:00 +02:00
can1357 ad1c17fffd ux(coding-agent): combined ttsr rule notifications into one block 2026-06-10 23:15:40 +02:00
can1357 6836dc1193 fix(coding-agent/tools): kept the resolve result block color past the leading icon 2026-06-10 23:15:34 +02:00
can1357 86195d6944 refactor(cross-cutting): moved grouped path-tree helpers into pi-utils 2026-06-10 23:13:39 +02:00
can1357 6ac73655c8 feat(coding-agent): removed resume support and switched task execution to spawn-only
- Removed `resume` from task params and schema, requiring agent and assignment inputs.
- Dropped resume continuation paths in task execution and call rendering, always spawning a new agent.
- Removed the `irc.enabled` setting and computed IRC availability by task-depth rules.
- Updated task follow-up guidance to use IRC messaging/history links instead of `task(resume:)`.
2026-06-10 23:00:03 +02:00
can1357 1d73af19f8 fix(coding-agent/tools): stripped task-result envelope from job TUI previews
- Added a helper to strip model-facing `<task-result>` wrappers from job result text.
- Updated the job tool renderer to preview the unwrapped `<output>/<preview>` body instead of the envelope markup.
- Documented the settled-task preview fix in the coding-agent changelog.
2026-06-10 22:44:11 +02:00
can1357 0fe75212b4 ux(hashline): appended context previews to unresolved block-edit errors
- Added a shared `formatAnchoredContext` helper and switched mismatch formatting to use it.
- Extended unresolved block-edit errors to append nearby numbered context with `*`-marked anchor lines.
- Updated unit and integration tests and docs to reflect the new unresolved-block preview behavior.
2026-06-10 21:50:19 +02:00
can1357 08a941a14e feat: added standalone snapcompact package and model-specific frame shaping
- Added a new @oh-my-pi/snapcompact package and redirected compaction call sites to it.
- Added provider-aware snapcompact shape resolution for model-specific mixed-frame behavior.
- Added optional image detail support by extending ImageContent and passing hints through OpenAI providers.
- Added native snapcompact render options, including 5x8/8x8 font loading and palette/geometry controls.
2026-06-10 21:50:03 +02:00
can1357 9d99ae1af0 feat(coding-agent): rewrote the task tool to spawn one persistent subagent per call
The task tool now takes a single { agent, assignment, description, ... } and always runs the subagent in the background — the batch tasks[] array and shared context parameter are gone. Fan-out is parallel task calls; shared background flows through a '/Users/can/.omp/agent/sessions/-Projects-.tree-pi-commit/2026-06-10T15-36-32-782Z_019eb22d-970e-7000-8964-72c98becf3e8/local' file referenced in each assignment.\n\nIntroduces a persistent subagent lifecycle: finished subagents stay live as idle, the lifecycle manager parks them to disk after task.agentIdleTtlMs (default 7 minutes; 0 keeps them live until exit), and they revive automatically when prompted from the Agent Hub, messaged on IRC, or resumed via task. New task(resume: "<id>") revives an idle or parked subagent and runs a follow-up assignment in its existing session.\n\nAdds soft request budgets (explore/quick_task 40, others 90, configurable via task.softRequestBudget, 0 disables): crossing the budget injects a one-time wrap-up steer into the child; crossing 1.5× aborts the run gracefully. Cancelled/aborted subagent salvage replaces the old (no output) with the child's last activity snippet plus request/token stats; SingleResult tracks a per-child requests counter (assistant message_end events) used to sort agent lists in runtime-ascending order in both the live progress view (finished agents above pending/running) and the finalized result view, so rows no longer reshuffle on finalize. Adds a task gallery fixture variant for the resume path (renderer key separated from fixture key).\n\nAll task tests are reshaped around the single-call contract; tests for the discarded shared-context flow are removed, and new task-guards/task-resume/task-schema tests pin the new contract surface.
2026-06-10 17:54:47 +02:00
can1357 9613076e96 feat(coding-agent): added repeat-read notice to the read tool
Tracks successful file reads per resolved base path (selector stripped) for the session; once a path has been whole-file-read three times, every subsequent read for that path appends a one-line nudge suggesting narrower line-range re-reads or the context echoed in edit results. Non-file sources (URLs, internal resources, directories, archives, SQLite, images) are never counted.
2026-06-10 17:53:46 +02:00
can1357 3aa1cedd73 feat(coding-agent): enforced an inline byte cap at the bash and browser tool boundary
Adds enforceInlineByteCap() in streaming-output and applies it to bash and browser tool results: oversized outputs are elided head/tail with an artifact:// footer pointing at the full capture, closing paths that previously let 100KB+ inline results past the minimizer. Defense at the tool-result boundary (no-op for already-bounded output).
2026-06-10 17:53:26 +02:00
can1357 0f4f301a02 feat(coding-agent): made waiting job polls displaceable in the TUI
A job poll whose watched jobs are all still running and nothing was cancelled is pure 'still waiting' noise once a newer block exists. ToolExecutionComponent now detects isWaitingPollDetails on the result, leaves the block displaceable, and keeps its rows out of scrollback. EventController tracks the most recent displaceable poll and resolves it (sealing the block) on every event that proves another tool now owns the live region: a new tool call/result, a streaming arg start, an end-of-turn signal, or another job result that itself isn't displaceable. UiHelpers' transcript rebuild applies the same rule. Docs and the new job-poll-displacement test pin the behavior.
2026-06-10 17:53:07 +02:00
can1357 9f62c7904a feat(coding-agent): integrated snapcompact strategy and per-turn supersede pruning
Adds compaction.strategy: "snapcompact" to the schema and the AgentSession routing: when chosen, both manual /compact (without custom instructions) and auto compaction call snapcompactCompact() to archive history as PNG frames instead of an LLM summary. Falls back to context-full with a visible warning notice when the current model is text-only or when /compact gets custom instructions. CustomTool and shared-event payloads carry the new action through. \n\nAlso wires the per-turn supersede pass: #pruneSupersededReads() runs every turn before threshold gating (cache-aware: only fires when the post-candidate suffix is small or the prompt cache is cold), prunes older read results superseded by a newer read of the same file, rewrites the session, and accounts the saved tokens in the next compaction decision. Gated by compaction.supersedeReads (default on).\n\nsession/messages.ts now delegates the core role conversion to agent-core's convertMessageToLlm so snapcompact image blocks flow through the LLM-context conversion path.
2026-06-10 17:52:49 +02:00
can1357 a64ff00cb8 feat(coding-agent): added history:// internal URL for agent transcripts
Registers a HistoryProtocolHandler with the internal URL router: history:// lists every registered agent (id, status, kind, last activity) and history://<agentId> renders a concise markdown transcript (tool calls collapsed to one line each, thinking elided). Live refs render from the in-memory message array; parked refs load read-only from the JSONL session file via loadSessionMessagesReadOnly (no writer, no lock). System prompt + read tool prompt + docs/tools/read.md learn the new scheme.
2026-06-10 17:52:13 +02:00
can1357 2b28816010 feat(coding-agent): replaced session observer with Agent Hub and inline compaction divider
The session-observer overlay is gone. The Agent Hub (ctrl+s, alt+a, or double-tap left arrow on an empty editor) presents one overlay with two views: a live registry table (status, unread irc count, current task, last activity; j/k to navigate, r to revive, x to abort/release) and per-agent chat (transcript + input line) — submitting revives a parked agent and steers it via the normal prompt path. Main is the ambient chat and stays out of the table.\n\nrenderInitialMessages no longer takes a prebuilt context: every redraw now reaches for AgentSession.buildTranscriptSessionContext() (full-history transcript with each compaction emitted inline at the point it fired, snapcompact frames re-attached on rebuild). UiHelpers drops the deferred-compaction render and the IRC autoreply branch that the new mailbox bus deprecated. CompactionSummaryMessage renders as a slim divider (── 📷 compacted · ctrl+o ──), expanding to the summary + snapcompact frame count. session-manager.buildSessionContext gains a { transcript: true } mode; an exported buildSessionContextFromFile() reads a session file without taking the writer lock so the hub chat view can tail any agent (parked or live). Theme picks up icon.camera + tool.irc symbol entries.
2026-06-10 17:51:42 +02:00
can1357 fcb8663de8 feat(coding-agent): reworked irc to a send/wait/inbox/list mailbox bus
Replaces the blocking auto-reply IRC turn with a process-global IrcBus and a four-op tool (send/wait/inbox/list). send is fire-and-forget with per-recipient delivery receipts (injected/woken/revived/failed); replies become real turns by the recipient, observed via wait (or the send await:true sugar). Bounded per-agent mailboxes (cap 100) drop oldest on overflow; AgentSession.deliverIrcMessage folds an in-flight delivery in as a non-interrupting aside at the next step boundary, or starts a real wake turn when idle. AgentRegistry/lifecycle handle the idle→woken / parked→revived transitions, so messaging a non-running peer brings it back. Adds a dedicated TUI renderer (directional headers, delivery-outcome coloring, quoted bodies, per-recipient receipt trees, status-badged peer lists with unread counts). irc.timeoutMs is now the default timeout for wait / send await:true. AgentSession sheds the agentRegistry config field, the dedupeIrcReply → dedupeEphemeralReply rename (now used by /btw and /omfg), and the background-channel exchange queue / forwardIrcRelayToMain plumbing the auto-reply model needed.
2026-06-10 17:47:47 +02:00
can1357 1654c759ca feat(coding-agent): added AgentLifecycleManager for idle/parked subagents
Introduces AgentLifecycleManager: when the task executor adopts a finished subagent the manager arms a TTL timer on idle, parks the agent on expiry (disposes the live session, keeps the AgentRef + sessionFile), and revives it on demand via an injected reviver. Only this manager flips parked ↔ idle. AgentRegistry now annotates session: AgentRef["session"] as null exactly when parked/aborted, and sdk.ts wires the lifecycle dispose into main-session teardown, derives agentKind once, and gates ref unregistration on parking so a parked agent stays addressable (history://, revive).
2026-06-10 17:46:02 +02:00
can1357 5406edeed0 refactor(coding-agent): made the job tool always available and dropped async-job gating
Removes isBackgroundJobSupportEnabled and JobTool.createIf; the tool is now registered unconditionally via `new JobTool(s)`. `async.enabled` now gates async bash commands only — the task tool runs asynchronously regardless. Deletes the async/support module and its barrel re-export.
2026-06-10 17:44:31 +02:00
can1357 84175ce4b2 fix(agent): preserved queued steering across externally aborted runs
Interrupting mid-tool execution (e.g. Enter with a pending steer) drained the steering queue into the dying run — it landed in history without a response and the post-abort resume saw an empty queue, so the agent stopped instead of continuing. Steering/follow-up/aside queue polls in runLoopBody and the post-tool-call check in executeToolCalls are now skipped once the run's abort signal fires, leaving the queue intact for Agent.continue().
2026-06-10 17:43:51 +02:00
can1357 70fc147d3f feat(coding-agent): enabled startup input capture with queued replay and async submit handling
- Added pre-TUI startup input capture that queued non-empty Enter submissions.
- Replayed queued startup submissions after initialization and injected startup editor text into InteractiveMode.
- Handled startup Ctrl+C to clear typed text and Ctrl+D to exit, with detach restoring terminal state.
- Extended TUI Editor `onSubmit` to accept `void | Promise<void>` for async handlers.
2026-06-10 11:20:26 +02:00
can1357 fd06c70dde fix(ask): restored checkmark glyph on custom answers and done option
- Replaced ask-tool icon with success glyph swapped during status sweep.
- Updated tests to expect a single success glyph on custom input.
2026-06-10 11:02:47 +02:00
can1357 6b76463941 fix: fixed stats dashboard asset serving for bundled CLI distributions
- Fixed npm CLI bundling by invoking `generate-client-bundle.ts --generate` before build and `--reset` after.
- Added `PI_BUNDLED` handling in `packages/stats/src/server.ts` and switched bundled distributions to embedded assets.
- Decoded embedded archives via `decodeEmbeddedClientArchive` and treated legacy placeholder content as missing.
- Handled missing dashboard source/build directories as ENOENT during mtime scans to avoid startup crashes.
- Extended `--smoke-test` to start the stats server and validate dashboard HTML contains expected asset markers.
2026-06-10 10:45:31 +02:00
can1357 316722397a Merge pull request #1896: fix(coding-agent): respect user shell for ! shortcuts 2026-06-10 09:52:28 +02:00
can1357 ffe3b6afd4 fix(coding-agent): rehome TITLE_SYSTEM.md discovery and reload it on cwd change 2026-06-10 09:51:46 +02:00
can1357 95146192e9 fix(coding-agent): evaluate enabledModels globs and fuzzy selectors in the sync ACP filter 2026-06-10 09:51:45 +02:00
can1357 4561cdfbd4 ux(coding-agent/task): reordered live task progress to show finished agents first
- Added a stable progress-ordering helper that moved pending and running agents below completed and failed ones.
- Applied this ordering to top-level and nested live task-progress rendering so finished entries render first.
- Added a renderer test and changelog note covering the finished-before-unfinished progress ordering.
2026-06-10 09:51:43 +02:00
roboomp cafd957f5d fix(providers): disabled ollama thinking for off turns
Propagated explicit thinking-off state through the agent loop so provider requests receive disableReasoning instead of an undefined effort. Added Ollama and agent-session regressions for the :off path.\n\nFixes #2239
2026-06-10 07:41:58 +00:00
handlecusion bbf8216768 fix(coding-agent): avoid interactive fish shortcuts 2026-06-10 16:36:09 +09:00
handlecusion 9820a5233f test(coding-agent): stabilize CI expectations 2026-06-10 16:21:43 +09:00
handlecusion 2f76c48160 test(coding-agent): align bash shortcut harness 2026-06-10 16:07:59 +09:00
handlecusion 2d7d717029 fix(coding-agent): tighten user shell routing 2026-06-10 16:07:59 +09:00
handlecusion 8b9c4fa1b9 fix(coding-agent): respect user shell for shortcuts 2026-06-10 16:07:59 +09:00
can1357 e3501e3f76 chore: fix merge issues 2026-06-10 08:35:51 +02:00
can1357 7205289ece Merge pull request #2201: feat(coding-agent): add title system prompt override 2026-06-10 08:32:10 +02:00
can1357 4a5686a120 Merge pull request #2176: feat(minimizer): deterministic shell-output minimizer 2026-06-10 08:32:10 +02:00
can1357 719875ac9a Merge pull request #2163: fix(tui): omit hidden thinking placeholder 2026-06-10 08:32:10 +02:00
can1357 d080645b94 Merge pull request #2161: fix(cli): reject ambiguous extensions command 2026-06-10 08:32:10 +02:00
can1357 db3a54cbe5 Merge pull request #2108: feat(memory): add runtime API and exact vector index 2026-06-10 08:32:09 +02:00
can1357 11c53051bf Merge pull request #2097: fix(acp): skip permission gate when yolo mode is explicitly enabled 2026-06-10 08:32:09 +02:00
can1357 d30dca302f Merge pull request #2044: fix(coding-agent): apply enabledModels filter to ACP model list 2026-06-10 08:32:09 +02:00
danzaio 3e9b5ea796 test(cli): avoid inline import in guard test 2026-06-10 08:31:37 +02:00
danzaio e2c7c45ff8 fix(cli): limit extensions guard to bare command 2026-06-10 08:31:37 +02:00
danzaio da1ad85dbe fix(cli): reject ambiguous extensions command 2026-06-10 08:31:37 +02:00
danzaio e5f37a5585 fix(tui): update hidden thinking expectations 2026-06-10 08:31:35 +02:00
danzaio d16b49efdf fix(tui): omit hidden thinking placeholder 2026-06-10 08:31:35 +02:00