Commit Graph

8384 Commits

Author SHA1 Message Date
can1357 8fa1f6c250 feat: added shared collab wire protocol and web guest collaboration client
- Added @oh-my-pi/pi-wire and reworked collab protocol types into shared contracts.
- Added wire-compatibility guards in coding-agent host to block unsupported events.
- Added standalone collab-web package with guest UI, mock-host tooling, and local relay.
- Added secure room-link validation, WebCrypto framing, and safer socket routing.
2026-06-12 11:54:41 +02:00
can1357 ed5eb70dda fix(catalog): redirected Gemini 3.1 Pro high-effort traffic to gemini-pro-agent
- Updated the Gemini 3.1 Pro variant collapse so high effort now routes to `gemini-pro-agent` instead of `gemini-3.1-pro-high`.
- Kept `gemini-3.1-pro-high` in the collapse members list so the raw discovery ID remains handled.
- Lowered `contextWindow` from `163840` to `131072` tokens in `models.json`.
2026-06-12 11:50:21 +02:00
can1357 ae84502b82 fix(coding-agent): bypass LSP for individual conflict resolution
Individual conflict resolution now bypasses the LSP writethrough to prevent formatting from corrupting other unresolved marker blocks and to avoid noisy diagnostics in partially resolved files.
2026-06-12 11:29:38 +02:00
can1357 612fa22900 chore(coding-agent): removed unused getRoleInfo import in input-controller
- Dropped the dead `getRoleInfo` import from `input-controller.ts` that was failing `biome check` on main.
2026-06-12 11:24:49 +02:00
can1357 d214e2f022 Merge branch 'pr-2182'
# Conflicts:
#	packages/coding-agent/package.json
#	packages/coding-agent/src/config/model-registry.ts
#	packages/coding-agent/src/main.ts
#	packages/coding-agent/src/modes/components/assistant-message.ts
#	packages/coding-agent/src/sdk.ts
#	packages/tui/src/components/markdown.ts
2026-06-12 11:24:26 +02:00
can1357 12bada4ce0 fix: hardened deferred MCP discovery and streaming render fast paths
- Recomputed `tools.discoveryMode: "auto"` in the deferred MCP closure in `sdk.ts` once the real tool count is known: a toolset crossing the threshold now flips discovery on, registers and activates `search_tool_bm25`, and skips `activateAll` instead of force-activating every MCP tool.
- Guarded the deferred MCP task against disposed sessions: added `AgentSession.isDisposed` and `enableMCPDiscovery()`, and the late connect now calls `disconnectAll()` instead of refreshing tools onto a dead session.
- Cleared `#fastPathKey`/`#fastPathItems` in `AssistantMessageComponent.invalidate()` so theme/symbol changes rebuild reused Markdown children instead of keeping stale captured themes.
- Memoized unusable read summaries as a `false` sentinel in `read.ts` so the per-session LRU no longer retains full sources of unsummarizable files.
- Broadened `HAS_REF_DEF` in `markdown.ts` to match backslash-escaped reference labels (`[a\]b]: x`) and cleared frozen stream-lex state on blank `setText()`.
- Added regression tests: deferred auto-discovery flip and mid-connect dispose (`sdk-mcp-auto-discovery.test.ts` + `many-tools-mcp.ts` fixture), fast-path child rebuild on invalidate, and escaped-ref-def incremental-lex equivalence.
2026-06-12 11:14:39 +02:00
can1357 d9cc9960a0 Merge remote-tracking branch 'origin/farm/4c1bfb4b/fix-remote-image-attachment' 2026-06-12 11:14:09 +02:00
can1357 7119153077 fix(ai): removed Codex SSE stateful chaining and enforced turn-scoped state
- Removed stateful SSE chain controls from Codex provider options.
- Changed SSE transport to send full request bodies without `previous_response_id` deltas.
- Updated stale-chain recovery to treat `unsupported` as stale and recover via websocket.
- Scoped `x-codex-turn-state` to in-turn follow-ups and cleared turn state otherwise.
2026-06-12 11:12:27 +02:00
can1357 34ea78e01c Merge remote-tracking branch 'origin/farm/4c1bfb4b/fix-remote-image-attachment' 2026-06-12 11:08:48 +02:00
can1357 e28ae2fd88 fix(ai): hoisted images out of error Anthropic tool results
- Adjusted Anthropic tool-result conversion to keep error results text-only while collecting any image blocks separately.
- Reattached collected images after the tool-result run in the same user message with a separator note for Anthropic compatibility.
- Added tests covering image-only error tool_results, image hoisting order, and successful tool_result image preservation.
2026-06-12 11:07:35 +02:00
roboomp 78171daffa style: bun run fix 2026-06-12 09:05:16 +00:00
roboomp 8babcdcbd2 fix(coding-agent): sanitized pasted image path before splicing into TUI status
Reviewer flagged that the bracketed-paste path is untrusted terminal input —
ANSI escapes, control chars, newlines/tabs, or a multi-hundred-char path
would corrupt the status line (per AGENTS.md TUI sanitization rules) and
leak the absolute home-dir path.

