Commit Graph

1013 Commits

Author SHA1 Message Date
can1357 e9acc575a7 feat(coding-agent/cli): implemented ps command for daemon processes
- Added a new ps command to list, inspect, view logs, and control daemon processes.
- Implemented CLI handlers and help metadata supporting daemon process operations.
- Added helpers for managing daemon scope metadata, paths, and live broker PIDs.
2026-08-20 04:41:24 +02:00
can1357 22b40b47e1 chore: bump version to 17.3.8 2026-08-19 12:35:37 +02:00
roboomp 289cc19325 fix(catalog): self-heal a corrupt models.db model cache
The shared SQLite model cache wrapped every read/write in a blanket catch that swallowed unrecoverable SQLITE_CORRUPT*/SQLITE_NOTADB failures as best-effort misses, and getSharedDb cached the broken handle. A physically corrupt models.db therefore permanently disabled cached catalogs across processes: a successful live discovery could never overwrite the corrupt cache, so a runtime extension with no bundled catalog was stuck with only its bootstrap model.

On those unrecoverable codes the cache now self-heals: close the handle, quarantine models.db(+-wal/-shm) to models.db.corrupt-<ts>, recreate a fresh database, and retry the operation once. SQLITE_BUSY, permission, and unrelated errors keep their existing best-effort paths. The SQLITE_BUSY/corruption classifiers moved to @oh-my-pi/pi-utils so the credential store and model cache share one implementation.

Fixes #8867
2026-08-19 09:00:07 +00:00
Sunil Srivatsa bce0b35e44 docs(changelog): record the read single-pass change 2026-08-17 14:15:16 -07:00
Sunil Srivatsa 301908560e perf(read): materialize a local file once per read
The local text read path opened the same file for every consumer. A ranged
read of a file within the snapshot cap cost four opens and three decodes:
an 8KiB binary sniff, a streaming scan for the rendered window, a whole-file
read for bracket context, and another whole-file read to hash the snapshot.
Whole-file reads under the structural summarizer paid a fifth. Two of those
readers also ran normalizeToLF over the same bytes.

Read the bytes once at or below SNAPSHOT_MAX_BYTES and derive every view
from them: sniff the leading 8KiB of the buffer, slice the rendered window
out of it under the identical line and byte budgets, index bracket context
into its addressable lines, and hand the normalized text to the snapshot
store and the summarizer. Past the cap nothing wants the whole file, so the
streaming reader stays.

Line byte lengths are walked out of the buffer rather than measured on the
decoded strings, so reported byte counts and the truncation boundary stay
exact for content that is not valid UTF-8.

The buffered text is BOM-stripped for hashing, matching the decoder the
patcher's live read uses. A whole-file read of a BOM file previously hashed
its tag from BOM-bearing text, so the following edit only applied through
stale-hash recovery and told the model the file had changed externally when
it had not.

Also stop rejoining lines into a fresh whole-file string on the way to
tree-sitter when the caller still holds that text, and drop the unread
selectedBytesTotal accounting from the streaming reader.

Measured on 966 differential cases across CRLF, BOM, lone-CR, invalid-UTF-8,
oversized-line, empty, no-trailing-newline, multi-range and raw shapes: the
spurious recovery warning is the only behavioral difference. Raw reads, which
skip the tree-sitter parse that dominates everything else, get 30-45% faster
(2.7MB: 10.3ms -> 5.7ms); non-raw reads 1-3%.
2026-08-17 14:15:15 -07:00
can1357 0a912cc467 chore: bump version to 17.3.7 2026-08-17 22:29:25 +03:00
can1357 54e1a8c900 chore: bump version to 17.3.6 2026-08-17 17:16:40 +03:00
can1357 37eee71978 chore: bump version to 17.3.5 2026-08-16 10:21:05 +03:00
Can Bölük ca1f184823 chore: rewritten changelogs 2026-08-16 09:28:34 +03:00
can1357 c7ecc3ef66 Merge PR #8598: fix(session): repair torn JSONL appends (@roboomp)
# Conflicts:
#	packages/coding-agent/src/session/session-loader.ts
#	packages/coding-agent/src/session/session-manager.ts
#	packages/coding-agent/test/session-loader-stream.test.ts
2026-08-16 02:48:12 +02:00
can1357 ffd838b256 fix(utils): detached deeper code after padded blanks 2026-08-16 02:03:17 +02:00
can1357 36465c4e1a fix(utils): preserved deeper lazy continuations 2026-08-16 02:03:17 +02:00
roboomp 9ae089d71b fix(session): repaired torn JSONL appends
Rolled partial file appends back to their pre-write size and marked malformed resumed sessions for an atomic rewrite.

