Commit Graph

45 Commits

Author SHA1 Message Date
can1357 00e6e14cb4 feat: added reconstructed raw SSE capture for stream provider SDKs
- Added reconstructed SSE event emission for OpenAI, Azure, and Anthropic streams.
- Added raw SSE text to debug report bundles, including raw-sse.txt output.
- Included dropped-record metadata in raw SSE text when events were trimmed.
- Updated raw SSE and sse-debug tests for observer-based capture and safety checks.
2026-06-08 02:35:14 +02:00
can1357 99e91138a4 feat(coding-agent): enabled component-based chat rendering with managed block lifecycles
- Added ChatBlock and ChatBlockHost with mount, finish, and dispose lifecycle callbacks.
- Added InteractiveModeContext.present and resetTranscript APIs and used them to mount/repaint blocks.
- Reworked controller rendering paths to emit command, event, extension, and selector outputs via ctx.present.
- Implemented component and container dispose hooks in tui so loaders and child blocks cleanup timers/effects.
2026-06-07 03:33:53 +02:00
can1357 4c5279b04b ux(modes): unified transcript spacing and block grouping for cleaner rendering
- Centralized transcript spacing by stripping blank edges and inserting separators.
- Removed per-component leading spacers and empty placeholders that added extra gaps.
- Introduced TranscriptBlock grouping so related outputs render as single transcript children.
- Updated transcript-related tests to validate one-row block separators and blank-line trimming.
2026-06-07 02:58:38 +02:00
can1357 2d0f62eb69 refactor(coding-agent): replaced list count indicators with ScrollView
- Wrapped selector and overlay list windows in ScrollView for proportional right-edge scrollbars.
- Dropped numeric position/count footers in favor of the scrollbar.
- Simplified SelectList status line to search hints only.
- Added ED3-risk autocomplete repaint test for POSIX terminals.
2026-06-06 14:20:41 +02:00
can1357 53aaced81f feat: enabled text-sizing and fixed OSC66 and DECCARA rendering behavior
- Added `textSizing` terminal capability and `tui.textSizing` setting for Kitty OSC66 scaling.
- Updated OSC66 range and visible-width handling to preserve grapheme slice behavior.
- Updated markdown rendering to apply heading text sizing only when enabled.
- Fixed DECCARA trailing-background fill tracking and DECRPM status 3/4 recognition.
2026-06-04 01:33:48 +02:00
can1357 48017b5f67 feat(packages/coding-agent): added terminal protocol debug diagnostics
- Added debug menu options for terminal state and protocol checks with new handlers.
- Added terminal diagnostics models and collectors to report geometry, protocol flags, and multiplexer data.
- Added protocol-probe utilities to encode RGB PNGs, generate sample content, and render test panels.
- Added support components for verbatim line rendering and OSC66-scaled text rows.
- Added tests validating image encoding, OSC66 output, and terminal state formatting.
2026-06-04 00:50:46 +02:00
can1357 44f85beb4a feat(ai): added websocket frame forwarding for raw SSE debug events
- Added helpers to synthesize RawSseEvent records for inbound, outbound, and malformed Codex WebSocket traffic.
- Passed onSseEvent through websocket transport and stream setup so frames are forwarded to the raw-SSE debug pipeline during streaming.
- Added a stream test that verifies outbound and inbound websocket frames are emitted with SSE-style raw lines for the debug viewer.
2026-05-26 11:21:02 +02:00
can1357 2155b8e020 perf: replaced WeakMap caches with symbol-keyed properties
- Migrated per-object caches (chat/tool starts, model fingerprints, validation contexts, provider indexes, render IDs) from WeakMap to Symbol-keyed properties on the objects themselves.
- Rewrote SSE debug tee as a single-pass inline parser, eliminating the body.tee() + readSseEvents re-parse pipeline.
- Refactored MockModel from a factory function + external WeakMap state into a self-contained class.
- Added FIFO memoization caches for heuristic candidate expansion and namespace suffix lookups.
2026-05-17 03:47:45 +02:00
can1357 cb05764eac feat(ai): added pi-native auth-gateway transport
- Added POST /v1/pi/stream endpoint that accepts canonical Context directly, skipping wire-format translation layers.
- Added client-side streamPiNative dispatch activated via Model.transport = "pi-native".
- Propagated transport field through model registry, provider overrides, and models.yml schema.
- Refactored deriveSessionId to accept explicit arguments instead of ParsedFormatRequest.
2026-05-17 03:05:57 +02:00
can1357 39f34ada70 feat: added pure-JS sanitizeText
- Migrated sanitizeText from pi-natives to pi-utils as a pure-JS implementation, removing the native dependency across all call sites.
2026-05-16 20:12:26 +02:00
can1357 9f386dd6e5 feat(ai,coding-agent): raw SSE diagnostics + steady-state idle watchdog
Adds an opt-in onSseEvent callback across HTTP-streaming providers (Anthropic, OpenAI Responses/Completions, Azure OpenAI Responses, OpenAI Codex SSE, Google Gemini CLI, GitLab Duo, Kimi, Synthetic) so callers can inspect raw SSE frames without altering parsed output. Provider fetch wrapping only tees response bodies when an observer is wired; standalone packages/ai consumers without onSseEvent are not penalized.

