Commit Graph

17 Commits

Author SHA1 Message Date
roboomp 714051d795 fix(catalog,coding-agent): disable vision on non-personal copilot endpoints
GitHub Copilot's /models response advertises supports.vision = true for
Claude/GPT chat models on every host, but only the canonical personal
endpoint (https://api.githubcopilot.com) actually accepts image inputs;
the business (api.business.githubcopilot.com) and enterprise
(copilot-api.{domain}) hosts respond '400 vision is not supported'.
snapcompact then injected rasterized transcript frames after compaction
and permanently broke every business-Copilot session.

- Catalog discovery (githubCopilotModelManagerOptions.mapModel) now
  forces input=['text'] whenever the resolved baseUrl is not the
  canonical personal-Copilot host, so the upstream's vision flag is
  honoured only where it actually works.
- mergeDynamicModel honours the dynamic input value (instead of
  OR-upgrading with the bundled reference) when the merged baseUrl
  differs from the bundled one, so a bundled spec pinned to the
  personal host can no longer taint a business-resolved merge.
- snapcompact-inline's canSendImages helper short-circuits the
  rasterizer for any github-copilot model whose baseUrl is non-personal,
  catching stale cached specs that still advertise vision.
- Helper isPersonalGitHubCopilotBaseUrl exported from
  pi-catalog/wire/github-copilot so catalog and coding-agent share one
  canonical check.

Regression coverage in github-copilot-model-limits.test.ts (vision
endpoint policy + full merge) and snapcompact-inline.test.ts (#3387
business/enterprise case).

Fixes #3387
2026-06-24 16:27:14 +00:00
can1357 29f7b57fde feat: migrated core rendering and context transformation to async
- Updated `render`, `renderMany`, and native snapcompact methods to return promises, ensuring scalable async execution.
- Refactored `transformProviderContext` and `buildSideRequestContext` to support asynchronous operations in agent loops.
- Integrated `Promise.all` for improved concurrency when processing frame rendering and rendering batch operations.
- Updated all internal call sites, SDK hooks, and test suites to accommodate the asynchronous API signatures.
2026-06-21 00:32:13 +02:00
can1357 ed1c977bbb tests: remove stale openrouter tests 2026-06-19 08:11:40 +02:00
can1357 31aa25da11 feat(coding-agent): updated the primaryArg selection logic to check
- Updated the `primaryArg` selection logic to check for the `advise` tool explicitly.
- Preformatted the summary format for advice as `{severity}: {note}` when both are present, falling back to either if only one exists.
- Updated and verified the associated test suite to confirm the output structure.
2026-06-18 02:07:25 +02:00
can1357 4c36a48eb7 refactor(coding-agent): extended primary argument keys list and add type annotation
- Added "note" to the list of primary argument keys for formatting session history.
- Added an explicit type annotation to the inline savings unit test options.
2026-06-18 02:06:38 +02:00
can1357 8749241c11 test(coding-agent): isolated inline geometry tests using a custom shape
- Switched tests to evaluate geometry bounds using a dedicated high-capacity `6x12-dim` test shape.
- Isolated test assertions from dependency on default snapcompact shapes.
- Introduced `withTestShape` utility to apply test dimensions uniformly across test suites.
2026-06-18 01:57:23 +02:00
can1357 233ee852cd feat(snapcompact): added spacing-tuned snapcompact variants and updated provider defaults
- Added 8on22-bw and 11on16-bw variants with spacing-tuned defaults for snapcompact.
- Changed provider defaults/mappings to use 11on16-bw for Anthropic and 8on22-bw for OpenAI/Google.
- Updated model frame rules so claude/fable/opus and gemini/gpt families map to new shapes and 2048 billing behavior.
- Fixed non-multiplexer resize dragging by using alternate screen during transient resize frames.
2026-06-14 07:02:27 +02:00
can1357 d63b1530f8 feat(coding-agent): added snapcompact savings journaling for imaged tool results
- Added a `snapcompact-savings.jsonl` append-only journal for per-tool savings records.
- Extended `SnapcompactInlineTransformer` to compute `savedTokens` and emit savings to an optional sink.
- Integrated `createSnapcompactSavingsRecorder` into `createAgentSession` for session-aware tool-result metrics.
- Skipped journaling entries without a session and deduped duplicate `toolCallId`s per recorder lifecycle.
- Added tests for savings-sink emissions and savings-journal read/write behavior.
2026-06-14 04:28:43 +02: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
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
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 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 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 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 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