sneakoscope 8.1.2 → 8.2.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/README.md +96 -58
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/fast-inline.js +5 -51
- package/dist/cli/command-manifest-lite.js +2 -1
- package/dist/cli/command-registry.js +2 -1
- package/dist/cli/global-mode-router.js +1 -1
- package/dist/cli/install-helpers-codex-lb-config.js +112 -914
- package/dist/cli/install-helpers-codex-lb-shared.js +3 -44
- package/dist/cli/install-helpers-install-support.js +4 -20
- package/dist/cli/install-helpers.js +36 -2716
- package/dist/cli/router.js +9 -9
- package/dist/commands/bridge-command-output.js +111 -0
- package/dist/commands/bridge.js +320 -0
- package/dist/commands/codex-app.js +39 -123
- package/dist/commands/doctor-helpers.js +380 -0
- package/dist/commands/doctor-profile.js +3 -0
- package/dist/commands/doctor.js +114 -873
- package/dist/commands/mad-sks.js +0 -4
- package/dist/config/skills-manifest.json +1 -1
- package/dist/core/agents/agent-effort-policy.js +11 -21
- package/dist/core/agents/agent-recursion-guard.js +26 -0
- package/dist/core/agents/agent-runner-codex-exec.js +7 -9
- package/dist/core/architecture-hardening/contracts/contracts.js +225 -161
- package/dist/core/architecture-hardening/state/state-service.js +49 -13
- package/dist/core/auto-review.js +15 -9
- package/dist/core/codex/codex-config-guard.js +8 -0
- package/dist/core/codex-adapter.js +8 -10
- package/dist/core/codex-app/codex-app-fast-ui-repair.js +7 -29
- package/dist/core/codex-app/codex-app-launcher.js +10 -12
- package/dist/core/codex-app/codex-app-restart.js +10 -12
- package/dist/core/codex-app/menubar/constants.js +2 -5
- package/dist/core/codex-app/menubar/global-install.js +3 -2
- package/dist/core/codex-app/menubar/installer/result.js +23 -0
- package/dist/core/codex-app/menubar/installer/runtime.js +28 -0
- package/dist/core/codex-app/menubar/installer.js +5 -96
- package/dist/core/codex-app/menubar/migration.js +1 -42
- package/dist/core/codex-app/openrouter-provider.js +0 -78
- package/dist/core/codex-app.js +97 -360
- package/dist/core/codex-control/codex-app-server-runtime-env.js +8 -28
- package/dist/core/codex-control/codex-current-image-path-real-probe.js +2 -3
- package/dist/core/codex-control/codex-current-web-search-probe.js +2 -3
- package/dist/core/codex-control/codex-sdk-adapter.js +5 -48
- package/dist/core/codex-control/codex-task-runner.js +16 -60
- package/dist/core/codex-control/desktop-bridge-launch-guard.js +227 -0
- package/dist/core/codex-exec-output-schema.js +11 -13
- package/dist/core/codex-lb/bridge-contracts.js +2 -0
- package/dist/core/codex-lb/bridge-runtime-validation/capability.js +104 -0
- package/dist/core/codex-lb/bridge-runtime-validation/catalog.js +52 -0
- package/dist/core/codex-lb/bridge-runtime-validation/shared.js +109 -0
- package/dist/core/codex-lb/bridge-runtime-validation/status.js +250 -0
- package/dist/core/codex-lb/bridge-runtime-validation.js +106 -0
- package/dist/core/codex-lb/capability-runner.js +505 -201
- package/dist/core/codex-lb/codex-lb-env.js +179 -12
- package/dist/core/codex-lb/combined-catalog/builder.js +86 -0
- package/dist/core/codex-lb/combined-catalog/contracts.js +5 -0
- package/dist/core/codex-lb/combined-catalog/normalize.js +170 -0
- package/dist/core/codex-lb/combined-catalog/persistence.js +207 -0
- package/dist/core/codex-lb/combined-catalog/shared.js +12 -0
- package/dist/core/codex-lb/combined-catalog/storage.js +171 -0
- package/dist/core/codex-lb/combined-catalog.js +12 -0
- package/dist/core/codex-lb/desktop-bridge/client.js +4 -1
- package/dist/core/codex-lb/desktop-bridge/header-policy.js +48 -63
- package/dist/core/codex-lb/desktop-bridge/http-forward.js +115 -83
- package/dist/core/codex-lb/desktop-bridge/launchd.js +20 -13
- package/dist/core/codex-lb/desktop-bridge/location-rewrite.js +4 -1
- package/dist/core/codex-lb/desktop-bridge/security.js +381 -267
- package/dist/core/codex-lb/desktop-bridge/server.js +148 -19
- package/dist/core/codex-lb/desktop-bridge/state.js +56 -70
- package/dist/core/codex-lb/desktop-bridge/types.js +6 -1
- package/dist/core/codex-lb/desktop-bridge/websocket-forward.js +281 -106
- package/dist/core/codex-lb/desktop-bridge-migration/historical-config.js +245 -0
- package/dist/core/codex-lb/desktop-bridge-migration/historical-toml.js +56 -0
- package/dist/core/codex-lb/desktop-bridge-migration/metadata.js +73 -0
- package/dist/core/codex-lb/desktop-bridge-migration/receipt.js +52 -0
- package/dist/core/codex-lb/desktop-bridge-migration/retired-runtime-cleanup.js +106 -0
- package/dist/core/codex-lb/desktop-bridge-migration/types.js +1 -0
- package/dist/core/codex-lb/desktop-bridge-migration.js +238 -0
- package/dist/core/codex-lb/desktop-controller-v3/catalog.js +257 -0
- package/dist/core/codex-lb/desktop-controller-v3/diagnostics.js +62 -0
- package/dist/core/codex-lb/desktop-controller-v3/lifecycle-commands.js +203 -0
- package/dist/core/codex-lb/desktop-controller-v3/live-probes.js +293 -0
- package/dist/core/codex-lb/desktop-controller-v3/preflight-probes.js +144 -0
- package/dist/core/codex-lb/desktop-controller-v3/provider-commands.js +182 -0
- package/dist/core/codex-lb/desktop-controller-v3/shared.js +279 -0
- package/dist/core/codex-lb/desktop-controller-v3/status.js +269 -0
- package/dist/core/codex-lb/desktop-controller-v3/types.js +1 -0
- package/dist/core/codex-lb/desktop-controller-v3/verification.js +89 -0
- package/dist/core/codex-lb/desktop-controller-v3.js +67 -0
- package/dist/core/codex-lb/desktop-controller.js +2 -1730
- package/dist/core/codex-lb/desktop-service.js +462 -627
- package/dist/core/codex-lb/migration-receipt.js +560 -118
- package/dist/core/codex-lb/probes/auxiliary-surfaces-probe.js +37 -53
- package/dist/core/codex-lb/probes/bridge-probe.js +125 -64
- package/dist/core/codex-lb/probes/catalog-probe.js +36 -136
- package/dist/core/codex-lb/probes/computer-use-probe.js +63 -39
- package/dist/core/codex-lb/probes/image-generation-probe.js +98 -41
- package/dist/core/codex-lb/probes/probe-evidence.js +32 -33
- package/dist/core/codex-lb/probes/voice-realtime-probe.js +69 -43
- package/dist/core/codex-lb/provider-credentials/configuration.js +127 -0
- package/dist/core/codex-lb/provider-credentials/locks.js +11 -0
- package/dist/core/codex-lb/provider-credentials/private-snapshot.js +28 -0
- package/dist/core/codex-lb/provider-credentials/removal.js +33 -0
- package/dist/core/codex-lb/provider-credentials/resolution.js +59 -0
- package/dist/core/codex-lb/provider-credentials/runtime.js +55 -0
- package/dist/core/codex-lb/provider-credentials/types.js +1 -0
- package/dist/core/codex-lb/provider-credentials/validation-store.js +137 -0
- package/dist/core/codex-lb/provider-credentials.js +5 -0
- package/dist/core/codex-lb/provider-registry.js +323 -0
- package/dist/core/codex-lb/provider-route-policy.js +118 -0
- package/dist/core/codex-lb/request-route-resolver.js +172 -0
- package/dist/core/codex-lb/route-index.js +148 -0
- package/dist/core/codex-lb/trusted-deep-evidence.js +158 -286
- package/dist/core/commands/basic-cli.js +1 -1
- package/dist/core/commands/check-command.js +3 -10
- package/dist/core/commands/gate-result-contract.js +10 -14
- package/dist/core/commands/intent-normalization/normalizer.js +1 -1
- package/dist/core/commands/mad-sks-command.js +2 -6
- package/dist/core/commands/release-command.js +11 -1
- package/dist/core/commands/telegram-command.js +46 -6
- package/dist/core/doctor/doctor-readiness-matrix.js +9 -7
- package/dist/core/doctor/skill-legacy-surface.js +5 -5
- package/dist/core/evidence/v2/evidence-key.js +30 -3
- package/dist/core/feature-fixtures.js +8 -1
- package/dist/core/feature-registry.js +3 -2
- package/dist/core/hooks-runtime/stop-finalization.js +11 -1
- package/dist/core/hooks-runtime/subagent-context.js +15 -1
- package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +1 -1
- package/dist/core/hooks-runtime/tool-output-quarantine.js +1 -1
- package/dist/core/hooks-runtime.js +73 -87
- package/dist/core/image-ux-review/imagegen-adapter.js +108 -94
- package/dist/core/image-ux-review/real-callout-extractor.js +144 -14
- package/dist/core/imagegen/desktop-bridge-imagegen-target.js +77 -0
- package/dist/core/imagegen/imagegen-capability.js +43 -151
- package/dist/core/init/skills/filesystem.js +89 -0
- package/dist/core/init/skills/inventory.js +97 -0
- package/dist/core/init/skills/manifest.js +151 -0
- package/dist/core/init/skills.js +5 -325
- package/dist/core/init.js +0 -63
- package/dist/core/install/installed-package-smoke.js +1 -1
- package/dist/core/managed-assets/managed-assets-manifest.js +0 -1
- package/dist/core/policy/latest-version-guidance.js +15 -2
- package/dist/core/preflight/parallel-preflight-engine.js +27 -51
- package/dist/core/provider/provider-badge.js +9 -4
- package/dist/core/provider/provider-context.js +57 -107
- package/dist/core/providers/openrouter/openrouter-account.js +3 -1
- package/dist/core/providers/openrouter/openrouter-secret-store.js +91 -22
- package/dist/core/release/desktop-bridge-release-evidence.js +457 -0
- package/dist/core/release/gate-manifest.js +0 -1
- package/dist/core/release/main-push-guard.js +13 -0
- package/dist/core/release/main-push-receipt.js +11 -0
- package/dist/core/release/physical-release-gates.js +664 -61
- package/dist/core/release/publish-preflight.js +3 -3
- package/dist/core/release/release-gate-batch-runner.js +19 -6
- package/dist/core/release/release-gate-dag.js +33 -6
- package/dist/core/release/release-gate-node.js +1 -3
- package/dist/core/release/release-gate-output-contract.js +55 -0
- package/dist/core/release/release-pack-contract.js +1 -1
- package/dist/core/release/release-pack-receipt.js +209 -8
- package/dist/core/release/release-real-contract.js +1 -1
- package/dist/core/release/stage-publish.js +106 -28
- package/dist/core/retention/temp-lease.js +204 -0
- package/dist/core/retention.js +18 -195
- package/dist/core/routes.js +1 -2
- package/dist/core/safety/intent-contract/intent-contract.js +3 -3
- package/dist/core/subagents/naruto-host-credentials.js +6 -1
- package/dist/core/subagents/official-subagent-config.js +27 -9
- package/dist/core/subagents/official-subagent-runner.js +14 -31
- package/dist/core/subagents/wave-lifecycle.js +36 -8
- package/dist/core/subagents/wave-parent-guidance.js +2 -1
- package/dist/core/telegram/doctor.js +2 -2
- package/dist/core/telegram/liveness.js +10 -4
- package/dist/core/triwiki/context-graph/compiler/index.js +18 -18
- package/dist/core/update/update-migration-state/fast-mode-config.js +172 -0
- package/dist/core/update/update-migration-state/session-state-split.js +247 -0
- package/dist/core/update/update-migration-state/simple-stages.js +46 -0
- package/dist/core/update/update-migration-state.js +4 -481
- package/dist/core/version.js +1 -1
- package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +28 -4
- package/dist/native/sks-menubar/Sources/OperationModels.swift +112 -2
- package/dist/native/sks-menubar/Sources/ProviderRouteExplanation.swift +21 -0
- package/dist/native/sks-menubar/Sources/ProvidersBridgeCatalog.swift +140 -0
- package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +107 -470
- package/dist/native/sks-menubar/Sources/ProvidersReliability.swift +27 -197
- package/dist/native/sks-menubar/Sources/ProvidersRoutingTruth.swift +335 -269
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +233 -437
- package/dist/native/sks-menubar/Sources/RemoteCodingViewController.swift +16 -7
- package/dist/native/sks-menubar/Sources/SecureProcessEnvelope.swift +39 -9
- package/dist/native/sks-menubar/Sources/TelegramSupport.swift +56 -0
- package/dist/scripts/canonical-test-runner.js +7 -1
- package/dist/scripts/check-runtime-schemas.js +7 -2
- package/dist/scripts/codex-sdk-real-smoke-check.js +3 -1
- package/dist/scripts/desktop-bridge-capabilities-check.js +123 -0
- package/dist/scripts/{codex-lb-desktop-bridge-latency-check.js → desktop-bridge-latency-check.js} +61 -16
- package/dist/scripts/desktop-bridge-real-evidence-check.js +64 -0
- package/dist/scripts/{codex-lb-desktop-bridge-check.js → desktop-bridge-transport-check.js} +92 -155
- package/dist/scripts/desktop-bridge-transport-client.js +116 -0
- package/dist/scripts/desktop-bridge-unification-check.js +276 -0
- package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +12 -8
- package/dist/scripts/gate-policy-audit-check.js +52 -2
- package/dist/scripts/provider-badge-context-check.js +55 -12
- package/dist/scripts/publish-preflight.js +1 -2
- package/dist/scripts/release-affected-selector-check.js +1 -2
- package/dist/scripts/release-aggressive-resource-governor-check.js +1 -1
- package/dist/scripts/release-cache-glob-hashing-check.js +1 -0
- package/dist/scripts/release-cache-version-neutral-fixture-check.js +1 -0
- package/dist/scripts/release-full-parallelism-blackbox.js +1 -1
- package/dist/scripts/release-gate-batch-runner-check.js +9 -0
- package/dist/scripts/release-gate-dag-runner-check.js +6 -0
- package/dist/scripts/release-gate-dag-runner.js +4 -2
- package/dist/scripts/release-metadata-check.js +16 -3
- package/dist/scripts/release-pack-receipt.js +29 -6
- package/dist/scripts/release-physical-gates-check.js +39 -0
- package/dist/scripts/release-real-check.js +7 -5
- package/package.json +6 -8
- package/release-gates.v2.json +156 -157
- package/runtime-required-scripts.json +11 -11
- package/schemas/codex/desktop-bridge-status-v3.schema.json +286 -0
- package/schemas/codex/desktop-capabilities-v3.schema.json +198 -0
- package/schemas/release/release-gate-node.schema.json +2 -3
- package/dist/cli/codex-lb-setup-warning-output.js +0 -17
- package/dist/cli/install-helpers-codex-lb-chain.js +0 -529
- package/dist/commands/codex-lb.js +0 -1232
- package/dist/core/architecture-hardening/migration/migration.js +0 -111
- package/dist/core/codex-app/auxiliary-oauth-policy.js +0 -36
- package/dist/core/codex-app/catalog-compat/catalog-service.js +0 -104
- package/dist/core/codex-app/child-policy/child-policy.js +0 -35
- package/dist/core/codex-app/desktop-routing-snapshot.js +0 -233
- package/dist/core/codex-app/glm-model-profile.js +0 -1
- package/dist/core/codex-app/glm-profile-installer.js +0 -191
- package/dist/core/codex-app/glm-profile-schema.js +0 -42
- package/dist/core/codex-app/multi-provider-router.js +0 -391
- package/dist/core/codex-app/openrouter-activate.js +0 -405
- package/dist/core/codex-app/openrouter-model-catalog.js +0 -217
- package/dist/core/codex-app/provider-child-policy.js +0 -64
- package/dist/core/codex-app/provider-mode.js +0 -91
- package/dist/core/codex-app/provider-session-policy.js +0 -85
- package/dist/core/codex-app/session-policy/session-pinning.js +0 -68
- package/dist/core/codex-control/codex-lb-launch-recovery.js +0 -319
- package/dist/core/codex-lb/codex-lb-setup.js +0 -293
- package/dist/core/codex-lb/codex-lb-tool-catalog.js +0 -456
- package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +0 -290
- package/dist/core/codex-lb/desktop-center-credentials.js +0 -1083
- package/dist/core/codex-lb/desktop-mode.js +0 -32
- package/dist/core/codex-lb/desktop-real-evidence.js +0 -168
- package/dist/core/codex-lb/legacy-migration.js +0 -576
- package/dist/core/codex-lb/native-openai-transport/transport.js +0 -68
- package/dist/core/codex-lb/provider-routing/provider-router.js +0 -58
- package/dist/core/codex-lb/routing-truth.js +0 -327
- package/dist/core/imagegen/codex-lb-imagegen-target.js +0 -92
- package/dist/native/sks-menubar/Sources/ProvidersConnectTest.swift +0 -118
- package/dist/native/sks-menubar/Sources/ProvidersFastMode.swift +0 -17
- package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +0 -331
- package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +0 -260
- package/dist/scripts/codex-lb-catalog-passthrough-check.js +0 -120
- package/dist/scripts/codex-lb-desktop-auth-invariant-check.js +0 -169
- package/dist/scripts/codex-lb-desktop-capabilities-check.js +0 -287
- package/dist/scripts/codex-lb-desktop-real-evidence-check.js +0 -123
- package/dist/scripts/codex-lb-fast-mode-truth-check.js +0 -114
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +0 -152
- package/dist/scripts/codex-lb-gpt56-fast-profile-check.js +0 -231
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { writeJsonAtomic } from '../core/fsx.js';
|
|
4
|
-
import { codexLbDesktopStatusV2, readCodexLbDesktopDeepEvidence, readCodexLbDesktopDeepEvidenceTrustAnchors } from '../core/codex-lb/desktop-controller.js';
|
|
5
|
-
import { CODEX_LB_DESKTOP_REAL_EVIDENCE_CHECK_SCHEMA, validateCodexLbDesktopRealEvidence } from '../core/codex-lb/desktop-real-evidence.js';
|
|
6
|
-
import { uniqueValues as unique } from '../core/text/strings.js';
|
|
7
|
-
const args = process.argv.slice(2);
|
|
8
|
-
const evidencePath = readArg('--evidence')
|
|
9
|
-
|| process.env.SKS_CODEX_LB_DESKTOP_REAL_EVIDENCE_PATH
|
|
10
|
-
|| null;
|
|
11
|
-
const trustAnchorsPath = readArg('--trust-anchors')
|
|
12
|
-
|| process.env.SKS_CODEX_LB_DESKTOP_REAL_EVIDENCE_TRUST_ANCHORS_PATH
|
|
13
|
-
|| null;
|
|
14
|
-
const home = readArg('--home') || process.env.HOME || null;
|
|
15
|
-
const maxAgeMs = positiveNumber(readArg('--max-age-ms') || process.env.SKS_CODEX_LB_DESKTOP_REAL_EVIDENCE_MAX_AGE_MS);
|
|
16
|
-
const reportPath = path.join(process.cwd(), '.sneakoscope', 'reports', 'codex-lb-desktop-real-evidence-check.json');
|
|
17
|
-
const blockers = [];
|
|
18
|
-
let status = null;
|
|
19
|
-
let result;
|
|
20
|
-
try {
|
|
21
|
-
status = await codexLbDesktopStatusV2({
|
|
22
|
-
...(home ? { home } : {}),
|
|
23
|
-
networkProbes: false
|
|
24
|
-
});
|
|
25
|
-
const mode = String(status.mode || 'disabled');
|
|
26
|
-
const bridge = asRecord(status.bridge);
|
|
27
|
-
const endpoint = loopbackCodexEndpoint(bridge.listen_origin);
|
|
28
|
-
if (mode !== 'desktop-native-bridge')
|
|
29
|
-
blockers.push('codex_lb_desktop_real_evidence_native_mode_required');
|
|
30
|
-
if (!endpoint)
|
|
31
|
-
blockers.push('codex_lb_desktop_real_evidence_loopback_endpoint_missing');
|
|
32
|
-
if (!evidencePath)
|
|
33
|
-
blockers.push('codex_lb_desktop_real_evidence_path_missing');
|
|
34
|
-
if (!trustAnchorsPath)
|
|
35
|
-
blockers.push('codex_lb_desktop_real_evidence_trust_anchors_path_missing');
|
|
36
|
-
if (blockers.length || !evidencePath || !trustAnchorsPath || !endpoint) {
|
|
37
|
-
result = missingResult(mode, endpoint, blockers);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const [evidence, trustAnchors] = await Promise.all([
|
|
41
|
-
readCodexLbDesktopDeepEvidence(evidencePath),
|
|
42
|
-
readCodexLbDesktopDeepEvidenceTrustAnchors(trustAnchorsPath)
|
|
43
|
-
]);
|
|
44
|
-
result = validateCodexLbDesktopRealEvidence(evidence, {
|
|
45
|
-
expectedMode: 'desktop-native-bridge',
|
|
46
|
-
expectedEndpoint: endpoint,
|
|
47
|
-
trustAnchors,
|
|
48
|
-
...(maxAgeMs ? { maxAgeMs } : {})
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
result = missingResult(String(status?.mode || 'disabled'), loopbackCodexEndpoint(asRecord(status?.bridge).listen_origin), [safeError(error)]);
|
|
54
|
-
}
|
|
55
|
-
const report = {
|
|
56
|
-
...result,
|
|
57
|
-
evidence_path: evidencePath ? path.resolve(evidencePath) : null,
|
|
58
|
-
trust_anchors_path: trustAnchorsPath ? path.resolve(trustAnchorsPath) : null,
|
|
59
|
-
actual_status: {
|
|
60
|
-
mode: status?.mode || null,
|
|
61
|
-
bridge_running: asRecord(status?.bridge).running === true,
|
|
62
|
-
oauth_present: asRecord(status?.oauth).present === true,
|
|
63
|
-
built_in_provider_retained: asRecord(status?.provider).built_in === true
|
|
64
|
-
},
|
|
65
|
-
report_path: path.relative(process.cwd(), reportPath).split(path.sep).join('/')
|
|
66
|
-
};
|
|
67
|
-
await writeJsonAtomic(reportPath, report);
|
|
68
|
-
console.log(JSON.stringify(report, null, 2));
|
|
69
|
-
if (report.ok !== true)
|
|
70
|
-
process.exitCode = 1;
|
|
71
|
-
function missingResult(mode, endpoint, reasons) {
|
|
72
|
-
return {
|
|
73
|
-
schema: CODEX_LB_DESKTOP_REAL_EVIDENCE_CHECK_SCHEMA,
|
|
74
|
-
ok: false,
|
|
75
|
-
status: 'real_required_missing',
|
|
76
|
-
release_authorizing: false,
|
|
77
|
-
mode,
|
|
78
|
-
endpoint,
|
|
79
|
-
producer_id: null,
|
|
80
|
-
deep_evidence_validation: null,
|
|
81
|
-
required_true_fields: [],
|
|
82
|
-
required_string_fields: [],
|
|
83
|
-
required_array_fields: [],
|
|
84
|
-
verified_fields: [],
|
|
85
|
-
blockers: unique(reasons.length ? reasons : ['codex_lb_desktop_real_evidence_missing']),
|
|
86
|
-
warnings: []
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function loopbackCodexEndpoint(value) {
|
|
90
|
-
try {
|
|
91
|
-
const origin = new URL(String(value || ''));
|
|
92
|
-
if (origin.protocol !== 'http:'
|
|
93
|
-
|| !['127.0.0.1', '::1'].includes(origin.hostname)
|
|
94
|
-
|| origin.username
|
|
95
|
-
|| origin.password
|
|
96
|
-
|| origin.search
|
|
97
|
-
|| origin.hash)
|
|
98
|
-
return null;
|
|
99
|
-
return new URL('/backend-api/codex', origin).toString().replace(/\/+$/, '');
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function readArg(name) {
|
|
106
|
-
const index = args.indexOf(name);
|
|
107
|
-
return index >= 0 && args[index + 1] ? String(args[index + 1]) : null;
|
|
108
|
-
}
|
|
109
|
-
function positiveNumber(value) {
|
|
110
|
-
const parsed = Number(value);
|
|
111
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
112
|
-
}
|
|
113
|
-
function asRecord(value) {
|
|
114
|
-
return value && typeof value === 'object' && !Array.isArray(value)
|
|
115
|
-
? value
|
|
116
|
-
: {};
|
|
117
|
-
}
|
|
118
|
-
function safeError(error) {
|
|
119
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
120
|
-
return /^[a-z0-9_:-]+$/i.test(message)
|
|
121
|
-
? message
|
|
122
|
-
: 'codex_lb_desktop_real_evidence_check_failed';
|
|
123
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { run } from '../commands/codex-lb.js';
|
|
6
|
-
import { CODEX_LB_TOOL_OUTPUT_RECOVERY_MIN_VERSION } from '../core/codex-lb/codex-lb-tool-output-recovery.js';
|
|
7
|
-
const calls = [];
|
|
8
|
-
const home = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-codex-lb-fast-truth-'));
|
|
9
|
-
await fs.mkdir(path.join(home, '.codex'), { recursive: true });
|
|
10
|
-
await fs.writeFile(path.join(home, '.codex', 'config.toml'), [
|
|
11
|
-
'model = "gpt-5.6-sol"',
|
|
12
|
-
'model_provider = "codex-lb"',
|
|
13
|
-
'service_tier = "fast"',
|
|
14
|
-
'',
|
|
15
|
-
'[model_providers.codex-lb]',
|
|
16
|
-
'name = "codex-lb"',
|
|
17
|
-
'base_url = "https://lb.example.test/backend-api/codex"',
|
|
18
|
-
'wire_api = "responses"',
|
|
19
|
-
'env_key = "CODEX_LB_API_KEY"',
|
|
20
|
-
'supports_websockets = true',
|
|
21
|
-
'requires_openai_auth = false',
|
|
22
|
-
''
|
|
23
|
-
].join('\n'));
|
|
24
|
-
await fs.writeFile(path.join(home, '.codex', 'auth.json'), `${JSON.stringify({
|
|
25
|
-
auth_mode: 'chatgpt',
|
|
26
|
-
account_id: 'acct-fast-truth',
|
|
27
|
-
tokens: {
|
|
28
|
-
access_token: 'oauth-fast-truth',
|
|
29
|
-
refresh_token: 'refresh-fast-truth'
|
|
30
|
-
}
|
|
31
|
-
})}\n`);
|
|
32
|
-
await fs.writeFile(path.join(home, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\nexport CODEX_LB_API_KEY='sk-fixture'\n", { mode: 0o600 });
|
|
33
|
-
const chain = await runFastCheck({
|
|
34
|
-
HOME: home,
|
|
35
|
-
CODEX_LB_API_KEY: 'sk-fixture',
|
|
36
|
-
CODEX_LB_BASE_URL: 'https://lb.example.test/backend-api/codex'
|
|
37
|
-
});
|
|
38
|
-
const requestedOnly = await runFastCheck({
|
|
39
|
-
HOME: home,
|
|
40
|
-
CODEX_LB_API_KEY: 'sk-fixture',
|
|
41
|
-
CODEX_LB_BASE_URL: 'https://lb.example.test/backend-api/codex',
|
|
42
|
-
SKS_TEST_FAST_ACTUAL_DEFAULT: '1'
|
|
43
|
-
});
|
|
44
|
-
const ok = chain.ok === true
|
|
45
|
-
&& chain.status === 'fast_verified'
|
|
46
|
-
&& calls[0]?.body?.service_tier === 'priority'
|
|
47
|
-
&& calls.every((call) => call.authorization === 'Bearer sk-fixture' && call.gatewayKey === null)
|
|
48
|
-
&& requestedOnly.ok === false
|
|
49
|
-
&& requestedOnly.status === 'fast_requested_but_actual_unverified'
|
|
50
|
-
&& requestedOnly.blockers.includes('codex_lb_actual_fast_service_tier_unverified');
|
|
51
|
-
console.log(JSON.stringify({
|
|
52
|
-
schema: 'sks.codex-lb-fast-mode-truth-check.v1',
|
|
53
|
-
ok,
|
|
54
|
-
priority_request_sent: calls[0]?.body?.service_tier === 'priority',
|
|
55
|
-
bearer_transport_verified: calls.every((call) => call.authorization === 'Bearer sk-fixture' && call.gatewayKey === null),
|
|
56
|
-
verified_case: chain,
|
|
57
|
-
requested_only_case: requestedOnly,
|
|
58
|
-
blockers: ok ? [] : ['codex_lb_fast_mode_truth_check_failed']
|
|
59
|
-
}, null, 2));
|
|
60
|
-
if (!ok)
|
|
61
|
-
process.exitCode = 1;
|
|
62
|
-
async function runFastCheck(env) {
|
|
63
|
-
const originalFetch = globalThis.fetch;
|
|
64
|
-
const originalEnv = { ...process.env };
|
|
65
|
-
const outputs = [];
|
|
66
|
-
const originalWrite = process.stdout.write.bind(process.stdout);
|
|
67
|
-
const originalExitCode = process.exitCode;
|
|
68
|
-
try {
|
|
69
|
-
Object.assign(process.env, env);
|
|
70
|
-
process.exitCode = 0;
|
|
71
|
-
globalThis.fetch = async (url, init = {}) => {
|
|
72
|
-
if (new URL(String(url)).pathname === '/health') {
|
|
73
|
-
return new Response('{}', {
|
|
74
|
-
status: 200,
|
|
75
|
-
headers: {
|
|
76
|
-
'content-type': 'application/json',
|
|
77
|
-
'x-app-version': CODEX_LB_TOOL_OUTPUT_RECOVERY_MIN_VERSION
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const body = JSON.parse(String(init.body || '{}'));
|
|
82
|
-
const headers = new Headers(init.headers);
|
|
83
|
-
calls.push({
|
|
84
|
-
body,
|
|
85
|
-
authorization: headers.get('authorization'),
|
|
86
|
-
gatewayKey: headers.get('x-codex-lb-api-key')
|
|
87
|
-
});
|
|
88
|
-
const id = calls.length % 2 === 1 ? 'resp_fast_1' : 'resp_fast_2';
|
|
89
|
-
const actual = env.SKS_TEST_FAST_ACTUAL_DEFAULT === '1' ? 'default' : 'priority';
|
|
90
|
-
return new Response(JSON.stringify({
|
|
91
|
-
id,
|
|
92
|
-
requestedServiceTier: 'priority',
|
|
93
|
-
actualServiceTier: actual,
|
|
94
|
-
serviceTier: actual
|
|
95
|
-
}), { status: 200, headers: { 'content-type': 'application/json' } });
|
|
96
|
-
};
|
|
97
|
-
process.stdout.write = (chunk) => {
|
|
98
|
-
outputs.push(String(chunk));
|
|
99
|
-
return true;
|
|
100
|
-
};
|
|
101
|
-
await run(null, ['fast-check', '--json']);
|
|
102
|
-
return JSON.parse(outputs.join('') || '{}');
|
|
103
|
-
}
|
|
104
|
-
finally {
|
|
105
|
-
globalThis.fetch = originalFetch;
|
|
106
|
-
process.stdout.write = originalWrite;
|
|
107
|
-
process.exitCode = originalExitCode;
|
|
108
|
-
for (const key of Object.keys(process.env)) {
|
|
109
|
-
if (!(key in originalEnv))
|
|
110
|
-
delete process.env[key];
|
|
111
|
-
}
|
|
112
|
-
Object.assign(process.env, originalEnv);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { codexLbConfigPath, codexLbEnvPath, configureCodexLbDesktopRouting, ensureGlobalCodexFastModeDuringInstall, repairCodexLbAuth } from '../cli/install-helpers.js';
|
|
6
|
-
import { escapeRegExp } from '../core/text/regex.js';
|
|
7
|
-
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-codex-lb-fast-ui-'));
|
|
8
|
-
const home = path.join(tmp, 'home');
|
|
9
|
-
const codexHome = path.join(home, '.codex');
|
|
10
|
-
const configPath = codexLbConfigPath(home);
|
|
11
|
-
const envPath = codexLbEnvPath(home);
|
|
12
|
-
const authPath = path.join(codexHome, 'auth.json');
|
|
13
|
-
const remoteBaseUrl = 'https://lb.example.test/backend-api/codex';
|
|
14
|
-
const bridgeBaseUrl = 'http://127.0.0.1:54321/backend-api/codex';
|
|
15
|
-
await fs.mkdir(codexHome, { recursive: true });
|
|
16
|
-
const oauthAuth = `${JSON.stringify({
|
|
17
|
-
auth_mode: 'chatgpt',
|
|
18
|
-
tokens: {
|
|
19
|
-
id_token: 'oauth-id',
|
|
20
|
-
access_token: 'oauth-access',
|
|
21
|
-
refresh_token: 'oauth-refresh'
|
|
22
|
-
},
|
|
23
|
-
account_id: 'acct-fast-ui-fixture'
|
|
24
|
-
}, null, 2)}\n`;
|
|
25
|
-
await fs.writeFile(configPath, [
|
|
26
|
-
'model = "future-codex-model"',
|
|
27
|
-
'model_reasoning_effort = "low"',
|
|
28
|
-
'service_tier = "fast"',
|
|
29
|
-
'# sks-codex-lb-managed-desktop-bridge',
|
|
30
|
-
`openai_base_url = "${bridgeBaseUrl}"`,
|
|
31
|
-
'',
|
|
32
|
-
'[features]',
|
|
33
|
-
'fast_mode = true',
|
|
34
|
-
'fast_mode_ui = true',
|
|
35
|
-
'',
|
|
36
|
-
'[user.fast_mode]',
|
|
37
|
-
'visible = true',
|
|
38
|
-
'enabled = true',
|
|
39
|
-
'',
|
|
40
|
-
'[model_providers.codex-lb]',
|
|
41
|
-
'name = "codex-lb"',
|
|
42
|
-
`base_url = "${remoteBaseUrl}"`,
|
|
43
|
-
'wire_api = "responses"',
|
|
44
|
-
'env_key = "CODEX_LB_API_KEY"',
|
|
45
|
-
'supports_websockets = true',
|
|
46
|
-
'requires_openai_auth = false',
|
|
47
|
-
''
|
|
48
|
-
].join('\n'));
|
|
49
|
-
await fs.writeFile(envPath, `export CODEX_LB_BASE_URL="${remoteBaseUrl}"\nexport CODEX_LB_API_KEY="sk-test-fast-ui"\n`, { mode: 0o600 });
|
|
50
|
-
await fs.writeFile(authPath, oauthAuth);
|
|
51
|
-
const install = await ensureGlobalCodexFastModeDuringInstall({
|
|
52
|
-
home,
|
|
53
|
-
configPath,
|
|
54
|
-
forceFastMode: true
|
|
55
|
-
});
|
|
56
|
-
const firstRepair = await repairCodexLbAuth({
|
|
57
|
-
home,
|
|
58
|
-
configPath,
|
|
59
|
-
envPath,
|
|
60
|
-
forceCodexLbApiKeyAuth: true,
|
|
61
|
-
forceFastMode: true,
|
|
62
|
-
authMode: 'codex-lb'
|
|
63
|
-
});
|
|
64
|
-
const firstConfig = await fs.readFile(configPath, 'utf8');
|
|
65
|
-
const firstAuth = await fs.readFile(authPath, 'utf8');
|
|
66
|
-
const firstAssert = assertConfig(firstConfig, 'native_repair');
|
|
67
|
-
const disabled = await configureCodexLbDesktopRouting({
|
|
68
|
-
mode: 'disabled',
|
|
69
|
-
home,
|
|
70
|
-
configPath,
|
|
71
|
-
authPath
|
|
72
|
-
});
|
|
73
|
-
const disabledConfig = await fs.readFile(configPath, 'utf8');
|
|
74
|
-
const disabledAuth = await fs.readFile(authPath, 'utf8');
|
|
75
|
-
const disableAssert = assertConfig(disabledConfig, 'routing_disabled', {
|
|
76
|
-
expectBridge: false
|
|
77
|
-
});
|
|
78
|
-
const reenabled = await configureCodexLbDesktopRouting({
|
|
79
|
-
mode: 'desktop-native-bridge',
|
|
80
|
-
home,
|
|
81
|
-
configPath,
|
|
82
|
-
authPath,
|
|
83
|
-
bridgeBaseUrl,
|
|
84
|
-
remoteBaseUrl,
|
|
85
|
-
gatewayAuthTransport: 'x-codex-lb-api-key'
|
|
86
|
-
});
|
|
87
|
-
const reenabledConfig = await fs.readFile(configPath, 'utf8');
|
|
88
|
-
const reenabledAuth = await fs.readFile(authPath, 'utf8');
|
|
89
|
-
const reenableAssert = assertConfig(reenabledConfig, 'native_reenabled');
|
|
90
|
-
const authPreserved = [firstAuth, disabledAuth, reenabledAuth]
|
|
91
|
-
.every((value) => value === oauthAuth);
|
|
92
|
-
const report = {
|
|
93
|
-
schema: 'sks.codex-lb-fast-ui-preservation-check.v2',
|
|
94
|
-
ok: firstRepair.ok === true
|
|
95
|
-
&& disabled.ok === true
|
|
96
|
-
&& reenabled.ok === true
|
|
97
|
-
&& authPreserved
|
|
98
|
-
&& firstAssert.ok
|
|
99
|
-
&& disableAssert.ok
|
|
100
|
-
&& reenableAssert.ok,
|
|
101
|
-
install_status: install.status,
|
|
102
|
-
first_repair_status: firstRepair.status,
|
|
103
|
-
disable_status: disabled.status,
|
|
104
|
-
reenable_status: reenabled.status,
|
|
105
|
-
oauth_preserved: authPreserved,
|
|
106
|
-
assertions: [firstAssert, disableAssert, reenableAssert],
|
|
107
|
-
config_path: configPath,
|
|
108
|
-
blockers: [
|
|
109
|
-
...(authPreserved ? [] : ['chatgpt_oauth_changed_during_routing_or_fast_repair']),
|
|
110
|
-
...firstAssert.blockers,
|
|
111
|
-
...disableAssert.blockers,
|
|
112
|
-
...reenableAssert.blockers
|
|
113
|
-
]
|
|
114
|
-
};
|
|
115
|
-
console.log(JSON.stringify(report, null, 2));
|
|
116
|
-
if (!report.ok)
|
|
117
|
-
process.exitCode = 1;
|
|
118
|
-
function assertConfig(text, label, options = {}) {
|
|
119
|
-
const expectBridge = options.expectBridge !== false;
|
|
120
|
-
const blockers = [
|
|
121
|
-
...(hasLegacyFastModeTables(text) ? ['legacy_fast_mode_tables_present'] : []),
|
|
122
|
-
...(tableKey(text, 'features', 'fast_mode') === 'true' ? [] : ['features_fast_mode_not_true']),
|
|
123
|
-
...(tableKey(text, 'features', 'fast_mode_ui') ? ['features_fast_mode_ui_legacy_flag_present'] : []),
|
|
124
|
-
...(hasTable(text, 'model_providers.codex-lb') ? [] : ['codex_lb_provider_table_missing']),
|
|
125
|
-
...(tableKey(text, 'model_providers.codex-lb', 'name') === 'codex-lb' ? [] : ['cli_provider_name_not_codex_lb']),
|
|
126
|
-
...(tableKey(text, 'model_providers.codex-lb', 'requires_openai_auth') === 'false' ? [] : ['cli_provider_requires_openai_auth_not_false']),
|
|
127
|
-
...(tableKey(text, 'model_providers.codex-lb', 'env_key') === 'CODEX_LB_API_KEY'
|
|
128
|
-
? []
|
|
129
|
-
: ['cli_provider_env_key_missing']),
|
|
130
|
-
...(topLevelKey(text, 'model_provider') === 'openai' ? [] : ['desktop_model_provider_must_be_openai']),
|
|
131
|
-
...(expectBridge && topLevelKey(text, 'openai_base_url') !== bridgeBaseUrl ? ['native_bridge_base_url_missing'] : []),
|
|
132
|
-
...(!expectBridge && topLevelKey(text, 'openai_base_url') ? ['disabled_routing_still_has_openai_base_url'] : []),
|
|
133
|
-
...(topLevelKey(text, 'model') === 'future-codex-model' ? [] : ['user_model_not_preserved']),
|
|
134
|
-
...(topLevelKey(text, 'model_reasoning_effort') === 'low' ? [] : ['user_reasoning_effort_not_preserved'])
|
|
135
|
-
];
|
|
136
|
-
return { label, ok: blockers.length === 0, blockers };
|
|
137
|
-
}
|
|
138
|
-
function hasLegacyFastModeTables(text) {
|
|
139
|
-
return hasTable(text, 'user.fast_mode') || hasTable(text, 'profiles.sks-fast-high');
|
|
140
|
-
}
|
|
141
|
-
function hasTable(text, table) {
|
|
142
|
-
return new RegExp(`(^|\\n)\\[${escapeRegExp(table)}\\](?=\\n|$)`).test(text);
|
|
143
|
-
}
|
|
144
|
-
function tableKey(text, table, key) {
|
|
145
|
-
const match = text.match(new RegExp(`(^|\\n)\\[${escapeRegExp(table)}\\]([\\s\\S]*?)(?=\\n\\[[^\\]]+\\]|\\s*$)`));
|
|
146
|
-
const block = match?.[2] || '';
|
|
147
|
-
return block.match(new RegExp(`(^|\\n)\\s*${escapeRegExp(key)}\\s*=\\s*([^\\n#]+)`))?.[2]?.trim().replace(/^"|"$/g, '') || '';
|
|
148
|
-
}
|
|
149
|
-
function topLevelKey(text, key) {
|
|
150
|
-
const top = text.split(/\n\s*\[/)[0] || '';
|
|
151
|
-
return top.match(new RegExp(`(^|\\n)\\s*${escapeRegExp(key)}\\s*=\\s*([^\\n#]+)`))?.[2]?.trim().replace(/^"|"$/g, '') || '';
|
|
152
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { codexFastModeDesktopStatus, codexLbConfigPath, configureCodexLb, configureCodexLbDesktopRouting, ensureGlobalCodexFastModeDuringInstall, repairCodexLbAuth } from '../cli/install-helpers.js';
|
|
6
|
-
import { repairCodexConfigStructure, splitCodexProjectConfigPolicy } from '../core/codex/codex-project-config-policy.js';
|
|
7
|
-
import { parseCodexConfigToml, validateCodexConfigRoundTrip } from '../core/codex/codex-config-toml.js';
|
|
8
|
-
import { CODEX_LB_TOOL_OUTPUT_RECOVERY_MIN_VERSION } from '../core/codex-lb/codex-lb-tool-output-recovery.js';
|
|
9
|
-
import { normalizeCodexLbToolCatalog } from '../core/codex-lb/codex-lb-tool-catalog.js';
|
|
10
|
-
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-codex-lb-gpt56-fast-'));
|
|
11
|
-
const home = path.join(tmp, 'home');
|
|
12
|
-
const root = path.join(tmp, 'project');
|
|
13
|
-
const codexHome = path.join(home, '.codex');
|
|
14
|
-
const configPath = codexLbConfigPath(home);
|
|
15
|
-
const envPath = path.join(codexHome, 'sks-codex-lb.env');
|
|
16
|
-
const authPath = path.join(codexHome, 'auth.json');
|
|
17
|
-
const projectConfig = path.join(root, '.codex', 'config.toml');
|
|
18
|
-
const remoteBaseUrl = 'https://lb.example.test/backend-api/codex';
|
|
19
|
-
const bridgeBaseUrl = 'http://127.0.0.1:54321/backend-api/codex';
|
|
20
|
-
await fs.mkdir(path.dirname(projectConfig), { recursive: true });
|
|
21
|
-
await fs.mkdir(codexHome, { recursive: true });
|
|
22
|
-
const oauth = `${JSON.stringify({
|
|
23
|
-
auth_mode: 'chatgpt',
|
|
24
|
-
account_id: 'acct-fast-profile',
|
|
25
|
-
tokens: {
|
|
26
|
-
access_token: 'oauth-access',
|
|
27
|
-
refresh_token: 'oauth-refresh'
|
|
28
|
-
}
|
|
29
|
-
}, null, 2)}\n`;
|
|
30
|
-
await fs.writeFile(authPath, oauth);
|
|
31
|
-
const setup = await configureCodexLb({
|
|
32
|
-
home,
|
|
33
|
-
configPath,
|
|
34
|
-
envPath,
|
|
35
|
-
host: remoteBaseUrl,
|
|
36
|
-
apiKey: 'fixture-codex-lb-fast-key',
|
|
37
|
-
writeEnvFile: true,
|
|
38
|
-
shellProfile: 'skip',
|
|
39
|
-
gatewayAuthTransport: 'x-codex-lb-api-key',
|
|
40
|
-
toolOutputRecoveryFetch
|
|
41
|
-
});
|
|
42
|
-
const native = await configureCodexLbDesktopRouting({
|
|
43
|
-
mode: 'desktop-native-bridge',
|
|
44
|
-
home,
|
|
45
|
-
configPath,
|
|
46
|
-
authPath,
|
|
47
|
-
bridgeBaseUrl,
|
|
48
|
-
remoteBaseUrl,
|
|
49
|
-
gatewayAuthTransport: 'x-codex-lb-api-key'
|
|
50
|
-
});
|
|
51
|
-
const fastOn = await ensureGlobalCodexFastModeDuringInstall({
|
|
52
|
-
home,
|
|
53
|
-
configPath,
|
|
54
|
-
forceFastMode: true
|
|
55
|
-
});
|
|
56
|
-
const first = assertFastProfile(await fs.readFile(configPath, 'utf8'), 'native_fast_on');
|
|
57
|
-
const disabled = await configureCodexLbDesktopRouting({
|
|
58
|
-
mode: 'disabled',
|
|
59
|
-
home,
|
|
60
|
-
configPath,
|
|
61
|
-
authPath
|
|
62
|
-
});
|
|
63
|
-
const afterDisable = assertFastProfile(await fs.readFile(configPath, 'utf8'), 'routing_disabled', false);
|
|
64
|
-
const reenabled = await configureCodexLbDesktopRouting({
|
|
65
|
-
mode: 'desktop-native-bridge',
|
|
66
|
-
home,
|
|
67
|
-
configPath,
|
|
68
|
-
authPath,
|
|
69
|
-
bridgeBaseUrl,
|
|
70
|
-
remoteBaseUrl,
|
|
71
|
-
gatewayAuthTransport: 'x-codex-lb-api-key'
|
|
72
|
-
});
|
|
73
|
-
const repair = await repairCodexLbAuth({
|
|
74
|
-
home,
|
|
75
|
-
configPath,
|
|
76
|
-
envPath,
|
|
77
|
-
forceCodexLbApiKeyAuth: true,
|
|
78
|
-
forceFastMode: true,
|
|
79
|
-
authMode: 'codex-lb'
|
|
80
|
-
});
|
|
81
|
-
await fs.writeFile(projectConfig, [
|
|
82
|
-
'# SKS managed fixture',
|
|
83
|
-
'default_profile = "sks-fast-high"',
|
|
84
|
-
'service_tier = "fast"',
|
|
85
|
-
'',
|
|
86
|
-
'[user.fast_mode]',
|
|
87
|
-
'visible = true',
|
|
88
|
-
'enabled = true',
|
|
89
|
-
'',
|
|
90
|
-
'[profiles.sks-fast-high]',
|
|
91
|
-
'model = "future-codex-model"',
|
|
92
|
-
'service_tier = "fast"',
|
|
93
|
-
''
|
|
94
|
-
].join('\n'));
|
|
95
|
-
const split = await splitCodexProjectConfigPolicy(root, {
|
|
96
|
-
apply: true,
|
|
97
|
-
codexHome,
|
|
98
|
-
configPath: projectConfig,
|
|
99
|
-
writeReport: false
|
|
100
|
-
});
|
|
101
|
-
const structure = await repairCodexConfigStructure(configPath, { apply: true });
|
|
102
|
-
const final = assertFastProfile(await fs.readFile(configPath, 'utf8'), 'after_rewriters');
|
|
103
|
-
const toolCatalog = assertGpt56ToolCatalogContract();
|
|
104
|
-
const authPreserved = await fs.readFile(authPath, 'utf8') === oauth;
|
|
105
|
-
const ok = setup.ok === true
|
|
106
|
-
&& native.ok === true
|
|
107
|
-
&& disabled.ok === true
|
|
108
|
-
&& reenabled.ok === true
|
|
109
|
-
&& !['failed', 'skipped_unsafe_rewrite', 'unparseable_config_preserved'].includes(String(fastOn.status))
|
|
110
|
-
&& repair.ok === true
|
|
111
|
-
&& split.ok === true
|
|
112
|
-
&& structure.ok === true
|
|
113
|
-
&& authPreserved
|
|
114
|
-
&& first.ok
|
|
115
|
-
&& afterDisable.ok
|
|
116
|
-
&& final.ok
|
|
117
|
-
&& toolCatalog.ok;
|
|
118
|
-
const report = {
|
|
119
|
-
schema: 'sks.codex-lb-gpt56-fast-profile-check.v2',
|
|
120
|
-
ok,
|
|
121
|
-
setup_status: setup.status,
|
|
122
|
-
native_status: native.status,
|
|
123
|
-
fast_on_status: fastOn.status,
|
|
124
|
-
disable_status: disabled.status,
|
|
125
|
-
reenable_status: reenabled.status,
|
|
126
|
-
repair_status: repair.status,
|
|
127
|
-
split_status: split.status || null,
|
|
128
|
-
structure_status: structure.status,
|
|
129
|
-
oauth_preserved: authPreserved,
|
|
130
|
-
assertions: [first, afterDisable, final],
|
|
131
|
-
tool_catalog: toolCatalog,
|
|
132
|
-
blockers: [
|
|
133
|
-
...(authPreserved ? [] : ['chatgpt_oauth_changed']),
|
|
134
|
-
...[first, afterDisable, final].flatMap((item) => item.blockers),
|
|
135
|
-
...toolCatalog.blockers
|
|
136
|
-
]
|
|
137
|
-
};
|
|
138
|
-
console.log(JSON.stringify(report, null, 2));
|
|
139
|
-
if (!report.ok)
|
|
140
|
-
process.exitCode = 1;
|
|
141
|
-
function assertFastProfile(text, label, expectBridge = true) {
|
|
142
|
-
const validation = validateCodexConfigRoundTrip(text);
|
|
143
|
-
const parsed = validation.ok ? parseCodexConfigToml(text) : {};
|
|
144
|
-
const provider = parsed.model_providers?.['codex-lb'] || {};
|
|
145
|
-
const desktop = codexFastModeDesktopStatus(text);
|
|
146
|
-
const blockers = [
|
|
147
|
-
...validation.blockers,
|
|
148
|
-
...(parsed.default_profile === undefined ? [] : ['default_profile_legacy_key_present']),
|
|
149
|
-
...(parsed.user?.fast_mode === undefined ? [] : ['user_fast_mode_legacy_table_present']),
|
|
150
|
-
...(parsed.profiles?.['sks-fast-high'] === undefined ? [] : ['sks_fast_high_legacy_profile_present']),
|
|
151
|
-
...(parsed.model === undefined ? [] : ['codex_app_model_was_injected']),
|
|
152
|
-
...(parsed.model_provider === 'openai' ? [] : ['desktop_model_provider_must_be_openai']),
|
|
153
|
-
...(provider.name === 'codex-lb' ? [] : ['codex_lb_cli_provider_name_mismatch']),
|
|
154
|
-
...(provider.requires_openai_auth === false ? [] : ['codex_lb_cli_requires_openai_auth_not_false']),
|
|
155
|
-
...(provider.env_key === 'CODEX_LB_API_KEY'
|
|
156
|
-
? []
|
|
157
|
-
: ['codex_lb_cli_env_key_missing']),
|
|
158
|
-
...(provider.wire_api === 'responses' ? [] : ['codex_lb_wire_api_not_responses']),
|
|
159
|
-
...(expectBridge && parsed.openai_base_url === bridgeBaseUrl ? [] : expectBridge ? ['native_bridge_base_url_missing'] : []),
|
|
160
|
-
...(!expectBridge && parsed.openai_base_url !== undefined ? ['disabled_routing_still_has_openai_base_url'] : []),
|
|
161
|
-
...(parsed.model_catalog_json === undefined ? [] : ['native_local_catalog_must_not_be_bound']),
|
|
162
|
-
...(desktop.on ? [] : ['desktop_fast_status_off'])
|
|
163
|
-
];
|
|
164
|
-
return {
|
|
165
|
-
label,
|
|
166
|
-
ok: blockers.length === 0,
|
|
167
|
-
default_profile: parsed.default_profile || null,
|
|
168
|
-
model: parsed.model || null,
|
|
169
|
-
model_provider: parsed.model_provider || null,
|
|
170
|
-
openai_base_url: parsed.openai_base_url || null,
|
|
171
|
-
legacy_keys: validation.legacy_keys,
|
|
172
|
-
service_tier: parsed.service_tier || null,
|
|
173
|
-
provider_name: provider.name || null,
|
|
174
|
-
provider_wire_api: provider.wire_api || null,
|
|
175
|
-
provider_requires_openai_auth: provider.requires_openai_auth ?? null,
|
|
176
|
-
blockers
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function assertGpt56ToolCatalogContract() {
|
|
180
|
-
const normalized = normalizeCodexLbToolCatalog({
|
|
181
|
-
models: ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna'].map(codexModel)
|
|
182
|
-
});
|
|
183
|
-
const models = normalized.catalog.models.filter((model) => String(model.slug).startsWith('gpt-5.6-'));
|
|
184
|
-
const blockers = [
|
|
185
|
-
...normalized.blockers,
|
|
186
|
-
...(normalized.schema === 'sks.codex-lb-tool-catalog.v1' ? [] : ['codex_lb_gpt56_catalog_schema_mismatch']),
|
|
187
|
-
...(normalized.contract === 'codex-model-catalog-pass-through.v2' ? [] : ['codex_lb_catalog_contract_not_v2']),
|
|
188
|
-
...(normalized.tools_transport === 'full_responses' ? [] : ['codex_lb_gpt56_native_tool_transport_not_full_responses']),
|
|
189
|
-
...(normalized.patched_models.join(',') === 'gpt-5.6-luna,gpt-5.6-sol,gpt-5.6-terra' ? [] : ['codex_lb_gpt56_catalog_patch_set_incomplete']),
|
|
190
|
-
...(models.length === 3 ? [] : ['codex_lb_gpt56_catalog_model_set_incomplete']),
|
|
191
|
-
...(models.every((model) => model.use_responses_lite === false) ? [] : ['codex_lb_gpt56_responses_lite_not_disabled']),
|
|
192
|
-
...(models.every((model) => model.future_unknown_field === 'preserved') ? [] : ['codex_lb_unknown_catalog_field_lost'])
|
|
193
|
-
];
|
|
194
|
-
return {
|
|
195
|
-
ok: blockers.length === 0,
|
|
196
|
-
contract: normalized.contract,
|
|
197
|
-
tools_transport: normalized.tools_transport,
|
|
198
|
-
patched_models: normalized.patched_models,
|
|
199
|
-
blockers
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function codexModel(slug) {
|
|
203
|
-
return {
|
|
204
|
-
slug,
|
|
205
|
-
display_name: slug,
|
|
206
|
-
supported_reasoning_levels: [{ effort: 'medium', description: 'Balanced' }],
|
|
207
|
-
shell_type: 'shell_command',
|
|
208
|
-
visibility: 'list',
|
|
209
|
-
supported_in_api: true,
|
|
210
|
-
priority: 1,
|
|
211
|
-
base_instructions: 'You are Codex.',
|
|
212
|
-
supports_reasoning_summaries: true,
|
|
213
|
-
support_verbosity: true,
|
|
214
|
-
truncation_policy: { mode: 'tokens', limit: 10_000 },
|
|
215
|
-
supports_parallel_tool_calls: true,
|
|
216
|
-
experimental_supported_tools: [],
|
|
217
|
-
tool_mode: 'code_mode_only',
|
|
218
|
-
use_responses_lite: true,
|
|
219
|
-
minimal_client_version: 'runtime',
|
|
220
|
-
future_unknown_field: 'preserved'
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
async function toolOutputRecoveryFetch() {
|
|
224
|
-
return new Response('{}', {
|
|
225
|
-
status: 200,
|
|
226
|
-
headers: {
|
|
227
|
-
'content-type': 'application/json',
|
|
228
|
-
'x-app-version': CODEX_LB_TOOL_OUTPUT_RECOVERY_MIN_VERSION
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|