Commit Graph
8310 Commits
Author SHA1 Message Date
can1357 b980dd24f2 refactor(coding-agent): streamline prompts for core agent tools
Rephrased and condensed prompts for the browser, eval, irc, and read tools. The updates focus on clarity, conciseness, and improved parseability for agent consumption by:

- Consolidating instructions and helper descriptions.
- Removing redundant phrasing and examples.
- Eliminating extraneous sections that added cognitive load.
2026-06-12 05:31:10 +02:00
can1357 579a005a04 feat(ai): added usage history tracking and trend reporting for account limits
- Added usage snapshot persistence in sqlite with hour-bucket upsert behavior.
- Added listUsageHistory query support with optional provider and sinceMs filters.
- Added usage CLI history mode with `--history` and `--days` and trend rendering.
- Added changelog documentation for usage trend inspection and no-history exit behavior.
2026-06-12 05:27:59 +02:00
can1357 be31ce3098 chore(scripts): added token usage estimation for tool prompts
- Added scripts/tool-prompt-usage.ts as a Bun CLI to estimate rendered tool prompt sizes.
- Implemented path-based prompt collection and configurable --encoding/--json options.
- Computed per-prompt and aggregate token, character, and line totals from rendered prompts.
2026-06-12 05:23:58 +02:00
can1357 9d94a222d3 feat(coding-agent): added anchored HUD for running subagents
- Added an anchored Subagents HUD renderer that formats active subagent sessions as `Id: description` rows.
- Integrated a new interactive-mode container and observer-driven render path so the HUD updates with session events and clears when no subagents are active.
- Exported `formatTaskId` for shared HUD formatting and added tests covering active-only filtering, fallback task/progress text, and line truncation.
2026-06-12 05:21:43 +02:00
can1357 212e05dbbb feat: added Codex saved reset-credit redemption flow to usage tooling
- Added Codex reset-credit models, endpoints, and redemption methods.
- Added reset-credit usage data and cache invalidation for successful redemption.
- Added `/reset-usage` slash command and interactive account selector flow.
- Added contract tests for reset-credit listing, fallback, and consume outcomes.
2026-06-12 05:20:08 +02:00
can1357 6091931b9d feat(coding-agent): added scoped snapcompact system-prompt imaging modes
- Added `snapcompact.systemPrompt` enum modes `none`, `agents-md`, and `all` with default `none`.
- Added AGENTS.md-mode context extraction and mode-specific system-frame injection.
- Updated `/context` and `/debug` request reporting to include snapcompact deltas, swap reasons, and estimates.
- Normalized legacy boolean `snapcompact.systemPrompt` values to enum strings for compatibility.
2026-06-12 05:14:34 +02:00
can1357 af3464cdbe fix(hashline): ignored deletes of the trailing newline sentinel in applyEdits
- Added a trailing-sentinel guard to identify newline-generated phantom lines and drop delete edits targeting them.
- Updated edit validation to allow those no-op deletes while preserving real line bounds checks.
- Adjusted format-v2 tests to expect no-op handling of sentinel deletes and clipping for ranges ending at the sentinel.
2026-06-12 05:05:35 +02:00
can1357 2630faca1f feat(coding-agent): added snapcompact savings estimation to context reporting
- Added optional snapcompact savings calculation in context breakdown with caller opt-in and setting gate.
- Added /context command integration to surface snapcompact savings and related skip reasons.
- Added context report sections for vision capability, tool-result imaging counts, and next-request token totals.
- Added shared inline-swap planning/savings estimation and transformer use for planned frame swaps.
2026-06-12 04:59:05 +02:00
can1357 4f0360e77a fix(coding-agent/task): fixed task glyphs for running, pending, and completed progress
- Updated task call and result headers to use the dispatch glyph during running async calls instead of spinner-style states.
- Switched running and pending agent rows to a static done-dot marker and reused the dot with foreground color settling when rows complete.
- Updated task rendering tests to validate the new glyphs and ensure running/pending rows do not emit spinner or pending symbols.
2026-06-12 04:58:21 +02:00
can1357 228d536a36 feat(coding-agent/modes): enabled editor-style input in settings search banner
- Replaced global search query mutation logic with a dedicated `Input` instance so typing now supports cursor movement, word deletion, and other editor hotkeys.
- Updated search banner rendering to display the embedded input line with live cursor while preserving match-count formatting and prompt width handling.
- Extended `Input` with a configurable prompt and end-of-value cursor placement, then updated memory-search tests for the new hotkey-driven editor behavior.
2026-06-12 04:54:07 +02:00
can1357 2e94b5ddd9 fix(coding-agent/prompts): fixed snapcompact tool note for rasterized image results
- Updated the snapcompact system prompt note to state that rasterized tool results are provided in PNG frames below.
- Instructed the model that image delivery is deliberate harness behavior and should not be treated as a tool malfunction.
- Recorded the updated behavior in the changelog fixed notes for this release.
2026-06-12 04:48:45 +02:00
can1357 99c9072427 feat: added one-shot AI request dump path support for debug workflows
- Added explicit request-debug path helpers in `packages/ai/src/utils/request-debug.ts` for one-shot dumps.
- Added `/debug dump-next-request`, `/debug dump-request`, and `/debug next-request` subcommands to arm next-request dumps.
- Changed `debug` handling in `packages/coding-agent/src/slash-commands/builtin-registry.ts` to execute args instead of always opening selector.
- Fixed explicit request-debug mode to resolve `~`/relative paths and create parent directories before logging.
- Fixed one-shot request-debug mode to consume its target after one call and overwrite existing response logs.
2026-06-12 04:46:53 +02:00
can1357 f29297da49 feat(tui): implemented relevance-based ranking for fuzzy search and settings matching
- Added fuzzy search preprocessing to normalize case, camelCase, and punctuation.
- Added token and phrase scoring for exact, prefix, substring, acronym, and compact hits.
- Added fuzzyRank to return {item, score}-ranked matches and delegated fuzzyFilter to it.
- Updated settings search tabs to sort by best score, keep original-order ties, and mute unmatched tabs.
2026-06-12 04:38:21 +02:00
can1357 0cb3cb6b9d chore: bump version to 15.11.4 2026-06-12 04:26:57 +02:00
can1357 15a4047785 fix(tui): fixed kitty mode reapply and double-ESC parsing across alt-screen
- Stored the active kitty keyboard enable sequence in the terminal and re-applied it after entering the alternate screen, then emitted `\x1b[<u` before leaving the alternate screen.
- Updated StdinBuffer parsing so `\x1b\x1b` waits for CSI/SS3 followers, splits `\x1b\x1b[` SGR mouse reports into a standalone Esc plus report, and reduced `PARTIAL_HOLD_MAX_MS` to 150ms.
2026-06-12 04:25:14 +02:00
can1357 4596c03fa8 feat(hashline): allowed closer-line insert after block anchors with warning fallback
- Updated block resolution to detect structural-closing-line anchors and convert unresolvable `insert after block` edits into plain `insert after` inserts while emitting a dedicated warning.
- Propagated these resolver warnings through `PatchSection` and `Patcher` results so parse and application callers receive them.
- Added tests covering the closer-anchor fallback and confirming non-closer unresolved block anchors still throw.
2026-06-12 04:25:00 +02:00
can1357 753443dd77 fix(coding-agent): stopped detached task rows from shimmering after leaving live region
- Detached async task progress rows stopped running a redraw driver and task progress rendering switched running/pending rows to static task-icon text.
- Background task snapshots were frozen once blocks left the transcript live region, preventing later partial snapshots from repainting commit-eligible rows.
- Updated task-progress and detached-background-task tests to validate static task rows and the new freeze behavior.
2026-06-12 04:25:00 +02:00
Can BölükandGitHub 2659aaefda Merge pull request #2260 from insodimension/fix/usage-active-oauth-account-upstream
Show active OAuth account in usage
2026-06-12 04:24:51 +02:00
Can BölükandGitHub ed92eb8ff6 Merge pull request #2248 from chan1103/feat/smart-paste-text-fallback
feat(coding-agent): fall back to text paste when clipboard holds no image
2026-06-12 04:24:29 +02:00
can1357 b0d2597715 refactor(coding-agent): share active-account matching across /usage renderers
- Extracted `limitMatchesActiveAccount`/`reportMatchesActiveAccount` into `slash-commands/helpers/active-oauth-account.ts` as the single definition of the report-to-account matching rules, including projectId matching against `limit.scope.projectId`/metadata.
- Dropped the duplicated `ActiveAccountIdentity`/`OAuthAccessResolver` shims, `as unknown` session casts, the dead `getOAuthAccountId` fallback, and the email-vs-scope-accountId comparison from `command-controller.ts` and `usage-report.ts`.
- Replaced the async per-provider `resolveActiveAccountsForReports` map with one synchronous typed `authStorage.getOAuthAccountIdentity()` call per render, gated to the session's current provider.
- Re-exported `OAuthAccountIdentity` from `session/auth-storage.ts` and added `active-oauth-account.test.ts` covering the matching rules.
2026-06-12 04:23:54 +02:00
can1357 ef9858fc16 feat(ai): carry projectId in getOAuthAccountIdentity and export OAuthAccountIdentity
- Added the exported `OAuthAccountIdentity` interface (`accountId`/`email`/`projectId`) next to `OAuthAccess` in `auth-storage.ts`.
- Reworked `AuthStorage.getOAuthAccountIdentity()` to return that type and carry the credential's `projectId`, so Google-style providers that key usage on the GCP project can be matched.
- Added `auth-storage-account-identity.test.ts` covering no-OAuth, field carriage, empty-field dropping, session-sticky rotation, and config-override suppression.
- Recorded the new API under `## [Unreleased]` in the pi-ai changelog.
2026-06-12 04:23:43 +02:00
can1357 c70d274320 fix(coding-agent): move /usage changelog entry to Unreleased and drop unrelated Ollama entry
- Moved the /usage active-account entry from the released 15.9.4 section into `## [Unreleased]` under `### Changed`.
- Dropped the Ollama `ollama-chat` discovery entry that described code not present in this branch.
2026-06-12 04:23:33 +02:00
can1357 5d6b1b6cbc fix(mnemopi): used real embeddings for SHMR consolidation clustering
- Switched `core/shmr` to the configured embedding provider: `embed()`, the new `embedBatch()`, `clusterBySimilarity()`, `computeHarmonyScore()`, `harmonize()`, and `recallBeliefs()` are now async and batch-embed candidate texts in a single provider call.
- Reused precomputed vectors from `memory_embeddings` for episodic candidates in `harmonize()` instead of re-embedding them.
- Kept the SHA1 bag-of-words hash (`hashEmbedding`) as the deterministic all-or-nothing fallback when no provider is available or a batch fails, and derived centroid dimensions from actual vector lengths instead of the hard-coded 384.
- Rewrote `shmr.test.ts` for the async API: provider-vector clustering (single batch call), deterministic hash fallback, and `memory_embeddings` reuse.