The new ENOENT diagnostic now feeds the path through sanitizeText (strip
ANSI/C0/C1 controls), collapses CR/LF/TAB to single spaces, runs it
through shortenPath (collapse home → '~'), and truncateToWidth-clamps it
to TRUNCATE_LENGTHS.CONTENT (80) before interpolating into either the SSH
or local status string. Added a third assertion to the repro test
defending the contract: ANSI/control bytes never reach the status, and
the displayed path is bounded below the input length.

Refs PR #2376
2026-06-12 09:05:07 +00:00
can1357 6da5ded361 fix(coding-agent): excluded error tool results from inline image swapping
- Added optional `isError` markers on inline tool-result and message models.
- Skipped error-marked tool results during swap planning, savings estimation, and live transformations.
- Added tests confirming large error tool results stay text-only and are not considered for inline swaps.
2026-06-12 11:03:03 +02:00
roboomp 8359fb5822 fix(coding-agent): surfaced unreachable image-path pastes over SSH instead of silently inserting the local path
When a local terminal forwards a bracketed-paste containing an image-file
path and the omp process is itself running on the remote end of an SSH
session, the path is on the user's local machine and unreachable from the
remote filesystem. The path-as-text fallback in handleImagePathPaste then
made it look like the image was attached when in fact only a useless
absolute path entered the editor and the bytes never crossed.

Distinguish ENOENT from other read failures: drop the misleading
path-as-text degrade, and surface a clear status that names the file and
— when SSH_CONNECTION/SSH_TTY/SSH_CLIENT indicate the remote end of an
SSH session — points the user at the clipboard image-paste shortcut so
the bytes actually cross. The ImageInputTooLargeError and unknown-error
branches keep their existing fallback so genuine type issues still
yield the user's input back to them.

Fixes #2375
2026-06-12 08:56:38 +00:00
can1357 3e90371f5c feat(coding-agent): added collaborative sessions with host and guest command support
- Added AES-GCM room-key crypto, relay link parsing, and invalid-link validation.
- Added `/collab`, `/join`, and `/leave` command handling for collaborative sessions.
- Added startup `join` argument wiring to execute `/join` during interactive launch.
- Added status-line, prompt, and command-routing updates for guest/host collaboration UX.
2026-06-12 10:54:28 +02:00
can1357 9f79c5e353 feat(coding-agent): Color segment track segments by position on HSV hue band
Dynamically assigns segment colors by sweeping across the full HSV hue spectrum based on their track position. This ensures each segment has a distinct, predictable hue and removes the need for explicit `color` assignments.
2026-06-12 10:37:21 +02:00
can1357 12290e080d test: Update issue #2372 repro test to use rebuildChatFromMessages 2026-06-12 10:05:38 +02:00
can1357 10d577e301 chore: bump version to 15.11.7 2026-06-12 10:02:58 +02:00
can1357 88e80f6fce Merge remote-tracking branch 'origin/farm/4520f36e/fix-toggle-thinking-clears-optimistic-message' 2026-06-12 10:02:22 +02:00
can1357 1ceae07764 fix(coding-agent): prevented non-node Windows cmd shims from being launched as node
- Updated the Windows npm shim resolver to resolve shim files against `cwd` and inspect `_prog` before treating a batch wrapper as a node launcher.
- Added a node-only guard so non-node wrappers, such as python shims, fall back to standard cmd.exe execution.
- Adjusted mcp stdio tests with a new non-node shim fixture and a simplified notify race case to validate transport teardown behavior.
2026-06-12 10:01:55 +02:00
roboomp 3a45b6e69b fix(tui): replay optimistic user message on chat rebuild
Pressing Ctrl+T (toggle thinking-block visibility) — or any other path that calls rebuildChatFromMessages, e.g. the theme/preset selector — during the pre-streaming window after a submission cleared the just-submitted user message until the first assistant token arrived.

