8000 [pull] main from can1357:main by pull[bot] · Pull Request #132 · ericrihm/oh-my-pi · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ab5c135
fix(prompt): template append provenance without rewriting input
andrebrait Sep 15, 2026
cdbd751
fix(coding-agent): cli ux gap fixes
Sep 28, 2026
85e52cd
fix(coding-agent): address review on cli ux gap fixes
Sep 28, 2026
90fe0b9
fix(coding-agent): defer non-TTY launch failure past extension flag r…
Sep 28, 2026
67694f6
fix(coding-agent): recheck non-TTY auto-print after extension flag re…
Sep 28, 2026
b989450
fix(coding-agent): report invalid --mode before the --no-ui guard
Sep 28, 2026
231fb4f
fix(coding-agent): reject invalid enum flags before serving ACP
Sep 28, 2026
cbe9bc2
feat: restructured web search and image generation model capabilities
can1357 Sep 28, 2026
bc36fba
fix(coding-agent): settle non-TTY prompt and ACP enum flags per exten…
Sep 28, 2026
79077c8
Merge remote-tracking branch 'origin/main' into fix/cli-ux-gaps
Sep 28, 2026
8c2cde6
fix(coding-agent): validate enum flags on --export; drop ACP launch-t…
Sep 28, 2026
f3b8f23
fix(stats): format dashboard numbers in en-US regardless of browser l…
NaC-L Sep 28, 2026
0b20c3a
docs(stats): credit #13640 in changelog
NaC-L Sep 28, 2026
30f0e68
Merge pull request #13623 from can1357/fix/cli-ux-gaps
H4vC Sep 28, 2026
327289f
test(stats): scope locale spy to the test; keep NUMBER_LOCALE module-…
Sep 28, 2026
8ce7e95
Merge PR #13640: fix(stats): format dashboard numbers in en-US regard…
H4vC Sep 28, 2026
a53706a
refactor(prompt): compile user-append wrapper once at module load
Sep 28, 2026
6dad5de
Merge PR #12147: fix(prompt): address append provenance review follow…
H4vC Sep 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ modelRoles:
memory: local/lfm2-1.2b

