codex-copilot-dx 1.4.3 → 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 +2 -0
- package/docs/ARCHITECTURE.md +4 -0
- package/docs/REFERENCE.md +8 -0
- package/package.json +1 -1
- package/src/access-settings.mjs +2 -1
- package/src/antigravity-handler.mjs +26 -11
- package/src/claude-gateway.mjs +6 -2
- package/src/cli-management.mjs +10 -2
- 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/index.html +1 -0
- package/src/dashboard/language.js +4 -0
- package/src/http-transport.mjs +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ On macOS, the optional Gemini integration adds compatible Copilot Gemini models
|
|
|
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
|
@@ -700,6 +700,8 @@ left unchanged. Ordinary accepted requests and streams bypass this adaptation.
|
|
|
700
700
|
|
|
701
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.
|
|
702
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
|
+
|
|
703
705
|
## Installation and release delivery
|
|
704
706
|
|
|
705
707
|
`release-install.mjs` is a standalone helper with built-in static imports, shared by the updater
|
|
@@ -1177,6 +1179,8 @@ The 1.3.13 native helper groups uncached short CPU sequences under the existing
|
|
|
1177
1179
|
|
|
1178
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.
|
|
1179
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
|
+
|
|
1180
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.
|
|
1181
1185
|
|
|
1182
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`
|
|
@@ -159,6 +161,10 @@ Verified newer contracts keep stable source-qualified model IDs. Both the native
|
|
|
159
161
|
|
|
160
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.
|
|
161
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
|
+
|
|
162
168
|
## API import and request validation
|
|
163
169
|
|
|
164
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.
|
|
@@ -820,6 +826,8 @@ The old external image provider, Qwen-specific generation/editing, `/mcp/image`,
|
|
|
820
826
|
| `CCDX_DISABLE_USAGE` | unset | Set to `1` to disable usage logging |
|
|
821
827
|
| `CCDX_SHUTDOWN_TIMEOUT_MS` | `5000` | Time to drain active HTTP connections before forcing shutdown |
|
|
822
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
|
+
|
|
823
831
|
## Usage logging
|
|
824
832
|
|
|
825
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");
|
|
@@ -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,
|
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-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."}`;
|
|
@@ -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/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
|
}
|