Commit Graph

98 Commits

Author SHA1 Message Date
can1357 a241cb0999 test: restore directory profile state after cache tests 2026-06-27 01:39:34 +02:00
can1357 9dea09e238 Merge PR #3264: feat(coding-agent): cache successful document conversions (@wolfiesch) 2026-06-27 01:39:33 +02:00
can1357 453865bb71 test(utils): dropped EBUSY-window test using banned mock.module/global mutation
The #3348 change is a single retry-window constant (25->50ms); the test asserted
it via mock.module("node:fs") + process.platform/Bun.sleepSync mutation, which
AGENTS.md bans (leaks across the full suite). The retry-on-EBUSY loop already has
coverage; a config constant does not warrant a global-mutating test.
2026-06-27 00:23:16 +02:00
can1357 eb4a02433c refactor: consolidated json parsing and stream utilities
- Centralized JSON parsing and stream processing logic by moving utilities from `packages/ai` to the shared `@oh-my-pi/pi-utils` package.
- Standardized import paths for JSON parsing and streaming across the agent, ai, and coding-agent packages.
- Refactored SSE stream handling to use consolidated `parseStreamingJson` logic and introduced robust error recovery for malformed container-shaped tail events.
- Cleaned up legacy bundled registry references and updated related module exports and tests to reflect the new utility structure.
2026-06-27 00:11:42 +02:00
can1357 4a5dce8a94 test(utils): cover Windows EBUSY retry window
(cherry picked from commit 5173f91457804a7456788130e1ae9fc8975deeed)
2026-06-26 23:43:03 +02:00
can1357 9cd9349d05 Merge PR #3362: fix(utils): handle trailing-truncated JSON in readSseJson (@usr-bin-roygbiv) 2026-06-26 23:27:38 +02:00
can1357 a13c8d2698 fix(utils): prevented winston warnings when transports are disabled
- Set logger to silent mode when no transports are active to avoid "no transports" errors during log emission.
- Added a regression test to verify that disabling all transports suppresses warnings and that log output resumes after re-enabling transports.
2026-06-25 12:46:49 +02:00
can1357 c58ec21242 fix(tui/utils): corrected state restoration for TTY and environment variables
- Corrected TTY property restoration to properly delete injected properties instead of redefining them as truthy values.
- Updated environment restoration to modify process.env keys individually to prevent breaking environment object reference bindings.
- Prevented pollution of TTY-gated code and environment variable state across test suites.
2026-06-24 15:30:29 +02:00
can1357 ea01c3998c fix(mermaid): enforced deterministic colorMode during golden test runs
- Pin colorMode to none in golden test suites to prevent nondeterministic ANSI escape sequences.
- Normalize render calls across test files to ensure stable output comparison.
- Prevent test flakes caused by environment-specific TTY auto-detection in the renderer.
2026-06-24 15:30:29 +02:00
Wolfgang Schoenberger 3a2ab8ad7d test: restore full env state in document-conversion cache tests
Snapshot and restore PI_CODING_AGENT_DIR, OMP_PROFILE, PI_PROFILE, and
XDG_CACHE_HOME instead of relying on setAgentDir(originalAgentDir), which
cannot restore previously-unset or profile-derived env state. Reset the
profile snapshot and rebuild dirs from env in cleanup to prevent
suite-order pollution.

Also reject empty cached content in parseCacheEntry() to harden the
cache contract against corrupted/empty entries.
2026-06-24 03:08:48 -07:00
usr_bin_roygbiv 5f22e58a61 fix(utils): require string closed in hasValidPredecessorForComma 2026-06-23 23:53:04 -05:00
usr_bin_roygbiv 2a31d063b2 fix(utils): handle string escapes and partial unicode escapes at EOF in getClosingSuffix 2026-06-23 23:43:46 -05:00
usr_bin_roygbiv 4528f5414a fix(utils): gate literal completion to non-inString state in getClosingSuffix 2026-06-23 23:39:56 -05:00
usr_bin_roygbiv 3a91053566 fix(utils): transition arrays back to expect_value on comma in scanJsonState 2026-06-23 23:36:28 -05:00
usr_bin_roygbiv a971f1aa9b fix(utils): validate comma predecessor using parser state instead of character rules 2026-06-23 23:32:42 -05:00
usr_bin_roygbiv fde4a33a59 fix(utils): handle invalid comma predecessors in isJsonTruncated 2026-06-23 23:29:36 -05:00
usr_bin_roygbiv 5032116702 fix(utils): handle truncated JSON gracefully in readSseJson 2026-06-23 23:23:55 -05:00
usr_bin_roygbiv 4d8a85e028 fix(utils): handle truncated JSON gracefully in readSseJson 2026-06-23 23:20:17 -05:00
Wolfgang Schoenberger 2cb892ef1f feat(coding-agent): cache successful document conversions
Repeated reads of unchanged PDFs, Office documents, and EPUBs re-ran the
full markit conversion every time. Add a transparent, content-addressed
cache for successful conversions keyed by SHA-256(content) + normalized
extension, so repeat reads reuse converted markdown instead of
reconverting.

