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,421 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
|
-
import { nowIso } from '../../../fsx.js';
|
|
3
|
-
import { GLM_52_OPENROUTER_MODEL } from '../glm-52-settings.js';
|
|
4
|
-
import { buildGlm52Request } from '../glm-52-request.js';
|
|
5
|
-
import { sendOpenRouterChatCompletionStream } from '../../openrouter/openrouter-stream.js';
|
|
6
|
-
import { assertGlm52ActualModel } from '../glm-52-response-guard.js';
|
|
7
|
-
import { encodeGlmRequestWithCache } from '../glm-request-cache.js';
|
|
8
|
-
import { parsePatchCandidateOutput, createPatchEnvelope, digestPatch } from './glm-naruto-patch-envelope.js';
|
|
9
|
-
import { parseGlmNarutoVerifierOutput } from './glm-naruto-verifier-output.js';
|
|
10
|
-
import { writeGlmNarutoWorkerArtifacts } from './glm-naruto-worker-artifacts.js';
|
|
11
|
-
import { extractGlmNarutoUsageMetrics } from './glm-naruto-usage-extractor.js';
|
|
12
|
-
import { normalizeGlmNarutoSessionId } from './glm-naruto-session-id.js';
|
|
13
|
-
const STABLE_SYSTEM_PREFIX = `You are a SKS GLM Naruto patch worker. Model lock: ${GLM_52_OPENROUTER_MODEL}. No GPT/OpenAI fallback allowed. Output only <sks_patch_candidate>, <sks_need_context>, or <sks_blocked> envelopes. Use unified diff format for patches. Never write to main workspace directly. Follow proof-first mutation rules.`;
|
|
14
|
-
export async function runPatchWorker(input) {
|
|
15
|
-
const started = Date.now();
|
|
16
|
-
const artifactRoot = input.root ?? process.cwd();
|
|
17
|
-
const sessionId = normalizeGlmNarutoSessionId(`sks-glm-naruto-${input.missionId}-${input.workerId}`);
|
|
18
|
-
const reasoningEffort = input.shard.reasoning;
|
|
19
|
-
const shardSuffix = JSON.stringify({
|
|
20
|
-
shard_id: input.shard.id,
|
|
21
|
-
task: input.shard.task,
|
|
22
|
-
target_paths: input.shard.target_paths,
|
|
23
|
-
forbidden_paths: input.shard.forbidden_paths,
|
|
24
|
-
base_digest: input.shard.base_digest,
|
|
25
|
-
strategy: input.shard.strategy,
|
|
26
|
-
context: input.contextSummary,
|
|
27
|
-
output_requirement: 'Produce a unified diff patch inside <sks_patch_candidate> tags with summary, target_paths, base_digest, strategy, and patch fields.'
|
|
28
|
-
});
|
|
29
|
-
const messages = [
|
|
30
|
-
{ role: 'system', content: STABLE_SYSTEM_PREFIX },
|
|
31
|
-
{ role: 'user', content: shardSuffix }
|
|
32
|
-
];
|
|
33
|
-
const request = buildGlm52Request({
|
|
34
|
-
profile: 'speed',
|
|
35
|
-
messages,
|
|
36
|
-
maxTokens: input.shard.max_tokens,
|
|
37
|
-
toolChoice: 'none',
|
|
38
|
-
parallelToolCalls: false,
|
|
39
|
-
providerSort: 'throughput'
|
|
40
|
-
});
|
|
41
|
-
const requestWithSession = { ...request, session_id: sessionId };
|
|
42
|
-
const stablePrefixDigest = crypto.createHash('sha256').update(STABLE_SYSTEM_PREFIX).digest('hex');
|
|
43
|
-
const shardSuffixDigest = crypto.createHash('sha256').update(shardSuffix).digest('hex');
|
|
44
|
-
const cacheKeyParts = {
|
|
45
|
-
model: requestWithSession.model,
|
|
46
|
-
profile: 'glm-naruto-worker-speed',
|
|
47
|
-
stable_prefix_digest: stablePrefixDigest,
|
|
48
|
-
shard_suffix_digest: shardSuffixDigest,
|
|
49
|
-
tools_digest: requestWithSession.tools ? crypto.createHash('sha256').update(JSON.stringify(requestWithSession.tools)).digest('hex') : null,
|
|
50
|
-
response_format_digest: requestWithSession.response_format ? crypto.createHash('sha256').update(JSON.stringify(requestWithSession.response_format)).digest('hex') : null,
|
|
51
|
-
provider_digest: crypto.createHash('sha256').update(JSON.stringify(requestWithSession.provider ?? null)).digest('hex'),
|
|
52
|
-
session_id: sessionId
|
|
53
|
-
};
|
|
54
|
-
const encoded = encodeGlmRequestWithCache({ request: requestWithSession, cacheKeyParts });
|
|
55
|
-
await writeGlmNarutoWorkerArtifacts({
|
|
56
|
-
root: artifactRoot,
|
|
57
|
-
missionId: input.missionId,
|
|
58
|
-
workerId: input.workerId,
|
|
59
|
-
shardId: input.shard.id,
|
|
60
|
-
requestSummary: {
|
|
61
|
-
model: requestWithSession.model,
|
|
62
|
-
provider: 'openrouter',
|
|
63
|
-
session_id: sessionId,
|
|
64
|
-
request_body_sha256: encoded.entry.bodySha256,
|
|
65
|
-
request_body_size: encoded.entry.byteLength,
|
|
66
|
-
request_body_stored: encoded.entry.bodyStored,
|
|
67
|
-
cache_hit: encoded.cacheHit,
|
|
68
|
-
gpt_fallback_allowed: false,
|
|
69
|
-
fallback_models_count: Array.isArray(requestWithSession.models) ? requestWithSession.models?.length ?? 0 : 0,
|
|
70
|
-
openai_key_used: false,
|
|
71
|
-
authorization_source: 'openrouter',
|
|
72
|
-
stable_prefix_digest: stablePrefixDigest,
|
|
73
|
-
shard_suffix_digest: shardSuffixDigest
|
|
74
|
-
}
|
|
75
|
-
}).catch(() => undefined);
|
|
76
|
-
const traceBase = {
|
|
77
|
-
worker_id: input.workerId,
|
|
78
|
-
shard_id: input.shard.id,
|
|
79
|
-
strategy: input.shard.strategy,
|
|
80
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
81
|
-
provider: 'openrouter',
|
|
82
|
-
provider_slug: 'openrouter',
|
|
83
|
-
session_id: sessionId,
|
|
84
|
-
ttft_ms: null,
|
|
85
|
-
total_ms: 0,
|
|
86
|
-
request_cache_hit: encoded.cacheHit,
|
|
87
|
-
output_digest: crypto.createHash('sha256').update(shardSuffix).digest('hex'),
|
|
88
|
-
patch_digest: null,
|
|
89
|
-
status: 'running'
|
|
90
|
-
};
|
|
91
|
-
try {
|
|
92
|
-
const response = await sendOpenRouterChatCompletionStream({
|
|
93
|
-
apiKey: input.apiKey,
|
|
94
|
-
request: requestWithSession,
|
|
95
|
-
timeoutMs: input.timeoutMs,
|
|
96
|
-
idleTimeoutMs: 60_000,
|
|
97
|
-
cacheKeyParts,
|
|
98
|
-
...(input.fetchImpl ? { fetchImpl: input.fetchImpl } : {})
|
|
99
|
-
});
|
|
100
|
-
if (!response.ok) {
|
|
101
|
-
const issue = classifyWorkerIssue(response.error);
|
|
102
|
-
const trace = { ...traceBase, total_ms: Date.now() - started, status: 'failed', chunk_count: 0, real_stream: false };
|
|
103
|
-
await writeGlmNarutoWorkerArtifacts({
|
|
104
|
-
root: artifactRoot,
|
|
105
|
-
missionId: input.missionId,
|
|
106
|
-
workerId: input.workerId,
|
|
107
|
-
shardId: input.shard.id,
|
|
108
|
-
streamTrace: trace,
|
|
109
|
-
termination: { status: 'failed', ok: false, error: response.error.code }
|
|
110
|
-
}).catch(() => undefined);
|
|
111
|
-
return {
|
|
112
|
-
envelope: null,
|
|
113
|
-
trace,
|
|
114
|
-
ok: false,
|
|
115
|
-
error: response.error.code,
|
|
116
|
-
issue
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
const modelGuard = assertGlm52ActualModel(response.value.model);
|
|
120
|
-
if (!modelGuard.ok) {
|
|
121
|
-
const usage = extractGlmNarutoUsageMetrics(response.value.usage);
|
|
122
|
-
const trace = { ...traceBase, ...usage, ttft_ms: response.value.ttft_ms, total_ms: Date.now() - started, status: 'blocked', chunk_count: response.value.chunk_count, real_stream: response.value.real_stream, request_cache_hit: response.value.request_cache_hit ?? traceBase.request_cache_hit };
|
|
123
|
-
await writeGlmNarutoWorkerArtifacts({
|
|
124
|
-
root: artifactRoot,
|
|
125
|
-
missionId: input.missionId,
|
|
126
|
-
workerId: input.workerId,
|
|
127
|
-
shardId: input.shard.id,
|
|
128
|
-
streamTrace: trace,
|
|
129
|
-
termination: { status: 'blocked', ok: false, error: `model_guard:${modelGuard.code}` }
|
|
130
|
-
}).catch(() => undefined);
|
|
131
|
-
return {
|
|
132
|
-
envelope: null,
|
|
133
|
-
trace,
|
|
134
|
-
ok: false,
|
|
135
|
-
error: `model_guard:${modelGuard.code}`,
|
|
136
|
-
issue: { code: `model_guard:${modelGuard.code}`, retryable: false }
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
const parsed = parsePatchCandidateOutput(response.value.content);
|
|
140
|
-
if (parsed.kind !== 'patch') {
|
|
141
|
-
const trace = {
|
|
142
|
-
...traceBase,
|
|
143
|
-
...extractGlmNarutoUsageMetrics(response.value.usage),
|
|
144
|
-
ttft_ms: response.value.ttft_ms,
|
|
145
|
-
total_ms: Date.now() - started,
|
|
146
|
-
chunk_count: response.value.chunk_count,
|
|
147
|
-
real_stream: response.value.real_stream,
|
|
148
|
-
request_cache_hit: response.value.request_cache_hit ?? traceBase.request_cache_hit,
|
|
149
|
-
status: parsed.kind === 'blocked' ? 'blocked' : 'no_patch'
|
|
150
|
-
};
|
|
151
|
-
await writeGlmNarutoWorkerArtifacts({
|
|
152
|
-
root: artifactRoot,
|
|
153
|
-
missionId: input.missionId,
|
|
154
|
-
workerId: input.workerId,
|
|
155
|
-
shardId: input.shard.id,
|
|
156
|
-
streamTrace: trace,
|
|
157
|
-
termination: { status: trace.status, ok: false, error: parsed.kind }
|
|
158
|
-
}).catch(() => undefined);
|
|
159
|
-
return {
|
|
160
|
-
envelope: null,
|
|
161
|
-
trace,
|
|
162
|
-
ok: false,
|
|
163
|
-
error: parsed.kind,
|
|
164
|
-
issue: { code: parsed.kind, retryable: false }
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
const envelope = createPatchEnvelope({
|
|
168
|
-
missionId: input.missionId,
|
|
169
|
-
workerId: input.workerId,
|
|
170
|
-
shardId: input.shard.id,
|
|
171
|
-
baseDigest: input.shard.base_digest,
|
|
172
|
-
patch: parsed.content,
|
|
173
|
-
strategy: input.shard.strategy,
|
|
174
|
-
reasoningEffort
|
|
175
|
-
});
|
|
176
|
-
const trace = {
|
|
177
|
-
...traceBase,
|
|
178
|
-
...extractGlmNarutoUsageMetrics(response.value.usage),
|
|
179
|
-
ttft_ms: response.value.ttft_ms,
|
|
180
|
-
total_ms: Date.now() - started,
|
|
181
|
-
chunk_count: response.value.chunk_count,
|
|
182
|
-
real_stream: response.value.real_stream,
|
|
183
|
-
request_cache_hit: response.value.request_cache_hit ?? traceBase.request_cache_hit,
|
|
184
|
-
patch_digest: digestPatch(envelope.patch),
|
|
185
|
-
status: 'completed'
|
|
186
|
-
};
|
|
187
|
-
await writeGlmNarutoWorkerArtifacts({
|
|
188
|
-
root: artifactRoot,
|
|
189
|
-
missionId: input.missionId,
|
|
190
|
-
workerId: input.workerId,
|
|
191
|
-
shardId: input.shard.id,
|
|
192
|
-
streamTrace: trace,
|
|
193
|
-
patchEnvelope: envelope,
|
|
194
|
-
gateResult: {
|
|
195
|
-
schema: 'sks.glm-naruto-worker-gate-result.v1',
|
|
196
|
-
worker_id: input.workerId,
|
|
197
|
-
shard_id: input.shard.id,
|
|
198
|
-
status: 'pending_orchestrator_gate',
|
|
199
|
-
ok: false,
|
|
200
|
-
reason: 'deterministic_gate_runs_in_orchestrator_with_repo_cwd'
|
|
201
|
-
},
|
|
202
|
-
termination: { status: 'completed', ok: true }
|
|
203
|
-
}).catch(() => undefined);
|
|
204
|
-
return { envelope, trace, ok: true };
|
|
205
|
-
}
|
|
206
|
-
catch (err) {
|
|
207
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
208
|
-
const trace = { ...traceBase, total_ms: Date.now() - started, status: 'failed', chunk_count: 0, real_stream: false };
|
|
209
|
-
await writeGlmNarutoWorkerArtifacts({
|
|
210
|
-
root: artifactRoot,
|
|
211
|
-
missionId: input.missionId,
|
|
212
|
-
workerId: input.workerId,
|
|
213
|
-
shardId: input.shard.id,
|
|
214
|
-
streamTrace: trace,
|
|
215
|
-
termination: { status: 'failed', ok: false, error: err instanceof Error ? err.message : String(err) }
|
|
216
|
-
}).catch(() => undefined);
|
|
217
|
-
return {
|
|
218
|
-
envelope: null,
|
|
219
|
-
trace,
|
|
220
|
-
ok: false,
|
|
221
|
-
error: message,
|
|
222
|
-
issue: classifyWorkerIssue({ code: message, message, severity: 'failed' })
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function classifyWorkerIssue(issue) {
|
|
227
|
-
const code = String(issue.code || 'glm_worker_failed');
|
|
228
|
-
const status = typeof issue.status === 'number' ? issue.status : undefined;
|
|
229
|
-
const retryable = code === 'glm_openrouter_rate_limited'
|
|
230
|
-
|| status === 429
|
|
231
|
-
|| (typeof status === 'number' && status >= 500)
|
|
232
|
-
|| code === 'glm_openrouter_provider_unavailable'
|
|
233
|
-
|| code === 'glm_stream_idle_timeout'
|
|
234
|
-
|| code === 'glm_request_timeout';
|
|
235
|
-
return {
|
|
236
|
-
code,
|
|
237
|
-
retryable,
|
|
238
|
-
...(status !== undefined ? { provider_status: status } : {}),
|
|
239
|
-
retry_after_ms: null
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
export async function runVerifierWorker(input) {
|
|
243
|
-
const started = Date.now();
|
|
244
|
-
const sessionId = normalizeGlmNarutoSessionId(`sks-glm-naruto-verify-${input.missionId}-${input.workerId}`);
|
|
245
|
-
const messages = [
|
|
246
|
-
{ role: 'system', content: `You are a SKS GLM Naruto verifier. Model: ${GLM_52_OPENROUTER_MODEL}. No GPT fallback. Return only JSON with schema "sks.glm-naruto-verifier-output.v1", ok boolean, issues string array, risk_score number 0..1, confidence number 0..1, requirements_satisfied string array, requirements_missing string array, and detail_loss_risks string array. Do not include markdown.` },
|
|
247
|
-
{ role: 'user', content: JSON.stringify({ patch_sha256: input.envelope.patch_sha256, target_paths: input.envelope.target_paths, requirements_satisfied: input.envelope.requirements_satisfied ?? [], requirements_risk: input.envelope.requirements_risk ?? [], patch: input.envelope.patch.slice(0, 4000) }) }
|
|
248
|
-
];
|
|
249
|
-
const request = buildGlm52Request({
|
|
250
|
-
profile: 'speed',
|
|
251
|
-
messages,
|
|
252
|
-
maxTokens: 2048,
|
|
253
|
-
toolChoice: 'none',
|
|
254
|
-
parallelToolCalls: false,
|
|
255
|
-
providerSort: 'throughput'
|
|
256
|
-
});
|
|
257
|
-
const requestWithSession = { ...request, session_id: sessionId };
|
|
258
|
-
const cacheKeyParts = {
|
|
259
|
-
model: requestWithSession.model,
|
|
260
|
-
profile: 'glm-naruto-verifier-speed',
|
|
261
|
-
stable_prefix_digest: crypto.createHash('sha256').update(messages[0].content).digest('hex'),
|
|
262
|
-
shard_suffix_digest: crypto.createHash('sha256').update(messages[1].content).digest('hex'),
|
|
263
|
-
tools_digest: null,
|
|
264
|
-
response_format_digest: requestWithSession.response_format ? crypto.createHash('sha256').update(JSON.stringify(requestWithSession.response_format)).digest('hex') : null,
|
|
265
|
-
provider_digest: crypto.createHash('sha256').update(JSON.stringify(requestWithSession.provider ?? null)).digest('hex'),
|
|
266
|
-
session_id: sessionId
|
|
267
|
-
};
|
|
268
|
-
try {
|
|
269
|
-
const response = await sendOpenRouterChatCompletionStream({
|
|
270
|
-
apiKey: input.apiKey,
|
|
271
|
-
request: requestWithSession,
|
|
272
|
-
timeoutMs: input.timeoutMs,
|
|
273
|
-
idleTimeoutMs: 60_000,
|
|
274
|
-
cacheKeyParts,
|
|
275
|
-
...(input.fetchImpl ? { fetchImpl: input.fetchImpl } : {})
|
|
276
|
-
});
|
|
277
|
-
if (!response.ok) {
|
|
278
|
-
return {
|
|
279
|
-
ok: false,
|
|
280
|
-
trace: {
|
|
281
|
-
worker_id: input.workerId,
|
|
282
|
-
shard_id: input.envelope.shard_id,
|
|
283
|
-
strategy: 'minimal_patch',
|
|
284
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
285
|
-
provider: 'openrouter',
|
|
286
|
-
provider_slug: 'openrouter',
|
|
287
|
-
session_id: sessionId,
|
|
288
|
-
ttft_ms: null,
|
|
289
|
-
total_ms: Date.now() - started,
|
|
290
|
-
request_cache_hit: false,
|
|
291
|
-
output_digest: '',
|
|
292
|
-
patch_digest: input.envelope.patch_sha256,
|
|
293
|
-
status: 'failed'
|
|
294
|
-
},
|
|
295
|
-
issues: [response.error.code]
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
const modelGuard = assertGlm52ActualModel(response.value.model);
|
|
299
|
-
const usageMetrics = extractGlmNarutoUsageMetrics(response.value.usage);
|
|
300
|
-
if (!modelGuard.ok) {
|
|
301
|
-
return {
|
|
302
|
-
ok: false,
|
|
303
|
-
trace: {
|
|
304
|
-
worker_id: input.workerId,
|
|
305
|
-
shard_id: input.envelope.shard_id,
|
|
306
|
-
strategy: 'minimal_patch',
|
|
307
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
308
|
-
provider: 'openrouter',
|
|
309
|
-
provider_slug: 'openrouter',
|
|
310
|
-
session_id: sessionId,
|
|
311
|
-
...usageMetrics,
|
|
312
|
-
ttft_ms: response.value.ttft_ms,
|
|
313
|
-
total_ms: Date.now() - started,
|
|
314
|
-
chunk_count: response.value.chunk_count,
|
|
315
|
-
real_stream: response.value.real_stream,
|
|
316
|
-
request_cache_hit: response.value.request_cache_hit ?? false,
|
|
317
|
-
output_digest: crypto.createHash('sha256').update(response.value.content).digest('hex'),
|
|
318
|
-
patch_digest: input.envelope.patch_sha256,
|
|
319
|
-
status: 'verification_failed'
|
|
320
|
-
},
|
|
321
|
-
issues: [`model_guard:${modelGuard.code}`]
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
const parsed = parseGlmNarutoVerifierOutput(response.value.content);
|
|
325
|
-
if (!parsed.ok || !parsed.output) {
|
|
326
|
-
return {
|
|
327
|
-
ok: false,
|
|
328
|
-
trace: {
|
|
329
|
-
worker_id: input.workerId,
|
|
330
|
-
shard_id: input.envelope.shard_id,
|
|
331
|
-
strategy: 'minimal_patch',
|
|
332
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
333
|
-
provider: 'openrouter',
|
|
334
|
-
provider_slug: 'openrouter',
|
|
335
|
-
session_id: sessionId,
|
|
336
|
-
...usageMetrics,
|
|
337
|
-
ttft_ms: response.value.ttft_ms,
|
|
338
|
-
total_ms: Date.now() - started,
|
|
339
|
-
chunk_count: response.value.chunk_count,
|
|
340
|
-
real_stream: response.value.real_stream,
|
|
341
|
-
request_cache_hit: response.value.request_cache_hit ?? false,
|
|
342
|
-
output_digest: crypto.createHash('sha256').update(response.value.content).digest('hex'),
|
|
343
|
-
patch_digest: input.envelope.patch_sha256,
|
|
344
|
-
status: 'verification_failed'
|
|
345
|
-
},
|
|
346
|
-
issues: parsed.issues
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
if (!parsed.output.ok) {
|
|
350
|
-
return {
|
|
351
|
-
ok: false,
|
|
352
|
-
trace: {
|
|
353
|
-
worker_id: input.workerId,
|
|
354
|
-
shard_id: input.envelope.shard_id,
|
|
355
|
-
strategy: 'minimal_patch',
|
|
356
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
357
|
-
provider: 'openrouter',
|
|
358
|
-
provider_slug: 'openrouter',
|
|
359
|
-
session_id: sessionId,
|
|
360
|
-
...usageMetrics,
|
|
361
|
-
ttft_ms: response.value.ttft_ms,
|
|
362
|
-
total_ms: Date.now() - started,
|
|
363
|
-
chunk_count: response.value.chunk_count,
|
|
364
|
-
real_stream: response.value.real_stream,
|
|
365
|
-
request_cache_hit: response.value.request_cache_hit ?? false,
|
|
366
|
-
output_digest: crypto.createHash('sha256').update(response.value.content).digest('hex'),
|
|
367
|
-
patch_digest: input.envelope.patch_sha256,
|
|
368
|
-
status: 'verification_failed',
|
|
369
|
-
verifier_risk_score: parsed.output.risk_score,
|
|
370
|
-
verifier_confidence: parsed.output.confidence
|
|
371
|
-
},
|
|
372
|
-
issues: parsed.output.issues
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
return {
|
|
376
|
-
ok: true,
|
|
377
|
-
trace: {
|
|
378
|
-
worker_id: input.workerId,
|
|
379
|
-
shard_id: input.envelope.shard_id,
|
|
380
|
-
strategy: 'minimal_patch',
|
|
381
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
382
|
-
provider: 'openrouter',
|
|
383
|
-
provider_slug: 'openrouter',
|
|
384
|
-
session_id: sessionId,
|
|
385
|
-
...usageMetrics,
|
|
386
|
-
ttft_ms: response.value.ttft_ms,
|
|
387
|
-
total_ms: Date.now() - started,
|
|
388
|
-
chunk_count: response.value.chunk_count,
|
|
389
|
-
real_stream: response.value.real_stream,
|
|
390
|
-
request_cache_hit: response.value.request_cache_hit ?? false,
|
|
391
|
-
output_digest: crypto.createHash('sha256').update(response.value.content).digest('hex'),
|
|
392
|
-
patch_digest: input.envelope.patch_sha256,
|
|
393
|
-
status: 'verification_passed',
|
|
394
|
-
verifier_risk_score: parsed.output.risk_score,
|
|
395
|
-
verifier_confidence: parsed.output.confidence
|
|
396
|
-
},
|
|
397
|
-
issues: []
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
catch (err) {
|
|
401
|
-
return {
|
|
402
|
-
ok: false,
|
|
403
|
-
trace: {
|
|
404
|
-
worker_id: input.workerId,
|
|
405
|
-
shard_id: input.envelope.shard_id,
|
|
406
|
-
strategy: 'minimal_patch',
|
|
407
|
-
model: GLM_52_OPENROUTER_MODEL,
|
|
408
|
-
provider: 'openrouter',
|
|
409
|
-
provider_slug: 'openrouter',
|
|
410
|
-
session_id: sessionId,
|
|
411
|
-
ttft_ms: null,
|
|
412
|
-
total_ms: Date.now() - started,
|
|
413
|
-
request_cache_hit: false,
|
|
414
|
-
output_digest: '',
|
|
415
|
-
patch_digest: input.envelope.patch_sha256,
|
|
416
|
-
status: 'failed'
|
|
417
|
-
},
|
|
418
|
-
issues: [err instanceof Error ? err.message : String(err)]
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { nowIso } from '../../../fsx.js';
|
|
2
|
-
import { decideConcurrency } from './glm-naruto-concurrency-governor.js';
|
|
3
|
-
export async function runGlmNarutoWorkerScheduler(input) {
|
|
4
|
-
const queue = input.jobs.map((job) => ({ job, attempt: 0 }));
|
|
5
|
-
const running = new Map();
|
|
6
|
-
const results = [];
|
|
7
|
-
const decisions = [];
|
|
8
|
-
const retryEvents = [];
|
|
9
|
-
const backpressureRecords = [];
|
|
10
|
-
const maxActive = Math.max(1, input.max_active_workers);
|
|
11
|
-
let targetActive = Math.max(1, Math.min(maxActive, input.initial_active_workers || 1));
|
|
12
|
-
let nextRunKey = 0;
|
|
13
|
-
let maxObservedActive = 0;
|
|
14
|
-
let backpressureEvents = 0;
|
|
15
|
-
let failureCount = 0;
|
|
16
|
-
let finishedCount = 0;
|
|
17
|
-
let pauseUntilMs = 0;
|
|
18
|
-
await recordDecision('initial');
|
|
19
|
-
while (queue.length > 0 || running.size > 0) {
|
|
20
|
-
const now = Date.now();
|
|
21
|
-
if (pauseUntilMs > now && running.size === 0) {
|
|
22
|
-
await sleep(Math.min(1_000, pauseUntilMs - now));
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
while (queue.length > 0 && running.size < targetActive && Date.now() >= pauseUntilMs) {
|
|
26
|
-
const entry = queue.shift();
|
|
27
|
-
const key = nextRunKey++;
|
|
28
|
-
running.set(key, runTimedJob(key, entry, input));
|
|
29
|
-
maxObservedActive = Math.max(maxObservedActive, running.size);
|
|
30
|
-
}
|
|
31
|
-
if (running.size === 0) {
|
|
32
|
-
if (queue.length > 0) {
|
|
33
|
-
targetActive = Math.max(1, targetActive);
|
|
34
|
-
pauseUntilMs = Math.min(pauseUntilMs || Date.now(), Date.now());
|
|
35
|
-
}
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const completed = await Promise.race([...running.values()]);
|
|
39
|
-
running.delete(completed.key);
|
|
40
|
-
finishedCount++;
|
|
41
|
-
const issue = issueFromSettled(completed.settled);
|
|
42
|
-
if (completed.settled.status === 'rejected' || (completed.settled.status === 'fulfilled' && !completed.settled.value.ok)) {
|
|
43
|
-
failureCount++;
|
|
44
|
-
}
|
|
45
|
-
updateProviderHealth(input.health, completed.settled);
|
|
46
|
-
if (issue && shouldBackoff(issue)) {
|
|
47
|
-
backpressureEvents++;
|
|
48
|
-
const pauseMs = backoffMs(issue);
|
|
49
|
-
pauseUntilMs = Math.max(pauseUntilMs, Date.now() + pauseMs);
|
|
50
|
-
backpressureRecords.push({
|
|
51
|
-
schema: 'sks.glm-naruto-provider-backpressure.v1',
|
|
52
|
-
created_at: nowIso(),
|
|
53
|
-
worker_id: completed.entry.job.worker_id,
|
|
54
|
-
attempt: completed.entry.attempt,
|
|
55
|
-
code: issue.code,
|
|
56
|
-
provider_status: issue.provider_status ?? null,
|
|
57
|
-
retry_after_ms: issue.retry_after_ms ?? null,
|
|
58
|
-
pause_ms: pauseMs
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (shouldRetry(completed.entry, completed.settled, issue)) {
|
|
62
|
-
const retryEntry = { job: completed.entry.job, attempt: completed.entry.attempt + 1 };
|
|
63
|
-
retryEvents.push({
|
|
64
|
-
schema: 'sks.glm-naruto-worker-retry.v1',
|
|
65
|
-
created_at: nowIso(),
|
|
66
|
-
worker_id: completed.entry.job.worker_id,
|
|
67
|
-
shard_id: completed.entry.job.shard.id,
|
|
68
|
-
next_attempt: retryEntry.attempt,
|
|
69
|
-
code: issue?.code ?? 'worker_scheduler_rejected'
|
|
70
|
-
});
|
|
71
|
-
queue.push(retryEntry);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
results.push(completed.settled);
|
|
75
|
-
}
|
|
76
|
-
await recordDecision(issue?.code ?? 'worker_finished');
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
results,
|
|
80
|
-
decisions,
|
|
81
|
-
max_observed_active_workers: maxObservedActive,
|
|
82
|
-
backpressure_events: backpressureEvents,
|
|
83
|
-
retry_events: retryEvents,
|
|
84
|
-
backpressure_records: backpressureRecords
|
|
85
|
-
};
|
|
86
|
-
async function recordDecision(reasonSuffix) {
|
|
87
|
-
const health = input.health.getHealth();
|
|
88
|
-
const decision = decideConcurrency({
|
|
89
|
-
requestedWorkers: maxActive,
|
|
90
|
-
activeWorkers: targetActive,
|
|
91
|
-
rateLimited429: health?.count_429 ?? 0,
|
|
92
|
-
ttftP90Ms: health?.p90_ttft_ms ?? 0,
|
|
93
|
-
failureRate: finishedCount ? failureCount / finishedCount : 0,
|
|
94
|
-
operatorMax: maxActive
|
|
95
|
-
});
|
|
96
|
-
targetActive = Math.max(running.size > 0 ? 1 : 0, Math.min(maxActive, decision.target_active_workers));
|
|
97
|
-
if (targetActive === 0 && queue.length > 0 && running.size === 0)
|
|
98
|
-
targetActive = 1;
|
|
99
|
-
const recorded = { ...decision, reason: `${decision.reason}:${reasonSuffix}` };
|
|
100
|
-
decisions.push(recorded);
|
|
101
|
-
if (recorded.backpressure)
|
|
102
|
-
backpressureEvents++;
|
|
103
|
-
await input.onDecision(recorded);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
async function runTimedJob(key, entry, input) {
|
|
107
|
-
try {
|
|
108
|
-
const value = await withTimeout(input.runJob(entry.job), input.worker_timeout_ms);
|
|
109
|
-
return { key, entry, settled: { status: 'fulfilled', value } };
|
|
110
|
-
}
|
|
111
|
-
catch (reason) {
|
|
112
|
-
return { key, entry, settled: { status: 'rejected', reason } };
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function updateProviderHealth(health, settled) {
|
|
116
|
-
if (settled.status !== 'fulfilled') {
|
|
117
|
-
health.record({ provider_slug: 'openrouter', model: 'z-ai/glm-5.2', count_5xx: 1, last_failure: nowIso() });
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const issue = settled.value.issue;
|
|
121
|
-
const trace = settled.value.trace;
|
|
122
|
-
health.record({
|
|
123
|
-
provider_slug: trace.provider_slug || 'openrouter',
|
|
124
|
-
model: trace.model,
|
|
125
|
-
...(trace.ttft_ms !== null ? { p50_ttft_ms: trace.ttft_ms } : {}),
|
|
126
|
-
...(issue?.provider_status === 429 || issue?.code === 'glm_openrouter_rate_limited' ? { count_429: 1 } : {}),
|
|
127
|
-
...(typeof issue?.provider_status === 'number' && issue.provider_status >= 500 ? { count_5xx: 1 } : {}),
|
|
128
|
-
last_success: settled.value.ok ? nowIso() : null,
|
|
129
|
-
last_failure: settled.value.ok ? null : nowIso()
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function issueFromSettled(settled) {
|
|
133
|
-
if (settled.status === 'rejected') {
|
|
134
|
-
return { code: 'worker_scheduler_rejected', retryable: true, retry_after_ms: null };
|
|
135
|
-
}
|
|
136
|
-
return settled.value.issue ?? null;
|
|
137
|
-
}
|
|
138
|
-
function shouldRetry(entry, settled, issue) {
|
|
139
|
-
if (entry.attempt >= 1)
|
|
140
|
-
return false;
|
|
141
|
-
if (settled.status === 'rejected')
|
|
142
|
-
return true;
|
|
143
|
-
return settled.value.ok === false && issue?.retryable === true;
|
|
144
|
-
}
|
|
145
|
-
function shouldBackoff(issue) {
|
|
146
|
-
return issue.provider_status === 429
|
|
147
|
-
|| issue.code === 'glm_openrouter_rate_limited'
|
|
148
|
-
|| (typeof issue.provider_status === 'number' && issue.provider_status >= 500)
|
|
149
|
-
|| issue.code === 'glm_openrouter_provider_unavailable'
|
|
150
|
-
|| issue.code === 'glm_stream_idle_timeout'
|
|
151
|
-
|| issue.code === 'glm_request_timeout';
|
|
152
|
-
}
|
|
153
|
-
function backoffMs(issue) {
|
|
154
|
-
if (typeof issue.retry_after_ms === 'number' && Number.isFinite(issue.retry_after_ms) && issue.retry_after_ms > 0) {
|
|
155
|
-
return Math.min(30_000, issue.retry_after_ms);
|
|
156
|
-
}
|
|
157
|
-
if (issue.provider_status === 429 || issue.code === 'glm_openrouter_rate_limited')
|
|
158
|
-
return 1_000;
|
|
159
|
-
return 250;
|
|
160
|
-
}
|
|
161
|
-
function withTimeout(promise, timeoutMs) {
|
|
162
|
-
if (!timeoutMs || timeoutMs <= 0)
|
|
163
|
-
return promise;
|
|
164
|
-
let timer;
|
|
165
|
-
return Promise.race([
|
|
166
|
-
promise,
|
|
167
|
-
new Promise((_, reject) => {
|
|
168
|
-
timer = setTimeout(() => reject(new Error('worker_scheduler_timeout')), timeoutMs);
|
|
169
|
-
})
|
|
170
|
-
]).finally(() => {
|
|
171
|
-
if (timer)
|
|
172
|
-
clearTimeout(timer);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
function sleep(ms) {
|
|
176
|
-
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
177
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { runPatchWorker, runVerifierWorker } from './glm-naruto-worker-runtime.js';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { nowIso, writeJsonAtomic } from '../../../fsx.js';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { removeGlmNarutoWorkerWorktree } from './glm-naruto-worktree-manager.js';
|
|
4
|
-
export async function cleanupGlmNarutoWorktree(input) {
|
|
5
|
-
const result = input.cleanup
|
|
6
|
-
? await removeGlmNarutoWorkerWorktree(input.repoRoot, input.lease)
|
|
7
|
-
: { ok: false, error: null };
|
|
8
|
-
const record = {
|
|
9
|
-
schema: 'sks.glm-naruto-worktree-cleanup.v1',
|
|
10
|
-
worker_id: input.lease.worker_id,
|
|
11
|
-
worktree_path: input.lease.path,
|
|
12
|
-
cleanup_requested: input.cleanup,
|
|
13
|
-
removed: input.cleanup ? result.ok : false,
|
|
14
|
-
error: input.cleanup ? result.error ?? null : null,
|
|
15
|
-
created_at: nowIso()
|
|
16
|
-
};
|
|
17
|
-
await writeJsonAtomic(path.join(input.repoRoot, '.sneakoscope', 'glm-naruto', input.missionId, 'workers', input.lease.worker_id, 'worktree-cleanup.json'), record).catch(() => undefined);
|
|
18
|
-
return record;
|
|
19
|
-
}
|