@bitkyc08/opencodex 2.19.0 → 2.20.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-DF_UFrGS.css +1 -0
- package/gui/dist/assets/index-DSK3S5HY.js +76 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/adapters/mimo-free.ts +17 -0
- package/src/adapters/openai-chat.ts +367 -32
- package/src/adapters/registry.ts +144 -0
- package/src/chat/inbound.ts +13 -7
- package/src/cli/claude.ts +2 -1
- package/src/cli/combo.ts +3 -0
- package/src/cli/dispatch.ts +8 -0
- package/src/cli/export-command.ts +2 -2
- package/src/cli/help.ts +2 -0
- package/src/cli/index.ts +3 -2
- package/src/cli/lab.ts +135 -1
- package/src/cli/minimax.ts +491 -0
- package/src/cli/models-runtime.ts +22 -1
- package/src/cli/models.ts +67 -2
- package/src/cli/opencode.ts +2 -1
- package/src/cli/registry.ts +22 -2
- package/src/clients/config-export.ts +125 -7
- package/src/codex/app-server-processes.ts +57 -2
- package/src/codex/app-server-restart-service.ts +232 -0
- package/src/codex/catalog/aggregation.ts +10 -1
- package/src/codex/catalog/effort.ts +15 -3
- package/src/codex/catalog/parsing.ts +3 -1
- package/src/codex/catalog/provider-fetch.ts +45 -5
- package/src/codex/catalog/sync.ts +74 -4
- package/src/codex/convergence.ts +2 -0
- package/src/combos/index.ts +1 -0
- package/src/combos/request.ts +30 -0
- package/src/combos/types.ts +6 -0
- package/src/config.ts +52 -0
- package/src/generated/compatibility-version.json +224 -76
- package/src/images/loop.ts +11 -1
- package/src/integrations/registry.ts +7 -0
- package/src/lab/conformance/jcs.ts +42 -2
- package/src/lab/conformance/negative-controls.ts +6 -2
- package/src/lab/conformance/runner.ts +16 -5
- package/src/lab/fabric/observe.ts +49 -14
- package/src/lab/index.ts +16 -0
- package/src/lab/ledger/purge.ts +152 -83
- package/src/lab/ledger/store.ts +168 -54
- package/src/lab/observe/from-conformance.ts +8 -6
- package/src/lab/observe/from-live.ts +8 -2
- package/src/lab/paths.ts +23 -0
- package/src/lab/public/bundle.ts +217 -0
- package/src/lab/public/community-authority.ts +175 -0
- package/src/lab/public/community-files.ts +29 -0
- package/src/lab/public/community.ts +479 -0
- package/src/lab/public/file-safety.ts +155 -0
- package/src/lab/public/ids.ts +26 -0
- package/src/lab/public/index.ts +16 -0
- package/src/lab/public/mutation-lock.ts +424 -0
- package/src/lab/public/operator.ts +353 -0
- package/src/lab/public/origin-purge.ts +79 -0
- package/src/lab/public/origin.ts +203 -0
- package/src/lab/public/privacy.ts +143 -0
- package/src/lab/public/private-file.ts +261 -0
- package/src/lab/public/project.ts +124 -0
- package/src/lab/public/purge-test-fault.ts +21 -0
- package/src/lab/public/purge.ts +223 -0
- package/src/lab/public/registry.ts +44 -0
- package/src/lab/public/revocation.ts +252 -0
- package/src/lab/public/signature.ts +219 -0
- package/src/lab/public/storage.ts +105 -0
- package/src/lab/public/strict-json.ts +206 -0
- package/src/lab/public/time.ts +26 -0
- package/src/lab/public/types.ts +172 -0
- package/src/lab/public/validate.ts +391 -0
- package/src/lib/codex-restart-contract.ts +120 -0
- package/src/lib/lab-activation.ts +109 -47
- package/src/lib/lab-live-pinned-sender.ts +16 -5
- package/src/lib/pinned-http.ts +70 -16
- package/src/lib/self-launch-argv.ts +15 -0
- package/src/lib/state-store-registrations.ts +2 -0
- package/src/lib/upstream-reachability.ts +4 -0
- package/src/lib/windows-elevation.ts +10 -1
- package/src/providers/derive.ts +24 -4
- package/src/providers/registry.ts +7 -3
- package/src/providers/request-pacing.ts +310 -0
- package/src/providers/service-tier.ts +143 -0
- package/src/providers/static-model-discovery.ts +86 -0
- package/src/reasoning-effort.ts +27 -1
- package/src/router.ts +23 -6
- package/src/routing/capability.ts +4 -2
- package/src/routing/compatibility/behavior.ts +5 -1
- package/src/server/adapter-resolve.ts +2 -32
- package/src/server/auth-cors.ts +8 -0
- package/src/server/chat-completions.ts +74 -36
- package/src/server/chat-native-sse.ts +331 -0
- package/src/server/chat-native.ts +371 -0
- package/src/server/management/combo-routes.ts +16 -2
- package/src/server/management/config-routes.ts +6 -4
- package/src/server/management/context.ts +17 -0
- package/src/server/management/lab-routes.ts +181 -19
- package/src/server/management/model-routes.ts +76 -2
- package/src/server/management/model-rows.ts +8 -0
- package/src/server/management/provider-capability-config.ts +48 -0
- package/src/server/management/provider-routes.ts +76 -4
- package/src/server/management/system-restart.ts +4 -2
- package/src/server/management/system-routes.ts +38 -0
- package/src/server/relay.ts +17 -3
- package/src/server/responses/compact.ts +4 -1
- package/src/server/responses/core.ts +257 -46
- package/src/server/responses/empty-completion-guard.ts +276 -0
- package/src/server/responses/fetch-helpers.ts +35 -4
- package/src/server/responses/pacing-overload.ts +13 -0
- package/src/server/responses/policy-fallback.ts +16 -2
- package/src/server/responses/terminal-guard.ts +1 -1
- package/src/server/responses/upstream-error.ts +5 -0
- package/src/server/responses.ts +17 -2
- package/src/types.ts +66 -4
- package/src/update/index.ts +6 -5
- package/src/update/job.ts +5 -6
- package/src/update/notify.ts +5 -3
- package/src/usage/log.ts +11 -1
- package/gui/dist/assets/index-CQ7bIKee.css +0 -1
- package/gui/dist/assets/index-D_JUZLEC.js +0 -76
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { isServiceViable } from "../../service";
|
|
36
36
|
import { readRuntimePort } from "../../config";
|
|
37
37
|
import { withProcessRuntimeProvenance } from "../../lib/bun-runtime";
|
|
38
|
+
import { selfLaunchArgv } from "../../lib/self-launch-argv";
|
|
38
39
|
import {
|
|
39
40
|
MEMORY_DRAIN_RESTART_MS,
|
|
40
41
|
REPLACEMENT_READY_TIMEOUT_MS,
|
|
@@ -213,19 +214,20 @@ function spawnDetachedStart(
|
|
|
213
214
|
port?: number,
|
|
214
215
|
waitForHealthBeforeParentExit = true,
|
|
215
216
|
): Promise<void> {
|
|
216
|
-
const args = [
|
|
217
|
+
const args = ["start"];
|
|
217
218
|
const expectedPort = typeof port === "number" && Number.isFinite(port) && port > 0 && port <= 65535
|
|
218
219
|
? Math.trunc(port)
|
|
219
220
|
: undefined;
|
|
220
221
|
if (expectedPort !== undefined) {
|
|
221
222
|
args.push("--port", String(expectedPort));
|
|
222
223
|
}
|
|
224
|
+
const launchArgs = selfLaunchArgv(args);
|
|
223
225
|
return new Promise<void>((resolve, reject) => {
|
|
224
226
|
let child: ReturnType<typeof spawn>;
|
|
225
227
|
try {
|
|
226
228
|
const env: NodeJS.ProcessEnv = { ...process.env };
|
|
227
229
|
delete env.OCX_SERVICE;
|
|
228
|
-
child = spawn(process.execPath,
|
|
230
|
+
child = spawn(process.execPath, launchArgs, {
|
|
229
231
|
detached: true,
|
|
230
232
|
stdio: "ignore",
|
|
231
233
|
windowsHide: true,
|
|
@@ -31,8 +31,16 @@ import {
|
|
|
31
31
|
SYSTEM_RESTART_EXPECTED_PID_HEADER,
|
|
32
32
|
parseExpectedSystemRestartPid,
|
|
33
33
|
} from "../../lib/system-restart-contract";
|
|
34
|
+
import {
|
|
35
|
+
CODEX_APP_SERVER_STATE_PATH,
|
|
36
|
+
CODEX_RESTART_PATH,
|
|
37
|
+
} from "../../lib/codex-restart-contract";
|
|
34
38
|
import { jsonResponse } from "../auth-cors";
|
|
35
39
|
import { getInspectionCounters } from "../relay";
|
|
40
|
+
import type {
|
|
41
|
+
performCodexRestart,
|
|
42
|
+
readCodexAppServerState,
|
|
43
|
+
} from "../../codex/app-server-restart-service";
|
|
36
44
|
import type { ManagementContext } from "./context";
|
|
37
45
|
import { acceptSystemRestart } from "./system-restart";
|
|
38
46
|
|
|
@@ -137,5 +145,35 @@ export async function handleSystemRoutes(ctx: ManagementContext): Promise<Respon
|
|
|
137
145
|
}, 202, req, config);
|
|
138
146
|
}
|
|
139
147
|
|
|
148
|
+
if (
|
|
149
|
+
(url.pathname === CODEX_APP_SERVER_STATE_PATH && req.method === "GET")
|
|
150
|
+
|| (url.pathname === CODEX_RESTART_PATH && req.method === "POST")
|
|
151
|
+
) {
|
|
152
|
+
// Resolved inside the path check, not at the top of this function: every
|
|
153
|
+
// /api/system/* request runs through here, and an unconditional import would
|
|
154
|
+
// pull the platform process-enumeration helpers into requests that never
|
|
155
|
+
// touch them.
|
|
156
|
+
// An explicit branch rather than `??`: the seam is an optional property, and
|
|
157
|
+
// narrowing through a nullish default keeps its `undefined` in the union.
|
|
158
|
+
let service: {
|
|
159
|
+
readState: typeof readCodexAppServerState;
|
|
160
|
+
performRestart: typeof performCodexRestart;
|
|
161
|
+
};
|
|
162
|
+
const injected = ctx.deps.codexRestartService;
|
|
163
|
+
if (injected) {
|
|
164
|
+
service = injected;
|
|
165
|
+
} else {
|
|
166
|
+
const module = await import("../../codex/app-server-restart-service");
|
|
167
|
+
service = {
|
|
168
|
+
readState: module.readCodexAppServerState,
|
|
169
|
+
performRestart: module.performCodexRestart,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (req.method === "GET") {
|
|
173
|
+
return jsonResponse(service.readState(), 200, req, config);
|
|
174
|
+
}
|
|
175
|
+
return jsonResponse(await service.performRestart(), 200, req, config);
|
|
176
|
+
}
|
|
177
|
+
|
|
140
178
|
return null;
|
|
141
179
|
}
|
package/src/server/relay.ts
CHANGED
|
@@ -366,6 +366,7 @@ export function trackSseForRequestLog(
|
|
|
366
366
|
): ReadableStream<Uint8Array> {
|
|
367
367
|
const reader = body.getReader();
|
|
368
368
|
let terminalReported = false;
|
|
369
|
+
let cancelled = false;
|
|
369
370
|
|
|
370
371
|
const reportTerminal = (status: ResponsesTerminalStatus) => {
|
|
371
372
|
if (terminalReported) return;
|
|
@@ -385,8 +386,10 @@ export function trackSseForRequestLog(
|
|
|
385
386
|
try {
|
|
386
387
|
const { done, value } = await reader.read();
|
|
387
388
|
if (done) {
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
if (!cancelled) {
|
|
390
|
+
inspector.finish();
|
|
391
|
+
if (!terminalReported) reportTerminal("incomplete");
|
|
392
|
+
}
|
|
390
393
|
inspector.dispose();
|
|
391
394
|
controller.close();
|
|
392
395
|
return;
|
|
@@ -394,12 +397,19 @@ export function trackSseForRequestLog(
|
|
|
394
397
|
inspector.feed(value);
|
|
395
398
|
controller.enqueue(value);
|
|
396
399
|
} catch (err) {
|
|
397
|
-
|
|
400
|
+
// The upstream read rejected: the 200 body died mid-flight. Client
|
|
401
|
+
// cancellation is the caller's separate 499 path, so a cancel-drained
|
|
402
|
+
// pending read (cancelled=true) must not carry the truncation marker.
|
|
403
|
+
if (!cancelled && !terminalReported && logCtx?.activeAttempt) {
|
|
404
|
+
logCtx.activeAttempt.streamAborted = true;
|
|
405
|
+
}
|
|
406
|
+
if (!cancelled && !terminalReported) reportTerminal("incomplete");
|
|
398
407
|
inspector.dispose();
|
|
399
408
|
try { controller.error(err); } catch { /* already torn down */ }
|
|
400
409
|
}
|
|
401
410
|
},
|
|
402
411
|
cancel(reason) {
|
|
412
|
+
cancelled = true;
|
|
403
413
|
inspector.dispose();
|
|
404
414
|
onCancel();
|
|
405
415
|
reader.cancel(reason).catch(() => {});
|
|
@@ -1122,6 +1132,10 @@ export function consumeForInspection(
|
|
|
1122
1132
|
if (logCtx) {
|
|
1123
1133
|
logCtx.transportPhase = "mid_stream";
|
|
1124
1134
|
logCtx.terminalSource = "synthetic";
|
|
1135
|
+
// A truncated 200 body must not meter as a success the client never
|
|
1136
|
+
// received; the router's equivalent turn carries 502 + streamAborted
|
|
1137
|
+
// (codex-router #139).
|
|
1138
|
+
if (logCtx.activeAttempt) logCtx.activeAttempt.streamAborted = true;
|
|
1125
1139
|
}
|
|
1126
1140
|
onTerminal("failed", 502);
|
|
1127
1141
|
}
|
|
@@ -490,7 +490,10 @@ export async function handleResponsesCompact(
|
|
|
490
490
|
req.signal,
|
|
491
491
|
connectMs,
|
|
492
492
|
false,
|
|
493
|
-
providerFetch(sendProvider
|
|
493
|
+
providerFetch(sendProvider, undefined, {
|
|
494
|
+
providerName: route.providerName,
|
|
495
|
+
modelId: route.modelId,
|
|
496
|
+
}),
|
|
494
497
|
// Every credential-bearing forward send gets manual redirects, not only
|
|
495
498
|
// pool sends: direct mode carries the caller's credential too (#914).
|
|
496
499
|
sendProvider.authMode === "forward",
|