- packages/utils: XDG-aware getDocumentConversionCacheDir() helper
- coding-agent: markit-cache module (bounded 256 MiB, oldest-first prune,
  best-effort writes that never fail conversion) layered over the central
  convertFileWithMarkit/convertBufferWithMarkit wrappers
- imageDir conversions stay uncached (cache:"skipped") to preserve PDF
  image extraction side effects; failed/empty/aborted conversions are
  never cached
- abort-safe: file byte reads run under untilAborted; cache I/O rechecks
  the signal
2026-06-22 16:54:13 -07:00
can1357 6486e2a14a Merge PR #3021: fix(ipc): harden worker IPC send against async EPIPE rejections (@oldschoola) 2026-06-19 17:16:37 +02:00
can1357 80a0a1b8a8 feat(utils): replaced createAbortableStream with abortableSource
- Introduced `abortableSource` as a lighter, direct-reader async generator.
- Removed the `createAbortableStream` public API to eliminate unnecessary stream wrapper layers.
- Updated internal stream processing to use `abortableSource` for improved memory and performance.
2026-06-19 16:06:18 +02:00
oldschoola 23565e3e58 fix(ipc): hardened worker IPC send against async EPIPE rejections
- Added `safeSend` helper wrapping `Subprocess.send()` so sync throws and async EPIPE rejections cannot escape.
- Replaced inline try/catch send wrappers in STT, TTS, and tiny-title clients with shared `safeSend`.
- Added `isIpcSendEpipe` predicate and made matching rejections non-fatal in the `unhandledRejection` handler.
- Added contract tests for `safeSend` and `isIpcSendEpipe` covering sync throws, async rejections, and edge cases.
2026-06-18 21:42:02 -07:00
can1357 3998d95088 feat: standardized tab expansion to fixed width
- Removed configurable tab width support and the `display.tabWidth` setting across all packages.
- Deleted obsolete utility functions `getIndentation`, `getIndentationNoescape`, and `setDefaultTabWidth`.
- Standardized tab expansion logic to use a fixed `DEFAULT_TAB_WIDTH` globally.
- Cleaned up related configuration schemas, test suites, and internal API signatures to remove path-dependency.
2026-06-19 04:48:41 +02:00
can1357 f5ebab2b83 feat(utils): vendor mermaid rendering 2026-06-18 18:52:38 +02:00
can1357 3ab675a83b fix: added buffered worker inboxing and standardized worker selectors
- Added `WorkerInbox` and `installWorkerInbox(port)` to queue worker messages before bind.
- Added `consumeWorkerInbox()` to replay buffered messages and clear one active inbox.
- Added buffered inbox consumption in JS and tab worker transports before direct message handlers.
- Normalized worker selector arguments to the `__omp_worker_*` naming across workers and tests.
2026-06-15 11:59:44 +02:00
can1357 3f82589ec1 fix: fixed OAuth and profile-boundary regressions across CLI and env handling
- Fixed OAuth credentials to keep unknown fields in schema while preserving existing shape checks.
- Fixed MCP OAuth IDs to be profile-scoped and avoid deleting credentials from non-active profiles.
- Fixed string-flag parsing so PROFILE_BOOTSTRAP_BOUNDARY tokens are not consumed as values.
- Fixed active-profile directory resolution to refresh after env updates so profile .env overrides apply.
2026-06-15 03:20:45 +02:00
Ogrodev 932ebe9a48 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias
# Conflicts:
#	.github/actions/build-native/action.yml
#	.github/workflows/ci.yml
2026-06-14 21:26:03 -03:00
Ogrodev f9bc96e96c fix(coding-agent): harden profile auth shipping gaps 2026-06-14 20:30:50 -03:00
Ogrodev 0123a46f83 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias
# Conflicts:
#	packages/coding-agent/src/cli/args.ts
2026-06-14 19:10:31 -03:00
roboomp d7d94949fa fix(tts): isolated kokoro onnxruntime loading
Loaded Kokoro's side-installed transformers runtime by absolute path before requiring kokoro-js, avoiding host/workspace onnxruntime libraries in the worker process.

Kept runtime-cache bare module requests inside the registered runtime cache when the parent module is already inside that cache, and covered the resolver boundary with a regression test.

Fixes #2591
2026-06-14 21:56:50 +00:00
can1357 2b436f222a chore: update changelogs 2026-06-14 18:21:35 +02:00
can1357 63572329dd test(utils): cover TempDir retry bound and skip filters
Adds regression coverage the PR's stated 'bounded retries' contract
needs but lacked: gives up after the 4-retry bound and rethrows the
original EBUSY (no infinite loop, no masking), skips non-transient
codes, and never retries off Windows. Also adds the missing final
newline biome required on the new test file.

