@kodelyth/codex 2026.5.42 → 2026.6.1
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/package.json +16 -1
- package/doctor-contract-api.test.ts +0 -44
- package/doctor-contract-api.ts +0 -68
- package/harness.ts +0 -72
- package/index.test.ts +0 -230
- package/index.ts +0 -66
- package/media-understanding-provider.test.ts +0 -486
- package/media-understanding-provider.ts +0 -521
- package/prompt-overlay-runtime-contract.test.ts +0 -48
- package/prompt-overlay.ts +0 -21
- package/provider-catalog.ts +0 -83
- package/provider-discovery.ts +0 -45
- package/provider.test.ts +0 -384
- package/provider.ts +0 -243
- package/src/app-server/app-inventory-cache.test.ts +0 -176
- package/src/app-server/app-inventory-cache.ts +0 -324
- package/src/app-server/approval-bridge.test.ts +0 -1471
- package/src/app-server/approval-bridge.ts +0 -1211
- package/src/app-server/auth-bridge.test.ts +0 -1449
- package/src/app-server/auth-bridge.ts +0 -614
- package/src/app-server/auth-profile-runtime-contract.test.ts +0 -239
- package/src/app-server/capabilities.ts +0 -27
- package/src/app-server/client-factory.ts +0 -24
- package/src/app-server/client.test.ts +0 -563
- package/src/app-server/client.ts +0 -715
- package/src/app-server/compact.test.ts +0 -710
- package/src/app-server/compact.ts +0 -500
- package/src/app-server/computer-use.test.ts +0 -788
- package/src/app-server/computer-use.ts +0 -683
- package/src/app-server/config.test.ts +0 -879
- package/src/app-server/config.ts +0 -1038
- package/src/app-server/context-engine-projection.test.ts +0 -252
- package/src/app-server/context-engine-projection.ts +0 -403
- package/src/app-server/delivery-no-reply-runtime-contract.test.ts +0 -80
- package/src/app-server/dynamic-tool-diagnostics.ts +0 -73
- package/src/app-server/dynamic-tool-profile.ts +0 -69
- package/src/app-server/dynamic-tools.test.ts +0 -1302
- package/src/app-server/dynamic-tools.ts +0 -623
- package/src/app-server/elicitation-bridge.test.ts +0 -1056
- package/src/app-server/elicitation-bridge.ts +0 -783
- package/src/app-server/event-projector.test.ts +0 -2668
- package/src/app-server/event-projector.ts +0 -2057
- package/src/app-server/image-payload-sanitizer.test.ts +0 -49
- package/src/app-server/image-payload-sanitizer.ts +0 -167
- package/src/app-server/klaw-owned-tool-runtime-contract.test.ts +0 -456
- package/src/app-server/local-runtime-attribution.ts +0 -39
- package/src/app-server/managed-binary.test.ts +0 -139
- package/src/app-server/managed-binary.ts +0 -193
- package/src/app-server/models.test.ts +0 -246
- package/src/app-server/models.ts +0 -172
- package/src/app-server/native-hook-relay.test.ts +0 -271
- package/src/app-server/native-hook-relay.ts +0 -150
- package/src/app-server/native-subagent-task-mirror.test.ts +0 -573
- package/src/app-server/native-subagent-task-mirror.ts +0 -497
- package/src/app-server/outcome-fallback-runtime-contract.test.ts +0 -404
- package/src/app-server/plugin-activation.test.ts +0 -336
- package/src/app-server/plugin-activation.ts +0 -283
- package/src/app-server/plugin-app-cache-key.ts +0 -74
- package/src/app-server/plugin-approval-roundtrip.ts +0 -122
- package/src/app-server/plugin-inventory.test.ts +0 -355
- package/src/app-server/plugin-inventory.ts +0 -357
- package/src/app-server/plugin-thread-config.test.ts +0 -865
- package/src/app-server/plugin-thread-config.ts +0 -455
- package/src/app-server/protocol-generated/json/DynamicToolCallParams.json +0 -33
- package/src/app-server/protocol-generated/json/v2/ErrorNotification.json +0 -199
- package/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +0 -102
- package/src/app-server/protocol-generated/json/v2/ModelListResponse.json +0 -227
- package/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +0 -2630
- package/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +0 -2630
- package/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +0 -1659
- package/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +0 -1655
- package/src/app-server/protocol-validators.test.ts +0 -75
- package/src/app-server/protocol-validators.ts +0 -203
- package/src/app-server/protocol.ts +0 -520
- package/src/app-server/rate-limit-cache.ts +0 -48
- package/src/app-server/rate-limits.test.ts +0 -202
- package/src/app-server/rate-limits.ts +0 -583
- package/src/app-server/request.ts +0 -73
- package/src/app-server/run-attempt.context-engine.test.ts +0 -1004
- package/src/app-server/run-attempt.test.ts +0 -9477
- package/src/app-server/run-attempt.ts +0 -4683
- package/src/app-server/run-attempt.vision-tools.test.ts +0 -35
- package/src/app-server/schema-normalization-runtime-contract.test.ts +0 -206
- package/src/app-server/session-binding.test.ts +0 -303
- package/src/app-server/session-binding.ts +0 -398
- package/src/app-server/session-history.ts +0 -44
- package/src/app-server/shared-client.test.ts +0 -589
- package/src/app-server/shared-client.ts +0 -289
- package/src/app-server/side-question.test.ts +0 -1175
- package/src/app-server/side-question.ts +0 -1007
- package/src/app-server/test-support.ts +0 -48
- package/src/app-server/thread-lifecycle.test.ts +0 -447
- package/src/app-server/thread-lifecycle.ts +0 -939
- package/src/app-server/thread-lifecycle.user-mcp-servers.test.ts +0 -442
- package/src/app-server/timeout.ts +0 -9
- package/src/app-server/tool-progress-normalization.ts +0 -77
- package/src/app-server/trajectory.test.ts +0 -205
- package/src/app-server/trajectory.ts +0 -365
- package/src/app-server/transcript-mirror.test.ts +0 -524
- package/src/app-server/transcript-mirror.ts +0 -208
- package/src/app-server/transcript-repair-runtime-contract.test.ts +0 -44
- package/src/app-server/transport-stdio.test.ts +0 -171
- package/src/app-server/transport-stdio.ts +0 -107
- package/src/app-server/transport-websocket.test.ts +0 -69
- package/src/app-server/transport-websocket.ts +0 -90
- package/src/app-server/transport.ts +0 -117
- package/src/app-server/user-input-bridge.test.ts +0 -249
- package/src/app-server/user-input-bridge.ts +0 -316
- package/src/app-server/version.ts +0 -4
- package/src/app-server/vision-tools.ts +0 -12
- package/src/command-account.ts +0 -544
- package/src/command-formatters.ts +0 -425
- package/src/command-handlers.ts +0 -2004
- package/src/command-rpc.test.ts +0 -16
- package/src/command-rpc.ts +0 -142
- package/src/commands.test.ts +0 -3312
- package/src/commands.ts +0 -65
- package/src/conversation-binding-data.ts +0 -124
- package/src/conversation-binding.test.ts +0 -599
- package/src/conversation-binding.ts +0 -561
- package/src/conversation-control.test.ts +0 -126
- package/src/conversation-control.ts +0 -303
- package/src/conversation-turn-collector.test.ts +0 -191
- package/src/conversation-turn-collector.ts +0 -186
- package/src/conversation-turn-input.test.ts +0 -141
- package/src/conversation-turn-input.ts +0 -106
- package/src/manifest.test.ts +0 -20
- package/src/migration/apply.ts +0 -501
- package/src/migration/helpers.ts +0 -55
- package/src/migration/plan.ts +0 -461
- package/src/migration/provider.test.ts +0 -1741
- package/src/migration/provider.ts +0 -41
- package/src/migration/source.ts +0 -643
- package/src/migration/targets.ts +0 -25
- package/src/node-cli-sessions.test.ts +0 -180
- package/src/node-cli-sessions.ts +0 -711
- package/test-api.ts +0 -82
- package/tsconfig.json +0 -16
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
formatCodexUsageLimitErrorMessage,
|
|
4
|
-
resolveCodexUsageLimitResetAtMs,
|
|
5
|
-
summarizeCodexAccountUsage,
|
|
6
|
-
summarizeCodexRateLimits,
|
|
7
|
-
} from "./rate-limits.js";
|
|
8
|
-
|
|
9
|
-
describe("formatCodexUsageLimitErrorMessage", () => {
|
|
10
|
-
it("preserves Codex retry hints when structured reset windows are absent", () => {
|
|
11
|
-
const message = formatCodexUsageLimitErrorMessage({
|
|
12
|
-
message:
|
|
13
|
-
"You've hit your usage limit. Upgrade to Pro (https://chatgpt.com/explore/pro), visit https://chatgpt.com/codex/settings/usage to purchase more credits or try again at May 11th, 2026 9:00 AM.",
|
|
14
|
-
codexErrorInfo: "usageLimitExceeded",
|
|
15
|
-
rateLimits: {
|
|
16
|
-
rateLimits: {
|
|
17
|
-
limitId: "codex",
|
|
18
|
-
primary: { usedPercent: 100, windowDurationMins: 300, resetsAt: null },
|
|
19
|
-
secondary: null,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
nowMs: Date.UTC(2026, 4, 10, 23, 0, 0),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
expect(message).toContain("You've reached your Codex subscription usage limit.");
|
|
26
|
-
expect(message).toContain("Codex says to try again at May 11th, 2026 9:00 AM.");
|
|
27
|
-
expect(message).not.toContain("Codex did not return a reset time");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("accepts snake_case rate limit snapshots from Codex core payloads", () => {
|
|
31
|
-
const message = formatCodexUsageLimitErrorMessage({
|
|
32
|
-
message: "You've reached your usage limit.",
|
|
33
|
-
codexErrorInfo: "usageLimitExceeded",
|
|
34
|
-
rateLimits: {
|
|
35
|
-
rate_limits: {
|
|
36
|
-
limit_id: "codex",
|
|
37
|
-
primary: { used_percent: 100, window_minutes: 300, resets_at: 1_700_003_600 },
|
|
38
|
-
secondary: null,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
nowMs: 1_700_000_000_000,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
expect(message).toContain("Next reset in 1 hour, ");
|
|
45
|
-
expect(message).toMatch(/\b[A-Z][a-z]{2} \d{1,2}(?:, \d{4})? at \d{1,2}:\d{2} [AP]M\b/u);
|
|
46
|
-
expect(message).not.toMatch(/\(\d{4}-\d{2}-\d{2}T/u);
|
|
47
|
-
expect(message).not.toContain("Codex did not return a reset time");
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe("Codex rate limit blocking resets", () => {
|
|
52
|
-
it("keeps subscriptions blocked until all exhausted windows reset", () => {
|
|
53
|
-
const nowMs = 1_700_000_000_000;
|
|
54
|
-
const shortTermReset = Math.ceil(nowMs / 1000) + 60 * 60;
|
|
55
|
-
const weeklyReset = Math.ceil(nowMs / 1000) + 24 * 60 * 60;
|
|
56
|
-
const payload = {
|
|
57
|
-
rateLimitsByLimitId: {
|
|
58
|
-
codex: {
|
|
59
|
-
limitId: "codex",
|
|
60
|
-
primary: { usedPercent: 100, windowDurationMins: 300, resetsAt: shortTermReset },
|
|
61
|
-
secondary: { usedPercent: 100, windowDurationMins: 10_080, resetsAt: weeklyReset },
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
expect(resolveCodexUsageLimitResetAtMs(payload, nowMs)).toBe(weeklyReset * 1000);
|
|
67
|
-
expect(summarizeCodexAccountUsage(payload, nowMs)?.blockedUntilMs).toBe(weeklyReset * 1000);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe("summarizeCodexRateLimits", () => {
|
|
72
|
-
it("formats status limits like provider usage summaries", () => {
|
|
73
|
-
const nowMs = 1_700_000_000_000;
|
|
74
|
-
const nowSeconds = nowMs / 1000;
|
|
75
|
-
|
|
76
|
-
expect(
|
|
77
|
-
summarizeCodexRateLimits(
|
|
78
|
-
{
|
|
79
|
-
rateLimits: {
|
|
80
|
-
limitId: "codex",
|
|
81
|
-
limitName: "Codex",
|
|
82
|
-
primary: {
|
|
83
|
-
usedPercent: 26,
|
|
84
|
-
windowDurationMins: 300,
|
|
85
|
-
resetsAt: nowSeconds + 3 * 60 * 60,
|
|
86
|
-
},
|
|
87
|
-
secondary: {
|
|
88
|
-
usedPercent: 4,
|
|
89
|
-
windowDurationMins: 7 * 24 * 60,
|
|
90
|
-
resetsAt: nowSeconds + 7 * 24 * 60 * 60,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
nowMs,
|
|
95
|
-
),
|
|
96
|
-
).toBe("Codex: primary 74% left ⏱3h · secondary 96% left ⏱7d");
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("ignores empty named buckets instead of showing them as available limits", () => {
|
|
100
|
-
const nowMs = 1_700_000_000_000;
|
|
101
|
-
const payload = {
|
|
102
|
-
rateLimitsByLimitId: {
|
|
103
|
-
premium: {
|
|
104
|
-
limitId: "premium",
|
|
105
|
-
limitName: "premium",
|
|
106
|
-
primary: null,
|
|
107
|
-
secondary: null,
|
|
108
|
-
credits: null,
|
|
109
|
-
planType: "pro",
|
|
110
|
-
rateLimitReachedType: null,
|
|
111
|
-
},
|
|
112
|
-
codex: {
|
|
113
|
-
limitId: "codex",
|
|
114
|
-
limitName: "Codex",
|
|
115
|
-
primary: {
|
|
116
|
-
usedPercent: 5,
|
|
117
|
-
windowDurationMins: 300,
|
|
118
|
-
resetsAt: Math.ceil(nowMs / 1000) + 3600,
|
|
119
|
-
},
|
|
120
|
-
secondary: null,
|
|
121
|
-
credits: null,
|
|
122
|
-
planType: "pro",
|
|
123
|
-
rateLimitReachedType: null,
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
expect(summarizeCodexRateLimits(payload, nowMs)).toContain("Codex: primary 95% left ⏱1h");
|
|
129
|
-
expect(summarizeCodexRateLimits(payload, nowMs)).not.toContain("premium");
|
|
130
|
-
expect(summarizeCodexAccountUsage(payload, nowMs)?.usageLine).toBe("short-term 5%");
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("does not render a server-reported usage-limit block as available", () => {
|
|
134
|
-
const payload = {
|
|
135
|
-
rateLimits: {
|
|
136
|
-
limitId: "codex",
|
|
137
|
-
limitName: "Codex",
|
|
138
|
-
primary: null,
|
|
139
|
-
secondary: null,
|
|
140
|
-
credits: null,
|
|
141
|
-
rateLimitReachedType: "rate_limit_reached",
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
expect(summarizeCodexRateLimits(payload, 1_700_000_000_000)).toBe("Codex: rate limit reached");
|
|
146
|
-
expect(summarizeCodexAccountUsage(payload, 1_700_000_000_000)).toMatchObject({
|
|
147
|
-
blocked: true,
|
|
148
|
-
blockingReason: "Codex usage limit is reached",
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it("ignores metadata-only Codex buckets", () => {
|
|
153
|
-
expect(
|
|
154
|
-
summarizeCodexRateLimits({
|
|
155
|
-
rateLimitsByLimitId: {
|
|
156
|
-
codex: {
|
|
157
|
-
limitId: "codex",
|
|
158
|
-
limitName: "Codex",
|
|
159
|
-
primary: null,
|
|
160
|
-
secondary: null,
|
|
161
|
-
credits: null,
|
|
162
|
-
planType: "plus",
|
|
163
|
-
rateLimitReachedType: null,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
}),
|
|
167
|
-
).toBeUndefined();
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it("keeps displayable buckets when sibling buckets are empty", () => {
|
|
171
|
-
const nowMs = 1_700_000_000_000;
|
|
172
|
-
const nowSeconds = nowMs / 1000;
|
|
173
|
-
|
|
174
|
-
expect(
|
|
175
|
-
summarizeCodexRateLimits(
|
|
176
|
-
{
|
|
177
|
-
rateLimitsByLimitId: {
|
|
178
|
-
codex: {
|
|
179
|
-
limitId: "codex",
|
|
180
|
-
limitName: "Codex",
|
|
181
|
-
primary: { usedPercent: 26, windowDurationMins: 300, resetsAt: nowSeconds + 3600 },
|
|
182
|
-
secondary: null,
|
|
183
|
-
credits: null,
|
|
184
|
-
planType: "plus",
|
|
185
|
-
rateLimitReachedType: null,
|
|
186
|
-
},
|
|
187
|
-
"gpt-5.3-codex-spark": {
|
|
188
|
-
limitId: "gpt-5.3-codex-spark",
|
|
189
|
-
limitName: "GPT 5.3 Codex Spark",
|
|
190
|
-
primary: null,
|
|
191
|
-
secondary: null,
|
|
192
|
-
credits: null,
|
|
193
|
-
planType: "plus",
|
|
194
|
-
rateLimitReachedType: null,
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
nowMs,
|
|
199
|
-
),
|
|
200
|
-
).toBe("Codex: primary 74% left ⏱1h");
|
|
201
|
-
});
|
|
202
|
-
});
|