Commit Graph

3855 Commits

Author SHA1 Message Date
can1357 6d16e93b86 test(coding-agent): align issue-1011 test with isCompiledBinary hybrid contract
The asset-emission assertion was the false positive flagged in
tab-supervisor.ts: the new pattern intentionally does not bundle the
worker as an asset of the supervisor — it is added as a separate
`--compile` entrypoint in build-binary.ts, and runtime is covered by
`omp --smoke-test` (sync worker).

Replaces it with two cheap static checks that defend the two halves
that actually make the worker survive `bun build --compile`:
1. tab-supervisor.ts branches on `isCompiledBinary()` and uses the
   exact `--root`-relative literal at the `new Worker(...)` site
   that Bun's `--compile` analyzer can discover, while keeping the
   `new URL("./tab-worker-entry.ts", import.meta.url)` branch for
   dev/source spawns.
2. scripts/build-binary.ts lists the same worker as an explicit
   additional `--compile` entrypoint so Bun emits it into bunfs.
2026-05-13 01:56:18 +02:00
can1357 ce045f02a2 chore: bump version to 14.9.9 2026-05-12 16:42:51 +02:00
can1357 b468bd5abd feat(stats): show input and output token totals 2026-05-12 16:40:43 +02:00
can1357 1cb451a071 fix(workers): replaced file-URL import pattern with compiled-binary-aware spawn
- Replaced `with { type: "file" }` worker imports with `isCompiledBinary()` hybrid: literal string for `--compile` static analysis, `new URL(import.meta.url)` for dev portability.
- Added worker entrypoints as explicit `--compile` args in `build-binary.ts` so Bun emits them into bunfs.
- Added `smokeTestSyncWorker` and `omp --smoke-test` to catch silent worker-load failures in compiled binaries (fixes #1011, #1027).
- Added `isCompiledBinary()` utility to `@oh-my-pi/pi-utils` detecting bunfs path markers.
2026-05-12 16:40:15 +02:00
can1357 6fbb93b017 fix(coding-agent): allowed hashline parsing to accept flexible @@ section headers
- Updated hashline section parsing to accept headers with any leading `@` characters, normalizing them to the path before validation.
- Updated the hashline grammar and fallback errors to use canonical `@@ PATH` section headers.
- Added coverage for mixed `@@` and `@@@` headers across multiple file sections in hashline parsing tests.
2026-05-12 14:40:42 +02:00
can1357 1cffb3473a fix: corrected worktree baseline capture with synthetic tree diff
- Added untracked worktree baseline capture via `untrackedPatch` and synthetic tree diffing.
- Added fallback-aware backend ordering by collecting host candidates and retrying alternates on unavailable PAL.
- Hardened overlay mount lifecycle by removing stale overlays and deleting upper/work dirs after unmount.
- Refined ZFS clone deletion to validate ownership and remove dataset+origin only when checks pass.
- Updated ProjFS integration to use extended-info callbacks and symlink metadata reads.
- Updated rcopy path handling to absolutize paths, and added `writeTree` plus combined shell timeout checks.
2026-05-12 14:36:31 +02:00
can1357 d37d48d11d feat(pi-iso): added unified pi-iso backend resolver with auto probe
- Added unified isolation primitives (BackendKind, ProbeResult, IsoError) and resolve fallback selection logic.
- Added Diff, FileChange, and ChangeKind with default_diff choosing git mode or filesystem walk based on repository state.
- Added APFS/btrfs/zfs/reflink/overlayfs/projfs/rcopy/block-clone backends with platform-aware start, stop, and probe.
- Mapped backend operations to canonicalized paths, recursive clone helpers, rollback cleanup, and unavailable error mapping.
- Added unified native exports isoBackend/isoProbe/isoResolve/isoStart/isoStop/isoDiff and removed projfsOverlay APIs.
- Replaced task isolation resolver flow with ensureIsolation/cleanupIsolation and migrated mode handling to auto plus legacy-mode aliases.
2026-05-12 13:39:45 +02:00
can1357 64e89b12b5 chore: bump version to 14.9.8 2026-05-12 11:17:24 +02:00
can1357 075e2f47ad fix(coding-agent/export): prevented HTML template $ substitution expansions
- Switched template CSS/JS inlining replacements to callback form in generation scripts to avoid `$` replacement expansion semantics.
- Updated HTML export generation to use callback-based replacements for theme variables and session data injection to prevent accidental `$` substitution parsing.
- Added regression tests for the inlined script ensuring literal `$'` regex tokens remain intact, no closing HTML tags are injected, and the script parses via `new Function`.
2026-05-12 11:15:38 +02:00
can1357 c42c2313a7 feat(tools): added conflict wildcard reads and per-file write grouping
- Added `:conflicts` and `read conflict://<N>`/`read conflict://<N>/<scope>` support and rejected wildcard conflict reads.
- Added bulk conflict resolution via `write({ path: "conflict://*", ... })` across files with per-file grouping.
- Expanded conflict detection to scan files up to 10MB, track insertion-ordered history, and report full `X of Y` summaries.
- Reworked `spliceConflict` to match marker blocks by content, fixing shifted or stale block splicing.
- Added coverage for wildcard parsing, scoped reads, prepended-line splices, relocation, and warning assertions in detect/integration tests.
2026-05-12 11:15:23 +02:00
can1357 0cdd381aee feat(coding-agent/tools): added scoped conflict URI parsing in read tool
- Added `ConflictScope` parsing for `conflict://<N>/<scope>` with `ours`, `theirs`, and `base` validation.
- Added `read` support for full and scoped conflict URIs, rendering regions via `#readConflictRegion` with preserved formatting metadata.
- Added conflict-count and error handling in read results, including `Conflict #N not found` responses.
- Added `write`-path rejection for scoped conflict URIs, returning `ToolError` before lookup to enforce read-only behavior.
- Added unit and integration tests for scope parsing, conflict rendering, and read/write conflict error scenarios.
2026-05-12 11:03:26 +02:00
can1357 478db5183a feat(tools): added strict conflict parsing for read/write tools
- Added conflictCount metadata and warning badge output to read results for files with unresolved conflicts.
- Added conflict detection parsing with strict marker matching and session-scoped conflict IDs.
- Added write-path conflict resolution for `conflict://N` using token expansion and marker validation before splicing.
- Added unit and integration tests for conflict scanning, history lifecycle, URI validation, and workflows.
2026-05-12 10:55:09 +02:00
can1357 b4b6536838 feat(pi-natives): added link-following control to filesystem scan options
- Added a follow_links flag to ScanOptions and build_walker so callers could control symlink traversal.
- Updated scan callsites so ast, glob, and grep continued skipping symlinks while fd's fuzzy-find enabled link following.
- Updated fd scoring to favor fuzzy basename matching for queries without '/', reducing matches based only on ancestor directory names.
2026-05-12 10:25:24 +02:00
can1357 028a442f18 feat(coding-agent): added parser support for t/rst in Cell eval
- Introduced canonical `*** Cell` headers with `t:` and `rst` attributes in eval prompts, schema, and docs.
- Updated parser and grammar to parse `*** Cell` blocks, stop on `*** End`/next header/EOF, and handle invalid `rst` with errors.
- Added quote-aware attribute tokenizers and split HTML eval parsing into `Cell` and legacy `Begin` handlers with `py` defaults.
- Expanded parsing behavior and tests for `rst` booleans, title aliases, abort boundaries, and stray-line skips between cells.
2026-05-12 10:01:56 +02:00
can1357 c562f4dc2a fix(coding-agent/eval): hardened eval parser against stray non-marker lines
- Updated parseEvalInput to verify begin-cell markers before dereferencing regex matches.
- Skipped stray non-marker lines between and after cells, preserving valid cells when model output is noisy.
- Added eval parse regression tests for stray content and trailing chatter, and kept abort-line handling explicit.
2026-05-12 09:41:06 +02:00
can1357 2726ee03e3 chore: bump version to 14.9.7 2026-05-12 09:29:55 +02:00
can1357 510a3db05a fix(coding-agent/web): propagated abort signals through web search execution
- Extended executeSearch to accept an optional AbortSignal parameter.
- Passed the provided signal through to the search provider invocation.
- Updated execute methods to forward incoming signals into executeSearch.
2026-05-12 09:29:31 +02:00
can1357 8d144e17ec feat(coding-agent/eval): added local python-runner subprocess execution
- Replaced Python execution with a local `python -u runner.py` subprocess and NDJSON stdin/stdout framing.
- Removed shared-gateway architecture, including coordinator lifecycle APIs, `useSharedGateway` wiring, and `jupyter` CLI/actions.
- Simplified setup checks to a plain Python 3 availability probe and removed automatic dependency-install fallbacks.
- Updated kernel cancellation and display processing to use status frames, SIGINT/SIGTERM escalation, and normalized output coercion.
- Added `python-runner` integration and display tests while deleting legacy websocket and kernel lifecycle test suites.
2026-05-12 09:09:24 +02:00
can1357 dcf3f1c8a3 feat(coding-agent): added tool.<name>(args) execution in Python prelude
- Added `tool.<name>(args)` execution in Python prelude and docs, enabling direct tool call syntax.
- Added per-execution Python tool-bridge registration, env wiring, and executor lifecycle management.
- Implemented authenticated loopback `/v1/tool` handling with session/name validation and structured responses.
- Updated runtime and lint handling to permit controlled global eval usage in indirect eval paths.
- Added tests for success, failures, invalid bodies, and `emitStatus` propagation in Python tool bridges.
2026-05-12 08:43:36 +02:00
can1357 2f7b2aaccd feat(coding-agent/eval): stripped TypeScript syntax before import rewrites
- Added a stripTypeScript pass that heuristically detects TypeScript-like syntax and transpiles it with Bun's ts loader before rewriting.
- Integrated the new pass into wrapCode so import and lexical rewrites operate on transpiled input.
- Added an executeJs test that verifies interfaces, type annotations, and type assertions execute to the expected numeric result.
2026-05-12 08:42:52 +02:00
can1357 2d4d70e47e feat(coding-agent): added shared JS runtime for worker execution
- Added shared JS runtime infrastructure with RuntimeHooks, RuntimeOptions, JsRuntime, and indirectEval-based execution.
- Reworked worker execution to use runtime.run, track active runs, and clean pending tool calls on close.
- Added tool-call and tool-reply message variants and wired supervisor/worker to route run-scoped calls.
- Added shared helper globals (read, writeFile, diff, tree, env) for browser-tab JS execution.
2026-05-12 08:42:30 +02:00
can1357 efbaa59a05 fix(coding-agent): routed rewritten static imports through cwd-aware helper
- Rewrote static import lowering to emit `__omp_import__` calls instead of direct `import(...)` so rewritten code routes through worker context helpers.
- Added a `__omp_import__` runtime helper in `WorkerCore` that resolves specifiers against the session cwd via `Bun.resolveSync` while passing through URL-like modules unchanged.
- Updated static import rewrite tests to expect the new helper-based `__omp_import__` form, including import attribute cases.
2026-05-12 08:22:55 +02:00
can1357 95b29561c7 feat(history-storage): added substring fallback to search with FTS tokenization fix
- Fixed query tokenization to split on non-alphanumeric runs, aligning with FTS5 unicode61 indexer so punctuation-delimited terms like `git-commit` match correctly.
- Added LIKE-based substring fallback so infix queries FTS5 prefix matching cannot reach (e.g. `mit` matching `commit`) still return results.
- Merged FTS and substring results with deduplication, prioritizing FTS matches before substring-only matches up to the requested limit.
2026-05-12 08:22:46 +02:00
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 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 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 66a9c483aa Merge branch 'main' into fix/windows-ssh-controlmaster 2026-05-12 06:24:23 +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 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 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 975941aba4 chore: remove garbage tests 2026-05-12 04:09:33 +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