Retried transient persistence failures from in-memory state and surfaced the first failure in the interactive TUI.

Fixes #8596
2026-08-15 00:34:41 +00:00
chan1103 dc0e2ebeed fix(utils): stop indented code interrupting paragraphs in marked lexer 2026-08-14 22:48:39 +09:00
can1357 ffd53ff92a chore: bump version to 17.3.4 2026-08-14 14:38:16 +02:00
can1357 039728ad80 chore: bump version to 17.3.3 2026-08-14 05:44:05 +02:00
can1357 ae2d3d6ea1 chore: bump version to 17.3.2 2026-08-14 00:28:43 +02:00
roboomp 5a0b2d460d fix(utils): normalized aborts during retry backoff
Route both fetchWithRetry backoff paths through one abort-normalizing wait helper and cover response and network retry cancellation.

Fixes #8450
2026-08-14 00:02:14 +02:00
can1357 0bc2c342f4 chore: bump version to 17.3.1 2026-08-13 19:39:21 +02:00
can1357 b279db1790 test: refactored test suites to eliminate time-based sleeps and polling loops
- Replaced time-based sleeps and polling loops with event-driven promise resolvers and fake timers across agent and tool tests.
- Migrated test suites to share in-memory auth storage and fixtures using lifecycle hooks.
- Updated catalog model definitions, metadata, and configurations.
2026-08-13 19:32:22 +02:00
can1357 8b0f400d3c chore: bump version to 17.3.0 2026-08-13 08:28:43 +02:00
can1357 fc1fd664b9 chore(changelog): rewritten 2026-08-13 05:51:01 +02:00
can1357 3cbb615630 chore: normalized changelog entries after merging open pull requests 2026-08-13 01:23:13 +02:00
can1357 157690aeb6 Merge PR #8101: fix(utils): mask routed lines beneath edge labels (@roboomp)
# Conflicts:
#	packages/utils/test/mermaid-ascii.test.ts
2026-08-13 01:15:29 +02:00
can1357 4658662c35 fix(write): keep streaming preview append checks bounded 2026-08-13 01:14:46 +02:00
can1357 9c311d7a7b Merge PR #8040: fix(tui,utils): remove O(N²) hot paths when streaming long tool-call args (@AmecoCoding) 2026-08-13 01:14:45 +02:00
can1357 5481d8b9b0 chore: bump version to 17.2.15 2026-08-12 03:26:12 +02:00
can1357 92098d60ec chore: rewrote changelog 2026-08-12 03:25:42 +02:00
can1357 037bfc5204 Merge PR #8268: fix(mcp): send MCP-Protocol-Version header and negotiate 2025-11-25 (@roboomp) 2026-08-12 01:53:44 +02:00
can1357 e5ebb2aee0 chore: bump version to 17.2.14 2026-08-11 20:43:02 +02:00
roboomp eaa5f46d32 fix(mcp): resumed interrupted HTTP response streams
Implemented 2025-11-25 Streamable HTTP polling semantics for POST SSE responses: retain event IDs and retry intervals, wait as instructed, and reconnect with GET plus Last-Event-ID until the originating JSON-RPC response arrives.

Extended the shared SSE parser to expose valid id/retry fields and control-only events so reconnecting consumers do not need to reparse raw lines.

Fixes #8264
2026-08-11 18:21:12 +00:00
can1357 2157becbe9 chore: bump version to 17.2.13 2026-08-11 16:03:05 +02:00
can1357 b524dfe36f refactor: standardized outbound User-Agent headers on shared utility constant
- Define a centralized `USER_AGENT` constant in `@oh-my-pi/pi-utils` formatted as `omp/<version>`.
- Replace hardcoded and platform-specific user agent strings across AI providers, catalog scrapers, tools, and search providers with the unified `USER_AGENT`.
- Add unit tests for update-cli binary release distribution gating.
2026-08-11 15:38:32 +02:00
can1357 8bd621f118 chore(changelog): promoted merged entries back to unreleased 2026-08-11 15:12:36 +02:00
can1357 4cea411ec1 fix(utils): moved log retention changelog to unreleased 2026-08-11 15:07:43 +02:00
can1357 978db72a46 Merge PR #7120: fix(utils): retain one rolled log per process day (@wolfiesch) 2026-08-11 15:07:43 +02:00
can1357 164edcb466 chore: removed stray blank line 2026-08-11 15:06:16 +02:00
Shawn Koh cfbd567628 fix: preserve punctuation label colors 2026-08-11 01:19:54 +08:00
Shawn Koh e658d9f7be fix: address Mermaid rendering review 2026-08-11 01:14:29 +08:00
Shawn Koh a42868f550 fix: make terminal state diagrams readable 2026-08-11 01:00:35 +08:00
Wolfie dca28eee66 fix(utils): retain one rolled log per process day 2026-08-09 23:19:52 -07:00
roboomp 5d92336e19 fix(utils): masked routed lines beneath edge labels
Added opaque label-space cells so Mermaid ASCII edge labels erase routed paths while preserving spaces during serialization.

