@wengine-ai/ccr-provider-codex 1.0.10 → 1.0.12
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/dist/card.js +23 -14
- package/dist/plugin.js +53 -4
- package/dist/plugin.json +1 -1
- package/package.json +2 -2
package/dist/card.js
CHANGED
|
@@ -957,7 +957,8 @@ function mount(el, props) {
|
|
|
957
957
|
t("managed_provider", { name: status?.providerName || CODEX_PROVIDER_NAME })
|
|
958
958
|
));
|
|
959
959
|
body.append(styled("p", "max-w-md text-xs text-muted-foreground", t("description")));
|
|
960
|
-
|
|
960
|
+
const showAccountSurface = !loading && !!status && (connected || state === "cooldown");
|
|
961
|
+
if (showAccountSurface && status) {
|
|
961
962
|
const rows = styled("dl", "grid max-w-md grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs");
|
|
962
963
|
const account = maskCodexAccountId(status.accountId) ?? t("unknown");
|
|
963
964
|
for (const [label, value, mono] of [
|
|
@@ -1164,23 +1165,31 @@ function mount(el, props) {
|
|
|
1164
1165
|
if (alive) render();
|
|
1165
1166
|
}) ?? null;
|
|
1166
1167
|
render();
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1168
|
+
const mountRead = (retried) => {
|
|
1169
|
+
readStatus().then((value) => {
|
|
1170
|
+
if (alive) {
|
|
1171
|
+
status = value;
|
|
1172
|
+
loadFailed = false;
|
|
1173
|
+
}
|
|
1174
|
+
}).catch(() => {
|
|
1175
|
+
if (!alive) return;
|
|
1176
|
+
if (!retried) {
|
|
1177
|
+
setTimeout(() => {
|
|
1178
|
+
if (alive) mountRead(true);
|
|
1179
|
+
}, 2500);
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1174
1182
|
loadFailed = true;
|
|
1175
1183
|
errorKey = "request_failed";
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
if (alive) {
|
|
1184
|
+
}).finally(() => {
|
|
1185
|
+
if (!alive) return;
|
|
1179
1186
|
loading = false;
|
|
1180
1187
|
render();
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1188
|
+
const mountState = codexStateKey(status);
|
|
1189
|
+
if (mountState === "connected" || mountState === "cooldown") void autoReadUsage();
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
mountRead(false);
|
|
1184
1193
|
}
|
|
1185
1194
|
function unmount(el) {
|
|
1186
1195
|
mounted.get(el)?.();
|
package/dist/plugin.js
CHANGED
|
@@ -1423,6 +1423,32 @@ var CodexAuthService = class {
|
|
|
1423
1423
|
const data = await this.ensureLoaded();
|
|
1424
1424
|
return this.latestCooldown(data) !== void 0;
|
|
1425
1425
|
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Data-plane success channel: clears non-sticky failure residue once the
|
|
1428
|
+
* upstream produced real output. Without this a single rejected request
|
|
1429
|
+
* (e.g. a 400 on an unsupported payload) latches status="error" on the card
|
|
1430
|
+
* until the next re-login — users experience that as "the login keeps
|
|
1431
|
+
* dropping" even though the token was never invalid. The sticky reauth
|
|
1432
|
+
* marker survives: one good request cannot prove the saved sign-in healthy
|
|
1433
|
+
* again, so only a fresh login clears it. rateLimitCooldownUntil is a
|
|
1434
|
+
* separate quota-window truth with its own expiry and is left alone.
|
|
1435
|
+
* Serialized on the mutation queue like every account write; silently
|
|
1436
|
+
* ignored when disconnected or on a write failure (bookkeeping never breaks
|
|
1437
|
+
* the response path).
|
|
1438
|
+
*/
|
|
1439
|
+
noteRequestSuccess() {
|
|
1440
|
+
return this.enqueueMutation(async () => {
|
|
1441
|
+
const current = await this.store.load().catch(() => null);
|
|
1442
|
+
if (!current) return;
|
|
1443
|
+
if (!current.account.lastError && !current.account.cooldownUntil) return;
|
|
1444
|
+
if (current.account.lastError?.code === "codex_reauth_required") return;
|
|
1445
|
+
await this.saveData({
|
|
1446
|
+
...current,
|
|
1447
|
+
account: { ...current.account, lastError: null, cooldownUntil: null }
|
|
1448
|
+
});
|
|
1449
|
+
}).catch(() => {
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1426
1452
|
/** Data-plane error channel (usage_limit_reached, 401, …). Never throws. */
|
|
1427
1453
|
noteUpstreamError(info) {
|
|
1428
1454
|
return this.enqueueMutation(async () => {
|
|
@@ -1595,6 +1621,7 @@ function normalizeItem(item, boundCallIds) {
|
|
|
1595
1621
|
if (item.type === "item_reference") return null;
|
|
1596
1622
|
const next = { ...item };
|
|
1597
1623
|
delete next.id;
|
|
1624
|
+
delete next.thinking;
|
|
1598
1625
|
if (next.role === "system") next.role = "developer";
|
|
1599
1626
|
if (next.call_id !== void 0) {
|
|
1600
1627
|
const bounded = boundCallId(next.call_id);
|
|
@@ -1861,7 +1888,7 @@ var CodexTransformer = class {
|
|
|
1861
1888
|
async transformResponseOut(response, context) {
|
|
1862
1889
|
this.observeHeaderRateLimits(response);
|
|
1863
1890
|
const contentType = response.headers.get("content-type") ?? "";
|
|
1864
|
-
if (!contentType.includes("
|
|
1891
|
+
if (!response.body || contentType.toLowerCase().includes("application/json")) {
|
|
1865
1892
|
return response;
|
|
1866
1893
|
}
|
|
1867
1894
|
return this.inspectStream(response, context);
|
|
@@ -1879,6 +1906,20 @@ var CodexTransformer = class {
|
|
|
1879
1906
|
} catch {
|
|
1880
1907
|
}
|
|
1881
1908
|
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Clear non-sticky failure residue once the upstream produced real output:
|
|
1911
|
+
* a recovered account must not keep reporting its last rejection/quota
|
|
1912
|
+
* marker as a permanent error while requests succeed. Fire-and-forget;
|
|
1913
|
+
* bookkeeping never blocks or breaks the response path.
|
|
1914
|
+
*/
|
|
1915
|
+
noteRequestSuccess() {
|
|
1916
|
+
try {
|
|
1917
|
+
const result = this.service.noteRequestSuccess?.();
|
|
1918
|
+
if (result && typeof result.then === "function") result.then(void 0, () => {
|
|
1919
|
+
});
|
|
1920
|
+
} catch {
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1882
1923
|
observeHeaderRateLimits(response) {
|
|
1883
1924
|
const limits = readCodexRateLimitHeaders(response.headers);
|
|
1884
1925
|
if (limits) this.reportRateLimits(limits);
|
|
@@ -1891,16 +1932,16 @@ var CodexTransformer = class {
|
|
|
1891
1932
|
* After the prefix, bytes pass through untouched, including [DONE] and
|
|
1892
1933
|
* comments; a client cancel propagates to the upstream reader.
|
|
1893
1934
|
*/
|
|
1894
|
-
inspectStream(response,
|
|
1935
|
+
inspectStream(response, _context) {
|
|
1895
1936
|
const reader = response.body.getReader();
|
|
1896
1937
|
const decoder = new TextDecoder();
|
|
1897
1938
|
const chunks = [];
|
|
1898
1939
|
let pending = "";
|
|
1899
1940
|
let scanned = 0;
|
|
1900
1941
|
let committed = false;
|
|
1901
|
-
let finished = false;
|
|
1902
1942
|
let rateLimitsSeen = false;
|
|
1903
1943
|
let sawOutput = false;
|
|
1944
|
+
let successNoted = false;
|
|
1904
1945
|
const handleEvent = async (data) => {
|
|
1905
1946
|
if (data === "[DONE]") return true;
|
|
1906
1947
|
let event;
|
|
@@ -1941,11 +1982,19 @@ var CodexTransformer = class {
|
|
|
1941
1982
|
}
|
|
1942
1983
|
if (typeof event?.type === "string" && (event.type.startsWith("response.output_text") || event.type.startsWith("response.function_call_arguments") || event.type.startsWith("response.reasoning") || event.type === "response.output_item.done")) {
|
|
1943
1984
|
sawOutput = true;
|
|
1985
|
+
if (!successNoted) {
|
|
1986
|
+
successNoted = true;
|
|
1987
|
+
this.noteRequestSuccess();
|
|
1988
|
+
}
|
|
1944
1989
|
return true;
|
|
1945
1990
|
}
|
|
1946
1991
|
if (event.type === "response.completed") {
|
|
1947
1992
|
if (sawOutput || responseHasOutput(event.response)) {
|
|
1948
1993
|
sawOutput = true;
|
|
1994
|
+
if (!successNoted) {
|
|
1995
|
+
successNoted = true;
|
|
1996
|
+
this.noteRequestSuccess();
|
|
1997
|
+
}
|
|
1949
1998
|
return true;
|
|
1950
1999
|
}
|
|
1951
2000
|
throw codexEmptyAnswerError();
|
|
@@ -2588,7 +2637,7 @@ var codexLocales = {
|
|
|
2588
2637
|
// src/plugin.ts
|
|
2589
2638
|
var manifest = {
|
|
2590
2639
|
name: "codex",
|
|
2591
|
-
version: "1.0.
|
|
2640
|
+
version: "1.0.11",
|
|
2592
2641
|
coreApi: "1",
|
|
2593
2642
|
description: "Codex subscription managed provider: chatgpt.com backend-api/codex data plane, browser OAuth login (PKCE, loopback 1455/1457 + paste), model sync, usage and admin routes."
|
|
2594
2643
|
};
|
package/dist/plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"coreApi": "1",
|
|
5
5
|
"description": "Codex subscription managed provider: chatgpt.com backend-api/codex data plane, browser OAuth login (PKCE, loopback 1455/1457 + paste), model sync, usage and admin routes."
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wengine-ai/ccr-provider-codex",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Codex subscription provider plugin for claude-code-router: browser OAuth login, fixed-origin responses data plane, transformer, managed runtime, admin routes, config protector and UI card.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.js",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"dist/*.json",
|
|
31
31
|
"dist/*.md"
|
|
32
32
|
]
|
|
33
|
-
}
|
|
33
|
+
}
|