Commit Graph

161 Commits

Author SHA1 Message Date
Shawn Koh a42868f550 fix: make terminal state diagrams readable 2026-08-11 01:00:35 +08:00
can1357 e0ec404de6 refactor(coding-agent): split theme module by responsibility
- theme.ts mixed symbol presets, JSON schema, color math, the Theme class,
  loading, global state, appearance handling and TUI adapters in 3171 lines.
- Symbols, schema, color, theme-class, loader and tui-adapters are now
  siblings; theme.ts keeps global state, the watcher, appearance handling and
  HTML export at 745 lines, with all 44 exports intact.
- Left appearance and export-colors in place: both read private mutable
  auto-theme state, so extracting them would have required new exported
  internals or DI rather than a straight move.
2026-08-08 06:32:01 +02:00
can1357 e9888367d1 refactor: migrated packages to internal utility modules and removed external dependencies
- Implemented in-house, zero-dependency utility modules in `pi-utils` covering DOM manipulation, markdown parsing, templating, browser automation helpers, and terminal buffers.
- Migrated packages across the repository to consume the new internal utilities and `omptype` schema validators instead of external dependencies.
- Removed multiple external runtime and development dependencies including Zod, Marked, LRU cache, Turndown, and Puppeteer browser packages.
2026-08-05 13:39:09 +02:00
can1357 bc39ffa265 feat: introduced omptype validation package and migrated workspace dependencies
- Introduce `@oh-my-pi/omptype` as a new ArkType-compatible schema validation package featuring a lazy JIT runtime, JSON Schema emission, and compatibility adapters.
- Replace `arktype` across workspace packages and test utilities with `@oh-my-pi/omptype`.
- Add benchmark suites, tests, and documentation for the new validation engine and adapters.
- Update workspace build, test runner, and release configurations to include the new package.
2026-08-03 21:56:48 +02:00
Alex Jaden daa9b99aab fix(coding-agent): preserve scrollback on appearance changes 2026-07-31 10:34:43 +05:00
Alex Jaden 070ff41f4c fix(coding-agent): sync WezTerm theme changes on macOS
(cherry picked from commit fa70be267daa6f98cf18e2f257041f4e6e68a61d)
2026-07-29 23:08:34 +02:00
can1357 d16a251777 chore: reorg tests 2026-07-27 16:43:53 +02:00
pr-eval 424458e99d chore(secrets): dropped drive-by changes unrelated to secret placeholders
Reverted branch-side edits to spawn-policy prompts/tests, settings tab
groups, mermaid cache typing, prewalk todo gating, and packages/ai test
churn back to merge-base content; trimmed their changelog entries. These
repaired stale CI against an older main and are stale or conflicting
against current main.
2026-07-23 17:56:29 +02:00
can1357 c0c1622012 Merge PR #4636: feat(secrets): add friendly names to secret placeholders (@Mathews-Tom)
# Conflicts:
#	packages/ai/test/pi-native-client.test.ts
#	packages/coding-agent/src/advisor/runtime.ts
#	packages/coding-agent/src/prompts/tools/eval.md
2026-07-23 17:56:24 +02:00
can1357 42a3da21de Merge PR #4001: feat(coding-agent): opt-in Markdown read previews (@oldschoola) 2026-07-23 17:30:33 +02:00
can1357 056c53189e merged PR #5421: fix(tui): use Nerd Fonts v3 session icon 2026-07-16 03:32:04 +02:00
Mathews-Tom 9a01a77c4a Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-15 04:48:00 +05:30
roboomp 0eda288b99 fix(tui): updated nerd session icon codepoint
Replaced the removed Nerd Fonts v2 Material Design glyph with its Nerd Fonts v3 mapping and covered the preset contract.