Adds streamIdleTimeoutMs (env: PI_STREAM_IDLE_TIMEOUT_MS, with PI_OPENAI_STREAM_IDLE_TIMEOUT_MS as a backward-compatible alias). Anthropic now enforces a steady-state idle watchdog (default 120s) in addition to the first-event watchdog. OpenAI Responses, Azure Responses, and Codex (SSE + WebSocket) gain a semantic-progress predicate so response.in_progress-style keepalives no longer keep stalled tool calls alive forever.

Adds a coding-agent debug-panel raw SSE viewer backed by a per-session bounded buffer (1000 records / 512KB) that AgentSession populates unconditionally so users can post-hoc inspect a stuck stream from the TUI.
2026-05-10 04:53:41 +02:00
can1357 ce17e4d1da fix(coding-agent): harden CPU info and PR push target
Fixes #779

Fixes #778
2026-04-25 18:56:47 +02:00
can1357 b60c0cc3ce refactor: migrated tab width resolution to pi-utils with EditorConfig caching
- Extracted tab width resolution from pi-natives to pi-utils with EditorConfig caching support.
- Made tabWidth parameter required in native text functions (visibleWidth, truncateToWidth, wrapTextWithAnsi, sliceWithWidth, extractSegments).
- Removed process-wide tab width state management from pi-natives text module.
- Consolidated wrapper node promotion logic in chunk classification with abbreviated string representations.
- Removed path-clean and pathdiff dependencies from pi-natives.
- Updated all consuming packages to import tab width functions from pi-utils and pass explicit tabWidth parameters.
2026-04-10 14:18:36 +02:00
can1357 9b78a6fa85 refactor(natives): migrated native bindings to NAPI-RS with auto-generated types
- Migrated native bindings from TypeScript wrappers to NAPI-RS generated modules with auto-generated type definitions and runtime enums.
- Replaced chunk tree API with stateful ChunkState class supporting render, edit, and resolve operations with improved error handling.
- Converted callback signatures to error-first pattern (error, result) for shell, PTY, glob, and grep operations.
- Introduced type-safe enums for MacOSAppearance, GrepOutputMode, KeyEventType, ImageFormat, and AstMatchStrictness replacing string literals.
- Refactored chunk tree implementation with dedicated modules for edit, indent, resolve, and state management with comprehensive validation.
- Moved clipboard utilities from native bindings to coding-agent package with improved OSC 52 and Termux compatibility.
2026-04-07 02:00:59 +02:00
HvC 50a9f872de fix(tui): fixed windows numpad input (#339)
* fix(tui): fixed windows numpad input

* numlock handles in kitty CSI p2

* fix(tui): preserved modified numlock keypad nav

* fix(tui): restored autocomplete keystroke triggers

---------

Co-authored-by: Brit <lol@no.com>
2026-03-09 15:14:28 +01:00
can1357 fd5c1e9115 fix(coding-agent): removed unnecessary awaits from non-promise function calls
- Removed await from stream() calls that return async iterables directly.
- Removed await from synchronous utility functions like findApiKey(), resolvePythonRuntime(), and getToolPath().
- Removed await from prerenderMermaid() and findExaKey() calls that don't require awaiting.
2026-03-04 02:09:12 +01:00
can1357 16f643ed3c refactor(clipboard): restructured clipboard copy to synchronous execution
- Converted clipboard copy operation from async to synchronous execution across native and TypeScript layers.
- Simplified copy_to_clipboard return type from task::Async<()> to Result<()> in Rust implementation.
- Removed promise chains and async/await from clipboard handlers in command and input controllers.
- Updated clipboard module documentation to explain synchronous execution avoids AppKit pasteboard warnings.
- Reordered fix:rs script to run cargo fmt before cargo clippy for consistent formatting.
2026-03-04 01:51:23 +01:00
can1357 c0edd45496 fix(coding-agent): corrected fetch result rendering to wrap long lines
- Fixed fetch result rendering to properly wrap long lines instead of truncating them.
- Replaced Bun.wrapAnsi with unified wrapTextWithAnsi utility across debug and output modules.
- Corrected content preview calculation to use actual wrapped line count instead of truncated count.
2026-03-04 01:42:38 +01:00
can1357 0fbd76d3fa feat(coding-agent/modes): added debug transcript export command to dump visible TUI conversation
- Added transcript export option to debug menu that writes visible TUI conversation to a temporary text file.
- Implemented handleDebugTranscriptCommand in CommandController to render chat messages, strip ANSI codes, and write to temp directory.
- Updated InteractiveModeContext interface and InteractiveMode to expose the new debug transcript command handler.
2026-03-01 08:53:49 +01:00
can1357 a83175c94c refactor: migrated imports to unified package root and consolidated skill discovery logic
- Consolidated @oh-my-pi/pi-utils subpath imports into single package root import across 100+ files.
- Moved tryParseJson utility from local web scrapers module to @oh-my-pi/pi-utils package for centralized JSON parsing.
- Renamed loadSkillsFromDir to scanSkillsFromDir and refactored skill discovery to use fs.promises.readdir instead of glob-based approach.
- Replaced custom parseJSON with tryParseJson across discovery modules for consistent error handling.
- Removed emitCustomToolSessionEvent method and cleanupSshResources function, consolidating shutdown logic into dispose method.
- Updated glob pattern construction to use GlobBuilder with literal_separator(true) for improved path handling.
2026-02-23 20:59:17 +01:00
can1357 abf8c1efc9 refactor: unslop common utilities 2026-02-22 11:01:11 +01:00
can1357 e4225d6829 refactor(coding-agent): consolidated output utilities into streaming-output module
- Consolidated truncation and output utilities from tools/truncate.ts and tools/output-utils.ts into session/streaming-output.ts with improved UTF-8 boundary handling.
- Renamed formatSize() to formatBytes() across codebase for consistency and clarity in byte-level formatting.
- Refactored OutputSink to use windowed byte truncation instead of full-buffer encoding, improving memory efficiency on large outputs.
- Migrated from Buffer to Uint8Array in web scrapers for better cross-platform compatibility and native browser support.
- Added getArtifactManager() lazy-initialization method to ToolSession for deferred artifact manager instantiation.
- Simplified API surface with wildcard exports from tools and session modules, reducing import complexity.
2026-02-22 01:02:26 +01:00
can1357 18eae63bb3 fix(coding-agent/debug): accounted for expanded row heights in scroll offset calculation 2026-02-15 09:53:18 +01:00
can1357 1562b21722 fix(coding-agent/debug): limited log file reads to tail 5000 lines / 2MB to prevent OOM 2026-02-15 09:53:18 +01:00
can1357 5ced7791c8 fix(coding-agent/debug): fixed sanitizeText imports from pi-utils to pi-natives 2026-02-15 09:53:18 +01:00
julia 1f8a61ff6a feat(coding-agent/debug): Linked debug report paths as file hyperlinks
- Formatted generated report paths with OSC-8 hyperlinks so terminals can open files directly.
- Reused the hyperlink formatter across performance, bundle, and memory save messages.
2026-02-15 09:53:17 +01:00
julia a2a10561f6 feat(coding-agent/debug): Enabled loading older debug logs from archived files
- Added a DebugLogSource that reads dated log files and feeds the viewer from the debug selector.
- Made load-older handling asynchronous to fetch external chunks while preserving cursor and scroll state.
- Updated log viewer tests for the new options, external log sources, and async loading paths.
2026-02-15 09:53:17 +01:00
julia a866f527b2 feat(coding-agent/debug): Enabled pid filtering and incremental loading in debug viewer
- Added pid filter toggle and load-older pagination controls to the debug log viewer.
- Introduced ctrl+o and enter shortcuts plus load-older row to page earlier logs while keeping the newest 50 visible.
- Adjusted cursor and selection to ignore non-log rows, allow select-all, and keep expansion anchored when rebuilding.
- Parsed pids from JSON log lines, read full log files for viewing, and covered pid filtering and pagination in tests.
2026-02-15 09:53:17 +01:00
julia 3b7c2336c4 feat(coding-agent/debug): Added inline filtering to debug log viewer
- Added case-insensitive substring filtering with inline query entry and visible count line in the debug log viewer.
- Preserved cursor and selection when filters change and show a no matches placeholder with adjusted scroll bounds.
- Updated filter sanitization and frame layout, removing Kitty-specific help text and aligning status counters.
- Expanded tests to cover filtering, selection anchoring, copy payloads, and session boundary warnings.
2026-02-15 09:53:17 +01:00
julia 2047b9ccd1 feat(coding-agent/debug): Added interactive debug log viewer with selection controls
- Replaced the log preview with an interactive viewer supporting navigation, selection, expansion, and clipboard copy.
- Added log formatting helpers to wrap multi-line entries and parse timestamps for session boundary detection.
- Covered viewer selection, copy payload sanitization, expanded formatting, and timestamp parsing with new tests.
2026-02-15 09:53:17 +01:00
julia 8d3fe37ca5 fix(coding-agent/debug): Sanitized debug log rendering
- Sanitized debug log lines by stripping ANSI/control codes, replacing tabs, and truncating to terminal width.
- Added formatting helper and unit tests covering sanitization, tab handling, and truncation.
2026-02-15 09:53:16 +01:00
can1357 d1e16d2101 refactor: implemented $PWD > cwd to prevent macOS symlink resolution
- Replaced all direct `process.cwd()` calls with `getProjectDir()` utility function across 40+ files to centralize project directory resolution logic.
- Added `getProjectDir()` and `setProjectDir()` functions to `@oh-my-pi/pi-utils/dirs` module to provide abstracted project directory management.
- Made `SessionManager.list()` method asynchronous to support asynchronous session discovery operations.
- Updated default working directory resolution throughout codebase to use `getProjectDir()` instead of `process.cwd()` for improved project directory detection.
2026-02-13 23:40:02 +01:00
can1357 fcd7ff4f84 refactor(dirs): centralized directory path utilities into @oh-my-pi/pi-utils/dirs module
- Extracted directory path utilities from multiple packages into a centralized '@oh-my-pi/pi-utils/dirs' module.
- Moved 30+ path helper functions (getAgentDir, getConfigRootDir, getPluginsDir, getMCPConfigPath, etc.) from scattered locations into a single shared utility module.
- Consolidated APP_NAME, CONFIG_DIR_NAME, and VERSION constants into the centralized dirs module for reuse across packages.
- Updated 70+ import statements across packages/ai, packages/coding-agent, packages/stats, and packages/tui to use the new centralized module.
- Removed local path construction logic and replaced with utility function calls for improved maintainability and consistency.
- Deleted packages/coding-agent/src/extensibility/plugins/paths.ts as its functions were moved to the centralized dirs module.
2026-02-13 15:06:05 +01:00
can1357 a44ae81262 refactor(coding-agent): extracted cross-platform path opening logic into unified utility function
- Extracted cross-platform URL and file path opening logic into a unified `openPath` utility function.
- Removed duplicate platform-specific browser opening code from five modules (stats-cli, debug, login-dialog, command-controller, mcp-command-controller) and replaced with calls to the centralized utility.
- Simplified error handling by delegating platform detection and command execution to the reusable utility function.
2026-02-12 00:55:09 +01:00
can1357 833811be59 feat(coding-agent): improved system info collection with macOS detection and optional values
- Added macOS marketing name detection to system information collection for both Rust and TypeScript implementations.
- Changed system info functions to return optional values instead of fallback strings, improving data accuracy.
- Refactored GPU caching to be independent from other system info, reducing unnecessary cache invalidation.
- Updated environment info collection to filter out undefined values, providing cleaner system prompt output.
2026-02-11 20:42:25 +01:00
can1357 acf8ab5225 style: stylistic changes 2026-02-10 07:39:39 +01:00
can1357 89e6479661 refactor: migrated environment variable access from process.env to Bun.env across 71 files
- Migrated all environment variable access from Node.js `process.env` to Bun runtime `Bun.env` API across the entire codebase.
- Updated 71 files including source code, tests, documentation, and configuration to use Bun's native environment variable API.
- Added comprehensive environment variables documentation in `packages/coding-agent/docs/environment-variables.md` covering 100+ environment variables organized by category.
- Updated CHANGELOG entries to reflect migration from `process.env` to `Bun.env` and environment variable prefix changes (PI_* vs OMP_*).
- Maintained identical behavior and logic across all changes - only the environment variable access method was updated.
2026-02-05 04:51:18 +01:00
can1357 2c34b641cd revert "feat(coding-agent): added Grafana Pyroscope continuous profiling integration"
This reverts commit 1b81e820bf.
2026-02-05 02:38:33 +01:00
can1357 1b81e820bf feat(coding-agent): added Grafana Pyroscope continuous profiling integration
- Added Grafana Pyroscope continuous profiling integration for CPU and heap profiling.
- Added seven new Pyroscope configuration settings: enabled, serverAddress, appName, basicAuthUser, basicAuthPassword, tenantID, and flushIntervalMs.
- Added support for Pyroscope configuration via environment variables: PYROSCOPE_URL, PYROSCOPE_APP_NAME, PYROSCOPE_BASIC_AUTH_USER, PYROSCOPE_BASIC_AUTH_PASSWORD, PYROSCOPE_TENANT_ID, and PYROSCOPE_FLUSH_INTERVAL_MS.
- Integrated Pyroscope initialization and shutdown into the main application lifecycle with automatic profiling start/stop.
- Added @pyroscope/nodejs dependency for continuous profiling capabilities.
2026-02-05 02:17:35 +01:00
can1357 7e64c4b6d8 feat(natives): exported getWorkProfile function and WorkProfile type from main package index
- Exported getWorkProfile function and WorkProfile type from main package index for work profiling capabilities.
- Updated coding-agent debug module imports to use new main package exports instead of subpath imports.
2026-02-02 13:39:00 +01:00
can1357 68992fbbf3 perf(pi-natives): optimized memory allocations by replacing Vec with SmallVec across modules
- Replaced heap-allocated Vec with stack-allocated SmallVec in grep module for context lines and type filters to reduce allocations.
- Optimized process tree data structure in ps module from Vec to SmallVec with capacity 4 for typical process child counts.
- Changed shell module to use SmallVec for process IDs collection, reducing heap allocations in abort operations.
- Refactored text module to use SmallVec for token and line collections, avoiding heap allocations for typical text wrapping scenarios.
- Increased work profiler stack capacity from 2 to 4 elements and optimized stack collection using iterator copy.
- Added work profile capture to debug report bundle for improved profiling insights.
2026-02-01 22:08:02 +01:00
can1357 951fc48eba feat(work): added work scheduling profiler with circular buffer sampling and flamegraph visualization
- Added work scheduling profiler with always-on circular buffer sampling to track CPU scheduling patterns and task execution times.
- Added `getWorkProfile()` native function to retrieve profiling data including folded stacks, markdown summary, SVG flamegraph, and metrics for the last N seconds.
- Added work profile debug menu item to visualize CPU scheduling patterns via flamegraph in the coding agent.
- Added work profile support to report bundles with folded stacks, summary, and flamegraph visualization.
- Updated `launch_blocking()` and `launch_async()` functions to accept task name tags for profiling instrumentation.
- Added dependencies on inferno, smallvec, and heapless crates for profiling infrastructure.
2026-02-01 22:04:15 +01:00
can1357 7233c4c8af fix: added windowsHide option to child process spawn calls
- Added `windowsHide: true` option to all child process spawn calls to prevent console windows from appearing on Windows systems.
2026-01-31 01:35:10 +01:00
can1357 8248b9e5ef feat(coding-agent/debug): added 'Open: artifact folder' menu option to debug selector for quick access to session artifacts
- Added 'Open: artifact folder' menu option to debug selector for quick access to session artifacts.
- Implemented handleOpenArtifacts() method to open session artifact directories in the native file manager with cross-platform support (macOS, Windows, Linux).
- Added fs/promises import for directory existence validation.
2026-01-30 01:04:54 +01:00
can1357 5503560d68 feat(coding-agent/debug): added interactive debug command with profiling and diagnostics
- Added interactive `/debug` command with menu-driven interface for bug report triage and system diagnostics.
- Implemented CPU profiling workflow allowing users to capture performance profiles during issue reproduction.
- Added heap snapshot generation for memory issue analysis and debugging.
- Implemented debug report bundle creation with session data, logs, system info, and optional profiling artifacts.
- Added system information collection and display including OS, CPU, memory, and version details.
- Implemented artifact cache management with size statistics and cleanup functionality.
2026-01-29 16:00:36 +01:00