Commit Graph

5140 Commits

Author SHA1 Message Date
can1357 f56cbbf4c6 feat(stats): added frustration metrics to stats parser and charting
- Added new frustration and revised behavior metrics across stats types, parser mappings, and UI charts.
- Reworked session sync to fan out parsing across a capped worker pool with SyncOptions progress callbacks.
- Added worker-based parse messaging and throttled TTY progress rendering in the stats sync command.
- Updated behavior scoring to strip structured content, ignore noisy prompts, and fix profanity boundary regressions.
- Expanded user message schema and migrations, then repaired assistant model/provider links during sync backfill.
- Updated worker-import guidance in AGENTS.md and recorded sync-progress/metrics updates in package changelogs.
2026-05-12 07:55:23 +02:00
can1357 a7209c2b4f feat(coding-agent-eval): added worker-backed JS runtime with queued runs
- Added worker-backed JS runtime via Transport and WorkerCore, with queued runs, status/error output, and clean teardown.
- Refactored executeInVmContext to reuse worker sessions, route pending runs by id, and fallback inline on spawn failure.
- Added rewrite helpers to convert top-level imports and demote top-level const/let/class declarations for persistence.
- Handled aborts by canceling in-flight tool calls, hard-killing worker sessions, and dropping JS timeout enforcement.
2026-05-12 07:20:43 +02:00
can1357 e3553b3211 test(coding-agent): align kNoAuth fallback test with #1008 behavior 2026-05-12 06:56:39 +02:00
can1357 34aed93f8e fix: win deps 2026-05-12 06:35:41 +02:00
can1357 c504c2654a chore: bump version to 14.9.5 2026-05-12 06:34:13 +02:00
can1357 92ec8607ff fix(coding-agent/tools): added ts-expect-error for Bun file URL worker import
- Documented why the tab worker entry must be imported with Bun's file attribute despite tsgo limitations.
- Added a @ts-expect-error on the tabWorkerEntryUrl import to suppress tsgo TS1192/TS5097 errors.
2026-05-12 06:32:12 +02:00
Can Bölük 8a5d805c06 Merge pull request #1006 from thedavemarshall/fix/rapidly-blinking-cursor-992
fix(tui): eliminate rapidly blinking cursor during task execution
2026-05-12 06:29:13 +02:00
Can Bölük 4db85a79f2 Merge pull request #1002 from ephraimduncan/fix/plugin-directory-extensions
fix(coding-agent/plugins): resolve directory manifest extension entries to their index.{ts,js,mjs,cjs}
2026-05-12 06:28:55 +02:00
Can Bölük 5dfe593828 Merge branch 'main' into fix/plugin-directory-extensions 2026-05-12 06:28:35 +02:00
Can Bölük 84c306f658 Merge pull request #1005 from tsagi2045/feat/ask-no-timeout-default
feat(coding-agent): default ask.timeout to 0 (wait indefinitely)
2026-05-12 06:27:38 +02:00
Can Bölük 4150c96dfc chore: doesnt require a change 2026-05-12 06:27:16 +02:00
Can Bölük 48a42fed58 chore: doesnt belong here 2026-05-12 06:26:09 +02:00
Can Bölük 92499815e7 Merge pull request #999 from jiwangyihao/fix/windows-ssh-controlmaster
fix(coding-agent): avoid SSH ControlMaster on Windows
2026-05-12 06:24:30 +02:00
Can Bölük 66a9c483aa Merge branch 'main' into fix/windows-ssh-controlmaster 2026-05-12 06:24:23 +02:00
Can Bölük f8c9a310ea Merge pull request #1012 from dmarsh-gusto/fix/export-and-tree-support-developer-messages
fix(coding-agent): render developer-role messages in /export and /tree
2026-05-12 06:21:36 +02:00
Can Bölük 68bf2be367 Merge pull request #1010 from rburketaylor/fix/opencode-go-deepseek-tool-choice
fix(opencode-go): disable tool_choice for deepseek-v4 models
2026-05-12 06:21:29 +02:00
Can Bölük 7f94047453 Merge branch 'main' into fix/export-and-tree-support-developer-messages 2026-05-12 06:21:20 +02:00
can1357 9d2355d1cd fix(coding-agent): expose hasConfiguredAuth on ModelRegistry for external plugins (#993)
External plugins, extensions, and downstream wrappers (notably the upstream
`@mariozechner/pi-coding-agent` AgentSession routed through the legacy-pi-compat
shim) call `modelRegistry.hasConfiguredAuth(model)` before launching a subagent
to short-circuit when no API key is configured. Our `ModelRegistry` did not
expose that method, so the direct agent-launch path threw
`this._modelRegistry.hasConfiguredAuth is not a function` and exited with 0
tokens, 0 tool uses, ~100ms runtime — well before any model conversation began.
The `task` tool path bypassed the preflight and worked, masking the missing
API.

Add a thin `hasConfiguredAuth(model)` wrapper that returns true for keyless
providers and providers with stored auth, matching upstream semantics. Add a
focused regression test asserting the method exists and distinguishes
configured vs. unconfigured providers.

Fixes #993.
2026-05-12 06:20:58 +02:00
Can Bölük 2c14fb6de9 Merge pull request #1014 from dmarsh-gusto/fix/esm-circular-import-tdz
fix(coding-agent): break task↔tools ESM cycle causing TDZ at module load
2026-05-12 06:20:30 +02:00
Can Bölük 976280a177 Merge branch 'main' into fix/esm-circular-import-tdz 2026-05-12 06:20:20 +02:00
can1357 ebbe66a3d6 fix(coding-agent/browser): bundle tab-worker-entry for prebuilt binaries (#1011)
The Worker spawn in spawnTabWorker used `new Worker(new URL(...).href, ...)`
through a local variable, which Bun's --compile static analysis does not
recognize. As a result, tab-worker-entry.ts was never embedded in single-file
binaries (v14.5.13+), and the worker thread failed to load its entry at
/$bunfs/root/tab-worker-entry.ts, surfacing as the user-visible
"Timed out initializing browser tab worker".

Switch to a `with { type: "file" }` import of the entry module so the
bundler discovers and embeds it in both dev and compiled targets.

Regression test asserts `Bun.build` emits tab-worker-entry as an asset
alongside the tab-supervisor entry point — the same static-analysis pass
that powers `bun build --compile`.
2026-05-12 06:16:05 +02:00
can1357 9b687a6dc7 feat(coding-agent-tools): added date range filtering to issue/PR/commit/repo
- Added optional since/until/dateField parameters to issue, PR, commit, and repo search tools.
- Added parsing for relative and ISO date bounds and built inclusive/exclusive/range search qualifiers.
- Allowed issue/PR/commit/repo searches to proceed with only date ranges and no query string.
- Mapped tool-specific date fields (commits, repos) and rejected since/until for code search validation.
- Updated search tool docs and tests for date filter formats, mappings, and unsupported-code-search behavior.
2026-05-12 06:14:14 +02:00
can1357 4af52c46f1 fix(coding-agent): honor keyless-by-design local models in subagent resolution
Fixes #1008
2026-05-12 06:13:12 +02:00
can1357 7579af8584 feat(coding-agent): added owner filtering and exclusive args for job API
- Removed jobs:// references from system prompts, router wiring, and protocol handler exports.
- Added job tool list=true snapshots and enforced list/poll/cancel argument exclusivity.
- Added owner-based filtering for job cancel/getAllJobs/getRunningJobs with mismatch guard in cancel.
- Updated task/job docs and unreleased changelog to route async workflow operations through job tool APIs.
2026-05-12 05:59:51 +02:00
can1357 ec649278bd fix(coding-agent): resolved async job owner filters for scoped cancelAll
- Added ownerId metadata to async jobs and to task/bash progress items from the session agent id.
- Extended async job registration and query methods with optional owner filters, and updated cancelAll to target matching owners.
- Updated session handoff and disposal so subagents inherit the parent manager, top-level sessions own it, and teardown cancels own jobs only.
- Added owner-aware async-job tests using hold/AbortSignal and scoped cancelAll assertions for running versus cancelled jobs.
2026-05-12 05:53:18 +02:00
can1357 4135897e19 feat(coding-agent/prompts): updated task prompts to branch on IRC mode
- Passed the `irc.enabled` session setting into task prompt rendering so templates can branch for IRC mode.
- Updated orchestrator and subagent-task prompts with IRC-specific instruction paths for skip-all checks, coordination, and file-scoped assignments.
2026-05-12 05:51:52 +02:00
can1357 7d233725b6 refactor(coding-agent/eval): removed eval shell run helpers from JS and Python preludes
- Removed the JS and Python eval prelude `run` helpers, including their shell execution and timeout/cwd option handling.
- Updated the JS VM helper set to expose `Bun` and removed the deleted `run` entry from the prelude.
- Revised eval docs to drop `run` from the helper surface and note the new JS `Bun` global.
2026-05-12 05:43:37 +02:00
can1357 a4d86a075a feat(coding-agent): added verbatim unicode rule to hashline prompt 2026-05-12 05:25:55 +02:00
can1357 9ed81977f7 feat(coding-agent): shared artifact manager and flat output directory across subagent sessions
- Added parent-to-subagent artifact manager adoption so subagents reuse the parent `ArtifactManager` and write artifacts into a shared directory with shared IDs.
- Passed the shared artifact manager through tool/session context into subagent executor startup and exposed it via `SessionManager` and `ToolSession` for lookup.
- Updated kernel environment and artifact-resolution paths to prefer `PI_ARTIFACTS_DIR`, falling back to existing session-file-based behavior when absent.
2026-05-12 05:17:53 +02:00
can1357 1bde755933 feat(coding-agent): added global singletons for URL protocol handlers
- Added process-wide singleton instances for InternalUrlRouter, AsyncJobManager, and MCPManager.
- Changed internal URL protocols to resolve through registered sessions and scan all active roots/datasets for matches.
- Refactored agent, artifact, memory, rule, skill, jobs, and mcp handlers to use shared manager and rule/skill state.
- Removed per-session protocol/tool wiring and switched tests to initialize and reset global singleton state.
2026-05-12 05:07:52 +02:00
can1357 338ec7284f fix(pi-shell): fixed macOS descendant traversal on broken proc_listchildpids
- Replaced macOS `Process::children` and `descendants` traversal with a one-shot `proc_listallpids` scan grouped by `pbi_ppid`, avoiding the broken self-query path in `proc_listchildpids`.
- Built `snapshot_all_pids` and `build_process_tree` helpers and updated descendant collection to walk that tree once, de-duplicating by PID in post-order.
- Added a Unix regression test that verified a freshly spawned child appears in `live_descendants`, preventing silent no-op cleanup on affected darwin kernels.
2026-05-12 05:07:19 +02:00
can1357 4623e7d3ea fix(coding-agent): marked streaming edit aggregates as errors when per-path edits fail
- Stored a failure counter during single-path edit execution and set isError on aggregate results when any entry edit failed.
- Set streaming-edit handling to always evaluate auto-generated-file checks, but only primed the file cache when edit.streamingAbort was enabled.
2026-05-12 04:44:38 +02:00
can1357 40753e9c7c fix(pi-shell): prevented shell cancellation from killing the harness process
- Restricted pgid adoption in `select_termination_targets` to only descendants that are their own group leader, preventing inherited harness pgids from entering the kill set.
- Added `kill_process_group` guard to refuse signaling the harness's own process group as a last-line defense.
- Awaited the `bridge_chunks` drain handle after shell/execute completes to ensure all output chunks are flushed before the future resolves.
2026-05-12 04:44:31 +02:00
can1357 975941aba4 chore: remove garbage tests 2026-05-12 04:09:33 +02:00
can1357 9b536bd6e9 refactor(ps): moved process management logic to pi-shell crate
- Removed ~1,500 lines of platform-specific process code from pi-natives/ps.rs, delegating to pi_shell::process.
- Removed PTY execution support from pi-shell and pi-natives, including portable-pty dependency.
- Exposed terminate_tree and wait_for_exit as public methods on pi_shell::process::Process.
2026-05-12 03:43:32 +02:00
can1357 2268fcc5bd feat(coding-agent/tools): surfaced display() outputs in eval tool responses
- Added helpers to stringify and truncate display() JSON values before including them in text responses.
- Updated eval execution to append formatted display output text alongside stdout and emit images as dedicated content blocks.
- Adjusted no-output messaging for image-only runs and removed detail-level image payload duplication when content already includes image blocks.
2026-05-12 03:23:47 +02:00
can1357 8fb0495017 docs(coding-agent): updated background job guidance for automatic completion flow
- Updated bash, job, and task prompts to state that background results are delivered automatically when complete.
- Removed guidance encouraging repeated `jobs://` polling and clarified `job` with `poll` should be used only when a task is blocking.
- Changed the bash tool confirmation message to recommend doing other work while waiting for background jobs and polling only if needed.
2026-05-12 03:20:47 +02:00
can1357 975c0eacdb config(coding-agent): added minimum release age to Bun install configuration
- Set `minimumReleaseAge` to 259200 in the root `bunfig.toml` install configuration.
- Applied the same `minimumReleaseAge` setting to `packages/coding-agent/bunfig.toml` to enforce a 3-day minimum dependency release age.
2026-05-12 03:15:09 +02:00
can1357 6d513c606f feat(coding-agent/modes): added timed expiry and cleanup for IRC chat messages
- Updated addMessageToChat in UI helpers and InteractiveModeContext to return rendered components instead of void.
- EventController now tracks IRC message components and removes them after a 10-second TTL, avoiding duplicate expiry scheduling per message signature.
- EventController dispose now clears all pending IRC expiry timers and tests were added for immediate render, TTL removal, duplicate suppression, and timer cleanup.
2026-05-12 03:11:49 +02:00
can1357 d186a1dafb refactor(coding-agent/prompts): moved system prompt constraints into project prompt
- Removed the shared date, workspace, and critical-response block from now-prompt.md.
- Added the same instructional block to project-prompt.md so the project prompt now carries those system constraints.
2026-05-12 03:11:21 +02:00
can1357 032e1aa040 fix(coding-agent/task): skipped context file for IRC-enabled subagents
- Skipped writing compact conversation context files when IRC is enabled so subagents avoid using stale markdown snapshots.
- In runSubprocess, passed an undefined context file for IRC-enabled paths and kept context file prompting for non-IRC executions.
2026-05-12 01:22:27 +02:00
can1357 9bcbefb30e feat(coding-agent/edit): added hashline fallback preview for in-flight edits
- Added edit streaming fallback data to the edit render context and used it when no finalized patch text was available.
- Implemented hashline fallback rendering that strips envelope syntax, sanitizes text, and truncates output to a fixed number of lines with a streaming indicator.
- Updated tool execution to populate the fallback preview from the active edit strategy and added a renderer test for hashline envelope input while the diff is not yet computable.
2026-05-12 01:00:50 +02:00
can1357 530942c0b2 feat(pi-shell): enabled PTY shell runs in pi-shell via PTY runner
- Added PTY flags to ShellRunOptions and ShellExecuteOptions and defaulted pty to false when unset.
- Routed PTY-enabled shell runs to a dedicated PTY runner and executed commands via `sh -lc` in a PTY.
- Handled PTY output with a dedicated thread, Chunk/Done events, child PGID cancellation, and drain-timeout cleanup.
- Added Unix-only PTY assertions and non-Windows native coverage for `executeShell` with `pty: true` and `/dev/` output checks.
- Added `portable-pty = "0.9"` (and lockfile update) to enable PTY execution in pi-shell.
2026-05-12 01:00:31 +02:00
can1357 7e05a2fef4 docs(coding-agent/prompts): added subagent rule to skip checks and centralize verification
- Updated the orchestration prompt to require that each `task` instructs subagents to skip all verification and formatting commands.
- Clarified that the orchestrator should perform linting, tests, and formatting once per phase across all changed files.
2026-05-12 00:39:04 +02:00
David Marshall 698fca8fd0 docs(coding-agent): changelog entry for ESM cycle TDZ fix
Co-Authored-By: omp <noreply@oh-my-pi.dev>
2026-05-11 12:48:42 -05:00
David Marshall 1f18e0bf40 fix(coding-agent): break task↔tools ESM cycle causing TDZ at module load
Two-edge fix for a runtime circular-import TDZ that manifested as
`ReferenceError: Cannot access 'TaskTool' / 'SUBAGENT_WARNING_*' /
'MAX_OUTPUT_BYTES' before initialization.` whenever the executor module
graph and the task tool module graph were evaluated together (e.g.
`bun test executor-warnings.test.ts task-simple-mode.test.ts` in either
order, or the wider `task/ discovery/ task-simple-mode` combination).

The runtime cycle is
  task/index.ts → ./executor → ../sdk → ./tools → ../task
closed by `tools/index.ts:285` eagerly dereferencing `TaskTool.create`
while the `task` module's body had not yet reached its `export class
TaskTool` declaration. The throw aborted `tools/index.ts`, which
propagated back through `sdk → executor`, leaving executor's body
suspended before its post-import `const`s (`SUBAGENT_WARNING_*`,
`MAX_OUTPUT_BYTES`) were initialized.

Two structural changes:

1. `tools/index.ts:285`: replace `task: TaskTool.create` with
   `task: s => TaskTool.create(s)`. Defers the `TaskTool` binding
   dereference to factory-call time, by which point the cycle has
   fully unwound. Matches the lazy-factory shape every other
   `BUILTIN_TOOLS` entry already uses.

2. `task/executor.ts:31`: split the `"../tools"` import. Source
   `truncateTail` directly from its leaf module
   `../session/streaming-output` (the barrel was just re-exporting
   it). Keep `ContextFileEntry` as a type-only import — erased at
   runtime, so no participation in the cycle.

Neither change touches tests, test runners, or removes the cycle in
source. They eliminate the eager dereferences that turned a benign
linker-level cycle into a TDZ at evaluation time.

Verified:
- `bun test executor-warnings.test.ts task-simple-mode.test.ts`
  passes in both orderings (11/11).
- Wider `bun test packages/coding-agent/test/task/
  packages/coding-agent/test/discovery/
  packages/coding-agent/test/tools/task-simple-mode.test.ts` now
  100/100 (was 14 fail / 1 error).
- `bun --cwd=packages/coding-agent run check` clean apart from the
  pre-existing unrelated `anthropic.ts:1206 'stop_details'` error
  from 4e0ca3c0e.

Co-Authored-By: omp <noreply@oh-my-pi.dev>
2026-05-11 12:47:59 -05:00
David Marshall c8d4f22b59 fix(coding-agent): render developer-role messages in /export and /tree
The HTML export feed, sidebar tree, and TUI session tree did not handle
the developer role, so plan content injected after /plan approval (and
any other developer messages) was hidden from /export and shown as a
bare [developer] label in /tree.

Renders developer messages in the main feed with a dimmed
.developer-message style, labels them in the sidebar tree, counts them
in header stats, and shows their content in the TUI tree selector so
search matches the body.

Closes #753.

Co-Authored-By: omp <noreply@oh-my-pi.dev>
2026-05-11 10:42:17 -05:00
Burke Taylor 9121ec0d59 fix(opencode-go): mark deepseek-v4 models as not supporting tool_choice
DeepSeek v4 Flash and Pro (opencode-go, openai-completions) do not support tool_choice properly. Override compat to disable it and configure reasoning content field requirements.

Also fixes a bug where model.compat ?? {} was not used when spreading, which could crash on undefined compat.
2026-05-11 09:22:59 -03:00
jiwangyihao 375ef060a7 fix(coding-agent): avoid SSH ControlMaster on Windows 2026-05-11 12:36:55 +08:00
David Marshall 4fccb3be52 fix(tui): eliminate rapidly blinking cursor during task execution
Refactored cursor positioning in TUI to consolidate cursor control
sequences into the synchronized output buffer, preventing the rapid
blink artifact that appeared on the right side of the terminal.

- Extract #cursorControlSequence() from #positionHardwareCursor
- Rename #positionHardwareCursor to #writeCursorPosition for clarity
- Emit cursor control inside the synchronized output buffer rather
  than as a separate terminal write, eliminating the visible blink
- Track #hardwareCursorRow state at write time instead of separately

Closes #992
2026-05-10 23:05:41 -05:00