sneakoscope 6.0.2 → 6.1.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 +5 -3
- package/config/codex-releases/{rust-v0.142.0.json → rust-v0.144.1.json} +6 -6
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/cli/install-helpers.js +255 -440
- package/dist/cli/router.js +53 -4
- package/dist/commands/codex-app.js +8 -3
- package/dist/commands/codex-lb.js +169 -40
- package/dist/commands/codex.js +6 -5
- package/dist/commands/doctor.js +60 -26
- package/dist/commands/versioning.js +7 -0
- package/dist/config/skills-manifest.json +57 -57
- package/dist/core/agents/agent-central-ledger.js +9 -0
- package/dist/core/agents/agent-cleanup-executor.js +334 -41
- package/dist/core/agents/agent-cleanup.js +20 -1
- package/dist/core/agents/agent-command-surface.js +2 -1
- package/dist/core/agents/agent-effort-policy.js +46 -33
- package/dist/core/agents/agent-janitor.js +9 -10
- package/dist/core/agents/agent-namespace-safety.js +56 -0
- package/dist/core/agents/agent-orchestrator.js +26 -4
- package/dist/core/agents/agent-output-validator.js +1 -1
- package/dist/core/agents/agent-proof-evidence.js +16 -2
- package/dist/core/agents/agent-role-config.js +3 -6
- package/dist/core/agents/agent-roster.js +2 -2
- package/dist/core/agents/agent-runner-codex-exec.js +2 -0
- package/dist/core/agents/agent-runner-process.js +1 -0
- package/dist/core/agents/fast-mode-policy.js +3 -5
- package/dist/core/agents/native-cli-session-swarm.js +18 -1
- package/dist/core/agents/native-worker-backend-router.js +180 -108
- package/dist/core/agents/parallel-write-fixture.js +15 -10
- package/dist/core/agents/runtime-proof-summary.js +21 -3
- package/dist/core/agents/work-partition/repo-inventory.js +68 -7
- package/dist/core/code-structure.js +5 -4
- package/dist/core/codex/codex-config-guard.js +31 -9
- package/dist/core/codex-app/codex-app-fast-ui-repair.js +51 -20
- package/dist/core/codex-app/codex-app-restart.js +38 -8
- package/dist/core/codex-app/codex-app-ui-state-snapshot.js +11 -3
- package/dist/core/codex-app/sks-menubar.js +100 -40
- package/dist/core/codex-app.js +60 -17
- package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -1
- package/dist/core/codex-compat/codex-release-manifest.js +6 -6
- package/dist/core/codex-control/codex-0139-doctor-real-probe.js +7 -1
- package/dist/core/codex-control/codex-0139-image-path-real-probe.js +14 -8
- package/dist/core/codex-control/codex-0139-probe-runner.js +103 -28
- package/dist/core/codex-control/codex-0139-real-probe-summary.js +7 -3
- package/dist/core/codex-control/codex-0139-real-probes.js +21 -6
- package/dist/core/codex-control/codex-0139-sandbox-real-probe.js +39 -13
- package/dist/core/codex-control/codex-0139-web-search-probe.js +11 -8
- package/dist/core/codex-control/{codex-0142-capability.js → codex-0144-capability.js} +22 -22
- package/dist/core/codex-control/codex-0144-collab-agent-real-probe.js +63 -0
- package/dist/core/codex-control/codex-model-metadata.js +8 -4
- package/dist/core/codex-control/codex-multi-agent-event-normalizer.js +5 -1
- package/dist/core/codex-control/codex-reliability-shield.js +4 -1
- package/dist/core/codex-control/codex-sdk-adapter.js +53 -6
- package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
- package/dist/core/codex-control/codex-sdk-sandbox-policy.js +6 -3
- package/dist/core/codex-lb/codex-lb-env.js +107 -0
- package/dist/core/codex-lb/codex-lb-tool-catalog.js +478 -0
- package/dist/core/codex-native/codex-native-feature-broker.js +22 -22
- package/dist/core/codex-native/codex-native-feature-matrix.js +2 -2
- package/dist/core/codex-native/native-capability-postcheck.js +16 -8
- package/dist/core/codex-native/native-capability-repair-matrix.js +76 -27
- package/dist/core/codex-plugins/codex-plugin-json.js +67 -21
- package/dist/core/codex-plugins/codex-plugin-repair.js +118 -0
- package/dist/core/codex-runtime/codex-desktop-config-policy.js +306 -0
- package/dist/core/commands/agent-command.js +19 -0
- package/dist/core/commands/basic-cli.js +45 -24
- package/dist/core/commands/gc-command.js +27 -4
- package/dist/core/commands/image-ux-review-command.js +55 -24
- package/dist/core/commands/mad-sks-command.js +152 -132
- package/dist/core/commands/naruto-command.js +41 -10
- package/dist/core/commands/pipeline-command.js +1 -0
- package/dist/core/commands/wiki-command.js +179 -83
- package/dist/core/computer-use-live-evidence.js +166 -3
- package/dist/core/computer-use-status.js +5 -2
- package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +2 -2
- package/dist/core/daemon/sksd-hook-daemon.js +171 -28
- package/dist/core/daemon/sksd-hook-dispatch.js +2 -2
- package/dist/core/dfix/verification-selector.js +6 -4
- package/dist/core/doctor/browser-use-repair.js +54 -13
- package/dist/core/doctor/codex-0139-doctor.js +3 -2
- package/dist/core/doctor/computer-use-repair.js +28 -39
- package/dist/core/doctor/doctor-codex-startup-repair.js +19 -9
- package/dist/core/doctor/doctor-context7-repair.js +1 -1
- package/dist/core/doctor/doctor-dirty-planner.js +1 -1
- package/dist/core/doctor/doctor-native-capability-repair.js +74 -3
- package/dist/core/doctor/imagegen-repair.js +47 -12
- package/dist/core/doctor/legacy-global-hook-cleanup.js +179 -0
- package/dist/core/feature-registry.js +25 -31
- package/dist/core/fsx.js +54 -6
- package/dist/core/harness-conflicts.js +1 -1
- package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +5 -4
- package/dist/core/hooks-runtime/hook-invocation-dedupe.js +147 -0
- package/dist/core/hooks-runtime/hook-io.js +6 -0
- package/dist/core/hooks-runtime.js +17 -2
- package/dist/core/image/image-artifact-path-contract.js +8 -6
- package/dist/core/image/image-artifact-registry.js +5 -1
- package/dist/core/image-ux-review/imagegen-adapter.js +5 -2
- package/dist/core/imagegen/imagegen-capability.js +10 -13
- package/dist/core/imagegen/require-imagegen.js +37 -11
- package/dist/core/managed-assets/managed-assets-manifest.js +1 -5
- package/dist/core/naruto/naruto-work-graph.js +70 -4
- package/dist/core/naruto/naruto-write-e2e.js +3 -4
- package/dist/core/ops/reporting.js +3 -0
- package/dist/core/pipeline-internals/runtime-core.js +12 -7
- package/dist/core/pipeline-internals/runtime-gates.js +17 -1
- package/dist/core/ppt/style-tokens.js +1 -1
- package/dist/core/ppt-review/index.js +1 -1
- package/dist/core/ppt-review/slide-exporter.js +23 -17
- package/dist/core/ppt-review/slide-imagegen-review.js +1 -1
- package/dist/core/ppt-review/slide-issue-extraction.js +4 -2
- package/dist/core/product-design-plugin.js +2 -2
- package/dist/core/proof/route-finalizer.js +1 -1
- package/dist/core/proof-field.js +3 -3
- package/dist/core/provider/model-router.js +68 -3
- package/dist/core/release/gate-manifest.js +18 -12
- package/dist/core/release/gate-pack-manifest.js +1 -1
- package/dist/core/release/package-size-budget.js +2 -0
- package/dist/core/release/release-gate-affected-selector.js +1 -1
- package/dist/core/release/release-gate-dag.js +43 -3
- package/dist/core/release/release-gate-hermetic-env.js +28 -17
- package/dist/core/release/release-real-contract.js +416 -0
- package/dist/core/retention/retention-budget.js +25 -6
- package/dist/core/retention.js +980 -101
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes/evidence.js +4 -4
- package/dist/core/routes/model-mode-router.js +3 -0
- package/dist/core/routes/ppt-policy.js +1 -1
- package/dist/core/routes.js +11 -12
- package/dist/core/secret-redaction.js +4 -0
- package/dist/core/triwiki/code-pack.js +8 -2
- package/dist/core/triwiki/triwiki-cache-key.js +108 -29
- package/dist/core/triwiki-attention.js +13 -6
- package/dist/core/triwiki-provenance.js +274 -0
- package/dist/core/triwiki-runtime.js +21 -7
- package/dist/core/triwiki-wrongness/wrongness-ledger.js +178 -59
- package/dist/core/triwiki-wrongness/wrongness-retrieval.js +11 -2
- package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +2 -0
- package/dist/core/update/update-migration-state.js +1 -1
- package/dist/core/update/update-notice.js +23 -0
- package/dist/core/update-check.js +69 -25
- package/dist/core/version.js +1 -1
- package/dist/core/wiki-coordinate.js +128 -12
- package/dist/core/work-order-ledger.js +168 -9
- package/dist/core/zellij/zellij-command.js +12 -1
- package/dist/core/zellij/zellij-dashboard-pane.js +3 -3
- package/dist/core/zellij/zellij-launcher.js +15 -14
- package/dist/core/zellij/zellij-pane-proof.js +32 -6
- package/dist/core/zellij/zellij-worker-pane-manager.js +5 -3
- package/dist/scripts/agent-fast-mode-default-check.js +48 -29
- package/dist/scripts/agent-role-config-repair-check.js +25 -4
- package/dist/scripts/agent-wiki-context-proof-check.js +16 -2
- package/dist/scripts/all-feature-deep-completion-check.js +14 -4
- package/dist/scripts/build-dist.js +17 -5
- package/dist/scripts/canonical-test-runner.js +188 -0
- package/dist/scripts/check-command-module-budget.js +38 -16
- package/dist/scripts/check-legacy-free.js +1 -1
- package/dist/scripts/codex-0139-interrupt-agent-check.js +5 -1
- package/dist/scripts/{codex-0142-app-server-v2-check.js → codex-0144-app-server-v2-check.js} +11 -10
- package/dist/scripts/{codex-0142-binary-identity-check.js → codex-0144-binary-identity-check.js} +4 -4
- package/dist/scripts/codex-0144-capability-check.js +21 -0
- package/dist/scripts/{codex-0139-real-probes-check.js → codex-0144-core-real-probes-check.js} +19 -5
- package/dist/scripts/{codex-0142-doctor-wiring-check.js → codex-0144-doctor-wiring-check.js} +6 -6
- package/dist/scripts/{codex-0142-manifest-check.js → codex-0144-manifest-check.js} +11 -3
- package/dist/scripts/{codex-0142-policy-check.js → codex-0144-policy-check.js} +2 -2
- package/dist/scripts/{codex-0142-thread-store-check.js → codex-0144-thread-store-check.js} +3 -3
- package/dist/scripts/codex-app-provider-model-ui-check.js +57 -8
- package/dist/scripts/codex-app-ui-preservation-check.js +35 -4
- package/dist/scripts/codex-control-side-effect-scope-check.js +2 -2
- package/dist/scripts/codex-effort-auto-discovery-check.js +1 -1
- package/dist/scripts/codex-lb-fast-mode-truth-check.js +1 -0
- package/dist/scripts/{codex-lb-gpt55-fast-profile-check.js → codex-lb-gpt56-fast-profile-check.js} +56 -5
- package/dist/scripts/codex-model-metadata-check.js +1 -1
- package/dist/scripts/codex-sdk-sandbox-policy-check.js +5 -1
- package/dist/scripts/codex-sdk-version-compat-check.js +2 -1
- package/dist/scripts/dfix-fixture-check.js +1 -1
- package/dist/scripts/docs-truthfulness-check.js +1 -1
- package/dist/scripts/doctor-codex-startup-repair-check.js +35 -10
- package/dist/scripts/doctor-context7-repair-check.js +2 -1
- package/dist/scripts/doctor-fix-proves-codex-read-check.js +1 -1
- package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +34 -7
- package/dist/scripts/doctor-imagegen-repair-check.js +14 -4
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +1 -1
- package/dist/scripts/doctor-startup-config-repair-check.js +1 -1
- package/dist/scripts/gate-policy-audit-check.js +2 -2
- package/dist/scripts/install-update-preserves-config-check.js +1 -1
- package/dist/scripts/legacy-gate-inventory-check.js +7 -5
- package/dist/scripts/legacy-strong-inventory-check.js +7 -5
- package/dist/scripts/legacy-upgrade-matrix-check.js +5 -5
- package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +175 -14
- package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +166 -6
- package/dist/scripts/mutation-callsite-coverage-check.js +0 -11
- package/dist/scripts/naruto-shadow-clone-swarm-check.js +88 -50
- package/dist/scripts/npm-publish-performance-check.js +2 -1
- package/dist/scripts/package-published-contract-check.js +9 -0
- package/dist/scripts/packlist-performance-check.js +5 -2
- package/dist/scripts/postinstall-safe-side-effects-check.js +8 -3
- package/dist/scripts/ppt-no-mock-as-real-check.js +3 -1
- package/dist/scripts/product-design-plugin-routing-check.js +1 -1
- package/dist/scripts/release-check-stamp.js +182 -2
- package/dist/scripts/release-dag-full-coverage-check.js +7 -7
- package/dist/scripts/release-dynamic-presets-check.js +8 -0
- package/dist/scripts/release-gate-dag-runner-check.js +3 -2
- package/dist/scripts/release-gate-dag-runner.js +24 -11
- package/dist/scripts/release-gate-existence-audit.js +8 -9
- package/dist/scripts/release-gate-script-parity-check.js +1 -1
- package/dist/scripts/release-real-check.js +368 -157
- package/dist/scripts/release-runtime-truth-matrix-check.js +22 -0
- package/dist/scripts/route-proof-artifact-structure-check.js +1 -0
- package/dist/scripts/scheduler-batch-dispatch-check.js +1 -1
- package/dist/scripts/search-visibility-gate-lib.js +1 -1
- package/dist/scripts/seo-geo-route-identity-check.js +30 -4
- package/dist/scripts/sizecheck.js +7 -2
- package/dist/scripts/sks-1-11-gate-lib.js +53 -6
- package/dist/scripts/sks-menubar-install-check.js +7 -0
- package/dist/scripts/sks-uninstall-regression-check.js +1 -1
- package/dist/scripts/sksd-daemon-check.js +16 -6
- package/dist/scripts/update-default-command-check.js +4 -2
- package/dist/scripts/write-build-manifest.js +2 -1
- package/dist/scripts/zellij-layout-valid-check.js +31 -6
- package/dist/scripts/zellij-pane-proof-check.js +33 -2
- package/dist/scripts/zellij-real-session-cleanup-check.js +122 -2
- package/dist/scripts/zellij-real-session-launch-check.js +76 -5
- package/dist/scripts/zellij-slot-pane-renderer-check.js +4 -4
- package/package.json +27 -30
- package/schemas/codex/{app-server-0.142 → app-server-0.144}/codex_app_server_protocol.v2.schemas.json +1146 -781
- package/schemas/codex/codex-0139-real-probe-result.schema.json +39 -5
- package/schemas/codex/ppt-slide-issue-ledger.schema.json +2 -1
- package/dist/core/codex-control/codex-0139-multi-agent-real-probe.js +0 -107
- package/dist/scripts/agent-native-release-gate.js +0 -274
- package/dist/scripts/codex-0142-capability-check.js +0 -21
- package/dist/scripts/command-performance-scorecard-check.js +0 -204
- package/dist/scripts/config-managed-merge-callsite-coverage-check.js +0 -212
- package/dist/scripts/dollar-performance-scorecard-check.js +0 -257
- package/dist/scripts/gate-timing-check.js +0 -16
- package/dist/scripts/ops-maturity-scorecard-check.js +0 -12
- package/dist/scripts/performance-baseline-check.js +0 -12
- package/dist/scripts/performance-improvement-report-check.js +0 -58
- package/dist/scripts/release-parallel-check.js +0 -389
- package/dist/scripts/release-runner-efficiency-check.js +0 -15
- package/dist/scripts/retention-long-run-smoke-check.js +0 -299
- package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
package/dist/cli/router.js
CHANGED
|
@@ -80,6 +80,16 @@ async function dispatchInner(argv) {
|
|
|
80
80
|
if (!helpRequest) {
|
|
81
81
|
const commandGate = await ensureActiveRouteCommandGate(command, rest);
|
|
82
82
|
if (!commandGate.ok) {
|
|
83
|
+
if ('command_result' in commandGate && commandGate.command_result) {
|
|
84
|
+
process.exitCode = 1;
|
|
85
|
+
if (argv.includes('--json'))
|
|
86
|
+
console.log(JSON.stringify(commandGate.command_result, null, 2));
|
|
87
|
+
else
|
|
88
|
+
printHandledCommandBlock(commandGate.command_result);
|
|
89
|
+
return commandGate.command_result;
|
|
90
|
+
}
|
|
91
|
+
if (argv.includes('--json'))
|
|
92
|
+
console.log(JSON.stringify(commandGate, null, 2));
|
|
83
93
|
console.error(commandGate.message);
|
|
84
94
|
process.exitCode = 1;
|
|
85
95
|
return commandGate;
|
|
@@ -92,7 +102,7 @@ async function dispatchInner(argv) {
|
|
|
92
102
|
const migrationGate = await ensureCurrentMigrationBeforeCommand({
|
|
93
103
|
command,
|
|
94
104
|
args: rest,
|
|
95
|
-
skipMigrationGate: entry.skipMigrationGate === true || entry.readonly === true
|
|
105
|
+
skipMigrationGate: entry.skipMigrationGate === true || entry.readonly === true || safeActiveRouteVisualQuery(command, rest)
|
|
96
106
|
});
|
|
97
107
|
if (!migrationGate.ok) {
|
|
98
108
|
console.error('SKS project migration blocked.');
|
|
@@ -106,6 +116,8 @@ async function dispatchInner(argv) {
|
|
|
106
116
|
console.error(`Optional warning: ${warning}`);
|
|
107
117
|
console.error(`Receipt: ${migrationGate.receipt_path}`);
|
|
108
118
|
console.error('Remedies: run `sks doctor --fix --yes`, then retry; diagnostics that must bypass this gate are marked skipMigrationGate in the command registry.');
|
|
119
|
+
if (argv.includes('--json'))
|
|
120
|
+
console.log(JSON.stringify(migrationGate, null, 2));
|
|
109
121
|
process.exitCode = 1;
|
|
110
122
|
return migrationGate;
|
|
111
123
|
}
|
|
@@ -136,9 +148,10 @@ async function ensureActiveRouteCommandGate(command, args) {
|
|
|
136
148
|
return { ok: true, status: 'allowed' };
|
|
137
149
|
if (safeReadOnlySubcommand(args))
|
|
138
150
|
return { ok: true, status: 'allowed_status_subcommand' };
|
|
139
|
-
if (
|
|
140
|
-
return { ok: true, status: '
|
|
141
|
-
|
|
151
|
+
if (safeActiveRouteVisualQuery(command, args))
|
|
152
|
+
return { ok: true, status: 'allowed_visual_query' };
|
|
153
|
+
if (safeActiveRouteRecoverySubcommand(command, args))
|
|
154
|
+
return { ok: true, status: 'allowed_active_route_recovery' };
|
|
142
155
|
const [{ projectRoot, readJson }, { stateFile }] = await Promise.all([
|
|
143
156
|
import('../core/fsx.js'),
|
|
144
157
|
import('../core/mission.js')
|
|
@@ -147,6 +160,14 @@ async function ensureActiveRouteCommandGate(command, args) {
|
|
|
147
160
|
const state = await readJson(stateFile(root), {}).catch(() => ({}));
|
|
148
161
|
if (!activeRouteStateBlocksCommand(state))
|
|
149
162
|
return { ok: true, status: 'allowed' };
|
|
163
|
+
const visualPreflight = await blockedVisualSourcePreflight(command, args);
|
|
164
|
+
if (visualPreflight) {
|
|
165
|
+
return {
|
|
166
|
+
ok: false,
|
|
167
|
+
status: 'handled_non_mutating_visual_preflight',
|
|
168
|
+
command_result: visualPreflight
|
|
169
|
+
};
|
|
170
|
+
}
|
|
150
171
|
return {
|
|
151
172
|
schema: 'sks.command-gate-active-route.v1',
|
|
152
173
|
ok: false,
|
|
@@ -158,12 +179,40 @@ async function ensureActiveRouteCommandGate(command, args) {
|
|
|
158
179
|
message: `SKS command gate blocked '${command}' because active route mission ${state.mission_id} is not closed. Run: sks route close --mission ${state.mission_id}`
|
|
159
180
|
};
|
|
160
181
|
}
|
|
182
|
+
function safeActiveRouteVisualQuery(command, args) {
|
|
183
|
+
if (command !== 'computer-use')
|
|
184
|
+
return false;
|
|
185
|
+
const sub = String(args.find((arg) => !String(arg).startsWith('-')) || '').toLowerCase();
|
|
186
|
+
if (sub !== 'require')
|
|
187
|
+
return false;
|
|
188
|
+
return !args.some((arg) => ['--fix', '--yes', '-y', '--write', '--apply', '--execute', '--force', '--real'].includes(String(arg)));
|
|
189
|
+
}
|
|
190
|
+
async function blockedVisualSourcePreflight(command, args) {
|
|
191
|
+
if (command !== 'image-ux-review' || String(args[0] || '').toLowerCase() !== 'run')
|
|
192
|
+
return null;
|
|
193
|
+
if (!args.includes('--from-chrome-extension') && !args.includes('--from-computer-use'))
|
|
194
|
+
return null;
|
|
195
|
+
const { imageUxReviewSourcePreflight } = await import('../core/commands/image-ux-review-command.js');
|
|
196
|
+
const preflight = await imageUxReviewSourcePreflight([...args.slice(1)]);
|
|
197
|
+
return preflight.result;
|
|
198
|
+
}
|
|
199
|
+
function printHandledCommandBlock(result) {
|
|
200
|
+
console.error(`SKS command blocked: ${result?.blocker || result?.status || 'preflight_failed'}`);
|
|
201
|
+
for (const line of Array.isArray(result?.guidance) ? result.guidance : [])
|
|
202
|
+
console.error(`- ${line}`);
|
|
203
|
+
}
|
|
161
204
|
function safeReadOnlySubcommand(args) {
|
|
162
205
|
const sub = String(args.find((arg) => !String(arg).startsWith('-')) || '').toLowerCase();
|
|
163
206
|
if (!['status', 'show', 'list', 'observe', 'watch', 'doctor', 'help'].includes(sub))
|
|
164
207
|
return false;
|
|
165
208
|
return !args.some((arg) => ['--fix', '--yes', '-y', '--write', '--apply', '--execute', '--force', '--real'].includes(String(arg)));
|
|
166
209
|
}
|
|
210
|
+
function safeActiveRouteRecoverySubcommand(command, args) {
|
|
211
|
+
if (command !== 'agent')
|
|
212
|
+
return false;
|
|
213
|
+
const sub = String(args.find((arg) => !String(arg).startsWith('-')) || '').toLowerCase();
|
|
214
|
+
return ['close', 'cleanup', 'rollback-patches'].includes(sub);
|
|
215
|
+
}
|
|
167
216
|
function activeRouteStateBlocksCommand(state = {}) {
|
|
168
217
|
if (!state?.mission_id || state.route_closed === true)
|
|
169
218
|
return false;
|
|
@@ -12,8 +12,11 @@ import { resolveCodexAppExecutionProfile } from '../core/codex-app/codex-app-exe
|
|
|
12
12
|
import { repairCodexNativeManagedAssets } from '../core/codex-native/codex-native-repair-transaction.js';
|
|
13
13
|
import { doctorCodexAppGlmProfile, installCodexAppGlmProfile } from '../core/codex-app/glm-profile-installer.js';
|
|
14
14
|
import { promptForOpenRouterKeyHidden, writeStoredOpenRouterKey } from '../core/providers/openrouter/openrouter-secret-store.js';
|
|
15
|
+
import { restartCodexApp } from '../core/codex-app/codex-app-restart.js';
|
|
15
16
|
export async function run(_command, args = []) {
|
|
16
17
|
const action = args[0] || 'check';
|
|
18
|
+
if (action === 'restart')
|
|
19
|
+
return printCodexAppResult(args, await restartCodexApp());
|
|
17
20
|
if (action === 'remote-control' || action === 'remote')
|
|
18
21
|
return codexAppRemoteControlCommand(args.slice(1));
|
|
19
22
|
if (action === 'harness-matrix') {
|
|
@@ -47,15 +50,17 @@ export async function run(_command, args = []) {
|
|
|
47
50
|
}
|
|
48
51
|
const record = await writeStoredOpenRouterKey(key);
|
|
49
52
|
const profile = await installCodexAppGlmProfile({ root, apply: true });
|
|
53
|
+
const restart = await restartCodexApp({ enabled: flag(args, '--restart-app') || flag(args, '--restart') });
|
|
50
54
|
const result = {
|
|
51
55
|
schema: 'sks.codex-app-openrouter-key.v1',
|
|
52
|
-
ok: profile.ok,
|
|
53
|
-
status: profile.ok ? 'stored' : '
|
|
56
|
+
ok: Boolean(profile.ok && restart.ok),
|
|
57
|
+
status: !profile.ok ? 'stored_profile_blocked' : restart.ok ? 'stored' : 'stored_restart_blocked',
|
|
54
58
|
key_preview: record.key_preview,
|
|
55
59
|
raw_key_recorded: false,
|
|
56
60
|
secret_store: 'sks-openrouter-secret-store',
|
|
57
61
|
glm_profile: profile,
|
|
58
|
-
|
|
62
|
+
restart_app: restart,
|
|
63
|
+
blockers: [...(profile.blockers || []), ...(restart.blockers || [])],
|
|
59
64
|
warnings: profile.warnings || []
|
|
60
65
|
};
|
|
61
66
|
return printCodexAppResult(args, result);
|
|
@@ -8,6 +8,7 @@ import { codexLbMetrics, readCodexLbCircuit, recordCodexLbHealthEvent, resetCode
|
|
|
8
8
|
import { checkCodexLbResponseChain, codexLbStatus, configureCodexLb, formatCodexLbStatusText, releaseCodexLbAuthHold, repairCodexLbAuth, unselectCodexLbProvider } from '../cli/install-helpers.js';
|
|
9
9
|
import { buildCodexLbSetupPlan, codexLbPersistenceSummary, renderCodexLbSetupPlan } from '../core/codex-lb/codex-lb-setup.js';
|
|
10
10
|
import { restartCodexApp } from '../core/codex-app/codex-app-restart.js';
|
|
11
|
+
import { repairCodexAppFastUi } from '../core/codex-app/codex-app-fast-ui-repair.js';
|
|
11
12
|
export async function run(command, args = []) {
|
|
12
13
|
const root = await projectRoot();
|
|
13
14
|
const action = args[0] || 'status';
|
|
@@ -53,35 +54,43 @@ export async function run(command, args = []) {
|
|
|
53
54
|
if (action === 'fast-check' || action === 'fast' || action === 'verify-fast') {
|
|
54
55
|
const status = await codexLbStatus();
|
|
55
56
|
const blocker = !status.env_key_configured ? 'missing_env_key' : !status.base_url ? 'missing_base_url' : !status.provider_contract_ok ? 'provider_contract_drift' : 'not_configured';
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const modelSelection = await resolveCodexLbFastCheckModel(status);
|
|
58
|
+
const chain = status.env_key_configured && status.base_url && modelSelection.model
|
|
59
|
+
? await checkCodexLbResponseChain(status, { force: true, cache: false, root, fastMode: true, model: modelSelection.model })
|
|
60
|
+
: { ok: false, status: modelSelection.model ? blocker : 'model_unselected', codex_lb: status };
|
|
59
61
|
const evidence = await fastEvidenceFromChain(chain, readOption(args, '--request-log', readOption(args, '--request-log-json', null)));
|
|
60
62
|
const providerReady = status.provider_contract_ok === true;
|
|
63
|
+
const chainVerified = isCodexLbFastChainVerified(chain);
|
|
61
64
|
const result = {
|
|
62
65
|
schema: 'sks.codex-lb-fast-check.v1',
|
|
63
|
-
ok: Boolean(providerReady &&
|
|
66
|
+
ok: Boolean(providerReady && chainVerified && evidence.fast_requested && evidence.fast_actual),
|
|
64
67
|
status: !providerReady
|
|
65
68
|
? 'provider_contract_drift'
|
|
66
|
-
: chain.
|
|
67
|
-
?
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
? '
|
|
71
|
-
:
|
|
72
|
-
|
|
69
|
+
: chain.skipped === true
|
|
70
|
+
? 'fast_check_chain_skipped'
|
|
71
|
+
: chainVerified
|
|
72
|
+
? evidence.fast_actual
|
|
73
|
+
? 'fast_verified'
|
|
74
|
+
: evidence.fast_requested
|
|
75
|
+
? 'fast_requested_but_actual_unverified'
|
|
76
|
+
: 'fast_not_requested'
|
|
77
|
+
: chain.status,
|
|
73
78
|
codex_lb: status,
|
|
79
|
+
model_selection: modelSelection,
|
|
74
80
|
chain,
|
|
75
81
|
evidence,
|
|
76
82
|
degraded_models: Array.isArray(chain.degraded_models) ? chain.degraded_models : [],
|
|
77
83
|
quota_low: Boolean(chain.quota_low),
|
|
78
84
|
blockers: [
|
|
79
85
|
...(providerReady ? [] : ['codex_lb_provider_contract_drift']),
|
|
80
|
-
...
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
...modelSelection.blockers,
|
|
87
|
+
...(chain.skipped === true
|
|
88
|
+
? ['codex_lb_fast_check_chain_skipped']
|
|
89
|
+
: chainVerified
|
|
90
|
+
? evidence.fast_actual
|
|
91
|
+
? []
|
|
92
|
+
: [evidence.fast_requested ? 'codex_lb_actual_fast_service_tier_unverified' : 'codex_lb_fast_service_tier_not_requested']
|
|
93
|
+
: [chain.status || blocker])
|
|
85
94
|
]
|
|
86
95
|
};
|
|
87
96
|
if (flag(args, '--json'))
|
|
@@ -95,11 +104,13 @@ export async function run(command, args = []) {
|
|
|
95
104
|
}
|
|
96
105
|
if (action === 'repair' || action === 'resync' || action === 'login') {
|
|
97
106
|
const result = await repairCodexLbAuth();
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!result.ok)
|
|
107
|
+
const fastUi = await repairCodexAppFastUiAfterMutation(root, Boolean(result.ok));
|
|
108
|
+
const shaped = { ...result, ok: Boolean(result.ok && fastUi.ok), codex_app_fast_ui: fastUi };
|
|
109
|
+
if (!shaped.ok)
|
|
102
110
|
process.exitCode = 1;
|
|
111
|
+
if (flag(args, '--json'))
|
|
112
|
+
return printJson(shaped);
|
|
113
|
+
console.log(`codex-lb repair: ${shaped.ok ? 'ok' : result.ok ? 'fast_ui_repair_failed' : result.status}`);
|
|
103
114
|
return;
|
|
104
115
|
}
|
|
105
116
|
if (action === 'release') {
|
|
@@ -126,8 +137,10 @@ export async function run(command, args = []) {
|
|
|
126
137
|
const host = status.base_url;
|
|
127
138
|
if (!host) {
|
|
128
139
|
const result = { schema: 'sks.codex-lb-set-key.v1', ok: false, status: 'not_configured' };
|
|
129
|
-
if (flag(args, '--json'))
|
|
140
|
+
if (flag(args, '--json')) {
|
|
141
|
+
process.exitCode = 1;
|
|
130
142
|
return printJson(result);
|
|
143
|
+
}
|
|
131
144
|
console.error('codex-lb is not configured yet. Run: sks codex-lb setup --host <domain> --api-key-stdin');
|
|
132
145
|
process.exitCode = 1;
|
|
133
146
|
return;
|
|
@@ -135,43 +148,60 @@ export async function run(command, args = []) {
|
|
|
135
148
|
const newKey = await resolveNewApiKey(args);
|
|
136
149
|
if (!newKey) {
|
|
137
150
|
const result = { schema: 'sks.codex-lb-set-key.v1', ok: false, status: 'missing_api_key' };
|
|
138
|
-
if (flag(args, '--json'))
|
|
151
|
+
if (flag(args, '--json')) {
|
|
152
|
+
process.exitCode = 1;
|
|
139
153
|
return printJson(result);
|
|
154
|
+
}
|
|
140
155
|
console.error('No new API key provided. Run: sks codex-lb set-key --api-key-stdin (or --api-key <key>)');
|
|
141
156
|
process.exitCode = 1;
|
|
142
157
|
return;
|
|
143
158
|
}
|
|
144
159
|
const result = await configureCodexLb({ host, apiKey: newKey, authMode: flag(args, '--preserve-auth') ? 'preserve' : 'codex-lb', forceCodexLbApiKeyAuth: !flag(args, '--preserve-auth') });
|
|
145
|
-
const
|
|
146
|
-
const
|
|
160
|
+
const fastUi = await repairCodexAppFastUiAfterMutation(root, Boolean(result.ok));
|
|
161
|
+
const restart = await maybeRestartCodexAppForAuthSwitch(args, Boolean(result.ok && fastUi.ok));
|
|
162
|
+
const ok = Boolean(result.ok && fastUi.ok && restart?.ok !== false);
|
|
163
|
+
const output = { ...result, ok, action: 'set-key', codex_app_fast_ui: fastUi, restart_app: restart };
|
|
164
|
+
if (!ok)
|
|
165
|
+
process.exitCode = 1;
|
|
147
166
|
if (flag(args, '--json'))
|
|
148
167
|
return printJson(output);
|
|
149
168
|
console.log(result.ok ? `codex-lb API key updated (${result.base_url || host}).` : `codex-lb key update failed: ${result.status}${result.error ? `: ${result.error}` : ''}`);
|
|
150
169
|
if (restart?.status === 'restarted')
|
|
151
170
|
console.log('Codex App restarted for the new codex-lb auth mode.');
|
|
152
|
-
if (!
|
|
171
|
+
if (!ok)
|
|
153
172
|
process.exitCode = 1;
|
|
154
173
|
return;
|
|
155
174
|
}
|
|
156
175
|
if (action === 'use-codex-lb' || action === 'use-lb') {
|
|
157
176
|
// Switch auth mode -> codex-lb (API key). Re-selects the provider and re-syncs auth.
|
|
158
177
|
const result = await repairCodexLbAuth({ forceCodexLbApiKeyAuth: true, authMode: 'codex-lb', forceFastMode: !flag(args, '--no-fast') });
|
|
159
|
-
const
|
|
178
|
+
const fastUi = await repairCodexAppFastUiAfterMutation(root, Boolean(result.ok));
|
|
179
|
+
const restart = await maybeRestartCodexAppForAuthSwitch(args, Boolean(result.ok && fastUi.ok));
|
|
180
|
+
const ok = Boolean(result.ok && fastUi.ok && restart?.ok !== false);
|
|
181
|
+
const shaped = { ...result, ok, mode: 'codex-lb', codex_app_fast_ui: fastUi, restart_app: restart };
|
|
182
|
+
if (!ok)
|
|
183
|
+
process.exitCode = 1;
|
|
160
184
|
if (flag(args, '--json'))
|
|
161
|
-
return printJson(
|
|
185
|
+
return printJson(shaped);
|
|
162
186
|
console.log(result.ok ? 'Auth mode: codex-lb selected (API key).' : `Switch to codex-lb failed: ${result.status}${result.error ? `: ${result.error}` : ''}`);
|
|
163
187
|
if (restart?.status === 'restarted')
|
|
164
188
|
console.log('Codex App restarted for codex-lb auth.');
|
|
165
|
-
if (!
|
|
189
|
+
if (!ok)
|
|
166
190
|
process.exitCode = 1;
|
|
167
191
|
return;
|
|
168
192
|
}
|
|
169
193
|
if (action === 'use-oauth' || action === 'use-chatgpt') {
|
|
170
194
|
// Switch auth mode -> ChatGPT OAuth. Restores the saved OAuth login if present.
|
|
171
195
|
const result = await releaseCodexLbAuthHold({ force: flag(args, '--force') });
|
|
172
|
-
const
|
|
196
|
+
const authOk = !['no_backup', 'auth_in_use', 'failed'].includes(result.status);
|
|
197
|
+
const fastUi = await repairCodexAppFastUiAfterMutation(root, authOk);
|
|
198
|
+
const restart = await maybeRestartCodexAppForAuthSwitch(args, Boolean(authOk && fastUi.ok));
|
|
199
|
+
const ok = Boolean(authOk && fastUi.ok && restart?.ok !== false);
|
|
200
|
+
const shaped = { ...result, ok, mode: 'oauth', codex_app_fast_ui: fastUi, restart_app: restart };
|
|
201
|
+
if (!ok)
|
|
202
|
+
process.exitCode = 1;
|
|
173
203
|
if (flag(args, '--json'))
|
|
174
|
-
return printJson(
|
|
204
|
+
return printJson(shaped);
|
|
175
205
|
if (result.status === 'no_backup') {
|
|
176
206
|
console.log('No saved ChatGPT OAuth credentials to restore. Switch to OAuth by logging in:');
|
|
177
207
|
console.log(' codex login');
|
|
@@ -210,8 +240,10 @@ export async function run(command, args = []) {
|
|
|
210
240
|
'Or: sks codex-lb setup --host <domain> --api-key-stdin --yes'
|
|
211
241
|
]
|
|
212
242
|
};
|
|
213
|
-
if (flag(args, '--json'))
|
|
243
|
+
if (flag(args, '--json')) {
|
|
244
|
+
process.exitCode = 1;
|
|
214
245
|
return printJson(result);
|
|
246
|
+
}
|
|
215
247
|
console.error('codex-lb API key is not configured.');
|
|
216
248
|
console.error('Run:');
|
|
217
249
|
console.error(' sks codex-lb setup');
|
|
@@ -222,6 +254,8 @@ export async function run(command, args = []) {
|
|
|
222
254
|
}
|
|
223
255
|
if (flag(args, '--plan')) {
|
|
224
256
|
const result = { schema: 'sks.codex-lb-setup-plan-result.v1', ok: plan.blockers.length === 0, plan, writes: false, expected_actions: plan.expected_actions, persistence: plan.persistence };
|
|
257
|
+
if (!result.ok)
|
|
258
|
+
process.exitCode = 1;
|
|
225
259
|
if (flag(args, '--json'))
|
|
226
260
|
return printJson(result);
|
|
227
261
|
process.stdout.write(renderCodexLbSetupPlan(plan));
|
|
@@ -235,8 +269,10 @@ export async function run(command, args = []) {
|
|
|
235
269
|
const confirm = (await ask('Apply this codex-lb setup plan? [y/N] ')).trim();
|
|
236
270
|
if (!/^(y|yes|예|네|응)$/i.test(confirm)) {
|
|
237
271
|
const result = { schema: 'sks.codex-lb-setup.v1', ok: false, status: 'cancelled', plan, applied_actions: [] };
|
|
238
|
-
if (flag(args, '--json'))
|
|
272
|
+
if (flag(args, '--json')) {
|
|
273
|
+
process.exitCode = 1;
|
|
239
274
|
return printJson(result);
|
|
275
|
+
}
|
|
240
276
|
console.log('codex-lb setup cancelled.');
|
|
241
277
|
process.exitCode = 1;
|
|
242
278
|
return;
|
|
@@ -291,19 +327,23 @@ export async function run(command, args = []) {
|
|
|
291
327
|
apiKeySource: options.apiKeySource,
|
|
292
328
|
allowInsecureHttp: options.allowInsecureLocalhost
|
|
293
329
|
});
|
|
294
|
-
const
|
|
295
|
-
const
|
|
330
|
+
const fastUi = await repairCodexAppFastUiAfterMutation(root, Boolean(result.ok));
|
|
331
|
+
const restart = await maybeRestartCodexAppForAuthSwitch(args, Boolean(result.ok && fastUi.ok) && !flag(args, '--preserve-auth'));
|
|
332
|
+
const shaped = { schema: 'sks.codex-lb-setup.v1', ...result, api_key: { present: Boolean(options.apiKey), redacted: true }, env_file_chmod: '0600', codex_app_fast_ui: fastUi };
|
|
296
333
|
shaped.restart_app = restart;
|
|
297
334
|
if (options.health)
|
|
298
335
|
shaped.applied_actions = [...(shaped.applied_actions || []), { type: 'run_health_check', target: 'codex-lb response chain', ok: true }];
|
|
299
336
|
if (options.health)
|
|
300
337
|
shaped.chain_health = result.ok ? await checkCodexLbResponseChain(result, { force: true, root }) : null;
|
|
338
|
+
shaped.ok = Boolean(result.ok && fastUi.ok && restart?.ok !== false);
|
|
339
|
+
if (!shaped.ok)
|
|
340
|
+
process.exitCode = 1;
|
|
301
341
|
if (flag(args, '--json'))
|
|
302
342
|
return printJson(shaped);
|
|
303
343
|
console.log(`codex-lb configured: ${result.base_url || result.status}`);
|
|
304
344
|
if (shaped.persistence?.warning)
|
|
305
345
|
console.log(`warning: ${shaped.persistence.warning}`);
|
|
306
|
-
if (!
|
|
346
|
+
if (!shaped.ok)
|
|
307
347
|
process.exitCode = 1;
|
|
308
348
|
return;
|
|
309
349
|
}
|
|
@@ -345,12 +385,90 @@ export async function run(command, args = []) {
|
|
|
345
385
|
}
|
|
346
386
|
async function maybeRestartCodexAppForAuthSwitch(args = [], enabled) {
|
|
347
387
|
if (!enabled)
|
|
348
|
-
return { schema: 'sks.codex-app-restart.v1', ok: true, status: 'skipped', skipped: true, reason: 'previous_step_failed', app_name: '
|
|
388
|
+
return { schema: 'sks.codex-app-restart.v1', ok: true, status: 'skipped', skipped: true, reason: 'previous_step_failed', app_name: 'ChatGPT', bundle_id: 'com.openai.codex', blockers: [] };
|
|
349
389
|
const requested = flag(args, '--restart-app') || flag(args, '--restart');
|
|
350
390
|
const shouldRestart = requested || (!flag(args, '--json') && !flag(args, '--no-restart-app') && !flag(args, '--no-restart'));
|
|
351
391
|
return restartCodexApp({ enabled: shouldRestart });
|
|
352
392
|
}
|
|
353
|
-
async function
|
|
393
|
+
async function repairCodexAppFastUiAfterMutation(root, enabled) {
|
|
394
|
+
if (!enabled) {
|
|
395
|
+
return {
|
|
396
|
+
schema: 'sks.codex-app-fast-ui-repair.v1',
|
|
397
|
+
ok: true,
|
|
398
|
+
status: 'skipped',
|
|
399
|
+
skipped: true,
|
|
400
|
+
reason: 'previous_step_failed',
|
|
401
|
+
actions: [],
|
|
402
|
+
blockers: []
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
return await repairCodexAppFastUi(root, { apply: true });
|
|
407
|
+
}
|
|
408
|
+
catch (err) {
|
|
409
|
+
return {
|
|
410
|
+
schema: 'sks.codex-app-fast-ui-repair.v1',
|
|
411
|
+
ok: false,
|
|
412
|
+
status: 'failed',
|
|
413
|
+
actions: [],
|
|
414
|
+
blockers: ['codex_app_fast_ui_repair_failed'],
|
|
415
|
+
error: String(err?.message || err)
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
export function isCodexLbFastChainVerified(chain = {}) {
|
|
420
|
+
return chain.ok === true && chain.skipped !== true;
|
|
421
|
+
}
|
|
422
|
+
export async function resolveCodexLbFastCheckModel(status = {}, env = process.env) {
|
|
423
|
+
const explicit = String(env.SKS_CODEX_MODEL || env.CODEX_MODEL || '').trim();
|
|
424
|
+
if (explicit)
|
|
425
|
+
return { model: explicit, source: env.SKS_CODEX_MODEL ? 'SKS_CODEX_MODEL' : 'CODEX_MODEL', blockers: [] };
|
|
426
|
+
const configPath = String(status.config_path || '').trim();
|
|
427
|
+
const config = configPath ? await readText(configPath, '').catch(() => '') : '';
|
|
428
|
+
const configured = topLevelTomlString(config, 'model');
|
|
429
|
+
if (configured)
|
|
430
|
+
return { model: configured, source: 'global_config', blockers: [] };
|
|
431
|
+
const configuredCatalogPath = topLevelTomlString(config, 'model_catalog_json');
|
|
432
|
+
if (!configuredCatalogPath)
|
|
433
|
+
return { model: null, source: null, blockers: ['codex_lb_fast_check_model_unselected'] };
|
|
434
|
+
const home = String(env.HOME || '').trim();
|
|
435
|
+
const expandedCatalogPath = configuredCatalogPath.startsWith('~/') && home
|
|
436
|
+
? path.join(home, configuredCatalogPath.slice(2))
|
|
437
|
+
: configuredCatalogPath;
|
|
438
|
+
const catalogPath = path.isAbsolute(expandedCatalogPath)
|
|
439
|
+
? expandedCatalogPath
|
|
440
|
+
: path.resolve(path.dirname(configPath), expandedCatalogPath);
|
|
441
|
+
try {
|
|
442
|
+
const payload = JSON.parse(await readText(catalogPath, ''));
|
|
443
|
+
const model = selectPriorityCapableCatalogModel(payload);
|
|
444
|
+
return model
|
|
445
|
+
? { model, source: 'model_catalog_json', blockers: [] }
|
|
446
|
+
: { model: null, source: 'model_catalog_json', blockers: ['codex_lb_fast_check_priority_model_unavailable'] };
|
|
447
|
+
}
|
|
448
|
+
catch {
|
|
449
|
+
return { model: null, source: 'model_catalog_json', blockers: ['codex_lb_fast_check_catalog_invalid'] };
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
function topLevelTomlString(text, key) {
|
|
453
|
+
const topLevel = String(text || '').split(/\n\s*\[/)[0] || '';
|
|
454
|
+
const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
455
|
+
return (topLevel.match(new RegExp(`(?:^|\\n)\\s*${escaped}\\s*=\\s*"([^"]+)"`))?.[1] || '').trim();
|
|
456
|
+
}
|
|
457
|
+
function selectPriorityCapableCatalogModel(payload = {}) {
|
|
458
|
+
const models = Array.isArray(payload?.models) ? payload.models : Array.isArray(payload?.data) ? payload.data : [];
|
|
459
|
+
return models
|
|
460
|
+
.filter((row) => {
|
|
461
|
+
if (!row || typeof row !== 'object' || row.supported_in_api !== true || typeof row.slug !== 'string' || !row.slug.trim())
|
|
462
|
+
return false;
|
|
463
|
+
const serviceTiers = Array.isArray(row.service_tiers) ? row.service_tiers : [];
|
|
464
|
+
const speedTiers = Array.isArray(row.additional_speed_tiers) ? row.additional_speed_tiers : [];
|
|
465
|
+
return serviceTiers.some((tier) => normalizeTier(typeof tier === 'string' ? tier : tier?.id) === 'priority')
|
|
466
|
+
|| speedTiers.some((tier) => normalizeTier(tier) === 'priority');
|
|
467
|
+
})
|
|
468
|
+
.sort((left, right) => Number(left.priority ?? Number.MAX_SAFE_INTEGER) - Number(right.priority ?? Number.MAX_SAFE_INTEGER)
|
|
469
|
+
|| String(left.slug).localeCompare(String(right.slug)))[0]?.slug || null;
|
|
470
|
+
}
|
|
471
|
+
export async function fastEvidenceFromChain(chain = {}, requestLogPath = null) {
|
|
354
472
|
const chainEvidence = chain.service_tier_evidence || {};
|
|
355
473
|
const logRows = requestLogPath ? await readRequestLogRows(String(requestLogPath)) : [];
|
|
356
474
|
const logEvidence = serviceTierEvidenceFromRows(logRows);
|
|
@@ -398,14 +516,14 @@ async function readRequestLogRows(file) {
|
|
|
398
516
|
}
|
|
399
517
|
return rows;
|
|
400
518
|
}
|
|
401
|
-
function serviceTierEvidenceFromRows(rows = []) {
|
|
519
|
+
export function serviceTierEvidenceFromRows(rows = []) {
|
|
402
520
|
let requested = null;
|
|
403
521
|
let actual = null;
|
|
404
522
|
let effective = null;
|
|
405
523
|
for (const row of rows) {
|
|
406
524
|
requested ||= normalizeTier(row?.requestedServiceTier || row?.requested_service_tier || row?.request?.service_tier || row?.body?.service_tier);
|
|
407
|
-
actual ||= normalizeTier(row?.actualServiceTier || row?.actual_service_tier || row?.response?.actualServiceTier);
|
|
408
|
-
effective ||=
|
|
525
|
+
actual ||= normalizeTier(row?.actualServiceTier || row?.actual_service_tier || row?.response?.actualServiceTier || row?.response?.actual_service_tier);
|
|
526
|
+
effective ||= responseServiceTier(row);
|
|
409
527
|
}
|
|
410
528
|
return {
|
|
411
529
|
requested_service_tier: requested,
|
|
@@ -414,6 +532,17 @@ function serviceTierEvidenceFromRows(rows = []) {
|
|
|
414
532
|
fast_actual: actual === 'priority' || effective === 'priority'
|
|
415
533
|
};
|
|
416
534
|
}
|
|
535
|
+
function responseServiceTier(row) {
|
|
536
|
+
const nested = normalizeTier(row?.response?.serviceTier || row?.response?.service_tier || row?.event?.response?.serviceTier || row?.event?.response?.service_tier);
|
|
537
|
+
if (nested)
|
|
538
|
+
return nested;
|
|
539
|
+
const responseKind = String(row?.direction || row?.phase || row?.kind || row?.type || '').trim().toLowerCase();
|
|
540
|
+
const responseBody = row?.object === 'response' || /^resp[_-]/i.test(String(row?.id || '')) || Array.isArray(row?.output);
|
|
541
|
+
if (responseBody || responseKind === 'response' || responseKind === 'inbound' || responseKind.startsWith('response.')) {
|
|
542
|
+
return normalizeTier(row?.serviceTier || row?.service_tier);
|
|
543
|
+
}
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
417
546
|
function normalizeTier(value) {
|
|
418
547
|
const text = String(value || '').trim().toLowerCase();
|
|
419
548
|
if (text === 'fast')
|
package/dist/commands/codex.js
CHANGED
|
@@ -4,7 +4,8 @@ import { codexCompatibilityReport, codexDoctorReport } from '../core/codex-compa
|
|
|
4
4
|
import { codexVersionReport } from '../core/codex-compat/codex-version.js';
|
|
5
5
|
import { codexSchemaSnapshotReport } from '../core/codex-compat/codex-schema-snapshot.js';
|
|
6
6
|
import { detectCodex0141Capability } from '../core/codex-control/codex-0141-capability.js';
|
|
7
|
-
import {
|
|
7
|
+
import { detectCodex0144Capability } from '../core/codex-control/codex-0144-capability.js';
|
|
8
|
+
import { CURRENT_CODEX_RELEASE_MANIFEST } from '../core/codex-compat/codex-release-manifest.js';
|
|
8
9
|
export async function run(_command, args = []) {
|
|
9
10
|
const action = args[0] || 'compatibility';
|
|
10
11
|
if (action === 'compatibility' || action === 'compat') {
|
|
@@ -39,11 +40,11 @@ export async function run(_command, args = []) {
|
|
|
39
40
|
process.exitCode = 1;
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
if (action === '0.
|
|
43
|
-
const result = await
|
|
43
|
+
if (action === '0.144' || action === '0144' || action === CURRENT_CODEX_RELEASE_MANIFEST.targetTag) {
|
|
44
|
+
const result = await detectCodex0144Capability({ requireReal: flag(args, '--require-real') });
|
|
44
45
|
if (flag(args, '--json'))
|
|
45
46
|
return printJson(result);
|
|
46
|
-
console.log(`Codex
|
|
47
|
+
console.log(`Codex ${CURRENT_CODEX_RELEASE_MANIFEST.requiredCliVersion} compatibility: ${result.ok ? 'ok' : 'blocked'} (${result.probe_mode})`);
|
|
47
48
|
for (const blocker of result.blockers || [])
|
|
48
49
|
console.log(`- blocker: ${blocker}`);
|
|
49
50
|
for (const warning of result.warnings || [])
|
|
@@ -70,7 +71,7 @@ export async function run(_command, args = []) {
|
|
|
70
71
|
process.exitCode = 1;
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
|
-
console.error('Usage: sks codex compatibility|version|doctor|schema|0.
|
|
74
|
+
console.error('Usage: sks codex compatibility|version|doctor|schema|0.144|0.141 [--json]');
|
|
74
75
|
process.exitCode = 1;
|
|
75
76
|
}
|
|
76
77
|
//# sourceMappingURL=codex.js.map
|