sneakoscope 8.0.2 → 8.0.4
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 +150 -37
- package/config/skills-hash-ledger.v1.json +1 -1
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/fast-inline.js +55 -27
- package/dist/bin/install.js +6 -32
- package/dist/bin/sks-dispatch.js +1 -1
- package/dist/cli/args.js +0 -2
- package/dist/cli/cli-theme.js +18 -9
- package/dist/cli/command-manifest-lite.js +6 -6
- package/dist/cli/command-registry.js +6 -6
- package/dist/cli/feature-commands.js +9 -7
- package/dist/cli/install-helpers-codex-lb-chain.js +198 -7
- package/dist/cli/install-helpers-codex-lb-config.js +78 -10
- package/dist/cli/install-helpers-install-support.js +9 -6
- package/dist/cli/install-helpers.js +101 -49
- package/dist/cli/install-tool-helpers.js +2 -82
- package/dist/cli/output.js +6 -1
- package/dist/cli/router.js +101 -2
- package/dist/commands/codex-lb.js +119 -19
- package/dist/commands/doctor-profile.js +1 -1
- package/dist/commands/doctor.js +727 -144
- package/dist/commands/mad-sks.js +1 -5
- package/dist/config/skills-manifest.json +4 -2
- package/dist/core/agents/agent-codex-cockpit.js +0 -3
- package/dist/core/agents/agent-effort-policy.js +5 -5
- package/dist/core/agents/agent-janitor.js +0 -20
- package/dist/core/agents/agent-orchestrator.js +9 -56
- package/dist/core/agents/agent-output-validator.js +2 -3
- package/dist/core/agents/agent-patch-schema.js +2 -2
- package/dist/core/agents/agent-proof-evidence.js +0 -65
- package/dist/core/agents/agent-recursion-guard.js +1 -1
- package/dist/core/agents/agent-runner-codex-exec.js +5 -3
- package/dist/core/agents/agent-scheduler.js +327 -85
- package/dist/core/agents/agent-schema.js +1 -1
- package/dist/core/agents/agent-trust-report.js +0 -36
- package/dist/core/agents/agent-worker-pipeline.js +0 -1
- package/dist/core/agents/fast-mode-policy.js +1 -3
- package/dist/core/agents/native-cli-worker-runtime-proof.js +1 -1
- package/dist/core/agents/native-cli-worker-runtime.js +69 -647
- package/dist/core/agents/native-cli-worker.js +6 -7
- package/dist/core/agents/native-worker-backend-router.js +2 -32
- package/dist/core/agents/no-subagent-scaling-policy.js +1 -1
- package/dist/core/agents/parallel-runtime-proof.js +1 -6
- package/dist/core/agents/runtime-proof-summary.js +1 -35
- package/dist/core/architecture-hardening/contracts/contracts.js +193 -0
- package/dist/core/architecture-hardening/migration/migration.js +111 -0
- package/dist/core/architecture-hardening/state/state-service.js +155 -0
- package/dist/core/artifact-schemas.js +0 -3
- package/dist/core/codex/codex-config-guard.js +238 -52
- package/dist/core/codex-adapter.js +5 -3
- package/dist/core/codex-app/auxiliary-oauth-policy.js +36 -0
- package/dist/core/codex-app/catalog-compat/catalog-service.js +104 -0
- package/dist/core/codex-app/child-policy/child-policy.js +35 -0
- package/dist/core/codex-app/codex-app-handoff.js +0 -1
- package/dist/core/codex-app/codex-hook-lifecycle.js +1 -1
- package/dist/core/codex-app/codex-init-deep.js +1 -1
- package/dist/core/codex-app/menubar/app-bundle.js +2 -0
- package/dist/core/codex-app/menubar/constants.js +14 -1
- package/dist/core/codex-app/menubar/global-install.js +288 -0
- package/dist/core/codex-app/menubar/installer.js +79 -14
- package/dist/core/codex-app/menubar/launch-agent.js +267 -45
- package/dist/core/codex-app/menubar/paths.js +3 -0
- package/dist/core/codex-app/menubar/rollback.js +55 -7
- package/dist/core/codex-app/menubar/status.js +75 -4
- package/dist/core/codex-app/provider-child-policy.js +64 -0
- package/dist/core/codex-app/provider-mode.js +91 -0
- package/dist/core/codex-app/provider-operation-stages.js +20 -0
- package/dist/core/codex-app/provider-session-policy.js +85 -0
- package/dist/core/codex-app/session-policy/session-pinning.js +68 -0
- package/dist/core/codex-app.js +3 -2
- package/dist/core/codex-control/codex-0139-image-path-real-probe.js +3 -1
- package/dist/core/codex-control/codex-0139-web-search-probe.js +3 -1
- package/dist/core/codex-control/codex-app-server-runtime-env.js +13 -4
- package/dist/core/codex-control/codex-app-server-v2-client.js +3 -3
- package/dist/core/codex-control/codex-control-proof.js +0 -1
- package/dist/core/codex-control/codex-task-runner.js +1 -4
- package/dist/core/codex-exec-output-schema.js +4 -1
- package/dist/core/codex-lb/codex-lb-env.js +63 -72
- package/dist/core/codex-lb/codex-lb-setup.js +15 -2
- package/dist/core/codex-lb/desktop-bridge/header-policy.js +6 -0
- package/dist/core/codex-lb/desktop-bridge/http-forward.js +48 -6
- package/dist/core/codex-lb/desktop-bridge/security.js +134 -0
- package/dist/core/codex-lb/desktop-bridge/server.js +9 -3
- package/dist/core/codex-lb/desktop-bridge/state.js +26 -6
- package/dist/core/codex-lb/desktop-bridge/types.js +1 -0
- package/dist/core/codex-lb/desktop-center-credentials.js +517 -58
- package/dist/core/codex-lb/desktop-controller.js +177 -56
- package/dist/core/codex-lb/desktop-service.js +179 -40
- package/dist/core/codex-lb/legacy-migration.js +1 -3
- package/dist/core/codex-lb/native-openai-transport/transport.js +68 -0
- package/dist/core/codex-lb/probes/cli-image-tool-probe.js +1 -1
- package/dist/core/codex-lb/provider-routing/provider-router.js +58 -0
- package/dist/core/codex-lb/routing-truth.js +327 -0
- package/dist/core/codex-native/codex-native-feature-broker.js +4 -0
- package/dist/core/codex-native/codex-native-pattern-analysis.js +1 -2
- package/dist/core/codex-native/core-skill-manifest.js +1 -1
- package/dist/core/codex-plugins/codex-plugin-json.js +26 -6
- package/dist/core/codex-plugins/codex-plugin-repair.js +32 -6
- package/dist/core/commands/basic-cli.js +9 -7
- package/dist/core/commands/computer-use-command.js +1 -1
- package/dist/core/commands/image-ux-review-command.js +16 -9
- package/dist/core/commands/install-package-command.js +105 -0
- package/dist/core/commands/intent-normalization/normalizer.js +96 -0
- package/dist/core/commands/mad-sks-command.js +23 -274
- package/dist/core/commands/mad-sks-headless.js +11 -30
- package/dist/core/commands/naruto-command.js +0 -25
- package/dist/core/commands/qa-loop-command.js +104 -22
- package/dist/core/commands/remote-command.js +2 -2
- package/dist/core/commands/research-command.js +10 -5
- package/dist/core/commands/telegram-command.js +407 -0
- package/dist/core/config-adopt/config-adopt-command.js +35 -0
- package/dist/core/config-adopt/config-adopt.js +346 -0
- package/dist/core/config-adopt/index.js +3 -0
- package/dist/core/doctor/command-alias-cleanup.js +4 -1
- package/dist/core/doctor/current-project-guidance-nested.js +37 -6
- package/dist/core/doctor/current-project-guidance.js +15 -9
- package/dist/core/doctor/doctor-dirty-planner.js +1 -4
- package/dist/core/doctor/doctor-readiness-matrix.js +15 -18
- package/dist/core/doctor/retired-managed-residue-private.js +4 -3
- package/dist/core/doctor/retired-managed-residue-runtime.js +2 -2
- package/dist/core/doctor/skill-legacy-surface.js +11 -10
- package/dist/core/doctor/sks-menubar-doctor.js +4 -0
- package/dist/core/evaluation.js +0 -19
- package/dist/core/evidence/v2/evidence-key.js +105 -0
- package/dist/core/feature-fixtures.js +12 -7
- package/dist/core/feature-registry.js +52 -21
- package/dist/core/hooks-runtime/hook-context.js +9 -0
- package/dist/core/hooks-runtime/managed-skill-admission.js +54 -4
- package/dist/core/hooks-runtime/official-subagent-lifecycle.js +69 -52
- package/dist/core/hooks-runtime/stop-finalization.js +226 -0
- package/dist/core/hooks-runtime/stop-repeat-guard.js +21 -2
- package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +2 -2
- package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +3 -3
- package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +43 -5
- package/dist/core/hooks-runtime/subagent-skill-availability.js +64 -30
- package/dist/core/hooks-runtime/subagent-stop-hook.js +15 -2
- package/dist/core/hooks-runtime.js +179 -212
- package/dist/core/image/reference-evidence/reference-registry.js +145 -0
- package/dist/core/image-ux-review/imagegen-adapter.js +21 -9
- package/dist/core/image-ux-review/reference-policy/reference-policy.js +9 -0
- package/dist/core/imagegen/codex-lb-imagegen-target.js +8 -0
- package/dist/core/imagegen/imagegen-capability.js +59 -2
- package/dist/core/imagegen/require-imagegen.js +2 -2
- package/dist/core/init/skills.js +17 -3
- package/dist/core/init.js +3 -3
- package/dist/core/install/installed-package-smoke.js +23 -5
- package/dist/core/json/canonical.js +9 -0
- package/dist/core/locks/file-lock.js +0 -1
- package/dist/core/loops/loop-continuation-enforcer.js +65 -7
- package/dist/core/loops/loop-decomposer.js +0 -1
- package/dist/core/loops/loop-gate-runner.js +65 -4
- package/dist/core/loops/loop-gate-selector.js +0 -2
- package/dist/core/loops/loop-proof-validation.js +38 -0
- package/dist/core/loops/loop-risk-classifier.js +1 -1
- package/dist/core/loops/loop-runtime.js +14 -2
- package/dist/core/loops/loop-scheduler.js +7 -2
- package/dist/core/loops/loop-worker-runtime.js +0 -15
- package/dist/core/loops/loop-worktree-runtime.js +52 -4
- package/dist/core/managed-assets/managed-assets-manifest.js +14 -14
- package/dist/core/naruto/hardware-capacity-probe.js +9 -6
- package/dist/core/naruto/naruto-active-pool.js +2 -14
- package/dist/core/naruto/naruto-concurrency-governor.js +71 -31
- package/dist/core/naruto/naruto-loop-worker-router.js +0 -2
- package/dist/core/naruto/naruto-verification-dag.js +0 -1
- package/dist/core/naruto/naruto-write-e2e.js +1 -2
- package/dist/core/naruto/resource-pressure-monitor.js +0 -4
- package/dist/core/observability/architecture-hardening/safe-projection.js +65 -0
- package/dist/core/perf/import-graph-budget.js +0 -1
- package/dist/core/perf/release-latency-slo.js +3 -2
- package/dist/core/preflight/parallel-preflight-engine.js +2 -15
- package/dist/core/product-design-app-server.js +13 -1
- package/dist/core/proof/fake-real-proof-policy.js +2 -17
- package/dist/core/proof/route-proof-gate.js +2 -10
- package/dist/core/proof/route-proof-policy.js +1 -1
- package/dist/core/proof/runtime-evidence-policy.js +185 -0
- package/dist/core/proof/runtime-truth-matrix.js +64 -39
- package/dist/core/proof/validation.js +27 -11
- package/dist/core/provider/provider-context.js +18 -2
- package/dist/core/providers/openrouter/openrouter-account.js +3 -2
- package/dist/core/python-tools/python-tool-runner.js +1 -1
- package/dist/core/qa-loop/qa-execution-control.js +57 -0
- package/dist/core/questions.js +1 -1
- package/dist/core/release/extreme-parallel-scheduler.js +0 -3
- package/dist/core/release/gate-manifest.js +3 -7
- package/dist/core/release/gate-pack-manifest.js +3 -7
- package/dist/core/release/package-size-budget.js +2 -2
- package/dist/core/release/physical-release-gates.js +189 -0
- package/dist/core/release/publish-preflight.js +113 -0
- package/dist/core/release/release-gate-affected-selector.js +0 -2
- package/dist/core/release/release-gate-batch-runner.js +1 -1
- package/dist/core/release/release-gate-node.js +0 -1
- package/dist/core/release/release-gate-resource-governor.js +0 -1
- package/dist/core/release/release-pack-receipt.js +5 -8
- package/dist/core/release/release-real-contract.js +0 -6
- package/dist/core/release/resource-class-budget.js +0 -1
- package/dist/core/release/stage-publish.js +178 -36
- package/dist/core/research/research-adversarial-review.js +103 -9
- package/dist/core/research.js +1 -1
- package/dist/core/retention.js +0 -1
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes/diagnostic-allowlist.js +0 -1
- package/dist/core/routes/dollar-manifest-lite.js +1 -1
- package/dist/core/routes.js +46 -15
- package/dist/core/runtime/execution-control.js +226 -0
- package/dist/core/runtime/progress-recovery/progress-recovery.js +89 -0
- package/dist/core/runtime/task-profile.js +10 -4
- package/dist/core/runtime/verification-budget.js +10 -1
- package/dist/core/safety/intent-contract/intent-contract.js +94 -0
- package/dist/core/safety/mutation-guard.js +0 -2
- package/dist/core/safety/mutation-ledger.js +0 -2
- package/dist/core/safety/requested-scope-contract.js +0 -0
- package/dist/core/search-visibility/discovery.js +1 -1
- package/dist/core/search-visibility/index.js +12 -0
- package/dist/core/search-visibility/verifier.js +112 -3
- package/dist/core/security/private-credential-file.js +209 -0
- package/dist/core/session/project-namespace.js +0 -5
- package/dist/core/skills/skill-agent-metadata.js +1 -3
- package/dist/core/strategy/adhd-orchestrating-gate.js +0 -1
- package/dist/core/subagents/agent-catalog.js +19 -34
- package/dist/core/subagents/model-policy.js +65 -24
- package/dist/core/subagents/naruto-help-contract.js +8 -8
- package/dist/core/subagents/naruto-host-credentials.js +13 -0
- package/dist/core/subagents/official-subagent-config.js +16 -6
- package/dist/core/subagents/official-subagent-preparation.js +35 -16
- package/dist/core/subagents/official-subagent-prompt.js +7 -7
- package/dist/core/subagents/official-subagent-runner.js +27 -4
- package/dist/core/subagents/role-model-preferences.js +1 -1
- package/dist/core/subagents/thread-budget.js +19 -12
- package/dist/core/subagents/wave-lifecycle.js +18 -6
- package/dist/core/telegram/access.js +58 -0
- package/dist/core/telegram/client.js +157 -0
- package/dist/core/telegram/confirmation.js +37 -0
- package/dist/core/telegram/doctor.js +154 -0
- package/dist/core/telegram/index.js +9 -0
- package/dist/core/telegram/keychain.js +317 -0
- package/dist/core/telegram/liveness.js +118 -0
- package/dist/core/telegram/poller.js +90 -0
- package/dist/core/telegram/redaction.js +15 -0
- package/dist/core/telegram/state-lock.js +416 -0
- package/dist/core/telegram/types.js +1 -0
- package/dist/core/text/strings.js +3 -0
- package/dist/core/triwiki/context-graph/store/evidence-write-lock.js +29 -0
- package/dist/core/triwiki/context-graph/store/fragment-cache.js +24 -0
- package/dist/core/triwiki/context-graph/store/snapshot-store.js +69 -21
- package/dist/core/triwiki/triwiki-gate-impact-map.js +2 -2
- package/dist/core/triwiki/triwiki-module-card.js +1 -2
- package/dist/core/update/installed-cli-resolution.js +170 -0
- package/dist/core/update/update-diagnostics.js +52 -0
- package/dist/core/update/update-migration-state.js +30 -12
- package/dist/core/update/update-operation.js +2 -1
- package/dist/core/update/update-stage-diagnostics.js +38 -0
- package/dist/core/update/update-status.js +2 -9
- package/dist/core/update-check.js +279 -91
- package/dist/core/version.js +1 -1
- package/dist/native/sks-menubar/Sources/AppDelegate.swift +19 -1
- package/dist/native/sks-menubar/Sources/AppIdentity.swift +7 -0
- package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +6 -2
- package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +159 -92
- package/dist/native/sks-menubar/Sources/OperationModels.swift +389 -0
- package/dist/native/sks-menubar/Sources/OverviewViewController.swift +57 -0
- package/dist/native/sks-menubar/Sources/ProcessClient.swift +3 -1
- package/dist/native/sks-menubar/Sources/ProvidersConnectTest.swift +115 -0
- package/dist/native/sks-menubar/Sources/ProvidersFastMode.swift +17 -0
- package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +3 -0
- package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +58 -17
- package/dist/native/sks-menubar/Sources/ProvidersReliability.swift +302 -0
- package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +5 -0
- package/dist/native/sks-menubar/Sources/ProvidersRoutingTruth.swift +190 -0
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +158 -126
- package/dist/native/sks-menubar/Sources/RemoteCodingViewController.swift +462 -26
- package/dist/native/sks-menubar/Sources/SKSKeychainStore.swift +344 -0
- package/dist/native/sks-menubar/Sources/SecureProcessEnvelope.swift +27 -0
- package/dist/native/sks-menubar/Sources/SingletonInstanceGuard.swift +328 -0
- package/dist/native/sks-menubar/Sources/StatusItemController.swift +10 -2
- package/dist/native/sks-menubar/Sources/TelegramPrivateFileStore.swift +498 -0
- package/dist/native/sks-menubar/Sources/TelegramPrivateFileSupport.swift +236 -0
- package/dist/native/sks-menubar/Sources/TelegramProcessGateway.swift +454 -0
- package/dist/native/sks-menubar/Sources/TelegramRuntimeSupport.swift +56 -0
- package/dist/native/sks-menubar/Sources/TelegramStateLock.swift +448 -0
- package/dist/native/sks-menubar/Sources/TelegramSupport.swift +187 -0
- package/dist/native/sks-menubar/Sources/TelegramTransport.swift +499 -0
- package/dist/native/sks-menubar/Sources/main.swift +15 -1
- package/dist/scripts/all-feature-deep-completion-check.js +5 -1
- package/dist/scripts/check-publish-tag.js +56 -0
- package/dist/scripts/codex-lb-fast-mode-truth-check.js +10 -3
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +12 -3
- package/dist/scripts/codex-lb-gpt56-fast-profile-check.js +4 -2
- package/dist/scripts/codex-native-agent-role-content-check.js +3 -3
- package/dist/scripts/codex-native-gate-lib.js +14 -7
- package/dist/scripts/current-command-surface-check.js +7 -7
- package/dist/scripts/current-surface-update-e2e-check.js +4 -3
- package/dist/scripts/current-upgrade-matrix-check.js +5 -24
- package/dist/scripts/docs-truthfulness-check.js +17 -13
- package/dist/scripts/gate-lib.js +0 -2
- package/dist/scripts/gate-policy-audit-check.js +3 -2
- package/dist/scripts/harness-benchmark-check.js +1 -1
- package/dist/scripts/init-deep-backup-retention-check.js +1 -1
- package/dist/scripts/lib/codex-sdk-gate-lib.js +1 -2
- package/dist/scripts/loop-directive-check-lib.js +28 -38
- package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +14 -180
- package/dist/scripts/mad-sks-launch-sql-plane-boundary-check.js +2 -11
- package/dist/scripts/official-subagent-workflow-check.js +1 -1
- package/dist/scripts/packlist-performance-check.js +1 -2
- package/dist/scripts/prepublish-release-check-or-fast.js +32 -0
- package/dist/scripts/publish-preflight.js +12 -0
- package/dist/scripts/release-affected-selector-check.js +2 -2
- package/dist/scripts/release-gate-batch-runner-check.js +2 -2
- package/dist/scripts/release-metadata-check.js +8 -12
- package/dist/scripts/release-real-check.js +2 -54
- package/dist/scripts/runtime-domain-gate-lib.js +2 -96
- package/dist/scripts/runtime-proof-summary-check.js +2 -6
- package/dist/scripts/search-visibility-gate-lib.js +0 -1
- package/dist/scripts/sks-cli-gate-lib.js +1 -1
- package/dist/scripts/typed-routing-gate-lib.js +7 -59
- package/docs/demo.tape +1 -1
- package/infra-harness-gates.json +1 -1456
- package/package.json +10 -7
- package/release-gates.v2.json +0 -1
- package/schemas/agents/parallel-runtime-proof.schema.json +0 -2
- package/schemas/codex/agent-result.schema.json +0 -6
- package/schemas/naruto/naruto-concurrency-governor.schema.json +1 -3
- package/schemas/release/release-gate-node.schema.json +1 -1
- package/dist/commands/zellij-lane.js +0 -22
- package/dist/commands/zellij-monitor-pane.js +0 -26
- package/dist/commands/zellij-slot-column-anchor.js +0 -22
- package/dist/commands/zellij-slot-pane.js +0 -80
- package/dist/commands/zellij-viewport-pane.js +0 -57
- package/dist/commands/zellij.js +0 -422
- package/dist/core/agents/agent-runner-zellij.js +0 -164
- package/dist/core/agents/agent-slot-pane-binding-proof.js +0 -96
- package/dist/core/agents/parallel-write-fixture.js +0 -305
- package/dist/core/agents/worker-pane-communication-contract.js +0 -100
- package/dist/core/agents/zellij-lane-supervisor.js +0 -428
- package/dist/core/agents/zellij-right-lane-cockpit.js +0 -66
- package/dist/core/doctor/doctor-zellij-repair.js +0 -40
- package/dist/core/ops/upgrade-migration-fixtures.js +0 -119
- package/dist/core/proof/route-finalizer-fixtures.js +0 -21
- package/dist/core/zellij/homebrew-policy.js +0 -43
- package/dist/core/zellij/zellij-capability.js +0 -126
- package/dist/core/zellij/zellij-clipboard-config.js +0 -52
- package/dist/core/zellij/zellij-command.js +0 -149
- package/dist/core/zellij/zellij-fake-adapter.js +0 -186
- package/dist/core/zellij/zellij-lane-renderer.js +0 -706
- package/dist/core/zellij/zellij-lane-runtime.js +0 -189
- package/dist/core/zellij/zellij-launcher.js +0 -268
- package/dist/core/zellij/zellij-layout-builder.js +0 -191
- package/dist/core/zellij/zellij-monitor-renderer.js +0 -52
- package/dist/core/zellij/zellij-official-subagent-activity.js +0 -526
- package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -258
- package/dist/core/zellij/zellij-pane-proof.js +0 -226
- package/dist/core/zellij/zellij-right-column-manager.js +0 -308
- package/dist/core/zellij/zellij-screen-proof.js +0 -120
- package/dist/core/zellij/zellij-self-heal-types.js +0 -44
- package/dist/core/zellij/zellij-self-heal.js +0 -408
- package/dist/core/zellij/zellij-slot-column-anchor.js +0 -304
- package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -521
- package/dist/core/zellij/zellij-slot-telemetry.js +0 -384
- package/dist/core/zellij/zellij-theme.js +0 -66
- package/dist/core/zellij/zellij-ui-mode.js +0 -34
- package/dist/core/zellij/zellij-update.js +0 -348
- package/dist/core/zellij/zellij-viewport-binder.js +0 -61
- package/dist/core/zellij/zellij-worker-pane-manager.js +0 -881
- package/dist/core/zellij/zellij-worker-pane-summary.js +0 -64
- package/dist/native/sks-menubar/Tests/AppRuntimeTestSupport.swift +0 -26
- package/dist/native/sks-menubar/Tests/OperationCoordinatorTests.swift +0 -174
- package/dist/native/sks-menubar/Tests/ProcessClientTests.swift +0 -20
- package/dist/native/sks-menubar/Tests/ProvidersViewControllerTests.swift +0 -142
- package/dist/scripts/zellij-pane-proof-check.js +0 -88
- package/dist/scripts/zellij-real-session-cleanup-check.js +0 -139
- package/dist/scripts/zellij-real-session-launch-check.js +0 -126
- package/dist/scripts/zellij-screen-proof-check.js +0 -43
- package/schemas/zellij/zellij-right-column-state.schema.json +0 -40
- package/schemas/zellij/zellij-slot-telemetry.schema.json +0 -89
- package/schemas/zellij/zellij-worker-pane.schema.json +0 -53
- package/scripts/build-clean-atomic.mjs +0 -323
|
@@ -9,7 +9,6 @@ import { guardedPackageInstall, guardContextForRoute } from '../core/safety/muta
|
|
|
9
9
|
import { formatHarnessConflictReport, llmHarnessCleanupPrompt, scanHarnessConflicts } from '../core/harness-conflicts.js';
|
|
10
10
|
import { initProject, installGlobalSkills } from '../core/init.js';
|
|
11
11
|
import { context7ConfigToml, DOLLAR_SKILL_NAMES, GETDESIGN_REFERENCE, hasContext7ConfigText, RECOMMENDED_SKILLS } from '../core/routes.js';
|
|
12
|
-
import { checkZellijCapability } from '../core/zellij/zellij-capability.js';
|
|
13
12
|
import { reconcileCodexAppUpgradeProcesses } from '../core/codex-app.js';
|
|
14
13
|
import { restartCodexApp } from '../core/codex-app/codex-app-restart.js';
|
|
15
14
|
import { cleanupMacLaunchSecretEnvironment } from '../core/codex-app/menubar/index.js';
|
|
@@ -29,7 +28,7 @@ import { canAskYesNo, compareVersions, hasCodexUnstableFeatureWarningSuppression
|
|
|
29
28
|
import { printCodexLbSetupWarnings } from './codex-lb-setup-warning-output.js';
|
|
30
29
|
import { checkCodexLbResponseChain } from './install-helpers-codex-lb-chain.js';
|
|
31
30
|
import { CODEX_LB_CANONICAL_FAST_SERVICE_TIER, CODEX_LB_PROVIDER_ENV_KEY, askPostinstallQuestion, codexAuthChatgptBackupPath, codexAuthPath, codexLbConfigPath, codexLbEnvPath, hasTopLevelCodexLbSelected, normalizeCodexLbBaseUrl, parseCodexLbEnvKey, redactSecretText } from './install-helpers-codex-lb-shared.js';
|
|
32
|
-
import { CODEX_LB_DESKTOP_BRIDGE_MARKER, CODEX_LB_DESKTOP_COMPAT_MARKER, appliedCodexLbPersistenceModes, captureCodexLbSetupWriteState, codexLbSharedOpenAiRoutingState, detectCodexLbSetupDrift, ensureGlobalCodexAppGlmProfile, ensureStoredOpenRouterProviderDuringInstall, hardenCodexLbSetupRecoveryPath,
|
|
31
|
+
import { CODEX_LB_DESKTOP_BRIDGE_MARKER, CODEX_LB_DESKTOP_COMPAT_MARKER, CODEX_LB_PROVIDER_SELECTION_MARKER, appliedCodexLbPersistenceModes, captureCodexLbSetupWriteState, codexLbSharedOpenAiRoutingState, detectCodexLbSetupDrift, ensureGlobalCodexAppGlmProfile, ensureStoredOpenRouterProviderDuringInstall, hardenCodexLbSetupRecoveryPath, removeCodexLbSetupRecoveryPath, removeCodexLbOrphanManagedMarkers, removeCodexLbSharedOpenAiRouting, removeCodexLbManagedDesktopConfig, restoreCodexLbSetupWriteState, sha256Text, shellSingleQuote, upsertCodexAppGlmConfig, upsertCodexLbConfig, upsertCodexLbCliProviderConfig, upsertCodexLbCompatDesktopConfig, upsertCodexLbNativeDesktopConfig, upsertCodexLbSharedOpenAiRouting, writeCodexLbSetupFileIfUnchanged } from './install-helpers-codex-lb-config.js';
|
|
33
32
|
import { detectLegacyCodexLbDesktopState } from '../core/codex-lb/legacy-migration.js';
|
|
34
33
|
import { ensureCodexImagegenDuringInstall, ensureGlobalCodexSkillsDuringInstall, ensureGlobalContext7DuringInstall, ensureGlobalGetdesignSkillDuringInstall, ensureSksCommandDuringInstall } from './install-helpers-install-support.js';
|
|
35
34
|
import { escapeRegExp } from '../core/text/regex.js';
|
|
@@ -236,7 +235,7 @@ async function reportPostinstallCodexLbAuth(snapshot = null) {
|
|
|
236
235
|
else if (codexLbAuth.status === 'skipped')
|
|
237
236
|
console.log(`codex-lb auth: skipped (${codexLbAuth.reason}).`);
|
|
238
237
|
else if (codexLbAuth.status === 'missing_env_key')
|
|
239
|
-
console.log('codex-lb auth: stored key missing.
|
|
238
|
+
console.log('codex-lb auth: stored key missing. Store it in ~/.codex/sks-codex-lb.env, run `sks codex-lb setup --host <domain> --api-key-stdin --yes`, or provide CODEX_LB_API_KEY in the environment.');
|
|
240
239
|
else if (codexLbAuth.status === 'missing_base_url')
|
|
241
240
|
console.log('codex-lb auth: stored key has no recoverable base URL. Run `sks codex-lb reconfigure --host <domain> --api-key-stdin` once.');
|
|
242
241
|
else if (codexLbAuth.status === 'legacy_migration_required')
|
|
@@ -557,17 +556,16 @@ function codexLbRoutingPlane(mode) {
|
|
|
557
556
|
return 'desktop_compat_provider';
|
|
558
557
|
return 'cli_provider';
|
|
559
558
|
}
|
|
560
|
-
async function capturePostinstallCodexLbConfigSnapshot(home = process.env.HOME || os.homedir()) {
|
|
559
|
+
export async function capturePostinstallCodexLbConfigSnapshot(home = process.env.HOME || os.homedir()) {
|
|
561
560
|
const configPath = codexLbConfigPath(home);
|
|
562
561
|
const envPath = codexLbEnvPath(home);
|
|
563
562
|
const authPath = codexAuthPath(home);
|
|
564
563
|
const config = await readText(configPath, '');
|
|
565
|
-
const envText = await readText(envPath, '');
|
|
566
564
|
const auth = await captureCodexAuthSnapshot({ home, authPath });
|
|
567
565
|
const envLoad = await loadCodexLbEnv({ home, envPath });
|
|
568
566
|
const envKey = envLoad.secret_api_key || '';
|
|
569
567
|
const providerConfigured = /\[model_providers\.codex-lb\]/.test(config);
|
|
570
|
-
const baseUrl = envLoad.base_url || codexLbProviderBaseUrl(config)
|
|
568
|
+
const baseUrl = envLoad.base_url || codexLbProviderBaseUrl(config);
|
|
571
569
|
const desktopMode = managedCodexLbDesktopMode(config);
|
|
572
570
|
const bridgeBaseUrl = desktopMode === 'desktop-native-bridge'
|
|
573
571
|
? topLevelTomlString(config, 'openai_base_url')
|
|
@@ -590,7 +588,7 @@ async function capturePostinstallCodexLbConfigSnapshot(home = process.env.HOME |
|
|
|
590
588
|
secret_api_key: envKey || null
|
|
591
589
|
};
|
|
592
590
|
}
|
|
593
|
-
async function restorePostinstallCodexLbConfigSnapshot(snapshot) {
|
|
591
|
+
export async function restorePostinstallCodexLbConfigSnapshot(snapshot) {
|
|
594
592
|
if (!snapshot)
|
|
595
593
|
return { status: 'skipped', reason: 'no_snapshot' };
|
|
596
594
|
let configRestored = false;
|
|
@@ -608,15 +606,12 @@ async function restorePostinstallCodexLbConfigSnapshot(snapshot) {
|
|
|
608
606
|
else if (snapshot.desktop_mode === 'desktop-dual-auth-compat') {
|
|
609
607
|
next = upsertCodexLbCompatDesktopConfig(current, { remoteBaseUrl: snapshot.base_url });
|
|
610
608
|
}
|
|
611
|
-
else
|
|
609
|
+
else {
|
|
612
610
|
next = upsertCodexLbCliProviderConfig(current, {
|
|
613
611
|
remoteBaseUrl: snapshot.base_url,
|
|
614
|
-
selectGlobally:
|
|
612
|
+
selectGlobally: snapshot.selected === true
|
|
615
613
|
});
|
|
616
614
|
}
|
|
617
|
-
else {
|
|
618
|
-
configStatus = 'legacy_migration_required';
|
|
619
|
-
}
|
|
620
615
|
}
|
|
621
616
|
catch (error) {
|
|
622
617
|
return {
|
|
@@ -629,7 +624,7 @@ async function restorePostinstallCodexLbConfigSnapshot(snapshot) {
|
|
|
629
624
|
error: error instanceof Error ? error.message : String(error)
|
|
630
625
|
};
|
|
631
626
|
}
|
|
632
|
-
if (
|
|
627
|
+
if (ensureTrailingNewline(next) !== ensureTrailingNewline(current)) {
|
|
633
628
|
const safeWrite = await safeWriteCodexConfigToml(snapshot.config_path, current, next, 'codex-lb-safe-routing-restore', { verifyUnchangedBeforeWrite: true });
|
|
634
629
|
configRestored = safeWrite.ok && safeWrite.changed === true;
|
|
635
630
|
configStatus = safeWrite.ok ? (configRestored ? 'restored' : 'present') : safeWrite.status;
|
|
@@ -728,7 +723,11 @@ export async function configureCodexLb(opts = {}) {
|
|
|
728
723
|
? Buffer.from(String(configBeforeEntry.bytes_base64 || ''), 'base64').toString('utf8')
|
|
729
724
|
: '';
|
|
730
725
|
const preservedDesktopMode = managedCodexLbDesktopMode(initialConfig);
|
|
731
|
-
const
|
|
726
|
+
const managedCliSelection = hasTopLevelMarker(initialConfig, CODEX_LB_PROVIDER_SELECTION_MARKER)
|
|
727
|
+
&& hasTopLevelCodexLbSelected(initialConfig);
|
|
728
|
+
const preservedLegacySelection = hasTopLevelCodexLbSelected(initialConfig)
|
|
729
|
+
&& !preservedDesktopMode
|
|
730
|
+
&& !managedCliSelection;
|
|
732
731
|
const desktopMode = preservedDesktopMode || 'cli-provider';
|
|
733
732
|
if (desktopModeRequiresGlobalSecretEnvironment(desktopMode)) {
|
|
734
733
|
return {
|
|
@@ -739,11 +738,15 @@ export async function configureCodexLb(opts = {}) {
|
|
|
739
738
|
error: 'desktop_dual_auth_compat_requires_global_secret_environment'
|
|
740
739
|
};
|
|
741
740
|
}
|
|
742
|
-
const useDefaultProvider = desktopMode === 'desktop-dual-auth-compat'
|
|
741
|
+
const useDefaultProvider = desktopMode === 'desktop-dual-auth-compat'
|
|
742
|
+
|| preservedLegacySelection
|
|
743
|
+
|| managedCliSelection
|
|
744
|
+
|| (desktopMode === 'cli-provider' && opts.useDefaultProvider === true);
|
|
743
745
|
const setupAnswers = {
|
|
744
746
|
host_or_base_url: rawHost,
|
|
745
747
|
api_key_source: opts.apiKeySource || 'stdin',
|
|
746
748
|
desktop_mode: 'cli-provider',
|
|
749
|
+
use_as_default_provider: useDefaultProvider,
|
|
747
750
|
gateway_auth_transport: (opts.gatewayAuthTransport || DEFAULT_CODEX_LB_GATEWAY_AUTH_TRANSPORT),
|
|
748
751
|
write_env_file: writeEnvFile,
|
|
749
752
|
store_keychain: storeKeychain,
|
|
@@ -823,7 +826,7 @@ export async function configureCodexLb(opts = {}) {
|
|
|
823
826
|
else if (!preservedLegacySelection) {
|
|
824
827
|
providerOnly = upsertCodexLbCliProviderConfig(current, {
|
|
825
828
|
remoteBaseUrl: baseUrl,
|
|
826
|
-
selectGlobally:
|
|
829
|
+
selectGlobally: useDefaultProvider
|
|
827
830
|
});
|
|
828
831
|
}
|
|
829
832
|
}
|
|
@@ -1235,7 +1238,7 @@ export async function configureCodexLb(opts = {}) {
|
|
|
1235
1238
|
}
|
|
1236
1239
|
const skipLaunchEnvironment = opts.syncLaunchEnv === false
|
|
1237
1240
|
|| process.env.SKS_SKIP_CODEX_LB_LAUNCH_ENV === '1';
|
|
1238
|
-
const {
|
|
1241
|
+
const { repairCodexLbLegacyKeychainMigration, syncDesktopCenterLaunchCredentials } = await import('../core/codex-lb/desktop-center-credentials.js');
|
|
1239
1242
|
const centerCredentials = skipLaunchEnvironment
|
|
1240
1243
|
? {
|
|
1241
1244
|
schema: 'sks.codex-lb-desktop-center-credentials.v1',
|
|
@@ -1493,43 +1496,36 @@ export async function configureCodexLb(opts = {}) {
|
|
|
1493
1496
|
};
|
|
1494
1497
|
if ((opts.platform || process.platform) === 'darwin' && writeEnvFile && !storeKeychain) {
|
|
1495
1498
|
await opts.testHooks?.beforeLegacyKeychainCleanup?.({ envPath, metadataPath });
|
|
1496
|
-
const
|
|
1499
|
+
const migration = await repairCodexLbLegacyKeychainMigration({
|
|
1497
1500
|
home,
|
|
1501
|
+
baseUrl,
|
|
1498
1502
|
envPath,
|
|
1499
1503
|
metadataPath,
|
|
1500
1504
|
account: opts.account || process.env.USER || 'sks',
|
|
1501
|
-
|
|
1502
|
-
});
|
|
1503
|
-
const cleanup = await purgeStaleCodexLbCredentialTwins({
|
|
1504
|
-
home,
|
|
1505
|
-
account: opts.account || process.env.USER || 'sks',
|
|
1506
|
-
platform: 'darwin',
|
|
1507
|
-
skipStaleEnvTwins: true,
|
|
1505
|
+
platform: opts.platform || process.platform,
|
|
1508
1506
|
...(opts.securityBin ? { securityBin: opts.securityBin } : {}),
|
|
1509
1507
|
...(opts.runProcessImpl ? { runProcessImpl: opts.runProcessImpl } : {}),
|
|
1510
|
-
|
|
1511
|
-
? { legacyKeychainMigrationReceipt: replacement.receipt }
|
|
1512
|
-
: {})
|
|
1508
|
+
expectedApiKeySha256: keyFingerprint
|
|
1513
1509
|
});
|
|
1514
|
-
const cleanupBlockers = [
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1510
|
+
const cleanupBlockers = [...new Set(migration.blockers)];
|
|
1511
|
+
const replacementStoreVerified = migration.env_key_valid
|
|
1512
|
+
&& migration.status !== 'replacement_store_unverified'
|
|
1513
|
+
&& migration.status !== 'env_file_unsafe';
|
|
1514
|
+
const cleanupOk = replacementStoreVerified
|
|
1515
|
+
&& migration.ok
|
|
1516
|
+
&& cleanupBlockers.length === 0;
|
|
1521
1517
|
legacyKeychainCleanup = {
|
|
1522
1518
|
ok: cleanupOk,
|
|
1523
|
-
status: !
|
|
1519
|
+
status: !replacementStoreVerified
|
|
1524
1520
|
? 'legacy_keychain_cleanup_blocked_replacement_store_unverified'
|
|
1525
|
-
:
|
|
1526
|
-
?
|
|
1521
|
+
: cleanupOk
|
|
1522
|
+
? migration.keychain_cleared.length > 0
|
|
1527
1523
|
? 'legacy_keychain_removed'
|
|
1528
1524
|
: 'legacy_keychain_absent'
|
|
1529
1525
|
: 'legacy_keychain_cleanup_failed_secure_store_retained',
|
|
1530
|
-
replacement_store_verified:
|
|
1531
|
-
keychain_cleared:
|
|
1532
|
-
blockers:
|
|
1526
|
+
replacement_store_verified: replacementStoreVerified,
|
|
1527
|
+
keychain_cleared: migration.keychain_cleared,
|
|
1528
|
+
blockers: cleanupBlockers
|
|
1533
1529
|
};
|
|
1534
1530
|
appliedActions.push({
|
|
1535
1531
|
type: 'migrate_legacy_keychain',
|
|
@@ -1601,9 +1597,10 @@ export async function codexLbStatus(opts = {}) {
|
|
|
1601
1597
|
const home = opts.home || process.env.HOME || os.homedir();
|
|
1602
1598
|
const configPath = opts.configPath || codexLbConfigPath(home);
|
|
1603
1599
|
const envPath = opts.envPath || codexLbEnvPath(home);
|
|
1604
|
-
const
|
|
1600
|
+
const rawConfig = await readText(configPath, '');
|
|
1601
|
+
const orphanManagedMarkerCleanup = removeCodexLbOrphanManagedMarkers(rawConfig);
|
|
1602
|
+
const config = orphanManagedMarkerCleanup.text;
|
|
1605
1603
|
const envExists = await exists(envPath);
|
|
1606
|
-
const envText = envExists ? await readText(envPath, '') : '';
|
|
1607
1604
|
const envLoad = await loadCodexLbEnv({ ...opts, home, envPath });
|
|
1608
1605
|
const authPath = opts.authPath || codexAuthPath(home);
|
|
1609
1606
|
const authText = await readText(authPath, '');
|
|
@@ -1635,11 +1632,16 @@ export async function codexLbStatus(opts = {}) {
|
|
|
1635
1632
|
&& providerName === 'codex-lb'
|
|
1636
1633
|
&& providerWireApi === 'responses'
|
|
1637
1634
|
&& providerEnvKey === CODEX_LB_PROVIDER_ENV_KEY
|
|
1635
|
+
&& providerHasSeparateGatewayAuth
|
|
1638
1636
|
&& providerSupportsWebsockets === true
|
|
1639
1637
|
&& providerOpenAiAuthDisabled;
|
|
1640
1638
|
const retiredCompatConfigured = desktopMode === 'desktop-dual-auth-compat';
|
|
1639
|
+
const definedButNotSelected = providerConfigured && !selected && desktopMode === null;
|
|
1641
1640
|
const providerContractOk = !retiredCompatConfigured && cliProviderContractOk;
|
|
1642
|
-
const providerUsesCodexLbEnvAuth = providerConfigured
|
|
1641
|
+
const providerUsesCodexLbEnvAuth = providerConfigured
|
|
1642
|
+
&& providerEnvKey === CODEX_LB_PROVIDER_ENV_KEY
|
|
1643
|
+
&& providerHasSeparateGatewayAuth
|
|
1644
|
+
&& providerOpenAiAuthDisabled;
|
|
1643
1645
|
const oauthAvailable = authMode.mode === 'chatgpt_oauth' || authMode.mode === 'browser_marker';
|
|
1644
1646
|
const authRoutingCoherent = desktopMode === 'desktop-native-bridge'
|
|
1645
1647
|
? !selected && oauthAvailable && !codexLbKeyInSharedAuth
|
|
@@ -1682,9 +1684,23 @@ export async function codexLbStatus(opts = {}) {
|
|
|
1682
1684
|
allowUnverified: opts.allowUnverifiedToolOutputRecovery === true
|
|
1683
1685
|
|| codexLbToolOutputRecoveryOverrideAcknowledged({ env: opts.env || process.env })
|
|
1684
1686
|
});
|
|
1687
|
+
const secretResolution = {
|
|
1688
|
+
source: envLoad.source,
|
|
1689
|
+
path: envLoad.source === 'env-file' ? envLoad.env_paths[0] || envPath : null,
|
|
1690
|
+
prompt_risk: 'none'
|
|
1691
|
+
};
|
|
1685
1692
|
return {
|
|
1686
1693
|
ok: providerReady && (!selected || !probeToolOutputRecovery || toolOutputRecovery.ok),
|
|
1687
1694
|
blockers,
|
|
1695
|
+
warnings: definedButNotSelected ? ['codex_lb_defined_but_not_selected'] : [],
|
|
1696
|
+
orphan_managed_markers: orphanManagedMarkerCleanup.orphan_markers,
|
|
1697
|
+
managed_marker_cleanup_required: orphanManagedMarkerCleanup.changed,
|
|
1698
|
+
activation_guidance: definedButNotSelected
|
|
1699
|
+
? [
|
|
1700
|
+
'Run `sks codex-lb use-cli` to select the CLI provider.',
|
|
1701
|
+
'Run `sks codex-lb use-desktop-full` to activate managed Desktop bridge mode.'
|
|
1702
|
+
]
|
|
1703
|
+
: [],
|
|
1688
1704
|
provider_ready: providerReady,
|
|
1689
1705
|
config_path: configPath,
|
|
1690
1706
|
env_path: envPath,
|
|
@@ -1717,10 +1733,13 @@ export async function codexLbStatus(opts = {}) {
|
|
|
1717
1733
|
source: envLoad.source,
|
|
1718
1734
|
source_priority: envLoad.source_priority,
|
|
1719
1735
|
api_key: envLoad.api_key,
|
|
1736
|
+
blockers: envLoad.blockers,
|
|
1737
|
+
guidance: envLoad.guidance,
|
|
1720
1738
|
credential_binding: envLoad.credential_binding,
|
|
1721
1739
|
keychain: envLoad.keychain,
|
|
1722
1740
|
env_paths: envLoad.env_paths
|
|
1723
1741
|
},
|
|
1742
|
+
secret_resolution: secretResolution,
|
|
1724
1743
|
base_url: baseUrl,
|
|
1725
1744
|
auth_path: authPath,
|
|
1726
1745
|
auth_mode: authMode.mode,
|
|
@@ -1746,6 +1765,19 @@ export async function codexLbStatus(opts = {}) {
|
|
|
1746
1765
|
export function formatCodexLbStatusText(status = {}, opts = {}) {
|
|
1747
1766
|
const backupPresent = Boolean(opts.backupPresent);
|
|
1748
1767
|
const backupPath = opts.backupPath || '';
|
|
1768
|
+
const resolution = status.secret_resolution || {};
|
|
1769
|
+
const resolutionSource = String(resolution.source || status.env_loader?.source || 'missing');
|
|
1770
|
+
const resolutionPath = resolution.path
|
|
1771
|
+
|| (resolutionSource === 'env-file' ? status.env_loader?.env_paths?.[0] || status.env_path : null);
|
|
1772
|
+
const displayResolutionPath = resolutionPath
|
|
1773
|
+
? formatCodexLbStatusPath(String(resolutionPath), opts.home || os.homedir())
|
|
1774
|
+
: '';
|
|
1775
|
+
const resolutionLabel = displayResolutionPath
|
|
1776
|
+
? `${resolutionSource} (${displayResolutionPath})`
|
|
1777
|
+
: resolutionSource;
|
|
1778
|
+
const keychainUsage = resolutionSource === 'keychain' ? 'used' : 'not used';
|
|
1779
|
+
const promptRisk = String(resolution.prompt_risk
|
|
1780
|
+
|| (resolutionSource === 'keychain' ? 'possible' : 'none'));
|
|
1749
1781
|
const lines = [
|
|
1750
1782
|
'SKS codex-lb',
|
|
1751
1783
|
'',
|
|
@@ -1755,7 +1787,8 @@ export function formatCodexLbStatusText(status = {}, opts = {}) {
|
|
|
1755
1787
|
`Provider OpenAI Auth: ${status.provider_requires_openai_auth ? 'required' : 'not required/drifted'} (${status.provider_name || 'missing'})`,
|
|
1756
1788
|
`Codex App auth: ${status.auth_usable_for_codex_app ? 'ok' : 'needs sign-in/repair'} (${status.auth_mode || 'unknown'})`,
|
|
1757
1789
|
`Shared OpenAI routing: ${status.shared_openai_routing?.safe === false ? 'unsafe' : status.shared_openai_routing?.status || 'unknown'}${status.shared_openai_routing?.managed ? ' (sks-managed)' : ''}`,
|
|
1758
|
-
`Auth/routing coherent: ${status.auth_routing_coherent ? 'yes' : 'no'}
|
|
1790
|
+
`Auth/routing coherent: ${status.auth_routing_coherent ? 'yes' : 'no'}`,
|
|
1791
|
+
`Key source: ${resolutionLabel} · keychain: ${keychainUsage} · prompt risk: ${promptRisk}`
|
|
1759
1792
|
];
|
|
1760
1793
|
if (status.tool_output_recovery?.status && status.tool_output_recovery.status !== 'not_selected') {
|
|
1761
1794
|
const recovery = status.tool_output_recovery;
|
|
@@ -1777,13 +1810,18 @@ export function formatCodexLbStatusText(status = {}, opts = {}) {
|
|
|
1777
1810
|
if (status.base_url)
|
|
1778
1811
|
lines.push(`Base URL: ${status.base_url}`);
|
|
1779
1812
|
lines.push(`ChatGPT backup: ${backupPresent ? `yes (${backupPath})` : 'no'}`);
|
|
1813
|
+
if ((status.warnings || []).includes('codex_lb_defined_but_not_selected')) {
|
|
1814
|
+
lines.push('', 'Warning [codex_lb_defined_but_not_selected]: the codex-lb provider is defined but not selected.');
|
|
1815
|
+
for (const action of status.activation_guidance || [])
|
|
1816
|
+
lines.push(` ${action}`);
|
|
1817
|
+
}
|
|
1780
1818
|
if (status.legacy_migration_required || status.shared_openai_routing?.safe === false)
|
|
1781
1819
|
lines.push('', 'Run: sks codex-lb migrate-legacy-desktop --restart-app. Ordinary repair will not rewrite shared Codex auth.');
|
|
1782
1820
|
else if (status.provider_configured && !status.provider_contract_ok)
|
|
1783
1821
|
lines.push('', 'Run: sks codex-lb repair to rewrite the provider block to the current codex-lb App contract.');
|
|
1784
1822
|
else if (status.desktop_mode === 'desktop-native-bridge' && !status.auth_usable_for_codex_app)
|
|
1785
1823
|
lines.push('', 'Sign in with ChatGPT OAuth, then run: sks codex-lb use-desktop-full.');
|
|
1786
|
-
else if (status.ok && status.desktop_mode === 'cli-provider' && !status.selected)
|
|
1824
|
+
else if (status.ok && status.desktop_mode === 'cli-provider' && !status.selected && !(status.warnings || []).includes('codex_lb_defined_but_not_selected'))
|
|
1787
1825
|
lines.push('', 'CLI provider is stored but unselected. Run `sks codex-lb use-cli` for CLI use or `sks codex-lb use-desktop-full` for managed Desktop routing.');
|
|
1788
1826
|
else if (status.desktop_mode === 'desktop-dual-auth-compat')
|
|
1789
1827
|
lines.push('', 'The retired compatibility route is blocked. Run `sks codex-lb use-desktop-full` or `sks codex-lb disable`.');
|
|
@@ -1791,12 +1829,22 @@ export function formatCodexLbStatusText(status = {}, opts = {}) {
|
|
|
1791
1829
|
lines.push('', 'Status: configured; no ordinary repair needed.');
|
|
1792
1830
|
else if (!status.ok && status.base_url && status.env_key_configured)
|
|
1793
1831
|
lines.push('', 'Run: sks codex-lb repair. To change routing explicitly, use `use-desktop-full`, `use-cli`, or `disable`.');
|
|
1832
|
+
else if (!status.ok && !status.env_key_configured)
|
|
1833
|
+
lines.push('', 'Gateway key missing. Store CODEX_LB_API_KEY in ~/.codex/sks-codex-lb.env, run `sks codex-lb setup --host <domain> --api-key-stdin --yes`, or provide CODEX_LB_API_KEY in the environment.');
|
|
1794
1834
|
else if (!status.ok)
|
|
1795
1835
|
lines.push('', 'Run: sks codex-lb setup --host <domain> --api-key-stdin');
|
|
1796
1836
|
if (backupPresent)
|
|
1797
1837
|
lines.push('Legacy OAuth backup detected; use `sks codex-lb migrate-legacy-desktop --restart-app` instead of background auth switching.');
|
|
1798
1838
|
return `${lines.join('\n')}\n`;
|
|
1799
1839
|
}
|
|
1840
|
+
function formatCodexLbStatusPath(file, home) {
|
|
1841
|
+
const resolvedFile = path.resolve(file);
|
|
1842
|
+
const resolvedHome = path.resolve(String(home || ''));
|
|
1843
|
+
const relative = path.relative(resolvedHome, resolvedFile);
|
|
1844
|
+
return relative && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative)
|
|
1845
|
+
? `~/${relative.split(path.sep).join('/')}`
|
|
1846
|
+
: file;
|
|
1847
|
+
}
|
|
1800
1848
|
export function formatCodexLbRepairResultText(result = {}) {
|
|
1801
1849
|
const lines = [
|
|
1802
1850
|
'codex-lb credential/provider configuration repaired without changing Codex shared auth.',
|
|
@@ -1839,11 +1887,15 @@ function codexLbProviderOpenAiAuthDisabled(text = '') {
|
|
|
1839
1887
|
}
|
|
1840
1888
|
function codexLbProviderEnvKey(text = '') {
|
|
1841
1889
|
const block = String(text || '').match(/(^|\n)\[model_providers\.codex-lb\]([\s\S]*?)(?=\n\[[^\]]+\]|\s*$)/)?.[2] || '';
|
|
1842
|
-
return block.match(/(^|\n)\s*env_key\s*=\s*"([^"]+)"/)?.[2]
|
|
1890
|
+
return block.match(/(^|\n)\s*env_key\s*=\s*"([^"]+)"/)?.[2]
|
|
1891
|
+
|| block.match(/env_http_headers\s*=\s*\{[^}]*"X-Codex-LB-API-Key"\s*=\s*"([^"]+)"[^}]*\}/)?.[1]
|
|
1892
|
+
|| '';
|
|
1843
1893
|
}
|
|
1844
1894
|
function codexLbProviderHasSeparateGatewayAuth(text = '') {
|
|
1845
1895
|
const block = String(text || '').match(/(^|\n)\[model_providers\.codex-lb\]([\s\S]*?)(?=\n\[[^\]]+\]|\s*$)/)?.[2] || '';
|
|
1846
|
-
return /X-Codex-LB-API-Key/.test(block)
|
|
1896
|
+
return /X-Codex-LB-API-Key/.test(block)
|
|
1897
|
+
&& /CODEX_LB_API_KEY/.test(block)
|
|
1898
|
+
&& !/(^|\n)\s*env_key\s*=/.test(block);
|
|
1847
1899
|
}
|
|
1848
1900
|
function codexLbFastModeConfigStatus(text = '') {
|
|
1849
1901
|
const globalServiceTier = topLevelTomlString(text, 'service_tier');
|
|
@@ -2827,7 +2879,7 @@ async function inspectCodexLbMacLaunchEnvironment(baseUrl = '', opts = {}) {
|
|
|
2827
2879
|
: []
|
|
2828
2880
|
};
|
|
2829
2881
|
}
|
|
2830
|
-
export { checkContext7, ensureCodexCliTool,
|
|
2882
|
+
export { checkContext7, ensureCodexCliTool, ensureRelatedCliTools, maybePromptCodexUpdateForLaunch, maybePromptSksUpdateForLaunch, shouldAutoApproveInstall } from './install-tool-helpers.js';
|
|
2831
2883
|
export { codexFastModeDesktopStatus, ensureGlobalCodexFastModeDuringInstall, normalizeCodexFastModeUiConfig, safeWriteCodexConfigToml } from '../core/codex-runtime/codex-desktop-config-policy.js';
|
|
2832
2884
|
export { checkRequiredSkills, context7GlobalMcpStatus, ensureCodexImagegenDuringInstall, ensureGlobalCodexSkillsDuringInstall, ensureProjectContext7Config, ensureSksCommandDuringInstall, globalCodexSkillsRoot, selftestSksShimRepair } from './install-helpers-install-support.js';
|
|
2833
2885
|
export { askPostinstallQuestion, codexLbConfigPath, codexLbEnvPath, normalizeCodexLbBaseUrl } from './install-helpers-codex-lb-shared.js';
|
|
@@ -7,56 +7,10 @@ import { exists, globalSksRoot, PACKAGE_VERSION, runProcess, which } from '../co
|
|
|
7
7
|
import { hasContext7ConfigText } from '../core/routes.js';
|
|
8
8
|
import { createRequestedScopeContract } from '../core/safety/requested-scope-contract.js';
|
|
9
9
|
import { guardedPackageInstall, guardContextForRoute } from '../core/safety/mutation-guard.js';
|
|
10
|
-
import { checkZellijCapability } from '../core/zellij/zellij-capability.js';
|
|
11
10
|
export async function ensureRelatedCliTools(args = []) {
|
|
12
11
|
const skip = args.includes('--skip-cli-tools') || process.env.SKS_SKIP_CLI_TOOLS === '1';
|
|
13
12
|
const codex = await ensureCodexCliTool({ skip, args });
|
|
14
|
-
|
|
15
|
-
const zellij = await checkZellijCapability({ require: false, writeReport: false });
|
|
16
|
-
return {
|
|
17
|
-
codex,
|
|
18
|
-
zellij: {
|
|
19
|
-
ok: zellij.status === 'ok',
|
|
20
|
-
bin: zellij.bin,
|
|
21
|
-
version: zellij.version,
|
|
22
|
-
min_version: zellij.min_version,
|
|
23
|
-
current_session: false,
|
|
24
|
-
repair: zellijRepair,
|
|
25
|
-
install_hint: zellij.status === 'ok' ? null : zellijInstallHint(),
|
|
26
|
-
error: zellijRepair.error || zellij.blockers[0] || zellij.warnings[0] || null
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export async function ensureMadLaunchDependencies(args = []) {
|
|
31
|
-
const skip = args.includes('--skip-cli-tools') || process.env.SKS_SKIP_CLI_TOOLS === '1';
|
|
32
|
-
const zellijRepair = skip ? { target: 'zellij', status: 'skipped', reason: 'SKS_SKIP_CLI_TOOLS=1 or --skip-cli-tools' } : await ensureZellijCliTool(args);
|
|
33
|
-
const zellij = await checkZellijCapability({ require: false, writeReport: false });
|
|
34
|
-
const ready = zellij.status === 'ok';
|
|
35
|
-
return {
|
|
36
|
-
ready,
|
|
37
|
-
actions: ready ? [] : [{
|
|
38
|
-
target: 'zellij',
|
|
39
|
-
status: zellijRepair.status,
|
|
40
|
-
command: zellijRepair.command || zellijInstallHint(),
|
|
41
|
-
error: zellijRepair.error || zellij.blockers[0] || zellij.warnings[0] || null,
|
|
42
|
-
repair: zellijRepair
|
|
43
|
-
}],
|
|
44
|
-
status: {
|
|
45
|
-
zellij: {
|
|
46
|
-
ok: ready,
|
|
47
|
-
status: zellij.status,
|
|
48
|
-
version: zellij.version,
|
|
49
|
-
min_version: zellij.min_version,
|
|
50
|
-
repair: zellijRepair,
|
|
51
|
-
install_hint: ready ? null : zellijInstallHint()
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export function formatMadLaunchDependencyAction(action = {}) {
|
|
57
|
-
const command = action.command ? ` Run: ${action.command}.` : '';
|
|
58
|
-
const error = action.error ? ` ${action.error}` : '';
|
|
59
|
-
return `${action.target || 'dependency'} ${action.status || 'blocked'}.${command}${error}`.trim();
|
|
13
|
+
return { codex };
|
|
60
14
|
}
|
|
61
15
|
export async function ensureCodexCliTool({ skip = false, args = [] } = {}) {
|
|
62
16
|
if (skip)
|
|
@@ -88,37 +42,6 @@ export async function ensureCodexCliTool({ skip = false, args = [] } = {}) {
|
|
|
88
42
|
hint: after.bin ? null : 'npm completed, but codex is not on PATH. Restart the shell or set SKS_CODEX_BIN.'
|
|
89
43
|
};
|
|
90
44
|
}
|
|
91
|
-
export async function ensureZellijCliTool(args = [], opts = {}) {
|
|
92
|
-
const before = await checkZellijCapability({ require: false, writeReport: false });
|
|
93
|
-
if (before.status === 'ok')
|
|
94
|
-
return { target: 'zellij', status: 'present', bin: before.bin, version: before.version || null };
|
|
95
|
-
const command = zellijInstallHint();
|
|
96
|
-
if (process.platform !== 'darwin')
|
|
97
|
-
return { target: 'zellij', status: 'manual_required', command, error: before.blockers[0] || before.warnings[0] || 'zellij not found' };
|
|
98
|
-
const brew = await which('brew').catch(() => null);
|
|
99
|
-
if (!brew)
|
|
100
|
-
return { target: 'zellij', status: 'manual_required', command: 'Install Homebrew, then run: brew install zellij', error: before.blockers[0] || before.warnings[0] || 'zellij not found' };
|
|
101
|
-
if (args.includes('--dry-run') || opts.dryRun)
|
|
102
|
-
return { target: 'zellij', status: 'dry_run', command, error: before.blockers[0] || before.warnings[0] || null };
|
|
103
|
-
const hasInstalledZellij = Boolean(before.version);
|
|
104
|
-
const question = hasInstalledZellij
|
|
105
|
-
? `Homebrew Zellij ${before.version || 'unknown'} is not ready. Upgrade to latest Zellij with ${command}?`
|
|
106
|
-
: `Zellij is missing. Install latest Zellij with ${command}?`;
|
|
107
|
-
if (!await confirmInstallYesDefault(question, args))
|
|
108
|
-
return { target: 'zellij', status: 'needs_approval', command, error: before.blockers[0] || before.warnings[0] || null };
|
|
109
|
-
const brewArgs = hasInstalledZellij ? ['upgrade', 'zellij'] : ['install', 'zellij'];
|
|
110
|
-
const zellijRoot = globalSksRoot();
|
|
111
|
-
const zellijContract = createRequestedScopeContract({
|
|
112
|
-
route: 'install', userRequest: command, projectRoot: zellijRoot, overrides: { package_install: true, zellij_install: true }
|
|
113
|
-
});
|
|
114
|
-
const install = await guardedPackageInstall(guardContextForRoute(zellijRoot, zellijContract, command), 'zellij', { confirmed: true, command: brew, args: brewArgs, timeoutMs: 180000 }).catch((err) => ({ code: 1, stdout: '', stderr: err.message }));
|
|
115
|
-
if (install.code !== 0)
|
|
116
|
-
return { target: 'zellij', status: 'failed', command, error: `${install.stderr || install.stdout || command + ' failed'}`.trim() };
|
|
117
|
-
const after = await checkZellijCapability({ require: false, writeReport: false });
|
|
118
|
-
if (after.status !== 'ok')
|
|
119
|
-
return { target: 'zellij', status: 'installed_not_ready', command, error: after.blockers[0] || after.warnings[0] || 'zellij installed but not ready' };
|
|
120
|
-
return { target: 'zellij', status: hasInstalledZellij ? 'upgraded' : 'installed', command, bin: after.bin, version: after.version || null };
|
|
121
|
-
}
|
|
122
45
|
export async function maybePromptCodexUpdateForLaunch(args = [], opts = {}) {
|
|
123
46
|
if (hasFlag(args, '--json') || hasFlag(args, '--skip-cli-tools') || hasFlag(args, '--skip-codex-update') || process.env.SKS_SKIP_CODEX_UPDATE === '1')
|
|
124
47
|
return { status: 'skipped' };
|
|
@@ -126,7 +49,7 @@ export async function maybePromptCodexUpdateForLaunch(args = [], opts = {}) {
|
|
|
126
49
|
const codex = await getCodexInfo().catch(() => EMPTY_CODEX_INFO);
|
|
127
50
|
const current = codexCliVersionNumber(codex.version);
|
|
128
51
|
const command = 'npm i -g @openai/codex@latest';
|
|
129
|
-
const label = opts.label || '
|
|
52
|
+
const label = opts.label || 'Codex launch';
|
|
130
53
|
const missing = !codex.bin;
|
|
131
54
|
const updateAvailable = Boolean(latest.version && current && compareVersions(latest.version, current) > 0);
|
|
132
55
|
if (!missing && !updateAvailable)
|
|
@@ -215,9 +138,6 @@ export async function checkContext7(root) {
|
|
|
215
138
|
result.ok = result.project.ok || result.codex_mcp_list.ok || (result.global.ok && !list.checked);
|
|
216
139
|
return result;
|
|
217
140
|
}
|
|
218
|
-
function zellijInstallHint() {
|
|
219
|
-
return process.platform === 'darwin' ? 'brew install zellij' : 'Install Zellij from https://zellij.dev/documentation/installation.html';
|
|
220
|
-
}
|
|
221
141
|
async function confirmInstallYesDefault(question, args = []) {
|
|
222
142
|
if (hasFlag(args, '--from-postinstall') && process.env.SKS_POSTINSTALL_AUTO_INSTALL_CLI_TOOLS !== '1')
|
|
223
143
|
return false;
|
package/dist/cli/output.js
CHANGED
|
@@ -2,6 +2,11 @@ import { PACKAGE_VERSION } from '../core/version.js';
|
|
|
2
2
|
export function sksTextLogo() {
|
|
3
3
|
return `SKS\nSNEAKOSCOPE CODEX v${PACKAGE_VERSION}`;
|
|
4
4
|
}
|
|
5
|
-
export function printJson(value) {
|
|
5
|
+
export function printJson(value, options = {}) {
|
|
6
|
+
if (options.failureExitCode !== false && value && typeof value === 'object' && value.ok === false) {
|
|
7
|
+
const current = Number(process.exitCode || 0);
|
|
8
|
+
if (!Number.isFinite(current) || current === 0)
|
|
9
|
+
process.exitCode = 1;
|
|
10
|
+
}
|
|
6
11
|
console.log(JSON.stringify(value, null, 2));
|
|
7
12
|
}
|
package/dist/cli/router.js
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
1
3
|
import { COMMAND_ALIASES_LITE, COMMAND_MANIFEST_BY_NAME, COMMAND_NAME_SET, } from './command-manifest-lite.js';
|
|
2
4
|
import { ui as cliUi } from './cli-theme.js';
|
|
3
5
|
import { helpResult, isHelpRequest, renderManifestHelp } from './help.js';
|
|
4
6
|
import { findRetiredGlobalExecutionArgumentErrors } from './global-mode-router.js';
|
|
7
|
+
import { normalizeIntentCommand, } from '../core/commands/intent-normalization/normalizer.js';
|
|
8
|
+
const routerIntentStorage = new AsyncLocalStorage();
|
|
9
|
+
export function currentRouterIntentContract() {
|
|
10
|
+
return routerIntentStorage.getStore() || null;
|
|
11
|
+
}
|
|
12
|
+
export function prepareRouterExecutionIntent(argv, inheritance = {}) {
|
|
13
|
+
const effectiveArgv = argv.length ? [...argv] : ['doctor'];
|
|
14
|
+
const rawCommand = effectiveArgv[0]?.startsWith('$')
|
|
15
|
+
? effectiveArgv.join(' ')
|
|
16
|
+
: `sks ${effectiveArgv.join(' ')}`;
|
|
17
|
+
const parent = inheritance.parentContract;
|
|
18
|
+
if (parent) {
|
|
19
|
+
const normalized = normalizeIntentCommand({
|
|
20
|
+
rawCommand,
|
|
21
|
+
naturalLanguageEffect: parent.natural_language_effect,
|
|
22
|
+
effect: parent.effect,
|
|
23
|
+
observedChangedPaths: parent.observed_changed_paths,
|
|
24
|
+
targetHashes: parent.target_hashes,
|
|
25
|
+
policyVersion: parent.policy_version,
|
|
26
|
+
modeSnapshot: parent.mode_snapshot,
|
|
27
|
+
evidenceState: parent.evidence_state,
|
|
28
|
+
retryBudget: parent.retry_budget,
|
|
29
|
+
requestedRisk: parent.risk,
|
|
30
|
+
explicitUltraOptIn: parent.risk === 'ULTRA',
|
|
31
|
+
force: parent.force,
|
|
32
|
+
});
|
|
33
|
+
if (normalized.contract.contract_hash !== parent.contract_hash) {
|
|
34
|
+
throw new Error('router_parent_intent_contract_mismatch');
|
|
35
|
+
}
|
|
36
|
+
return Object.freeze({ ...normalized, contract: parent });
|
|
37
|
+
}
|
|
38
|
+
const preflight = normalizeIntentCommand({
|
|
39
|
+
rawCommand,
|
|
40
|
+
naturalLanguageEffect: inheritance.naturalLanguageEffect || `Execute ${effectiveArgv[0] || 'doctor'}`,
|
|
41
|
+
effect: inheritance.effect || classifyCliIntentEffect(effectiveArgv),
|
|
42
|
+
targetHashes: [createHash('sha256').update(`${process.cwd()}\0${effectiveArgv[0] || 'doctor'}`).digest('hex')],
|
|
43
|
+
policyVersion: 'sks-cli-router-v1',
|
|
44
|
+
modeSnapshot: inheritance.modeSnapshot || providerModeFromEnvironment(),
|
|
45
|
+
evidenceState: inheritance.evidenceState || 'missing',
|
|
46
|
+
retryBudget: inheritance.retryBudget ?? 0,
|
|
47
|
+
force: effectiveArgv.includes('--force'),
|
|
48
|
+
});
|
|
49
|
+
return preflight;
|
|
50
|
+
}
|
|
5
51
|
export function isCommandName(value) {
|
|
6
52
|
return COMMAND_NAME_SET.has(value);
|
|
7
53
|
}
|
|
@@ -22,7 +68,28 @@ export function normalizeCommand(args = []) {
|
|
|
22
68
|
export async function dispatch(args) {
|
|
23
69
|
const argv = args ?? process.argv.slice(2);
|
|
24
70
|
try {
|
|
25
|
-
|
|
71
|
+
let intent = null;
|
|
72
|
+
try {
|
|
73
|
+
intent = prepareRouterExecutionIntent(argv);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const code = error instanceof Error ? error.message : String(error);
|
|
77
|
+
if (code === 'intent_legacy_option_unsupported') {
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
const result = { ok: false, status: 'blocked', reason: code, command: argv[0] || 'doctor' };
|
|
80
|
+
if (argv.includes('--json'))
|
|
81
|
+
console.log(JSON.stringify(result, null, 2));
|
|
82
|
+
else
|
|
83
|
+
console.error(code);
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
if (!['intent_cli_command_unknown', 'intent_dollar_command_unknown', 'intent_dollar_command_unmapped'].includes(code)) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return intent
|
|
91
|
+
? await routerIntentStorage.run(intent.contract, () => dispatchInner(argv))
|
|
92
|
+
: await dispatchInner(argv);
|
|
26
93
|
}
|
|
27
94
|
catch (err) {
|
|
28
95
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -37,6 +104,32 @@ export async function dispatch(args) {
|
|
|
37
104
|
return result;
|
|
38
105
|
}
|
|
39
106
|
}
|
|
107
|
+
function providerModeFromEnvironment() {
|
|
108
|
+
const mode = String(process.env.SKS_PROVIDER_MODE || '').trim();
|
|
109
|
+
return mode === 'codex-lb' || mode === 'openrouter' || mode === 'chatgpt-oauth'
|
|
110
|
+
? mode
|
|
111
|
+
: 'chatgpt-oauth';
|
|
112
|
+
}
|
|
113
|
+
function classifyCliIntentEffect(argv) {
|
|
114
|
+
const normalized = normalizeCommand(argv);
|
|
115
|
+
const command = normalized.command;
|
|
116
|
+
const entry = command ? COMMAND_MANIFEST_BY_NAME[command] : null;
|
|
117
|
+
const tokens = argv.map((value) => String(value).toLowerCase());
|
|
118
|
+
const action = tokens.slice(1).find((value) => !value.startsWith('-')) || '';
|
|
119
|
+
if (entry?.readonly === true || safeReadOnlySubcommand(command, normalized.args))
|
|
120
|
+
return 'read';
|
|
121
|
+
if (/^(?:delete|remove|uninstall|purge|cleanup)$/.test(action))
|
|
122
|
+
return 'delete';
|
|
123
|
+
if (/^(?:deploy|publish|release|push)$/.test(action))
|
|
124
|
+
return 'deploy';
|
|
125
|
+
if (/^(?:login|logout|signin|sign-in|auth|setup|reconnect)$/.test(action))
|
|
126
|
+
return 'auth';
|
|
127
|
+
if (/^(?:install|update|upgrade|add-dependency)$/.test(action))
|
|
128
|
+
return 'dependency';
|
|
129
|
+
if (/^(?:security|permissions|sign|verify-signature|rotate)$/.test(action))
|
|
130
|
+
return 'security';
|
|
131
|
+
return 'write';
|
|
132
|
+
}
|
|
40
133
|
async function dispatchInner(argv) {
|
|
41
134
|
const retiredGlm = findRetiredGlobalExecutionArgumentErrors(argv).filter((item) => item.includes('--glm'));
|
|
42
135
|
if (retiredGlm.length && argv.some((arg) => arg === '--glm' || String(arg).startsWith('--glm='))) {
|
|
@@ -133,7 +226,13 @@ async function dispatchInner(argv) {
|
|
|
133
226
|
}
|
|
134
227
|
if (typeof mod.run !== 'function')
|
|
135
228
|
throw new Error(`Command ${command} must export run(command, args)`);
|
|
136
|
-
|
|
229
|
+
const result = await mod.run(rawCommand || command, rest);
|
|
230
|
+
if (argv.includes('--json') && result && typeof result === 'object' && result.ok === false) {
|
|
231
|
+
const current = Number(process.exitCode || 0);
|
|
232
|
+
if (!Number.isFinite(current) || current === 0)
|
|
233
|
+
process.exitCode = 1;
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
137
236
|
}
|
|
138
237
|
async function ensureActiveRouteCommandGate(command, args) {
|
|
139
238
|
const entry = COMMAND_MANIFEST_BY_NAME[command];
|