Fixes #4795
2026-07-14 16:22:55 +00:00
can1357 da24614d5a feat: added scrollback rebuild controls and prewalk status-line visibility
- Added `tui.scrollbackRebuild` configuration with interactive startup/controller wiring to apply `setScrollbackRebuild`.
- Exposed prewalk session state in `SegmentContext` and rendered a dedicated prewalk segment/icon in the status line.
- Added divergence-aware TUI full-paint logic that enables scrollback erase-and-replay rebuilds for non-multiplexer divergence cases.
- Updated rendering and streaming tests to verify rebuild behavior (`3J`) and eliminate stale marker expectations under drift scenarios.
2026-07-14 00:39:34 +02:00
can1357 e770cdc4d9 fix(coding-agent): unified tool renderer and clarified launch diagnostics
- Implemented a consolidated TUI renderer for launch tool operations to unify status headers and metadata.
- Added tracking for unfulfilled readiness conditions to distinguish between timeout causes and daemon states.
- Enhanced timeout reporting to explicitly surface specific unmet log or port conditions.
- Included comprehensive unit and regression tests for tool rendering and start-timeout diagnostics.
2026-07-13 05:16:36 +02:00
Mathews-Tom 8d231daedb Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-11 20:42:16 +05:30
can1357 59d08172c1 feat(coding-agent): introduced model hub for unified management and search
- Replaced the legacy model selector with a full-screen Model Hub, introducing mouse support and a fuzzy-searchable browser.
- Integrated comprehensive model management, including role assignment, thinking-level visualization, and manual provider discovery.
- Implemented a cancellable OAuth login flow and integrated it directly into the Model Hub for provider authentication.
- Centralized model logic and migrated existing tests to support the new component architecture.
2026-07-11 15:10:53 +02:00
can1357 520f6f9bcc feat(catalog): standardized reasoning effort configuration
- Transitioned DeepSeek models to an explicit `[High, Max]` effort ladder, removing stale alias maps.
- Updated the OpenAI compatibility layer to enforce authoritative `supportsReasoningEffort` and `omitReasoningEffort` flags.
- Synchronized `models.json` definitions to reflect accurate reasoning effort capabilities across the catalog.
2026-07-10 13:59:54 +02:00
can1357 d435385ab1 feat: introduced max reasoning effort tier across model and rpc systems
- Introduced `Max` as a first-class reasoning effort tier across all packages, including AI providers, coding agent configurations, and RPC protocols.
- Refactored model effort ladders to use wire-exact mappings and removed legacy effort aliasing (e.g., `max-to-xhigh` mapping).
- Updated model registry and provider configurations to support `Max` tier routing, color themes, and UI icon associations.
- Expanded test suites to provide end-to-end coverage for the new reasoning tier, including updated compatibility and fallback scenarios.
2026-07-10 13:39:42 +02:00
Mathews-Tom 79d1658703 Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-06 03:03:55 +05:30
Mathews-Tom ec9dedec3d Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-04 06:30:49 +05:30
roboomp 31ac7e27eb perf(coding-agent/tui): scoped renders + shimmer band fast-path
Timer-driven reveal and spinner ticks (streaming reveal, tool-args reveal,
tool-execution spinner, todo strike animation) now hand the changed
component to `TUI.requestComponentRender(component)` instead of forcing a
full-tree render at 30fps. Every other root subtree reuses its previous
frame rows, cutting the Box/Container tree walk out of the compose
pipeline while the transcript grows.

Shimmer:
- Intern the working-message palette per accent (WeakMap-keyed) so the
  Symbol-slot compiled-ANSI cache in `shimmerSegments.compile` actually
  hits between frames — the fresh palette literal in `renderWorkingMessage`
  guaranteed a per-tick miss.
- Add an `activeBand` fast-path: outside the sweep window the intensity
  is guaranteed zero, so those code points coalesce into a single low-tier
  run without running `intensityFn` or `tierFor`. On the typical ~60-char
  working message the classic band is 12 cells wide, so ~80% of the per-char
  loop disappears.