Fixes #2324: Mnemopi: shmr.ts uses SHA1 bag-of-words hashing instead of real embeddings for consolidation clustering
2026-06-12 04:01:57 +02:00
can1357 3e04b81c1b fix(mnemopi): surfaced silent embedding pipeline failures with structured logs
- Replaced the bare `catch {}` blocks in `runEmbedding()` (`beam/helpers.ts`), `getLocalModel()`, and the local-model path of `embed()` (`embeddings.ts`) with structured `logger.debug` entries carrying the error plus per-site context (item count, model name); failure semantics stay best-effort.
- Threaded `MnemopiOptions.debug` through `resolveRuntimeOptions()` in `memory.ts` so `mnemopiDebugEnabled()` escalates these logs to `warn` when `mnemopi.debug` is set.
- Passed `mnemopi.debug` from coding-agent settings into provider options (`debug` added to the `MnemopiProviderOptions` pick in `src/mnemopi/config.ts`).
- Added `embedding-failure-logging.test.ts` asserting the logged context on a real local-model load failure and the debug→warn escalation; the changelog entry landed with the previous commit (same contiguous run).

Fixes #2322: Mnemopi: runEmbedding() and getLocalModel() silently swallow errors — mnemopi.debug produces no diagnostic output
2026-06-12 04:01:47 +02:00
can1357 12bbefd48b feat(mnemopi): exposed polyphonic and enhanced recall via config.yml
- Added `mnemopi.polyphonicRecall` and `mnemopi.enhancedRecall` boolean settings (default off) to `settings-schema.ts` and `loadMnemopiConfig`, applied via the new `configureRecallFeatures()` in `createScopedResources`.
- Made `polyphonicRecallEnabled()`, `enhancedRecallEnabled()`, and `isEnhancedRecallEnabled()` fall back to the configured defaults while `MNEMOPI_POLYPHONIC_RECALL` / `MNEMOPI_ENHANCED_RECALL` env vars still win when set.
- Exported `configureRecallFeatures`/`RecallFeatureFlags` from the package root and `core` barrels; documented the settings in `docs/mnemosyne-memory-backend.md`.
- Added `recall-feature-flags.test.ts` covering defaults, config enablement, and env precedence; the mnemopi changelog hunk also carries the adjacent #2322 entry (same contiguous run).