# Model-kind workloads
image: openai/gpt-image-1
image: openai/gpt-image-2
web: web/duckduckgo
speech: local/kokoro
dictation: local/parakeet-tdt-0.6b-v3
Expand Down
2 changes: 1 addition & 1 deletion docs/tools/generate_image.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The custom tool is registered only when `generate_image.enabled=true` (default `
- `content[0].type = "text"`
- `content[0].text` summarizes provider/model and saved image paths, with each image's reported size/quality when the provider returns them.
- `details = { provider, model, imageCount, imagePaths, images, responseText?, revisedPrompt?, promptFeedback?, usage? }`
- `model` is the image model the provider reports having run when it echoes one (hosted OpenAI transports), otherwise the selected catalog model id. When they differ, the text shows both, e.g. `Model: gpt-image-2-codex (catalog entry openai-codex/gpt-image-1)`. Each `images[]` entry may carry the provider-reported `size` and `quality`.
- `model` is the image model the provider reports having run when it echoes one (hosted OpenAI transports), otherwise the selected catalog model id. When they differ, the text shows both, e.g. `Model: gpt-image-2-codex (catalog entry openai-codex/gpt-image-2)`. Each `images[]` entry may carry the provider-reported `size` and `quality`.
- Model responses with no image data return `imageCount: 0`, empty `imagePaths` / `images`, and any provider text/feedback available.

## Flow
Expand Down
16 changes: 8 additions & 8 deletions docs/tools/web_search.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Each provider search transport receives a hard timeout from `providers.webSearch
2. `executeSearch()` builds the candidate pool with `roleCandidatePool("web", …)`: available models the `web` role accepts, i.e. `web/*` search-engine catalog models (kind `search`) and chat models that declare a `webSearch` grounding. It then orders candidates:
- if `params.model` is set (not in the model-facing schema; `omp q --model <selector>` sets it), that selector resolves to at most one candidate, marked explicit;
- otherwise `resolveRoleChain("web", …)` (`packages/coding-agent/src/config/model-resolver.ts`) yields the `web` role chain described under [Provider selection](#modes--variants).
3. Candidates are walked in order. A `search`-kind model loads its engine by catalog id through `getSearchProvider()`; a chat model loads its grounding backend (`gemini`, `anthropic`, `codex`, `openai`, `xai`, `openrouter`) through `getGroundedSearchProvider()`. Provider modules load only when a candidate reaches them. Explicit candidates are checked with `isExplicitlyAvailable()`, others with `isAvailable()`. An unavailable non-explicit candidate is skipped silently; an unavailable explicit candidate is recorded as a failure (`<Provider> web search is unavailable. Configure its credentials or select the automatic provider chain.`) and the walk continues.
3. Candidates are walked in order. A `search`-kind model loads its engine by catalog id through `getSearchProvider()`; a chat model loads its grounding backend (`gemini`, `anthropic`, `codex`, `openai`, `xai`, `openrouter`) through `getGroundedSearchProvider()`. Provider modules load only when a candidate reaches them. `web/hosted` is replaced by the session's active model when that model declares a `webSearch` grounding; otherwise it is skipped (automatic) or recorded as a failure (explicit). Explicit candidates are checked with `isExplicitlyAvailable()`, others with `isAvailable()`. An unavailable non-explicit candidate is skipped silently; an unavailable explicit candidate is recorded as a failure (`<Provider> web search is unavailable. Configure its credentials or select the automatic provider chain.`) and the walk continues.
4. If no candidate was available and none failed, `executeSearch()` returns `Error: No web search model configured.` (or `No web search model matches selector "<model>".` when `params.model` was given) with `details.response.provider = "none"`.
5. For each provider in order, `executeSearch()` calls `provider.search()` with:
- `query`,
Expand All @@ -110,14 +110,14 @@ Each provider search transport receives a hard timeout from `providers.webSearch
- Provider choice is the `web` model role. A candidate is a catalog model: `web/<engine>` for a search engine (for example `web/brave`, `web/duckduckgo`), or a chat model whose catalog entry declares a `webSearch` grounding (for example `anthropic/claude-haiku-4-5`, bundled `openai/gpt-6-luna`, or `openai/gpt-5.6-luna`), in which case that model runs the grounded search.
- **Primary**: `modelRoles.web`. If it is set, its first selector pattern that matches an available model becomes the first candidate and is explicit. If it is unset, the role resolves through the built-in `web` priority list.
- **Fallbacks**: `retry.fallbackChains.web`. If it is set (even as an empty list), exactly those selectors follow the primary and are explicit. If it is unset, every entry of the built-in `web` priority list that matches an available model follows as a non-explicit candidate. Duplicate models are dropped, and a model listed by any explicit selector stays explicit.
- **Explicit vs automatic**: explicit candidates use `isExplicitlyAvailable()`, so Perplexity, Exa, Firecrawl, and Public Web can run their unauthenticated/keyless paths when you select them. Automatic candidates use `isAvailable()` and are skipped when their credentials are missing.
- **Explicit vs automatic**: explicit candidates use `isExplicitlyAvailable()`, so Perplexity and Public Web can run their unauthenticated paths when you select them. Parallel, Exa, and Firecrawl run their keyless paths in either mode. Automatic candidates use `isAvailable()` and are skipped when their credentials are missing.
- **Per-request selector**: `SearchQueryParams.model` (`omp q --model web/duckduckgo "…"`) replaces the whole chain with that single explicit candidate.
- **Default chain** (the `web` list in `packages/coding-agent/src/priority.json`): `web/parallel`, `web/perplexity`, `google/gemini-2.5-flash`, `google-antigravity/gemini-2.5-flash`, `anthropic/claude-haiku-4-5`, `openai-codex/gpt-6-luna`, `openai-codex/gpt-5.6-luna`, `openai-codex/gpt-5.6`, `openai-codex/gpt-5.5`, `openai/gpt-6-luna`, `openai/gpt-5.6-luna`, `xai/grok-4.5`, `xai-oauth/grok-4.5`, `web/zai`, `web/exa`, `web/tinyfish`, `web/jina`, `web/kagi`, `web/tavily`, `web/firecrawl`, `web/brave`, `web/kimi`, `web/synthetic`, `web/ollama`, `web/searxng`, `web/startpage`, `web/duckduckgo`, `web/ecosia`, `web/google`, `web/mojeek`, `web/public`. Parallel uses authenticated search when configured and its credential-free MCP otherwise. The API-billed `openai/*` entries follow every Codex entry, so a Codex failure exhausts the ChatGPT-subscription fallbacks before any OpenAI API request is billed. `public` is explicit-only: its `isAvailable()` returns `false`, so the automatic chain never fans out to it.
- **Legacy settings**: on load, `packages/coding-agent/src/config/settings.ts` migrates `providers.webSearch`, `providers.webSearchOrder`, `providers.webSearchExclude`, and `providers.webSearchGeminiModel` into `modelRoles.web` plus `retry.fallbackChains.web`, then deletes the old keys. The migration never overwrites a role or chain that is already set. The migrated chain is the listed providers followed by the default chain, with the Gemini entries using the configured Gemini model and excluded providers removed.
- **Default chain** (the `web` list in `packages/coding-agent/src/priority.json`): `web/parallel`, `web/hosted`, `web/exa`, `web/firecrawl`, `web/searxng`, `web/startpage`, `web/duckduckgo`, `web/ecosia`, `web/google`, `web/mojeek`, `web/public`. Every entry is free: keyless engines, scrapers, a self-hosted SearXNG, and `web/hosted`, which searches through the session's own model and so bills only the credential already in use. Paid engines and other providers' chat models run only when configured in `modelRoles.web` or `retry.fallbackChains.web`. `public` is explicit-only: its `isAvailable()` returns `false`, so the automatic chain never fans out to it.
- **Legacy settings**: on load, `packages/coding-agent/src/config/settings.ts` migrates `providers.webSearch`, `providers.webSearchOrder`, `providers.webSearchExclude`, and `providers.webSearchGeminiModel` into `modelRoles.web` plus `retry.fallbackChains.web`, then deletes the old keys. The migration never overwrites a role or chain that is already set. The migrated chain is the listed providers followed by the default chain, with excluded providers removed; `providers.webSearchGeminiModel` only shapes a listed `gemini` entry.
- **Provider timeout**: `providers.webSearchTimeoutSeconds` supplies the hard ceiling for each provider's search transport before the automatic chain advances. It defaults to `60`; invalid non-positive values fall back to that default and values above `300` are capped, while provider-specific upstream or aggregate limits may still be shorter.
- **Provider adapters**
- **Perplexity** — `packages/coding-agent/src/web/search/providers/perplexity.ts`
- Availability: auth attempt order is `PERPLEXITY_COOKIES` -> OAuth token in `agent.db` -> direct Perplexity API key -> OpenRouter key -> anonymous ask-endpoint fallback. The automatic chain requires direct Perplexity auth (cookies, OAuth, or a Perplexity credential); explicit selection is always available and can use OpenRouter or anonymous search.
- Availability: auth attempt order is `PERPLEXITY_COOKIES` -> OAuth token in `agent.db` -> direct Perplexity API key -> anonymous ask-endpoint fallback. The automatic chain requires direct Perplexity auth (cookies, OAuth, or a Perplexity credential); explicit selection is always available and can fall back to anonymous search. OpenRouter keys are never borrowed; select `openrouter/perplexity/…` to search through OpenRouter.
- Browser SSO: run `/login perplexity` (or select Perplexity in the setup wizard), then press Enter or enter `sso`. Complete sign-in in the dedicated browser window, choosing **Single sign-on (SSO)** for your organization. omp captures and validates the session automatically; no extension, DevTools, cookie copying, or logout from your normal browser is needed.
- Browser login requires a graphical session on the machine running omp. It uses an isolated Chromium profile and incognito context, preserves sandbox and TLS checks, and closes the browser when login finishes, is cancelled, or reaches the five-minute timeout. Press Escape in omp to cancel. Profile cleanup uses the existing retry-and-warn behavior if the operating system keeps files locked.
- The saved session uses the existing Perplexity subscription, including an Enterprise seat; browser SSO does not switch to separately billed API credentials. Sign in again if Perplexity expires or revokes the session. Enter `email` to use the existing email-code and authenticator-code flow instead.
Expand Down Expand Up @@ -172,7 +172,7 @@ Each provider search transport receives a hard timeout from `providers.webSearch
- `limit` and `num_search_results` are collapsed together before dispatch.
- Output may include parsed free-text `answer`, `sources`, `requestId`.
- **Exa** — `packages/coding-agent/src/web/search/providers/exa.ts`
- Availability: `EXA_API_KEY` or a stored credential for `exa` (including one added through `/login exa`) admits Exa to the auto chain; settings must not explicitly disable `exa.enabled` or `exa.enableSearch`. Explicit selection (`web/exa` in `modelRoles.web` or a configured `retry.fallbackChains.web`, or `omp q --model web/exa`) reaches Exa even without a credential and falls back to public MCP.
- Availability: available unless settings disable `exa.enabled` or `exa.enableSearch`. `EXA_API_KEY` or a stored credential for `exa` (including one added through `/login exa`) selects the API; otherwise search falls back to the public MCP.
- Querying: POST `https://api.exa.ai/search` with the resolved Exa API key, otherwise JSON-RPC `tools/call` against `https://mcp.exa.ai/mcp` for remote MCP tool `web_search_exa`.
- `limit` and `num_search_results` are collapsed together before dispatch.
- Output: synthesized `answer` from up to 3 result summaries, `sources`, `requestId`.
Expand All @@ -198,7 +198,7 @@ Each provider search transport receives a hard timeout from `providers.webSearch
- `limit` / `num_search_results`: adapter uses `params.numSearchResults ?? params.limit`, clamped to `5..20` with default `5`.
- Output: `answer`, `sources`, `requestId`, `authMode: "api_key"`.
- **Firecrawl** — `packages/coding-agent/src/web/search/providers/firecrawl.ts`
- Availability: credentials admit it to the automatic chain; explicit selection is always available and uses keyless mode when no credential resolves.
- Availability: always available; uses keyless mode when no credential or self-hosted endpoint resolves.
- Querying: POST `https://api.firecrawl.dev/v2/search` with `sources: [{ type: "web" }]`. The endpoint is built by the shared resolver in `packages/coding-agent/src/web/firecrawl.ts`, which applies the `FIRECRAWL_BASE_URL` (alias `FIRECRAWL_API_URL`) self-hosting override. Google-style operators are formatted into the query; `recency` and parsed absolute dates map to `tbs`.
- `limit` / `num_search_results`: collapsed and clamped to `1..100`, default `10`; output `sources`, `requestId`, and `authMode: "api_key" | "keyless"`.
- The same module exposes Firecrawl `/scrape` as a `providers.fetch` reader backend for the fetch/read URL tool (requires `FIRECRAWL_API_KEY`). API reference: [docs.firecrawl.dev](https://docs.firecrawl.dev).
Expand Down Expand Up @@ -307,6 +307,6 @@ Each provider search transport receives a hard timeout from `providers.webSearch
- `executeSearch()` loads provider modules lazily as the chain reaches them. Provider instances are cached per id (`packages/coding-agent/src/web/search/provider.ts`), and asking for labels via `getSearchProviderLabel()` does not trigger imports.
- Most providers treat `limit` and `num_search_results` as the same number because adapters pass `params.numSearchResults ?? params.limit`. Perplexity preserves both concepts. TinyFish uses the collapsed value as a local cap, serializes `num_results` per page, and paginates when more results are needed. xAI uses it only to cap parsed sources/citations (`10` default, `30` max).
- `recency` has native or engine-query mappings in Brave, Perplexity, Tavily, SearXNG, Kagi, TinyFish, Firecrawl, DuckDuckGo, Startpage, Google, and Mojeek. xAI retains absolute date directives as natural-language query hints because its current Responses tool has no date parameters; Ecosia ignores recency. Public Web passes the request through to its engines.
- `SEARCH_PROVIDER_OPTIONS` in `packages/coding-agent/src/web/search/types.ts` lists `auto` plus every provider in the auto chain; the setup wizard (`packages/coding-agent/src/modes/setup.ts`) uses it to map a `web/<provider>` model in the `web` role to its search provider.
- `SEARCH_PROVIDER_LABELS` in `packages/tui/src/tools/web-search-types.ts` is the id→label registry for every search implementation (engines and groundings); provider ids, `SearchResponse`, and the transcript renderer all derive from it. Selection itself lives only in the `web` model role.
- The credential-free scrapers close the auto chain: Startpage and DuckDuckGo precede the browser-backed Ecosia, Google, and Mojeek paths; `public` is listed last and never auto-selected.
- `/login exa` stores the pasted key in AuthStorage; Exa resolves stored or environment credentials before the unauthenticated `https://mcp.exa.ai/mcp` fallback.
4 changes: 0 additions & 4 deletions packages/ai/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

## [Unreleased]

### Fixed

- Fixed DeepSeek `/responses` requests failing with `400 No tool output found` when a repaired orphan tool-result note landed between two outputs of the same tool round, and with `400 The reasoning_text in the thinking mode must be passed back` when replayed history lacked reasoning for an assistant turn ([#13083](https://github.com/can1357/oh-my-pi/issues/13083)).

## [18.4.2] - 2026-09-28

### Fixed
Expand Down
7 changes: 5 additions & 2 deletions packages/ai/src/images/openai-hosted.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Api, Model } from "@oh-my-pi/pi-catalog/types";
import { type Api, type Model, modelKind } from "@oh-my-pi/pi-catalog/types";
import {
applyCodexResidencyHeader,
CODEX_BASE_URL,
Expand Down Expand Up @@ -155,7 +155,10 @@ export async function generateHostedImage(
action: content.length > 1 ? "edit" : "generate",
output_format: "webp",
...(size ? { size } : {}),
...(model.api === "openai-responses" ? { model: model.requestModelId ?? model.id } : {}),
// A chat model generating on its own lets the host pick the image model.
...(model.api === "openai-responses" && modelKind(model) === "image"
? { model: model.requestModelId ?? model.id }
: {}),
};
const body = {
model: carrier.requestModelId ?? carrier.id,
Expand Down
8 changes: 8 additions & 0 deletions packages/catalog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

### Breaking Changes

- Renamed the Codex image model `openai-codex/gpt-image-1` to `openai-codex/gpt-image-2` to match what the Codex backend runs (`gpt-image-2-codex`); update `image` roles that name the old id.

### Added

- Added the `web-search-model`, `hosted-image`, and `image-model` catalog axes (`Model.webSearchModel`, `hostedImage`, `imageModel`). `web-search` now comes from the model's lineage and API (GPT-5+ Responses, Claude 4+ Messages, Gemini 2+), so proxies and gateways that expose these models inherit it.

## [18.4.2] - 2026-09-28

### Changed
Expand Down
3 changes: 3 additions & 0 deletions packages/catalog/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ function applyCatalogAssignments<TApi extends Api>(model: Model<TApi>, catalog:
) {
model.webSearch = webSearch;
}
if (typeof catalog.webSearchModel === "string") model.webSearchModel = catalog.webSearchModel;
if (catalog.hostedImage === true) model.hostedImage = true;
if (typeof catalog.imageModel === "string") model.imageModel = catalog.imageModel;
const serviceTierCost = objectPayload(catalog.serviceTierCost);
if (serviceTierCost !== undefined) {
const flex = numberField(serviceTierCost, "flex");
Expand Down
3 changes: 3 additions & 0 deletions packages/catalog/src/compat/axes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
shape: "scalar",
values: ["gemini", "anthropic", "codex", "xai", "openrouter", "openai"],
},
"web-search-model": { key: "webSearchModel", set: "catalog", shape: "scalar" },
"hosted-image": { key: "hostedImage", set: "catalog", shape: "scalar", values: [true, false] },
"image-model": { key: "imageModel", set: "catalog", shape: "scalar" },
"limits-patch": { key: "limitsPatch", set: "catalog", shape: "object" },
"long-context-cost": { key: "longContext", set: "catalog", shape: "object" },
"prompt-cache": { key: "promptCache", set: "catalog", shape: "object" },
Expand Down
13 changes: 11 additions & 2 deletions packages/catalog/src/compat/collapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,17 @@ function retargetCollapsedModelReferences<TSpec extends VariantSpecLike>(specs:
liveIdsByProvider,
);
const compactionModel = resolveCollapsedModelReference(spec.compactionModel, spec.provider, liveIdsByProvider);
if (contextPromotionTarget === spec.contextPromotionTarget && compactionModel === spec.compactionModel) continue;
specs[index] = { ...spec, contextPromotionTarget, compactionModel };
const webSearchModel = resolveCollapsedModelReference(spec.webSearchModel, spec.provider, liveIdsByProvider);
const imageModel = resolveCollapsedModelReference(spec.imageModel, spec.provider, liveIdsByProvider);
if (
contextPromotionTarget === spec.contextPromotionTarget &&
compactionModel === spec.compactionModel &&
webSearchModel === spec.webSearchModel &&
imageModel === spec.imageModel
) {
continue;
}
specs[index] = { ...spec, contextPromotionTarget, compactionModel, webSearchModel, imageModel };
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/catalog/src/compat/rules.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions packages/catalog/src/compat/rules/classes/anthropic.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,13 @@ class "anthropic" {
antigravity-usage-label "true"
}
}

// Claude 4+ ships the server-side `web_search` tool on any Messages-compatible host.
class "anthropic" {
on-api "anthropic-messages" {
revision ">=4" {
web-search "anthropic"
web-search-model "claude-haiku-4-5"
}
}
}
11 changes: 11 additions & 0 deletions packages/catalog/src/compat/rules/classes/gemini.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,14 @@ class "gemini" {

thinking-loop-guard "gemini"
}

// Google Search grounding is a Gemini 2+ lineage capability on every Gemini transport.
class "gemini" {
on-api "google-generative-ai" "google-gemini-cli" {
revision ">=2" {
web-search "gemini"
web-search-model "gemini-2.5-flash"
image-model "gemini-3-pro-image"
}
}
}
Loading
Loading
0