codex-copilot-dx 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/docs/ARCHITECTURE.md +7 -1
- package/docs/REFERENCE.md +13 -4
- package/package.json +1 -1
- package/src/access-settings.mjs +2 -1
- package/src/adapter.mjs +4 -0
- package/src/antigravity-chat-bridge.mjs +2 -2
- package/src/antigravity-handler.mjs +26 -11
- package/src/antigravity-models.mjs +19 -10
- package/src/antigravity-runtime.mjs +7 -3
- package/src/claude-gateway.mjs +6 -2
- package/src/cli-command-spec.mjs +2 -2
- package/src/cli-management.mjs +14 -6
- package/src/client-effort.mjs +28 -0
- package/src/client-model-plan.mjs +2 -1
- package/src/connection-policy.mjs +6 -0
- package/src/connection-routing.mjs +1 -0
- package/src/connection-view.mjs +3 -0
- package/src/dashboard/connections.js +19 -4
- package/src/dashboard/gemini.js +3 -3
- package/src/dashboard/index.html +1 -0
- package/src/dashboard/language.js +4 -0
- package/src/http-transport.mjs +1 -1
- package/src/model-capabilities.mjs +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Use your model services in **Codex App, Claude App and Claude Code** through one local gateway.
|
|
4
4
|
|
|
5
|
-
On macOS, the optional Gemini integration adds Copilot
|
|
5
|
+
On macOS, the optional Gemini integration adds compatible Copilot Gemini models to the original App's Antigravity. Ordinary Gemini chat keeps Google. The Antigravity page lists each model once, with its advertised reasoning levels shown in the same format as Codex and Claude. Refresh the catalog there or with `ccdx app antigravity models --refresh`. Existing clients keep their setup.
|
|
6
6
|
|
|
7
7
|
Connect GitHub Copilot, Microsoft 365 or your own API. Choose which apps can use each source, then select their models. CI and prebuilt releases cover **macOS on Apple Silicon** and **Windows on x64/ARM64**. Intel Mac code remains available, without CI coverage or new prebuilt assets.
|
|
8
8
|
|
|
9
|
+
Claude App keeps its native reasoning menu when it can represent the source's levels exactly. Otherwise, choose a declared fallback level in CCDX. It applies only when the App omits a level; model names and existing client choices stay unchanged.
|
|
10
|
+
|
|
9
11
|
Optional local masking is off by default. Enable it in Settings → Local masking to download the model and component. Checks run locally and may add delay or mistake ordinary text; an unfinished check holds the request back. See [local masking](docs/REFERENCE.md#local-masking).
|
|
10
12
|
|
|
11
13
|
## Install and start
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -34,13 +34,15 @@ or `/antigravity/` routes. Existing inference routes return before that dispatch
|
|
|
34
34
|
|
|
35
35
|
`antigravity-handler.mjs` preserves observed Google account/catalog control
|
|
36
36
|
requests against fixed official Code Assist origins. It merges advertised
|
|
37
|
-
Copilot
|
|
37
|
+
compatible Copilot Gemini aliases while retaining native models and defaults. The catalog drives model names, limits, vision and reasoning aliases, including xhigh; there is no per-model allowlist. Explicit image-only, disabled, non-streaming/non-tool and non-Chat declarations are excluded. Native
|
|
38
38
|
Google agent requests pass through; selected Copilot agents and all unattributed
|
|
39
39
|
background inference use Copilot. Summaries use Carbon Low, searches use the
|
|
40
40
|
existing Copilot search transport, and images use the existing GHC Images API.
|
|
41
41
|
Ordinary Gemini chat is outside this endpoint scope; parent-App route adoption
|
|
42
42
|
and ordinary-chat isolation require native App acceptance beyond engine replay.
|
|
43
43
|
|
|
44
|
+
The existing Antigravity refresh control sends an explicit `refresh` operation through the GitHub catalog runtime. Status and summary reads remain cached. Refresh failures preserve the last-good catalog; selection and draft writes remain separate. `app antigravity models --refresh` shares this boundary. The capability projection also preserves explicit Copilot `vision=false` as text-only while retaining native-template fallback for unknown vision, following [CC Switch's capability fix](https://github.com/farion1231/cc-switch/commit/fc3eb797c72e054d554eea6a2e7a8b93933c6ac5).
|
|
45
|
+
|
|
44
46
|
The Chat bridge keeps lossless tool integers, explicit effort, cancellation,
|
|
45
47
|
stream backpressure, privacy-token restoration and terminal errors. Native
|
|
46
48
|
conversation labels feed the existing source guard before main-answer dispatch.
|
|
@@ -698,6 +700,8 @@ left unchanged. Ordinary accepted requests and streams bypass this adaptation.
|
|
|
698
700
|
|
|
699
701
|
Byte-weighted request admission is not a simultaneous-stream limit. The 1.2.0 load replay exercises 16/64/128 small-body held streams, management responsiveness and downstream cancellation against 1.1.1. It does not establish a universal safe concurrency maximum. Existing defaults remain unchanged; see the release receipt for measured bounds.
|
|
700
702
|
|
|
703
|
+
Antigravity retains its shared body reservation while reading, decoding, masking and performing compaction recovery. Once the final upstream response opens, it drops the native request, converted Chat payload and privacy-session body references before releasing both raw and decoded reservations. Response restoration mappings remain alive until completion or cancellation. Search and image operations retain their input reservation through completion. Queue waiting uses the admission deadline; the body deadline starts only after admission. Admission/body preparation timings and fixed abort codes distinguish local queue failures (`503`), body deadlines (`408`), upstream or compaction deadlines (`504`) and client cancellation (`499`), without changing budgets, queue fairness or product timeouts.
|
|
704
|
+
|
|
701
705
|
## Installation and release delivery
|
|
702
706
|
|
|
703
707
|
`release-install.mjs` is a standalone helper with built-in static imports, shared by the updater
|
|
@@ -1175,6 +1179,8 @@ The 1.3.13 native helper groups uncached short CPU sequences under the existing
|
|
|
1175
1179
|
|
|
1176
1180
|
`claude-app-contract.mjs` reads bounded installed macOS archive declarations and consumers, extracts native effort profiles, and caches by installation identity. Lightweight file hints and the existing refresh path coalesce revalidation outside inference. `connection-runtime.mjs` replaces the capability snapshot and clears compiled plans before owned synchronization. Profile entries and discovery replies carry identical `behavesAs`/`behaves_as` and effort caps. Neutral route identity stays source-qualified; previously published aliases remain resolvable. Legacy inspected adapters remain available when a newer native contract cannot be checked. Non-contiguous effort sets are declared as limited instead of remapped. Shared capability-map reconciliation preserves manual entries and unchanged original restoration state. Native profile loading may require a normal client restart; requested and sent effort observations do not establish unobserved picker adoption.
|
|
1177
1181
|
|
|
1182
|
+
`client-effort.mjs` separates declared source effort sets from native menu presentation. Exact native contracts remain preferred; otherwise the existing client-model form offers source-declared values without model-name cases or level remapping. The optional Claude App deployment `reasoning_effort` is compiled into an internal route-record default, not native model metadata or provider configuration. Authenticated client/source/model resolution pins it with the capability snapshot. The gateway shallow-copies only a generation request missing `output_config.effort`, preserving its history and output-format fields. Explicit App values retain the existing validation path. Count-token requests and other clients never receive the default. Removed defaults remain configured for correction and fail before forwarding when needed. Drafts, revisions, source isolation and Save/Discard retain their existing boundaries. App inspection remains read-only; the signed model-catalog channel, binaries, trust roots, session-host mode and tool permissions are not changed.
|
|
1183
|
+
|
|
1178
1184
|
Usage presentation maps configured api_ identifiers to current provider labels after aggregation. Rows, chart filters and historical statistics keep their original keys. Provider-label changes refresh only the table/model labels, preserving the selected raw model key, day and existing chart nodes. The native capability replay disables usage persistence and gives its process a temporary usage path; no production filter recognizes test model names or response IDs.
|
|
1179
1185
|
|
|
1180
1186
|
## Native image recovery and request correlation
|
package/docs/REFERENCE.md
CHANGED
|
@@ -56,6 +56,8 @@ For scripts, source access accepts `--apps codex,claude-app` with `--edit`; edit
|
|
|
56
56
|
|
|
57
57
|
An app model file contains `deployments: [{"source":"github","model":"<model-id>"}]`, with optional `default_model` and `auto_sync`. An explicit empty array clears the default and pauses access. A file without `deployments` is rejected. Unavailable saved selections remain visible until the user changes them.
|
|
58
58
|
|
|
59
|
+
Claude App deployments may also specify `reasoning_effort`, for example `{"source":"api_work","model":"reasoner","reasoning_effort":"xhigh"}`. Omit it to follow the App. A client can send an automatic level even without a visible selection; CCDX preserves that supplied value. The fallback applies only when the request omits the field. `app claude-app models --edit` and the TUI expose the source's declared choices for models needing CCDX control, and preserve existing defaults during other model edits. This preference belongs to that client's source/model binding, not to the source shared with Codex or Claude Code.
|
|
60
|
+
|
|
59
61
|
## Antigravity in Gemini App
|
|
60
62
|
|
|
61
63
|
The **Antigravity** page and `ccdx app antigravity status|models|enable|disable|open`
|
|
@@ -70,9 +72,9 @@ inspection. Use `app antigravity status` to check the signed installation explic
|
|
|
70
72
|
The old `app gemini` commands remain available. Authorize Antigravity on the GitHub
|
|
71
73
|
Copilot source page, or with `source github access --edit --apps codex,antigravity --yes`.
|
|
72
74
|
Choose its exposed models on the Antigravity page or with
|
|
73
|
-
`app antigravity models --edit`. Each WebUI row represents one model.
|
|
75
|
+
`app antigravity models --edit`. Each WebUI row represents one model. Compatible Gemini chat models come from the current GitHub catalog, rather than a fixed Carbon/Argon list. The Reasoning column lists advertised levels, including Hydrogen's `xhigh` when available. The model checkbox controls visibility. Save/Discard, refresh, navigation, pausing and an off/on toggle preserve an existing saved route subset. CLI model editing and model files remain available for fine-grained effort selection. Refresh on this page or run `app antigravity models --refresh` to read the upstream catalog through the existing GitHub refresh runtime. Refresh does not change saved choices, save drafts, restart clients or invoke inference; failed reads retain the last usable list.
|
|
74
76
|
|
|
75
|
-
The native Gemini catalog still uses distinct routing aliases for each level so its original selector can choose the intended effort. JSON model output retains those aliases for compatibility, with a `model` field identifying the actual model; the management status also includes `model_groups`. A model file accepts `{"models":["gemini-4-
|
|
77
|
+
The native Gemini catalog still uses distinct routing aliases for each level so its original selector can choose the intended effort. JSON model output retains those aliases for compatibility, with a `model` field identifying the actual model; the management status also includes `model_groups`. A model file accepts `{"models":["gemini-4-hydrogen"]}` to expose all of its advertised levels, or individual `ccdx-copilot-...-<effort>` aliases to choose a subset. Existing Carbon/Argon aliases remain valid. Models without declared reasoning levels use one plain alias.
|
|
76
78
|
After saving, the Antigravity page reports whether the client has fetched the current model list. If the list is pending, reopen Gemini through CCDX.
|
|
77
79
|
|
|
78
80
|
The WebUI uses one authorization form for GitHub Copilot, Microsoft 365 and custom APIs. Source switches apply immediately. App-authorization and model checkboxes are drafts until **Save**; **Discard changes** restores the saved selection. Drafts survive refresh and navigation. Source authorization does not choose app models.
|
|
@@ -81,14 +83,15 @@ Pausing Antigravity Copilot access retains its saved model selection. Native Goo
|
|
|
81
83
|
|
|
82
84
|
The page distinguishes enabled access from an observed client connection.
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
Copilot account advertises them. Google models, account controls and defaults
|
|
86
|
+
Compatible Gemini models and their declared reasoning levels appear when the Copilot account advertises them. Image-only models, incompatible interfaces and explicitly unavailable models are excluded. Google models, account controls and defaults
|
|
86
87
|
are retained. Conversations keep their initial Google/Copilot source; start a
|
|
87
88
|
new conversation to change source. Unsupported PDF, audio and video inputs are refused
|
|
88
89
|
before Copilot dispatch. Text, inline images and native function tools are
|
|
89
90
|
converted to the advertised Copilot Chat interface; truncated streams report an
|
|
90
91
|
error rather than successful completion.
|
|
91
92
|
|
|
93
|
+
This Copilot selection does not restrict Antigravity's original Google model directory. Google wire IDs such as `gemini-3.8-flash-tiered` can therefore appear in usage without being CCDX-added model choices. The recorded provider distinguishes Google and GitHub Copilot; the ID alone does not establish a background task or a fallback. Known conversation compaction retains its observed source and model.
|
|
94
|
+
|
|
92
95
|
`enable` saves CCDX settings and prepares its local source guard. `open --preview` shows the launch plan.
|
|
93
96
|
`open` starts a closed, signed `/Applications/Gemini.app` with a process-local
|
|
94
97
|
Antigravity endpoint. An already running App is kept open and must be quit by
|
|
@@ -158,6 +161,10 @@ Verified newer contracts keep stable source-qualified model IDs. Both the native
|
|
|
158
161
|
|
|
159
162
|
Capability declarations, successful synchronization and an observed outgoing effort are separate facts. `ccdx app claude-app status --details`, sync preview and retained request details expose these facts. A missing effort on one request is not proof of missing support. An unverified contract preserves affected existing settings. A non-contiguous set such as low/high/max stays declared and is reported as limited when the native picker cannot express it exactly; CCDX does not invent an intermediate level or silently remap the selection.
|
|
160
163
|
|
|
164
|
+
CCDX renders the complete declared set independently of the native menu. When the current verified App contract can express the exact set, the existing native presentation stays in use. Otherwise, the Reasoning cell provides a native-styled CCDX selector, such as `low / high / xhigh`, without adding a missing `medium` or creating model variants. An unknown App contract can still use this CCDX-side control when source capabilities are known. Refresh and navigation keep the draft; Save and Discard use the existing form.
|
|
165
|
+
|
|
166
|
+
A saved fallback is applied as Messages `output_config.effort` only when the App omits that field. Effort and thinking mode stay separate; the gateway does not enable, disable or rewrite `thinking`. Explicit App values are retained and pass through the existing capability validation; unsupported values are never mapped to nearby levels. Existing output-format fields, model IDs, history and tool permissions are preserved. Count-token requests and other clients do not receive the fallback. If the source stops advertising the saved level, the value remains visible as unavailable and generation needing that default fails with `ccdx_client_effort_unavailable` until it is corrected or cleared. Native configuration synchronization remains independent of this request preference; changing the preference does not add native model metadata or require an App restart for the parameter itself.
|
|
167
|
+
|
|
161
168
|
## API import and request validation
|
|
162
169
|
|
|
163
170
|
**Model sources → Import** and `ccdx source import --file FILE` preview explicitly supplied JSON. Supported shapes are CCDX API metadata/connection exports, CC Switch Claude provider JSON (`settingsConfig.env`), and Magpie `providers.json` with native API bases. Cached deployment evidence, foreign route aliases, account rotation, commands and tool permissions are not adopted. Credential values are not copied; use a private key input or `key_env` when saving. Client access remains a separate explicit choice.
|
|
@@ -819,6 +826,8 @@ The old external image provider, Qwen-specific generation/editing, `/mcp/image`,
|
|
|
819
826
|
| `CCDX_DISABLE_USAGE` | unset | Set to `1` to disable usage logging |
|
|
820
827
|
| `CCDX_SHUTDOWN_TIMEOUT_MS` | `5000` | Time to drain active HTTP connections before forcing shutdown |
|
|
821
828
|
|
|
829
|
+
Antigravity starts the body deadline after queue admission. Its generation requests release body reservations after the final upstream response opens, while keeping response-restoration state until completion. Queue exhaustion or timeout returns `503`; a body timeout returns `408`; upstream and compaction timeouts return `504`. Client cancellation releases queued or active reservations. These limits and queue ordering remain unchanged.
|
|
830
|
+
|
|
822
831
|
## Usage logging
|
|
823
832
|
|
|
824
833
|
When upstream responses contain usage fields, CCDX records token counts, model names, API surface, and response IDs in `~/.local/share/codex-copilot-dx/usage.jsonl`. It does not record prompts, completions, tool arguments, or image content.
|
package/package.json
CHANGED
package/src/access-settings.mjs
CHANGED
|
@@ -134,7 +134,8 @@ export function checkedAccessSettings(value) {
|
|
|
134
134
|
|| client.auto_sync !== undefined && typeof client.auto_sync !== "boolean"
|
|
135
135
|
|| client.default_model !== undefined && client.default_model !== null && !modelId(client.default_model)
|
|
136
136
|
|| client.deployments !== undefined && client.deployments !== null && (!Array.isArray(client.deployments) || client.deployments.length > 1000
|
|
137
|
-
|| client.deployments.some(item => !fields(item, ["source", "model"]) || !client.allowed.includes(item.source) || !modelId(item.model)
|
|
137
|
+
|| client.deployments.some(item => !fields(item, ["source", "model", "reasoning_effort"]) || !client.allowed.includes(item.source) || !modelId(item.model)
|
|
138
|
+
|| item.reasoning_effort !== undefined && (id !== "claude_app" || !["none", "minimal", "low", "medium", "high", "xhigh", "max"].includes(item.reasoning_effort)))
|
|
138
139
|
|| new Set(client.deployments.map(item => item.source + "\0" + item.model)).size !== client.deployments.length)
|
|
139
140
|
|| client.history_isolation !== undefined && typeof client.history_isolation !== "boolean"
|
|
140
141
|
|| client.auto_review_effort !== undefined && client.auto_review_effort !== null && !["none", "minimal", "low", "medium", "high", "xhigh", "max"].includes(client.auto_review_effort)) throw accessError("ccdx_connections_invalid");
|
package/src/adapter.mjs
CHANGED
|
@@ -193,6 +193,10 @@ export function createAdapterHandler(options = {}) {
|
|
|
193
193
|
if (!antigravityLoading) antigravityLoading = (async () => {
|
|
194
194
|
const { createAntigravityRuntime } = await import("./antigravity-runtime.mjs");
|
|
195
195
|
antigravity = createAntigravityRuntime({ client: codexClient, models: () => codexModelRegistry?.models || [], privacy, compaction, acquireRequest,
|
|
196
|
+
...(options.providerRuntime?.dashboardCatalog?{refreshModels:async()=>{
|
|
197
|
+
const result=await options.providerRuntime.dashboardCatalog({provider:"github"});
|
|
198
|
+
if(!result)throw httpError("GitHub model catalog refresh is unavailable",503);
|
|
199
|
+
}}:{}),
|
|
196
200
|
env: options.env, home: options.dashboardOptions?.home, requestBodyTimeoutMs, upstreamTimeoutMs, streamIdleTimeoutMs,
|
|
197
201
|
...options.antigravityOptions });
|
|
198
202
|
return antigravity;
|
|
@@ -53,7 +53,7 @@ function contentValue(parts) {
|
|
|
53
53
|
return parts.length === 1 && parts[0].type === "text" ? parts[0].text : parts;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function antigravityToChat(request, { model, effort, stream = true } = {}) {
|
|
56
|
+
export function antigravityToChat(request, { model, effort, stream = true, reasoningEfforts = ["none","minimal","low","medium","high","xhigh","max"] } = {}) {
|
|
57
57
|
if (!object(request) || !Array.isArray(request.contents) || typeof model !== "string" || !model)
|
|
58
58
|
throw invalid("Invalid Gemini generation request");
|
|
59
59
|
if (Object.keys(request).some(key => !["contents", "systemInstruction", "tools", "toolConfig", "generationConfig", "labels", "sessionId"].includes(key))
|
|
@@ -143,7 +143,7 @@ export function antigravityToChat(request, { model, effort, stream = true } = {}
|
|
|
143
143
|
// A CCDX model alias advertises the Copilot effort selected in the App.
|
|
144
144
|
// Its explicit effort takes precedence over Google's internal token budget.
|
|
145
145
|
const level = effort || generation.thinkingConfig?.thinkingLevel?.toLowerCase();
|
|
146
|
-
if (level && !
|
|
146
|
+
if (level && !reasoningEfforts.includes(level)) throw invalid("Unsupported Gemini reasoning level");
|
|
147
147
|
const chat = { model, messages, stream,
|
|
148
148
|
...(stream ? { stream_options: { include_usage: true } } : {}),
|
|
149
149
|
...(tools.length ? { tools, tool_choice: choices[mode] } : {}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {randomUUID,createHash} from "node:crypto";
|
|
2
2
|
import {buildResponsesUsageRecord,recordUsage} from "./usage-store.mjs";
|
|
3
|
-
import {createRequestAbort,readJsonBody,readBoundedResponseText,writeOrDrain,httpError,sendJsonError} from "./http-transport.mjs";
|
|
3
|
+
import {createRequestAbort,abortErrorStatusCode,readJsonBody,readBoundedResponseText,writeOrDrain,httpError,sendJsonError} from "./http-transport.mjs";
|
|
4
4
|
import {safeUpstreamResponseHeaders} from "./upstream-headers.mjs";
|
|
5
5
|
import {isLoopbackAddress,isLoopbackHostHeader} from "./security.mjs";
|
|
6
6
|
import {antigravityToChat,chatToAntigravity,chatStreamToAntigravity,parseAntigravityJSON} from "./antigravity-chat-bridge.mjs";
|
|
@@ -8,7 +8,7 @@ import {ANTIGRAVITY_MODEL_PREFIX,antigravityCopilotModels,mergeAntigravityModels
|
|
|
8
8
|
import {createPrivacyTextFragments} from "./privacy-stream.mjs";
|
|
9
9
|
import {createGoogleResponseObserver,googleUsageEvent} from "./antigravity-usage.mjs";
|
|
10
10
|
import {currentRequestContext,observeRequestedModel} from "./request-context.mjs";
|
|
11
|
-
import {markUpstreamStarted,markUpstreamHeaders,markFirstOutput,markOutputTokens,markRequestObservation,markResponseModel,markResponseTerminal,markToolActivity} from "./stream-performance.mjs";
|
|
11
|
+
import {measureRequestStageAsync,markUpstreamStarted,markUpstreamHeaders,markFirstOutput,markOutputTokens,markRequestObservation,markResponseModel,markResponseErrorOrigin,markResponseTerminal,markToolActivity} from "./stream-performance.mjs";
|
|
12
12
|
import {isCompactionRequest} from "./context-compaction.mjs";
|
|
13
13
|
import {compactionSummarizer} from "./context-compaction-wire.mjs";
|
|
14
14
|
import {requestPurpose} from "./request-context.mjs";
|
|
@@ -42,7 +42,11 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
42
42
|
let active=0,observed=false,catalogModels=null;const nativeWindows=new Map();
|
|
43
43
|
const counts={total:0,google:0,copilot:0,search:0,images:0,failed:0};
|
|
44
44
|
const handler=async(req,res)=>{
|
|
45
|
-
const abort=createRequestAbort(req,res);let release=()=>{},session,usageEvent=null,usageModel=null,outcome=null,usageMode,usageProvider;
|
|
45
|
+
const abort=createRequestAbort(req,res);let release=()=>{},session,body,request,converted,phase="validation",usageEvent=null,usageModel=null,outcome=null,usageMode,usageProvider;
|
|
46
|
+
const releaseInput=()=>{
|
|
47
|
+
body=null;request=null;if(converted)converted.chat=null;if(session)session.body=null;
|
|
48
|
+
const done=release;release=()=>{};done();
|
|
49
|
+
};
|
|
46
50
|
const captureUsage=event=>{
|
|
47
51
|
if(!event?.usage&&!event?.copilot_usage)return;
|
|
48
52
|
const known=value=>Number.isSafeInteger(value)&&value>=0,u={...usageEvent?.usage},incoming=event.usage;
|
|
@@ -66,9 +70,11 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
66
70
|
const match=/^\/v1internal(?::|\/)([A-Za-z][A-Za-z0-9]*)$/.exec(route);
|
|
67
71
|
if(!local.pathname.startsWith(PREFIX+"/")||!match)throw httpError("Unknown Antigravity endpoint",404);
|
|
68
72
|
const method=match[1];
|
|
69
|
-
abort.setTimeout(requestBodyTimeoutMs,"request_body_timeout");release=await acquireRequest(req,{signal:abort.signal});
|
|
70
73
|
if(req.method==="POST"&&!/^application\/json(?:;|$)/i.test(req.headers["content-type"]||""))throw httpError("Antigravity requires JSON",415);
|
|
71
|
-
|
|
74
|
+
phase="admission";release=await measureRequestStageAsync("admission",()=>acquireRequest(req,{signal:abort.signal}));
|
|
75
|
+
phase="body";abort.setTimeout(requestBodyTimeoutMs,"request_body_timeout");
|
|
76
|
+
body=req.method==="POST"?await measureRequestStageAsync("body",()=>readJsonBody(req,{admission:release,signal:abort.signal,parse:parseBody})):null;
|
|
77
|
+
phase="preparation";
|
|
72
78
|
const context=currentRequestContext();if(context)context.application="gemini_app";
|
|
73
79
|
const compacting=isCompactionRequest("gemini",body);
|
|
74
80
|
if(compacting&&context){context.purpose=requestPurpose(req.headers["x-ccdx-purpose"],"compaction");context.streamPerformance?.setPurpose(context.purpose)}
|
|
@@ -95,9 +101,12 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
95
101
|
...(value?{body:JSON.stringify(value)}:{}),signal:options.signal||abort.signal,redirect:"error"});
|
|
96
102
|
if(generation)markUpstreamHeaders(result.status);return result;
|
|
97
103
|
};
|
|
104
|
+
phase="upstream";
|
|
98
105
|
const upstream=compacting&&compaction?await compaction.run({body,protocol:"gemini",scope:JSON.stringify(["gemini","google",createHash("sha256").update(req.headers.authorization||"").update(String(body.project||"")).digest("hex")]),
|
|
99
106
|
source:"google",client:"gemini",model:body.model,inputLimit:nativeWindows.get(body.model),outputAllowance:body.request?.generationConfig?.maxOutputTokens||0,native:open,options:{signal:abort.signal},
|
|
100
107
|
summarize:compactionSummarizer(body,"gemini",(value,options)=>open(value,{...options,internal:true})),onActivity:()=>abort.setTimeout(streamIdleTimeoutMs,"compaction_idle_timeout")}):await open(body);
|
|
108
|
+
releaseInput();
|
|
109
|
+
if(!upstream.ok)markResponseErrorOrigin("upstream_http");
|
|
101
110
|
if(method==="fetchAvailableModels"&&upstream.ok){
|
|
102
111
|
const value=JSON.parse(await readBoundedResponseText(upstream,{maxBytes:8*1024*1024,signal:abort.signal,label:"Google model catalog"}));
|
|
103
112
|
nativeWindows.clear();for(const[id,entry]of Object.entries(value.models||{}).slice(0,256))if(Number.isSafeInteger(entry?.maxTokens)&&entry.maxTokens>0){nativeWindows.set(id,entry.maxTokens);if(typeof entry.model==="string")nativeWindows.set(entry.model,entry.maxTokens)}
|
|
@@ -125,7 +134,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
125
134
|
}
|
|
126
135
|
}finally{if(observer?.finish().unavailable&&!usageEvent)markRequestObservation({usage_state:"unavailable"})}
|
|
127
136
|
if(generation&&!upstream.ok)outcome="failed";
|
|
128
|
-
if(outcome)markResponseTerminal(outcome);
|
|
137
|
+
if(outcome)markResponseTerminal(outcome,upstream.ok?undefined:{origin:"upstream_http"});
|
|
129
138
|
res.end();
|
|
130
139
|
};
|
|
131
140
|
if(!generation){
|
|
@@ -148,7 +157,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
148
157
|
if(context){context.provider="github";context.streamPerformance?.setProvider?.("github")}
|
|
149
158
|
observeContextSession(null,{session_id:body.request?.labels?.root_cascade_id||body.request?.labels?.cascade_id},{profileId:()=>"github:codex"},"chat");
|
|
150
159
|
context?.streamPerformance?.observeToolInput?.(body.request,"gemini");
|
|
151
|
-
|
|
160
|
+
request=body.request;
|
|
152
161
|
if(body.requestType==="web_search"){
|
|
153
162
|
counts.search++;if(!searchFn)throw httpError("Copilot search is unavailable",503);
|
|
154
163
|
const query=searchQuery(request),input={id:randomUUID(),commands:{search_query:[{q:query}]}};
|
|
@@ -169,15 +178,17 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
169
178
|
const target=body.requestType==="agent"||compactBinding&&!compactBinding.background?selected:copilotModels.find(model=>model.model==="gemini-4-carbon"&&model.effort==="low");
|
|
170
179
|
if(!target)throw httpError("Copilot Carbon is unavailable for Antigravity background tasks",503);
|
|
171
180
|
const stream=method==="streamGenerateContent";usageModel=target.model;usageMode=stream?"sse":"json";usageProvider="github";
|
|
172
|
-
|
|
181
|
+
converted=antigravityToChat(request,{model:target.model,effort:target.effort,reasoningEfforts:target.effort?[target.effort]:[],stream});
|
|
173
182
|
markResponseModel(target.model);markRequestObservation({usage_state:"pending"});
|
|
174
183
|
session=privacy?.prepareSession?await privacy.prepareSession(converted.chat,{protocol:"chat",client:"gemini",signal:abort.signal}):passthrough(converted.chat);
|
|
175
184
|
const callOptions={signal:abort.signal,retryOptions:{retries:0},onUpstreamStart:()=>abort.setTimeout(upstreamTimeoutMs,"upstream_timeout")};
|
|
185
|
+
phase="upstream";
|
|
176
186
|
const upstream=compacting&&compaction?await compaction.run({body:session.body,protocol:"chat",scope:JSON.stringify(["gemini","github",compactionProfile()]),source:"github",client:"gemini",
|
|
177
187
|
inputLimit:target.maxTokens,outputAllowance:session.body.max_completion_tokens||session.body.max_tokens||0,native:client.chatCompletions,options:callOptions,
|
|
178
188
|
summarize:compactionSummarizer(session.body,"chat",client.chatCompletions),onActivity:()=>abort.setTimeout(streamIdleTimeoutMs,"compaction_idle_timeout")}):await client.chatCompletions(session.body,callOptions);
|
|
189
|
+
releaseInput();
|
|
179
190
|
markUpstreamHeaders(upstream.status);
|
|
180
|
-
if(!upstream.ok){await upstream.body?.cancel();throw httpError("Copilot generation was refused (HTTP "+upstream.status+")",upstream.status)}
|
|
191
|
+
if(!upstream.ok){markResponseErrorOrigin("upstream_http");await upstream.body?.cancel();throw httpError("Copilot generation was refused (HTTP "+upstream.status+")",upstream.status)}
|
|
181
192
|
if(!stream){
|
|
182
193
|
const data=JSON.parse(await readBoundedResponseText(upstream,{maxBytes:MAX_REPLY,signal:abort.signal,label:"Copilot response"}));captureUsage(data);
|
|
183
194
|
const result=chatToAntigravity(data,converted.originalNames);markToolActivity(result,"gemini");
|
|
@@ -200,13 +211,17 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
200
211
|
}
|
|
201
212
|
res.end();
|
|
202
213
|
}catch(error){
|
|
214
|
+
if(abort.reason)error=Object.assign(httpError(error.message,abortErrorStatusCode(abort.reason)),{code:abort.reason});
|
|
215
|
+
else if(phase==="admission")error=Object.assign(httpError(error.message,error.statusCode||503),{code:"ccdx_request_admission_unavailable"});
|
|
203
216
|
if(typeof error.code==="string"&&error.code.startsWith("ccdx_compaction_"))res.setHeader("x-should-retry","false");
|
|
204
217
|
counts.failed++;
|
|
205
|
-
outcome=abort.signal.aborted&&["client_closed","client_aborted"].includes(abort.reason)?"cancelled":"failed";
|
|
218
|
+
outcome=abort.signal.aborted&&["client_closed","client_aborted"].includes(abort.reason)?"cancelled":"failed";
|
|
219
|
+
const origin=outcome==="cancelled"?"client_disconnect":currentRequestContext()?.errorOrigin||(abort.reason||phase==="admission"?"transport":error.origin==="privacy"?"privacy":error.statusCode<500?"client_validation":"transport");
|
|
220
|
+
markResponseErrorOrigin(origin);markResponseTerminal(outcome,{origin});
|
|
206
221
|
if(res.headersSent&&!res.writableEnded&&!res.destroyed){res.end("data: "+JSON.stringify({error:{code:error.statusCode||502,message:error.message}})+"\n\n");}
|
|
207
222
|
else sendJsonError(res,error,error.statusCode||502);
|
|
208
223
|
}finally{
|
|
209
|
-
|
|
224
|
+
releaseInput();session?.release();abort.cleanup();active--;
|
|
210
225
|
if(usageEvent){
|
|
211
226
|
const u=usageEvent.usage,record=buildResponsesUsageRecord({surface:"antigravity",mode:usageMode,model:usageModel,
|
|
212
227
|
response:{id:usageEvent.id,model:usageEvent.model||usageModel,usage:u?{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {uniqueModelEntries} from "./model-catalog.mjs";
|
|
2
|
+
import {modelDisplayName} from "./model-display.mjs";
|
|
3
|
+
import {modelReasoningEfforts} from "./provider-metadata.mjs";
|
|
3
4
|
export const ANTIGRAVITY_MODEL_PREFIX = "ccdx-copilot-";
|
|
4
5
|
|
|
5
6
|
export function antigravityCopilotModels(catalog) {
|
|
6
7
|
const data=Array.isArray(catalog)?catalog:catalog?.data;
|
|
7
|
-
return (data
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
return uniqueModelEntries(Array.isArray(data)?data:[]).filter(model=>/^gemini-[a-z0-9][a-z0-9._-]{0,100}$/.test(model?.id)
|
|
9
|
+
&&model.model_picker_enabled!==false&&(!model.policy?.state||model.policy.state==="enabled")
|
|
10
|
+
&&(!model.capabilities?.type||model.capabilities.type==="chat")
|
|
11
|
+
&&model.capabilities?.supports?.streaming!==false&&model.capabilities?.supports?.tool_calls!==false
|
|
12
|
+
&&model.supported_endpoints?.some(endpoint=>["/chat/completions","/v1/chat/completions"].includes(endpoint)))
|
|
13
|
+
.flatMap(model=>{
|
|
14
|
+
const efforts=modelReasoningEfforts(model)||[],fallback=model.id.split("-").map(word=>word[0].toUpperCase()+word.slice(1)).join(" ");
|
|
15
|
+
const name=modelDisplayName({...model,name:model.name||fallback}),label=/gemini/i.test(name)?name:"Gemini · "+name;
|
|
16
|
+
return (efforts.length?efforts:[null]).map(effort=>({
|
|
17
|
+
id:ANTIGRAVITY_MODEL_PREFIX+model.id+(effort?"-"+effort:""),model:model.id,effort,
|
|
18
|
+
displayName:label+" · Copilot"+(effort?" ("+effort[0].toUpperCase()+effort.slice(1)+")":""),
|
|
19
|
+
maxTokens:model.capabilities?.limits?.max_context_window_tokens,maxOutputTokens:model.capabilities?.limits?.max_output_tokens,
|
|
20
|
+
supportsImages:model.capabilities?.supports?.vision===true,
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
export function mergeAntigravityModels(googleCatalog,copilotCatalog,selection=null) {
|
|
@@ -23,7 +32,7 @@ export function mergeAntigravityModels(googleCatalog,copilotCatalog,selection=nu
|
|
|
23
32
|
if(next>=600||Object.hasOwn(models,entry.id))throw new Error("Antigravity model catalog has no free client identifiers");
|
|
24
33
|
const model="MODEL_PLACEHOLDER_M"+next++;used.add(model);
|
|
25
34
|
models[entry.id]={displayName:entry.displayName,model,maxTokens:entry.maxTokens,maxOutputTokens:entry.maxOutputTokens,
|
|
26
|
-
supportsImages:entry.supportsImages,supportsThinking:
|
|
35
|
+
supportsImages:entry.supportsImages,supportsThinking:Boolean(entry.effort),apiProvider:"API_PROVIDER_GOOGLE_GEMINI"};
|
|
27
36
|
}
|
|
28
37
|
const sorts=googleCatalog.agentModelSorts?.length?structuredClone(googleCatalog.agentModelSorts):[{displayName:"Recommended",groups:[]}];
|
|
29
38
|
// Gemini App reads only the first group in the Recommended sort.
|
|
@@ -21,7 +21,7 @@ import {antigravityCopilotModels} from "./antigravity-models.mjs";
|
|
|
21
21
|
|
|
22
22
|
const execute=promisify(execFile),key="gemini_antigravity_enabled",modelKey="gemini_antigravity_models";
|
|
23
23
|
|
|
24
|
-
export function createAntigravityRuntime({client,models=()=>[],privacy,home=os.homedir(),env=process.env,inspect=inspectGeminiApp,
|
|
24
|
+
export function createAntigravityRuntime({client,models=()=>[],refreshModels,privacy,home=os.homedir(),env=process.env,inspect=inspectGeminiApp,
|
|
25
25
|
exec=execute,searchFn,imageFn,guardSource,googleFetch,acquireRequest,readToken=()=>readSavedGithubToken(home),...timeouts}={}) {
|
|
26
26
|
const options={home,env},guard=createConversationSourceGuard(options);
|
|
27
27
|
const web=searchFn?null:createCopilotWeb({client,readToken});
|
|
@@ -35,7 +35,7 @@ export function createAntigravityRuntime({client,models=()=>[],privacy,home=os.h
|
|
|
35
35
|
const settings=()=>{
|
|
36
36
|
const saved=readUserSettings({...options,strict:true});
|
|
37
37
|
if(saved[key]!==undefined&&typeof saved[key]!=="boolean")throw httpError("Invalid Gemini integration setting",409);
|
|
38
|
-
if(saved[modelKey]!==undefined&&(!Array.isArray(saved[modelKey])||saved[modelKey].length>100||new Set(saved[modelKey]).size!==saved[modelKey].length||saved[modelKey].some(id=>typeof id!=="string"||!/^ccdx-copilot-[a-z0-9-]{1,140}$/.test(id))))throw httpError("Invalid Antigravity model selection",409);
|
|
38
|
+
if(saved[modelKey]!==undefined&&(!Array.isArray(saved[modelKey])||saved[modelKey].length>100||new Set(saved[modelKey]).size!==saved[modelKey].length||saved[modelKey].some(id=>typeof id!=="string"||!/^ccdx-copilot-[a-z0-9._-]{1,140}$/.test(id))))throw httpError("Invalid Antigravity model selection",409);
|
|
39
39
|
return {configured:Object.hasOwn(saved,key),enabled:saved[key]===true,selected_models:saved[modelKey]??null};
|
|
40
40
|
};
|
|
41
41
|
const available=()=>settings().enabled&&readAccessSettings(options).providers.github?models():[];
|
|
@@ -77,8 +77,12 @@ export function createAntigravityRuntime({client,models=()=>[],privacy,home=os.h
|
|
|
77
77
|
async function action(input={},baseUrl){
|
|
78
78
|
if(input&&Object.keys(input).some(name=>!["action","accept_background_copilot","models"].includes(name)))throw httpError("Invalid Gemini operation",400);
|
|
79
79
|
const operation=input.action||"status";
|
|
80
|
-
if(!["status","summary","models","enable","disable","open","preview"].includes(operation))throw httpError("Unknown Gemini operation",400);
|
|
80
|
+
if(!["status","summary","refresh","models","enable","disable","open","preview"].includes(operation))throw httpError("Unknown Gemini operation",400);
|
|
81
81
|
if(input.models!==undefined&&operation!=="models")throw httpError("Models require the models operation",400);
|
|
82
|
+
if(operation==="refresh"){
|
|
83
|
+
if(!refreshModels)throw httpError("Antigravity model refresh is unavailable in this service",503);
|
|
84
|
+
await refreshModels();lastOperation={action:operation,status:"models_refreshed"};
|
|
85
|
+
}
|
|
82
86
|
if(operation==="models"){
|
|
83
87
|
const ids=input.models,known=new Set(antigravityCopilotModels(models()).map(model=>model.id));
|
|
84
88
|
if(!Array.isArray(ids)||ids.length>100||new Set(ids).size!==ids.length||ids.some(id=>!known.has(id)))throw httpError("Choose available Antigravity models",400);
|
package/src/claude-gateway.mjs
CHANGED
|
@@ -23,6 +23,7 @@ import { MESSAGES_TOOL_GUARD } from "./messages-tool-schema.mjs";
|
|
|
23
23
|
import { isCompactionRequest, compactionScope } from "./context-compaction.mjs";
|
|
24
24
|
import { compactionSummarizer } from "./context-compaction-wire.mjs";
|
|
25
25
|
import { requestPurpose } from "./request-context.mjs";
|
|
26
|
+
import { messagesWithEffortDefault } from "./client-effort.mjs";
|
|
26
27
|
|
|
27
28
|
function observeMessagesWindow(provider, model, capability, entry) {
|
|
28
29
|
try {
|
|
@@ -234,7 +235,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
|
|
|
234
235
|
if (!resolveRequest) tracker?.setProvider(provider.id);
|
|
235
236
|
const abort = createRequestAbort(req, res);
|
|
236
237
|
let release = () => {}, conversation, outcome = "failed", model = null, configuredModel = null, clientModel = null, responseId = null, usage = null, stopReason = null, streamed = false, sawStop = false, failedEvent = false;
|
|
237
|
-
let selectedModel, selectedCapability;
|
|
238
|
+
let selectedModel, selectedCapability, selectedEffortDefault;
|
|
238
239
|
let terminalOrigin = "client_validation", failureStatus = null, countDeadline = null, rejectionReason;
|
|
239
240
|
if (!countTokens) { stats.total++;stats.active++;stats.last_request_at = new Date().toISOString(); }
|
|
240
241
|
const context = parent || { requestId, purpose: req.headers["x-ccdx-purpose"] };
|
|
@@ -259,6 +260,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
|
|
|
259
260
|
selectedProvider = resolved.provider;finishProvider = resolved.finish || finishProvider;
|
|
260
261
|
configuredModel = resolved.model;clientModel = body.model === configuredModel ? null : body.model;
|
|
261
262
|
selectedCapability = resolved.capability;
|
|
263
|
+
selectedEffortDefault = resolved.effortDefault;
|
|
262
264
|
body = { ...body, model: configuredModel };tracker?.setProvider(selectedProvider.id);
|
|
263
265
|
const context = currentRequestContext();if (context) context.provider = selectedProvider.id;
|
|
264
266
|
}
|
|
@@ -271,10 +273,12 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
|
|
|
271
273
|
}
|
|
272
274
|
if (desktopAliases && !configuredModel) throw Object.assign(new Error("The selected model is unavailable"), { code: "ccdx_api_model_unavailable", statusCode: 400 });
|
|
273
275
|
if (desktopAliases && configuredModel !== model) { clientModel = model;model = configuredModel;body = { ...body, model }; }
|
|
276
|
+
const requestedEffort = body.output_config?.effort;
|
|
277
|
+
if (!countTokens) body = messagesWithEffortDefault(body, selectedEffortDefault, selectedCapability);
|
|
274
278
|
stats.last_model = model;
|
|
275
279
|
context.model = configuredModel || model;
|
|
276
280
|
if (!countTokens) {
|
|
277
|
-
markRequestObservation({ max_output_tokens_requested: body.max_tokens, reasoning_effort_requested:
|
|
281
|
+
markRequestObservation({ max_output_tokens_requested: body.max_tokens, reasoning_effort_requested: requestedEffort });
|
|
278
282
|
observeMessagesWindow(selectedProvider, configuredModel || model, selectedCapability, selectedModel);
|
|
279
283
|
}
|
|
280
284
|
tracker?.setModel(configuredModel || model, { configured: Boolean(configuredModel) });
|
package/src/cli-command-spec.mjs
CHANGED
|
@@ -110,7 +110,7 @@ export const MANAGED_COMMANDS = [
|
|
|
110
110
|
),
|
|
111
111
|
command("app list", "List client configuration and observed activity", read),
|
|
112
112
|
...["gemini", "antigravity"].flatMap(app => ["status", "models", "enable", "disable", "open"].map(action => command(`app ${app} ${action}`,
|
|
113
|
-
({status:"Inspect Gemini App and Antigravity setup",models:"List Copilot models
|
|
113
|
+
({status:"Inspect Gemini App and Antigravity setup",models:"List compatible Copilot models for Antigravity",enable:"Enable Antigravity routing and Copilot background requests",disable:"Pause Antigravity Copilot access; reopen Gemini for native routing",open:"Open the original Gemini App with its prepared route"})[action], {...read,...confirm,...(action==="models"?{"--edit":"flag","--file":"value","--refresh":"flag"}:{})}))),
|
|
114
114
|
command("app <app> status", "Show configuration, not process liveness", { ...read, "--details": "flag" }),
|
|
115
115
|
command("app <app> models", "Show or edit the client's selected model plan", {
|
|
116
116
|
...read,
|
|
@@ -288,7 +288,7 @@ export function parseManagedCommand(args) {
|
|
|
288
288
|
const extras = {
|
|
289
289
|
source:
|
|
290
290
|
"Status reads local/cached evidence. check/--refresh may contact the source; no inference.\nsource import --file FILE previews supplied metadata. --select N --apply saves one source using private key input; no client access is granted.\nSource access grants do not select client models. Disable previews affected clients.\nGitHub login and company-account selection are source-specific.\nChoose visible models and defaults with app <app> models --edit.",
|
|
291
|
-
app: "Configured is not App adoption or process liveness. Unknown stays unknown.\nmodels shows the selected plan;
|
|
291
|
+
app: "Configured is not App adoption or process liveness. Unknown stays unknown.\nmodels shows the selected plan; Antigravity lists compatible Copilot models and their selection.\napp antigravity models --refresh reads the GitHub catalog without inference or changing saved choices.\nsource <id> models shows the upstream catalog.\nsetup/remove changes integration setup; pause/resume retains credentials.\nsync --preview shows the model/configuration plan, not a byte-level file diff.\nNo client program is force-restarted.",
|
|
292
292
|
config:
|
|
293
293
|
"Only service and terminal preferences are in scope. Browser appearance stays in WebUI.\nReset keeps accounts, keys, model plans and chats and stores a pre-reset backup.\nSaved and effective values can differ; restart requirements remain explicit.",
|
|
294
294
|
requests:
|
package/src/cli-management.mjs
CHANGED
|
@@ -53,7 +53,7 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
53
53
|
const request = async args => {
|
|
54
54
|
try { return await rawRequest(args); }
|
|
55
55
|
catch (error) {
|
|
56
|
-
const messages = { ccdx_connections_conflict: "Settings changed. Reload and review before saving again.", ccdx_settings_changed: "Service preferences changed. Reload and review before saving again.", ccdx_source_in_use: "This source is still selected. Review replacements or pause the affected clients.",
|
|
56
|
+
const messages = { ccdx_client_effort_unavailable: "The saved reasoning level is unavailable. Choose a declared level or follow the app.", ccdx_connections_conflict: "Settings changed. Reload and review before saving again.", ccdx_settings_changed: "Service preferences changed. Reload and review before saving again.", ccdx_source_in_use: "This source is still selected. Review replacements or pause the affected clients.",
|
|
57
57
|
ccdx_source_busy: "This source has active work. Wait for it to finish before changing access.", ccdx_api_model_unavailable: "A selected model is unavailable. Saved selections were kept.",
|
|
58
58
|
ccdx_client_source_disabled: "Model access is paused. Review the client, source and model selection.", ccdx_api_protocol_required: "This source does not provide the required client interface." };
|
|
59
59
|
if (error.code && error.code !== "ccdx_tool_unavailable") error.message = messages[error.code] || `Operation rejected: ${error.code}. ${error.code.startsWith("ccdx_settings_") ? "Review service preferences and their backup; existing files were kept." : "Review the selected source or client."}`;
|
|
@@ -225,7 +225,7 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
225
225
|
output.write(print(preview) + "\n");await confirm(action === "enable" ? "Enable this Antigravity-only routing scope?" : "Pause Copilot access? Reopen Gemini afterward to restore its native route.");
|
|
226
226
|
}
|
|
227
227
|
if(action==="models"&&flags.edit){
|
|
228
|
-
const state=await request({path:"gemini"});
|
|
228
|
+
const state=await request({path:"gemini",...(flags.refresh?{body:{action:"refresh"},timeoutMs:20000}:{})});
|
|
229
229
|
let ids;
|
|
230
230
|
if(flags.file){
|
|
231
231
|
const listed=readFile().models;if(!Array.isArray(listed))throw new Error("Model files require a models array.");
|
|
@@ -236,7 +236,7 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
236
236
|
ids=[];
|
|
237
237
|
for(const index of selected){
|
|
238
238
|
const model=groups[index],previous=model.efforts.flatMap((item,i)=>item.selected?[i]:[]);
|
|
239
|
-
const efforts=await choose(model.efforts.map(item=>model.name+" / "+item.effort),previous.length?previous:model.efforts.map((_,i)=>i));
|
|
239
|
+
const efforts=await choose(model.efforts.map(item=>model.name+" / "+(item.effort||"default")),previous.length?previous:model.efforts.map((_,i)=>i));
|
|
240
240
|
ids.push(...efforts.map(i=>model.efforts[i].id));
|
|
241
241
|
}
|
|
242
242
|
}else ids=(await choose(state.models.map(model=>model.name),state.models.flatMap((model,index)=>model.selected!==false?[index]:[]))).map(index=>state.models[index].id);
|
|
@@ -245,9 +245,9 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
245
245
|
await confirm("Save Antigravity model selection? Reopen Gemini afterward to reload it.");
|
|
246
246
|
return print(await request({path:"gemini",body:{action:"models",models:ids}}));
|
|
247
247
|
}
|
|
248
|
-
const state = await request({ path: "gemini", ...(["status", "models"].includes(action) ? {} : { body: { action: flags.preview ? "preview" : action, ...(action === "enable" ? { accept_background_copilot: true } : {}) }, timeoutMs: 20000 }) });
|
|
248
|
+
const state = await request({ path: "gemini", ...(action==="models"&&flags.refresh?{body:{action:"refresh"},timeoutMs:20000}:["status", "models"].includes(action) ? {} : { body: { action: flags.preview ? "preview" : action, ...(action === "enable" ? { accept_background_copilot: true } : {}) }, timeoutMs: 20000 }) });
|
|
249
249
|
if(action==="models"&&flags.format!=="json"&&state.model_groups)return print(state.model_groups.map(model=>({model:model.name,id:model.id,source:"GitHub Copilot",context:model.context_window,
|
|
250
|
-
efforts:model.efforts.map(item=>item.effort+(item.selected?" ✓":"")).join(" / ")})),[["model","Model"],["id","ID"],["source","Source"],["context","Context"],["efforts","Reasoning (selected ✓)"]]);
|
|
250
|
+
efforts:model.efforts.map(item=>(item.effort||"default")+(item.selected?" ✓":"")).join(" / ")})),[["model","Model"],["id","ID"],["source","Source"],["context","Context"],["efforts","Reasoning (selected ✓)"]]);
|
|
251
251
|
return print(action === "models" ? state.models : state);
|
|
252
252
|
}
|
|
253
253
|
const graph = await connection(), snapshot = (await readStatus()).data, view = projectTerminalState(snapshot);
|
|
@@ -304,7 +304,7 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
304
304
|
const available = [...(modelPlan?.available || [])], selected = Array.isArray(client.deployments) ? client.deployments : modelPlan?.models.map(model => ({ source: model.source, model: model.id })) || [];
|
|
305
305
|
for (const old of selected) if (!available.some(row => row.source === old.source && row.id === old.model)) available.push({ source: old.source, id: old.model, unavailable: true });
|
|
306
306
|
const indexes = await choose(available.map(row => `${row.source} / ${row.id}${row.unavailable ? " (unavailable; selection retained)" : ""}`), available.flatMap((row, index) => selected.some(item => item.source === row.source && item.model === row.id) ? [index] : []));
|
|
307
|
-
body.deployments = indexes.map(index => ({ source: available[index].source, model: available[index].id }));
|
|
307
|
+
body.deployments = indexes.map(index => ({ ...selected.find(item => item.source === available[index].source && item.model === available[index].id), source: available[index].source, model: available[index].id }));
|
|
308
308
|
body.default_model = client.default_model || modelPlan?.default_model || null;
|
|
309
309
|
if (body.deployments.length) {
|
|
310
310
|
const defaults = body.deployments.map(item => deploymentModelId(item.source, item.model));
|
|
@@ -313,6 +313,14 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
313
313
|
if (value && (!/^\d+$/.test(value) || Number(value) < 1 || Number(value) > defaults.length)) throw new Error("Choose a listed default model number.");
|
|
314
314
|
body.default_model = defaults[value ? Number(value) - 1 : Math.max(0, defaults.indexOf(body.default_model))];
|
|
315
315
|
} else body.default_model = null;
|
|
316
|
+
if (id === "claude_app") for (const item of body.deployments) {
|
|
317
|
+
const entry = available.find(row => row.source === item.source && row.id === item.model), levels = entry?.capability?.values.reasoning_efforts || [];
|
|
318
|
+
if (entry?.effort_control !== "gateway" && item.reasoning_effort === undefined) continue;
|
|
319
|
+
output.write(`Reasoning for ${item.source} / ${item.model}: follow-app${levels.length ? ", " + levels.join(", ") : ""}\n`);
|
|
320
|
+
const answer = (await ask(`Default when the app omits effort [${item.reasoning_effort || "follow-app"}]: `)).trim();
|
|
321
|
+
if (answer === "follow-app") delete item.reasoning_effort;
|
|
322
|
+
else if (answer) { if (!levels.includes(answer)) throw new Error("Choose a declared reasoning level or follow-app.");item.reasoning_effort = answer; }
|
|
323
|
+
}
|
|
316
324
|
}
|
|
317
325
|
if (id === "codex" && !flags.file && modelPlan?.image?.models?.length) {
|
|
318
326
|
const images = modelPlan.image.models, current = images.findIndex(model => model.id === modelPlan.image.selected_model);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { claudeNativeModelHint } from "./claude-app-contract.mjs";
|
|
2
|
+
import { claudeEffortPrefix } from "./model-capabilities.mjs";
|
|
3
|
+
|
|
4
|
+
export function claudeEffortControl(capability, support = {}) {
|
|
5
|
+
const values = capability?.values || {}, levels = values.reasoning === false || !Array.isArray(values.reasoning_efforts) ? [] : values.reasoning_efforts;
|
|
6
|
+
if (!levels.length) return Array.isArray(values.reasoning_efforts) || values.reasoning === false ? "unsupported" : "unknown";
|
|
7
|
+
const native = support.app && (support.app_contract?.status === "verified"
|
|
8
|
+
? Boolean(claudeNativeModelHint(values, support.app_contract))
|
|
9
|
+
: !support.app_contract && claudeEffortPrefix(values).length === levels.length);
|
|
10
|
+
return native ? "native" : "gateway";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function effortUnavailable() {
|
|
14
|
+
return Object.assign(new Error("The saved reasoning level is unavailable. Choose a declared level or follow the app."),
|
|
15
|
+
{ code: "ccdx_client_effort_unavailable", statusCode: 400 });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function messagesWithEffortDefault(body, effort, capability) {
|
|
19
|
+
if (!effort) return body;
|
|
20
|
+
const config = body.output_config;
|
|
21
|
+
if (config !== undefined && (!config || typeof config !== "object" || Array.isArray(config))) {
|
|
22
|
+
throw Object.assign(new Error("output_config must be an object"), { code: "ccdx_messages_invalid", statusCode: 400 });
|
|
23
|
+
}
|
|
24
|
+
if (config && Object.hasOwn(config, "effort")) return body;
|
|
25
|
+
const values = capability?.values || {};
|
|
26
|
+
if (values.reasoning === false || !Array.isArray(values.reasoning_efforts) || !values.reasoning_efforts.includes(effort)) throw effortUnavailable();
|
|
27
|
+
return { ...body, output_config: { ...config, effort } };
|
|
28
|
+
}
|
|
@@ -50,7 +50,8 @@ export function compileClientModels({ client, binding, source, enabled, names =
|
|
|
50
50
|
if (client === "claude_app" && explicit) entry.client_id = claudeDeploymentId(entry, route, { desktopEffortAliases });
|
|
51
51
|
const publicId = explicit ? entry.client_id : client === "codex" ? model.id : claudeModelEntries([entry], { desktopAliases: client === "claude_app" && provider.id.startsWith("api_") })[0].name;
|
|
52
52
|
entry.public_id = publicId;
|
|
53
|
-
const record = { provider, model: entry, source: item.source, upstreamModel: model.id, publicId
|
|
53
|
+
const record = { provider, model: entry, source: item.source, upstreamModel: model.id, publicId,
|
|
54
|
+
effortDefault: client === "claude_app" ? item.reasoning_effort : undefined };
|
|
54
55
|
if (routes.has(publicId)) throw Object.assign(new Error("Model routes collide"), { code: "ccdx_model_route_collision", statusCode: 503 });
|
|
55
56
|
routes.set(publicId, record);routes.set(route, record);
|
|
56
57
|
if (client === "claude_app" && explicit) for (const alias of claudeRouteAliases(entry, route, true).slice(2)) routes.set(alias, record);
|
|
@@ -6,6 +6,7 @@ import { compileClientModels, sourceModels } from "./client-model-plan.mjs";
|
|
|
6
6
|
import { deploymentModelId } from "./model-capabilities.mjs";
|
|
7
7
|
import { autoReviewReasoningEfforts } from "./models.mjs";
|
|
8
8
|
import { claudeSharedCapabilityPlan, inspectClaudeCapabilityConfiguration } from "./claude-capability-config.mjs";
|
|
9
|
+
import { effortUnavailable } from "./client-effort.mjs";
|
|
9
10
|
|
|
10
11
|
export function createConnectionPolicy({ validObject, binding, catalogRefresh, save, discoveries, getSettings, env, imageModels, enabled,
|
|
11
12
|
getSource, legacy, capabilitySupport, capabilitySupportForSync, plan, snapshot, options, permitted, sourceImpact }) {
|
|
@@ -178,6 +179,11 @@ export function createConnectionPolicy({ validObject, binding, catalogRefresh, s
|
|
|
178
179
|
names,
|
|
179
180
|
desktopEffortAliases: capabilitySupport.app && capabilitySupport.app_aliases !== false,
|
|
180
181
|
});
|
|
182
|
+
for (const item of c.deployments || []) if (item.reasoning_effort !== undefined) {
|
|
183
|
+
const previous = old.deployments?.find(value => value.source === item.source && value.model === item.model);
|
|
184
|
+
const values = compiled.models.find(model => model.source_id === item.source && model.id === item.model)?.capability?.values;
|
|
185
|
+
if (previous?.reasoning_effort !== item.reasoning_effort && (values?.reasoning === false || !values?.reasoning_efforts?.includes(item.reasoning_effort))) throw effortUnavailable();
|
|
186
|
+
}
|
|
181
187
|
if (c.default_model && !compiled.routes.has(c.default_model))
|
|
182
188
|
throw accessError("ccdx_api_model_unavailable");
|
|
183
189
|
c.default_model = compiled.routes.get(compiled.defaultModel)?.model.route_id || null;
|
package/src/connection-view.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { CLIENT_IDS, CLIENT_NAMES } from "./access-settings.mjs";
|
|
|
4
4
|
import { publicModelCatalog } from "./provider-metadata.mjs";
|
|
5
5
|
import { sourceModels, clientModelExclusion } from "./client-model-plan.mjs";
|
|
6
6
|
import { deploymentModelId, resolveModelCapabilities, deploymentRevision } from "./model-capabilities.mjs";
|
|
7
|
+
import { claudeEffortControl } from "./client-effort.mjs";
|
|
7
8
|
|
|
8
9
|
export function createConnectionView({ legacy, env, binding, plan, getSource, enabled, editable, modelDisplay, discoveries,
|
|
9
10
|
setup, credentialStates, lastClients, memoryModel, capabilitySupport, sharedSync, isManaged, getSettings, corePort, permitted }) {
|
|
@@ -55,6 +56,7 @@ export function createConnectionView({ legacy, env, binding, plan, getSource, en
|
|
|
55
56
|
public_id: model.public_id,
|
|
56
57
|
route_id: model.route_id,
|
|
57
58
|
capability: model.capability,
|
|
59
|
+
...(id === "claude_app" ? { effort_control: claudeEffortControl(model.capability, capabilitySupport), reasoning_effort: compiled.routes.get(model.public_id)?.effortDefault ?? null } : {}),
|
|
58
60
|
})),
|
|
59
61
|
unavailable: (config.clients[id].deployments || [])
|
|
60
62
|
.filter(
|
|
@@ -75,6 +77,7 @@ export function createConnectionView({ legacy, env, binding, plan, getSource, en
|
|
|
75
77
|
display_name: model.display_name || model.name || model.id,
|
|
76
78
|
route_id: deploymentModelId(source, model.id),
|
|
77
79
|
capability: model.capability || resolveModelCapabilities(model, { builtin: true }),
|
|
80
|
+
...(id === "claude_app" ? { effort_control: claudeEffortControl(model.capability || resolveModelCapabilities(model, { builtin: true }), capabilitySupport) } : {}),
|
|
78
81
|
}))
|
|
79
82
|
),
|
|
80
83
|
sync: sharedSync(),
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const words = (node, key, args) => globalThis.ccdxLanguage.set(node, key, args), format = key => globalThis.ccdxLanguage.format(key);
|
|
4
4
|
let data = null, editing = null, editingClient = null, disabling = null, models = [], selectedModels = new Set(), busy = false, generation = 0;
|
|
5
5
|
let claudeClient = "claude_app", bindingSelection = new Set(), bindingDefault = null, bindingImageModel = null, bindingImageDirty = false, bindingDirty = false;
|
|
6
|
+
let bindingEfforts = new Map();
|
|
6
7
|
let memoryAction = null, memoryOrigin = null;
|
|
7
8
|
let disableRevision = null;
|
|
8
9
|
const drafts = new Map();let editorOrigin = null, discovery = null, desiredSource = null;
|
|
@@ -389,7 +390,7 @@
|
|
|
389
390
|
const bindingKey = (source, model) => source + "\0" + model;
|
|
390
391
|
const routeId = item => item.route_id || item.public_id;
|
|
391
392
|
function rememberDraft() {
|
|
392
|
-
if (editingClient && bindingDirty) drafts.set(editingClient, { selection: new Set(bindingSelection), defaultModel: bindingDefault, imageModel: bindingImageModel, imageDirty: bindingImageDirty, autoSync: el("connection-auto-sync").checked });
|
|
393
|
+
if (editingClient && bindingDirty) drafts.set(editingClient, { selection: new Set(bindingSelection), efforts: new Map(bindingEfforts), defaultModel: bindingDefault, imageModel: bindingImageModel, imageDirty: bindingImageDirty, autoSync: el("connection-auto-sync").checked });
|
|
393
394
|
}
|
|
394
395
|
function mountClient(force = false) {
|
|
395
396
|
if (!data) return;
|
|
@@ -403,6 +404,7 @@
|
|
|
403
404
|
editingClient = id;const draft = drafts.get(id);bindingDirty = Boolean(draft);
|
|
404
405
|
const selected = Array.isArray(c.deployments) ? c.deployments : (c.model_plan?.models || []).map(model => ({ source: model.source, model: model.id }));
|
|
405
406
|
bindingSelection = draft ? new Set(draft.selection) : new Set(selected.map(item => bindingKey(item.source, item.model)));
|
|
407
|
+
bindingEfforts = draft ? new Map(draft.efforts || []) : new Map(selected.filter(item => item.reasoning_effort !== undefined).map(item => [bindingKey(item.source, item.model), item.reasoning_effort]));
|
|
406
408
|
bindingDefault = draft ? draft.defaultModel : c.default_model || c.model_plan?.models.find(model => model.public_id === c.model_plan?.default_model)?.route_id || null;
|
|
407
409
|
bindingImageModel = draft?.imageDirty ? draft.imageModel : c.image_model || c.model_plan?.image?.selected_model || null;
|
|
408
410
|
bindingImageDirty = draft?.imageDirty === true;
|
|
@@ -410,12 +412,13 @@
|
|
|
410
412
|
el("connection-sync-result").hidden = true;el("connection-client-note").textContent = "";
|
|
411
413
|
}
|
|
412
414
|
if (id === "codex" && !bindingImageDirty) bindingImageModel = c.image_model || c.model_plan?.image?.selected_model || null;
|
|
413
|
-
bindingRows(document.activeElement?.name === "binding-model" ? { kind: "selection", key: document.activeElement.value } : document.activeElement?.dataset.binding ? { kind: "default", key: document.activeElement.dataset.binding } : null);words(el("connection-client-title"), "cap_visible_model");list();
|
|
415
|
+
bindingRows(document.activeElement?.name === "binding-model" ? { kind: "selection", key: document.activeElement.value } : document.activeElement?.dataset.effortBinding ? { kind: "effort", key: document.activeElement.dataset.effortBinding } : document.activeElement?.dataset.binding ? { kind: "default", key: document.activeElement.dataset.binding } : null);words(el("connection-client-title"), "cap_visible_model");list();
|
|
414
416
|
}
|
|
415
417
|
function bindingRows(focus) {
|
|
416
418
|
memoryRender();
|
|
417
419
|
el("connection-client-cancel").disabled = !bindingDirty;
|
|
418
420
|
const body = el("connection-bindings"), c = client(editingClient);body.replaceChildren();
|
|
421
|
+
let effortControls = 0;
|
|
419
422
|
const available = c.model_plan?.available || [], availableKeys = new Set(available.map(item => bindingKey(item.source, item.id)));
|
|
420
423
|
const missing = [...bindingSelection].filter(key => !availableKeys.has(key)).map(key => { const [source, id] = key.split("\0"), saved = c.model_plan?.unavailable?.find(item => item.source === source && item.id === id);return { source, id, route_id: saved?.route_id, reason: saved?.reason, unavailable: true }; });
|
|
421
424
|
for (const item of [...available, ...missing]) {
|
|
@@ -438,6 +441,17 @@
|
|
|
438
441
|
if (item.unavailable) { const warning = node("span", undefined, "hint binding-unavailable");words(warning, item.reason ? "visibility_" + item.reason : "cap_model_unavailable");name.append(warning); }
|
|
439
442
|
const cell = node("td");cell.append(action);
|
|
440
443
|
const details = [node("td", source(item.source)?.name || item.source), node("td", count(capability.context_window)), node("td", reasoningText(capability))];
|
|
444
|
+
const levels = capability.reasoning === false ? [] : capability.reasoning_efforts || [];
|
|
445
|
+
if (editingClient === "claude_app" && (item.effort_control === "gateway" && levels.length || bindingEfforts.has(key))) {
|
|
446
|
+
const select = node("select"), follow = node("option");follow.value = "";words(follow, "cap_effort_follow");select.append(follow);
|
|
447
|
+
const saved = bindingEfforts.get(key);
|
|
448
|
+
if (saved && !levels.includes(saved)) { const option = node("option");option.value = saved;option.disabled = true;words(option, "cap_effort_unavailable", { effort: saved });select.append(option); }
|
|
449
|
+
for (const effort of levels) { const option = node("option", effort);option.value = effort;select.append(option); }
|
|
450
|
+
select.value = saved || "";select.dataset.effortBinding = key;select.setAttribute("aria-label", (item.display_name || item.id) + " · " + format("cap_reasoning"));
|
|
451
|
+
select.disabled = busy || Boolean(item.unavailable) || !bindingSelection.has(key);
|
|
452
|
+
select.addEventListener("change", () => { if (select.value) bindingEfforts.set(key, select.value);else bindingEfforts.delete(key);bindingDirty = true;rememberDraft();bindingRows({ kind: "effort", key }); });
|
|
453
|
+
details[2].replaceChildren(select);effortControls++;
|
|
454
|
+
}
|
|
441
455
|
details.forEach((cell, i) => cell.dataset.label = format(["source", "cap_context", "cap_reasoning"][i]));
|
|
442
456
|
row.append(name, ...details, cell);body.append(row);
|
|
443
457
|
}
|
|
@@ -463,9 +477,10 @@
|
|
|
463
477
|
: setup === "default_unavailable" ? "cap_default_unavailable" : "sync_not_configured";
|
|
464
478
|
globalThis.ccdxIcons.set(el("connection-setup-state"), syncKey, setup === "configured" ? "ok" : ["configuration_unavailable", "default_unavailable"].includes(setup) ? "warning" : "unavailable");
|
|
465
479
|
const capabilityNote = el("connection-capability-state");capabilityNote.hidden = !c.model_plan?.sync?.limitations?.some(item => item.code === "client_version_unknown");
|
|
480
|
+
el("connection-effort-note").hidden = !effortControls;
|
|
466
481
|
if (!capabilityNote.hidden) words(capabilityNote, "sync_capability_unverified");
|
|
467
482
|
words(clientForm.querySelector('button[type="submit"]'), el("connection-auto-sync").checked ? "cap_save_sync" : "api_save");
|
|
468
|
-
if (focus) { const selector = focus.kind === "selection" ? 'input[name="binding-model"]' : focus.kind === "image" ? 'input[name="binding-image-model"]' : 'button[data-binding]';[...body.querySelectorAll(selector)].find(input => (input.value || input.dataset.binding) === focus.key)?.focus(); }
|
|
483
|
+
if (focus) { const selector = focus.kind === "selection" ? 'input[name="binding-model"]' : focus.kind === "image" ? 'input[name="binding-image-model"]' : focus.kind === "effort" ? 'select[data-effort-binding]' : 'button[data-binding]';[...body.querySelectorAll(selector)].find(input => (input.dataset.effortBinding || input.value || input.dataset.binding) === focus.key)?.focus(); }
|
|
469
484
|
if (!body.children.length) { const row = node("tr"), cell = node("td");cell.colSpan = 5;words(cell, "cap_no_models");const link = node("a");link.href = "#models";words(link, "model_services");cell.append(" ", link);row.append(cell);body.append(row); }
|
|
470
485
|
}
|
|
471
486
|
function editClient(c) { location.hash = c.id === "codex" ? "codex" : "claude";if (c.id !== "codex") claudeClient = c.id;mountClient(true); }
|
|
@@ -485,7 +500,7 @@
|
|
|
485
500
|
return { operation: "image_model", id: "codex", model: bindingImageModel, client_revision: c.revision };
|
|
486
501
|
}
|
|
487
502
|
return { operation, id: c.id, enabled: true, allowed: c.allowed,
|
|
488
|
-
deployments: [...bindingSelection].map(key => { const [source, model] = key.split("\0");return { source, model }; }),
|
|
503
|
+
deployments: [...bindingSelection].map(key => { const [source, model] = key.split("\0");return { source, model, ...(editingClient === "claude_app" && bindingEfforts.has(key) ? { reasoning_effort: bindingEfforts.get(key) } : {}) }; }),
|
|
489
504
|
...(editingClient === "codex" && bindingImageModel ? { image_model: bindingImageModel } : {}),
|
|
490
505
|
default_model: bindingDefault, auto_sync: el("connection-auto-sync").checked };
|
|
491
506
|
}
|
package/src/dashboard/gemini.js
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
label.append(input,document.createTextNode(model.name));name.append(label);row.append(name);
|
|
42
42
|
for(const [key,value]of [['source','GitHub Copilot'],['cap_context',count(model.context_window)]]){const cell=document.createElement('td');cell.textContent=value;cell.dataset.label=language.format(key);row.append(cell)}
|
|
43
43
|
const efforts=document.createElement('td');efforts.dataset.label=language.format('cap_reasoning');
|
|
44
|
-
efforts.textContent=model.efforts.map(item=>item.effort).join(' / ');
|
|
44
|
+
efforts.textContent=model.efforts.map(item=>item.effort||'—').join(' / ');
|
|
45
45
|
row.append(efforts);list.append(row);
|
|
46
46
|
}
|
|
47
47
|
if(!state.models.length){const row=document.createElement('tr'),cell=document.createElement('td');cell.colSpan=4;language.set(cell,'gemini_no_models');row.append(cell);list.append(row)}
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
el('gemini-model-form').addEventListener('submit',event=>{event.preventDefault();if(dirty())void load('models',{models:draft})});
|
|
71
71
|
el('gemini-cancel').addEventListener('click',()=>{draft=null;notice=null;clear('gemini-note');render()});
|
|
72
72
|
el('gemini-open').addEventListener('click',()=>void load('open'));
|
|
73
|
-
el('gemini-refresh').addEventListener('click',()=>void load());
|
|
74
|
-
el('refresh').addEventListener('click',()=>{if(['#gemini','#models'].includes(location.hash))void load(location.hash==='#models'?'summary':
|
|
73
|
+
el('gemini-refresh').addEventListener('click',()=>void load('refresh'));
|
|
74
|
+
el('refresh').addEventListener('click',()=>{if(['#gemini','#models'].includes(location.hash))void load(location.hash==='#models'?'summary':'refresh')});
|
|
75
75
|
window.addEventListener('hashchange',()=>{if(['#gemini','#models'].includes(location.hash))void load(location.hash==='#models'?'summary':undefined)});
|
|
76
76
|
new MutationObserver(render).observe(document.documentElement,{attributes:true,attributeFilter:['lang']});
|
|
77
77
|
void load(location.hash==='#gemini'?undefined:'summary');
|
package/src/dashboard/index.html
CHANGED
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
<p id="connection-setup-state" class="client-sync-state" role="status" aria-live="polite"></p>
|
|
70
70
|
<p id="connection-capability-state" class="hint" hidden></p>
|
|
71
71
|
<div class="table-wrap"><table class="binding-table"><thead><tr><th data-i18n="model">Model</th><th data-i18n="source">Source</th><th data-i18n="cap_context">Context</th><th data-i18n="cap_reasoning">Reasoning</th><th data-i18n="cap_default">Default</th></tr></thead><tbody id="connection-bindings"></tbody></table></div>
|
|
72
|
+
<p id="connection-effort-note" class="hint" data-i18n="cap_effort_scope" hidden>Used only when the app omits a reasoning level.</p>
|
|
72
73
|
<div class="setting-row"><label for="connection-auto-sync" data-i18n="cap_auto_sync">Sync model settings</label><input id="connection-auto-sync" type="checkbox" role="switch" checked><span class="hint" data-i18n="cap_sync_scope">Preserves your manual settings.</span></div>
|
|
73
74
|
<div class="section-actions"><button type="submit" data-i18n="api_save">Save</button><button type="button" id="connection-client-cancel" data-i18n="cap_discard_changes">Discard changes</button><button type="button" id="connection-sync-preview" data-i18n="cap_sync_preview">Review sync</button></div>
|
|
74
75
|
<p id="connection-client-note" class="hint" role="status" aria-live="polite"></p>
|
|
@@ -365,6 +365,10 @@
|
|
|
365
365
|
"cap_visible_model": ["Available models", "可用模型"],
|
|
366
366
|
"cap_context": ["Context", "上下文"],
|
|
367
367
|
"cap_reasoning": ["Reasoning", "推理"],
|
|
368
|
+
"cap_effort_follow": ["Follow app", "跟随应用"],
|
|
369
|
+
"cap_effort_scope": ["Used only when the app omits a reasoning level.", "应用未指定档位时生效。"],
|
|
370
|
+
"cap_effort_unavailable": ["{effort} (unavailable)", "{effort}(已不可用)"],
|
|
371
|
+
"ccdx_client_effort_unavailable": ["The saved reasoning level is unavailable. Choose a declared level or follow the app.", "已保存的推理档位不可用,请选择支持的档位或跟随应用。"],
|
|
368
372
|
"cap_search": ["Search", "联网搜索"],
|
|
369
373
|
"cap_default": ["Default", "默认"],
|
|
370
374
|
"cap_set_default": ["Set default", "设为默认"],
|
package/src/http-transport.mjs
CHANGED
|
@@ -324,7 +324,7 @@ export function isAbortLikeError(err) {
|
|
|
324
324
|
|
|
325
325
|
export function abortErrorStatusCode(reason) {
|
|
326
326
|
if (reason === "request_body_timeout") return 408;
|
|
327
|
-
if (["responses_prepare_timeout", "messages_prepare_timeout", "upstream_timeout", "stream_handshake_timeout", "stream_idle_timeout"].includes(reason)) return 504;
|
|
327
|
+
if (["responses_prepare_timeout", "messages_prepare_timeout", "upstream_timeout", "stream_handshake_timeout", "stream_idle_timeout", "compaction_idle_timeout"].includes(reason)) return 504;
|
|
328
328
|
if (reason === "client_aborted" || reason === "client_closed") return 499;
|
|
329
329
|
return 502;
|
|
330
330
|
}
|
|
@@ -40,7 +40,7 @@ export function catalogCapabilities(model) {
|
|
|
40
40
|
max_tool_definitions: first(model.max_tool_definitions, window.max_tool_definitions),
|
|
41
41
|
reasoning: first(typeof caps.reasoning === "boolean" ? caps.reasoning : undefined, supports.reasoning),
|
|
42
42
|
reasoning_efforts: first(model.reasoning_efforts, supports.reasoning_effort),
|
|
43
|
-
input_modalities: first(model.input_modalities, caps.input_modalities, supports.vision ===
|
|
43
|
+
input_modalities: first(model.input_modalities, caps.input_modalities, typeof supports.vision === "boolean" ? supports.vision ? ["text", "image"] : ["text"] : undefined),
|
|
44
44
|
tools: first(supports.tools, supports.tool_calls), parallel_tools: supports.parallel_tool_calls, streaming: supports.streaming, mid_conversation_system: supports.mid_conversation_system,
|
|
45
45
|
structured_output: first(supports.structured_output, supports.structured_outputs), web_search: first(model.web_search, caps.web_search), thinking_modes: first(model.thinking_modes, caps.thinking_modes),
|
|
46
46
|
...Object.fromEntries(["reasoning_required", "reasoning_adaptive", "reasoning_budget_min", "reasoning_budget_max", "reasoning_format"].map(key => [key, first(model[key], caps[key])])),
|