startPendingSubmission paints the user message optimistically before session.prompt(...) lands it in session entries; rebuildChatFromMessages reads buildTranscriptSessionContext() which has no record of it yet, so the rebuild erased it and the streaming-component re-add block in toggleThinkingBlockVisibility was a no-op (no stream yet).

Centralize the fix in rebuildChatFromMessages: after rendering the transcript, replay the in-flight optimistic user submission. EventController#handleMessageStart already clears optimisticUserMessageSignature once the real user message_start lands, so the replay is a no-op post-streaming and cannot duplicate. cancelPendingSubmission clears the signature and marks the submission cancelled before its own rebuild, so cancellation paths still wipe the message.

Fixes #2372
2026-06-12 07:49:05 +00:00
can1357 21be63e97d docs: Add READMEs and include documentation in published packages 2026-06-12 09:47:04 +02:00
can1357 d1dcbdc879 Merge remote-tracking branch 'origin/farm/fa33fc2a/fix-kimi-first-event-timeout' 2026-06-12 09:40:22 +02:00
can1357 03bb6c823a Merge remote-tracking branch 'origin/farm/03069f2c/windows-codegraph-mcp' 2026-06-12 09:40:19 +02:00
can1357 bbfff979c4 Merge remote-tracking branch 'origin/farm/d4bfb254/ctrl-t-thinking-toggle' 2026-06-12 09:40:16 +02:00
can1357 7eca774cc7 feat(coding-agent): added mouse support to setup wizard scenes and controls
- Added SGR mouse routing to wizard scenes for hover, click, and wheel interactions.
- Added pointer-based tab selection and panel wheel scrolling in providers tabs.
- Added splash/outro left-click handling to start and complete the wizard flow.
- Added setup-wizard tests for mouse routing, splash click entry, and local coordinates.
2026-06-12 09:39:48 +02:00
can1357 3fc086eca8 perf: narrowed indexed PNG palettes and selected frame-specific bit depth
- Used per-frame palette usage statistics to remap global indices into a compact local palette before PNG encoding.
- Encoded indexed outputs with dynamic 1-, 2-, and 4-bit depths based on used color count.
- Raised PNG compression from Balanced to High for indexed and RGB paths and updated parity and decode tests for variable-bit palette decoding.
2026-06-12 09:36:46 +02:00
roboomp 9bec08a952 fix(tui): preserved pending message on thinking toggle
Updated thinking visibility toggles to refresh assistant blocks in place instead of rebuilding the transcript, preserving pending user submissions and loaders before streaming starts. Added a regression test for the Ctrl+T pre-stream gap.\n\nFixes #2370
2026-06-12 07:30:54 +00:00
roboomp 4938f47254 fix(mcp): preserved cwd precedence for unqualified .cmd commands
Restored cmd.exe's lookup order on Windows so an unqualified MCP command (e.g. server.cmd) checks the configured cwd before iterating PATH, keeping a project-local shim from being shadowed by a same-named global one.
2026-06-12 07:28:13 +00:00
can1357 b845ef6362 feat(snapcompact): implemented model-aware compaction billing and frame-size resolution
- Implemented model-specific frame-size billing for Anthropic, OpenAI, and Google.
- Changed compaction shape resolution to bind model variants to ideal frame sizes.
- Updated tests and docs to reflect new frame-size and budget behavior.
2026-06-12 09:27:03 +02:00
roboomp aa862b8b32 fix(mcp): launched npm cmd shims directly
Resolved Windows npm-generated .cmd MCP shims to their Node entrypoint before spawning so CodeGraph keeps ownership of stdio instead of disconnecting behind a transient cmd.exe wrapper.