Addresses review feedback on #2382.
2026-06-14 17:27:15 +02:00
oldschoola 0d83a0fabc fix(utils): drop sleepSync type assertion; add EBUSY retry tests 2026-06-14 17:23:06 +02:00
can1357 b830f7912b feat: unified speech setup and introduced local STT/TTS capabilities
- Added unified `omp setup speech` flow with JSON/check modes and model picker.
- Added local STT pipeline with sherpa workers, recorder/download flow, and streaming inference.
- Added local TTS pipeline with `omp say`, backend selection, and streaming vocalization.
- Replaced legacy speech settings with unified `speech`/`speechgen` configuration keys.
2026-06-14 16:07:44 +02:00
metaphorics 2b126ffb80 feat(tui): add event-loop watchdog and phase breadcrumbs for stall diagnosis
Always-on LoopWatchdog (armed in TUI.start/stop) logs ui.loop-blocked with blockedMs and the current loop phase on the rising edge of a late probe tick. New pushLoopPhase/popLoopPhase/currentLoopPhase stack in pi-utils feeds it; breadcrumbs at in-process subagent dispatch (subagent:<id>) and the SelectList fuzzy filter (ui.select-filter) attribute residual main-thread stalls.
2026-06-14 08:23:05 +09:00
Ogrodev 6450d3b46a Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias
# Conflicts:
#	packages/coding-agent/src/cli/args.ts
2026-06-13 18:05:16 -03:00
can1357 b75c7dd5f2 fix(utils): added abort propagation to createAbortableStream
- Reworked createAbortableStream to forward abort signals to the source stream reader.
- Added cleanup logic so abort/cancel/error paths release locks and emit AbortError consistently.
- Updated related tests to verify source-stream cancellation and handoff escape-handler behavior.
2026-06-13 17:56:02 +02:00
HugoAir Dev 798e28ff07 test: exercise public mermaid renderer 2026-06-13 18:33:50 +09:00
HugoAir Dev 46c68570e4 test: cover mermaid emoji label collision 2026-06-13 18:17:53 +09:00
Ogrodev dbe6c57576 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias 2026-06-12 11:31:37 -03:00
can1357 961e7c10d3 feat(utils): added isMacosMallocStackLoggingEnvName() function
- Added isMacosMallocStackLoggingEnvName() function to identify MallocStackLogging and MallocStackLoggingNoCompact variables. Updated filterProcessEnv() and Bun.env initialization to skip these variables during environment filtering. Added test case to verify malloc stack logging toggles are dropped instead of forwarded.
2026-06-12 15:46:52 +02:00
can1357 9845ba1861 feat(deps): enabled fastembed and onnxruntime peers to install on demand
- Moved `fastembed` and `onnxruntime-node` to optional peerDependencies.
- Fixed bundled installs that could not resolve `onnxruntime_binding.node`.
- Added shared `runtime-install` utilities for on-demand module resolution.
- Added tests for runtime-resolution parsing and exact peer-version checks.
2026-06-12 14:18:58 +02:00
Ogrodev fb027a65b3 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias 2026-06-11 17:12:37 -03:00
roboomp 2f4ba21a62 fix(lsp): resolved per-file format options from editorconfig and content
The format-on-write path sent a hardcoded {tabSize:3, insertSpaces:true}
on every textDocument/formatting request from two duplicated DEFAULT_FORMAT_OPTIONS
constants. Servers that honour tabSize for re-indent (yaml-language-server, the
common YAML/Kustomize/Flux case) reserialized 2-space files at a 3-space stride
on every write — exactly the corruption reported on Kubernetes/Flux YAML repos.

Replace both constants with a single resolveFormatOptions(filePath, content)
helper that layers, in order:
- .editorconfig (indent_style, indent_size, tab_width) via the new
  getEditorConfigFormatting() helper in pi-utils — strict, no fallback.
- Indent sniffed from the in-memory content the agent is about to write
  (first indented line decides spaces vs tabs; GCD of space-indent widths
  fixes the unit).
- Hardcoded 2-space fallback. The previous 3-space stride was an unusual
  default that actively damaged every file with a 2/4-space convention.

Tests cover the editorconfig and content-sniffing paths plus a direct
regression check that 2-space YAML stays 2-space (the issue's repro).

Fixes #2329
2026-06-11 21:03:49 +02:00
Ogrodev 75694dc49c Merge upstream/main (15.11.0) into feat/profiles-and-alias
Conciliated changelogs: branch entries kept under [Unreleased] above
upstream's new 15.11.0 release section in coding-agent and utils.
2026-06-10 19:08:49 -03:00
can1357 86195d6944 refactor(cross-cutting): moved grouped path-tree helpers into pi-utils 2026-06-10 23:13:39 +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 1c885471bc fix(utils): unescaped \n/\t in {{join}} prompt helper separator 2026-06-10 17:40:50 +02:00
Ogrodev ff77f2b3e9 Merge upstream/main into feat/profiles-and-alias 2026-06-09 21:22:04 -03:00
can1357 f2137becb8 fix: fixed prompt parsing, startup tracing, and help-command behavior
- Fixed help rendering so `--help` no longer triggers unrelated command loaders.
- Fixed startup span logging to emit markers only with PI_DEBUG_STARTUP set.
- Fixed logger startup trace behavior for `:start`, `:done`, and `:fail` phases.
- Fixed prompt template processing with cached raw-template compilation and safer formatting.
- Optimized symbol and tag parsing in prompt templates via manual parsers.
2026-06-10 02:17:35 +02:00