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,314 +1,129 @@
|
|
|
1
1
|
import { sha256 } from '../fsx.js';
|
|
2
2
|
import { uniqueValues as unique } from '../text/strings.js';
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const DEFAULT_CODEX_LB_DEEP_EVIDENCE_MAX_AGE_MS = 15 * 60 * 1000;
|
|
3
|
+
export const CAPABILITY_TRUSTED_DEEP_EVIDENCE_SCHEMA = 'sks.capability-trusted-deep-evidence.v2';
|
|
4
|
+
export const CAPABILITY_DEEP_EVIDENCE_TRUST_ANCHOR_SCHEMA = 'sks.capability-deep-evidence-trust-anchor.v2';
|
|
5
|
+
export const CAPABILITY_DEEP_EVIDENCE_VALIDATION_SCHEMA = 'sks.capability-deep-evidence-validation.v2';
|
|
6
|
+
export const DEFAULT_CAPABILITY_DEEP_EVIDENCE_MAX_AGE_MS = 15 * 60 * 1000;
|
|
8
7
|
const DEFAULT_FUTURE_SKEW_MS = 60 * 1000;
|
|
9
8
|
const SHA256_PATTERN = /^[a-f0-9]{64}$/i;
|
|
10
9
|
const ID_PATTERN = /^[a-z0-9][a-z0-9._:/-]{2,127}$/i;
|
|
11
|
-
|
|
12
|
-
'fixture',
|
|
13
|
-
'provider_identity_verified',
|
|
14
|
-
'picker_control_visible',
|
|
15
|
-
'picker_selected_model',
|
|
16
|
-
'configured_service_tier',
|
|
17
|
-
'request_service_tier',
|
|
18
|
-
'response_actual_service_tier',
|
|
19
|
-
'bridge_websocket_round_trip',
|
|
20
|
-
'image_route',
|
|
21
|
-
'image_request_tools_present',
|
|
22
|
-
'image_events',
|
|
23
|
-
'image_artifact_materialized',
|
|
24
|
-
'computer_events',
|
|
25
|
-
'computer_executor_completed',
|
|
26
|
-
'computer_output_submitted',
|
|
27
|
-
'computer_follow_up_completed',
|
|
28
|
-
'computer_session_affinity_preserved',
|
|
29
|
-
'browser_use_verified',
|
|
30
|
-
'voice_create_verified',
|
|
31
|
-
'voice_location_received',
|
|
32
|
-
'voice_location_rewritten',
|
|
33
|
-
'voice_websocket_upgraded',
|
|
34
|
-
'voice_server_event_seen',
|
|
35
|
-
'voice_clean_close',
|
|
36
|
-
'voice_owner_binding_verified',
|
|
37
|
-
'plugins_verified',
|
|
38
|
-
'auxiliary_routes_observed',
|
|
39
|
-
'auxiliary_events',
|
|
40
|
-
'auxiliary_output_events',
|
|
41
|
-
'auxiliary_request_body_hash_preserved',
|
|
42
|
-
'auxiliary_owner_affinity_verified',
|
|
43
|
-
'desktop_adoption_verified',
|
|
44
|
-
'desktop_adoption_source',
|
|
45
|
-
'oauth_bytes_unchanged_before_restart',
|
|
46
|
-
'oauth_semantic_identity_verified_after_restart',
|
|
47
|
-
'built_in_openai_provider_retained',
|
|
48
|
-
'fast_selector_visible',
|
|
49
|
-
'fast_effective_verified',
|
|
50
|
-
'text_response_verified',
|
|
51
|
-
'code_mcp_search_verified',
|
|
52
|
-
'files_transcribe_verified',
|
|
53
|
-
'memory_thread_goal_routes_verified',
|
|
54
|
-
'existing_thread_resumed',
|
|
55
|
-
'new_thread_created',
|
|
56
|
-
'disable_routing_verified',
|
|
57
|
-
'rollback_byte_exact_verified',
|
|
58
|
-
'app_restart_recovery_verified',
|
|
59
|
-
'mac_reboot_recovery_verified',
|
|
60
|
-
'remote_other_mac_runtime_verified',
|
|
61
|
-
'auth_mode_independence_verified',
|
|
62
|
-
'source_surface',
|
|
63
|
-
'desktop_build',
|
|
64
|
-
'codex_core_version',
|
|
65
|
-
'protocol_fixture_schema_hash',
|
|
66
|
-
'app_origin_observed'
|
|
67
|
-
]);
|
|
68
|
-
const BOOLEAN_PAYLOAD_KEYS = new Set([
|
|
69
|
-
'fixture',
|
|
70
|
-
'provider_identity_verified',
|
|
71
|
-
'picker_control_visible',
|
|
72
|
-
'bridge_websocket_round_trip',
|
|
73
|
-
'image_request_tools_present',
|
|
74
|
-
'image_artifact_materialized',
|
|
75
|
-
'computer_executor_completed',
|
|
76
|
-
'computer_output_submitted',
|
|
77
|
-
'computer_follow_up_completed',
|
|
78
|
-
'computer_session_affinity_preserved',
|
|
79
|
-
'browser_use_verified',
|
|
80
|
-
'voice_create_verified',
|
|
81
|
-
'voice_location_received',
|
|
82
|
-
'voice_location_rewritten',
|
|
83
|
-
'voice_websocket_upgraded',
|
|
84
|
-
'voice_server_event_seen',
|
|
85
|
-
'voice_clean_close',
|
|
86
|
-
'voice_owner_binding_verified',
|
|
87
|
-
'plugins_verified',
|
|
88
|
-
'auxiliary_request_body_hash_preserved',
|
|
89
|
-
'auxiliary_owner_affinity_verified',
|
|
90
|
-
'desktop_adoption_verified',
|
|
91
|
-
'oauth_bytes_unchanged_before_restart',
|
|
92
|
-
'oauth_semantic_identity_verified_after_restart',
|
|
93
|
-
'built_in_openai_provider_retained',
|
|
94
|
-
'fast_selector_visible',
|
|
95
|
-
'fast_effective_verified',
|
|
96
|
-
'text_response_verified',
|
|
97
|
-
'code_mcp_search_verified',
|
|
98
|
-
'files_transcribe_verified',
|
|
99
|
-
'memory_thread_goal_routes_verified',
|
|
100
|
-
'existing_thread_resumed',
|
|
101
|
-
'new_thread_created',
|
|
102
|
-
'disable_routing_verified',
|
|
103
|
-
'rollback_byte_exact_verified',
|
|
104
|
-
'app_restart_recovery_verified',
|
|
105
|
-
'mac_reboot_recovery_verified',
|
|
106
|
-
'remote_other_mac_runtime_verified',
|
|
107
|
-
'auth_mode_independence_verified'
|
|
108
|
-
]);
|
|
109
|
-
const NULLABLE_STRING_PAYLOAD_KEYS = new Set([
|
|
110
|
-
'picker_selected_model',
|
|
111
|
-
'configured_service_tier',
|
|
112
|
-
'request_service_tier',
|
|
113
|
-
'response_actual_service_tier',
|
|
114
|
-
'desktop_adoption_source',
|
|
115
|
-
'source_surface',
|
|
116
|
-
'desktop_build',
|
|
117
|
-
'codex_core_version',
|
|
118
|
-
'protocol_fixture_schema_hash',
|
|
119
|
-
'app_origin_observed'
|
|
120
|
-
]);
|
|
121
|
-
const ARRAY_PAYLOAD_KEYS = new Set([
|
|
122
|
-
'image_events',
|
|
123
|
-
'computer_events',
|
|
124
|
-
'auxiliary_routes_observed',
|
|
125
|
-
'auxiliary_events',
|
|
126
|
-
'auxiliary_output_events'
|
|
127
|
-
]);
|
|
128
|
-
export function validateCodexLbDesktopDeepEvidence(value, options) {
|
|
10
|
+
export function validateCapabilityDeepEvidenceV2(value, options) {
|
|
129
11
|
if (value == null)
|
|
130
|
-
return
|
|
12
|
+
return capabilityValidation(options, 'not_attempted', [], []);
|
|
131
13
|
const blockers = [];
|
|
132
14
|
if (!isRecord(value) || !hasExactKeys(value, ['schema', 'producer', 'created_at', 'target', 'payload', 'integrity'])) {
|
|
133
|
-
return
|
|
15
|
+
return capabilityValidation(options, 'blocked', ['capability_deep_evidence_schema_invalid'], []);
|
|
134
16
|
}
|
|
135
|
-
if (value.schema !==
|
|
136
|
-
blockers.push('
|
|
17
|
+
if (value.schema !== CAPABILITY_TRUSTED_DEEP_EVIDENCE_SCHEMA)
|
|
18
|
+
blockers.push('capability_deep_evidence_schema_invalid');
|
|
137
19
|
const producer = parseProducer(value.producer, blockers, 'evidence');
|
|
138
|
-
const target =
|
|
20
|
+
const target = parseCapabilityTarget(value.target, blockers);
|
|
139
21
|
const integrity = parseIntegrity(value.integrity, blockers);
|
|
140
|
-
const payload =
|
|
22
|
+
const payload = isRecord(value.payload) ? value.payload : null;
|
|
23
|
+
if (!payload)
|
|
24
|
+
blockers.push('capability_deep_evidence_payload_invalid');
|
|
141
25
|
const createdAt = typeof value.created_at === 'string' ? value.created_at : '';
|
|
142
26
|
const createdAtMs = Date.parse(createdAt);
|
|
143
27
|
if (!createdAt || !Number.isFinite(createdAtMs))
|
|
144
|
-
blockers.push('
|
|
28
|
+
blockers.push('capability_deep_evidence_created_at_invalid');
|
|
145
29
|
const expectedEndpoint = normalizeEndpoint(options.expectedEndpoint);
|
|
146
30
|
const evidenceEndpoint = target ? normalizeEndpoint(target.endpoint) : null;
|
|
147
31
|
if (!expectedEndpoint)
|
|
148
|
-
blockers.push('
|
|
149
|
-
if (target
|
|
150
|
-
blockers.push('
|
|
151
|
-
if (target
|
|
152
|
-
blockers.push('
|
|
32
|
+
blockers.push('capability_deep_evidence_expected_endpoint_invalid');
|
|
33
|
+
if (target?.provider_id !== options.expectedProviderId)
|
|
34
|
+
blockers.push('capability_deep_evidence_provider_mismatch');
|
|
35
|
+
if (target?.scope !== options.expectedScope)
|
|
36
|
+
blockers.push('capability_deep_evidence_scope_mismatch');
|
|
37
|
+
if (target?.capability !== options.expectedCapability)
|
|
38
|
+
blockers.push('capability_deep_evidence_capability_mismatch');
|
|
39
|
+
if (target?.report_id !== options.expectedReportId)
|
|
40
|
+
blockers.push('capability_deep_evidence_report_mismatch');
|
|
41
|
+
if (target?.catalog_generation !== options.expectedCatalogGeneration)
|
|
42
|
+
blockers.push('capability_deep_evidence_generation_mismatch');
|
|
43
|
+
if (target && evidenceEndpoint !== expectedEndpoint)
|
|
44
|
+
blockers.push('capability_deep_evidence_endpoint_mismatch');
|
|
153
45
|
const nowMs = normalizeNow(options.now);
|
|
154
|
-
const maxAgeMs = positiveFinite(options.maxAgeMs,
|
|
46
|
+
const maxAgeMs = positiveFinite(options.maxAgeMs, DEFAULT_CAPABILITY_DEEP_EVIDENCE_MAX_AGE_MS);
|
|
155
47
|
const futureSkewMs = positiveFinite(options.maxFutureSkewMs, DEFAULT_FUTURE_SKEW_MS);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
48
|
+
const stale = Number.isFinite(createdAtMs) && createdAtMs < nowMs - maxAgeMs;
|
|
49
|
+
if (Number.isFinite(createdAtMs) && createdAtMs > nowMs + futureSkewMs) {
|
|
50
|
+
blockers.push('capability_deep_evidence_created_at_in_future');
|
|
51
|
+
}
|
|
160
52
|
let contentSha256 = null;
|
|
161
53
|
if (producer && target && payload && createdAt && integrity) {
|
|
162
|
-
contentSha256 =
|
|
163
|
-
schema:
|
|
54
|
+
contentSha256 = capabilityDeepEvidenceContentSha256V2({
|
|
55
|
+
schema: CAPABILITY_TRUSTED_DEEP_EVIDENCE_SCHEMA,
|
|
164
56
|
producer,
|
|
165
57
|
created_at: createdAt,
|
|
166
58
|
target,
|
|
167
59
|
payload
|
|
168
60
|
});
|
|
169
61
|
if (integrity.content_sha256 !== contentSha256)
|
|
170
|
-
blockers.push('
|
|
62
|
+
blockers.push('capability_deep_evidence_content_sha256_mismatch');
|
|
171
63
|
}
|
|
172
64
|
const anchor = integrity
|
|
173
65
|
? (options.trustAnchors || []).find((candidate) => candidate.anchor_id === integrity.trust_anchor_id)
|
|
174
66
|
: null;
|
|
175
|
-
if (!anchor)
|
|
176
|
-
blockers.push('
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
67
|
+
if (!anchor)
|
|
68
|
+
blockers.push('capability_deep_evidence_trust_anchor_missing');
|
|
69
|
+
else
|
|
70
|
+
validateCapabilityAnchor(anchor, producer, target, contentSha256, blockers);
|
|
71
|
+
const common = {
|
|
72
|
+
producer_id: producer?.id || null,
|
|
73
|
+
created_at: createdAt || null,
|
|
74
|
+
content_sha256: contentSha256,
|
|
75
|
+
trust_anchor_id: integrity?.trust_anchor_id || null
|
|
76
|
+
};
|
|
181
77
|
if (payload?.fixture === true) {
|
|
182
78
|
return {
|
|
183
|
-
...
|
|
184
|
-
|
|
185
|
-
created_at: createdAt || null,
|
|
186
|
-
content_sha256: contentSha256,
|
|
187
|
-
trust_anchor_id: integrity?.trust_anchor_id || null
|
|
79
|
+
...capabilityValidation(options, 'not_attempted', [], ['capability_deep_evidence_fixture_unverified']),
|
|
80
|
+
...common
|
|
188
81
|
};
|
|
189
82
|
}
|
|
190
|
-
if (blockers.length || !payload) {
|
|
83
|
+
if (blockers.length > 0 || !payload) {
|
|
191
84
|
return {
|
|
192
|
-
...
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
85
|
+
...capabilityValidation(options, 'blocked', unique(blockers), []),
|
|
86
|
+
...common
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (stale) {
|
|
90
|
+
return {
|
|
91
|
+
...capabilityValidation(options, 'stale', ['capability_deep_evidence_stale'], []),
|
|
92
|
+
...common
|
|
197
93
|
};
|
|
198
94
|
}
|
|
199
95
|
return {
|
|
200
|
-
|
|
201
|
-
|
|
96
|
+
...capabilityValidation(options, 'verified', [], []),
|
|
97
|
+
...common,
|
|
202
98
|
trusted: true,
|
|
203
|
-
evidence: payload
|
|
204
|
-
producer_id: producer.id,
|
|
205
|
-
created_at: createdAt,
|
|
206
|
-
content_sha256: contentSha256,
|
|
207
|
-
trust_anchor_id: integrity.trust_anchor_id,
|
|
208
|
-
blockers: [],
|
|
209
|
-
warnings: []
|
|
99
|
+
evidence: redactCapabilityEvidence(payload)
|
|
210
100
|
};
|
|
211
101
|
}
|
|
212
|
-
export function
|
|
102
|
+
export function capabilityDeepEvidenceContentSha256V2(content) {
|
|
213
103
|
return sha256(canonicalJson(content));
|
|
214
104
|
}
|
|
215
|
-
export function
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
schema: CODEX_LB_DEEP_EVIDENCE_TRUST_ANCHOR_SET_SCHEMA,
|
|
219
|
-
ok: false,
|
|
220
|
-
anchors: [],
|
|
221
|
-
blockers: ['codex_lb_deep_evidence_trust_anchor_set_invalid']
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
if (value.schema !== CODEX_LB_DEEP_EVIDENCE_TRUST_ANCHOR_SET_SCHEMA
|
|
225
|
-
|| !Array.isArray(value.anchors)
|
|
226
|
-
|| value.anchors.length === 0) {
|
|
227
|
-
return {
|
|
228
|
-
schema: CODEX_LB_DEEP_EVIDENCE_TRUST_ANCHOR_SET_SCHEMA,
|
|
229
|
-
ok: false,
|
|
230
|
-
anchors: [],
|
|
231
|
-
blockers: ['codex_lb_deep_evidence_trust_anchor_set_invalid']
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
const blockers = [];
|
|
235
|
-
const anchors = [];
|
|
236
|
-
const seen = new Set();
|
|
237
|
-
for (const [index, candidate] of value.anchors.entries()) {
|
|
238
|
-
const candidateBlockers = [];
|
|
239
|
-
validateAnchor(candidate, null, null, null, candidateBlockers);
|
|
240
|
-
const anchorId = isRecord(candidate) && typeof candidate.anchor_id === 'string'
|
|
241
|
-
? candidate.anchor_id
|
|
242
|
-
: '';
|
|
243
|
-
if (anchorId && seen.has(anchorId))
|
|
244
|
-
candidateBlockers.push('codex_lb_deep_evidence_trust_anchor_duplicate');
|
|
245
|
-
if (anchorId)
|
|
246
|
-
seen.add(anchorId);
|
|
247
|
-
if (candidateBlockers.length) {
|
|
248
|
-
blockers.push(...candidateBlockers.map((blocker) => `${blocker}:${index}`));
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
anchors.push(candidate);
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
schema: CODEX_LB_DEEP_EVIDENCE_TRUST_ANCHOR_SET_SCHEMA,
|
|
255
|
-
ok: blockers.length === 0 && anchors.length === value.anchors.length,
|
|
256
|
-
anchors: blockers.length === 0 ? anchors : [],
|
|
257
|
-
blockers: unique(blockers)
|
|
258
|
-
};
|
|
105
|
+
export function redactCapabilityEvidence(value) {
|
|
106
|
+
return redactRecord(value);
|
|
259
107
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
262
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_invalid');
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (anchor.schema !== CODEX_LB_DEEP_EVIDENCE_TRUST_ANCHOR_SCHEMA)
|
|
266
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_invalid');
|
|
267
|
-
if (typeof anchor.anchor_id !== 'string' || !ID_PATTERN.test(anchor.anchor_id))
|
|
268
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_invalid');
|
|
269
|
-
const anchorProducer = parseProducer(anchor.producer, blockers, 'anchor');
|
|
270
|
-
const anchorTarget = parseTarget(anchor.target, blockers, 'anchor');
|
|
271
|
-
if (!SHA256_PATTERN.test(anchor.content_sha256))
|
|
272
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_hash_invalid');
|
|
273
|
-
if (contentSha256 && anchor.content_sha256 !== contentSha256)
|
|
274
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_hash_mismatch');
|
|
275
|
-
if (producer && anchorProducer && canonicalJson(producer) !== canonicalJson(anchorProducer))
|
|
276
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_producer_mismatch');
|
|
277
|
-
if (target && anchorTarget && (target.mode !== anchorTarget.mode
|
|
278
|
-
|| normalizeEndpoint(target.endpoint) !== normalizeEndpoint(anchorTarget.endpoint)))
|
|
279
|
-
blockers.push('codex_lb_deep_evidence_trust_anchor_target_mismatch');
|
|
108
|
+
export function redactCapabilityText(value) {
|
|
109
|
+
return redactString(value);
|
|
280
110
|
}
|
|
281
111
|
function parseProducer(value, blockers, scope) {
|
|
282
112
|
if (!isRecord(value) || !hasExactKeys(value, ['id', 'version', 'run_id'])) {
|
|
283
|
-
blockers.push(`
|
|
113
|
+
blockers.push(`capability_deep_evidence_${scope}_producer_invalid`);
|
|
284
114
|
return null;
|
|
285
115
|
}
|
|
286
116
|
for (const key of ['id', 'version', 'run_id']) {
|
|
287
117
|
if (typeof value[key] !== 'string' || !ID_PATTERN.test(value[key])) {
|
|
288
|
-
blockers.push(`
|
|
118
|
+
blockers.push(`capability_deep_evidence_${scope}_producer_invalid`);
|
|
289
119
|
return null;
|
|
290
120
|
}
|
|
291
121
|
}
|
|
292
122
|
return value;
|
|
293
123
|
}
|
|
294
|
-
function parseTarget(value, blockers, scope) {
|
|
295
|
-
if (!isRecord(value) || !hasExactKeys(value, ['mode', 'endpoint'])) {
|
|
296
|
-
blockers.push(`codex_lb_deep_evidence_${scope}_target_invalid`);
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
if (!['desktop-native-bridge', 'desktop-dual-auth-compat', 'cli-provider', 'disabled'].includes(String(value.mode))) {
|
|
300
|
-
blockers.push(`codex_lb_deep_evidence_${scope}_target_invalid`);
|
|
301
|
-
return null;
|
|
302
|
-
}
|
|
303
|
-
if (typeof value.endpoint !== 'string' || !normalizeEndpoint(value.endpoint)) {
|
|
304
|
-
blockers.push(`codex_lb_deep_evidence_${scope}_target_invalid`);
|
|
305
|
-
return null;
|
|
306
|
-
}
|
|
307
|
-
return value;
|
|
308
|
-
}
|
|
309
124
|
function parseIntegrity(value, blockers) {
|
|
310
125
|
if (!isRecord(value) || !hasExactKeys(value, ['algorithm', 'content_sha256', 'trust_anchor_id'])) {
|
|
311
|
-
blockers.push('
|
|
126
|
+
blockers.push('capability_deep_evidence_integrity_invalid');
|
|
312
127
|
return null;
|
|
313
128
|
}
|
|
314
129
|
if (value.algorithm !== 'sha256'
|
|
@@ -316,34 +131,85 @@ function parseIntegrity(value, blockers) {
|
|
|
316
131
|
|| !SHA256_PATTERN.test(value.content_sha256)
|
|
317
132
|
|| typeof value.trust_anchor_id !== 'string'
|
|
318
133
|
|| !ID_PATTERN.test(value.trust_anchor_id)) {
|
|
319
|
-
blockers.push('
|
|
134
|
+
blockers.push('capability_deep_evidence_integrity_invalid');
|
|
320
135
|
return null;
|
|
321
136
|
}
|
|
322
137
|
return value;
|
|
323
138
|
}
|
|
324
|
-
function
|
|
325
|
-
if (!isRecord(value)
|
|
326
|
-
|
|
139
|
+
function parseCapabilityTarget(value, blockers) {
|
|
140
|
+
if (!isRecord(value) || !hasExactKeys(value, [
|
|
141
|
+
'provider_id',
|
|
142
|
+
'scope',
|
|
143
|
+
'capability',
|
|
144
|
+
'report_id',
|
|
145
|
+
'catalog_generation',
|
|
146
|
+
'endpoint'
|
|
147
|
+
])) {
|
|
148
|
+
blockers.push('capability_deep_evidence_target_invalid');
|
|
327
149
|
return null;
|
|
328
150
|
}
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
blockers.push('
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (key
|
|
340
|
-
blockers.push('
|
|
341
|
-
|
|
342
|
-
if (key === 'auxiliary_routes_observed' && Array.isArray(entry) && entry.some((item) => typeof item !== 'string')) {
|
|
343
|
-
blockers.push('codex_lb_deep_evidence_payload_type_invalid:auxiliary_routes_observed');
|
|
151
|
+
const providerId = value.provider_id;
|
|
152
|
+
if (providerId !== 'codex-lb' && providerId !== 'openrouter') {
|
|
153
|
+
blockers.push('capability_deep_evidence_target_invalid');
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (value.scope !== `provider:${providerId}`) {
|
|
157
|
+
blockers.push('capability_deep_evidence_target_invalid');
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
for (const key of ['capability', 'report_id', 'catalog_generation']) {
|
|
161
|
+
if (typeof value[key] !== 'string' || !ID_PATTERN.test(value[key])) {
|
|
162
|
+
blockers.push('capability_deep_evidence_target_invalid');
|
|
163
|
+
return null;
|
|
344
164
|
}
|
|
345
165
|
}
|
|
346
|
-
|
|
166
|
+
if (typeof value.endpoint !== 'string' || !normalizeEndpoint(value.endpoint)) {
|
|
167
|
+
blockers.push('capability_deep_evidence_target_invalid');
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return value;
|
|
171
|
+
}
|
|
172
|
+
function validateCapabilityAnchor(anchor, producer, target, contentSha256, blockers) {
|
|
173
|
+
if (!isRecord(anchor) || !hasExactKeys(anchor, ['schema', 'anchor_id', 'producer', 'target', 'content_sha256'])) {
|
|
174
|
+
blockers.push('capability_deep_evidence_trust_anchor_invalid');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (anchor.schema !== CAPABILITY_DEEP_EVIDENCE_TRUST_ANCHOR_SCHEMA)
|
|
178
|
+
blockers.push('capability_deep_evidence_trust_anchor_invalid');
|
|
179
|
+
if (!ID_PATTERN.test(anchor.anchor_id))
|
|
180
|
+
blockers.push('capability_deep_evidence_trust_anchor_invalid');
|
|
181
|
+
const anchorProducer = parseProducer(anchor.producer, blockers, 'anchor');
|
|
182
|
+
const anchorTarget = parseCapabilityTarget(anchor.target, blockers);
|
|
183
|
+
if (!SHA256_PATTERN.test(anchor.content_sha256))
|
|
184
|
+
blockers.push('capability_deep_evidence_trust_anchor_hash_invalid');
|
|
185
|
+
if (contentSha256 && anchor.content_sha256 !== contentSha256)
|
|
186
|
+
blockers.push('capability_deep_evidence_trust_anchor_hash_mismatch');
|
|
187
|
+
if (producer && anchorProducer && canonicalJson(producer) !== canonicalJson(anchorProducer)) {
|
|
188
|
+
blockers.push('capability_deep_evidence_trust_anchor_producer_mismatch');
|
|
189
|
+
}
|
|
190
|
+
if (target && anchorTarget && canonicalJson(target) !== canonicalJson(anchorTarget)) {
|
|
191
|
+
blockers.push('capability_deep_evidence_trust_anchor_target_mismatch');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function capabilityValidation(options, state, blockers, warnings) {
|
|
195
|
+
return {
|
|
196
|
+
schema: CAPABILITY_DEEP_EVIDENCE_VALIDATION_SCHEMA,
|
|
197
|
+
state,
|
|
198
|
+
trusted: false,
|
|
199
|
+
provider_id: options.expectedProviderId,
|
|
200
|
+
scope: options.expectedScope,
|
|
201
|
+
capability: options.expectedCapability,
|
|
202
|
+
report_id: options.expectedReportId,
|
|
203
|
+
catalog_generation: options.expectedCatalogGeneration,
|
|
204
|
+
endpoint: normalizeEndpoint(options.expectedEndpoint) || options.expectedEndpoint,
|
|
205
|
+
evidence: null,
|
|
206
|
+
producer_id: null,
|
|
207
|
+
created_at: null,
|
|
208
|
+
content_sha256: null,
|
|
209
|
+
trust_anchor_id: null,
|
|
210
|
+
blockers,
|
|
211
|
+
warnings
|
|
212
|
+
};
|
|
347
213
|
}
|
|
348
214
|
function normalizeEndpoint(value) {
|
|
349
215
|
try {
|
|
@@ -382,22 +248,28 @@ function positiveFinite(value, fallback) {
|
|
|
382
248
|
}
|
|
383
249
|
function hasExactKeys(value, expected) {
|
|
384
250
|
const actual = Object.keys(value).sort();
|
|
385
|
-
|
|
251
|
+
const sortedExpected = [...expected].sort();
|
|
252
|
+
return actual.length === sortedExpected.length && actual.every((key, index) => key === sortedExpected[index]);
|
|
386
253
|
}
|
|
387
254
|
function isRecord(value) {
|
|
388
255
|
return Boolean(value && typeof value === 'object' && !Array.isArray(value));
|
|
389
256
|
}
|
|
390
|
-
function
|
|
391
|
-
return {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
257
|
+
function redactRecord(value) {
|
|
258
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
259
|
+
if (/(?:authorization|api[_-]?key|token|secret|credential)/i.test(key))
|
|
260
|
+
return [key, '[REDACTED]'];
|
|
261
|
+
if (typeof entry === 'string')
|
|
262
|
+
return [key, redactString(entry)];
|
|
263
|
+
if (Array.isArray(entry))
|
|
264
|
+
return [key, entry.map((item) => (isRecord(item) ? redactRecord(item) : typeof item === 'string' ? redactString(item) : item))];
|
|
265
|
+
if (isRecord(entry))
|
|
266
|
+
return [key, redactRecord(entry)];
|
|
267
|
+
return [key, entry];
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
function redactString(value) {
|
|
271
|
+
return value
|
|
272
|
+
.replace(/\b(?:sk|or|sess|key)-[A-Za-z0-9_-]{8,}\b/g, '[REDACTED]')
|
|
273
|
+
.replace(/Bearer\s+[A-Za-z0-9._~+/-]{8,}/gi, 'Bearer [REDACTED]')
|
|
274
|
+
.replace(/((?:api[_-]?key|access[_-]?token|refresh[_-]?token|secret|credential)\s*[=:]\s*["']?)[A-Za-z0-9._~+/-]{8,}/gi, '$1[REDACTED]');
|
|
403
275
|
}
|
|
@@ -34,7 +34,7 @@ export async function helpCommand(args = []) {
|
|
|
34
34
|
for (const row of commandRows().filter((entry) => entry.maturity !== 'labs')) {
|
|
35
35
|
console.log(` ${row.usage.padEnd(58)} ${row.description}`);
|
|
36
36
|
}
|
|
37
|
-
console.log('\nThree core promises: Completion Proof for serious routes, Image Voxel TriWiki for visual routes, and release-gated Codex App/
|
|
37
|
+
console.log('\nThree core promises: Completion Proof for serious routes, Image Voxel TriWiki for visual routes, and release-gated Codex App/Desktop Bridge/hooks/Rust evidence.');
|
|
38
38
|
}
|
|
39
39
|
export function commandsCommand(args = []) {
|
|
40
40
|
const commands = commandRows();
|
|
@@ -4,7 +4,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
4
4
|
import { flag } from '../../cli/args.js';
|
|
5
5
|
import { printJson } from '../../cli/output.js';
|
|
6
6
|
import { projectRoot } from '../fsx.js';
|
|
7
|
-
import { evaluateGateProcessOutput } from './gate-result-contract.js';
|
|
7
|
+
import { GATE_RESULT_CONTRACT, evaluateGateProcessOutput } from './gate-result-contract.js';
|
|
8
8
|
const CHECK_SCHEMA = 'sks.check.v1';
|
|
9
9
|
export async function checkCommand(args = []) {
|
|
10
10
|
const root = await projectRoot();
|
|
@@ -44,14 +44,7 @@ export async function checkCommand(args = []) {
|
|
|
44
44
|
reason = 'invalid_json_output';
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
if (step.output_contract ===
|
|
48
|
-
const gateEval = evaluateGateProcessOutput({ status: result.status, stdout, requiresContract: true });
|
|
49
|
-
ok = gateEval.ok;
|
|
50
|
-
reason = gateEval.reason;
|
|
51
|
-
contract = gateEval.contract;
|
|
52
|
-
gateResult = gateEval.gate_result;
|
|
53
|
-
}
|
|
54
|
-
else if (step.name.startsWith('release:')) {
|
|
47
|
+
if (step.output_contract === GATE_RESULT_CONTRACT) {
|
|
55
48
|
const gateEval = evaluateGateProcessOutput({ status: result.status, stdout });
|
|
56
49
|
ok = gateEval.ok;
|
|
57
50
|
reason = gateEval.reason;
|
|
@@ -101,7 +94,7 @@ function buildCheckPlan(input) {
|
|
|
101
94
|
}
|
|
102
95
|
else {
|
|
103
96
|
steps.push({ name: buildScript, command: 'npm', args: ['run', buildScript, '--silent'] });
|
|
104
|
-
steps.push({ name: `release:${tier}`, command: process.execPath, args: dagArgs(tier, input.changedSince, input.sla), output_contract:
|
|
97
|
+
steps.push({ name: `release:${tier}`, command: process.execPath, args: dagArgs(tier, input.changedSince, input.sla), output_contract: GATE_RESULT_CONTRACT });
|
|
105
98
|
}
|
|
106
99
|
return {
|
|
107
100
|
tier,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export const GATE_RESULT_CONTRACT = 'sks.gate-result.
|
|
1
|
+
export const GATE_RESULT_CONTRACT = 'sks.gate-result.v2';
|
|
2
|
+
export const GATE_RESULT_CONTRACT_MODE = 'strict';
|
|
2
3
|
export function parseGateResultFromStdout(stdout) {
|
|
3
4
|
const lines = String(stdout || '').trim().split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
4
5
|
const last = lines.at(-1);
|
|
@@ -6,7 +7,10 @@ export function parseGateResultFromStdout(stdout) {
|
|
|
6
7
|
return null;
|
|
7
8
|
try {
|
|
8
9
|
const parsed = JSON.parse(last);
|
|
9
|
-
if (parsed?.schema === GATE_RESULT_CONTRACT
|
|
10
|
+
if (parsed?.schema === GATE_RESULT_CONTRACT
|
|
11
|
+
&& parsed.contract_mode === GATE_RESULT_CONTRACT_MODE
|
|
12
|
+
&& typeof parsed.ok === 'boolean'
|
|
13
|
+
&& Array.isArray(parsed.blockers)) {
|
|
10
14
|
return parsed;
|
|
11
15
|
}
|
|
12
16
|
return null;
|
|
@@ -15,22 +19,14 @@ export function parseGateResultFromStdout(stdout) {
|
|
|
15
19
|
return null;
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
|
-
export function evaluateGateProcessOutput({ status, stdout
|
|
22
|
+
export function evaluateGateProcessOutput({ status, stdout }) {
|
|
19
23
|
const gateResult = parseGateResultFromStdout(stdout);
|
|
20
24
|
if (!gateResult) {
|
|
21
|
-
if (requiresContract) {
|
|
22
|
-
return {
|
|
23
|
-
ok: false,
|
|
24
|
-
contract: GATE_RESULT_CONTRACT,
|
|
25
|
-
gate_result: null,
|
|
26
|
-
reason: 'gate_output_contract_violation'
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
25
|
return {
|
|
30
|
-
ok:
|
|
31
|
-
contract:
|
|
26
|
+
ok: false,
|
|
27
|
+
contract: GATE_RESULT_CONTRACT,
|
|
32
28
|
gate_result: null,
|
|
33
|
-
|
|
29
|
+
reason: 'gate_output_contract_violation'
|
|
34
30
|
};
|
|
35
31
|
}
|
|
36
32
|
return {
|
|
@@ -24,7 +24,7 @@ export function normalizeIntentCommand(input) {
|
|
|
24
24
|
canonicalCommand,
|
|
25
25
|
targetHashes: input.targetHashes,
|
|
26
26
|
policyVersion: input.policyVersion,
|
|
27
|
-
|
|
27
|
+
runtimeSnapshot: input.runtimeSnapshot,
|
|
28
28
|
evidenceState: input.evidenceState,
|
|
29
29
|
...(input.observedChangedPaths === undefined ? {} : { observedChangedPaths: input.observedChangedPaths }),
|
|
30
30
|
...(input.retryBudget === undefined ? {} : { retryBudget: input.retryBudget }),
|