Widen `ToolExecutionHandle` to extend `Component` (matches every
concrete impl — `ToolExecutionComponent`, `ReadToolGroupComponent` —
which already extend `Container`) so the reveal controller callback
sites are type-checked.

Fixes #4377
2026-07-03 00:50:03 +00:00
can1357 16267f4e6a Merge remote-tracking branch 'origin/farm/51e9b851/tui-render-cpu-overhead' 2026-07-03 00:47:33 +02:00
can1357 f577f4cb22 ux(coding-agent): visualized advisor notes to distinguish from output
- Introduced a dedicated advisor rail symbol to differentiate note cards from thinking output.
- Applied bold custom header tags and severity-tinted rails to distinguish advisor notes from surrounding text.
- Shifted note body text to the default content color to prevent blending with dimmed thinking-output styles.
2026-07-03 00:46:46 +02:00
roboomp 30527aee0c fix(tui): cut TUI CPU overhead during interactive sessions
Four tightly-scoped hot-path fixes covering the highest-impact items in the
reporter's CPU profile (13.1 s profiled / 30 s window):

1. `event-controller.ts:handleEvent` no longer fires a blanket
   `statusLine.invalidate() + ui.requestRender()` before every session event.
   The pre-render was a leftover from #4145 when `updateEditorTopBorder()`
   still eagerly rebuilt the border; the lazy provider added in #4145 made
   it redundant. It fired on every `message_update`/`tool_execution_update`
   during streaming — the pre-render's frame ran while the handler was
   awaiting, then the handler's own `requestRender` scheduled a second
   identical frame. Every handler that mutates visible state already calls
   `requestRender()`.

2. `shimmer.ts:shimmerSegments` iterates the segment string in place instead
   of building a code-point array with `Array.from(seg.text)` every animation
   frame. Runs of same-tier chars are emitted via a single `slice` per run
   rather than accumulating into `runBuf`. Surrogate pairs stay atomic — the
   code-point index still advances by 1 per emoji. Microbench over 30k
   frames: 45 ms → 18 ms (2.53x), allocation rate down from ~N-per-frame to
   a handful per frame. New tests cover mixed BMP+surrogate and all-emoji
   inputs. `Array.from` was the #1 self-time hotspot in the reporter's
   profile at 10.2%.

