codex-copilot-dx 1.2.8 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/docs/ARCHITECTURE.md +31 -3
- package/docs/REFERENCE.md +36 -10
- package/package.json +1 -1
- package/src/cli-m365.mjs +5 -0
- package/src/dashboard/animation.js +186 -0
- package/src/dashboard/console.js +50 -19
- package/src/dashboard/index.html +106 -84
- package/src/dashboard/language.js +56 -5
- package/src/dashboard/status.js +60 -25
- package/src/dashboard/time.js +16 -0
- package/src/dashboard/tools.js +7 -3
- package/src/dashboard/ui.css +56 -14
- package/src/dashboard/ui.js +78 -211
- package/src/dashboard/updates.js +3 -3
- package/src/dashboard/usage.js +2 -2
- package/src/dashboard-api.mjs +4 -2
- package/src/dashboard.mjs +2 -0
- package/src/optional-routes.mjs +1 -1
- package/src/provider-descriptors.mjs +24 -0
- package/src/provider-runtime.mjs +10 -22
- package/src/providers/m365-catalog-diagnostic.mjs +38 -0
- package/src/providers/m365.mjs +8 -3
package/README.md
CHANGED
|
@@ -14,18 +14,18 @@ npm install -g codex-copilot-dx@latest
|
|
|
14
14
|
ccdx
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
17
|
+
No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.10/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.10/install.ps1) (Windows), then run `sh install.sh` or `./install.ps1` under your current shell policy. The bootstrap reuses compatible Node/npm or installs verified official Node 24.22.0 privately for CCDX. It adds no Git, compiler or system package manager. It keeps registry/proxy/certificate policy, verifies the Release package and installed runtime, and restores the prior CCDX package if installation fails. Dependencies still need your configured registry. See [installation limits and private command paths](docs/REFERENCE.md#install-without-node-or-git).
|
|
18
18
|
|
|
19
19
|
CCDX reuses a compatible local credential or starts GitHub Device Flow, listens on `127.0.0.1:2026`, configures Codex, and opens the App. Interactive desktop starts also open the local WebUI once; use `ccdx --no-browser` or disable this in WebUI settings. No client binary patch is needed. On Windows, open the App manually unless native prediction setup is 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`. The npm package adds no install hook or policy change; custom launchers are preserved. npm's own script is untouched. The configured `dummy` API key is a placeholder, not a credential.
|
|
20
20
|
|
|
21
|
-
The [local control console](http://127.0.0.1:2026/)
|
|
21
|
+
The [local control console](http://127.0.0.1:2026/) separates Overview, indented Codex/Claude pages, Model sources, Usage, Requests, Checks & repairs and Settings. Its sticky header stays stable across modules; page switches return to the top, while refreshes preserve scroll. Codex owns source/model, Auto Review, images, input suggestions and conversation buffering, with request performance separate from maintenance. Model sources owns accounts, catalogs and M365 access; browsing never changes routing. Claude shows each app's setup separately and labels combined Messages performance. Checks & repairs owns runtime diagnostics; Settings keeps appearance, startup and updates. Usage offers animated bars (default) or curves with scoped filters and no extra requests; reduced motion stays static. Trends load on demand. Recent requests open by default, with technical metadata folded into each row. Overview and the live terminal share an approximate token cache hit rate, preserving partial/unknown states. Overview's six activity dots share status polling; only idle has a breathing halo, failed or six-second-old evidence is unknown, and short requests can fall between snapshots. The existing style and logo remain. System proxy exceptions accept shortened IPv4 networks; M365 network failures retain specific, redacted reasons.
|
|
22
22
|
|
|
23
23
|
Startup shows bounded checks, sources with discovered model lists and Claude Code/App configuration. Prediction normally uses one summary line; `ccdx prediction status` retains recovery and environment details. After Ready, an interactive terminal shows current source/Claude state and a line-framed table of this process's returned usage and inference counters. Notices and activity each have their own line; individual requests do not scroll. Input includes reused input tokens. `ccdx --verbose` (also `--show-request-id`, or debug logging) retains detail output; optional file logging remains independently controlled. Source and Claude summaries wrap on narrow terminals. Failed reads show previous-data status and the last successful update time. Non-TTY, CI, dumb, or terminals too small for the full region use plain output (at least 40 columns / 16 rows are required). `Ready` only means the core service is available; discovered catalogs and configured clients do not prove inference access.
|
|
24
24
|
|
|
25
25
|
WebUI settings apply animation choices live, pause/resume configured image calls and prediction adaptation without removing credentials/trust, change the Codex source explicitly, and manage the conversation-buffer limit. Saved preference and effective state are separate; browser opening is labeled for the next start. Clearing the conversation buffer clears **all** buffered continuations. Busy cleanup is refused; retry after active requests finish. Saved Codex transcripts are retained. First-time image/prediction setup still uses the existing CLI; trust, client routing and cached client capabilities may require a normal App relaunch. Busy M365 requests must finish before disabling that provider. Settings also offers independent webpage/terminal colors: classic green (default), Klein blue or Soft pink. Web colors stay in this browser; terminal colors persist locally. Failed saves are reported. See the [control reference](docs/REFERENCE.md#control-console-and-online-settings).
|
|
26
26
|
|
|
27
27
|
While visible and auto-refresh is on, the console reads the small status snapshot about every two seconds and source/settings evidence about every 16 seconds. Catalogs and retained usage are fetched on demand and at most once per 30-minute refresh interval while their view is open. Hidden pages stop scheduled reads. First output uses **ms**, estimated speed **token/s**, and each protocol has its own samples. HTTP traffic includes catalog and routing requests; it is not a conversation count.
|
|
28
|
-
The **Requests by source** section and `ccdx status` separate request outcomes by source and protocol. Process-local returned usage also retains bounded source totals; missing usage remains partial. Configuration, sign-in, discovery and a completed reply remain separate evidence. CLI text stays English; WebUI stays bilingual. See the [copy inventory](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/UX_COPY.md) and [1.2.0 verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.0.md).
|
|
28
|
+
The **Requests by source** section and `ccdx status` separate request outcomes by source and protocol. Process-local returned usage also retains bounded source totals; missing usage remains partial. Configuration, sign-in, discovery and a completed reply remain separate evidence. CLI text stays English; WebUI stays bilingual. WebUI uses solid selected controls and independent webpage/terminal appearance. See the [copy inventory](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/UX_COPY.md) and [1.2.0 verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.0.md).
|
|
29
29
|
|
|
30
30
|
## Commands
|
|
31
31
|
| Command | Purpose |
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -268,7 +268,7 @@ settlement for two seconds; no successful plaintext cache or transcript index ex
|
|
|
268
268
|
|
|
269
269
|
`cli-web.mjs` provides an unauthenticated management bootstrap. It opens an existing compatible listener or composes the management listener and provider controls without app writes/launch, prediction setup or automatic M365 start. It is deliberately separate from normal launcher side effects; normal app startup follows after stopping this management-only process. CLI feature pause/resume delegates to the existing preference gates; full removal/setup remains in the original integration commands.
|
|
270
270
|
|
|
271
|
-
`provider-runtime.mjs` composes
|
|
271
|
+
`provider-descriptors.mjs` projects plain source/client evidence without transport, configuration writes or lifecycle ownership. `provider-runtime.mjs` supplies its existing snapshots and composes these descriptors separately from
|
|
272
272
|
source-selection actions. `provider-metadata.mjs` projects bounded model metadata
|
|
273
273
|
without transport or credential dependencies. `dashboard-api.mjs` sanitizes public
|
|
274
274
|
fields and keeps local credential validity separate from authorization evidence.
|
|
@@ -276,13 +276,14 @@ A requested catalog Provider must be registered; unavailable sources never fall
|
|
|
276
276
|
through to another source. The unchanged CLI model selector retains its GPT scope.
|
|
277
277
|
|
|
278
278
|
`dashboard/refresh.js` owns one visible-page timer, in-flight deduplication,
|
|
279
|
-
freshness, cancellation and last-good snapshots. `
|
|
279
|
+
freshness, cancellation and last-good snapshots. `animation.js` owns terminal animation selection, preview timing and saving, with injected view helpers and the shared refresh controller; it does not select providers. `time.js` formats local 24-hour timestamps in both UI languages.
|
|
280
|
+
`ui.js` generates Provider tabs
|
|
280
281
|
and source filters from descriptors and retained history, with per-tab snapshots
|
|
281
282
|
invalidated on profile generation/account changes. It cancels obsolete reads and
|
|
282
283
|
prevents stale apply across tabs. `status.js` renders source-neutral authorization
|
|
283
284
|
and client evidence; `usage.js` renders usage and date selection. View state remains
|
|
284
285
|
page-local; only existing preferences and the viewed model Provider are saved in
|
|
285
|
-
the browser. Expanded sections read on demand. There is no Node data watcher.
|
|
286
|
+
the browser. Expanded sections read on demand. The directory and Codex selectors share the same catalog resource, freshness and single-flight read. Changing sources cancels an obsolete waiter; generation checks reject late results. Account changes clear old-source drafts and snapshots; ordinary refreshes retain pending choices. There is no Node data watcher.
|
|
286
287
|
The sidebar controller reads small process-local status snapshots every two seconds
|
|
287
288
|
while visible/automatic, and source/settings evidence every eight status ticks.
|
|
288
289
|
Catalog and retained-log reads retain their slower, view-scoped policy. Animation
|
|
@@ -433,3 +434,30 @@ The existing same-origin bounded settings action saves terminal color through th
|
|
|
433
434
|
The existing status payload projects `model_activity.active` from the three fixed inference route counters plus actual image-generation activity, never total HTTP activity or image MCP calls. It adds no history store, provider request or listener. `dashboard/activity.js` consumes this metadata through the existing refresh path, expires stale evidence after six seconds and pauses offscreen animation. Idle, active and unknown remain distinct; CSS owns six theme-colored dots and the idle-only halo. Terminal Cache hit reads the existing raw runtime aggregate rather than deriving a ratio from rounded display numbers.
|
|
434
435
|
|
|
435
436
|
The Claude gateway still relays original native SSE bytes. `stream-performance.mjs` classifies only nonempty text, thinking and tool-argument deltas as first output; empty and signature-only deltas remain transport metadata. Sparse/interleaved blocks are not reordered or translated. Existing provider generations, locked atomic settings writes, cancellation and route ownership remain the composition boundaries.
|
|
437
|
+
|
|
438
|
+
## Dashboard layout and information scopes (1.2.9)
|
|
439
|
+
|
|
440
|
+
The existing CSS grid reserves explicit header/body/footer tracks; the body owns spare space from the full-height sidebar. The header uses an opaque themed sticky surface, stable action slots and a deliberate compact toolbar. Scrollbar space is stable, with an always-scroll fallback for older engines. `console.js` owns route titles/descriptions, scroll reset and main-content focus; refresh code does not navigate or reset scroll.
|
|
441
|
+
|
|
442
|
+
The eight existing views remain. `status.js` groups Overview clients by application using explicit selected-source evidence, retains all registered sources and projects separate Claude setup rows without inventing per-app Messages metrics. Account controls, catalog and access rows share the selected source in `ui.js`; source-management shortcuts browse without switching inference routes. Existing resource generations, cancellation, last-good snapshots and refresh cadence remain unchanged. Timestamps follow their own status/source/catalog/usage resources. Animation reads also check that Settings is visible.
|
|
443
|
+
|
|
444
|
+
HTML owns grouping: Codex buffer maintenance is separate from request performance, usage filters sit with the data they actually control, Requests prioritizes recent records and folds bounded technical fields into each row, and Checks & repairs owns runtime diagnostics. Settings owns preferences and updates. Request expansion is preserved by bounded request keys, and literal upstream values still use text nodes. Existing settings transactions, same-origin protections and confirmations remain in use; action failures target the affected controls. No framework, runtime dependency, endpoint, log scan, model call or installer policy is added.
|
|
445
|
+
|
|
446
|
+
## Catalog failure evidence and controls (1.2.10)
|
|
447
|
+
|
|
448
|
+
`providers/m365-catalog-diagnostic.mjs` classifies model-list HTTP failures using
|
|
449
|
+
fixed causes. The one known Entra-disabled message is recognized exactly; other
|
|
450
|
+
403 responses mean access denied, without inferring tenant-policy changes. Only
|
|
451
|
+
cause, HTTP status, check/last-success timestamps and a bounded service request ID
|
|
452
|
+
survive. The server body, credentials and account details are not retained in that
|
|
453
|
+
diagnostic. CLI and protected dashboard routes share its projection. Successful
|
|
454
|
+
refresh clears both source and composition failure state; delayed closed-source
|
|
455
|
+
results cannot clear a newer source's state. Discovery still sends no inference.
|
|
456
|
+
|
|
457
|
+
The eight WebUI views retain their scope, palettes, atom and circle status icons.
|
|
458
|
+
Selection uses an opaque theme fill and centered text, without a check or radio
|
|
459
|
+
mark; hover retains the selection. Native selects use square borders and retain a
|
|
460
|
+
visible square keyboard focus outline. Model names and metadata use readable text
|
|
461
|
+
roles rather than accent colors. The catalog's technical fields remain available
|
|
462
|
+
in per-model details. Usage trends and summaries are peer panels, still loaded on
|
|
463
|
+
demand. Saved/effective preference differences are shown only when relevant.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -808,6 +808,31 @@ In-memory usage still updates when `CCDX_DISABLE_USAGE=1` disables persistence.
|
|
|
808
808
|
|
|
809
809
|
The Clear conversation buffer action clears all process-local conversation continuation data. If image optimization or conversation history is active, cleanup is refused; retry after current requests finish. Old chats may fail to continue; saved Codex transcripts remain. It invokes the existing image-transform/history cleanup operation, rather than an inactive-only selector.
|
|
810
810
|
|
|
811
|
+
The source page groups account/access checks and the model list under the selected
|
|
812
|
+
source. Selecting a source tab only browses it; application routing is changed from
|
|
813
|
+
the application page. Model names remain in the main table; maker, protocol,
|
|
814
|
+
reasoning levels, listing state and context limit are in each model's details.
|
|
815
|
+
The Codex choices and source table share one catalog read with freshness,
|
|
816
|
+
cancellation and account-generation checks. Explicit Refresh still checks again.
|
|
817
|
+
|
|
818
|
+
Selection uses a solid theme fill with centered text, without a preceding check.
|
|
819
|
+
Model-list text uses the normal text color. Selects have square borders and a
|
|
820
|
+
visible keyboard focus indicator. Settings groups webpage appearance, independent
|
|
821
|
+
terminal color/animation, startup and updates. The terminal preview is expandable;
|
|
822
|
+
choosing an animation previews it, while Save applies it to the running terminal.
|
|
823
|
+
Usage trends are separate from the model summary and remain on demand. Request
|
|
824
|
+
rows show an observed HTTP failure separately from the model's terminal result;
|
|
825
|
+
request IDs and attempt counts are available in the same bounded details. List
|
|
826
|
+
timestamps use local 24-hour time in both UI languages.
|
|
827
|
+
|
|
828
|
+
M365 catalog refusals expose a fixed reason, HTTP status, check/last-success time
|
|
829
|
+
and service request ID when available. `entra_access_disabled` means the server
|
|
830
|
+
reported that Copilot CLI Entra access is not enabled for that account; a generic
|
|
831
|
+
403 does not establish why access changed. Sign-in, discovery and successful
|
|
832
|
+
inference remain separate evidence. Failed discovery keeps the account-bound
|
|
833
|
+
last-good list. A successful refresh clears old failure evidence. No automatic
|
|
834
|
+
relogin, model call, source switch or policy exception is added.
|
|
835
|
+
|
|
811
836
|
The settings API is local, requires the dashboard header, bounded JSON and
|
|
812
837
|
same-origin POST. It invokes the same Provider, cache and integration operations;
|
|
813
838
|
it does not spawn a CLI or generic shell command. Settings reads do not reveal
|
|
@@ -1012,7 +1037,7 @@ Unknown support prevents an explicitly requested exception from starting.
|
|
|
1012
1037
|
For an older updater that still requires Git, install the Release tarball directly:
|
|
1013
1038
|
|
|
1014
1039
|
```sh
|
|
1015
|
-
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
1040
|
+
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.10/codex-copilot-dx-1.2.10.tgz
|
|
1016
1041
|
# Windows PowerShell: use npm.cmd instead of npm.
|
|
1017
1042
|
```
|
|
1018
1043
|
|
|
@@ -1174,17 +1199,17 @@ once by default, using the configured main port when customized. See
|
|
|
1174
1199
|
startup preferences, output modes and effective-state rules. Assets require both
|
|
1175
1200
|
a loopback connection and loopback Host, including when the main listener uses LAN mode.
|
|
1176
1201
|
|
|
1177
|
-
The sidebar separates Overview, indented Codex/Claude Apps, Model sources, Usage, Requests, and Settings. Codex-specific images, prediction integration
|
|
1178
|
-
and conversation buffering stay under Codex. HTTP traffic counts include model
|
|
1202
|
+
The sidebar separates Overview, indented Codex/Claude Apps, Model sources, Usage, Requests, Checks & repairs, and Settings. Desktop header rows have explicit heights, the header sticks when it reaches the viewport top, and stable scrollbar space prevents horizontal movement between long and short pages. Narrow screens keep compact navigation and a two-row toolbar. Page switches reset scroll and move keyboard focus to the main content; background/manual data refreshes preserve scroll. Each page has its own purpose description, and data groups carry their own update times rather than a shared page-wide freshness claim. Codex-specific images, prediction integration
|
|
1203
|
+
and conversation buffering stay under Codex. Buffer controls and request performance have separate groups. HTTP traffic counts include model
|
|
1179
1204
|
catalogs and route errors; model outcomes and timing are named by protocol.
|
|
1180
1205
|
Microsoft 365's Claude Messages summary is not a Provider-wide request total.
|
|
1181
1206
|
|
|
1182
|
-
The
|
|
1207
|
+
The source access table uses bounded local credential metadata and Provider snapshots, showing only the selected source. Switching source tabs also changes the account controls and catalog, never application routing. Overview groups client rows by app and uses an explicitly selected source; it does not substitute a configured but unselected source when the selected source is unavailable. The source card still lists every registered source. Claude App and Claude Code have separate setup/local-service rows, while Messages performance stays combined and is labeled accordingly. A running local service does not prove the app is open.
|
|
1183
1208
|
A locally saved GitHub credential is not online entitlement. Account names with
|
|
1184
1209
|
underscores retain their exact display value; identity, keys and environment
|
|
1185
1210
|
values are not inferred from model names. Client configuration, gateway state,
|
|
1186
1211
|
recent requests and actual inference are separate observations. The top summary
|
|
1187
|
-
describes source/application status without mapping arrows. The source card counts and lists every discovered registered source, including disabled sources; availability and account evidence remain in the detailed tables. Each sidebar tab has a decorative inline SVG icon, with application entries indented. Terminal appearance has one Settings entry, and the animation selector has one separating rule.
|
|
1212
|
+
describes source/application status without mapping arrows. The source card counts and lists every discovered registered source, including disabled sources; availability and account evidence remain in the detailed tables. Each sidebar tab has a decorative inline SVG icon, with application entries indented. Terminal appearance has one Settings entry, and the animation selector has one separating rule. Settings contains webpage/terminal appearance, startup preferences and version updates. Local memory, queues, notices, raw HTTP traffic and request-size caps live under Checks & repairs → Runtime details. Account-check links identify the source and lead to its existing account tools. Save failures appear beside the affected controls; configuration repair previews and destructive-action confirmations remain in place.
|
|
1188
1213
|
|
|
1189
1214
|
Catalog tabs browse registered Provider directories without changing routing.
|
|
1190
1215
|
Rows retain protocol, eligible clients, reasoning metadata and directory state.
|
|
@@ -1210,6 +1235,8 @@ The separate current-run summary updates from returned usage in memory, without
|
|
|
1210
1235
|
rescanning retained logs at the status cadence.
|
|
1211
1236
|
Overview adds an approximate token cache hit rate: returned reused input tokens divided by returned input tokens, weighted by tokens rather than request percentages. Missing evidence is distinct from an explicit zero; all-unknown cache evidence, zero input and invalid counts display `—`. Mixed complete/incomplete cache evidence displays `~` before the recorded aggregate ratio. This describes recorded input reuse, not a request success ratio, invoice or whole-account cache statistic. Missing output alone does not invalidate usable input/cache evidence.
|
|
1212
1237
|
|
|
1238
|
+
The usage source selector applies to the whole page. Model selection controls both daily trends and the calendar; 7/30/90-day range and bar/line view belong to daily trends, and request/Token measure belongs to the fixed annual calendar. These controls do not redefine the all-history model table; selecting a known day narrows the table and Show all restores retained-history totals.
|
|
1239
|
+
|
|
1213
1240
|
Usage analytics remains collapsed until opened: 7/30/90-day charts and a bounded
|
|
1214
1241
|
365-day calendar in the browser time zone. Model/range/day selection reuses its
|
|
1215
1242
|
snapshot. Days outside retained history are distinct from zero recorded activity.
|
|
@@ -1247,8 +1274,7 @@ Client cancellations remain in verbose/file diagnostics as informational records
|
|
|
1247
1274
|
timeouts and actual failures remain notices. Non-TTY, CI, dumb and terminals under
|
|
1248
1275
|
40 columns or 16 rows retain plain output. At 40×16 the compact table keeps all metrics and short source/Code/App states. Larger terminals wrap full state descriptions. No runtime terminal dependency is added.
|
|
1249
1276
|
|
|
1250
|
-
Terminal appearance lives in Settings,
|
|
1251
|
-
screens. Preview frames load on opening; closing, hiding the view/page or reduced
|
|
1277
|
+
Terminal appearance lives only in Settings. Preview frames load on opening; closing, hiding the view/page or reduced
|
|
1252
1278
|
motion stops preview timers. Saving changes the running supported status terminal.
|
|
1253
1279
|
|
|
1254
1280
|
The recent-failure view merges bounded Responses events, main-listener HTTP
|
|
@@ -1334,13 +1360,13 @@ ccdx --show-request-id
|
|
|
1334
1360
|
|
|
1335
1361
|
### Authentication recovery
|
|
1336
1362
|
|
|
1337
|
-
The dashboard's
|
|
1338
|
-
status snapshot. It shows at most 20 finished request observations: serialized
|
|
1363
|
+
The dashboard's **RECENT REQUESTS** section opens by default and reuses the same
|
|
1364
|
+
status snapshot. It shows at most 20 finished request observations: time, source, model, outcome and returned input tokens, with serialized
|
|
1339
1365
|
upstream payload bytes, image count, reported input tokens, the advertised model
|
|
1340
1366
|
window and terminal outcome, plus process-local compaction outcome counts. Missing
|
|
1341
1367
|
fields are unknown, not zero; input/window is a reference ratio, not an exact live
|
|
1342
1368
|
session measurement. No prompts, image bytes, files, tool results or extra session
|
|
1343
|
-
scan are retained.
|
|
1369
|
+
scan are retained. Technical fields are folded into each row. Expanded fields survive unchanged reads and retained matching request observations; closed/hidden request groups defer row rebuilding without another API call.
|
|
1344
1370
|
|
|
1345
1371
|
When the saved token is missing, `ccdx` looks for compatible local Copilot GitHub tokens, validates them with GitHub and Copilot, and imports a valid one before starting Device Flow. It checks explicit token sources (`CCDX_GITHUB_TOKEN`, `CCDX_GITHUB_TOKEN_PATH`, and `CCDX_GITHUB_TOKEN_PATHS`) plus common local `auth.json` layouts. Generic discovery refuses to choose silently when valid credentials for multiple GitHub accounts are found.
|
|
1346
1372
|
|
package/package.json
CHANGED
package/src/cli-m365.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { readBoundedResponseText } from "./upstream-body.mjs";
|
|
|
10
10
|
import { parseAdapterAddressOptions } from "./cli-options.mjs";
|
|
11
11
|
import { autoReviewReasoningEfforts } from "./models.mjs";
|
|
12
12
|
import { m365AccountMessage } from "./providers/m365-accounts.mjs";
|
|
13
|
+
import { m365CatalogDiagnostic, m365CatalogMessage } from "./providers/m365-catalog-diagnostic.mjs";
|
|
13
14
|
import { m365NetworkDiagnostic, m365NetworkMessage } from "./providers/m365-network-diagnostic.mjs";
|
|
14
15
|
|
|
15
16
|
export async function fetchActiveProviderModels({ control = providerControl, ...options } = {}) {
|
|
@@ -35,6 +36,7 @@ export async function providerControl({ host = "127.0.0.1", port = 2026, action,
|
|
|
35
36
|
export function formatM365Status(state) {
|
|
36
37
|
const m = state.m365 || {}, claude = m.claude || {}, models = m.models || {};
|
|
37
38
|
const network = m365NetworkDiagnostic(m.network_diagnostic);
|
|
39
|
+
const catalog = m365CatalogDiagnostic(m.catalog_diagnostic);
|
|
38
40
|
return [
|
|
39
41
|
`Microsoft 365: ${terminalCell(m.state || "not running")}${m.reason ? ` (${terminalCell(m.reason)})` : ""}`,
|
|
40
42
|
...(m.account?.login ? [`Account: ${terminalCell(m.account.login)}`] : []),
|
|
@@ -42,6 +44,9 @@ export function formatM365Status(state) {
|
|
|
42
44
|
...(network ? [`Network: ${network.source} / ${network.stage} / ${network.cause_code}`, m365NetworkMessage(network)] : m.reason ? [m365AccountMessage(m.reason)] : []),
|
|
43
45
|
`Models: ${models.claude || 0} Claude / ${models.gpt || 0} GPT (${models.source || "unavailable"})`,
|
|
44
46
|
`Claude gateway: ${claude.gateway || "not running"}${claude.base_url ? ` / ${claude.base_url}` : ""}`,
|
|
47
|
+
...(catalog ? [`Catalog: ${m365CatalogMessage(catalog)} (HTTP ${catalog.http_status})`,
|
|
48
|
+
`Checked: ${catalog.checked_at || "unknown"} / Last success: ${catalog.last_success_at || "unknown"}`,
|
|
49
|
+
...(catalog.request_id ? [`Service request: ${catalog.request_id}`] : [])] : []),
|
|
45
50
|
...(claude.reason ? [`Claude detail: ${terminalCell(claude.reason)}`] : []),
|
|
46
51
|
...(claude.requests ? [`Claude requests: ${claude.requests.completed} completed / ${claude.requests.incomplete} incomplete / ${claude.requests.failed} failed / ${claude.requests.active} active`] : []),
|
|
47
52
|
`Claude Code: ${claude.clients?.code || "unknown"}; Claude App: ${claude.clients?.app || "unknown"}`,
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
function create({ element, phrase, localize, text, reducedMotion, getRefresh, document }) {
|
|
3
|
+
const animationRows = new Map();
|
|
4
|
+
const animationLabels = new Map();
|
|
5
|
+
let animationTimelines = [];
|
|
6
|
+
let savedAnimation = "";
|
|
7
|
+
let selectedAnimation = "";
|
|
8
|
+
let previewDisabledByEnvironment = false;
|
|
9
|
+
let previewVisible = false;
|
|
10
|
+
let previewTimer = null;
|
|
11
|
+
let previewStarted = 0;
|
|
12
|
+
let animationSaving = false;
|
|
13
|
+
let animationFramesLoaded = false;
|
|
14
|
+
|
|
15
|
+
function renderAnsiFrame(target, frame) {
|
|
16
|
+
const fragments = String(frame).split(/\u001b\[([0-9;]+)m/);
|
|
17
|
+
const content = document.createDocumentFragment();
|
|
18
|
+
let color = "";
|
|
19
|
+
for (let index = 0; index < fragments.length; index += 2) {
|
|
20
|
+
if (fragments[index]) {
|
|
21
|
+
const span = document.createElement("span");
|
|
22
|
+
span.className = color;
|
|
23
|
+
span.textContent = fragments[index];
|
|
24
|
+
content.append(span);
|
|
25
|
+
}
|
|
26
|
+
const code = fragments[index + 1];
|
|
27
|
+
color = code === "97" ? "ansi-white"
|
|
28
|
+
: /^38;5;(159|123|87|51|45|39|33)$/.test(code || "") ? `ansi-${code.slice(5)}` : "";
|
|
29
|
+
}
|
|
30
|
+
target.replaceChildren(content);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function renderAnimationFrames(elapsed) {
|
|
34
|
+
for (const timeline of animationTimelines) {
|
|
35
|
+
const position = timeline.id === selectedAnimation ? elapsed % timeline.duration : 0;
|
|
36
|
+
const frameIndex = timeline.frames.findIndex(({ until }) => position < until);
|
|
37
|
+
if (frameIndex === timeline.lastFrame) continue;
|
|
38
|
+
timeline.lastFrame = frameIndex;
|
|
39
|
+
renderAnsiFrame(timeline.target, frameIndex < 0 ? `[${" ".repeat(20)}]` : timeline.frames[frameIndex].ansi);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function stopAnimationPreview() {
|
|
44
|
+
if (previewTimer !== null) clearTimeout(previewTimer);
|
|
45
|
+
previewTimer = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function tickAnimationPreview() {
|
|
49
|
+
previewTimer = null;
|
|
50
|
+
if (!animationTimelines.length || !element("animation-settings").open || element("animation-settings").closest("[hidden]") || !previewVisible || document.visibilityState !== "visible" || reducedMotion.matches || previewDisabledByEnvironment) return;
|
|
51
|
+
renderAnimationFrames(performance.now() - previewStarted);
|
|
52
|
+
previewTimer = setTimeout(tickAnimationPreview, 32);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function syncAnimationPreview() {
|
|
56
|
+
stopAnimationPreview();
|
|
57
|
+
if (!animationTimelines.length || !element("animation-settings").open || element("animation-settings").closest("[hidden]") || !previewVisible || document.visibilityState !== "visible" || reducedMotion.matches || previewDisabledByEnvironment) {
|
|
58
|
+
for (const timeline of animationTimelines) timeline.lastFrame = -2;
|
|
59
|
+
renderAnimationFrames(0);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
previewStarted = performance.now();
|
|
63
|
+
tickAnimationPreview();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
new IntersectionObserver(([entry]) => {
|
|
67
|
+
previewVisible = entry.isIntersecting;
|
|
68
|
+
syncAnimationPreview();
|
|
69
|
+
}).observe(element("animation-options"));
|
|
70
|
+
document.addEventListener("visibilitychange", syncAnimationPreview);
|
|
71
|
+
reducedMotion.addEventListener("change", syncAnimationPreview);
|
|
72
|
+
|
|
73
|
+
function buildAnimationOptions(data) {
|
|
74
|
+
const container = element("animation-options");
|
|
75
|
+
container.replaceChildren();
|
|
76
|
+
animationRows.clear();
|
|
77
|
+
animationTimelines = [];
|
|
78
|
+
savedAnimation = data.theme;
|
|
79
|
+
selectedAnimation = data.theme;
|
|
80
|
+
previewDisabledByEnvironment = data.disabled_by_environment === true;
|
|
81
|
+
for (const [index, theme] of data.themes.entries()) {
|
|
82
|
+
animationLabels.set(theme.id, theme.label);
|
|
83
|
+
const option = document.createElement("button");
|
|
84
|
+
option.type = "button";
|
|
85
|
+
option.className = "theme-option";
|
|
86
|
+
option.dataset.theme = theme.id;
|
|
87
|
+
option.setAttribute("aria-pressed", String(theme.id === data.theme));
|
|
88
|
+
option.addEventListener("click", () => {
|
|
89
|
+
selectedAnimation = theme.id;
|
|
90
|
+
for (const [id, row] of animationRows) row.setAttribute("aria-pressed", String(id === theme.id));
|
|
91
|
+
element("save-animation").disabled = selectedAnimation === savedAnimation;
|
|
92
|
+
updateAnimationState();
|
|
93
|
+
syncAnimationPreview();
|
|
94
|
+
});
|
|
95
|
+
const name = document.createElement("span");
|
|
96
|
+
name.className = "theme-name";
|
|
97
|
+
const label = document.createElement("span");
|
|
98
|
+
localize(label, "index_theme", { index: String(index + 1).padStart(2, "0"), theme: phrase(theme.label) });
|
|
99
|
+
name.append(label);
|
|
100
|
+
if (theme.default) {
|
|
101
|
+
const marker = document.createElement("small");
|
|
102
|
+
localize(marker, "default");
|
|
103
|
+
name.append(marker);
|
|
104
|
+
}
|
|
105
|
+
const preview = document.createElement("span");
|
|
106
|
+
preview.className = "theme-preview";
|
|
107
|
+
preview.setAttribute("aria-hidden", "true");
|
|
108
|
+
option.append(name, preview);
|
|
109
|
+
container.append(option);
|
|
110
|
+
animationRows.set(theme.id, option);
|
|
111
|
+
let until = 0;
|
|
112
|
+
const frames = theme.frames.map((frame) => {
|
|
113
|
+
until += frame.delay_ms;
|
|
114
|
+
return { ansi: frame.ansi, until };
|
|
115
|
+
});
|
|
116
|
+
animationTimelines.push({ id: theme.id, target: preview, frames, duration: until + theme.loop_pause_ms, lastFrame: -2 });
|
|
117
|
+
}
|
|
118
|
+
element("save-animation").disabled = true;
|
|
119
|
+
syncAnimationPreview();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function animationNote(data) {
|
|
123
|
+
return data.disabled_by_environment
|
|
124
|
+
? "disabled_by_ccdx_terminal_animation_saved_choice_applies_after_o"
|
|
125
|
+
: "saved_choice_applies_to_the_running_terminal";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function loadAnimation(options) {
|
|
129
|
+
if (!animationSaving) return getRefresh().refresh("animation", options);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function applyAnimation(data, { changed } = {}) {
|
|
133
|
+
if (changed === false) { updateAnimationState(); return; }
|
|
134
|
+
if (!animationFramesLoaded && data.themes.some(theme => theme.frames)) {
|
|
135
|
+
buildAnimationOptions(data);
|
|
136
|
+
animationFramesLoaded = true;
|
|
137
|
+
} else {
|
|
138
|
+
const dirty = selectedAnimation && selectedAnimation !== savedAnimation;
|
|
139
|
+
savedAnimation = data.theme;
|
|
140
|
+
if (!dirty) selectedAnimation = data.theme;
|
|
141
|
+
previewDisabledByEnvironment = data.disabled_by_environment === true;
|
|
142
|
+
for (const [id, row] of animationRows) row.setAttribute("aria-pressed", String(id === selectedAnimation));
|
|
143
|
+
element("save-animation").disabled = selectedAnimation === savedAnimation;
|
|
144
|
+
syncAnimationPreview();
|
|
145
|
+
}
|
|
146
|
+
updateAnimationState();
|
|
147
|
+
text("animation-note", animationNote(data));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function updateAnimationState() {
|
|
151
|
+
text("animation-state", "current_theme_unsaved", { theme: phrase(animationLabels.get(savedAnimation) || savedAnimation), unsaved: selectedAnimation !== savedAnimation ? phrase("unsaved") : "" });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function saveAnimation() {
|
|
155
|
+
const button = element("save-animation");
|
|
156
|
+
if (!selectedAnimation || selectedAnimation === savedAnimation) return;
|
|
157
|
+
animationSaving = true;
|
|
158
|
+
getRefresh().invalidate("animation");
|
|
159
|
+
button.disabled = true;
|
|
160
|
+
text("animation-note", "saving");
|
|
161
|
+
try {
|
|
162
|
+
const response = await fetch("/_ccdx/ui/animation", {
|
|
163
|
+
method: "POST",
|
|
164
|
+
headers: { "Content-Type": "application/json", "X-CCDX-Dashboard": "1" },
|
|
165
|
+
body: JSON.stringify({ theme: selectedAnimation }),
|
|
166
|
+
signal: AbortSignal.timeout(8000),
|
|
167
|
+
});
|
|
168
|
+
const data = await response.json();
|
|
169
|
+
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`);
|
|
170
|
+
savedAnimation = data.theme;
|
|
171
|
+
updateAnimationState();
|
|
172
|
+
text("animation-note", animationNote(data));
|
|
173
|
+
} catch (error) {
|
|
174
|
+
text("animation-note", "not_saved_error", { error: String(error.message || error).slice(0, 150) });
|
|
175
|
+
} finally {
|
|
176
|
+
animationSaving = false;
|
|
177
|
+
button.disabled = selectedAnimation === savedAnimation;
|
|
178
|
+
loadAnimation({ force: true });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return { apply: applyAnimation, load: loadAnimation, save: saveAnimation, sync: syncAnimationPreview, stop: stopAnimationPreview,
|
|
183
|
+
get saving() { return animationSaving; }, get framesLoaded() { return animationFramesLoaded; } };
|
|
184
|
+
}
|
|
185
|
+
globalThis.ccdxDashboardAnimation = { create };
|
|
186
|
+
})();
|
package/src/dashboard/console.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
const el = id => document.getElementById(id);
|
|
3
3
|
const label = (node, key, values = {}) => globalThis.ccdxLanguage.set(node, key, values);
|
|
4
4
|
const titles = { overview: "overview", codex: "Codex", claude: "Claude", models: "model_services", usage: "usage_and_diagnostics", requests: "request_records", checks: "tools_checks_title", system: "system_and_settings" };
|
|
5
|
+
const descriptions = { overview: "page_overview_description", codex: "page_codex_description", claude: "page_claude_description", models: "page_models_description", usage: "page_usage_description", requests: "page_requests_description", checks: "page_checks_description", system: "page_settings_description" };
|
|
6
|
+
const settingsViews = ["codex", "models", "system", "checks"];
|
|
5
7
|
let current = "overview", settings = null, settingsPending = false, stopped = false, timer = null, ticks = 0;
|
|
6
8
|
let sourceDirty = false, reviewDirty = false, sourceModels = [], modelsPreference = null, sourceGeneration = 0, modelsSource = null;
|
|
7
9
|
let settingsReadAt = null;
|
|
@@ -40,15 +42,23 @@
|
|
|
40
42
|
function navigate() {
|
|
41
43
|
const route = location.hash.slice(1), next = Object.hasOwn(titles, route) ? route : "overview";
|
|
42
44
|
current = next;
|
|
45
|
+
if (next !== "codex") sourceGeneration++;
|
|
46
|
+
if (!["codex", "models"].includes(next) && dashboardRefresh.state("models").pending) dashboardRefresh.invalidate("models");
|
|
43
47
|
for (const view of document.querySelectorAll("[data-view]")) view.hidden = view.dataset.view !== next;
|
|
44
48
|
globalThis.ccdxDashboardActivity?.visibilityChanged();
|
|
45
49
|
for (const item of document.querySelectorAll("[data-route]")) {
|
|
46
50
|
if (item.dataset.route === next) item.setAttribute("aria-current", "page");else item.removeAttribute("aria-current");
|
|
47
51
|
}
|
|
48
52
|
label(el("page-title"), titles[next]);
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
label(el("page-description"), descriptions[next]);
|
|
54
|
+
el("page-description").hidden = ["models", "system"].includes(next);
|
|
55
|
+
el("page-settings-note").textContent = "";
|
|
56
|
+
window.scrollTo(0, 0);
|
|
57
|
+
el("main-content").focus({ preventScroll: true });
|
|
58
|
+
if (settingsViews.includes(next)) void loadSettings();
|
|
59
|
+
if (next === "models") { void refreshCatalog();void dashboardRefresh.refresh("auth"); }
|
|
51
60
|
if (next === "usage") { void dashboardRefresh.refresh("usage");usageView.revealChart(); } else usageView.stopMotion();
|
|
61
|
+
if (next === "requests") renderContext();
|
|
52
62
|
if (next === "system") { void dashboardRefresh.refresh("animation");void dashboardRefresh.refresh("updates"); }
|
|
53
63
|
syncAnimationPreview();
|
|
54
64
|
}
|
|
@@ -104,7 +114,7 @@
|
|
|
104
114
|
for (const key of ["terminal_animation_enabled", "open_webui", "image_enabled", "prediction_enabled"]) {
|
|
105
115
|
const input = el(`setting-${key}`), effective = data.effective[key];
|
|
106
116
|
input.checked = data.saved[key];input.disabled = Boolean(effective.locked);
|
|
107
|
-
label(el(`effect-${key}`),
|
|
117
|
+
label(el(`effect-${key}`), data.saved[key] === effective.value && !effective.locked ? "preference_effect" : "saved_saved_effective_effective_state", {
|
|
108
118
|
saved: { key: data.saved[key] ? "on" : "off" }, effective: { key: effective.value ? "on" : "off" },
|
|
109
119
|
state: { key: effective.locked ? "controlled_by_environment" : states[effective.state] || effective.state } });
|
|
110
120
|
}
|
|
@@ -112,10 +122,22 @@
|
|
|
112
122
|
el("history-limit").disabled = data.history.source === "environment";
|
|
113
123
|
el("save-history").disabled = data.history.source === "environment";
|
|
114
124
|
label(el("effect-history"), data.history.source === "environment" ? "controlled_by_environment" : "applies_to_new_calls");
|
|
115
|
-
|
|
125
|
+
el("settings-note").textContent = "";
|
|
116
126
|
el("page-settings-note").textContent = "";
|
|
117
127
|
const state = data.providers;
|
|
128
|
+
el("m365-enabled").checked = state?.m365?.enabled === true;
|
|
129
|
+
el("m365-enabled").disabled = settingsPending;
|
|
130
|
+
label(el("m365-source-effect"), state?.m365?.enabled ? "enabled" : "disabled");
|
|
118
131
|
const account = state?.m365?.account;
|
|
132
|
+
el("m365-account-name").textContent = account?.login || "—";
|
|
133
|
+
const sourceState = state?.m365;
|
|
134
|
+
globalThis.ccdxIcons.set(el("m365-signin-state"), sourceState?.token_cached ? "authorized" : !sourceState?.enabled ? "disabled" : "tools_not_checked",
|
|
135
|
+
sourceState?.token_cached ? "ok" : "unknown");
|
|
136
|
+
const catalogFailed = Boolean(sourceState?.catalog_diagnostic) || sourceState?.state === "unavailable";
|
|
137
|
+
globalThis.ccdxIcons.set(el("m365-catalog-state"), catalogFailed ? "live_lookup_failed" : sourceState?.models?.refreshed_at ? sourceState.models.source === "cache" ? "catalog_snapshot" : "live_snapshot" : "tools_not_checked",
|
|
138
|
+
catalogFailed ? "warning" : sourceState?.models?.refreshed_at ? "ok" : "unknown");
|
|
139
|
+
const last = Object.values(sourceState?.claude?.observed_clients || {}).filter(value => typeof value === "string").sort().at(-1);
|
|
140
|
+
el("m365-last-request").textContent = last ? time(last) : "—";
|
|
119
141
|
if (account) label(el("m365-account-current"), "company_account_current", { login: account.login, tenant: account.tenant || "—", source: { key: `account_source_${account.selection_source || "legacy"}` } });
|
|
120
142
|
else label(el("m365-account-current"), "company_account_none");
|
|
121
143
|
if (accountReasons.has(state?.m365?.reason)) label(el("m365-account-note"), state.m365.reason);
|
|
@@ -129,6 +151,9 @@
|
|
|
129
151
|
const status = { ready: "ready", checking: "checking", disabled: "disabled", unsupported: "unsupported", idle: "unknown", unavailable: "unavailable" }[state.m365?.state] || "unknown";
|
|
130
152
|
label(m365, "microsoft_365_state", { state: { key: status } });
|
|
131
153
|
el("source-control-note").replaceChildren(source);el("m365-control-note").append(m365);
|
|
154
|
+
if (state.m365?.catalog_diagnostic) {
|
|
155
|
+
const cause = document.createElement("p");label(cause, `catalog_cause_${state.m365.catalog_diagnostic.cause_code}`);el("m365-control-note").append(cause);
|
|
156
|
+
}
|
|
132
157
|
if (state.m365?.reason) {
|
|
133
158
|
const detail = document.createElement("details"), summary = document.createElement("summary"), code = document.createElement("code");
|
|
134
159
|
label(summary, "message");code.textContent = state.m365.reason;detail.append(summary, code);el("m365-control-note").append(detail);
|
|
@@ -141,22 +166,26 @@
|
|
|
141
166
|
settingsPending = true;
|
|
142
167
|
el("terminal-color-theme").disabled = true;
|
|
143
168
|
syncAccountControls();
|
|
144
|
-
try { applySettings(await api());settingsReadAt =
|
|
169
|
+
try { applySettings(await api());settingsReadAt = time(Date.now()); }
|
|
145
170
|
catch (error) {
|
|
146
|
-
for (const id of ["settings-note", "page-settings-note"]) {
|
|
171
|
+
for (const id of ["settings-note", ...(settingsViews.includes(current) ? ["page-settings-note"] : [])]) {
|
|
147
172
|
label(el(id), settingsReadAt ? "showing_previous_data_updated_time" : "could_not_read_settings", { time: settingsReadAt });
|
|
148
173
|
el(id).title = error.message;
|
|
149
174
|
}
|
|
150
175
|
}
|
|
151
|
-
finally { settingsPending = false;el("terminal-color-theme").disabled = !settings;el("apply-source").disabled = !sourceReady();syncReviewButton();syncAccountControls(); }
|
|
176
|
+
finally { settingsPending = false;el("m365-enabled").disabled = !settings;el("terminal-color-theme").disabled = !settings;el("apply-source").disabled = !sourceReady();syncReviewButton();syncAccountControls(); }
|
|
152
177
|
}
|
|
153
178
|
async function change(body, button) {
|
|
154
179
|
if (settingsPending) return;
|
|
155
180
|
settingsPending = true;
|
|
156
181
|
syncAccountControls();
|
|
157
|
-
const controls = [...document.querySelectorAll("[role=switch], #save-history, #clean-history, #fix-prediction, #apply-source, #save-review, #source-provider, #source-model, #source-review, #source-review-effort, #terminal-color-theme, #m365-
|
|
182
|
+
const controls = [...document.querySelectorAll("[role=switch], #save-history, #clean-history, #fix-prediction, #apply-source, #save-review, #source-provider, #source-model, #source-review, #source-review-effort, #terminal-color-theme, #m365-enabled")];
|
|
158
183
|
controls.forEach(input => { input.disabled = true; });
|
|
159
|
-
|
|
184
|
+
const note = el(body.key ? `effect-${body.key}` : body.action === "color_theme" ? "terminal-color-note"
|
|
185
|
+
: body.action.startsWith("history_") ? "effect-history" : body.action === "prediction_fix" ? "prediction-note"
|
|
186
|
+
: body.operation === "switch" ? "source-control-note" : body.operation === "auto-review" ? "review-control-note"
|
|
187
|
+
: body.operation === "account" ? "m365-account-note" : "m365-control-note");
|
|
188
|
+
label(note, "applying");
|
|
160
189
|
if (button) button.setAttribute("aria-busy", "true");
|
|
161
190
|
try {
|
|
162
191
|
const data = await api(body);
|
|
@@ -166,6 +195,7 @@
|
|
|
166
195
|
el("review-control-note").textContent = "";
|
|
167
196
|
applySettings(data);
|
|
168
197
|
if (body.operation === "account") {
|
|
198
|
+
sourceDirty = false;reviewDirty = false;sourceGeneration++;
|
|
169
199
|
modelsPreference = null;modelsSource = null;
|
|
170
200
|
dashboardRefresh.invalidate("models", { clear: true });
|
|
171
201
|
label(el("m365-account-note"), "company_account_checked");
|
|
@@ -176,8 +206,7 @@
|
|
|
176
206
|
if (settings) applySettings(settings);
|
|
177
207
|
if (body.operation === "account") { label(el("m365-account-note"), "company_account_not_saved", { reason: { key: accountReasons.has(error.code) ? error.code : error.message } });return; }
|
|
178
208
|
if (body.action === "color_theme") { label(el("terminal-color-note"), "not_saved_error", { error: error.message });return; }
|
|
179
|
-
|
|
180
|
-
if (body.key) el(`effect-${body.key}`).textContent = error.message;
|
|
209
|
+
note.textContent = error.message;
|
|
181
210
|
} finally {
|
|
182
211
|
settingsPending = false;controls.forEach(input => { input.disabled = false; });
|
|
183
212
|
syncAccountControls();
|
|
@@ -187,7 +216,7 @@
|
|
|
187
216
|
button?.removeAttribute("aria-busy");
|
|
188
217
|
}
|
|
189
218
|
}
|
|
190
|
-
for (const input of document.querySelectorAll(
|
|
219
|
+
for (const input of document.querySelectorAll('[role=switch][id^="setting-"]')) input.addEventListener("change", () => {
|
|
191
220
|
void change({ action: "preference", key: input.id.slice("setting-".length), value: input.checked }, input);
|
|
192
221
|
});
|
|
193
222
|
el("terminal-color-theme").addEventListener("change", () => void change({ action: "color_theme", theme: el("terminal-color-theme").value }, el("terminal-color-theme")));
|
|
@@ -196,9 +225,12 @@
|
|
|
196
225
|
if (window.confirm(globalThis.ccdxLanguage.format("clear_inactive_codex_conversation_data_older_continuation_ids_ma"))) void change({ action: "history_clean" }, el("clean-history"));
|
|
197
226
|
});
|
|
198
227
|
el("fix-prediction").addEventListener("click", () => void change({ action: "prediction_fix" }, el("fix-prediction")));
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
228
|
+
el("m365-enabled").addEventListener("change", () => {
|
|
229
|
+
const operation = el("m365-enabled").checked ? "on" : "off";
|
|
230
|
+
if (operation === "off" && !window.confirm(globalThis.ccdxLanguage.format("confirm_disable_m365"))) {
|
|
231
|
+
el("m365-enabled").checked = settings?.providers?.m365?.enabled === true;return;
|
|
232
|
+
}
|
|
233
|
+
void change({ action: "provider", operation }, el("m365-enabled"));
|
|
202
234
|
});
|
|
203
235
|
async function loadSourceModels() {
|
|
204
236
|
const generation = ++sourceGeneration;
|
|
@@ -212,8 +244,7 @@
|
|
|
212
244
|
el("apply-source").disabled = settingsPending || Boolean(needsModels);
|
|
213
245
|
label(el("review-control-note"), "model_choices_loading");
|
|
214
246
|
try {
|
|
215
|
-
const
|
|
216
|
-
const data = await response.json();if (!response.ok || !Array.isArray(data.models)) throw new Error(data.error || "Invalid model list");
|
|
247
|
+
const data = await readModelCatalog(source.id);
|
|
217
248
|
if (generation !== sourceGeneration) return;
|
|
218
249
|
const models = data.models.filter(model => model.selectable && model.clients.includes("codex"));
|
|
219
250
|
sourceModels = models;
|
|
@@ -257,14 +288,14 @@
|
|
|
257
288
|
await dashboardRefresh.refresh("status", { force: true });
|
|
258
289
|
if (++ticks % 8 === 0) {
|
|
259
290
|
await dashboardRefresh.refresh("auth", { force: true });
|
|
260
|
-
if (
|
|
291
|
+
if (settingsViews.includes(current)) await loadSettings();
|
|
261
292
|
}
|
|
262
293
|
}
|
|
263
294
|
schedule();
|
|
264
295
|
}, 2000);
|
|
265
296
|
}
|
|
266
297
|
window.addEventListener("hashchange", navigate);
|
|
267
|
-
el("refresh").addEventListener("click", () => { if (
|
|
298
|
+
el("refresh").addEventListener("click", () => { if (settingsViews.includes(current)) void loadSettings(); });
|
|
268
299
|
window.addEventListener("pagehide", () => { stopped = true;clearTimeout(timer); });
|
|
269
300
|
window.addEventListener("pageshow", () => { stopped = false;schedule(); });
|
|
270
301
|
navigate();schedule();
|