codex-copilot-dx 0.10.1 → 1.0.0

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 CHANGED
@@ -20,8 +20,8 @@ on `127.0.0.1:2026`, configures Codex, and opens the App. No client binary patch
20
20
  is needed. On Windows, open the App manually unless native prediction setup is
21
21
  enabled. In restricted Windows PowerShell, use `npm.cmd` to install and `ccdx.cmd` for the first launch, or run `ccdx.cmd doctor --fix`. Startup, updates and explicit repair remove only CCDX's exact npm-generated `.ps1` launchers so later calls can use `ccdx`. No install script, alias or policy change is added; custom launchers are preserved. npm's own script is untouched. The configured `dummy` API key is a placeholder, not a credential.
22
22
 
23
- Open [the local dashboard](http://127.0.0.1:2026/) for status, model discovery,
24
- usage, cache/limits, recent failures, request context and animation settings. First output uses **ms**; estimated output speed uses **token/s**. Inference HTTP failures are retained separately from route and MCP-method errors.
23
+ Open [the local dashboard](http://127.0.0.1:2026/) for status, model discovery, usage, cache/limits, recent failures, request context and animation settings. First output uses **ms**; estimated output speed uses **token/s**. Inference HTTP failures are retained separately from route and MCP-method errors.
24
+ Provider tabs browse sources without changing routing. Separate disclosures show authorization, clients, resources and optional capabilities. Saved credentials and catalog listings do not prove inference access; historical sources remain filterable.
25
25
  Auto refresh runs every 30 minutes while visible and can be switched off. Hidden pages pause; opening sections and manual refresh still work. The atom rotates once on page load and manual refresh, respecting reduced motion. Startup uses a compact six-line atom and aligned checks; `Ready` refers to the core service. Narrow/non-color terminals use a plain title.
26
26
 
27
27
  ## Commands
@@ -39,7 +39,7 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
39
39
  | `ccdx auth status` | Saved account; add `--online` to verify access |
40
40
  | `ccdx models` | Fresh upstream model list |
41
41
  | `ccdx usage` | Recorded tokens and upstream prompt-cache hit rate |
42
- | `ccdx usage --provider github` / `m365` | Separate source-specific usage |
42
+ | `ccdx usage --provider ID` | Filter current or historical source-specific usage |
43
43
  | `ccdx m365 status` / `models` | M365 authorization, Claude gateway and Claude models |
44
44
  | `ccdx m365 switch` | Choose the Codex source; default remains GitHub |
45
45
  | `ccdx m365 on` / `off` / `remove` | Enable discovery, restore owned client settings, or remove owned M365 state |
@@ -62,6 +62,7 @@ device policy and Loki entitlement must permit access. Optional failure does not
62
62
 
63
63
  Claude clients use the separate, keyed `127.0.0.1:2027` gateway and Claude-only catalog.
64
64
  Existing custom/managed settings are preserved; already-running clients may need a normal restart.
65
+ Canonical Claude IDs and advertised effort caps refresh only in unchanged CCDX-owned settings. User and managed choices are preserved; supported App versions can update model knowledge through Anthropic's signed catalog. New protocol semantics may require a client or CCDX update. See the [model reference](docs/REFERENCE.md#claude-gateway-and-client-ownership).
65
66
  `ccdx m365 off` restores unchanged owned fields; `remove` also clears owned M365 state.
66
67
 
67
68
  Codex stays on GitHub until `ccdx m365 switch`. Select available GPT/review models;
@@ -9,7 +9,7 @@ Client integration, image tools and the dashboard are not a general plugin frame
9
9
  | Core inference | `adapter.mjs`, Responses modules, model catalog, history | Codex wire contracts, streaming and recovery |
10
10
  | Providers | `providers/github.mjs`, `providers/m365*.mjs` | Source-owned auth, discovery, routing, capabilities and transport |
11
11
  | Provider composition | `provider-runtime.mjs`, `provider-settings.mjs` | Explicit selection, lifecycle, history namespaces and snapshots |
12
- | Claude clients | `claude-gateway.mjs`, `claude-client-config.mjs` | Native Messages relay and field-owned reversible client setup |
12
+ | Claude clients | `claude-gateway.mjs`, `claude-client-config.mjs`, `claude-models.mjs` | Native Messages relay and field-owned reversible client setup |
13
13
  | Client integration | `client-integration.mjs`, Codex config, native prediction | Client setup, optional start/stop, diagnostic snapshots |
14
14
  | Optional images | Image provider, CLI setup, image MCP and skill | Opt-in API access and image delivery; failures do not block core startup |
15
15
  | Management | CLI, dashboard, observability, package updates | Bounded metadata and explicit user actions |
@@ -250,14 +250,32 @@ settlement for two seconds; no successful plaintext cache or transcript index ex
250
250
 
251
251
  ## Dashboard reads
252
252
 
253
- `dashboard/refresh.js` owns the browser-only read lifecycle: one visible-page
254
- timer, per-group in-flight deduplication, attempt freshness, cancellation and
255
- last-good snapshots. `ui.js` composes the controls and refresh resources;
256
- `status.js` owns status/failure rendering, and `usage.js` owns usage rendering
257
- and date selection. Their state stays page-local. Models, usage,
258
- status/account and animation metadata remain independent resources; no timer
259
- or data watcher is added to the Node service. Animation frames load once per
260
- page when opened, and read refresh does not overwrite an unsaved choice.
253
+ `provider-runtime.mjs` composes read-only Provider descriptors separately from
254
+ source-selection actions. `provider-metadata.mjs` projects bounded model metadata
255
+ without transport or credential dependencies. `dashboard-api.mjs` sanitizes public
256
+ fields and keeps local credential validity separate from authorization evidence.
257
+ A requested catalog Provider must be registered; unavailable sources never fall
258
+ through to another source. The unchanged CLI model selector retains its GPT scope.
259
+
260
+ `dashboard/refresh.js` owns one visible-page timer, in-flight deduplication,
261
+ freshness, cancellation and last-good snapshots. `ui.js` generates Provider tabs
262
+ and source filters from descriptors and retained history, with per-tab snapshots
263
+ invalidated on profile generation/account changes. It cancels obsolete reads and
264
+ prevents stale apply across tabs. `status.js` renders source-neutral authorization
265
+ and client evidence; `usage.js` renders usage and date selection. View state remains
266
+ page-local; only existing preferences and the viewed model Provider are saved in
267
+ the browser. Expanded sections read on demand. There is no Node data watcher or
268
+ new poller. Animation frames still load once per page when opened.
269
+
270
+ `claude-models.mjs` owns exact ID spelling and capability-cap projection shared by
271
+ configuration and model discovery. M365 resolves both canonical and existing raw
272
+ IDs to the same catalog entry and checks explicit effort lists without modifying
273
+ signed blocks. Successful refreshes schedule a coalesced client reconciliation;
274
+ it checks current lifecycle/profile after policy inspection, preserves ownership
275
+ and does not write in the inference serialization path. The Messages gateway uses
276
+ its injected Provider ID for diagnostics/usage. App model knowledge remains under
277
+ Anthropic's signed catalog and installed-client protocol, with its existing policy.
278
+
261
279
  `upstream-body.mjs` is the shared bounded response reader. The transport retains
262
280
  its existing exports; live model lookup uses the same 8 MiB catalog limit as
263
281
  core model discovery, without importing the request lifecycle or UI layer.
package/docs/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Documentation index
2
2
 
3
+ - [1.0.0: Provider dashboard and Claude effort adaptation](RELEASE_1.0.0.md)
4
+
3
5
  The [root README](../README.md) is the quick start; the [command/configuration
4
6
  reference](REFERENCE.md) preserves complete current behavior and limits. `ccdx --help` and
5
7
  `ccdx <command> --help` describe the installed package's CLI. Code and tests
package/docs/REFERENCE.md CHANGED
@@ -70,15 +70,17 @@ Codex source and M365 review choices live separately in
70
70
  GitHub auth/cache/preferences, Codex auth, prediction trust and image keys are not
71
71
  copied into the M365 profile. The system's Microsoft SSO account is never deleted.
72
72
 
73
- M365 catalogs refresh at startup and on the existing background model interval.
74
- Request-time catalog reads use the account-bound cache, trigger refresh after two
75
- hours and reject disk caches older than seven days. `ccdx models`, Auto-review's
76
- selector and dashboard models follow the selected Codex source. Under M365 they
77
- use the running provider's catalog, labeled as a catalog rather than a fresh
78
- per-command GitHub lookup. Disabled/hidden models and wrong publisher/protocol
79
- families are not exposed. A catalog listing is not proof that inference will pass
80
- quota or policy checks. M365 Fast is unverified and `priority` requests fail
81
- explicitly; choose Standard. This does not change GitHub Fast behavior.
73
+ M365 catalogs refresh at startup and on explicit lookups. Existing model-list
74
+ reads and Claude Messages traffic start a background refresh after two hours;
75
+ disk caches older than seven days are rejected. `ccdx models` and Auto-review's
76
+ selector follow the selected Codex source. Dashboard tabs query a registered
77
+ Provider independently of that selection; M365 uses a fresh provider catalog
78
+ lookup and labels the returned catalog timestamp. Its disabled/hidden or
79
+ ineligible models remain visible as directory metadata, with no eligible client.
80
+ Client discovery and request validation still exclude wrong publishers/protocols
81
+ and disabled/hidden models. A listing does not prove inference access or quota.
82
+ M365 Fast is unverified and `priority` requests fail explicitly; choose Standard.
83
+ GitHub Fast behavior is unchanged.
82
84
 
83
85
  M365 Auto-review has its own required model choice and defaults to low reasoning.
84
86
  `ccdx auto-review-model` changes that provider's model/effort without touching the
@@ -108,6 +110,33 @@ breakpoint positions, tool input, thinking and approval settings do not change.
108
110
  This is a retention/cost limitation of the new M365 path, not an equivalent
109
111
  one-hour cache guarantee. GitHub caching is unchanged.
110
112
 
113
+ The gateway publishes canonical Claude version IDs such as `claude-opus-5-5`,
114
+ while M365 receives its exact `claude-opus-5.5` ID. Existing raw IDs are still
115
+ accepted. Only exact supported family/version spellings are normalized; alias
116
+ collisions fail explicitly. Bodies, thinking signatures and native response bytes
117
+ remain intact apart from the existing cache-TTL policy and the upstream model ID.
118
+
119
+ `capabilities.supports.reasoning_effort` supplies deployment-specific effort
120
+ metadata. App `inferenceModels` entries receive the highest recognized advertised
121
+ `maxEffort`; Code discovery receives canonical IDs. A successful catalog refresh
122
+ reconciles unchanged owned fields outside inference serialization. An owned legacy
123
+ Code default can migrate to its matching canonical ID; valid user model/effort
124
+ preferences are preserved. Reads after a profile change invalidate page catalogs.
125
+ Unknown metadata stays unknown. Unknown effort names remain visible as upstream
126
+ metadata and are not invented as App caps. When an explicit effort list exists,
127
+ requests for absent efforts fail before inference, without dropping the field or
128
+ substituting a lower level. Missing metadata leaves the upstream authoritative.
129
+
130
+ App effort controls also depend on its model knowledge. Supported versions can
131
+ read Anthropic's signed catalog under the App's existing network and management
132
+ policy; CCDX neither replaces that signed document nor changes its URL/policy.
133
+ `maxEffort` is a ceiling, not an arbitrary discrete allowlist: client-visible
134
+ options may differ from an upstream's sparse list, while exact request validation
135
+ remains authoritative. Unknown model identities or new protocol semantics can
136
+ still need a client or CCDX update. A displayed control alone is not an inference
137
+ verification. See [Claude model configuration](https://claude.com/docs/third-party/claude-desktop/configuration)
138
+ and [gateway behavior](https://code.claude.com/docs/en/llm-gateway-protocol).
139
+
111
140
  For Claude Code, CCDX owns only its gateway environment fields in
112
141
  `CLAUDE_CONFIG_DIR/settings.json` or `~/.claude/settings.json`. For Claude App it
113
142
  uses the installed client's third-party config library, with one named
@@ -995,7 +1024,44 @@ JSON reply to a streaming request is still not silently converted to SSE.
995
1024
 
996
1025
  After starting `ccdx`, open [http://127.0.0.1:2026/](http://127.0.0.1:2026/) in a browser. If `ADAPTER_PORT` is customized, use that port instead. The dashboard shares the existing adapter listener; CCDX does not open a browser automatically or start another service. The page and its assets require both a loopback connection and a loopback Host header, even when LAN binding is enabled.
997
1026
 
998
- The dashboard loads local status, a live GitHub Copilot model directory, and a summary of local usage metadata once when opened. The top Refresh updates status/account and expanded data groups; model and usage sections retain their own Refresh controls. Auto refresh is on by default, saved only in this browser, and updates status/account plus expanded groups every 30 minutes while the page is visible. Opening a data section updates its group unless it was attempted within 30 seconds. Hidden pages pause; returning after 30 minutes catches up once, without replaying missed intervals. Turning automatic updates off retains manual and open-section refresh. No server background task is added. In-flight reads are shared per group; failures retain the prior snapshot and success timestamp. Unchanged model rows and charts are retained rather than rebuilt. The appearance button switches between the default dark terminal theme (sun icon) and a light theme (moon icon); the choice is stored only in that browser. The Requests card shows the running adapter's active raw and decoded per-request body limits, not request-body usage; Local History shows its in-memory Responses history use and active limit. Limit changes remain CLI-only (`ccdx limits` and `ccdx cache`). The live model table uses the same fresh account validation and selectable GPT filtering as `ccdx models`, never labels cached fallback data as online, and makes no inference request. A catalog listing does not guarantee inference access. The Model Usage table combines the current and rotated local usage logs, shows totals and up to 100 model rows, and contains no prompt, response body, or credential fields. The animation selector previews the existing themes and saves through the same settings writer as `ccdx animation`; changes take effect on the next adapter start, and `CCDX_TERMINAL_ANIMATION=off` still disables terminal motion. Dashboard data requests require a custom header that cross-site simple requests cannot send; animation writes also require a matching same-origin `Origin`. The dashboard does not initialize the optional image handler. The overview's known-model count is the adapter's current in-memory catalog, not the live table. A missing image-generation status does not prove the feature is disabled: use `ccdx image-status` to check setup. Recent upstream error prose may contain sensitive details, so review the page before sharing screenshots.
1027
+ The dashboard reads local runtime/Provider snapshots and local usage metadata.
1028
+ Account Authorization lists saved identity, authorization evidence, service state,
1029
+ last successful token acquisition and TTL where known. GitHub local credential
1030
+ validity is labeled saved, never online entitlement. Client Connections separately
1031
+ shows configuration, gateway state, observed requests and Codex native prediction.
1032
+ Runtime Resources retains Responses outcomes/timing and local history; Additional
1033
+ Capabilities retains optional image status. Codex model/request overview counts
1034
+ are scoped to the Codex surface; Claude request counters remain separately labeled.
1035
+
1036
+ Model Catalog tabs come from the backend Provider descriptors. Selecting a tab
1037
+ only selects a read resource, not the inference route. GitHub's dashboard view
1038
+ includes upstream directory entries beyond selectable Codex GPT models; the CLI's
1039
+ existing GPT filtering is unchanged. Rows show protocol, eligible clients,
1040
+ upstream-advertised reasoning and directory state. An unknown field is displayed
1041
+ as unknown, not unsupported. A directory listing is not inference verification.
1042
+ The header count is the active Codex in-memory catalog, not a sum of tab results.
1043
+ The usage selector combines registered Providers and retained historical sources.
1044
+ Mixed-source model rows and combined daily analytics retain source identity;
1045
+ source-filtered views show model names within that source. Legacy untagged records
1046
+ remain GitHub records. Current and rotated logs remain bounded metadata reads.
1047
+
1048
+ Top Refresh updates local status/Provider evidence and expanded data groups.
1049
+ Auto refresh is browser-local, defaults on and runs every 30 minutes while visible.
1050
+ Opening a data section updates its group unless attempted within 30 seconds;
1051
+ hidden pages pause and returning catches up once. In-flight reads are deduplicated;
1052
+ tab changes cancel obsolete page requests and reject late responses. Each tab
1053
+ retains only its own last-good catalog; account/generation changes discard it.
1054
+ Errors preserve the successful timestamp and mark the read as failed. Provider
1055
+ lookups never enable a disabled source or open an interactive login. No server
1056
+ poller, event bus, extra inference call or runtime dependency is added.
1057
+
1058
+ Dark/light themes, English/Chinese, reduced motion and unsaved animation choices
1059
+ are retained. Provider tabs support keyboard navigation. Data requests require the
1060
+ same loopback address/Host and custom dashboard header; animation writes also
1061
+ require a matching Origin. The page cannot switch Providers or manage credentials.
1062
+ Limit changes remain CLI-only. The dashboard does not initialize images; unknown
1063
+ image status still requires `ccdx image-status`. Review diagnostics before sharing
1064
+ screenshots: upstream error prose may contain sensitive details.
999
1065
 
1000
1066
  The dashboard labels the upstream token cache hit metric **Reuse Rate** and cached input **Reused Input**, separate from **Local History**. Chinese uses short functional names such as “对话暂存”, “重用输入” and “重用比例”. English and Chinese preserve model IDs, commands, units, HTTP status codes and raw diagnostic values. Animation display names translate in place; theme IDs and CLI parameters do not change.
1001
1067
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "0.10.1",
4
- "description": "Use Codex App with GitHub Copilot",
3
+ "version": "1.0.0",
4
+ "description": "Local Codex adapter and optional Microsoft 365 Claude gateway",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
7
7
  "bin": {
package/src/adapter.mjs CHANGED
@@ -167,7 +167,8 @@ export function createAdapterHandler(options = {}) {
167
167
  const responseFailures = options.responseFailures || createResponseFailureDiagnostics();
168
168
  const httpErrors = createHttpFailureDiagnostics();
169
169
  const optionalRoutes = createOptionalRoutes({ ...options, dashboardOptions: { ...options.dashboardOptions,
170
- ...(options.providerRuntime ? { providerCatalogFn: () => options.providerRuntime.dashboardCatalog() } : {}) } });
170
+ ...(options.providerRuntime ? { providerCatalogFn: input => options.providerRuntime.dashboardCatalog(input),
171
+ providerStateFn: () => options.providerRuntime.dashboardProviders() } : {}) } });
171
172
  const managementHandler = createManagementHandler({
172
173
  nativePredictionPac: options.nativePredictionPac, fixPrediction: options.fixPrediction, requestBodyTimeoutMs,
173
174
  statusSnapshot: () => {
@@ -8,6 +8,7 @@ import { readBoundedFileSync } from "./bounded-file.mjs";
8
8
  import { atomicWriteFileSync } from "./atomic-file.mjs";
9
9
  import { withFileLockSync } from "./lock.mjs";
10
10
  import { m365Paths, readM365Json, writeM365Json } from "./m365-settings.mjs";
11
+ import { claudeClientModelId, claudeModelEntries } from "./claude-models.mjs";
11
12
 
12
13
  export const M365_CLAUDE_PROFILE_ID = "00000000-0000-4000-8000-000000202700";
13
14
  const M365_CLAUDE_PROFILE_NAME = "CCDX Microsoft 365";
@@ -152,7 +153,8 @@ function reconcile(operations, { restore = false, ...options } = {}) {
152
153
  }
153
154
 
154
155
  export function configureClaudeClients({ baseUrl, apiKey, models, desktopInstalled, desktopManaged, ...options } = {}) {
155
- const paths = claudeClientPaths(options), ids = models.map(model => model.id), operations = [], result = {};
156
+ const entries = claudeModelEntries(models);
157
+ const paths = claudeClientPaths(options), ids = entries.map(model => model.name), operations = [], result = {};
156
158
  const endpoint = new URL(baseUrl);
157
159
  if (endpoint.protocol !== "http:" || endpoint.hostname !== "127.0.0.1" || endpoint.pathname !== "/" || endpoint.search || endpoint.hash || endpoint.username || endpoint.password) throw new Error("Claude gateway must use a local root URL");
158
160
  const add = (file, keys, value, itemId) => operations.push({ file, keys, value, ...(itemId ? { itemId } : {}) });
@@ -175,7 +177,10 @@ export function configureClaudeClients({ baseUrl, apiKey, models, desktopInstall
175
177
  add(paths.code, ["env", "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"], "1");
176
178
  if (env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS === undefined) add(paths.code, ["env", "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS"], "1");
177
179
  add(paths.code, ["env", "ANTHROPIC_CUSTOM_HEADERS"], "X-CCDX-Client: claude-code");
178
- if (!codeEnv.ANTHROPIC_MODEL && ids.length) add(paths.code, ["env", "ANTHROPIC_MODEL"], ids[0]);
180
+ if (ids.length && (!codeEnv.ANTHROPIC_MODEL || models.some(model => model.id === codeEnv.ANTHROPIC_MODEL))) {
181
+ const index = models.findIndex(model => model.id === codeEnv.ANTHROPIC_MODEL);
182
+ add(paths.code, ["env", "ANTHROPIC_MODEL"], ids[Math.max(0, index)]);
183
+ }
179
184
  result.code = "configured";
180
185
  }
181
186
  const installed = desktopInstalled ?? (fs.existsSync(path.dirname(paths.normal)) || fs.existsSync(path.dirname(paths.threep))
@@ -195,7 +200,14 @@ export function configureClaudeClients({ baseUrl, apiKey, models, desktopInstall
195
200
  add(paths.profile, ["inferenceGatewayBaseUrl"], baseUrl);
196
201
  add(paths.profile, ["inferenceGatewayApiKey"], apiKey);
197
202
  add(paths.profile, ["inferenceGatewayAuthScheme"], "bearer");
198
- add(paths.profile, ["inferenceModels"], JSON.stringify(ids));
203
+ let previousModels = [];
204
+ try { previousModels = JSON.parse(profile.inferenceModels || "[]"); } catch { /* Ownership reconciliation preserves a user-modified field. */ }
205
+ const order = new Map((Array.isArray(previousModels) ? previousModels : []).map((entry, index) => {
206
+ const name = typeof entry === "string" ? entry : entry?.name;
207
+ return [typeof name === "string" ? claudeClientModelId(name) : "", index];
208
+ }));
209
+ const orderedEntries = [...entries].sort((left, right) => (order.get(left.name) ?? Infinity) - (order.get(right.name) ?? Infinity));
210
+ add(paths.profile, ["inferenceModels"], JSON.stringify(orderedEntries));
199
211
  add(paths.profile, ["inferenceCustomHeaders"], JSON.stringify({ "X-CCDX-Client": "claude-app" }));
200
212
  add(paths.meta, ["entries"], { id: M365_CLAUDE_PROFILE_ID, name: M365_CLAUDE_PROFILE_NAME }, M365_CLAUDE_PROFILE_ID);
201
213
  add(paths.meta, ["appliedId"], M365_CLAUDE_PROFILE_ID);
@@ -1,3 +1,5 @@
1
+ import { isProviderId } from "./provider-metadata.mjs";
2
+ import { claudeModelEntries } from "./claude-models.mjs";
1
3
  import http from "node:http";
2
4
  import { randomUUID, timingSafeEqual } from "node:crypto";
3
5
  import { createRequestAbort, readJsonBody, readBoundedResponseText, writeOrDrain, MAX_UPSTREAM_ERROR_BODY_BYTES } from "./http-transport.mjs";
@@ -55,7 +57,7 @@ export function createMessagesObserver(onEvent, maxBytes = 8 * 1024 * 1024) {
55
57
 
56
58
  export function createClaudeGatewayHandler({ provider, apiKey, log = () => {}, onRequest = () => {}, env = process.env,
57
59
  record = recordUsage, acquireRequest = createRequestAdmission({ maxBytes: 16 * 1024 * 1024, maxQueued: 8 }) } = {}) {
58
- if (!provider || typeof apiKey !== "string" || apiKey.length < 32) throw new Error("Claude gateway requires a provider and private local key");
60
+ if (!provider || !isProviderId(provider.id) || typeof apiKey !== "string" || apiKey.length < 32) throw new Error("Claude gateway requires a provider and private local key");
59
61
  const config = loadRuntimeConfig(env), performance = createStreamPerformanceMetrics({ routeNames: ["messages"] });
60
62
  const decodedLimit = decodedBodyLimitPreference({ env }).bytes;
61
63
  const stats = { total: 0, active: 0, completed: 0, incomplete: 0, failed: 0, cancelled: 0, last_request_at: null, last_model: null };
@@ -65,19 +67,23 @@ export function createClaudeGatewayHandler({ provider, apiKey, log = () => {}, o
65
67
  if (!authenticated(req.headers, apiKey)) { send(res, 401, apiError("ccdx_gateway_auth", "Invalid local gateway credential"));return; }
66
68
  let pathname;try { pathname = new URL(req.url, "http://localhost").pathname; } catch { send(res, 400, apiError("ccdx_invalid_path", "Invalid request path"));return; }
67
69
  if (req.method === "GET" && pathname === "/v1/models") {
68
- const models = provider.models("claude").map(model => ({ id: model.id, type: "model", display_name: typeof model.name === "string" && model.name || model.id }));
69
- send(res, 200, { data: models, has_more: false, first_id: models[0]?.id || null, last_id: models.at(-1)?.id || null });return;
70
+ try {
71
+ const entries = provider.models("claude");
72
+ const models = claudeModelEntries(entries).map((entry, index) => ({ id: entry.name, type: "model", display_name: typeof entries[index].name === "string" && entries[index].name || entry.name }));
73
+ send(res, 200, { data: models, has_more: false, first_id: models[0]?.id || null, last_id: models.at(-1)?.id || null });
74
+ } catch (error) { send(res, 503, apiError(error.code || "ccdx_catalog_unavailable", "Claude model discovery is unavailable; refresh the provider catalog.")); }
75
+ return;
70
76
  }
71
77
  if (!["/v1/messages", "/v1/messages/count_tokens"].includes(pathname)) { send(res, 404, apiError("ccdx_not_found", "Not found"));return; }
72
78
  if (req.method !== "POST") { send(res, 405, apiError("ccdx_method", "Use POST"));return; }
73
79
  if (!/^application\/json(?:\s*;|$)/i.test(req.headers["content-type"] || "")) { send(res, 415, apiError("ccdx_media_type", "Expected application/json"));return; }
74
80
  const countTokens = pathname.endsWith("/count_tokens"), requestId = randomUUID();
75
81
  const tracker = countTokens ? null : performance.begin("messages", { requestId });
76
- tracker?.setProvider("m365");
82
+ tracker?.setProvider(provider.id);
77
83
  const abort = createRequestAbort(req, res);
78
84
  let release = () => {}, outcome = "failed", model = null, responseId = null, usage = null, stopReason = null, streamed = false, sawStop = false, failedEvent = false;
79
85
  if (!countTokens) { stats.total++;stats.active++;stats.last_request_at = new Date().toISOString(); }
80
- await runWithRequestContext({ requestId, provider: "m365", route: "messages", streamPerformance: tracker }, async () => {
86
+ await runWithRequestContext({ requestId, provider: provider.id, route: "messages", streamPerformance: tracker }, async () => {
81
87
  try {
82
88
  release = await acquireRequest(req, { signal: abort.signal });
83
89
  abort.setTimeout(config.requestBodyTimeoutMs, "request_body_timeout");
@@ -143,7 +149,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, log = () => {}, o
143
149
  tracker?.terminal(outcome, { origin: failedEvent ? "upstream_event" : "upstream_response", reason: stopReason === "max_tokens" ? "max_output_tokens" : undefined });
144
150
  tracker?.finish({ failed: outcome === "failed" || outcome === "cancelled", aborted: outcome === "cancelled", statusCode: res.statusCode });
145
151
  const client = req.headers["x-ccdx-client"] === "claude-app" ? "claude_app" : req.headers["x-ccdx-client"] === "claude-code" ? "claude_code" : "claude";
146
- try { void Promise.resolve(record(buildMessagesUsageRecord({ model, responseId, usage, mode: streamed ? "stream" : "json", client }))).catch(() => {}); } catch {}
152
+ try { void Promise.resolve(record(buildMessagesUsageRecord({ model, responseId, usage, mode: streamed ? "stream" : "json", client, provider: provider.id }))).catch(() => {}); } catch {}
147
153
  }
148
154
  }
149
155
  });
@@ -0,0 +1,26 @@
1
+ import { modelReasoningEfforts } from "./provider-metadata.mjs";
2
+
3
+ const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
4
+
5
+ // M365's version separator differs from Anthropic's model ID spelling. Other
6
+ // aliases and unknown families are kept verbatim, never assigned another model.
7
+ export function claudeClientModelId(id) {
8
+ return id.replace(/^(claude-(?:opus|sonnet|haiku)-\d+)\.(\d+)$/, "$1-$2");
9
+ }
10
+
11
+ export function claudeModelEntries(models) {
12
+ const ids = new Set();
13
+ return models.map(model => {
14
+ const name = claudeClientModelId(model.id);
15
+ if (ids.has(name)) throw Object.assign(new Error("Claude model aliases collide; refresh the provider catalog"), { code: "claude_model_alias_collision", statusCode: 503 });
16
+ ids.add(name);
17
+ const advertised = modelReasoningEfforts(model);
18
+ const maxEffort = EFFORTS.filter(value => advertised?.includes(value)).at(-1);
19
+ return { name, ...(maxEffort ? { maxEffort } : {}) };
20
+ });
21
+ }
22
+
23
+ export function resolveClaudeModel(models, id) {
24
+ claudeModelEntries(models); // Refuse ambiguous catalogs, including exact-ID collisions.
25
+ return models.find(model => model.id === id || claudeClientModelId(model.id) === id);
26
+ }
@@ -1,3 +1,4 @@
1
+ import { isProviderId } from "./provider-metadata.mjs";
1
2
  import { MAX_TIMER_DELAY_MS } from "./runtime-config.mjs";
2
3
 
3
4
  const HELP_COMMANDS = new Set(["help", "--help", "-h"]);
@@ -167,7 +168,7 @@ export function parseCliArgs(args = []) {
167
168
  }
168
169
  if (command === "usage") {
169
170
  const options = parseOptions(rest, new Map([["--format", "value"], ["--provider", "value"]]));
170
- if (options["--provider"] && !["github", "m365"].includes(options["--provider"])) throw new Error("Usage provider must be github or m365");
171
+ if (options["--provider"] && !isProviderId(options["--provider"])) throw new Error("Usage provider must be a valid provider ID");
171
172
  return baseCommand("usage", { ...outputFormatOption(options["--format"]), ...(options["--provider"] ? { provider: options["--provider"] } : {}) });
172
173
  }
173
174
  if (command === "cache") {
@@ -382,7 +383,7 @@ function topicHelp(name, topic) {
382
383
  "doctor config": `Usage:\n ${name} doctor config\n\nReads ~/.codex/config.toml, checks TOML syntax and CCDX-managed settings, and previews the existing startup writer's changes. Does not merge Codex profiles or validate the complete installed Codex schema. No authentication, network requests, file writes, or adapter/GUI startup. Existing context_management=false is valid. Exit 1 for errors, 0 for OK/warnings; unsupported arguments exit 2.`,
383
384
  status: `Usage:\n ${name} status\n\nShows bounded runtime, routing, performance, queue, and cache metrics from a running adapter.`,
384
385
  models: `Usage:\n ${name} models [--format table|plain]\n\nShows GPT models for the selected Codex provider. GitHub performs a fresh read-only lookup; M365 uses its isolated catalog in the running service. Interactive terminals use a table by default.`,
385
- usage: `Usage:\n ${name} usage [--format table|plain] [--provider github|m365]\n\nSummarizes local token usage metadata without reading prompt or completion content. Optional provider filtering separates sources; default totals include both. Interactive terminals use a table by default.`,
386
+ usage: `Usage:\n ${name} usage [--format table|plain] [--provider ID]\n\nSummarizes local token usage metadata without reading prompt or completion content. Optional provider filtering separates sources; default totals include all recorded sources. Interactive terminals use a table by default.`,
386
387
  cache: `Usage:\n ${name} cache\n ${name} cache --limit <MiB|default>\n ${name} cache --clean [--history] [--yes]\n\nShows runtime cache use, saves and applies the shared response-history limit, or clears the rebuildable image-transform cache. --history also clears in-memory response history for all tasks and can make their next continuation fail, so interactive confirmation or --yes is required. Generated image files and saved Codex transcripts are never deleted. Short aliases: -128 sets 128 MiB and -clean equals --clean.`,
387
388
  limits: `Usage:\n ${name} limits\n ${name} limits --decoded <MiB|default>\n\nShows configured and running request-body limits, or saves a decoded request-body limit from 128 to 512 MiB. The raw-body limit is unchanged. Restart ccdx to apply a saved change; no conversation or cache is cleared. Short alias: -256 sets 256 MiB.`,
388
389
  animation: `Usage:\n ${name} animation\n\nPreviews all terminal activity animations together and selects the theme used the next time the adapter starts.`,
@@ -410,7 +411,7 @@ export function cliHelp(commandName = "ccdx", topic = "") {
410
411
  ${name} doctor config
411
412
  ${name} status
412
413
  ${name} models [--format table|plain]
413
- ${name} usage [--format table|plain] [--provider github|m365]
414
+ ${name} usage [--format table|plain] [--provider ID]
414
415
  ${name} cache [--limit <MiB|default> | --clean [--history] [--yes]]
415
416
  ${name} limits [--decoded <MiB|default>]
416
417
  ${name} animation
@@ -24,47 +24,26 @@
24
24
  <main>
25
25
  <section class="intro">
26
26
  <h1><svg id="status-icon" class="status-icon" viewBox="0 0 64 64" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><ellipse cx="32" cy="32" rx="26" ry="10"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(60 32 32)"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(120 32 32)"/></g><circle cx="32" cy="32" r="4.5" fill="currentColor"/></svg> ccdx status</h1>
27
- <div class="snapshot-meta"><p id="auth-account" role="status" data-i18n data-i18n-title title="Saved GitHub Copilot account / local credentials only; not an online entitlement check.">GitHub / READING</p><p id="updated" data-i18n>Reading status…</p></div>
27
+ <div class="snapshot-meta"><p id="auth-account" role="status" data-i18n data-i18n-title title="Provider status / authorization and inference are separate.">READING</p><p id="updated" data-i18n>Reading status…</p></div>
28
28
  </section>
29
29
 
30
30
  <section class="overview" aria-label="Overview" data-i18n-label>
31
31
  <article class="card"><h2 data-i18n>ADAPTER</h2><strong id="version">—</strong><p id="uptime">—</p></article>
32
- <article class="card"><h2>Copilot</h2><strong id="copilot">—</strong><p id="token">—</p></article>
33
- <article class="card"><h2 data-i18n>KNOWN MODELS</h2><strong id="models">—</strong><p id="model-source">—</p></article>
34
- <article class="card"><h2 data-i18n>REQUESTS</h2><strong id="requests">—</strong><p id="request-errors">—</p><p id="http-error-breakdown">—</p><p><span data-i18n>Per-request limits (active)</span><br><span id="body-limits">—</span></p></article>
32
+ <article class="card"><h2 data-i18n>SOURCES</h2><strong id="source-summary">—</strong><p id="source-detail">—</p></article>
33
+ <article class="card"><h2 data-i18n>CODEX MODELS</h2><strong id="models">—</strong><p id="model-source">—</p></article>
34
+ <article class="card"><h2 data-i18n>CODEX REQUESTS</h2><strong id="requests">—</strong><p id="request-errors">—</p><p id="http-error-breakdown">—</p><p><span data-i18n>Per-request limits (active)</span><br><span id="body-limits">—</span></p></article>
35
35
  </section>
36
36
 
37
- <section class="details" aria-label="Runtime details" data-i18n-label>
38
- <article class="panel">
39
- <div class="panel-heading"><h2 data-i18n>MODEL OUTCOMES</h2><span>RESPONSES</span></div>
40
- <dl class="stats"><div><dt data-i18n>Completed</dt><dd id="completed">—</dd></div><div><dt data-i18n>Incomplete</dt><dd id="incomplete">—</dd></div><div><dt data-i18n>Failed</dt><dd id="failed">—</dd></div><div><dt data-i18n>Cancelled</dt><dd id="cancelled">—</dd></div></dl>
41
- <p class="hint" data-i18n>HTTP 2xx != model completed.</p>
42
- <dl class="stats timing-stats"><div><dt data-i18n>First output</dt><dd id="ttft">—</dd></div><div><dt data-i18n>Output speed</dt><dd id="tpot">—</dd></div></dl>
43
- <p class="hint" data-i18n>Gateway timing. Output speed is estimated.</p>
44
- </article>
45
- <article class="panel">
46
- <div class="panel-heading"><h2 data-i18n>LOCAL HISTORY</h2><span data-i18n>ACTIVE LIMIT</span></div>
47
- <strong id="history">—</strong><progress id="history-meter" class="meter" max="100" value="0" aria-label="History cache usage" data-i18n-label></progress>
48
- <p id="history-detail" class="hint">—</p>
49
- </article>
50
- <article class="panel">
51
- <div class="panel-heading"><h2 data-i18n>IMAGE GENERATION</h2><span data-i18n>OPTIONAL</span></div>
52
- <strong id="image">—</strong><p id="image-detail" class="hint">—</p>
53
- </article>
54
- <article class="panel">
55
- <div class="panel-heading"><h2>Microsoft 365</h2><span data-i18n>SEPARATE PROFILE</span></div>
56
- <strong id="m365-state">—</strong>
57
- <p id="m365-account" class="hint">—</p>
58
- <p id="m365-models" class="hint">—</p>
59
- <p id="m365-claude" class="hint">—</p>
60
- <p id="m365-requests" class="hint">—</p>
61
- <p id="m365-clients" class="hint">—</p>
62
- <p id="m365-codex" class="hint">—</p>
63
- </article>
64
- </section>
37
+ <details class="panel dashboard-section" id="account-authorization">
38
+ <summary class="panel-heading"><h2 data-i18n>ACCOUNT AUTHORIZATION</h2><span data-i18n>BY PROVIDER</span></summary>
39
+ <p class="hint" data-i18n>Saved credentials, authorization, model access and client requests are separate evidence.</p>
40
+ <div class="table-wrap"><table><thead><tr><th data-i18n>Source</th><th data-i18n>ACCOUNT</th><th data-i18n>AUTHORIZATION</th><th data-i18n>SERVICE</th><th data-i18n>LAST VERIFIED</th><th>TTL</th></tr></thead><tbody id="provider-auth"></tbody></table></div>
41
+ </details>
65
42
 
66
43
  <details class="panel dashboard-section" id="client-features" open>
67
- <summary class="panel-heading"><h2 data-i18n>CLIENT FEATURES</h2><span data-i18n>OBSERVED STATE</span></summary>
44
+ <summary class="panel-heading"><h2 data-i18n>CLIENT CONNECTIONS</h2><span data-i18n>OBSERVED STATE</span></summary>
45
+ <div class="table-wrap"><table><thead><tr><th data-i18n>Source</th><th data-i18n>CLIENT</th><th data-i18n>STATE</th><th data-i18n>GATEWAY</th><th data-i18n>LAST REQUEST</th></tr></thead><tbody id="provider-clients"></tbody></table></div>
46
+ <div id="provider-requests" class="hint"></div>
68
47
  <dl class="stats"><div><dt data-i18n>Native predictions</dt><dd id="prediction-preference">—</dd></div><div><dt data-i18n>Local bridge</dt><dd id="prediction-bridge">—</dd></div><div><dt data-i18n>Client route</dt><dd id="prediction-route">—</dd></div><div><dt data-i18n>Visible candidate</dt><dd id="prediction-candidate">—</dd></div></dl>
69
48
  <p id="prediction-note" class="hint">—</p>
70
49
  <p class="hint" data-i18n>Configured does not mean displayed. Use ccdx prediction status for details.</p>
@@ -78,16 +57,17 @@
78
57
  </details>
79
58
 
80
59
  <details class="panel dashboard-section" id="upstream-models" open>
81
- <summary class="panel-heading"><h2 data-i18n>UPSTREAM GPT MODELS</h2><span id="models-state" data-i18n>CHECKING LIVE</span></summary>
60
+ <summary class="panel-heading"><h2 data-i18n>MODEL CATALOG</h2><span id="models-state" data-i18n>CHECKING LIVE</span></summary>
61
+ <div id="model-providers" class="provider-tabs" role="tablist" aria-label="Model providers" data-i18n-label></div>
82
62
  <div class="section-actions"><button id="refresh-models" type="button" data-i18n>Refresh</button></div>
83
- <p id="models-note" class="table-note" data-i18n>Querying GitHub Copilot…</p>
84
- <div class="table-wrap"><table><thead><tr><th scope="col" data-i18n>MODEL</th><th scope="col" data-i18n>VENDOR</th><th scope="col" data-i18n>API</th><th scope="col" data-i18n>FLAG</th></tr></thead><tbody id="live-models-body"><tr><td colspan="4" data-i18n>Loading…</td></tr></tbody></table></div>
63
+ <p id="models-note" class="table-note" data-i18n>Reading provider catalog…</p>
64
+ <div class="table-wrap"><table><thead><tr><th scope="col" data-i18n>MODEL</th><th scope="col" data-i18n>VENDOR</th><th scope="col" data-i18n>API</th><th scope="col" data-i18n>CLIENT</th><th scope="col" data-i18n>REASONING</th><th scope="col" data-i18n>STATE</th></tr></thead><tbody id="live-models-body" role="tabpanel"><tr><td colspan="6" data-i18n>Loading…</td></tr></tbody></table></div>
85
65
  <p class="hint" data-i18n>Catalog listing does not guarantee inference access.</p>
86
66
  </details>
87
67
 
88
68
  <details class="panel dashboard-section" id="model-usage" open>
89
69
  <summary class="panel-heading"><h2 data-i18n>USAGE</h2><span id="usage-state" data-i18n>READING LOG</span></summary>
90
- <div class="section-actions"><label><span data-i18n>Source</span> <select id="usage-provider"><option value="" data-i18n>All providers</option><option value="github">GitHub Copilot</option><option value="m365">Microsoft 365</option></select></label><button id="clear-usage-day" type="button" hidden data-i18n>All history</button><button id="refresh-usage" type="button" data-i18n>Refresh</button></div>
70
+ <div class="section-actions"><label><span data-i18n>Source</span> <select id="usage-provider"><option value="" data-i18n>All providers</option></select></label><button id="clear-usage-day" type="button" hidden data-i18n>All history</button><button id="refresh-usage" type="button" data-i18n>Refresh</button></div>
91
71
  <p id="usage-note" class="table-note" data-i18n>Aggregating local usage metadata…</p>
92
72
  <div class="table-wrap"><table class="usage-table"><thead><tr><th scope="col" data-i18n>MODEL</th><th scope="col" data-i18n>CALLS</th><th scope="col" data-i18n>INPUT</th><th scope="col" data-i18n>CACHE READ</th><th scope="col" data-i18n>OUTPUT</th><th scope="col" data-i18n>TOTAL</th><th scope="col" data-i18n>CACHE HIT</th></tr></thead><tbody id="usage-body"><tr><td colspan="7" data-i18n>Loading…</td></tr></tbody></table></div>
93
73
  <p class="hint" data-i18n>Cache hit = recorded cached / input tokens. ~ = incomplete history. — = unavailable or invalid counts.</p>
@@ -116,6 +96,29 @@
116
96
  <p class="hint" data-i18n>Upstream messages may contain sensitive text.</p>
117
97
  </details>
118
98
 
99
+ <details class="panel dashboard-section" id="runtime-resources" open>
100
+ <summary data-i18n>RUNTIME RESOURCES</summary>
101
+ <div class="details"><article class="panel">
102
+ <div class="panel-heading"><h2 data-i18n>MODEL OUTCOMES</h2><span>RESPONSES</span></div>
103
+ <dl class="stats"><div><dt data-i18n>Completed</dt><dd id="completed">—</dd></div><div><dt data-i18n>Incomplete</dt><dd id="incomplete">—</dd></div><div><dt data-i18n>Failed</dt><dd id="failed">—</dd></div><div><dt data-i18n>Cancelled</dt><dd id="cancelled">—</dd></div></dl>
104
+ <p class="hint" data-i18n>HTTP 2xx != model completed.</p>
105
+ <dl class="stats timing-stats"><div><dt data-i18n>First output</dt><dd id="ttft">—</dd></div><div><dt data-i18n>Output speed</dt><dd id="tpot">—</dd></div></dl>
106
+ <p class="hint" data-i18n>Gateway timing. Output speed is estimated.</p>
107
+ </article><article class="panel">
108
+ <div class="panel-heading"><h2 data-i18n>LOCAL HISTORY</h2><span data-i18n>ACTIVE LIMIT</span></div>
109
+ <strong id="history">—</strong><progress id="history-meter" class="meter" max="100" value="0" aria-label="History cache usage" data-i18n-label></progress>
110
+ <p id="history-detail" class="hint">—</p>
111
+ </article></div>
112
+ </details>
113
+
114
+ <details class="panel dashboard-section" id="additional-capabilities">
115
+ <summary data-i18n>ADDITIONAL CAPABILITIES</summary>
116
+ <article class="panel">
117
+ <div class="panel-heading"><h2 data-i18n>IMAGE GENERATION</h2><span data-i18n>OPTIONAL</span></div>
118
+ <strong id="image">—</strong><p id="image-detail" class="hint">—</p>
119
+ </article>
120
+ </details>
121
+
119
122
  <details id="animation-settings" class="panel dashboard-section settings-panel">
120
123
  <summary class="panel-heading"><h2 data-i18n>TERMINAL ANIMATION</h2><span id="animation-state" data-i18n>READING</span></summary>
121
124
  <div id="animation-options" class="animation-options" role="group" aria-label="Animation theme" data-i18n-label></div>
@@ -1,5 +1,43 @@
1
1
  (() => {
2
2
  const translations = {
3
+ "CODEX MODELS": ["CODEX MODELS", "Codex 模型"],
4
+ "CODEX REQUESTS": ["CODEX REQUESTS", "Codex 请求"],
5
+ "{state} / {reason}": ["{state} / {reason}", "{state} / {reason}"],
6
+ "RUNTIME RESOURCES": ["RUNTIME RESOURCES", "运行资源"],
7
+ "ADDITIONAL CAPABILITIES": ["ADDITIONAL CAPABILITIES", "附加能力"],
8
+ "SOURCES": ["SOURCES", "模型来源"],
9
+ "ACCOUNT AUTHORIZATION": ["ACCOUNT AUTHORIZATION", "账号授权"],
10
+ "BY PROVIDER": ["BY PROVIDER", "按来源列出"],
11
+ "ACCOUNT": ["ACCOUNT", "账号"],
12
+ "AUTHORIZATION": ["AUTHORIZATION", "授权状态"],
13
+ "SERVICE": ["SERVICE", "服务状态"],
14
+ "LAST VERIFIED": ["LAST VERIFIED", "最近验证"],
15
+ "CLIENT": ["CLIENT", "客户端"],
16
+ "STATE": ["STATE", "状态"],
17
+ "GATEWAY": ["GATEWAY", "网关"],
18
+ "LAST REQUEST": ["LAST REQUEST", "最近请求"],
19
+ "CLIENT CONNECTIONS": ["CLIENT CONNECTIONS", "客户端接入"],
20
+ "MODEL CATALOG": ["MODEL CATALOG", "模型目录"],
21
+ "REASONING": ["REASONING", "推理档位"],
22
+ "Model providers": ["Model providers", "模型来源"],
23
+ "Reading provider catalog…": ["Reading provider catalog…", "正在读取模型目录…"],
24
+ "No models advertised.": ["No models advertised.", "目录未返回模型。"],
25
+ "No catalog available.": ["No catalog available.", "模型目录不可用。"],
26
+ "Saved locally": ["Saved locally", "本机已保存"],
27
+ "Authorized": ["Authorized", "已授权"],
28
+ "Ready": ["Ready", "就绪"],
29
+ "Checking": ["Checking", "检查中"],
30
+ "Unsupported": ["Unsupported", "当前平台不支持"],
31
+ "Standby": ["Standby", "备用未启用"],
32
+ "listed": ["Listed", "目录已列出"],
33
+ "restricted": ["Restricted", "受限制"],
34
+ "hidden": ["Hidden upstream", "上游已隐藏"],
35
+ "running": ["Running", "运行中"],
36
+ "unavailable": ["Unavailable", "不可用"],
37
+ "{count} providers": ["{count} providers", "{count}个来源"],
38
+ "{provider}: {done} done / {incomplete} incomplete / {failed} failed": ["{provider}: {done} done / {incomplete} incomplete / {failed} failed", "{provider}:完成{done}·未完成{incomplete}·失败{failed}"],
39
+ "Provider status / authorization and inference are separate.": ["Provider status / authorization and inference are separate.", "来源状态。\n授权与推理分别验证。"],
40
+ "Saved credentials, authorization, model access and client requests are separate evidence.": ["Saved credentials, authorization, model access and client requests are separate evidence.", "凭据、授权、模型访问\n和客户端请求分别验证。"],
3
41
  "CLIENT FEATURES": ["CLIENT FEATURES", "接入能力"],
4
42
  "OBSERVED STATE": ["OBSERVED STATE", "实际状态"],
5
43
  "Native predictions": ["Native predictions", "输入建议"],
@@ -82,7 +82,7 @@
82
82
  .map(key => refresh(key, { force })));
83
83
  }
84
84
 
85
- function invalidate(key) {
85
+ function invalidate(key, { clear = false } = {}) {
86
86
  const entry = state(key);
87
87
  entry.generation += 1;
88
88
  entry.abort?.abort();
@@ -90,6 +90,7 @@
90
90
  entry.abort = null;
91
91
  entry.attemptedAt = null;
92
92
  entry.variant = undefined;
93
+ if (clear) { entry.value = undefined;entry.signature = undefined;entry.updatedAt = null;entry.error = null; }
93
94
  notify(key);
94
95
  }
95
96