3. `Markdown.setText` gains an equality guard mirroring `Text.setText`
   (returns `false` when `text === #text`). Providers re-emit identical text
   on ticks with no delta (throttled frames, reconciled tool-execution
   updates); each of those now short-circuits instead of dropping
   `#cachedLines` and forcing a full lex + wrap on the accumulated paragraph
   (the reporter's #3 hotspot at 8.4%). New test asserts render-reference
   stability + return-value semantics.

4. `SPINNER_RENDER_INTERVAL_MS` aligned with `SPINNER_GLYPH_ADVANCE_MS`
   (both 80 ms). The previous 33 ms cadence emitted ~2.4 paints per glyph
   step; the differential-output dedup only skips the write, not the
   compose walk. Visually identical (glyph advance was already 12.5fps),
   halves paints during tool execution.

Skipped (out of scope for a bug fix, deserve dedicated PRs):
- Freezing streaming prefix on single `\n` boundaries — correctness-bound
  to `\n\n` block separators (CommonMark loose-list continuation).
- Compose-phase idle gate + adaptive-backpressure moving-average — need a
  component-level dirty flag; the 200 ms cap in `#scheduleRender` was set
  for a reason (#4145 tail-latency guard).

Tests updated: two IRC-expiry tests in event-controller-message-start.test.ts
that were asserting the pre-render's second `requestRender` call now expect
one.

Fixes #4353
2026-07-02 22:11:26 +00:00
Mathews-Tom 90548ba0e6 Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names
# Conflicts:
#	packages/coding-agent/test/interactive-mode-plan-review.test.ts
2026-07-02 06:27:32 +05:30
luk 308eabc6b3 feat(status-line): add throughput icon and simplify cache segments 2026-07-02 00:24:55 +01:00
Mathews-Tom 3feba134cf Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-02 03:06:10 +05:30
oldschoola d1f279971c feat(coding-agent): add opt-in Markdown read previews
Add the read.renderMarkdown setting (off by default) to render Markdown read results as formatted terminal Markdown previews instead of raw source.

Centralize Markdown detection in isMarkdownPath() (now covering .md, .markdown, .mdx, .mdc, .mkd, .mdown) and use it consistently across the read tool and all internal-URL protocols (local, memory, skill, ssh, vault) so the preview renderer recognizes Markdown files uniformly. Markdown read results stay verbatim for the model; only the TUI rendering changes.
2026-06-30 20:40:49 -07:00
Magicien 7da80bc325 fix(coding-agent): replay scrollback on theme changes 2026-06-30 13:06:53 +01:00
Mathews-Tom 2a9ec3a7aa Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names
# Conflicts:
#	packages/coding-agent/src/eval/__tests__/julia-prelude.test.ts
2026-06-29 02:48:29 +05:30
can1357 4db3d68bdb feat(coding-agent): implemented git worktree detection and rendering
- Added `git.repo.linkedWorktreeSync` to identify and resolve git worktree metadata without spawning subprocesses.
- Updated `StatusLineComponent` to detect linked worktrees and resolve project/worktree context names.
- Modified path segment rendering to collapse nested git worktree paths and display the worktree name when it diverges from the active branch.
- Introduced `icon.worktree` symbol across themes to visually distinguish git worktree paths.
2026-06-28 22:50:30 +02:00
Mathews-Tom 49b91ed3e2 Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names
# Conflicts:
#	packages/coding-agent/test/sdk-session-isolation.test.ts
2026-06-27 21:01:41 +05:30
can1357 2d5b08d055 feat(coding-agent): improved edit tool ui for file operations
- Enhanced the edit renderer to support visual tracking of delete and move/rename operations.
- Updated diff computation to correctly handle file-level changes and suppress erroneous "No changes" warnings.
- Improved terminal output with a clearer activity indicator and accurate state representation during multi-file operations.
- Extended the rendering pipeline to display source-to-destination paths for file renames and added validation tests for edit workflows.
2026-06-27 03:35:32 +02:00
Mathews-Tom be97adfe0d Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-06-26 20:53:35 +05:30
arg3t e894753603 feat(tui): add mermaid rendering toggle 2026-06-26 04:34:44 -07:00
Mathews-Tom 2584f7e91e Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-06-22 19:21:44 +05:30
can1357 33e2594f03 feat(coding-agent): added support for Julia and display language icons in code cells
- Added Julia language support to the theme symbol maps.
- Enabled language icons in code cell headers for the eval tool renderer.
2026-06-22 06:13:01 +02:00
Mathews-Tom 51e921d3f8 Merge upstream/main into feat/secret-friendly-names
Reconcile the friendlyName secret feature with upstream's secret-obfuscation
refactor (7302a7ae96):

- obfuscator.ts: keep upstream's typed message-transformer layer
  (deobfuscateAgentMessages/AssistantContent/ToolArguments, obfuscateMessages,
  narrow obfuscateProviderContext, obfuscateToolArguments, mapJsonStrings) as
  the canonical API; retain the PR's SecretObfuscator class internals
  (friendlyName + keyed-hash placeholders, case hints, legacy aliases,
  idempotent re-obfuscation, replace-mode hardening).
- Integrate upstream's <8-char secret toning + hasRealSec into the class.
- Thread allowLegacyAliases through the typed deobfuscation transformers so
  display-only transcripts still restore legacy index-derived aliases while
  agent-feeding paths stay keyed-only.
- Lengthen friendlyName test secrets to >=8 chars to satisfy toning; tool-result
  content is no longer deobfuscated (typed transformers walk assistant/summary
  roles only).
2026-06-22 05:33:15 +05:30
can1357 838b5162bc feat(coding-agent): standardized html export styling with brand palette
- Introduced `web-palette.ts` to implement the collab-web pink/purple brand identity for HTML exports.
- Updated `generateThemeVars` to support a `palette` option, allowing users to choose between the brand-web aesthetic and a specific TUI theme.
- Configured public exports and the share-viewer script to default to the brand-web palette rather than inheriting the user's terminal theme.
- Refactored `AgentSession.exportToHtml` to align with the new branding defaults while allowing for per-export theme overrides.
- Adjusted `dark.json` background values to ensure better visual consistency across internal surfaces.
2026-06-21 18:31:03 +02:00
Mathews-Tom 6a91ca5bc1 Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-06-19 21:26:25 +05:30
can1357 5c66faa81d Merge PR #3026: fix(coding-agent): guard theme getters against undefined theme before init (@oldschoola) 2026-06-19 17:16:37 +02:00
Mathews-Tom 3405e9b0c3 Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names
# Conflicts:
#	packages/coding-agent/test/secrets-obfuscator.test.ts
2026-06-19 19:07:41 +05:30
can1357 b877464575 refactor(coding-agent): migrated UI chrome to rounded box corners
- Switch all UI components and tests from sharp box corners (`boxSharp`) to rounded ones (`boxRound`).
- Update `Theme` to re-export sharp junction symbols (tees and cross) under `boxRound` to ensure consistent divider rendering in rounded boxes.
- Remove outdated architectural notes regarding forced tool-choice queues in documentation.
2026-06-19 07:57:15 +02:00
can1357 a9c493db13 feat(coding-agent): added toggleable prompt cache miss markers
- Added `display.cacheMissMarker` setting to enable visual indicators for prompt cache invalidation in assistant messages.
- Included updated theme symbols to represent cache misses across supported icon sets.
- Configured the selector controller to rebuild the chat display when the marker visibility setting is toggled.
2026-06-19 07:54:32 +02:00
oldschoola cc3c956f26 fix(coding-agent/modes): guarded theme getters against undefined theme before init
- Added `typeof theme === "undefined"` guards to all four theme getters.
- Fallbacks return a usable plain-ASCII or plain-text theme instead of crashing.
- Added a pre-init test asserting the getters never throw.
2026-06-18 22:14:24 -07:00
Mathews-Tom 56d2bb9ed2 Merge remote-tracking branch 'upstream/main' into pr-2735-fix
# Conflicts:
#	packages/coding-agent/test/secrets-obfuscator.test.ts
2026-06-18 06:32:23 +05:30
can1357 93347438ed fix(coding-agent): prevented async leaks and state pollution on disposal
- Added `#disposed` flags and guards to `StatusLineComponent` to stop async callbacks running post-dispose.
- Updated `onThemeChange` to return an unsubscribe function and registered it in `InteractiveMode`.
- Fixed schema validation for `spinnerFramesSchema` to narrower types instead of dynamic or-validation.
- Resolved settings leaks by saving and restoring `tuiTight` state in tests.
- Added regression tests verifying that pending async microtasks do not trigger updates after disposal.
2026-06-18 01:57:23 +02:00
can1357 a050474af7 feat: migrated validation schemas and tool definitions from Zod to ArkType
- Migrated all wire protocol, schema definitions, and tools validation from Zod to ArkType across multiple packages.
- Updated extension runtimes, custom tools loader, and TypeBox compatibility shim to expose and use ArkType instances.
- Added a comprehensive ArkType migration guide, validation parity tests, and helper utilities.
- Removed redundant PDF asset routing and parsing implementations from the read tool.
2026-06-18 00:59:53 +02:00
Mathews-Tom ac6e7f4b56 Fix coding-agent CI after main merge 2026-06-17 18:21:02 +05:30