sneakoscope 7.0.2 → 7.0.5
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 +9 -7
- package/config/codex-releases/{rust-v0.144.5.json → rust-v0.145.0.json} +14 -8
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/sks-dispatch.js +0 -3
- package/dist/cli/command-manifest-lite.js +1 -2
- package/dist/cli/command-registry.js +0 -4
- package/dist/cli/global-mode-router.js +5 -12
- package/dist/cli/install-helpers-codex-lb-chain.js +24 -2
- package/dist/cli/install-helpers-codex-lb-config.js +10 -25
- package/dist/cli/install-helpers-codex-lb-selftest-chain.js +0 -3
- package/dist/cli/install-helpers-codex-lb-selftest.js +0 -17
- package/dist/cli/install-helpers-install-support.js +1 -2
- package/dist/cli/install-helpers.js +83 -99
- package/dist/cli/router.js +22 -31
- package/dist/commands/codex-app.js +20 -2
- package/dist/commands/codex-lb.js +176 -22
- package/dist/commands/codex.js +3 -8
- package/dist/commands/conflicts.js +26 -3
- package/dist/commands/doctor.js +26 -31
- package/dist/commands/perf.js +5 -1
- package/dist/commands/zellij-slot-column-anchor.js +0 -2
- package/dist/commands/zellij-slot-pane.js +0 -7
- package/dist/commands/zellij.js +0 -2
- package/dist/config/skills-manifest.json +52 -52
- package/dist/core/agent-bridge/agent-manifest.js +192 -1
- package/dist/core/agent-bridge/agent-mode.js +0 -5
- package/dist/core/agent-bridge/host-capability-policy.js +189 -0
- package/dist/core/agent-bridge/host-capability-runtime.js +1395 -0
- package/dist/core/agent-bridge/mcp-server.js +1 -11
- package/dist/core/agents/agent-effort-policy.js +7 -10
- package/dist/core/agents/agent-orchestrator.js +0 -4
- package/dist/core/agents/agent-proof-evidence.js +0 -2
- package/dist/core/agents/agent-roster.js +6 -5
- package/dist/core/agents/agent-runner-ollama.js +0 -3
- package/dist/core/agents/agent-scheduler.js +7 -10
- package/dist/core/agents/agent-schema.js +3 -1
- package/dist/core/agents/agent-task-graph.js +4 -1
- package/dist/core/agents/agent-work-partition.js +4 -2
- package/dist/core/agents/native-cli-worker-runtime.js +5 -17
- package/dist/core/agents/work-partition/repo-inventory.js +0 -2
- package/dist/core/auto-review.js +8 -14
- package/dist/core/bench.js +0 -14
- package/dist/core/code-structure.js +0 -3
- package/dist/core/codex/agent-config-file-repair.js +0 -8
- package/dist/core/codex/codex-cli-update.js +122 -20
- package/dist/core/codex/codex-config-eperm-repair.js +0 -4
- package/dist/core/codex/codex-config-guard.js +0 -3
- package/dist/core/codex/codex-config-readability.js +0 -13
- package/dist/core/codex/codex-project-config-policy.js +0 -33
- package/dist/core/codex/codex-startup-config-postcheck.js +5 -0
- package/dist/core/codex/official-goal-mode.js +0 -2
- package/dist/core/codex-app/codex-agent-type-probe.js +31 -24
- package/dist/core/codex-app/codex-app-fast-ui-repair.js +5 -7
- package/dist/core/codex-app/codex-app-ui-state-snapshot.js +44 -7
- package/dist/core/codex-app/glm-model-profile.js +1 -1
- package/dist/core/codex-app/glm-profile-installer.js +40 -41
- package/dist/core/codex-app/glm-profile-schema.js +7 -11
- package/dist/core/codex-app/menubar/constants.js +1 -0
- package/dist/core/codex-app/menubar/launch-agent.js +37 -1
- package/dist/core/codex-app/openrouter-activate.js +152 -0
- package/dist/core/codex-app/openrouter-provider.js +82 -0
- package/dist/core/codex-app/sks-menubar.js +0 -1
- package/dist/core/codex-app.js +14 -32
- package/dist/core/codex-compat/codex-capability-matrix.js +208 -0
- package/dist/core/codex-compat/codex-hook-output-builders.js +9 -1
- package/dist/core/codex-compat/codex-hook-output-normalizer.js +1 -1
- package/dist/core/codex-compat/codex-hook-semantic-validator.js +3 -2
- package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -2
- package/dist/core/codex-compat/codex-release-manifest.js +15 -8
- package/dist/core/codex-compat/codex-version-policy.js +77 -15
- package/dist/core/codex-control/codex-0144-capability.js +1 -1
- package/dist/core/codex-control/codex-lb-launch-recovery.js +0 -3
- package/dist/core/codex-control/codex-reliability-shield.js +0 -8
- package/dist/core/codex-control/codex-sdk-adapter.js +0 -3
- package/dist/core/codex-control/codex-sdk-config-policy.js +0 -2
- package/dist/core/codex-control/codex-sdk-env-policy.js +61 -16
- package/dist/core/codex-control/codex-task-runner.js +0 -7
- package/dist/core/codex-control/codex-thread-registry.js +0 -4
- package/dist/core/codex-lb/codex-lb-env.js +133 -24
- package/dist/core/codex-lb/codex-lb-tool-catalog.js +0 -4
- package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +1 -1
- package/dist/core/codex-model-guard.js +0 -14
- package/dist/core/codex-native/codex-native-feature-broker.js +67 -22
- package/dist/core/codex-native/codex-native-interop-policy.js +81 -9
- package/dist/core/codex-native/confined-report-writer.js +21 -0
- package/dist/core/codex-native/core-skill-integrity.js +169 -20
- package/dist/core/codex-native/project-skill-dedupe.js +55 -13
- package/dist/core/codex-native/skill-registry-ledger.js +137 -16
- package/dist/core/codex-native/sks-skill-paths.js +185 -0
- package/dist/core/codex-runtime/codex-desktop-config-policy.js +3 -3
- package/dist/core/commands/agent-bridge-command.js +28 -8
- package/dist/core/commands/basic-cli.js +89 -42
- package/dist/core/commands/bench-command.js +5 -1
- package/dist/core/commands/command-utils.js +0 -5
- package/dist/core/commands/image-ux-review-command.js +0 -9
- package/dist/core/commands/mad-sks-command.js +55 -208
- package/dist/core/commands/naruto-command.js +55 -21
- package/dist/core/commands/ppt-command.js +0 -9
- package/dist/core/commands/run-command.js +8 -2
- package/dist/core/commands/seo-command.js +0 -6
- package/dist/core/commands/wiki-command.js +0 -14
- package/dist/core/computer-use-live-evidence.js +0 -5
- package/dist/core/config/secret-preservation.js +0 -11
- package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +0 -2
- package/dist/core/daemon/sksd-hook-daemon.js +1 -29
- package/dist/core/daemon/sksd-hook-dispatch.js +0 -17
- package/dist/core/db-safety.js +0 -7
- package/dist/core/doctor/browser-use-repair.js +0 -2
- package/dist/core/doctor/command-alias-cleanup.js +37 -9
- package/dist/core/doctor/current-project-guidance.js +6 -3
- package/dist/core/doctor/doctor-codex-startup-repair.js +0 -3
- package/dist/core/doctor/doctor-dirty-planner.js +1 -1
- package/dist/core/doctor/doctor-readiness-matrix.js +12 -0
- package/dist/core/doctor/doctor-skill-reconcile.js +32 -0
- package/dist/core/doctor/imagegen-repair.js +0 -2
- package/dist/core/doctor/mcp-transport-collision-repair.js +0 -3
- package/dist/core/doctor/retired-auto-review-config.js +9 -1
- package/dist/core/doctor/retired-managed-residue-private.js +5 -4
- package/dist/core/doctor/retired-managed-residue-runtime.js +9 -1
- package/dist/core/doctor/skill-legacy-surface.js +351 -0
- package/dist/core/doctor/supabase-mcp-repair.js +0 -11
- package/dist/core/evaluation.js +3 -0
- package/dist/core/feature-fixture-executor.js +0 -48
- package/dist/core/feature-fixtures.js +0 -6
- package/dist/core/fsx.js +11 -12
- package/dist/core/harness-conflicts.js +177 -18
- package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +0 -5
- package/dist/core/hooks-runtime/hook-context.js +202 -0
- package/dist/core/hooks-runtime/hook-io.js +1 -12
- package/dist/core/hooks-runtime/light-turn.js +0 -2
- package/dist/core/hooks-runtime/naruto-decision-gate.js +4 -1
- package/dist/core/hooks-runtime/naruto-terminal-finalization.js +91 -0
- package/dist/core/hooks-runtime/official-subagent-lifecycle.js +369 -0
- package/dist/core/hooks-runtime/standalone-parent-host-capability.js +98 -0
- package/dist/core/hooks-runtime/subagent-context.js +59 -0
- package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +29 -0
- package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +195 -0
- package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +316 -0
- package/dist/core/hooks-runtime/subagent-skill-availability.js +217 -0
- package/dist/core/hooks-runtime.js +275 -540
- package/dist/core/image-ux-review/codex-app-generated-image-discovery.js +0 -17
- package/dist/core/image-ux-review/imagegen-adapter.js +0 -14
- package/dist/core/imagegen/imagegen-auth-readiness.js +0 -9
- package/dist/core/imagegen/imagegen-capability.js +0 -3
- package/dist/core/init/managed-skill-install.js +42 -0
- package/dist/core/init/skills.js +248 -75
- package/dist/core/init.js +19 -45
- package/dist/core/lean-engineering-policy.js +0 -2
- package/dist/core/locks/file-lock.js +0 -21
- package/dist/core/loops/loop-planner.js +0 -6
- package/dist/core/loops/loop-runtime.js +0 -1
- package/dist/core/loops/loop-worker-runtime.js +0 -19
- package/dist/core/mad-sks/executors/db-write-executor.js +0 -4
- package/dist/core/mad-sks/executors/executor-base.js +0 -10
- package/dist/core/mad-sks/immutable-harness-guard.js +0 -5
- package/dist/core/mad-sks/sql-plane/coordinator.js +0 -5
- package/dist/core/mad-sks/sql-plane/ledger.js +0 -4
- package/dist/core/mad-sks/sql-plane/lock.js +0 -4
- package/dist/core/mad-sks/sql-plane/mcp-executor.js +0 -9
- package/dist/core/mad-sks/sql-plane/policy-resolver.js +0 -2
- package/dist/core/mad-sks/sql-plane/postconditions.js +0 -4
- package/dist/core/mad-sks/sql-plane/recovery.js +0 -2
- package/dist/core/mad-sks/sql-plane/runtime-profile.js +0 -8
- package/dist/core/managed-assets/managed-assets-manifest.js +1 -7
- package/dist/core/mcp-config/health-check.js +10 -3
- package/dist/core/migration/migration-transaction-journal.js +0 -8
- package/dist/core/mission.js +0 -2
- package/dist/core/naruto/naruto-active-pool.js +0 -2
- package/dist/core/naruto/naruto-concurrency-governor.js +18 -11
- package/dist/core/naruto/naruto-real-write-proof.js +0 -4
- package/dist/core/naruto/naruto-write-e2e.js +0 -1
- package/dist/core/perf/perf-budget.js +0 -5
- package/dist/core/permission-gates.js +0 -2
- package/dist/core/pipeline-internals/runtime-core.js +15 -5
- package/dist/core/pipeline-internals/runtime-gates.js +7 -19
- package/dist/core/preflight/parallel-preflight-engine.js +1 -12
- package/dist/core/proof/evidence-collector.js +0 -2
- package/dist/core/proof/route-finalizer.js +0 -1
- package/dist/core/proof/selftest-proof-fixtures.js +0 -5
- package/dist/core/providers/openrouter/openrouter-client.js +2 -2
- package/dist/core/providers/openrouter/openrouter-provider-health.js +1 -1
- package/dist/core/providers/{glm/glm-request-cache.js → openrouter/openrouter-request-cache.js} +5 -6
- package/dist/core/providers/openrouter/openrouter-secret-store.js +0 -1
- package/dist/core/providers/openrouter/openrouter-stream.js +2 -4
- package/dist/core/questions.js +3 -3
- package/dist/core/release/gate-manifest.js +0 -5
- package/dist/core/release/package-size-budget.js +2 -2
- package/dist/core/release/release-gate-batch-runner.js +11 -2
- package/dist/core/release/release-gate-cache-v2.js +0 -4
- package/dist/core/release/release-gate-contract.js +0 -7
- package/dist/core/release/release-gate-hermetic-env.js +0 -5
- package/dist/core/release/release-pack-receipt.js +1 -0
- package/dist/core/release-parallel-full-coverage.js +0 -2
- package/dist/core/remote/ssh-worker-client.js +0 -3
- package/dist/core/research/research-adversarial-review.js +6 -2
- package/dist/core/responses-retry-policy.js +0 -10
- package/dist/core/retention.js +0 -7
- package/dist/core/routes/constants.js +0 -3
- package/dist/core/routes/model-mode-router.js +10 -19
- package/dist/core/routes.js +91 -17
- package/dist/core/safety/command-contract/contracts.js +2 -0
- package/dist/core/safety/mutation-guard.js +0 -25
- package/dist/core/safety/mutation-ledger.js +0 -9
- package/dist/core/safety/requested-scope-contract.js +0 -0
- package/dist/core/security/high-risk-contracts.js +0 -1
- package/dist/core/skills/core-skill-card.js +0 -0
- package/dist/core/skills/core-skill-deployment.js +0 -13
- package/dist/core/skills/core-skill-epoch.js +0 -11
- package/dist/core/skills/core-skill-meta-update.js +0 -6
- package/dist/core/skills/core-skill-patch-apply.js +0 -7
- package/dist/core/skills/core-skill-patch.js +0 -8
- package/dist/core/skills/core-skill-reflection.js +0 -16
- package/dist/core/skills/core-skill-runtime.js +0 -6
- package/dist/core/skills/core-skill-scorer.js +0 -7
- package/dist/core/skills/core-skill-trainer.js +0 -11
- package/dist/core/skills/core-skill-types.js +0 -9
- package/dist/core/skills/core-skill-validation.js +0 -5
- package/dist/core/skills/rejected-skill-patch-buffer.js +0 -2
- package/dist/core/stop-gate/stop-gate-check.js +0 -8
- package/dist/core/stop-gate/stop-gate-resolver.js +0 -7
- package/dist/core/stop-gate/stop-gate-writer.js +0 -5
- package/dist/core/subagents/model-policy.js +0 -7
- package/dist/core/subagents/naruto-help-contract.js +3 -2
- package/dist/core/subagents/naruto-proof-projection.js +580 -12
- package/dist/core/subagents/official-subagent-config.js +256 -40
- package/dist/core/subagents/official-subagent-preparation.js +11 -7
- package/dist/core/subagents/official-subagent-prompt.js +29 -0
- package/dist/core/subagents/official-subagent-runner.js +379 -39
- package/dist/core/subagents/subagent-evidence.js +378 -9
- package/dist/core/subagents/terminology.js +11 -6
- package/dist/core/subagents/thread-budget.js +6 -3
- package/dist/core/subagents/triwiki-attention.js +0 -4
- package/dist/core/subagents/wave-parent-guidance.js +54 -9
- package/dist/core/telegram/runtime.js +0 -1
- package/dist/core/triwiki/code-index-scanner.js +0 -3
- package/dist/core/triwiki/code-pack-head-freshness.js +0 -10
- package/dist/core/triwiki/code-pack.js +0 -2
- package/dist/core/triwiki/triwiki-cache-key.js +0 -1
- package/dist/core/triwiki/triwiki-proof-bank.js +0 -1
- package/dist/core/triwiki-attention.js +0 -10
- package/dist/core/triwiki-provenance.js +0 -5
- package/dist/core/triwiki-runtime.js +0 -12
- package/dist/core/triwiki-wrongness/wrongness-ledger.js +0 -7
- package/dist/core/triwiki-wrongness/wrongness-schema.js +0 -3
- package/dist/core/trust-kernel/trust-report.js +0 -7
- package/dist/core/update/update-migration-state.js +113 -61
- package/dist/core/update-check.js +2 -14
- package/dist/core/version-manager.js +43 -4
- package/dist/core/version.js +1 -1
- package/dist/core/work-order-ledger.js +0 -17
- package/dist/core/zellij/zellij-clipboard-config.js +0 -18
- package/dist/core/zellij/zellij-fake-adapter.js +16 -0
- package/dist/core/zellij/zellij-lane-renderer.js +5 -46
- package/dist/core/zellij/zellij-lane-runtime.js +0 -1
- package/dist/core/zellij/zellij-launcher.js +35 -35
- package/dist/core/zellij/zellij-official-subagent-activity.js +0 -5
- package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -5
- package/dist/core/zellij/zellij-pane-proof.js +3 -3
- package/dist/core/zellij/zellij-screen-proof.js +0 -7
- package/dist/core/zellij/zellij-slot-column-anchor.js +0 -1
- package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -9
- package/dist/core/zellij/zellij-slot-telemetry.js +6 -16
- package/dist/core/zellij/zellij-ui-mode.js +0 -7
- package/dist/core/zellij/zellij-update.js +0 -29
- package/dist/core/zellij/zellij-worker-pane-manager.js +0 -39
- package/dist/native/sks-menubar/Sources/DiagnosticsViewController.swift +61 -2
- package/dist/native/sks-menubar/Sources/MCPServersViewController.swift +10 -3
- package/dist/native/sks-menubar/Sources/OverviewViewController.swift +55 -3
- package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +76 -0
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +273 -54
- package/dist/native/sks-menubar/Sources/RemoteTelegramViewController.swift +5 -1
- package/dist/native/sks-menubar/Sources/SettingsViewController.swift +2 -2
- package/dist/native/sks-menubar/Sources/StatusItemController.swift +28 -2
- package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +96 -13
- package/dist/scripts/agent-message-bus-reader-check.js +0 -1
- package/dist/scripts/all-feature-deep-completion-check.js +0 -1
- package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -1
- package/dist/scripts/architecture-guard-check.js +0 -1
- package/dist/scripts/build-dist.js +0 -1
- package/dist/scripts/build-once-runner-check.js +0 -1
- package/dist/scripts/canonical-test-runner.js +0 -2
- package/dist/scripts/certificate-sla-check.js +0 -1
- package/dist/scripts/changelog-check.js +0 -1
- package/dist/scripts/check-cli-entrypoint.js +0 -1
- package/dist/scripts/check-command-module-budget.js +0 -7
- package/dist/scripts/check-feature-quality.js +0 -1
- package/dist/scripts/check-legacy-free.js +0 -1
- package/dist/scripts/check-pipeline-runtime.js +0 -1
- package/dist/scripts/check-runtime-schemas.js +0 -1
- package/dist/scripts/codex-0-134-runner-truth-check.js +0 -1
- package/dist/scripts/codex-0-137-compat-check.js +0 -1
- package/dist/scripts/codex-0138-capability-artifact-check.js +0 -1
- package/dist/scripts/codex-0138-capability-check.js +0 -1
- package/dist/scripts/codex-0138-doctor-check.js +0 -1
- package/dist/scripts/codex-0138-feature-probes-check.js +0 -1
- package/dist/scripts/codex-0144-app-server-v2-check.js +5 -5
- package/dist/scripts/codex-0144-core-real-probes-check.js +0 -1
- package/dist/scripts/codex-app-handoff-check.js +0 -1
- package/dist/scripts/codex-app-handoff-launch-check.js +0 -1
- package/dist/scripts/codex-config-load-probe.js +0 -5
- package/dist/scripts/codex-control-all-pipelines-check.js +0 -1
- package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -1
- package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +0 -1
- package/dist/scripts/codex-permission-profiles-check.js +0 -1
- package/dist/scripts/codex-plugin-app-template-policy-check.js +0 -1
- package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -1
- package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -1
- package/dist/scripts/codex-sdk-backend-router-check.js +0 -1
- package/dist/scripts/codex-sdk-capability-check.js +0 -1
- package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -1
- package/dist/scripts/codex-sdk-real-smoke-check.js +0 -1
- package/dist/scripts/concurrent-session-collision-check.js +9 -0
- package/dist/scripts/context7-evidence-dedupe-check.js +0 -1
- package/dist/scripts/core-skill-card-schema-check.js +0 -11
- package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -10
- package/dist/scripts/core-skill-heldout-validation-check.js +0 -11
- package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -11
- package/dist/scripts/core-skill-patch-check.js +0 -11
- package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -11
- package/dist/scripts/current-command-surface-check.js +1 -1
- package/dist/scripts/current-surface-update-e2e-check.js +2 -4
- package/dist/scripts/current-upgrade-matrix-check.js +0 -1
- package/dist/scripts/dfix-fixture-check.js +0 -1
- package/dist/scripts/dfix-patch-handoff-check.js +0 -1
- package/dist/scripts/dfix-verification-check.js +0 -1
- package/dist/scripts/dfix-verification-recommendation-check.js +0 -1
- package/dist/scripts/docs-truthfulness-check.js +7 -7
- package/dist/scripts/doctor-fastpath-check.js +0 -1
- package/dist/scripts/doctor-fix-production-blackbox.js +1 -1
- package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -11
- package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -4
- package/dist/scripts/doctor-idempotence-check.js +0 -1
- package/dist/scripts/doctor-ops-semantics-check.js +0 -1
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +1 -1
- package/dist/scripts/ensure-bin-executable.js +0 -1
- package/dist/scripts/evidence-flagship-coverage-check.js +0 -1
- package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -1
- package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -5
- package/dist/scripts/fsx-hotpath-check.js +0 -1
- package/dist/scripts/gate-policy-audit-check.js +1 -1
- package/dist/scripts/geo-claim-evidence-check.js +0 -1
- package/dist/scripts/geo-cli-blackbox-check.js +0 -1
- package/dist/scripts/geo-crawler-policy-check.js +0 -1
- package/dist/scripts/git-worktree-diff-envelope-check.js +0 -1
- package/dist/scripts/git-worktree-dirty-lock-check.js +0 -1
- package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -1
- package/dist/scripts/git-worktree-integration-primary-check.js +0 -1
- package/dist/scripts/git-worktree-manifest-append-check.js +0 -1
- package/dist/scripts/git-worktree-untracked-diff-check.js +0 -1
- package/dist/scripts/high-risk-contracts-check.js +0 -1
- package/dist/scripts/hook-latency-budget-check.js +0 -1
- package/dist/scripts/hook-latency-quantum-check.js +0 -1
- package/dist/scripts/image-artifact-path-contract-check.js +0 -1
- package/dist/scripts/imagegen-real-smoke-check.js +0 -1
- package/dist/scripts/import-graph-budget-check.js +0 -1
- package/dist/scripts/installed-package-smoke-check.js +0 -1
- package/dist/scripts/legacy-gate-purge-check.js +0 -1
- package/dist/scripts/lib/codex-sdk-gate-lib.js +0 -3
- package/dist/scripts/lib/ensure-dist-fresh.js +0 -1
- package/dist/scripts/lib/valid-png-fixture.js +0 -1
- package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -1
- package/dist/scripts/loop-directive-check-lib.js +0 -1
- package/dist/scripts/loop-worker-fixture-child.js +0 -1
- package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -10
- package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +0 -1
- package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +0 -1
- package/dist/scripts/mcp-plugin-inventory-check.js +0 -1
- package/dist/scripts/mcp-tool-naming-parity-check.js +0 -1
- package/dist/scripts/model-call-concurrency-check.js +0 -1
- package/dist/scripts/mutation-callsite-coverage-check.js +0 -5
- package/dist/scripts/naruto-codex-e2e-check.js +0 -1
- package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -1
- package/dist/scripts/official-subagent-workflow-check.js +4 -2
- package/dist/scripts/ops-diagnostics-bundle-check.js +0 -1
- package/dist/scripts/packlist-performance-check.js +1 -3
- package/dist/scripts/perf-budget-check.js +0 -1
- package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -1
- package/dist/scripts/ppt-real-export-adapter-check.js +0 -1
- package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -1
- package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -1
- package/dist/scripts/ppt-reexport-rereview-check.js +0 -1
- package/dist/scripts/prepublish-fast-check.js +0 -23
- package/dist/scripts/prepublish-release-check-or-fast.js +0 -7
- package/dist/scripts/probe-memoization-check.js +0 -1
- package/dist/scripts/product-design-plugin-routing-check.js +0 -1
- package/dist/scripts/project-skill-dedupe-blackbox.js +36 -9
- package/dist/scripts/prompt-placeholder-guard-check.js +0 -1
- package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -3
- package/dist/scripts/qa-loop-app-handoff-capability-check.js +0 -1
- package/dist/scripts/qa-loop-app-handoff-check.js +0 -1
- package/dist/scripts/qa-loop-app-handoff-cli-check.js +0 -1
- package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +0 -1
- package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +0 -1
- package/dist/scripts/qa-loop-app-handoff-launch-check.js +0 -1
- package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +0 -1
- package/dist/scripts/qa-loop-budget-policy-check.js +0 -1
- package/dist/scripts/qa-loop-effort-escalation-check.js +0 -1
- package/dist/scripts/qa-loop-image-path-exposure-check.js +0 -1
- package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +0 -1
- package/dist/scripts/release-cache-glob-hashing-check.js +0 -1
- package/dist/scripts/release-cache-input-classifier-check.js +0 -1
- package/dist/scripts/release-cache-neutralization-report-check.js +0 -1
- package/dist/scripts/release-cache-version-neutral-fixture-check.js +0 -1
- package/dist/scripts/release-check-stamp.js +0 -4
- package/dist/scripts/release-dist-freshness-check.js +0 -1
- package/dist/scripts/release-full-parallelism-blackbox.js +3 -3
- package/dist/scripts/release-gate-batch-runner-check.js +22 -0
- package/dist/scripts/release-gate-budget-check.js +0 -6
- package/dist/scripts/release-gate-dag-runner-check.js +0 -1
- package/dist/scripts/release-latency-slo-check.js +0 -1
- package/dist/scripts/release-metadata-1-19-check.js +0 -2
- package/dist/scripts/release-metadata-check.js +0 -3
- package/dist/scripts/release-parallel-speed-budget-check.js +0 -5
- package/dist/scripts/release-proof-truth-check.js +0 -1
- package/dist/scripts/release-provenance-check.js +0 -1
- package/dist/scripts/release-real-check.js +0 -1
- package/dist/scripts/release-runtime-truth-matrix-check.js +0 -1
- package/dist/scripts/release-version-truth-check.js +0 -1
- package/dist/scripts/research-blueprint-densifier-check.js +0 -1
- package/dist/scripts/research-claim-builder-check.js +0 -1
- package/dist/scripts/research-complete-package-fixture-check.js +0 -1
- package/dist/scripts/research-final-reviewer-blackbox.js +0 -1
- package/dist/scripts/responses-retry-policy-centralized-check.js +0 -1
- package/dist/scripts/retention-apply-smoke-check.js +0 -1
- package/dist/scripts/retention-budget-check.js +0 -1
- package/dist/scripts/retention-dry-run-check.js +0 -1
- package/dist/scripts/rollback-recovery-smoke-check.js +0 -1
- package/dist/scripts/route-intent-regression-check.js +0 -1
- package/dist/scripts/runtime-current-terminal-check.js +0 -1
- package/dist/scripts/runtime-dist-parity-check.js +0 -1
- package/dist/scripts/runtime-no-src-mjs-check.js +0 -1
- package/dist/scripts/runtime-proof-summary-check.js +0 -1
- package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -15
- package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -1
- package/dist/scripts/scheduler-batch-dispatch-check.js +0 -1
- package/dist/scripts/scheduler-parallel-proof-consistency-check.js +0 -1
- package/dist/scripts/scheduler-utilization-integral-check.js +0 -1
- package/dist/scripts/search-visibility-gate-lib.js +0 -1
- package/dist/scripts/seo-audit-fixture-check.js +0 -1
- package/dist/scripts/seo-cli-blackbox-check.js +0 -1
- package/dist/scripts/seo-geo-geo-disambiguation-check.js +0 -1
- package/dist/scripts/seo-geo-route-identity-check.js +0 -1
- package/dist/scripts/seo-geo-skill-rich-content-check.js +0 -1
- package/dist/scripts/seo-marketing-truthfulness-check.js +0 -1
- package/dist/scripts/seo-metadata-sync-check.js +0 -1
- package/dist/scripts/seo-no-mutation-by-default-check.js +0 -1
- package/dist/scripts/shared-memory-fixture-check.js +0 -1
- package/dist/scripts/side-effect-runtime-report-check.js +0 -1
- package/dist/scripts/sizecheck.js +2 -3
- package/dist/scripts/sks-1-11-gate-lib.js +0 -1
- package/dist/scripts/sks-1-12-real-execution-check-lib.js +0 -1
- package/dist/scripts/sks-1-18-gate-lib.js +0 -1
- package/dist/scripts/sks-menubar-install-check.js +0 -3
- package/dist/scripts/sksd-daemon-check.js +0 -1
- package/dist/scripts/super-search-live-smoke-check.js +0 -1
- package/dist/scripts/super-search-local-http-smoke-check.js +0 -1
- package/dist/scripts/super-search-offline-contract-check.js +0 -1
- package/dist/scripts/super-search-provider-interface-check.js +0 -1
- package/dist/scripts/triwiki-cache-key-check.js +0 -1
- package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -1
- package/dist/scripts/triwiki-proof-bank-check.js +0 -1
- package/dist/scripts/triwiki-proof-card-check.js +0 -1
- package/dist/scripts/trust-fixture-check.js +0 -1
- package/dist/scripts/ultra-router-auto-router-check.js +0 -1
- package/dist/scripts/update-fastpath-check.js +0 -1
- package/dist/scripts/upgrade-migration-matrix-check.js +0 -1
- package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -1
- package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -1
- package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -1
- package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -1
- package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -1
- package/dist/scripts/write-build-manifest.js +0 -1
- package/dist/scripts/wrongness-fixture-check.js +0 -1
- package/dist/scripts/zellij-capability-check.js +0 -1
- package/dist/scripts/zellij-developer-controls-check.js +0 -1
- package/dist/scripts/zellij-doctor-readiness-check.js +0 -13
- package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -1
- package/dist/scripts/zellij-fake-adapter-check.js +0 -1
- package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -1
- package/dist/scripts/zellij-lane-renderer-check.js +0 -1
- package/dist/scripts/zellij-launch-command-truth-check.js +0 -12
- package/dist/scripts/zellij-layout-valid-check.js +0 -1
- package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -1
- package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -1
- package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -1
- package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -1
- package/dist/scripts/zellij-pane-proof-check.js +0 -1
- package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -1
- package/dist/scripts/zellij-real-session-cleanup-check.js +0 -1
- package/dist/scripts/zellij-real-session-launch-check.js +0 -1
- package/dist/scripts/zellij-right-column-geometry-proof.js +0 -1
- package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -1
- package/dist/scripts/zellij-right-column-manager-check.js +0 -1
- package/dist/scripts/zellij-screen-proof-check.js +0 -1
- package/dist/scripts/zellij-slot-only-ui-check.js +0 -1
- package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -1
- package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -7
- package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -1
- package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -1
- package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -1
- package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -1
- package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -1
- package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -1
- package/dist/scripts/zellij-stacked-version-parser-check.js +0 -1
- package/dist/scripts/zellij-ui-design-check.js +0 -12
- package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -1
- package/dist/scripts/zellij-update-prompt-mode-check.js +0 -1
- package/dist/scripts/zellij-update-prompt-safety-check.js +0 -1
- package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -2
- package/package.json +6 -7
- package/release-gates.v2.json +426 -93
- package/schemas/codex/app-server-0.145/codex_app_server_protocol.v2.schemas.json +19611 -0
- package/dist/core/commands/glm-command.js +0 -93
- package/dist/core/providers/glm/bench/glm-bench-comparison.js +0 -47
- package/dist/core/providers/glm/bench/glm-bench-fixture.js +0 -64
- package/dist/core/providers/glm/bench/glm-bench-model-lock-proof.js +0 -52
- package/dist/core/providers/glm/bench/glm-bench-report.js +0 -74
- package/dist/core/providers/glm/bench/glm-benchmark-runner.js +0 -243
- package/dist/core/providers/glm/bench/glm-benchmark-types.js +0 -1
- package/dist/core/providers/glm/bench/glm-direct-bench-runner.js +0 -72
- package/dist/core/providers/glm/glm-52-profile.js +0 -82
- package/dist/core/providers/glm/glm-52-request.js +0 -73
- package/dist/core/providers/glm/glm-52-response-guard.js +0 -32
- package/dist/core/providers/glm/glm-52-settings.js +0 -67
- package/dist/core/providers/glm/glm-context-budget.js +0 -14
- package/dist/core/providers/glm/glm-context-cache.js +0 -8
- package/dist/core/providers/glm/glm-direct-run.js +0 -140
- package/dist/core/providers/glm/glm-interactive-launch.js +0 -4
- package/dist/core/providers/glm/glm-latency-trace.js +0 -39
- package/dist/core/providers/glm/glm-loop-guard.js +0 -30
- package/dist/core/providers/glm/glm-mad-launch.js +0 -128
- package/dist/core/providers/glm/glm-mad-mode.js +0 -269
- package/dist/core/providers/glm/glm-model-meta-cache.js +0 -18
- package/dist/core/providers/glm/glm-patch-apply.js +0 -72
- package/dist/core/providers/glm/glm-patch-parser.js +0 -18
- package/dist/core/providers/glm/glm-profile-resolver.js +0 -168
- package/dist/core/providers/glm/glm-readiness.js +0 -4
- package/dist/core/providers/glm/glm-reasoning-policy.js +0 -14
- package/dist/core/providers/glm/glm-run-controller.js +0 -65
- package/dist/core/providers/glm/glm-run-state.js +0 -10
- package/dist/core/providers/glm/glm-run-timeout.js +0 -30
- package/dist/core/providers/glm/glm-speed-context.js +0 -81
- package/dist/core/providers/glm/glm-speed-gate.js +0 -39
- package/dist/core/providers/glm/glm-speed-output-parser.js +0 -39
- package/dist/core/providers/glm/glm-tool-schema-cache.js +0 -18
- package/dist/core/providers/glm/naruto/glm-naruto-apply-transaction.js +0 -135
- package/dist/core/providers/glm/naruto/glm-naruto-artifacts.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-bench.js +0 -6
- package/dist/core/providers/glm/naruto/glm-naruto-budget.js +0 -44
- package/dist/core/providers/glm/naruto/glm-naruto-combined-patch.js +0 -48
- package/dist/core/providers/glm/naruto/glm-naruto-command.js +0 -101
- package/dist/core/providers/glm/naruto/glm-naruto-concurrency-governor.js +0 -37
- package/dist/core/providers/glm/naruto/glm-naruto-conflict-graph.js +0 -79
- package/dist/core/providers/glm/naruto/glm-naruto-critical-path.js +0 -50
- package/dist/core/providers/glm/naruto/glm-naruto-decomposer.js +0 -148
- package/dist/core/providers/glm/naruto/glm-naruto-file-lease.js +0 -22
- package/dist/core/providers/glm/naruto/glm-naruto-final-seal.js +0 -81
- package/dist/core/providers/glm/naruto/glm-naruto-finalizer.js +0 -22
- package/dist/core/providers/glm/naruto/glm-naruto-hunk-conflict.js +0 -15
- package/dist/core/providers/glm/naruto/glm-naruto-hunk-parser.js +0 -35
- package/dist/core/providers/glm/naruto/glm-naruto-isolation-policy.js +0 -37
- package/dist/core/providers/glm/naruto/glm-naruto-judge.js +0 -83
- package/dist/core/providers/glm/naruto/glm-naruto-merge-planner.js +0 -61
- package/dist/core/providers/glm/naruto/glm-naruto-metrics.js +0 -33
- package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +0 -486
- package/dist/core/providers/glm/naruto/glm-naruto-parallelism-summary.js +0 -54
- package/dist/core/providers/glm/naruto/glm-naruto-patch-candidate-gate.js +0 -41
- package/dist/core/providers/glm/naruto/glm-naruto-patch-candidate-parser.js +0 -61
- package/dist/core/providers/glm/naruto/glm-naruto-patch-envelope.js +0 -54
- package/dist/core/providers/glm/naruto/glm-naruto-quorum.js +0 -36
- package/dist/core/providers/glm/naruto/glm-naruto-rate-limiter.js +0 -17
- package/dist/core/providers/glm/naruto/glm-naruto-repair-wave.js +0 -20
- package/dist/core/providers/glm/naruto/glm-naruto-requirement-coverage.js +0 -108
- package/dist/core/providers/glm/naruto/glm-naruto-requirement-ledger.js +0 -57
- package/dist/core/providers/glm/naruto/glm-naruto-scoreboard.js +0 -74
- package/dist/core/providers/glm/naruto/glm-naruto-secret-audit.js +0 -90
- package/dist/core/providers/glm/naruto/glm-naruto-session-id.js +0 -9
- package/dist/core/providers/glm/naruto/glm-naruto-shard-planner.js +0 -31
- package/dist/core/providers/glm/naruto/glm-naruto-stage-scheduler.js +0 -84
- package/dist/core/providers/glm/naruto/glm-naruto-targeted-checks.js +0 -75
- package/dist/core/providers/glm/naruto/glm-naruto-task-size-classifier.js +0 -11
- package/dist/core/providers/glm/naruto/glm-naruto-terminal.js +0 -43
- package/dist/core/providers/glm/naruto/glm-naruto-trace.js +0 -173
- package/dist/core/providers/glm/naruto/glm-naruto-types.js +0 -36
- package/dist/core/providers/glm/naruto/glm-naruto-usage-extractor.js +0 -30
- package/dist/core/providers/glm/naruto/glm-naruto-verifier-output.js +0 -30
- package/dist/core/providers/glm/naruto/glm-naruto-work-graph.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-worker-artifacts.js +0 -55
- package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +0 -275
- package/dist/core/providers/glm/naruto/glm-naruto-worker-runtime.js +0 -421
- package/dist/core/providers/glm/naruto/glm-naruto-worker-scheduler.js +0 -177
- package/dist/core/providers/glm/naruto/glm-naruto-worker.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-worktree-cleanup.js +0 -19
- package/dist/core/providers/glm/naruto/glm-naruto-worktree-manager.js +0 -71
- package/dist/core/providers/glm/naruto/glm-naruto-worktree-worker.js +0 -73
- package/dist/core/providers/glm/naruto/glm-naruto-worktree.js +0 -62
- package/schemas/codex/app-server-0.144/codex_app_server_protocol.v2.schemas.json +0 -1
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import readline from 'node:readline/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { stdin as input, stdout as output } from 'node:process';
|
|
4
|
-
import { printJson } from '../../../cli/output.js';
|
|
5
|
-
import { flag } from '../../../cli/args.js';
|
|
6
|
-
import { nowIso, writeJsonAtomic } from '../../fsx.js';
|
|
7
|
-
import {} from '../openrouter/openrouter-types.js';
|
|
8
|
-
import { sendOpenRouterChatCompletion } from '../openrouter/openrouter-client.js';
|
|
9
|
-
import { resolveOpenRouterApiKey, writeStoredOpenRouterKey } from '../openrouter/openrouter-secret-store.js';
|
|
10
|
-
import { redactOpenRouterKey } from '../../security/redact-secrets.js';
|
|
11
|
-
import { buildGlmCodexAppModelProfile } from './glm-52-profile.js';
|
|
12
|
-
import { buildGlm52KeyValidationRequest, buildGlm52Request } from './glm-52-request.js';
|
|
13
|
-
import { assertGlm52ActualModel } from './glm-52-response-guard.js';
|
|
14
|
-
import { GLM_52_OPENROUTER_MODEL, OPENROUTER_CHAT_COMPLETIONS_URL } from './glm-52-settings.js';
|
|
15
|
-
import { resolveGlmProfileFromArgs } from './glm-profile-resolver.js';
|
|
16
|
-
import { createEmptyGlmLatencyTrace, writeGlmLatencyTrace } from './glm-latency-trace.js';
|
|
17
|
-
export async function runMadGlmMode(args = [], adapters = {}) {
|
|
18
|
-
const runtime = buildDefaultAdapters(adapters);
|
|
19
|
-
const repair = flag(args, '--repair');
|
|
20
|
-
const noSaveKey = flag(args, '--no-save-key');
|
|
21
|
-
const skipValidation = flag(args, '--skip-validation');
|
|
22
|
-
const json = flag(args, '--json');
|
|
23
|
-
const selectedProfile = resolveGlmProfileFromArgs(args);
|
|
24
|
-
const profile = buildGlmCodexAppModelProfile();
|
|
25
|
-
let result;
|
|
26
|
-
if (selectedProfile.blockers.length) {
|
|
27
|
-
result = baseResult({
|
|
28
|
-
status: 'blocked',
|
|
29
|
-
blockers: selectedProfile.blockers,
|
|
30
|
-
warnings: []
|
|
31
|
-
}, selectedProfile);
|
|
32
|
-
}
|
|
33
|
-
else if (repair) {
|
|
34
|
-
const key = await runtime.promptSecret('OpenRouter API key is required for GLM 5.2 mode.\nEnter OpenRouter API key: ');
|
|
35
|
-
if (!key) {
|
|
36
|
-
result = baseResult({
|
|
37
|
-
status: 'blocked',
|
|
38
|
-
blockers: ['glm_key_prompt_cancelled'],
|
|
39
|
-
warnings: []
|
|
40
|
-
}, selectedProfile);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
if (!noSaveKey)
|
|
44
|
-
await runtime.writeSecret(key);
|
|
45
|
-
const validation = skipValidation
|
|
46
|
-
? { ok: true, value: validationValue(null) }
|
|
47
|
-
: await runtime.validateOpenRouterKey(key);
|
|
48
|
-
result = validation.ok
|
|
49
|
-
? baseResult({
|
|
50
|
-
status: 'ready',
|
|
51
|
-
...(validation.value.actual_model ? { actual_model: validation.value.actual_model } : {}),
|
|
52
|
-
openrouter_key_source: noSaveKey ? 'prompt' : 'user-secret-store',
|
|
53
|
-
key_preview: redactOpenRouterKey(key),
|
|
54
|
-
blockers: [],
|
|
55
|
-
warnings: noSaveKey ? ['openrouter_key_not_saved'] : []
|
|
56
|
-
}, selectedProfile)
|
|
57
|
-
: baseResult({
|
|
58
|
-
status: 'blocked',
|
|
59
|
-
openrouter_key_source: noSaveKey ? 'prompt' : 'user-secret-store',
|
|
60
|
-
key_preview: redactOpenRouterKey(key),
|
|
61
|
-
blockers: [validation.error.code],
|
|
62
|
-
warnings: []
|
|
63
|
-
}, selectedProfile);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const resolved = await resolveOpenRouterApiKey({ env: runtime.env });
|
|
68
|
-
if (!resolved.key && process.stdin.isTTY) {
|
|
69
|
-
const key = await runtime.promptSecret('OpenRouter API key is required for GLM 5.2 mode.\nEnter OpenRouter API key: ');
|
|
70
|
-
if (!key) {
|
|
71
|
-
result = baseResult({ status: 'blocked', blockers: ['glm_key_prompt_cancelled'], warnings: [] }, selectedProfile);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
const save = noSaveKey ? false : await runtime.promptConfirm('Save this key for future SKS GLM runs? [Y/n] ', true);
|
|
75
|
-
if (save)
|
|
76
|
-
await runtime.writeSecret(key);
|
|
77
|
-
result = baseResult({
|
|
78
|
-
status: 'ready',
|
|
79
|
-
openrouter_key_source: save ? 'user-secret-store' : 'prompt',
|
|
80
|
-
key_preview: redactOpenRouterKey(key),
|
|
81
|
-
blockers: [],
|
|
82
|
-
warnings: save ? [] : ['openrouter_key_not_saved']
|
|
83
|
-
}, selectedProfile);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (!resolved.key) {
|
|
87
|
-
result = baseResult({
|
|
88
|
-
status: 'blocked',
|
|
89
|
-
blockers: resolved.blockers,
|
|
90
|
-
warnings: ['set_OPENROUTER_API_KEY_or_run_sks_--mad_--glm_--repair']
|
|
91
|
-
}, selectedProfile);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
result = baseResult({
|
|
95
|
-
status: 'ready',
|
|
96
|
-
...(resolved.source ? { openrouter_key_source: resolved.source } : {}),
|
|
97
|
-
key_preview: resolved.key_preview,
|
|
98
|
-
blockers: [],
|
|
99
|
-
warnings: resolved.warnings
|
|
100
|
-
}, selectedProfile);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
await writeGlmModeArtifacts(runtime.cwd, result, profile, selectedProfile, runtime.nowIso()).catch(() => undefined);
|
|
104
|
-
if (flag(args, '--trace')) {
|
|
105
|
-
await writeGlmLatencyTrace(runtime.cwd, {
|
|
106
|
-
...createEmptyGlmLatencyTrace(selectedProfile.name),
|
|
107
|
-
context_estimated_tokens: selectedProfile.name === 'speed' ? 16_000 : 64_000,
|
|
108
|
-
request_encode_ms: 1,
|
|
109
|
-
encoded_request_cache_hit: false,
|
|
110
|
-
provider: 'openrouter'
|
|
111
|
-
}).catch(() => undefined);
|
|
112
|
-
}
|
|
113
|
-
if (json)
|
|
114
|
-
printJson(result);
|
|
115
|
-
else
|
|
116
|
-
printHumanGlmResult(result, runtime.log);
|
|
117
|
-
if (!result.ok)
|
|
118
|
-
process.exitCode = 1;
|
|
119
|
-
return result;
|
|
120
|
-
}
|
|
121
|
-
function baseResult(input, profile) {
|
|
122
|
-
const result = {
|
|
123
|
-
schema: 'sks.glm-mode-result.v1',
|
|
124
|
-
ok: input.blockers.length === 0 && input.status !== 'failed',
|
|
125
|
-
status: input.status,
|
|
126
|
-
mode: profile.mode,
|
|
127
|
-
profile: profile.name,
|
|
128
|
-
provider: 'openrouter',
|
|
129
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
130
|
-
requested_model: GLM_52_OPENROUTER_MODEL,
|
|
131
|
-
strict_model_lock: true,
|
|
132
|
-
gpt_fallback_allowed: false,
|
|
133
|
-
codex_app_profile_id: 'sks/glm-5.2-mad',
|
|
134
|
-
blockers: input.blockers,
|
|
135
|
-
warnings: input.warnings
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
...result,
|
|
139
|
-
...(input.actual_model ? { actual_model: input.actual_model } : {}),
|
|
140
|
-
...(input.openrouter_key_source ? { openrouter_key_source: input.openrouter_key_source } : {}),
|
|
141
|
-
...(input.key_preview !== undefined ? { key_preview: input.key_preview } : {})
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function buildDefaultAdapters(overrides) {
|
|
145
|
-
return {
|
|
146
|
-
nowIso: overrides.nowIso || nowIso,
|
|
147
|
-
env: overrides.env || process.env,
|
|
148
|
-
cwd: overrides.cwd || process.cwd(),
|
|
149
|
-
promptSecret: overrides.promptSecret || promptLine,
|
|
150
|
-
promptConfirm: overrides.promptConfirm || promptConfirmLine,
|
|
151
|
-
writeSecret: overrides.writeSecret || (async (value) => {
|
|
152
|
-
await writeStoredOpenRouterKey(value);
|
|
153
|
-
}),
|
|
154
|
-
validateOpenRouterKey: overrides.validateOpenRouterKey || validateOpenRouterKey,
|
|
155
|
-
sendOpenRouterRequest: overrides.sendOpenRouterRequest || (async (request, key) => sendOpenRouterChatCompletion({ request, apiKey: key })),
|
|
156
|
-
log: overrides.log || ((message) => console.log(message))
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
async function validateOpenRouterKey(key) {
|
|
160
|
-
const response = await sendOpenRouterChatCompletion({
|
|
161
|
-
apiKey: key,
|
|
162
|
-
request: buildGlm52KeyValidationRequest()
|
|
163
|
-
});
|
|
164
|
-
if (!response.ok)
|
|
165
|
-
return response;
|
|
166
|
-
const guard = assertGlm52ActualModel(response.value.model);
|
|
167
|
-
if (!guard.ok) {
|
|
168
|
-
return {
|
|
169
|
-
ok: false,
|
|
170
|
-
error: {
|
|
171
|
-
code: guard.code,
|
|
172
|
-
message: 'GLM model lock violated.',
|
|
173
|
-
severity: 'blocked'
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
return { ok: true, value: validationValue(response.value.model || null) };
|
|
178
|
-
}
|
|
179
|
-
function validationValue(actualModel) {
|
|
180
|
-
return {
|
|
181
|
-
schema: 'sks.openrouter-key-validation.v1',
|
|
182
|
-
ok: true,
|
|
183
|
-
requested_model: GLM_52_OPENROUTER_MODEL,
|
|
184
|
-
actual_model: actualModel,
|
|
185
|
-
strict_model_lock: true,
|
|
186
|
-
gpt_fallback_allowed: false
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
async function writeGlmModeArtifacts(cwd, result, profile, selectedProfile, generatedAt) {
|
|
190
|
-
const dir = path.join(cwd, '.sneakoscope', 'glm');
|
|
191
|
-
await writeJsonAtomic(path.join(dir, 'mad-glm-session.json'), {
|
|
192
|
-
schema: 'sks.glm-mad-session.v1',
|
|
193
|
-
generated_at: generatedAt,
|
|
194
|
-
result,
|
|
195
|
-
profile_id: profile.id,
|
|
196
|
-
selected_profile: selectedProfile.name
|
|
197
|
-
});
|
|
198
|
-
await writeJsonAtomic(path.join(dir, 'openrouter-request-summary.json'), {
|
|
199
|
-
schema: 'sks.openrouter-request-summary.v1',
|
|
200
|
-
generated_at: generatedAt,
|
|
201
|
-
endpoint: OPENROUTER_CHAT_COMPLETIONS_URL,
|
|
202
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
203
|
-
mode: selectedProfile.mode,
|
|
204
|
-
profile: selectedProfile.name,
|
|
205
|
-
temperature: selectedProfile.temperature,
|
|
206
|
-
top_p: selectedProfile.top_p,
|
|
207
|
-
reasoning_effort: selectedProfile.reasoning_effort || null,
|
|
208
|
-
max_tokens: selectedProfile.max_tokens,
|
|
209
|
-
tool_choice: selectedProfile.tool_choice,
|
|
210
|
-
parallel_tool_calls: selectedProfile.parallel_tool_calls,
|
|
211
|
-
stream: selectedProfile.stream,
|
|
212
|
-
provider_allow_fallbacks: false,
|
|
213
|
-
provider_sort: selectedProfile.provider.sort || null,
|
|
214
|
-
require_parameters: selectedProfile.provider.require_parameters,
|
|
215
|
-
key_source: result.openrouter_key_source || null,
|
|
216
|
-
key_preview: result.key_preview || null
|
|
217
|
-
});
|
|
218
|
-
await writeJsonAtomic(path.join(dir, 'model-guard.json'), {
|
|
219
|
-
schema: 'sks.glm-model-guard.v1',
|
|
220
|
-
generated_at: generatedAt,
|
|
221
|
-
requested_model: GLM_52_OPENROUTER_MODEL,
|
|
222
|
-
actual_model: result.actual_model || null,
|
|
223
|
-
accepted: result.actual_model ? assertGlm52ActualModel(result.actual_model).ok : result.ok,
|
|
224
|
-
strict_model_lock: true,
|
|
225
|
-
gpt_fallback_allowed: false,
|
|
226
|
-
blockers: result.blockers
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
function printHumanGlmResult(result, log) {
|
|
230
|
-
log(`GLM 5.2 MAD mode: ${result.ok ? result.status : 'blocked'} (${result.profile})`);
|
|
231
|
-
log(`Model: ${result.model}`);
|
|
232
|
-
log(`GPT fallback: ${result.gpt_fallback_allowed ? 'allowed' : 'blocked'}`);
|
|
233
|
-
if (result.openrouter_key_source)
|
|
234
|
-
log(`OpenRouter key: ${result.openrouter_key_source} ${result.key_preview || ''}`.trim());
|
|
235
|
-
for (const blocker of result.blockers)
|
|
236
|
-
log(`- blocker: ${blocker}`);
|
|
237
|
-
for (const warning of result.warnings)
|
|
238
|
-
log(`- warning: ${warning}`);
|
|
239
|
-
}
|
|
240
|
-
async function promptLine(prompt) {
|
|
241
|
-
if (!process.stdin.isTTY)
|
|
242
|
-
return null;
|
|
243
|
-
const rl = readline.createInterface({ input, output });
|
|
244
|
-
try {
|
|
245
|
-
const answer = await rl.question(prompt);
|
|
246
|
-
return answer.trim() || null;
|
|
247
|
-
}
|
|
248
|
-
finally {
|
|
249
|
-
rl.close();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
async function promptConfirmLine(prompt, defaultYes) {
|
|
253
|
-
if (!process.stdin.isTTY)
|
|
254
|
-
return defaultYes;
|
|
255
|
-
const answer = await promptLine(prompt);
|
|
256
|
-
if (!answer)
|
|
257
|
-
return defaultYes;
|
|
258
|
-
return !/^n(o)?$/i.test(answer);
|
|
259
|
-
}
|
|
260
|
-
export function buildGlmModeDryRunRequest() {
|
|
261
|
-
return buildGlm52Request({
|
|
262
|
-
messages: [{ role: 'user', content: 'SKS GLM dry run.' }],
|
|
263
|
-
profile: 'speed',
|
|
264
|
-
stream: false,
|
|
265
|
-
maxTokens: 1,
|
|
266
|
-
toolChoice: 'none',
|
|
267
|
-
parallelToolCalls: false
|
|
268
|
-
});
|
|
269
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SksLruCache } from '../../perf/lru-cache.js';
|
|
2
|
-
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
3
|
-
export function createGlmModelMetaCache(maxEntries = 16, ttlMs = DAY_MS) {
|
|
4
|
-
const cache = new SksLruCache(maxEntries);
|
|
5
|
-
return {
|
|
6
|
-
get(model, now = Date.now()) {
|
|
7
|
-
const entry = cache.get(model);
|
|
8
|
-
if (!entry || entry.expiresAt <= now)
|
|
9
|
-
return null;
|
|
10
|
-
return entry;
|
|
11
|
-
},
|
|
12
|
-
set(model, reasoning, now = Date.now()) {
|
|
13
|
-
const entry = { model, reasoning, createdAt: now, expiresAt: now + ttlMs };
|
|
14
|
-
cache.set(model, entry, now);
|
|
15
|
-
return entry;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import { parseUnifiedDiffPatch } from './glm-patch-parser.js';
|
|
3
|
-
const PROTECTED_PATH = /(^|\/)(\.github|dist|node_modules)(\/|$)/;
|
|
4
|
-
export async function checkAndApplyGlmPatch(input) {
|
|
5
|
-
const parsed = parseUnifiedDiffPatch(input.patch);
|
|
6
|
-
if (parsed.empty) {
|
|
7
|
-
return issue('glm_patch_empty', 'GLM output did not contain a non-empty unified diff.');
|
|
8
|
-
}
|
|
9
|
-
const blockedPath = parsed.touchedPaths.find((file) => PROTECTED_PATH.test(file));
|
|
10
|
-
if (blockedPath) {
|
|
11
|
-
return issue('glm_patch_protected_path', `GLM patch touched protected path: ${blockedPath}`);
|
|
12
|
-
}
|
|
13
|
-
const check = await runGitApply(input.cwd, input.patch, ['apply', '--check', '--whitespace=nowarn', '-']);
|
|
14
|
-
if (check.code !== 0) {
|
|
15
|
-
return issue('glm_patch_gate_failed', check.stderr || check.stdout || 'git apply --check failed.');
|
|
16
|
-
}
|
|
17
|
-
if (!input.apply) {
|
|
18
|
-
return {
|
|
19
|
-
ok: true,
|
|
20
|
-
value: {
|
|
21
|
-
checked: true,
|
|
22
|
-
applied: false,
|
|
23
|
-
touchedPaths: parsed.touchedPaths,
|
|
24
|
-
stdout: check.stdout,
|
|
25
|
-
stderr: check.stderr
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const applied = await runGitApply(input.cwd, input.patch, ['apply', '--whitespace=nowarn', '-']);
|
|
30
|
-
if (applied.code !== 0) {
|
|
31
|
-
return issue('glm_patch_apply_failed', applied.stderr || applied.stdout || 'git apply failed.');
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
ok: true,
|
|
35
|
-
value: {
|
|
36
|
-
checked: true,
|
|
37
|
-
applied: true,
|
|
38
|
-
touchedPaths: parsed.touchedPaths,
|
|
39
|
-
stdout: applied.stdout,
|
|
40
|
-
stderr: applied.stderr
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function issue(code, message) {
|
|
45
|
-
return { ok: false, error: { code, message, severity: 'blocked' } };
|
|
46
|
-
}
|
|
47
|
-
function runGitApply(cwd, patch, args) {
|
|
48
|
-
return new Promise((resolve) => {
|
|
49
|
-
const child = spawn('git', [...args], { cwd, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
50
|
-
let stdout = '';
|
|
51
|
-
let stderr = '';
|
|
52
|
-
let settled = false;
|
|
53
|
-
const finish = (code) => {
|
|
54
|
-
if (settled)
|
|
55
|
-
return;
|
|
56
|
-
settled = true;
|
|
57
|
-
resolve({ code, stdout, stderr });
|
|
58
|
-
};
|
|
59
|
-
child.stdout.on('data', (chunk) => { stdout += String(chunk); });
|
|
60
|
-
child.stderr.on('data', (chunk) => { stderr += String(chunk); });
|
|
61
|
-
child.stdin.on('error', (error) => {
|
|
62
|
-
if (error.code !== 'EPIPE')
|
|
63
|
-
stderr += `${stderr ? '\n' : ''}${error.message}`;
|
|
64
|
-
});
|
|
65
|
-
child.on('error', (error) => {
|
|
66
|
-
stderr += `${stderr ? '\n' : ''}${error.message}`;
|
|
67
|
-
finish(null);
|
|
68
|
-
});
|
|
69
|
-
child.on('close', finish);
|
|
70
|
-
child.stdin.end(patch);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function parseUnifiedDiffPatch(patch) {
|
|
2
|
-
const touched = new Set();
|
|
3
|
-
for (const line of patch.split(/\r?\n/)) {
|
|
4
|
-
const diff = line.match(/^diff --git a\/(.+?) b\/(.+)$/);
|
|
5
|
-
if (diff?.[1])
|
|
6
|
-
touched.add(diff[1]);
|
|
7
|
-
if (diff?.[2])
|
|
8
|
-
touched.add(diff[2]);
|
|
9
|
-
const file = line.match(/^(?:---|\+\+\+) [ab]\/(.+)$/);
|
|
10
|
-
if (file?.[1] && file[1] !== '/dev/null')
|
|
11
|
-
touched.add(file[1]);
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
patch,
|
|
15
|
-
touchedPaths: [...touched],
|
|
16
|
-
empty: !patch.trim() || !/^diff --git /m.test(patch)
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { readOption } from '../../../cli/args.js';
|
|
2
|
-
import { GLM_DEEP_MODE, GLM_DEEP_PROFILE, GLM_52_OPENROUTER_MODEL, GLM_SPEED_MODE, GLM_SPEED_PROFILE, GLM_STRICT_MODE, GLM_STRICT_PROFILE, GLM_XHIGH_MODE, GLM_XHIGH_PROFILE } from './glm-52-settings.js';
|
|
3
|
-
export function resolveGlmProfileFromArgs(args = []) {
|
|
4
|
-
const list = args.map(String);
|
|
5
|
-
const exactProvider = readOption(list, '--exact-provider', null);
|
|
6
|
-
const slashSelection = parseGlmSlashModelSelection(list);
|
|
7
|
-
const providerBlockers = exactProvider && !isValidOpenRouterProviderSlug(exactProvider)
|
|
8
|
-
? [`invalid_openrouter_provider_slug:${exactProvider}`]
|
|
9
|
-
: [];
|
|
10
|
-
const base = slashSelection.reasoning_effort === 'xhigh' || list.includes('--xhigh')
|
|
11
|
-
? profileFromConst('xhigh')
|
|
12
|
-
: list.includes('--strict')
|
|
13
|
-
? profileFromConst('strict')
|
|
14
|
-
: slashSelection.reasoning_effort === 'high' || list.includes('--deep')
|
|
15
|
-
? profileFromConst('deep')
|
|
16
|
-
: profileFromConst('speed');
|
|
17
|
-
const provider = exactProvider && !providerBlockers.length
|
|
18
|
-
? {
|
|
19
|
-
allow_fallbacks: false,
|
|
20
|
-
require_parameters: base.provider.require_parameters,
|
|
21
|
-
order: [exactProvider]
|
|
22
|
-
}
|
|
23
|
-
: list.includes('--ttft')
|
|
24
|
-
? {
|
|
25
|
-
...base.provider,
|
|
26
|
-
sort: 'latency',
|
|
27
|
-
preferred_max_latency: { p50: 1.5, p90: 4 }
|
|
28
|
-
}
|
|
29
|
-
: base.provider;
|
|
30
|
-
return {
|
|
31
|
-
...base,
|
|
32
|
-
provider,
|
|
33
|
-
blockers: [...providerBlockers, ...slashSelection.blockers]
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export function reasoningEffortFromGlmSlashModelArgs(args = []) {
|
|
37
|
-
return parseGlmSlashModelSelection(args).reasoning_effort;
|
|
38
|
-
}
|
|
39
|
-
export function stripGlmSlashModelArgs(args = []) {
|
|
40
|
-
const consumed = new Set(parseGlmSlashModelSelection(args).consumed_indexes);
|
|
41
|
-
return args.map(String).filter((_arg, index) => !consumed.has(index));
|
|
42
|
-
}
|
|
43
|
-
export function parseGlmSlashModelSelection(args = []) {
|
|
44
|
-
const list = args.map(String);
|
|
45
|
-
const consumed = new Set();
|
|
46
|
-
const values = [];
|
|
47
|
-
for (let i = 0; i < list.length; i += 1) {
|
|
48
|
-
const arg = list[i] || '';
|
|
49
|
-
if (arg === '/model') {
|
|
50
|
-
consumed.add(i);
|
|
51
|
-
for (let j = i + 1; j < list.length && values.length < 2; j += 1) {
|
|
52
|
-
const candidate = list[j] || '';
|
|
53
|
-
if (candidate.startsWith('--') || candidate.startsWith('/'))
|
|
54
|
-
break;
|
|
55
|
-
consumed.add(j);
|
|
56
|
-
values.push(candidate);
|
|
57
|
-
if (values.length === 1 && isSelectableGlmReasoningEffort(candidate.trim().toLowerCase()))
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
const inline = arg.match(/^\/model(?::|=)(.+)$/)?.[1];
|
|
63
|
-
if (inline) {
|
|
64
|
-
consumed.add(i);
|
|
65
|
-
values.push(...inline.split(/[,:]/).map((value) => value.trim()).filter(Boolean).slice(0, 2));
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
let model = null;
|
|
70
|
-
let reasoning = null;
|
|
71
|
-
const blockers = [];
|
|
72
|
-
for (const value of values) {
|
|
73
|
-
const normalized = value.trim().toLowerCase();
|
|
74
|
-
if (isSelectableGlmReasoningEffort(normalized)) {
|
|
75
|
-
reasoning = normalized;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (!model) {
|
|
79
|
-
model = value;
|
|
80
|
-
if (!isAllowedGlmSlashModel(value))
|
|
81
|
-
blockers.push(`glm_slash_model_mismatch:${value}`);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
blockers.push(`glm_slash_model_unrecognized:${value}`);
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
model,
|
|
88
|
-
reasoning_effort: reasoning,
|
|
89
|
-
consumed_indexes: [...consumed].sort((a, b) => a - b),
|
|
90
|
-
blockers
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export function profileFromConst(name) {
|
|
94
|
-
if (name === 'deep') {
|
|
95
|
-
return {
|
|
96
|
-
name,
|
|
97
|
-
mode: GLM_DEEP_MODE,
|
|
98
|
-
stream: GLM_DEEP_PROFILE.stream,
|
|
99
|
-
max_tokens: GLM_DEEP_PROFILE.max_tokens,
|
|
100
|
-
temperature: GLM_DEEP_PROFILE.temperature,
|
|
101
|
-
top_p: GLM_DEEP_PROFILE.top_p,
|
|
102
|
-
tool_choice: GLM_DEEP_PROFILE.tool_choice,
|
|
103
|
-
parallel_tool_calls: GLM_DEEP_PROFILE.parallel_tool_calls,
|
|
104
|
-
provider: GLM_DEEP_PROFILE.provider,
|
|
105
|
-
reasoning_effort: GLM_DEEP_PROFILE.reasoning_effort,
|
|
106
|
-
blockers: []
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (name === 'xhigh') {
|
|
110
|
-
return {
|
|
111
|
-
...profileFromConst('deep'),
|
|
112
|
-
name,
|
|
113
|
-
mode: GLM_XHIGH_MODE,
|
|
114
|
-
max_tokens: GLM_XHIGH_PROFILE.max_tokens,
|
|
115
|
-
reasoning_effort: GLM_XHIGH_PROFILE.reasoning_effort,
|
|
116
|
-
blockers: []
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (name === 'strict') {
|
|
120
|
-
return {
|
|
121
|
-
...profileFromConst('deep'),
|
|
122
|
-
name,
|
|
123
|
-
mode: GLM_STRICT_MODE,
|
|
124
|
-
response_format: {
|
|
125
|
-
type: 'json_schema',
|
|
126
|
-
json_schema: {
|
|
127
|
-
name: 'sks_glm_strict_proof',
|
|
128
|
-
strict: true,
|
|
129
|
-
schema: {
|
|
130
|
-
type: 'object',
|
|
131
|
-
additionalProperties: false,
|
|
132
|
-
properties: {
|
|
133
|
-
summary: { type: 'string' },
|
|
134
|
-
patch: { type: 'string' },
|
|
135
|
-
proof: { type: 'object' }
|
|
136
|
-
},
|
|
137
|
-
required: ['summary', 'patch', 'proof']
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
blockers: []
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
name,
|
|
146
|
-
mode: GLM_SPEED_MODE,
|
|
147
|
-
stream: GLM_SPEED_PROFILE.stream,
|
|
148
|
-
max_tokens: GLM_SPEED_PROFILE.max_tokens,
|
|
149
|
-
temperature: GLM_SPEED_PROFILE.temperature,
|
|
150
|
-
top_p: GLM_SPEED_PROFILE.top_p,
|
|
151
|
-
tool_choice: GLM_SPEED_PROFILE.tool_choice,
|
|
152
|
-
parallel_tool_calls: GLM_SPEED_PROFILE.parallel_tool_calls,
|
|
153
|
-
provider: GLM_SPEED_PROFILE.provider,
|
|
154
|
-
reasoning_effort: GLM_SPEED_PROFILE.reasoning_effort,
|
|
155
|
-
stop: ['</sks_patch>'],
|
|
156
|
-
blockers: []
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
export function isValidOpenRouterProviderSlug(value) {
|
|
160
|
-
return /^(?!.*(?:^|\/)\.\.?(?:\/|$))[a-z0-9][a-z0-9._-]{0,63}(?:\/[a-z0-9][a-z0-9._-]{0,63}){0,3}$/i.test(value);
|
|
161
|
-
}
|
|
162
|
-
function isSelectableGlmReasoningEffort(value) {
|
|
163
|
-
return value === 'none' || value === 'minimal' || value === 'low' || value === 'medium' || value === 'high' || value === 'xhigh';
|
|
164
|
-
}
|
|
165
|
-
function isAllowedGlmSlashModel(value) {
|
|
166
|
-
const normalized = value.trim().toLowerCase();
|
|
167
|
-
return normalized === GLM_52_OPENROUTER_MODEL || normalized === 'glm-5.2' || normalized === 'glm5.2';
|
|
168
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const FAST_REASONING_ORDER = ['none', 'minimal', 'low'];
|
|
2
|
-
export function buildFastReasoningConfig(meta = null) {
|
|
3
|
-
if (meta?.mandatory === true)
|
|
4
|
-
return { exclude: true };
|
|
5
|
-
const supported = new Set(meta?.supported_efforts || []);
|
|
6
|
-
for (const effort of FAST_REASONING_ORDER) {
|
|
7
|
-
if (supported.has(effort))
|
|
8
|
-
return { effort, exclude: true };
|
|
9
|
-
}
|
|
10
|
-
return { exclude: true };
|
|
11
|
-
}
|
|
12
|
-
export function buildDeepReasoningConfig(effort) {
|
|
13
|
-
return { effort, exclude: true };
|
|
14
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { nowIso, randomId, writeJsonAtomic } from '../../fsx.js';
|
|
3
|
-
import { GLM_SPEED_LIMITS } from './glm-run-timeout.js';
|
|
4
|
-
import { isGlmTerminalPhase } from './glm-run-state.js';
|
|
5
|
-
export function createGlmRunController(input = {}) {
|
|
6
|
-
const clock = input.now || nowIso;
|
|
7
|
-
const startedAt = clock();
|
|
8
|
-
const startedMs = Date.now();
|
|
9
|
-
let state = {
|
|
10
|
-
run_id: input.runId || `glm-${startedAt.replace(/[:.]/g, '-')}-${randomId(6)}`,
|
|
11
|
-
...(input.missionId ? { mission_id: input.missionId } : {}),
|
|
12
|
-
phase: 'idle',
|
|
13
|
-
started_at: startedAt,
|
|
14
|
-
updated_at: startedAt,
|
|
15
|
-
turn_count: 0,
|
|
16
|
-
tool_round_count: 0,
|
|
17
|
-
no_progress_count: 0,
|
|
18
|
-
repeated_output_count: 0,
|
|
19
|
-
terminal: false
|
|
20
|
-
};
|
|
21
|
-
const limits = input.limits || GLM_SPEED_LIMITS;
|
|
22
|
-
return {
|
|
23
|
-
state: () => state,
|
|
24
|
-
transition: (phase, reason) => {
|
|
25
|
-
if (state.terminal || isGlmTerminalPhase(state.phase))
|
|
26
|
-
return state;
|
|
27
|
-
state = {
|
|
28
|
-
...state,
|
|
29
|
-
phase,
|
|
30
|
-
updated_at: clock(),
|
|
31
|
-
terminal: isGlmTerminalPhase(phase),
|
|
32
|
-
...(reason ? { terminal_reason: reason } : {})
|
|
33
|
-
};
|
|
34
|
-
return state;
|
|
35
|
-
},
|
|
36
|
-
terminate: (phase, reason, blockers = [], warnings = []) => {
|
|
37
|
-
state = {
|
|
38
|
-
...state,
|
|
39
|
-
phase,
|
|
40
|
-
updated_at: clock(),
|
|
41
|
-
terminal: true,
|
|
42
|
-
terminal_reason: reason
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
schema: 'sks.glm-run-termination.v1',
|
|
46
|
-
run_id: state.run_id,
|
|
47
|
-
terminal: true,
|
|
48
|
-
phase,
|
|
49
|
-
reason,
|
|
50
|
-
turn_count: state.turn_count,
|
|
51
|
-
wall_clock_ms: Math.min(Date.now() - startedMs, limits.max_wall_clock_ms),
|
|
52
|
-
blockers,
|
|
53
|
-
warnings
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export async function writeGlmRunArtifacts(input) {
|
|
59
|
-
const dir = path.join(input.cwd, '.sneakoscope', 'glm', 'runs', input.state.run_id);
|
|
60
|
-
await writeJsonAtomic(path.join(dir, 'run-state.json'), input.state);
|
|
61
|
-
await writeJsonAtomic(path.join(dir, 'termination.json'), input.termination);
|
|
62
|
-
await writeJsonAtomic(path.join(dir, 'loop-guard.json'), input.loopGuard || { schema: 'sks.glm-loop-guard.v1', ok: true });
|
|
63
|
-
await writeJsonAtomic(path.join(dir, 'context-omissions.json'), input.contextOmissions || { omitted: [] });
|
|
64
|
-
return dir;
|
|
65
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const GLM_SPEED_LIMITS = {
|
|
2
|
-
max_turns: 2,
|
|
3
|
-
max_tool_rounds: 0,
|
|
4
|
-
max_wall_clock_ms: 90_000,
|
|
5
|
-
request_timeout_ms: 45_000,
|
|
6
|
-
idle_timeout_ms: 15_000,
|
|
7
|
-
max_no_progress_iterations: 1,
|
|
8
|
-
max_repeated_output: 1,
|
|
9
|
-
max_patch_retries: 1,
|
|
10
|
-
max_context_requests: 1
|
|
11
|
-
};
|
|
12
|
-
export const GLM_DEEP_LIMITS = {
|
|
13
|
-
max_turns: 4,
|
|
14
|
-
max_tool_rounds: 4,
|
|
15
|
-
max_wall_clock_ms: 240_000,
|
|
16
|
-
request_timeout_ms: 120_000,
|
|
17
|
-
idle_timeout_ms: 30_000,
|
|
18
|
-
max_no_progress_iterations: 2,
|
|
19
|
-
max_repeated_output: 2,
|
|
20
|
-
max_patch_retries: 2,
|
|
21
|
-
max_context_requests: 2
|
|
22
|
-
};
|
|
23
|
-
export function createRequestAbortController(timeoutMs) {
|
|
24
|
-
const controller = new AbortController();
|
|
25
|
-
const timeout = setTimeout(() => controller.abort(), Math.max(1, timeoutMs));
|
|
26
|
-
return {
|
|
27
|
-
controller,
|
|
28
|
-
clear: () => clearTimeout(timeout)
|
|
29
|
-
};
|
|
30
|
-
}
|