Fixes #2323: Mnemopi: MNEMOPI_POLYPHONIC_RECALL and MNEMOPI_ENHANCED_RECALL not configurable via config.yml
2026-06-12 04:01:36 +02:00
can1357 cfeaee0105 feat(coding-agent): add shimmer to running jobs and refine ID display
- Running job labels now shimmer in the TUI to provide a dynamic visual indicator of activity.
- Adjusted cache key to account for shimmer animation, ensuring it updates at 30fps instead of the 12.5fps spinner cadence.
- Suppressed job ID display when the job label is identical to its ID, avoiding redundant information.
2026-06-12 04:01:10 +02:00
can1357 197f374801 fix(coding-agent): improved tree gutter anchoring & fixed tests
- Ensured flattened chain rows under a `└─` branch are anchored by a vertical line one level right of the suppressed gutter (below the branch head's content), never in the `└─` corner column itself, resolving visual issues #2298 and #2325.

Fixes #2325.
2026-06-12 03:57:09 +02:00
can1357 e58c9f4d52 fix(packages/agent): patched steering checks to avoid consuming messages
- Added `hasSteeringMessages` to `executeToolCalls` polling so queued steering is detected without dequeuing.
- Retained fallback to `getSteeringMessages` by consuming messages when no peek callback exists.
2026-06-12 03:50:05 +02:00
can1357 a8297c5cbb test(packages/coding-agent): added q object+img tests and removed compaction
- Removed obsolete compaction-threading audit test coverage.
- Updated issue-825-repro and skill-queue tests for object-based queued message text entries.
- Expanded queued-message tests to verify image restoration via clearQueue paths.
2026-06-12 03:50:05 +02:00
can1357 ec63047ad9 fix(packages/coding-agent): resolved queued steering/follow-up text+images
- Stored queued steering/follow-up attachments in `QueuedDisplayEntry` so restore APIs retain image data.
- Changed `AgentSession.clearQueue` and `popLastQueuedMessage` to return `{ text, images }` payloads.
- Restored queued text and images into editor image buffers when steer submission fails or queue items are restored.
2026-06-12 03:50:05 +02:00
can1357 6eedc1d52d fix(packages/catalog): addressed stale refresh fallback and grok limits
- Handled stale online catalog refreshes by falling back to curated models.
- Raised grok model maxTokens to 2,000,000/1,000,000/512,000 in models.json.
2026-06-12 03:50:05 +02:00
can1357 e183efbc84 feat(packages/mnemopi): added runtime debug switch for verbose diagnostics
- Added `debug` to `MnemopiRuntimeOptions` and resolved runtime options.
- Added `mnemopiDebugEnabled()` to expose runtime-scope verbose diagnostic checks.
2026-06-12 03:46:03 +02:00
can1357 d5b12494e8 test(packages/coding-agent): updated tests for declared effort filters
- Adjusted model-registry runtime-provider test expectations for effort-map filtering.
- Updated model-registry lookup test assertion to require declared effort levels only.
2026-06-12 03:46:03 +02:00
can1357 1f3b79078f test(packages/coding-agent): updated terminal frame and accent checks
- Updated settings selector tests to parse framed rows and sidebar columns accurately.
- Updated status-line tests to compare rendered accents using lazy ANSI setup.
2026-06-12 03:46:03 +02:00
can1357 8bad18563d feat(agent): updated steering tests and clarified task batching guidance
- Updated run-summary test mocks to track tool completion and only surface steering messages after the first task finishes.
- Reworked steering message retrieval from call counts to completion-and-drain state so pre-chat polls no longer block tool execution.
- Revised task prompt guidance to require batching multiple `tasks[]` in one call when subagents share context.
2026-06-12 03:31:40 +02:00
can1357 51208e5de1 feat(coding-agent): added boundary-aware steering and idle steer-queue handling
- Added optional `hasSteeringMessages` config hook and limited steering checks to boundaries.
- Fixed interrupted tool-batch steering by keeping queued messages until boundary handling.
- Added idle text and image submissions to steer queueing when no input waiter exists.
- Auto-continued resumable sessions after queued steering and preserved submit metadata.
2026-06-12 03:30:51 +02:00
can1357 f4ab3dab0e chore: bump models 2026-06-12 03:28:18 +02:00
can1357 5ecda78819 fix(hashline): fixed deep insert-after-block inward landing behavior
- Fixed deep insert-after-block landing by retreating inward corrections across trailing closers.
- Added blockStart tracking and warning diagnostics for inward correction of block inserts.
- Clarified insert-after-block prompt and changelog guidance to require opener-based landing rules.
- Added regression tests for nested, empty, and conflicted inward landing scenarios.
2026-06-12 03:27:51 +02:00
can1357 b54fa1fd22 feat(coding-agent): added configurable system prompt personalities with markdown presets
- Added a `personality` enum to `settings-schema.ts` and new `Personality` type alias.
- Replaced inline reply guidelines with a templated `<personality>` block in `system-prompt.md`.
- Added markdown personality specs and wired them into `system-prompt.ts` rendering.
- Updated `sdk.ts` and `selector-controller.ts` to apply personality changes and refresh prompts.
- Set sub-agent sessions to use `personality: none` to suppress personality rendering.
2026-06-12 03:27:51 +02:00
can1357 b69a2024d3 fix: revert read-repeat
This reverts commit 9613076e96.
2026-06-12 03:27:50 +02:00
can1357 3fd0dc3b58 feat(tui): added bounded holding for split escape partials in StdinBuffer
- Added `partialHoldTimeout` to `StdinBufferOptions` to configure extra wait for dangling partial escapes.
- Reworked `StdinBuffer` flush scheduling to defer emits and avoid stale partials merging with new escapes.
- Held SGR mouse and kitty partial escapes until cap expiry to prevent tail bytes leaking as typed text.
2026-06-12 03:27:50 +02:00
can1357 2e0ffcca46 feat(tui): added section-focus navigation support for settings interfaces
- Added `SettingsList` section-focus state with `sectionFocused`, `hasSectionFocusTargets`, and `toggleSectionFocus()`.
- Implemented section-heading navigation with Tab/Shift+Tab, Up/Down focus jumps, and Enter/Escape exits.
- Updated `/settings` input hints and fallback routing to tab-bar keys when section focus is unavailable.
- Added tests for section-focus navigation, mouse parsing, and tab-bar behavior coverage.
2026-06-12 03:27:50 +02:00
can1357 c35b41ed41 feat(coding-agent): added mouse-driven /settings overlay navigation across tabs and sections
- Added mouse hover, wheel, and click routing for `/settings` rows and tabs.
- Changed `/settings` to open as a fullscreen alternate-screen overlay.
- Added hover, hit-testing, and wheel APIs across TabBar, SelectList, and SettingsList.
- Added SGR mouse parsing plus `routeMouse` dispatch and exported it from the `tui` entrypoint.
2026-06-12 03:27:50 +02:00
can1357 6b1ca33bf7 refactor(snapcompact): dropped the snapcompact qualifier from every export
- Renamed all functions, types, and constants in @oh-my-pi/snapcompact to namespace-relative names (`snapcompactCompact` → `compact`, `renderSnapcompactFrames` → `renderMany`, `snapcompactFrameCount` → `frames`, `SnapcompactShape` → `Shape`, `SNAPCOMPACT_SHAPES` → `SHAPES`, …).
- Converted every consumer to `import * as snapcompact` member access: `agent/compaction.ts`, `coding-agent` `agent-session.ts`/`session-manager.ts`/`snapcompact-inline.ts`, and all affected tests.
- Renamed internal `geometry` locals to `geo` in `snapcompact.ts` to avoid TDZ collisions with the new `geometry` export.
- Updated `docs/compaction.md` prose and added a Breaking Changes entry to the snapcompact changelog documenting the full rename map.
2026-06-12 03:27:50 +02:00
can1357 a82d68ef49 feat(coding-agent): added experimental snapcompact inline imaging for system prompt and tool results
- Added `renderSnapcompactFrames()` and `snapcompactFrameCount()` to @oh-my-pi/snapcompact for paging arbitrary text into PNG image blocks without dim-marker bookkeeping.
- Widened the agent loop's `transformProviderContext` hook to `(context, model) => Context` so per-request transforms can gate on the dispatch model's capabilities.
- Added `SnapcompactInlineTransformer` rendering the system prompt and large historical tool results as snapcompact frames on vision models: vision gate, per-provider image budgets, 3k-token floor, savings-margin gate, skip-last rule, and hash-keyed render caches swept to live tool calls.
- Added default-off `snapcompact.systemPrompt` and `snapcompact.toolResults` settings under a new Context → Experimental group, composed after secret obfuscation in `sdk.ts` so frames are built per-request and never persisted to session.jsonl.
- Added prompt stubs (`snapcompact-system-stub.md`, `snapcompact-system-frames-note.md`, `snapcompact-toolresult-note.md`) and unit tests covering frame paging, no-mutate guarantees, budget caps, gates, and render caching.
2026-06-12 03:27:50 +02:00
Can BölükandGitHub 21b1854a9e Merge pull request #2311 from bjin/fix/local-memory-consolidation-instructions
fix(coding-agent): add local memory consolidation instructions
2026-06-12 03:27:26 +02:00
Can BölükandGitHub 92a4ab4ad4 Merge branch 'main' into fix/local-memory-consolidation-instructions 2026-06-12 03:26:50 +02:00
Can BölükandGitHub dba99e3eb7 Merge pull request #2339 from blingdivinity/fix/edit-block-resolver-shell-rc
fix(natives): resolve bash for extensionless shell rc files (zshrc/.bashrc)
2026-06-12 03:26:13 +02:00
Can BölükandGitHub d84b796c5f Merge pull request #2317 from can1357/farm/7d4f8a78/fix-minimax-gpt-oss-reasoning-effort-clamp
fix(catalog): clamp MiniMax M2 / GPT-OSS reasoning_effort on Fireworks
2026-06-12 02:58:50 +02:00
Can BölükandGitHub b2e859e691 Merge branch 'main' into farm/7d4f8a78/fix-minimax-gpt-oss-reasoning-effort-clamp 2026-06-12 02:45:25 +02:00