Fixes #2367
2026-06-12 07:22:10 +00:00
roboomp bc8d3a5bc7 fix(catalog): widened kimi k2.6 stream watchdog
Widened Kimi K2.6 OpenAI-compatible stream watchdog defaults so long reasoning starts do not hit the generic first-event timeout. Covered Fire Pass public and router ids with a regression test.\n\nFixes #2366
2026-06-12 07:17:03 +00:00
can1357 a9229b0f26 feat(snapcompact): clipped snapcompact PNG frame height to rendered text rows
- Adjusted snapcompact rendering to compute used rows from text, dim toggles, and doc line breaks, then derive output height from usedRows x lineRepeat x cellHeight.
- Updated indexed and RGB PNG encoders to accept explicit canvas width and height so native renders now emit non-square frames matching actual content.
- Expanded Rust and TypeScript tests and updated docs/changelogs to assert and describe variable-height frame behavior.
2026-06-12 09:11:41 +02:00
can1357 df49125296 Merge remote-tracking branch 'origin/farm/116277d9/hindsight-local-timestamps' 2026-06-12 09:00:18 +02:00
can1357 49af8b56d5 feat(packages/coding-agent): enabled model-tuned snapcompact budget limits
- Updated snapcompact selectors and previews to pass `ShapeTarget` into `resolveShape` so `auto` is model-tuned.
- Applied `providerFrameBudget` in session compaction so generated archives stay within provider image caps.
- Replaced inline hard-coded image limits with `providerImageBudget` and skipped rasterization at cap.
- Added OpenRouter inline-transformer tests for cap exhaustion and existing-image budget exhaustion behavior.
2026-06-12 09:00:05 +02:00
can1357 dbb34dfa72 feat(packages/snapcompact): added mono_prod CLI snapcompact probe modes
- Added chunked and cached Kimi mono-prod probing with hit/miss diagnostics.
- Added parse_robust fallback and cache re-score path for numbered QA answer parsing.
- Added multi-route probe execution modes including smoke, bill, frame, AB, and last-line checks.
- Changed mono_prod CLI to support custom shape JSON/name and pricing overrides.
2026-06-12 09:00:05 +02:00
can1357 8eeab0a877 feat(packages/snapcompact): added model-aware shape + text-tail budgets
- Added support for `{api,id}` `ShapeTarget` in `resolveShape`, deriving variants from model IDs.
- Added provider budget APIs/constants and `providerFrameBudget` clamping with `MAX_FRAMES`.
- Added `Archive.textTail` and moved overflow pages into plain-text tail folding across frames.
- Updated summary prompt rendering to show continuation only when `textTail` exists and append it as text.
2026-06-12 09:00:04 +02:00
roboomp b94ab98005 fix(hindsight): preserved local retain timestamps
Sent Hindsight retain timestamps with local timezone offsets and supplied timestamps for automatic and queued retains. Added regression coverage for client serialization and backend timestamp propagation.\n\nFixes #2363
2026-06-12 06:54:30 +00:00
can1357 1308f654a0 feat(ai): ensure Anthropic requests use correct thinking model ID
- Previously, `anthropic-messages` requests using `resolveWireModelId` would always derive the non-thinking variant for `requestModelId`, even when reasoning was explicitly enabled.
- This change ensures the `reasoning` state is correctly passed to `resolveWireModelId`, allowing the API request to include the appropriate `X-thinking` model variant when thinking is active, standardizing behavior across providers.
2026-06-12 08:27:41 +02:00
can1357 870d2b8981 feat(snapcompact): switched the Anthropic default shape from 8x8r-bw to 6x12-dim
- Repointed `SHAPES.anthropic` and the `anthropic-messages`/unknown-API fallback in `resolveShape` at the `6x12-dim` variant: production mono eval on claude-fable scored f1 .840 vs .877 for the repeated grid (within noise at n=25) at 37% lower cost, with no refusals.
- Reworded the `snapcompact.shape` descriptions in `settings-schema.ts` to drop per-provider eval-winner claims from the variant help text.
- Updated `snapcompact.test.ts` (new `6x12-dim` default render/compact assertions, `8x8r-bw` exercised via `resolveShape`), `snapcompact-inline.test.ts` frame math for the new geometry, and the `docs/compaction.md` shape sentence.
- Amended the snapcompact `[Unreleased]` entry that said the Anthropic default stayed `8x8r-bw` and added the default-switch entry.
2026-06-12 08:21:48 +02:00
can1357 ce112bf9ff fix(coding-agent): fixed omp bench cached OpenRouter replays and Codex instruction 400s
- Sent `X-OpenRouter-Cache: false` on bench requests in `bench-cli.ts`: pi-ai opts every OpenRouter request into 1h response caching, so repeated byte-identical runs replayed a cached generation with zeroed usage as "tokens 0, TPS 0.0" successes.
- Added a minimal default `systemPrompt` to bench's request context, matching eval's completion-bridge guard against Codex's HTTP 400 `{"detail":"Instructions are required"}`.
- Checked in `src/prompts/bench.md`, the default bench prompt `bench-cli.ts` already imports (left untracked by 300c1ada30).
- Added both bench changelog entries.
2026-06-12 08:21:25 +02:00
can1357 e5f8f7ed67 feat(ai): clamped omitted and disabled reasoning on requiresEffort models
- Added `normalizeMandatoryReasoningOptions` to `stream.ts`: models baked with `thinking.requiresEffort` floor omitted or disabled reasoning to `minimumSupportedEffort` instead of sending an explicit disable, fixing "Reasoning is mandatory for this endpoint and cannot be disabled" 400s on OpenRouter Gemini 3.x.
- Skipped the clamp for `suppressWhenOff` models, which handle off provider-side via an explicit wire config.
- Added `requires-effort.test.ts` covering omitted-reasoning clamping, `disableReasoning` suppression, untouched explicit efforts, flag-free pair routing, and flagged collapsed pairs.
- Added the pi-ai changelog entry.
2026-06-12 08:21:06 +02:00
can1357 17c4edda0d feat(ai): routed openai-completions and anthropic wire ids through resolveWireModelId
- Added a `requestModelId` option to `AnthropicOptions`, serialized as `requestModelId ?? model.requestModelId ?? model.id` in `buildParams`.
- Replaced `resolveOpenAICompletionsModelId`'s pinned-id short-circuit with `resolveWireModelId`-based resolution ahead of the provider-specific id transforms.
- Passed `requestModelId: resolveWireModelId(model, reasoning)` from every `mapOptionsForApi` case in `stream.ts`, so collapsed `X`/`X-thinking` pairs on aggregators and custom providers switch to the thinking SKU when reasoning is enabled.
- Added the pi-ai changelog entry.
2026-06-12 08:20:48 +02:00
can1357 176157055b feat(catalog): added thinking.requiresEffort baking for mandatory-reasoning upstreams
- Added `thinking.requiresEffort` to `ThinkingConfig` and baked it in `deriveThinking`/`fillThinkingWireDefaults` via `impliesMandatoryReasoning` for reasoning-only upstreams: Gemini 3.x, Gemini 2.5 Pro, the OpenAI o-series, MiniMax M2, and thinking-only `-reasoner`/`-reasoning` SKUs.
- Added `minimumSupportedEffort()` to `model-thinking.ts` as the clamp target for thinking-off requests on flagged models.
- Moved `stripThinkingVariantToken`/`findThinkingVariantToken` into `identity/family.ts`, taught them the `-reasoning`/`-reasoner` spellings, and re-pointed the `variant-collapse` and coding-agent `model-resolver` imports.
- Dropped `requiresEffort` (with `effortRouting`/`suppressWhenOff`) from collapsed-pair thinking surfaces in `derivePairThinkingSurface`, since the collapsed pair routes off to the bare backing id.
- Regenerated `models.json` and covered derivation, backfill, and reasoning-token pairing in `model-thinking.test.ts` and `variant-collapse.test.ts`.
2026-06-12 08:20:27 +02:00
can1357 300c1ada30 feat(coding-agent): added bench command and updated default compaction shapes
- Added a new `bench` CLI command with multi-model selectors and new options.
- Implemented `runBenchCommand` validation, per-run session handling, and failure exit reporting.
- Updated default compaction shapes to `8x8r-bw` and `doc-8on16-sent-dim` in code and schema.
- Documented `bench` flags, per-run errors, failure counts, and exit behavior.
2026-06-12 08:00:03 +02:00
can1357 a094b794bc fix: updated OpenAI defaults and corrected catalog grouping behavior
- Resolved OpenAI shape resolution to `openai` and default to `8on16-bw`.
- Fixed catalog generation to collapse effort tiers before provider grouping.
- Updated help text and schemas to describe `8on16-bw` as the OpenAI auto default.
- Added production `render_pages` and `mono_prod` scripts for end-to-end QA output.
2026-06-12 07:49:23 +02:00
can1357 509192d24a feat(coding-agent): added eval-winner variants to the snapcompact.shape setting
- Added the `6x12-dim`, `8x13-bw`, `8on16-bw`, `doc-8on16-bw`, `doc-8on16-sent`, and `doc-8on16-sent-dim` options to the `snapcompact.shape` enum in `settings-schema.ts` with per-variant descriptions naming each eval winner.
- Updated the `snapcompact.shape` paragraph in `docs/compaction.md` to list the new grid and two-column doc variants.
- Updated the coding-agent changelog: rewrote the `snapcompact.shape` Added entry for the new variants and recorded the Changed/Fixed entries for the already-landed variant-alias and pending-preview commits (one contiguous changelog run).
2026-06-12 07:38:00 +02:00
can1357 afa3439485 fix(coding-agent): classified provisional pending tool previews per renderer
- Added `ToolRenderer.provisionalPendingPreview` in `renderers.ts` and consulted it from `ToolExecutionComponent.isTranscriptBlockCommitStable`, replacing the 15.11.6 blanket gate that marked every collapsed pending preview commit-unstable.
- Marked only the tail-window previews the result render re-anchors as provisional: the edit streamed-diff tail (`edit/renderer.ts`), bash/ssh command caps (`createShellRenderer`, `sshToolRenderer`), and eval cells with interleaved outputs (`evalToolRenderer`).
- Restored mid-stream scrollback commits for every other pending preview, so tool calls taller than the viewport (e.g. a task call's context/assignment markdown) no longer read as cut off until the result lands.
- Added a regression test in `tool-live-region-scrollback.test.ts` scroll-appending a tall collapsed streaming task call into native scrollback mid-stream.
2026-06-12 07:37:53 +02:00
can1357 89059951ee chore(catalog): regenerated models.json
- Regenerated the bundled catalog via `generate-models` to pick up effort-tier variant collapsing (raw `-low`/`-high`/`-thinking` member ids folded into logical entries with `thinking.effortRouting`) and display-name cleaning (gateway author prefixes and alias/price/promo decorations dropped).
2026-06-12 07:37:44 +02:00
can1357 f30ec6e089 feat(catalog): stripped gateway prefixes and promo tags from model display names
- Added `cleanModelName` to `utils.ts`, dropping gateway author prefixes (`OpenAI: …`), `(latest)` alias markers, `(Antigravity)` attribution, price tiers (`($$$$)`), and promo/lifecycle tags (`(20% off)`, `(retires …)`) while preserving variant tags that map to distinct wire ids (`(Thinking)`, `(free)`, `(Fast)`, dates, regions).
- Applied it in `buildModel` (covers live discovery and stale caches) and as a display-name normalization pass in `generate-models.ts`; Antigravity discovery no longer appends `(Antigravity)` to display names.
- Added name-cleaning coverage to `build.test.ts`.
- Changelog entry for this change landed with the variant-collapse commit (same contiguous `CHANGELOG.md` run).
2026-06-12 07:37:38 +02:00