Added horizontal and vertical regression coverage.

Fixes #8098
2026-08-09 19:03:32 +00:00
lee 9e87d432bd fix(tui,utils): remove O(N^2) hot paths when streaming long tool-call args
Long write/edit streams made the TUI stutter or freeze for seconds at a
time (ui.loop-blocked warnings, keystrokes starving while the single JS
thread rebuilt previews). Two compounding quadratic paths:

1. parseStreamingJsonThrottled re-parsed the entire accumulated args
   buffer on a FIXED 256-byte cadence. The comment claimed this bounded
   mid-stream work to O(N), but a constant growth gate still parses an
   N-byte buffer N/256 times at O(N) each: O(N^2) with a smaller
   constant. The gate now scales geometrically (max(256, len/32)), so
   parse points form a geometric progression: O(log N) parses, O(N log N)
   total, with mid-stream snapshots staying within ~3% of the stream.
   Small buffers keep the exact fixed cadence as before.

2. write.ts formatStreamingContent normalized + split('\n') the WHOLE
   accumulated content on every 30Hz reveal tick (renderCall also ran a
   full-payload normalize first): O(N) per tick, O(N^2) per stream, per
   concurrent writer. The collapsed tail-window path now tracks the
   newline count incrementally (append-only resume keyed on the
   component's persistent render-state object via WeakMap) and extracts
   only the tail window with a backward scan: O(delta + preview lines)
   per tick, byte-identical output to the split-based reference. The
   expanded (Ctrl+O) path is unchanged in output and skips its
   split+join round-trip.

Tests: geometric-gate bounds + freshness + small-buffer cadence in
parse-streaming-json-throttled.test.ts; append-growth/reference-
window/CRLF/trailing-newline/restart battery in
write-streaming-incremental.test.ts. Full write/tool-render battery
(56 tests) and ai streaming-args tests (117 tests) pass.
2026-08-08 22:32:26 +01:00
can1357 6fb07028fd chore: bump version to 17.2.12 2026-08-08 20:57:55 +02:00
can1357 055a5d4f26 chore: bump version to 17.2.11 2026-08-07 23:38:40 +02:00
can1357 34af136c6a test(utils): dropped flaky concurrent logger rotation test
- The two-child fs.watch/poll choreography deadlocked under parallel test load
  (runner killed a dangling probe); the PID-namespace pruning test still covers
  the multiprocess audit/rotation file contract.
2026-08-07 23:38:26 +02:00
can1357 a9dcf0f8d1 chore: update changelogs 2026-08-07 23:38:26 +02:00
can1357 850225a694 style: applied biome formatting after community fix merges 2026-08-07 13:40:52 +02:00
can1357 bd6e87b297 feat(utils): added repair and rawKeys options to parseFrontmatter
- repair: false disables lenient recovery (ambiguous-scalar quoting, tab
  replacement, leading HTML-comment stripping) so spec-conformant loaders
  reject malformed input instead of silently repairing it.
- rawKeys: true preserves frontmatter keys verbatim; exported
  normalizeFrontmatterKeys for callers that validate raw keys first.
2026-08-07 05:59:19 +02:00
can1357 3a8591a8af test: hardened two ci-flaky timing tests
- mnemopi provider parity 'diagnose, validate, graph' does ~6.7s of real
  work under bun --parallel=8 on loaded runners; raised its per-test
  timeout to 30s (default 5s flaked twice in three CI runs).
- utils LRUCache updateAgeOnGet drove a 30ms TTL with real 20ms sleeps
  (10ms margin); now drives performance.now() via a mocked clock, so the
  contract is asserted deterministically with no wall-clock wait.
2026-08-06 14:48:57 +02:00