@bitkyc08/opencodex 2.17.1-preview.20260814 → 2.19.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/gui/dist/assets/{index-DUCH59lJ.css → index-CQ7bIKee.css} +1 -1
- package/gui/dist/assets/{index-ta3-_hgj.js → index-D_JUZLEC.js} +16 -16
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/adapters/client-fingerprint.ts +14 -10
- package/src/adapters/cursor/live-transport.ts +17 -5
- package/src/adapters/cursor/protobuf-events.ts +662 -20
- package/src/adapters/cursor/tool-definitions.ts +12 -6
- package/src/adapters/google-antigravity-wire.ts +4 -3
- package/src/adapters/google.ts +22 -3
- package/src/bridge.ts +12 -2
- package/src/chat/inbound.ts +24 -1
- package/src/cli/index.ts +11 -0
- package/src/codex/app-server-processes.ts +3 -3
- package/src/codex/shim.ts +100 -5
- package/src/codex/user-identity.ts +36 -6
- package/src/config.ts +0 -2
- package/src/generated/compatibility-version.json +52 -44
- package/src/lib/errors.ts +27 -0
- package/src/lib/token-estimate.ts +19 -2
- package/src/lib/windows-elevation.ts +37 -0
- package/src/lib/windows-secret-acl.ts +7 -0
- package/src/lib/windows-text.ts +106 -0
- package/src/lib/windows-user-principal.ts +0 -2
- package/src/oauth/index.ts +1 -1
- package/src/oauth/store.ts +32 -18
- package/src/providers/antigravity-models.ts +25 -5
- package/src/providers/free-directory.ts +1 -1
- package/src/providers/registry.ts +6 -3
- package/src/responses/spill-store.ts +20 -1
- package/src/responses/state.ts +159 -3
- package/src/server/chat-completions.ts +4 -2
- package/src/server/effort-policy.ts +18 -0
- package/src/server/index.ts +5 -1
- package/src/server/management/logs-usage-routes.ts +7 -22
- package/src/server/request-log.ts +48 -3
- package/src/server/responses/core.ts +59 -15
- package/src/server/responses/encrypted-payload.ts +58 -38
- package/src/server/responses/fetch-helpers.ts +12 -4
- package/src/server/responses/input-admission.ts +169 -0
- package/src/server/responses/policy-fallback.ts +13 -2
- package/src/server/responses/ws-upstream.ts +115 -6
- package/src/service-manager-probe.ts +23 -37
- package/src/service.ts +233 -25
- package/src/tray/windows.ts +0 -2
- package/src/types.ts +10 -2
- package/src/update/job.ts +2 -2
- package/src/usage/summary.ts +21 -4
- package/src/vision/index.ts +21 -4
- package/src/web-search/index.ts +2 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"path": "package.json",
|
|
13
|
-
"sha256": "
|
|
13
|
+
"sha256": "4b1881e599a19c6a02309927d634f2bf2a45a93da5762d63e37e5795d103713e"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "scripts/model-metadata.source.json",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"path": "src/adapters/client-fingerprint.ts",
|
|
49
|
-
"sha256": "
|
|
49
|
+
"sha256": "6494cb40aefb337db3584489d1544d7ae623445dd3c81e5e34a30c77312f4e69"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"path": "src/adapters/command-code.ts",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"path": "src/adapters/cursor/live-transport.ts",
|
|
105
|
-
"sha256": "
|
|
105
|
+
"sha256": "247e48058e2d22e282d2d49652cde998c5d13f36197898562510d99746993711"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"path": "src/adapters/cursor/mcp-config.ts",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
"path": "src/adapters/cursor/protobuf-events.ts",
|
|
153
|
-
"sha256": "
|
|
153
|
+
"sha256": "16faa16a8f5eeb5022a2f7332bd0739189bf3cd5b6dc1267730b14a78786bc08"
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
"path": "src/adapters/cursor/protobuf-request.ts",
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
168
|
"path": "src/adapters/cursor/tool-definitions.ts",
|
|
169
|
-
"sha256": "
|
|
169
|
+
"sha256": "95b440c3456085df1216ed1eb2659025edfc49e6ba121bd8231b46f32fa88870"
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
"path": "src/adapters/cursor/transport-retry.ts",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
"path": "src/adapters/google-antigravity-wire.ts",
|
|
189
|
-
"sha256": "
|
|
189
|
+
"sha256": "1fa3361241026926754656cf8300ce513fefac86020d796cb985018192499797"
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
192
|
"path": "src/adapters/google-errors.ts",
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
"path": "src/adapters/google.ts",
|
|
213
|
-
"sha256": "
|
|
213
|
+
"sha256": "7905d7c039bebc63a2fa968fc934570d5dedf882c474087bcf4d55e317641e63"
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
"path": "src/adapters/identity.ts",
|
|
@@ -298,11 +298,11 @@
|
|
|
298
298
|
},
|
|
299
299
|
{
|
|
300
300
|
"path": "src/bridge.ts",
|
|
301
|
-
"sha256": "
|
|
301
|
+
"sha256": "47ccd936f3abd32d98ea9f044d35acd353b16ee1c9f0f0542f4b519f63f52221"
|
|
302
302
|
},
|
|
303
303
|
{
|
|
304
304
|
"path": "src/chat/inbound.ts",
|
|
305
|
-
"sha256": "
|
|
305
|
+
"sha256": "fe115207f0d5a4cf397e7e46a81b772f405363bd623481dc3fd4b2eec4bbf87e"
|
|
306
306
|
},
|
|
307
307
|
{
|
|
308
308
|
"path": "src/chat/outbound.ts",
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
},
|
|
463
463
|
{
|
|
464
464
|
"path": "src/cli/index.ts",
|
|
465
|
-
"sha256": "
|
|
465
|
+
"sha256": "d8c530cd151adc3ecbc243a63d5297c8c18001345aaaa708842d854e854faa6a"
|
|
466
466
|
},
|
|
467
467
|
{
|
|
468
468
|
"path": "src/cli/init.ts",
|
|
@@ -606,7 +606,7 @@
|
|
|
606
606
|
},
|
|
607
607
|
{
|
|
608
608
|
"path": "src/codex/app-server-processes.ts",
|
|
609
|
-
"sha256": "
|
|
609
|
+
"sha256": "4c55315be736f3e8fb0e19569d96d1235592d07a10fd243aa16a9d6925227f5f"
|
|
610
610
|
},
|
|
611
611
|
{
|
|
612
612
|
"path": "src/codex/auth-api.ts",
|
|
@@ -906,7 +906,7 @@
|
|
|
906
906
|
},
|
|
907
907
|
{
|
|
908
908
|
"path": "src/codex/shim.ts",
|
|
909
|
-
"sha256": "
|
|
909
|
+
"sha256": "f779c71050a1b2c3d6c08c22dbb6597d393a106f20a27566cc949203dbdad837"
|
|
910
910
|
},
|
|
911
911
|
{
|
|
912
912
|
"path": "src/codex/subagent-defaults.ts",
|
|
@@ -930,7 +930,7 @@
|
|
|
930
930
|
},
|
|
931
931
|
{
|
|
932
932
|
"path": "src/codex/user-identity.ts",
|
|
933
|
-
"sha256": "
|
|
933
|
+
"sha256": "e2cb675b208f7ad2fdd64c5d05d9c439511f786f3887ea5cb54d87b6fe7fe8a2"
|
|
934
934
|
},
|
|
935
935
|
{
|
|
936
936
|
"path": "src/codex/warmup.ts",
|
|
@@ -966,7 +966,7 @@
|
|
|
966
966
|
},
|
|
967
967
|
{
|
|
968
968
|
"path": "src/config.ts",
|
|
969
|
-
"sha256": "
|
|
969
|
+
"sha256": "142ca0d8026b63ddceb2b347b4f27dd6912b908ccf351016352e9423445fa2ef"
|
|
970
970
|
},
|
|
971
971
|
{
|
|
972
972
|
"path": "src/generated/model-metadata.ts",
|
|
@@ -1530,7 +1530,7 @@
|
|
|
1530
1530
|
},
|
|
1531
1531
|
{
|
|
1532
1532
|
"path": "src/lib/errors.ts",
|
|
1533
|
-
"sha256": "
|
|
1533
|
+
"sha256": "39613acb1eaae98fa448296a9ea6e55e246e7348aebf3110d775ac05febae7df"
|
|
1534
1534
|
},
|
|
1535
1535
|
{
|
|
1536
1536
|
"path": "src/lib/eventstream-decoder.ts",
|
|
@@ -1666,7 +1666,7 @@
|
|
|
1666
1666
|
},
|
|
1667
1667
|
{
|
|
1668
1668
|
"path": "src/lib/token-estimate.ts",
|
|
1669
|
-
"sha256": "
|
|
1669
|
+
"sha256": "c90473299655c86ef0118f5a265a71c100bf92e52172d6464a16c8f6ea300ca5"
|
|
1670
1670
|
},
|
|
1671
1671
|
{
|
|
1672
1672
|
"path": "src/lib/tool-argument-integers.ts",
|
|
@@ -1694,15 +1694,19 @@
|
|
|
1694
1694
|
},
|
|
1695
1695
|
{
|
|
1696
1696
|
"path": "src/lib/windows-elevation.ts",
|
|
1697
|
-
"sha256": "
|
|
1697
|
+
"sha256": "eeb579420c42318232ffdf924dba46d3ec172fb7dd8d83930a2985dfbc875d4a"
|
|
1698
1698
|
},
|
|
1699
1699
|
{
|
|
1700
1700
|
"path": "src/lib/windows-secret-acl.ts",
|
|
1701
|
-
"sha256": "
|
|
1701
|
+
"sha256": "6cbb7d5a6d9e5a1d73058af79ac02611e5cebc01fc49c7daf39ab8b0f9b41f53"
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
"path": "src/lib/windows-text.ts",
|
|
1705
|
+
"sha256": "b5b4505de8b0e99df6548e2c6359e57066378b3e1e7ef3fe210e8ecd4aec8367"
|
|
1702
1706
|
},
|
|
1703
1707
|
{
|
|
1704
1708
|
"path": "src/lib/windows-user-principal.ts",
|
|
1705
|
-
"sha256": "
|
|
1709
|
+
"sha256": "c8974defc31bc73364c57ef906befd5142e32467655cefbcf8f764db6ef5c896"
|
|
1706
1710
|
},
|
|
1707
1711
|
{
|
|
1708
1712
|
"path": "src/lib/winsw.ts",
|
|
@@ -1770,7 +1774,7 @@
|
|
|
1770
1774
|
},
|
|
1771
1775
|
{
|
|
1772
1776
|
"path": "src/oauth/index.ts",
|
|
1773
|
-
"sha256": "
|
|
1777
|
+
"sha256": "e42ad175a0eaf9a4ab524066ee825e81b4cd16c3671cb2051968f87a56c46cb7"
|
|
1774
1778
|
},
|
|
1775
1779
|
{
|
|
1776
1780
|
"path": "src/oauth/key-providers.ts",
|
|
@@ -1810,7 +1814,7 @@
|
|
|
1810
1814
|
},
|
|
1811
1815
|
{
|
|
1812
1816
|
"path": "src/oauth/store.ts",
|
|
1813
|
-
"sha256": "
|
|
1817
|
+
"sha256": "61c14ad05498f0146aec503f8618a4249d8064967377c6c782437276c9ab0ac5"
|
|
1814
1818
|
},
|
|
1815
1819
|
{
|
|
1816
1820
|
"path": "src/oauth/token-guardian.ts",
|
|
@@ -1838,7 +1842,7 @@
|
|
|
1838
1842
|
},
|
|
1839
1843
|
{
|
|
1840
1844
|
"path": "src/providers/antigravity-models.ts",
|
|
1841
|
-
"sha256": "
|
|
1845
|
+
"sha256": "005e17707703842d91d9b18aa6f28375bda6b49efff07cb7642c597ee0bcdc8b"
|
|
1842
1846
|
},
|
|
1843
1847
|
{
|
|
1844
1848
|
"path": "src/providers/api-keys.ts",
|
|
@@ -1866,7 +1870,7 @@
|
|
|
1866
1870
|
},
|
|
1867
1871
|
{
|
|
1868
1872
|
"path": "src/providers/free-directory.ts",
|
|
1869
|
-
"sha256": "
|
|
1873
|
+
"sha256": "e984f4a79b202e702f4e73386c479fbe96293e6e99ac97d91ddd410e15999087"
|
|
1870
1874
|
},
|
|
1871
1875
|
{
|
|
1872
1876
|
"path": "src/providers/github-copilot-transport.ts",
|
|
@@ -1938,7 +1942,7 @@
|
|
|
1938
1942
|
},
|
|
1939
1943
|
{
|
|
1940
1944
|
"path": "src/providers/registry.ts",
|
|
1941
|
-
"sha256": "
|
|
1945
|
+
"sha256": "89cc6f2a0fb31b3b05df612e86f396682bc0e7e50bf4d9d733b870ed1307a880"
|
|
1942
1946
|
},
|
|
1943
1947
|
{
|
|
1944
1948
|
"path": "src/providers/slug-codec.ts",
|
|
@@ -1982,11 +1986,11 @@
|
|
|
1982
1986
|
},
|
|
1983
1987
|
{
|
|
1984
1988
|
"path": "src/responses/spill-store.ts",
|
|
1985
|
-
"sha256": "
|
|
1989
|
+
"sha256": "a1239057ea7a156c562222a6f385a3bbd3f324cf346964cb6aae8185f47a3e34"
|
|
1986
1990
|
},
|
|
1987
1991
|
{
|
|
1988
1992
|
"path": "src/responses/state.ts",
|
|
1989
|
-
"sha256": "
|
|
1993
|
+
"sha256": "761a96f2839ee22f7cea11f037424a13bd1dedb0f747f1bc35a81c91ca9b0bbd"
|
|
1990
1994
|
},
|
|
1991
1995
|
{
|
|
1992
1996
|
"path": "src/responses/tool-groups.ts",
|
|
@@ -2106,7 +2110,7 @@
|
|
|
2106
2110
|
},
|
|
2107
2111
|
{
|
|
2108
2112
|
"path": "src/server/chat-completions.ts",
|
|
2109
|
-
"sha256": "
|
|
2113
|
+
"sha256": "31a6edac0e224e98bdfa3c46197388f5ef8067e2be2e25751b2a23fb7a1cdc96"
|
|
2110
2114
|
},
|
|
2111
2115
|
{
|
|
2112
2116
|
"path": "src/server/claude-messages.ts",
|
|
@@ -2118,7 +2122,7 @@
|
|
|
2118
2122
|
},
|
|
2119
2123
|
{
|
|
2120
2124
|
"path": "src/server/effort-policy.ts",
|
|
2121
|
-
"sha256": "
|
|
2125
|
+
"sha256": "1678af1658f000101cb2c5f3273388953e642fbaf7e85771d425d057c4fd2a6f"
|
|
2122
2126
|
},
|
|
2123
2127
|
{
|
|
2124
2128
|
"path": "src/server/github-copilot-responses-repair.ts",
|
|
@@ -2138,7 +2142,7 @@
|
|
|
2138
2142
|
},
|
|
2139
2143
|
{
|
|
2140
2144
|
"path": "src/server/index.ts",
|
|
2141
|
-
"sha256": "
|
|
2145
|
+
"sha256": "e909c5777cac73894273ab6ce9a0e635dc55a74de726cc6a6f71c4409a695ba2"
|
|
2142
2146
|
},
|
|
2143
2147
|
{
|
|
2144
2148
|
"path": "src/server/lifecycle.ts",
|
|
@@ -2206,7 +2210,7 @@
|
|
|
2206
2210
|
},
|
|
2207
2211
|
{
|
|
2208
2212
|
"path": "src/server/management/logs-usage-routes.ts",
|
|
2209
|
-
"sha256": "
|
|
2213
|
+
"sha256": "0f4b36868f53fe7314ba5393f1270045eb8d260058620ab34f4aa343ce0b4b80"
|
|
2210
2214
|
},
|
|
2211
2215
|
{
|
|
2212
2216
|
"path": "src/server/management/model-routes.ts",
|
|
@@ -2310,7 +2314,7 @@
|
|
|
2310
2314
|
},
|
|
2311
2315
|
{
|
|
2312
2316
|
"path": "src/server/request-log.ts",
|
|
2313
|
-
"sha256": "
|
|
2317
|
+
"sha256": "e7111d92152cdedf0e771d719bddee0150124d14bcac13610662dcbed3b75869"
|
|
2314
2318
|
},
|
|
2315
2319
|
{
|
|
2316
2320
|
"path": "src/server/responses-custom-tool-repair.ts",
|
|
@@ -2362,15 +2366,19 @@
|
|
|
2362
2366
|
},
|
|
2363
2367
|
{
|
|
2364
2368
|
"path": "src/server/responses/core.ts",
|
|
2365
|
-
"sha256": "
|
|
2369
|
+
"sha256": "d4eb9b247e29412896578bd59492a0983681210439d19188b992011b4963992d"
|
|
2366
2370
|
},
|
|
2367
2371
|
{
|
|
2368
2372
|
"path": "src/server/responses/encrypted-payload.ts",
|
|
2369
|
-
"sha256": "
|
|
2373
|
+
"sha256": "0e48bc0b453fc6b037d334d06a6454af46d8214f29b286a197d0bfdee138e215"
|
|
2370
2374
|
},
|
|
2371
2375
|
{
|
|
2372
2376
|
"path": "src/server/responses/fetch-helpers.ts",
|
|
2373
|
-
"sha256": "
|
|
2377
|
+
"sha256": "1043b5b66d5d8c43bd3600200d86cbd6bb5af5614bc4fa17bebc2134b854ca99"
|
|
2378
|
+
},
|
|
2379
|
+
{
|
|
2380
|
+
"path": "src/server/responses/input-admission.ts",
|
|
2381
|
+
"sha256": "961168288033b3bb4f1b9542e7ab329a0350d2c5fc44036d2e6cf39355d3b26c"
|
|
2374
2382
|
},
|
|
2375
2383
|
{
|
|
2376
2384
|
"path": "src/server/responses/passthrough-error.ts",
|
|
@@ -2378,7 +2386,7 @@
|
|
|
2378
2386
|
},
|
|
2379
2387
|
{
|
|
2380
2388
|
"path": "src/server/responses/policy-fallback.ts",
|
|
2381
|
-
"sha256": "
|
|
2389
|
+
"sha256": "7f824ac3b25fa7b9716e81daec7fbfab75bd1c08098ab8195b22404922dae856"
|
|
2382
2390
|
},
|
|
2383
2391
|
{
|
|
2384
2392
|
"path": "src/server/responses/terminal-guard.ts",
|
|
@@ -2390,7 +2398,7 @@
|
|
|
2390
2398
|
},
|
|
2391
2399
|
{
|
|
2392
2400
|
"path": "src/server/responses/ws-upstream.ts",
|
|
2393
|
-
"sha256": "
|
|
2401
|
+
"sha256": "9d76c39ae90cb8a2256a851fddd25c8d508816689a2768d9d578ff1ee908ae61"
|
|
2394
2402
|
},
|
|
2395
2403
|
{
|
|
2396
2404
|
"path": "src/server/search.ts",
|
|
@@ -2430,11 +2438,11 @@
|
|
|
2430
2438
|
},
|
|
2431
2439
|
{
|
|
2432
2440
|
"path": "src/service-manager-probe.ts",
|
|
2433
|
-
"sha256": "
|
|
2441
|
+
"sha256": "debddd154561e93532edb423bf53dc917c6619ea980d7061368c22a512b29200"
|
|
2434
2442
|
},
|
|
2435
2443
|
{
|
|
2436
2444
|
"path": "src/service.ts",
|
|
2437
|
-
"sha256": "
|
|
2445
|
+
"sha256": "da173595e82233c5b20b78026255027004f0eea388fc66a7bf073229dd69e45e"
|
|
2438
2446
|
},
|
|
2439
2447
|
{
|
|
2440
2448
|
"path": "src/stall-timeout.ts",
|
|
@@ -2506,11 +2514,11 @@
|
|
|
2506
2514
|
},
|
|
2507
2515
|
{
|
|
2508
2516
|
"path": "src/tray/windows.ts",
|
|
2509
|
-
"sha256": "
|
|
2517
|
+
"sha256": "d571ce0ea715feeb5aebd1f623a06b604f7b1e7f3445fca6ea755bd871415746"
|
|
2510
2518
|
},
|
|
2511
2519
|
{
|
|
2512
2520
|
"path": "src/types.ts",
|
|
2513
|
-
"sha256": "
|
|
2521
|
+
"sha256": "4eccad9a6a250af4255297f55de0a8b4fd31058e7f4ea0068eeba4a744f7a3fd"
|
|
2514
2522
|
},
|
|
2515
2523
|
{
|
|
2516
2524
|
"path": "src/update/badge.ts",
|
|
@@ -2522,7 +2530,7 @@
|
|
|
2522
2530
|
},
|
|
2523
2531
|
{
|
|
2524
2532
|
"path": "src/update/job.ts",
|
|
2525
|
-
"sha256": "
|
|
2533
|
+
"sha256": "60bb9f289105ff55fbf96d15de28e3305ad881f1fcd1f0b2a216eff50e7ff498"
|
|
2526
2534
|
},
|
|
2527
2535
|
{
|
|
2528
2536
|
"path": "src/update/notify.ts",
|
|
@@ -2570,7 +2578,7 @@
|
|
|
2570
2578
|
},
|
|
2571
2579
|
{
|
|
2572
2580
|
"path": "src/usage/summary.ts",
|
|
2573
|
-
"sha256": "
|
|
2581
|
+
"sha256": "7c73078f67bb6b14f8448b794cd1e622f47517f5686efe1cd3553580afe98122"
|
|
2574
2582
|
},
|
|
2575
2583
|
{
|
|
2576
2584
|
"path": "src/usage/totals.ts",
|
|
@@ -2598,7 +2606,7 @@
|
|
|
2598
2606
|
},
|
|
2599
2607
|
{
|
|
2600
2608
|
"path": "src/vision/index.ts",
|
|
2601
|
-
"sha256": "
|
|
2609
|
+
"sha256": "eec04f8b8e21e3e0f894eda6a194947e3e4f91129e9b089f31c1a5f98a781bd6"
|
|
2602
2610
|
},
|
|
2603
2611
|
{
|
|
2604
2612
|
"path": "src/vision/reasoning.ts",
|
|
@@ -2622,7 +2630,7 @@
|
|
|
2622
2630
|
},
|
|
2623
2631
|
{
|
|
2624
2632
|
"path": "src/web-search/index.ts",
|
|
2625
|
-
"sha256": "
|
|
2633
|
+
"sha256": "5334eb4bf0a970693eca2fa7e38cacef23c1ec5b79692383aa7364db2c011144"
|
|
2626
2634
|
},
|
|
2627
2635
|
{
|
|
2628
2636
|
"path": "src/web-search/loop.ts",
|
package/src/lib/errors.ts
CHANGED
|
@@ -43,6 +43,25 @@ function isSubscriptionGateMessage(text: string): boolean {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
function isLocalAclHardeningMessage(text: string): boolean {
|
|
47
|
+
const secretPathHardening = text.includes("secret path") && (
|
|
48
|
+
text.includes("acl") ||
|
|
49
|
+
text.includes("harden") ||
|
|
50
|
+
text.includes("permission") ||
|
|
51
|
+
text.includes("access denied") ||
|
|
52
|
+
text.includes("inheritance")
|
|
53
|
+
);
|
|
54
|
+
return (
|
|
55
|
+
text.includes("icacls") ||
|
|
56
|
+
text.includes("acl hardening") ||
|
|
57
|
+
text.includes("ntfs") ||
|
|
58
|
+
secretPathHardening ||
|
|
59
|
+
text.includes("inheritance:r") ||
|
|
60
|
+
/\bwindows\b.*\bacl\b/.test(text) ||
|
|
61
|
+
text.includes("/grant:r")
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
46
65
|
function isAuthenticationMessage(text: string): boolean {
|
|
47
66
|
const accessDeniedWithCredentialCue = (
|
|
48
67
|
text.includes("access denied") ||
|
|
@@ -170,6 +189,11 @@ export function classifyError(status: number, type: string, message: string): Oc
|
|
|
170
189
|
if (type === "origin_rejected") {
|
|
171
190
|
return { message, type: "invalid_request_error", code: "origin_rejected" };
|
|
172
191
|
}
|
|
192
|
+
// Local ACL setup failures can contain provider-like auth wording (for example
|
|
193
|
+
// "access denied" or "authentication") but represent unavailable infrastructure.
|
|
194
|
+
if (status === 503 && isLocalAclHardeningMessage(text)) {
|
|
195
|
+
return { message, type: "server_error", code: "upstream_server_error" };
|
|
196
|
+
}
|
|
173
197
|
// HTTP 401 and explicit auth failures are authoritative even when provider text
|
|
174
198
|
// also advertises an upgrade or subscription.
|
|
175
199
|
if (
|
|
@@ -280,6 +304,9 @@ export function inferHttpStatusFromAdapterMessage(message: string): number {
|
|
|
280
304
|
lower.includes("too many requests") ||
|
|
281
305
|
lower.includes("throttling")
|
|
282
306
|
) return 429;
|
|
307
|
+
// Local Windows filesystem hardening is infrastructure, not provider authentication.
|
|
308
|
+
// Keep this ahead of auth/permission and timeout keyword inference.
|
|
309
|
+
if (isLocalAclHardeningMessage(lower)) return 503;
|
|
283
310
|
// Strong authentication signals win when a message contains mixed auth and
|
|
284
311
|
// subscription/permission wording.
|
|
285
312
|
if (isAuthenticationMessage(lower)) return 401;
|
|
@@ -55,15 +55,32 @@ function cjkRatio(text: string): number {
|
|
|
55
55
|
return sampled === 0 ? 0 : cjk / sampled;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Cap an estimated token count at a model's context window (codex-router PR #140).
|
|
60
|
+
*
|
|
61
|
+
* A request the provider answered cannot have exceeded the window, so the estimate is never
|
|
62
|
+
* allowed to claim it did: the estimate only ever substitutes a reported-zero (or missing)
|
|
63
|
+
* input count, and a value above the window would be provably false. Positive or missing
|
|
64
|
+
* reported counts are never rewritten here — this bounds the heuristic estimate itself.
|
|
65
|
+
* Non-positive or non-integer windows (unknown model) leave the estimate untouched.
|
|
66
|
+
*/
|
|
67
|
+
export function capEstimateAtContextWindow(estimate: number, contextWindow: number | undefined): number {
|
|
68
|
+
return typeof contextWindow === "number" && Number.isInteger(contextWindow) && contextWindow > 0
|
|
69
|
+
? Math.min(estimate, contextWindow)
|
|
70
|
+
: estimate;
|
|
71
|
+
}
|
|
72
|
+
|
|
58
73
|
/**
|
|
59
74
|
* Estimate the token count of a text blob. Pure and deterministic.
|
|
60
75
|
* Returns 0 for empty/whitespace-free-empty input; otherwise ceil(length / ratio), min 1.
|
|
76
|
+
* When `contextWindow` is a positive integer the estimate is capped at it: a request the
|
|
77
|
+
* provider answered cannot have exceeded the window, so the estimate must not claim it did.
|
|
61
78
|
*/
|
|
62
|
-
export function estimateTokens(text: string, modelId?: string): number {
|
|
79
|
+
export function estimateTokens(text: string, modelId?: string, contextWindow?: number): number {
|
|
63
80
|
if (!text) return 0;
|
|
64
81
|
const len = text.length;
|
|
65
82
|
if (len === 0) return 0;
|
|
66
83
|
let ratio = charsPerToken(modelId);
|
|
67
84
|
if (cjkRatio(text) > CJK_RATIO_THRESHOLD) ratio = Math.min(ratio, CJK_CHARS_PER_TOKEN);
|
|
68
|
-
return Math.max(1, Math.ceil(len / ratio));
|
|
85
|
+
return capEstimateAtContextWindow(Math.max(1, Math.ceil(len / ratio)), contextWindow);
|
|
69
86
|
}
|
|
@@ -612,6 +612,43 @@ export function runWindowsElevated(file: string, args: string[]): Promise<number
|
|
|
612
612
|
return startPowerShellCommand(script).completion.then(result => result.exitCode);
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Register one scheduled-task definition without exposing a mutable XML pathname to
|
|
617
|
+
* the elevated process. The XML bytes are fixed in the encoded PowerShell command
|
|
618
|
+
* before UAC; Register-ScheduledTask receives that string directly after elevation.
|
|
619
|
+
*/
|
|
620
|
+
export function runWindowsElevatedScheduledTaskRegistration(
|
|
621
|
+
taskName: string,
|
|
622
|
+
xml: string,
|
|
623
|
+
): Promise<number> {
|
|
624
|
+
const xmlBase64 = Buffer.from(xml, "utf16le").toString("base64");
|
|
625
|
+
const inner = [
|
|
626
|
+
`$taskName = ${psSingleQuote(taskName)}`,
|
|
627
|
+
`$xmlBase64 = ${psSingleQuote(xmlBase64)}`,
|
|
628
|
+
"$xml = [Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($xmlBase64))",
|
|
629
|
+
"Register-ScheduledTask -TaskName $taskName -Xml $xml -Force -ErrorAction Stop | Out-Null",
|
|
630
|
+
].join("; ");
|
|
631
|
+
const encodedCommand = Buffer.from(inner, "utf16le").toString("base64");
|
|
632
|
+
const script = [
|
|
633
|
+
`$p = Start-Process -FilePath ${psSingleQuote(windowsPowerShell())}`,
|
|
634
|
+
` -ArgumentList ${psSingleQuote(buildWindowsElevatedArgumentList([
|
|
635
|
+
"-NoProfile",
|
|
636
|
+
"-NonInteractive",
|
|
637
|
+
"-ExecutionPolicy",
|
|
638
|
+
"Bypass",
|
|
639
|
+
"-EncodedCommand",
|
|
640
|
+
encodedCommand,
|
|
641
|
+
]))}`,
|
|
642
|
+
" -Verb RunAs -WindowStyle Hidden -PassThru -Wait",
|
|
643
|
+
`if ($null -eq $p) { exit ${OCX_ELEVATED_UAC_CANCELLED} }`,
|
|
644
|
+
"$null = $p.Handle",
|
|
645
|
+
`if ($null -eq $p.ExitCode) { exit ${OCX_ELEVATED_PROTOCOL_FAILED} }`,
|
|
646
|
+
"exit $p.ExitCode",
|
|
647
|
+
].join("; ");
|
|
648
|
+
|
|
649
|
+
return startPowerShellCommand(script).completion.then(result => result.exitCode);
|
|
650
|
+
}
|
|
651
|
+
|
|
615
652
|
/**
|
|
616
653
|
* Build the elevated (post-UAC) script: create → run → optional delete rollback.
|
|
617
654
|
* Returns only OpenCodex protocol exit codes (never raw schtasks codes, never 1223).
|
|
@@ -388,6 +388,13 @@ export function forgetEphemeralSecretPath(tempPath: string): void {
|
|
|
388
388
|
timedOutPaths.delete(`optional:${tempPath}`);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
+
/** Directory counterpart for a proven-absent ephemeral staging root. */
|
|
392
|
+
export function forgetEphemeralSecretDir(tempPath: string): void {
|
|
393
|
+
hardenedDirectories.delete(tempPath);
|
|
394
|
+
timedOutPaths.delete(`required:${tempPath}`);
|
|
395
|
+
timedOutPaths.delete(`optional:${tempPath}`);
|
|
396
|
+
}
|
|
397
|
+
|
|
391
398
|
/** Test seam: timeout memo sets return to baseline after ephemeral cleanup. */
|
|
392
399
|
export function timedOutSecretPathCountForTests(): number {
|
|
393
400
|
return timedOutPaths.size;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode bounded text emitted by Windows system tools.
|
|
3
|
+
*
|
|
4
|
+
* [Decision Log]
|
|
5
|
+
* - Purpose: preserve non-ASCII paths when a Windows tool writes the active
|
|
6
|
+
* legacy code page instead of UTF-8.
|
|
7
|
+
* - Existing constraint: generated service assets may be UTF-16, while
|
|
8
|
+
* redirected `schtasks` output follows the Windows locale on affected hosts.
|
|
9
|
+
* - Alternatives considered: replacement-character heuristics and a new
|
|
10
|
+
* iconv dependency. The former can reinterpret valid text; the latter widens
|
|
11
|
+
* the install/security surface for two small, already-supported codecs.
|
|
12
|
+
* - Choice: recognize UTF-16 first, accept only strict UTF-8 next, then use the
|
|
13
|
+
* locale-appropriate WHATWG decoder (CP949 through `euc-kr`, or Windows-1252
|
|
14
|
+
* only for locales that actually use that family). Unknown/unsupported
|
|
15
|
+
* locales fail back to the old replacement-preserving UTF-8 result instead
|
|
16
|
+
* of guessing another code page or throwing in diagnostics.
|
|
17
|
+
* - Impact: decoding stays dependency-free and bounded, but this deliberately
|
|
18
|
+
* does not guess arbitrary OEM code pages that the runtime cannot identify.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function trimWindowsText(value: string): string {
|
|
22
|
+
return value.replace(/^\uFEFF/, "").trim();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function currentWindowsLocale(): string {
|
|
26
|
+
try {
|
|
27
|
+
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
28
|
+
} catch {
|
|
29
|
+
return "en-US";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function decodeStrict(buffer: Uint8Array, encoding: string): string | null {
|
|
34
|
+
try {
|
|
35
|
+
return trimWindowsText(new TextDecoder(encoding, { fatal: true }).decode(buffer));
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function decodeUtf16Be(buffer: Uint8Array): string {
|
|
42
|
+
const payloadLength = buffer.length - 2;
|
|
43
|
+
const swapped = Buffer.alloc(payloadLength - (payloadLength % 2));
|
|
44
|
+
for (let i = 2; i + 1 < buffer.length; i += 2) {
|
|
45
|
+
swapped[i - 2] = buffer[i + 1]!;
|
|
46
|
+
swapped[i - 1] = buffer[i]!;
|
|
47
|
+
}
|
|
48
|
+
return trimWindowsText(swapped.toString("utf16le"));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* CP949 is exposed by the Encoding Standard under the `euc-kr` label. Keep the
|
|
53
|
+
* Western fallback deliberately narrow: treating CP932, CP1250, or CP1251
|
|
54
|
+
* bytes as Windows-1252 can fabricate a different valid-looking filesystem
|
|
55
|
+
* path, which is worse than the previous replacement-character refusal.
|
|
56
|
+
*/
|
|
57
|
+
function legacyEncodingForLocale(locale: string): "euc-kr" | "windows-1252" | null {
|
|
58
|
+
const language = locale.trim().split(/[-_]/, 1)[0]?.toLowerCase();
|
|
59
|
+
if (language === "ko") return "euc-kr";
|
|
60
|
+
if (language && WINDOWS_1252_LANGUAGES.has(language)) return "windows-1252";
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const WINDOWS_1252_LANGUAGES = new Set([
|
|
65
|
+
"af", "br", "ca", "co", "cy", "da", "de", "en", "es", "eu", "fi", "fo", "fr",
|
|
66
|
+
"ga", "gd", "gl", "id", "is", "it", "lb", "ms", "nl", "no", "oc", "pt", "sq",
|
|
67
|
+
"sv", "sw",
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
export interface WindowsTextDecodeOptions {
|
|
71
|
+
/** Test seam and explicit locale override; production uses the active Intl locale. */
|
|
72
|
+
readonly locale?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function decodeWindowsTextBytes(
|
|
76
|
+
buffer: Uint8Array,
|
|
77
|
+
options: WindowsTextDecodeOptions = {},
|
|
78
|
+
): string {
|
|
79
|
+
if (buffer.length === 0) return "";
|
|
80
|
+
|
|
81
|
+
const bomUtf16Le = buffer.length >= 2 && buffer[0] === 0xff && buffer[1] === 0xfe;
|
|
82
|
+
const bomUtf16Be = buffer.length >= 2 && buffer[0] === 0xfe && buffer[1] === 0xff;
|
|
83
|
+
const looksUtf16Le = buffer.length >= 4
|
|
84
|
+
&& buffer[1] === 0x00
|
|
85
|
+
&& buffer[3] === 0x00
|
|
86
|
+
&& buffer[0] !== 0x00;
|
|
87
|
+
|
|
88
|
+
if (bomUtf16Le || looksUtf16Le) {
|
|
89
|
+
return trimWindowsText(Buffer.from(buffer).toString("utf16le"));
|
|
90
|
+
}
|
|
91
|
+
if (bomUtf16Be) return decodeUtf16Be(buffer);
|
|
92
|
+
|
|
93
|
+
const utf8 = decodeStrict(buffer, "utf-8");
|
|
94
|
+
if (utf8 !== null) return utf8;
|
|
95
|
+
|
|
96
|
+
const locale = options.locale ?? currentWindowsLocale();
|
|
97
|
+
const legacyEncoding = legacyEncodingForLocale(locale);
|
|
98
|
+
if (legacyEncoding !== null) {
|
|
99
|
+
const legacy = decodeStrict(buffer, legacyEncoding);
|
|
100
|
+
if (legacy !== null) return legacy;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Preserve the previous fail-soft behavior when the runtime lacks a codec or
|
|
104
|
+
// the bytes are malformed even for the selected Windows code page.
|
|
105
|
+
return trimWindowsText(new TextDecoder("utf-8").decode(buffer));
|
|
106
|
+
}
|
package/src/oauth/index.ts
CHANGED
|
@@ -1124,7 +1124,7 @@ export async function runLogin(
|
|
|
1124
1124
|
await (deps.saveAccountCredential ?? saveAccountCredential)(provider, opts.reauthAccountId, cred);
|
|
1125
1125
|
} else {
|
|
1126
1126
|
await (deps.saveCredential ?? saveCredential)(provider, cred, {
|
|
1127
|
-
preserveIdentityless:
|
|
1127
|
+
preserveIdentityless: opts?.forceLogin === true,
|
|
1128
1128
|
});
|
|
1129
1129
|
}
|
|
1130
1130
|
if (provider !== "chatgpt") {
|