sneakoscope 6.0.3 → 6.1.2
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 +29 -12
- package/config/codex-releases/{rust-v0.142.0.json → rust-v0.144.1.json} +6 -6
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/fast-inline.js +18 -14
- package/dist/bin/sks-dispatch.js +2 -4
- package/dist/cli/args.js +2 -0
- package/dist/cli/command-manifest-lite.js +2 -3
- package/dist/cli/command-registry.js +3 -4
- package/dist/cli/help-fast.js +1 -1
- package/dist/cli/install-helpers.js +348 -763
- package/dist/cli/install-tool-helpers.js +287 -0
- package/dist/cli/router.js +91 -6
- package/dist/commands/codex-lb.js +188 -53
- package/dist/commands/codex.js +44 -5
- package/dist/commands/doctor.js +302 -46
- package/dist/commands/tmux.js +5 -1
- package/dist/commands/versioning.js +7 -0
- package/dist/commands/zellij-monitor-pane.js +2 -0
- package/dist/commands/zellij-viewport-pane.js +3 -1
- package/dist/commands/zellij.js +1 -1
- package/dist/config/skills-manifest.json +59 -59
- package/dist/core/agent-bridge/agent-manifest.js +48 -0
- package/dist/core/agents/agent-central-ledger.js +9 -0
- package/dist/core/agents/agent-cleanup-executor.js +334 -41
- package/dist/core/agents/agent-cleanup.js +20 -1
- package/dist/core/agents/agent-command-surface.js +3 -1
- package/dist/core/agents/agent-effort-policy.js +30 -38
- package/dist/core/agents/agent-janitor.js +9 -10
- package/dist/core/agents/agent-namespace-safety.js +56 -0
- package/dist/core/agents/agent-orchestrator.js +25 -3
- package/dist/core/agents/agent-output-validator.js +1 -1
- package/dist/core/agents/agent-plan.js +100 -21
- package/dist/core/agents/agent-role-config.js +43 -49
- package/dist/core/agents/agent-runner-codex-exec.js +18 -3
- package/dist/core/agents/agent-runner-process.js +1 -0
- package/dist/core/agents/agent-schema.js +3 -2
- package/dist/core/agents/fast-mode-policy.js +3 -5
- package/dist/core/agents/native-cli-session-swarm.js +1 -1
- package/dist/core/agents/native-worker-backend-router.js +2 -1
- package/dist/core/agents/work-partition/repo-inventory.js +68 -7
- package/dist/core/agents/zellij-right-lane-cockpit.js +2 -2
- package/dist/core/code-structure.js +5 -4
- package/dist/core/codex/agent-config-file-repair.js +94 -193
- package/dist/core/codex/codex-cli-update.js +723 -0
- package/dist/core/codex/codex-config-guard.js +38 -11
- package/dist/core/codex/codex-project-config-policy.js +3 -6
- package/dist/core/codex/codex-startup-config-postcheck.js +52 -42
- package/dist/core/codex-adapter.js +35 -22
- package/dist/core/codex-app/codex-agent-role-sync.js +13 -54
- package/dist/core/codex-app/codex-app-fast-ui-repair.js +51 -20
- package/dist/core/codex-app/codex-app-launcher.js +48 -17
- package/dist/core/codex-app/codex-app-restart.js +23 -2
- package/dist/core/codex-app/codex-app-ui-state-snapshot.js +11 -3
- package/dist/core/codex-app/sks-menubar.js +136 -5
- package/dist/core/codex-app.js +35 -14
- package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -1
- package/dist/core/codex-compat/codex-release-manifest.js +6 -6
- package/dist/core/codex-control/codex-0139-doctor-real-probe.js +7 -1
- package/dist/core/codex-control/codex-0139-image-path-real-probe.js +29 -12
- package/dist/core/codex-control/codex-0139-probe-runner.js +103 -28
- package/dist/core/codex-control/codex-0139-real-probe-summary.js +7 -3
- package/dist/core/codex-control/codex-0139-real-probes.js +21 -6
- package/dist/core/codex-control/codex-0139-sandbox-real-probe.js +39 -13
- package/dist/core/codex-control/codex-0139-web-search-probe.js +28 -14
- package/dist/core/codex-control/{codex-0142-capability.js → codex-0144-capability.js} +22 -22
- package/dist/core/codex-control/codex-0144-collab-agent-real-probe.js +63 -0
- package/dist/core/codex-control/codex-lb-launch-recovery.js +278 -0
- package/dist/core/codex-control/codex-multi-agent-event-normalizer.js +5 -1
- package/dist/core/codex-control/codex-reliability-shield.js +93 -30
- package/dist/core/codex-control/codex-sdk-adapter.js +96 -13
- package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
- package/dist/core/codex-control/codex-sdk-sandbox-policy.js +6 -3
- package/dist/core/codex-control/codex-task-runner.js +62 -9
- package/dist/core/codex-control/python-codex-sdk-adapter.js +30 -3
- package/dist/core/codex-exec-output-schema.js +35 -6
- package/dist/core/codex-lb/codex-lb-env.js +30 -1
- package/dist/core/codex-lb/codex-lb-tool-catalog.js +478 -0
- package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +291 -0
- package/dist/core/codex-native/codex-native-feature-broker.js +31 -38
- package/dist/core/codex-native/codex-native-feature-matrix.js +2 -2
- package/dist/core/codex-native/codex-native-repair-transaction.js +1 -1
- package/dist/core/codex-native/core-skill-manifest.js +8 -4
- package/dist/core/codex-native/native-capability-postcheck.js +16 -8
- package/dist/core/codex-native/native-capability-repair-matrix.js +76 -27
- package/dist/core/codex-plugins/codex-plugin-json.js +67 -21
- package/dist/core/codex-plugins/codex-plugin-repair.js +118 -0
- package/dist/core/codex-runtime/codex-desktop-config-policy.js +305 -0
- package/dist/core/commands/agent-bridge-command.js +23 -2
- package/dist/core/commands/agent-command.js +38 -5
- package/dist/core/commands/basic-cli.js +77 -30
- package/dist/core/commands/command-utils.js +1 -1
- package/dist/core/commands/gc-command.js +27 -4
- package/dist/core/commands/image-ux-review-command.js +55 -24
- package/dist/core/commands/mad-sks-command.js +182 -137
- package/dist/core/commands/naruto-command.js +643 -1153
- package/dist/core/commands/pipeline-command.js +1 -0
- package/dist/core/commands/research-command.js +293 -231
- package/dist/core/commands/run-command.js +100 -23
- package/dist/core/commands/team-command.js +2 -3
- package/dist/core/commands/team-legacy-observe-command.js +94 -359
- package/dist/core/commands/wiki-command.js +179 -83
- package/dist/core/computer-use-live-evidence.js +166 -3
- package/dist/core/computer-use-status.js +5 -2
- package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +2 -2
- package/dist/core/daemon/sksd-hook-daemon.js +171 -28
- package/dist/core/daemon/sksd-hook-dispatch.js +2 -2
- package/dist/core/db-safety.js +2 -2
- package/dist/core/decision-lattice.js +6 -6
- package/dist/core/dfix/verification-selector.js +6 -4
- package/dist/core/doctor/browser-use-repair.js +54 -13
- package/dist/core/doctor/codex-0139-doctor.js +3 -2
- package/dist/core/doctor/codex-startup-config-repair.js +8 -3
- package/dist/core/doctor/computer-use-repair.js +28 -39
- package/dist/core/doctor/doctor-codex-startup-repair.js +24 -149
- package/dist/core/doctor/doctor-context7-repair.js +1 -1
- package/dist/core/doctor/doctor-dirty-planner.js +1 -1
- package/dist/core/doctor/doctor-native-capability-repair.js +74 -3
- package/dist/core/doctor/imagegen-repair.js +47 -12
- package/dist/core/doctor/legacy-global-hook-cleanup.js +179 -0
- package/dist/core/feature-fixture-executor.js +71 -7
- package/dist/core/feature-fixture-runner.js +53 -12
- package/dist/core/feature-fixtures.js +47 -14
- package/dist/core/feature-registry.js +53 -58
- package/dist/core/fsx.js +54 -6
- package/dist/core/harness-conflicts.js +19 -10
- package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +5 -4
- package/dist/core/hooks-runtime/hook-invocation-dedupe.js +147 -0
- package/dist/core/hooks-runtime/hook-io.js +14 -4
- package/dist/core/hooks-runtime/light-turn.js +70 -0
- package/dist/core/hooks-runtime/payload-signals.js +270 -0
- package/dist/core/hooks-runtime/team-digest.js +0 -1
- package/dist/core/hooks-runtime/tool-output-quarantine.js +93 -0
- package/dist/core/hooks-runtime.js +418 -250
- package/dist/core/image/image-artifact-path-contract.js +8 -6
- package/dist/core/image/image-artifact-registry.js +5 -1
- package/dist/core/image-ux-review/imagegen-adapter.js +5 -2
- package/dist/core/imagegen/imagegen-capability.js +10 -13
- package/dist/core/imagegen/require-imagegen.js +37 -11
- package/dist/core/init/skills.js +16 -30
- package/dist/core/init.js +144 -36
- package/dist/core/managed-assets/managed-assets-manifest.js +417 -14
- package/dist/core/mission.js +24 -1
- package/dist/core/naruto/naruto-work-graph.js +70 -4
- package/dist/core/ops/reporting.js +3 -0
- package/dist/core/pipeline-internals/runtime-core.js +578 -180
- package/dist/core/pipeline-internals/runtime-gates.js +191 -49
- package/dist/core/ppt/style-tokens.js +1 -1
- package/dist/core/ppt-review/index.js +1 -1
- package/dist/core/ppt-review/slide-exporter.js +23 -17
- package/dist/core/ppt-review/slide-imagegen-review.js +1 -1
- package/dist/core/ppt-review/slide-issue-extraction.js +4 -2
- package/dist/core/preflight/parallel-preflight-engine.js +50 -1
- package/dist/core/product-design-plugin.js +2 -2
- package/dist/core/proof/route-finalizer.js +1 -1
- package/dist/core/proof/route-proof-gate.js +7 -2
- package/dist/core/proof-field.js +3 -3
- package/dist/core/provider/model-router.js +38 -32
- package/dist/core/recallpulse/policy.js +12 -28
- package/dist/core/recallpulse.js +11 -6
- package/dist/core/release/gate-manifest.js +18 -12
- package/dist/core/release/gate-pack-manifest.js +1 -1
- package/dist/core/release/npm-pack-proof.js +247 -0
- package/dist/core/release/package-dist-snapshot.js +151 -0
- package/dist/core/release/package-size-budget.js +5 -0
- package/dist/core/release/release-authorization-snapshot.js +115 -0
- package/dist/core/release/release-gate-affected-selector.js +15 -3
- package/dist/core/release/release-gate-cache-v2.js +30 -0
- package/dist/core/release/release-gate-contract.js +161 -0
- package/dist/core/release/release-gate-dag.js +44 -3
- package/dist/core/release/release-gate-hermetic-env.js +28 -17
- package/dist/core/release/release-real-contract.js +496 -0
- package/dist/core/release-parallel-full-coverage.js +31 -143
- package/dist/core/research/claim-evidence-matrix.js +41 -6
- package/dist/core/research/experiment-plan.js +14 -10
- package/dist/core/research/falsification.js +9 -2
- package/dist/core/research/implementation-blueprint-densifier.js +82 -60
- package/dist/core/research/implementation-blueprint.js +32 -26
- package/dist/core/research/mock-result.js +122 -11
- package/dist/core/research/replication-pack.js +15 -8
- package/dist/core/research/research-adversarial-review.js +1068 -0
- package/dist/core/research/research-claim-builder.js +69 -17
- package/dist/core/research/research-claim-synthesizer.js +343 -0
- package/dist/core/research/research-cycle-runner.js +53 -3
- package/dist/core/research/research-falsification-runner.js +176 -0
- package/dist/core/research/research-final-reviewer.js +44 -125
- package/dist/core/research/research-realistic-report.js +14 -6
- package/dist/core/research/research-review-artifact-digest.js +66 -0
- package/dist/core/research/research-source-evidence.js +144 -0
- package/dist/core/research/research-source-layer-catalog.js +68 -0
- package/dist/core/research/research-source-ledger-merge.js +250 -12
- package/dist/core/research/research-source-shards.js +26 -70
- package/dist/core/research/research-stage-runner.js +237 -247
- package/dist/core/research/research-super-search.js +184 -0
- package/dist/core/research/research-synthesis-prompt.js +20 -1
- package/dist/core/research/research-synthesis-writer.js +86 -5
- package/dist/core/research/research-work-graph.js +25 -18
- package/dist/core/research/source-quality-report.js +21 -0
- package/dist/core/research.js +429 -280
- package/dist/core/retention/retention-budget.js +25 -6
- package/dist/core/retention.js +980 -101
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes/dollar-manifest-lite.js +11 -11
- package/dist/core/routes/evidence.js +4 -4
- package/dist/core/routes/ppt-policy.js +1 -1
- package/dist/core/routes.js +92 -64
- package/dist/core/runtime/task-profile.js +66 -0
- package/dist/core/runtime/verification-budget.js +12 -0
- package/dist/core/secret-redaction.js +4 -0
- package/dist/core/security/high-risk-contracts.js +6 -6
- package/dist/core/stop-gate/stop-gate-check.js +49 -12
- package/dist/core/subagents/agent-catalog.js +215 -0
- package/dist/core/subagents/model-policy.js +118 -0
- package/dist/core/subagents/naruto-help-contract.js +40 -0
- package/dist/core/subagents/official-subagent-config.js +488 -0
- package/dist/core/subagents/official-subagent-preparation.js +251 -0
- package/dist/core/subagents/official-subagent-prompt.js +137 -0
- package/dist/core/subagents/official-subagent-runner.js +129 -0
- package/dist/core/subagents/subagent-evidence.js +663 -0
- package/dist/core/subagents/terminology.js +16 -0
- package/dist/core/subagents/thread-budget.js +21 -0
- package/dist/core/subagents/triwiki-attention.js +65 -0
- package/dist/core/super-search/runtime-helpers.js +173 -19
- package/dist/core/super-search/runtime.js +140 -15
- package/dist/core/super-search/source-records.js +49 -8
- package/dist/core/team-review-policy.js +15 -0
- package/dist/core/triwiki/code-pack.js +8 -2
- package/dist/core/triwiki/triwiki-cache-key.js +108 -29
- package/dist/core/triwiki/triwiki-module-card.js +1 -1
- package/dist/core/triwiki-attention.js +13 -6
- package/dist/core/triwiki-provenance.js +274 -0
- package/dist/core/triwiki-runtime.js +21 -7
- package/dist/core/triwiki-wrongness/wrongness-ledger.js +187 -61
- package/dist/core/triwiki-wrongness/wrongness-retrieval.js +11 -2
- package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +2 -0
- package/dist/core/update-check.js +23 -15
- package/dist/core/version-manager.js +51 -1
- package/dist/core/version.js +1 -1
- package/dist/core/wiki-coordinate.js +128 -12
- package/dist/core/work-order-ledger.js +208 -10
- package/dist/core/zellij/zellij-command.js +12 -1
- package/dist/core/zellij/zellij-dashboard-pane.js +3 -3
- package/dist/core/zellij/zellij-fake-adapter.js +3 -1
- package/dist/core/zellij/zellij-launcher.js +51 -21
- package/dist/core/zellij/zellij-layout-builder.js +14 -5
- package/dist/core/zellij/zellij-official-subagent-activity.js +477 -0
- package/dist/core/zellij/zellij-official-subagent-telemetry.js +264 -0
- package/dist/core/zellij/zellij-pane-proof.js +32 -6
- package/dist/core/zellij/zellij-slot-pane-renderer.js +17 -5
- package/dist/core/zellij/zellij-slot-telemetry.js +15 -3
- package/dist/core/zellij/zellij-ui-mode.js +1 -1
- package/dist/core/zellij/zellij-viewport-binder.js +3 -0
- package/dist/core/zellij/zellij-worker-pane-manager.js +5 -3
- package/dist/scripts/agent-fast-mode-default-check.js +48 -29
- package/dist/scripts/agent-role-config-repair-check.js +34 -15
- package/dist/scripts/agent-wiki-context-proof-check.js +16 -2
- package/dist/scripts/all-feature-deep-completion-check.js +14 -4
- package/dist/scripts/architecture-guard-check.js +8 -1
- package/dist/scripts/build-dist.js +17 -5
- package/dist/scripts/canonical-test-runner.js +188 -0
- package/dist/scripts/check-command-module-budget.js +38 -16
- package/dist/scripts/check-legacy-free.js +1 -1
- package/dist/scripts/check-route-modularity.js +0 -1
- package/dist/scripts/check-ts-contracts.js +1 -1
- package/dist/scripts/codex-0139-interrupt-agent-check.js +5 -1
- package/dist/scripts/{codex-0142-app-server-v2-check.js → codex-0144-app-server-v2-check.js} +11 -10
- package/dist/scripts/{codex-0142-binary-identity-check.js → codex-0144-binary-identity-check.js} +4 -4
- package/dist/scripts/codex-0144-capability-check.js +21 -0
- package/dist/scripts/{codex-0139-real-probes-check.js → codex-0144-core-real-probes-check.js} +19 -5
- package/dist/scripts/{codex-0142-doctor-wiring-check.js → codex-0144-doctor-wiring-check.js} +6 -6
- package/dist/scripts/{codex-0142-manifest-check.js → codex-0144-manifest-check.js} +11 -3
- package/dist/scripts/{codex-0142-policy-check.js → codex-0144-policy-check.js} +2 -2
- package/dist/scripts/{codex-0142-thread-store-check.js → codex-0144-thread-store-check.js} +3 -3
- package/dist/scripts/codex-app-provider-model-ui-check.js +53 -19
- package/dist/scripts/codex-app-ui-preservation-check.js +35 -4
- package/dist/scripts/codex-control-all-pipelines-check.js +7 -3
- package/dist/scripts/codex-control-side-effect-scope-check.js +2 -2
- package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +27 -0
- package/dist/scripts/codex-effort-auto-discovery-check.js +1 -1
- package/dist/scripts/codex-lb-fast-mode-truth-check.js +1 -0
- package/dist/scripts/{codex-lb-gpt55-fast-profile-check.js → codex-lb-gpt56-fast-profile-check.js} +56 -5
- package/dist/scripts/codex-model-metadata-check.js +1 -1
- package/dist/scripts/codex-native-agent-role-content-check.js +15 -7
- package/dist/scripts/codex-native-repair-transaction-check.js +3 -1
- package/dist/scripts/codex-sdk-all-pipelines-check.js +7 -4
- package/dist/scripts/codex-sdk-research-pipeline-check.js +30 -8
- package/dist/scripts/codex-sdk-sandbox-policy-check.js +5 -1
- package/dist/scripts/codex-sdk-version-compat-check.js +2 -1
- package/dist/scripts/db-route-materialization-check.js +33 -0
- package/dist/scripts/dfix-fixture-check.js +1 -1
- package/dist/scripts/docs-truthfulness-check.js +4 -2
- package/dist/scripts/doctor-codex-startup-repair-check.js +47 -25
- package/dist/scripts/doctor-context7-repair-check.js +2 -1
- package/dist/scripts/doctor-fix-production-blackbox.js +12 -2
- package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +34 -7
- package/dist/scripts/doctor-imagegen-repair-check.js +14 -4
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +9 -3
- package/dist/scripts/doctor-startup-config-repair-check.js +13 -3
- package/dist/scripts/install-update-preserves-config-check.js +7 -2
- package/dist/scripts/legacy-gate-inventory-check.js +7 -5
- package/dist/scripts/legacy-strong-inventory-check.js +7 -5
- package/dist/scripts/legacy-upgrade-matrix-check.js +4 -4
- package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +173 -13
- package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +165 -6
- package/dist/scripts/managed-role-manifest-parity-check.js +5 -4
- package/dist/scripts/mutation-callsite-coverage-check.js +0 -11
- package/dist/scripts/naruto-codex-e2e-check.js +14 -7
- package/dist/scripts/naruto-shadow-clone-swarm-check.js +4 -201
- package/dist/scripts/npm-publish-performance-check.js +20 -12
- package/dist/scripts/official-subagent-workflow-check.js +145 -0
- package/dist/scripts/package-published-contract-check.js +6 -20
- package/dist/scripts/packlist-performance-check.js +17 -3
- package/dist/scripts/parallel-verification-engine-check.js +2 -2
- package/dist/scripts/postinstall-safe-side-effects-check.js +8 -3
- package/dist/scripts/ppt-no-mock-as-real-check.js +3 -1
- package/dist/scripts/prepublish-release-check-or-fast.js +23 -86
- package/dist/scripts/product-design-plugin-routing-check.js +1 -1
- package/dist/scripts/release-affected-selector-check.js +74 -1
- package/dist/scripts/release-check-stamp.js +324 -239
- package/dist/scripts/release-dag-full-coverage-check.js +7 -15
- package/dist/scripts/release-dynamic-presets-check.js +10 -1
- package/dist/scripts/release-gate-dag-runner-check.js +3 -3
- package/dist/scripts/release-gate-dag-runner.js +35 -11
- package/dist/scripts/release-gate-existence-audit.js +1 -2
- package/dist/scripts/release-gate-script-parity-check.js +1 -1
- package/dist/scripts/release-parallel-full-coverage-check.js +12 -6
- package/dist/scripts/release-parallel-speed-budget-check.js +18 -2
- package/dist/scripts/release-real-check.js +390 -157
- package/dist/scripts/release-registry-check.js +61 -16
- package/dist/scripts/release-runtime-truth-matrix-check.js +22 -0
- package/dist/scripts/research-blueprint-densifier-check.js +2 -2
- package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +11 -7
- package/dist/scripts/route-proof-artifact-structure-check.js +1 -0
- package/dist/scripts/search-visibility-gate-lib.js +1 -1
- package/dist/scripts/seo-geo-route-identity-check.js +30 -4
- package/dist/scripts/sizecheck.js +4 -4
- package/dist/scripts/sks-1-11-gate-lib.js +53 -6
- package/dist/scripts/sks-3-1-4-directive-check-lib.js +8 -2
- package/dist/scripts/sks-3-1-5-directive-check-lib.js +3 -2
- package/dist/scripts/sks-3-1-6-directive-check-lib.js +5 -3
- package/dist/scripts/sks-menubar-install-check.js +8 -0
- package/dist/scripts/sks-uninstall-regression-check.js +1 -1
- package/dist/scripts/sksd-daemon-check.js +16 -6
- package/dist/scripts/trust-fixture-check.js +32 -10
- package/dist/scripts/write-build-manifest.js +2 -1
- package/dist/scripts/wrongness-fixture-check.js +1 -1
- package/dist/scripts/zellij-layout-valid-check.js +36 -11
- package/dist/scripts/zellij-pane-proof-check.js +33 -2
- package/dist/scripts/zellij-real-session-cleanup-check.js +122 -2
- package/dist/scripts/zellij-real-session-launch-check.js +76 -5
- package/dist/scripts/zellij-slot-pane-renderer-check.js +4 -4
- package/dist/scripts/zellij-spawn-on-demand-layout-check.js +3 -3
- package/docs/demo.tape +1 -1
- package/infra-harness-gates.json +1486 -0
- package/package.json +32 -19
- package/release-gates.v2.json +4060 -0
- package/runtime-required-scripts.json +9 -0
- package/schemas/codex/{app-server-0.142 → app-server-0.144}/codex_app_server_protocol.v2.schemas.json +1146 -781
- package/schemas/codex/codex-0139-real-probe-result.schema.json +39 -5
- package/schemas/codex/ppt-slide-issue-ledger.schema.json +2 -1
- package/dist/commands/db.js +0 -6
- package/dist/core/codex-control/codex-0139-multi-agent-real-probe.js +0 -107
- package/dist/core/commands/db-command.js +0 -146
- package/dist/core/research/prompt.js +0 -15
- package/dist/scripts/agent-native-release-gate.js +0 -274
- package/dist/scripts/codex-0142-capability-check.js +0 -21
- package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
- package/dist/scripts/command-performance-scorecard-check.js +0 -204
- package/dist/scripts/config-managed-merge-callsite-coverage-check.js +0 -212
- package/dist/scripts/dollar-performance-scorecard-check.js +0 -257
- package/dist/scripts/gate-timing-check.js +0 -16
- package/dist/scripts/ops-maturity-scorecard-check.js +0 -12
- package/dist/scripts/performance-baseline-check.js +0 -12
- package/dist/scripts/performance-improvement-report-check.js +0 -58
- package/dist/scripts/release-parallel-check.js +0 -389
- package/dist/scripts/release-runner-efficiency-check.js +0 -15
- package/dist/scripts/retention-long-run-smoke-check.js +0 -299
- package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { codexModelEffortCapability } from '../codex-control/codex-model-capabilities.js';
|
|
2
2
|
import { GLM_52_OPENROUTER_MODEL } from '../providers/glm/glm-52-settings.js';
|
|
3
|
-
import { isNarutoGpt56Model
|
|
3
|
+
import { isNarutoGpt56Model } from '../provider/model-router.js';
|
|
4
|
+
import { decideSubagentModel } from '../subagents/model-policy.js';
|
|
4
5
|
const XHIGH_SIGNAL_RE = /(frontier|autoresearch|novelty|hypothesis|falsif|forensic|from-chat-img|image\s*work\s*order|새로운\s*연구|가설|포렌식)/i;
|
|
5
6
|
const HIGH_SIGNAL_RE = /(database|supabase|sql|migration|security|permission|mad|release|publish|deploy|architecture|policy|schema|hook|rollback|db|보안|배포|마이그레이션|데이터베이스|권한|릴리즈)/i;
|
|
6
7
|
const MEDIUM_SIGNAL_RE = /(tmux|terminal|cli|tool(?:\s|-)?call|router|routing|orchestrat|pipeline|multi[-\s]?session|multi[-\s]?agent|lease|ledger|proof|검증|파이프라인|오케스트레이션|병렬|에이전트)/i;
|
|
@@ -61,21 +62,24 @@ export function decideAgentEffort(input = {}) {
|
|
|
61
62
|
]
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
export function
|
|
65
|
+
// Official Codex subagents always use max reasoning. Clear bounded work uses
|
|
66
|
+
// Luna; any judgment-bearing slice uses Sol. There is no automatic Terra or
|
|
67
|
+
// lower-effort fallback.
|
|
68
|
+
export function decideOfficialSubagentModel(input = {}) {
|
|
68
69
|
const persona = input.persona || {};
|
|
69
70
|
const prompt = String(input.prompt || '');
|
|
70
71
|
const role = String(persona.role || '');
|
|
71
|
-
const agentId = String(input.agentId || persona.id || '
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
const agentId = String(input.agentId || persona.id || 'subagent');
|
|
73
|
+
const routed = decideSubagentModel({
|
|
74
|
+
title: [agentId, persona.naruto_role, persona.work_kind].filter(Boolean).join(' '),
|
|
75
|
+
description: [prompt, persona.risk_focus, persona.write_policy].filter(Boolean).join(' '),
|
|
76
|
+
role,
|
|
77
|
+
expectedOutput: (persona.output_expectations || []).join(' ')
|
|
78
|
+
});
|
|
79
|
+
const effort = 'max';
|
|
76
80
|
const modelCapability = codexModelEffortCapability({
|
|
77
81
|
model: routed.model,
|
|
78
|
-
advertisedEfforts:
|
|
82
|
+
advertisedEfforts: ['max'],
|
|
79
83
|
defaultEffort: effort
|
|
80
84
|
});
|
|
81
85
|
return {
|
|
@@ -87,24 +91,23 @@ export function decideNarutoCloneEffort(input = {}) {
|
|
|
87
91
|
reasoning_effort: effort,
|
|
88
92
|
model_reasoning_effort: effort,
|
|
89
93
|
model_tier: `${routed.model}-${effort}`,
|
|
90
|
-
model_profile: `sks-
|
|
91
|
-
model_selection_reason:
|
|
94
|
+
model_profile: `sks-official-subagent-${safeProfileSegment(routed.model)}-${effort}-fast`,
|
|
95
|
+
model_selection_reason: routed.reason,
|
|
92
96
|
model_effort_capability: modelCapability,
|
|
93
97
|
reasoning_profile: reasoningProfileName(effort),
|
|
94
98
|
service_tier: 'fast',
|
|
95
|
-
reason:
|
|
99
|
+
reason: routed.reason,
|
|
96
100
|
dynamic: true,
|
|
97
101
|
escalation_triggers: [
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
102
|
+
'UI, review, debugging, planning, architecture, integration, security, database, release, or ambiguity selects Sol Max',
|
|
103
|
+
'requiresJudgment or reasoning-sensitive evidence selects Sol Max',
|
|
104
|
+
'requested model or max effort unavailable blocks instead of silently falling back'
|
|
101
105
|
],
|
|
102
|
-
downshift_triggers: [
|
|
103
|
-
'ordinary coding stays on Terra xhigh',
|
|
104
|
-
'ordinary E2E, browser, Computer Use, and GUI verification stays on Luna xhigh'
|
|
105
|
-
]
|
|
106
|
+
downshift_triggers: []
|
|
106
107
|
};
|
|
107
108
|
}
|
|
109
|
+
/** @deprecated since 6.1.1. Use decideOfficialSubagentModel. */
|
|
110
|
+
export const decideNarutoCloneEffort = decideOfficialSubagentModel;
|
|
108
111
|
export function buildAgentEffortPolicy(roster = {}) {
|
|
109
112
|
const decisions = Array.isArray(roster.roster) ? roster.roster.map((agent) => ({
|
|
110
113
|
agent_id: agent.id,
|
|
@@ -126,19 +129,20 @@ export function buildAgentEffortPolicy(roster = {}) {
|
|
|
126
129
|
policy_version: 1,
|
|
127
130
|
dynamic: true,
|
|
128
131
|
service_tier: 'fast',
|
|
129
|
-
model_catalog_policy: narutoFamilyOnly ? '
|
|
130
|
-
model_constraint: narutoFamilyOnly ? ['gpt-5.6-luna', 'gpt-5.6-
|
|
132
|
+
model_catalog_policy: narutoFamilyOnly ? 'official_subagent_luna_sol_max' : 'codex_catalog_passthrough',
|
|
133
|
+
model_constraint: narutoFamilyOnly ? ['gpt-5.6-luna', 'gpt-5.6-sol'] : null,
|
|
134
|
+
explicit_compatibility_models: narutoFamilyOnly ? ['gpt-5.6-terra'] : null,
|
|
131
135
|
model_tiers: narutoFamilyOnly
|
|
132
|
-
? ['gpt-5.6-luna-
|
|
136
|
+
? ['gpt-5.6-luna-max', 'gpt-5.6-sol-max', 'gpt-5.6-terra-max']
|
|
133
137
|
: ['codex-selected-low', 'codex-selected-medium', 'codex-selected-high', 'codex-selected-xhigh', 'glm-5.2-minimal', 'glm-5.2-low', 'glm-5.2-high', 'glm-5.2-xhigh'],
|
|
134
|
-
allowed_efforts: narutoFamilyOnly ? ['
|
|
138
|
+
allowed_efforts: narutoFamilyOnly ? ['max'] : codexModelEffortCapability().advertised_efforts,
|
|
135
139
|
model_effort_capability: codexModelEffortCapability(),
|
|
136
140
|
max_agents: roster.max_agents || 20,
|
|
137
141
|
agent_count: roster.agent_count || decisions.length,
|
|
138
142
|
concurrency: roster.concurrency || decisions.length,
|
|
139
143
|
decisions,
|
|
140
144
|
rule: narutoFamilyOnly
|
|
141
|
-
? 'Naruto
|
|
145
|
+
? 'Official Naruto subagents automatically use GPT-5.6 Luna Max for clear bounded repeatable work and GPT-5.6 Sol Max for every reasoning-sensitive slice; an explicit user-selected Terra model remains compatible but is never selected automatically.'
|
|
142
146
|
: 'Codex/OpenAI workers inherit the current Codex-selected model, including future catalog entries; SKS changes only advertised reasoning effort. Explicit non-Codex provider modes retain their provider model.'
|
|
143
147
|
};
|
|
144
148
|
}
|
|
@@ -165,18 +169,6 @@ function effortReason(effort) {
|
|
|
165
169
|
return 'simple_bounded_slice';
|
|
166
170
|
return 'default_orchestration_slice';
|
|
167
171
|
}
|
|
168
|
-
function narutoAdvertisedEfforts(model) {
|
|
169
|
-
return model === 'gpt-5.6-luna'
|
|
170
|
-
? ['low', 'medium', 'high', 'xhigh', 'max']
|
|
171
|
-
: ['low', 'medium', 'high', 'xhigh', 'max', 'ultra'];
|
|
172
|
-
}
|
|
173
|
-
function narutoSelectionReason(model, effort) {
|
|
174
|
-
if (model === 'gpt-5.6-sol')
|
|
175
|
-
return `naruto_refactor_plan_strategy_sol_${effort}`;
|
|
176
|
-
if (model === 'gpt-5.6-luna')
|
|
177
|
-
return `naruto_e2e_browser_computer_use_luna_${effort}`;
|
|
178
|
-
return `naruto_coding_terra_${effort}`;
|
|
179
|
-
}
|
|
180
172
|
export function decideAgentWorkerModel(input = {}) {
|
|
181
173
|
const mainModel = String(input.mainModel || process.env.SKS_CODEX_MODEL || process.env.CODEX_MODEL || '').trim();
|
|
182
174
|
const glmMain = isGlmWorkerMode(mainModel);
|
|
@@ -2,6 +2,7 @@ import fsp from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { exists, nowIso, readJson, writeJsonAtomic } from '../fsx.js';
|
|
4
4
|
import { normalizeAgentSessionRows } from './agent-session-rows.js';
|
|
5
|
+
import { resolveOwnedNamespacePath } from './agent-namespace-safety.js';
|
|
5
6
|
export async function runAgentJanitor(input) {
|
|
6
7
|
const staleMs = input.staleMs ?? 30 * 60 * 1000;
|
|
7
8
|
const agentRoot = path.join(input.missionDir, 'agents');
|
|
@@ -39,7 +40,7 @@ export async function runAgentJanitor(input) {
|
|
|
39
40
|
const staleZellijSessions = rawStaleZellijSessions.filter((id) => !activeGenerationSet.has(id));
|
|
40
41
|
const skippedActiveGenerations = rawStaleZellijSessions.filter((id) => activeGenerationSet.has(id));
|
|
41
42
|
const orphanGenerationDirs = await detectOrphanGenerationDirs(agentRoot, new Set(generationRows.map((row) => String(row.artifact_dir || ''))));
|
|
42
|
-
const orphanTempDirs = await scopedExistingPaths(Array.isArray(namespace?.orphan_temp_dirs) ? namespace.orphan_temp_dirs : [], projectHash);
|
|
43
|
+
const orphanTempDirs = await scopedExistingPaths(Array.isArray(namespace?.orphan_temp_dirs) ? namespace.orphan_temp_dirs : [], projectHash, namespace?.temp_dir ? [namespace.temp_dir] : []);
|
|
43
44
|
const staleLocks = await scopedStaleLockPaths(namespace?.lock_dir ? [namespace.lock_dir] : [], projectHash, staleMs);
|
|
44
45
|
const cleaned = [];
|
|
45
46
|
if (input.cleanup) {
|
|
@@ -103,15 +104,12 @@ async function detectOrphanGenerationDirs(agentRoot, knownGenerationDirs) {
|
|
|
103
104
|
export async function writeAgentJanitorReport(missionDir, report) {
|
|
104
105
|
await writeJsonAtomic(path.join(missionDir, 'agents', 'agent-janitor-report.json'), report);
|
|
105
106
|
}
|
|
106
|
-
async function scopedExistingPaths(paths, projectHash) {
|
|
107
|
+
async function scopedExistingPaths(paths, projectHash, anchors = []) {
|
|
107
108
|
const out = [];
|
|
108
109
|
for (const candidate of paths) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
continue;
|
|
113
|
-
if (await exists(candidate))
|
|
114
|
-
out.push(candidate);
|
|
110
|
+
const owned = await resolveOwnedNamespacePath(candidate, String(projectHash || ''), anchors);
|
|
111
|
+
if (owned)
|
|
112
|
+
out.push(owned);
|
|
115
113
|
}
|
|
116
114
|
return out;
|
|
117
115
|
}
|
|
@@ -119,9 +117,10 @@ async function scopedStaleLockPaths(paths, projectHash, staleMs) {
|
|
|
119
117
|
const out = [];
|
|
120
118
|
const now = Date.now();
|
|
121
119
|
for (const dir of paths) {
|
|
122
|
-
|
|
120
|
+
const ownedDir = await resolveOwnedNamespacePath(dir, String(projectHash || ''));
|
|
121
|
+
if (!ownedDir)
|
|
123
122
|
continue;
|
|
124
|
-
for (const file of await listFiles(
|
|
123
|
+
for (const file of await listFiles(ownedDir)) {
|
|
125
124
|
const stat = await fsp.stat(file).catch(() => null);
|
|
126
125
|
if (stat && now - stat.mtimeMs > staleMs)
|
|
127
126
|
out.push(file);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import fsp from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export function validProjectNamespaceHash(value) {
|
|
4
|
+
return /^[A-Za-z0-9_-]{4,64}$/.test(String(value || ''));
|
|
5
|
+
}
|
|
6
|
+
export function processReportMatchesProjectNamespace(report, projectHash) {
|
|
7
|
+
if (!validProjectNamespaceHash(projectHash) || !report || typeof report !== 'object')
|
|
8
|
+
return false;
|
|
9
|
+
if (String(report.project_hash || '') === projectHash)
|
|
10
|
+
return true;
|
|
11
|
+
if (String(report.root_hash || '') === projectHash)
|
|
12
|
+
return true;
|
|
13
|
+
const namespace = String(report.project_namespace || '');
|
|
14
|
+
return namespace === projectHash || namespace === `sks-${projectHash}` || namespace.startsWith(`sks-${projectHash}-`);
|
|
15
|
+
}
|
|
16
|
+
export async function resolveOwnedNamespacePath(candidate, projectHash, anchors = []) {
|
|
17
|
+
if (!validProjectNamespaceHash(projectHash))
|
|
18
|
+
return null;
|
|
19
|
+
const raw = String(candidate || '');
|
|
20
|
+
if (!raw || !path.isAbsolute(raw) || raw.includes('\0') || raw.split(/[\\/]+/).includes('..'))
|
|
21
|
+
return null;
|
|
22
|
+
const resolved = path.resolve(raw);
|
|
23
|
+
const stat = await fsp.lstat(resolved).catch(() => null);
|
|
24
|
+
if (!stat || stat.isSymbolicLink())
|
|
25
|
+
return null;
|
|
26
|
+
const real = await fsp.realpath(resolved).catch(() => null);
|
|
27
|
+
if (!real)
|
|
28
|
+
return null;
|
|
29
|
+
const validAnchors = [];
|
|
30
|
+
for (const value of anchors) {
|
|
31
|
+
const anchorRaw = String(value || '');
|
|
32
|
+
if (!anchorRaw || !path.isAbsolute(anchorRaw) || anchorRaw.split(/[\\/]+/).includes('..'))
|
|
33
|
+
continue;
|
|
34
|
+
const anchorResolved = path.resolve(anchorRaw);
|
|
35
|
+
const anchorStat = await fsp.lstat(anchorResolved).catch(() => null);
|
|
36
|
+
if (!anchorStat?.isDirectory() || anchorStat.isSymbolicLink())
|
|
37
|
+
continue;
|
|
38
|
+
const anchorReal = await fsp.realpath(anchorResolved).catch(() => null);
|
|
39
|
+
if (anchorReal)
|
|
40
|
+
validAnchors.push({ resolved: anchorResolved, real: anchorReal });
|
|
41
|
+
}
|
|
42
|
+
if (validAnchors.length) {
|
|
43
|
+
return validAnchors.some((anchor) => isWithin(anchor.resolved, resolved) && isWithin(anchor.real, real)) ? resolved : null;
|
|
44
|
+
}
|
|
45
|
+
return pathContainsHashToken(resolved, projectHash) && pathContainsHashToken(real, projectHash) ? resolved : null;
|
|
46
|
+
}
|
|
47
|
+
function pathContainsHashToken(value, projectHash) {
|
|
48
|
+
const escaped = projectHash.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
49
|
+
const token = new RegExp(`(^|[-_.])${escaped}($|[-_.])`);
|
|
50
|
+
return path.resolve(value).split(path.sep).filter(Boolean).some((segment) => token.test(segment));
|
|
51
|
+
}
|
|
52
|
+
function isWithin(parent, candidate) {
|
|
53
|
+
const rel = path.relative(path.resolve(parent), path.resolve(candidate));
|
|
54
|
+
return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=agent-namespace-safety.js.map
|
|
@@ -53,6 +53,7 @@ import { writeNativeCliSessionProof } from './native-cli-session-proof.js';
|
|
|
53
53
|
import { writeNoSubagentScalingPolicy } from './no-subagent-scaling-policy.js';
|
|
54
54
|
import { writeOfficialSubagentHelperPolicy } from './official-subagent-helper-policy.js';
|
|
55
55
|
import { runCodexTask } from '../codex-control/codex-control-plane.js';
|
|
56
|
+
import { codexTimeoutClassForRoute } from '../codex-control/codex-reliability-shield.js';
|
|
56
57
|
import { CODEX_AGENT_WORKER_RESULT_SCHEMA_ID, codexAgentWorkerResultSchema } from '../codex-control/schemas/agent-worker-result.schema.js';
|
|
57
58
|
import { resolveLocalCollaborationPolicy, localCollaborationParticipated } from '../local-llm/local-collaboration-policy.js';
|
|
58
59
|
import { runFinalGptReviewStage } from '../pipeline/final-gpt-review-stage.js';
|
|
@@ -72,7 +73,7 @@ import { APPROACHES, rank, scoreCandidate, summarizeTournament } from '../naruto
|
|
|
72
73
|
export async function runNativeAgentOrchestrator(opts = {}) {
|
|
73
74
|
const root = path.resolve(opts.root || process.cwd());
|
|
74
75
|
const sessionKey = opts.sessionKey || null;
|
|
75
|
-
const prompt =
|
|
76
|
+
const prompt = await resolveAgentMissionPrompt(root, opts);
|
|
76
77
|
const route = opts.route || '$Agent';
|
|
77
78
|
const routeCommand = String(opts.routeCommand || defaultRouteCommand(route));
|
|
78
79
|
const routeBlackboxKind = String(opts.routeBlackboxKind || defaultRouteBlackboxKind(route));
|
|
@@ -412,7 +413,7 @@ export async function runNativeAgentOrchestrator(opts = {}) {
|
|
|
412
413
|
generationIndex: agent.generation_index,
|
|
413
414
|
requireGeneration: true
|
|
414
415
|
});
|
|
415
|
-
const backendOpts = { ...opts, missionId, agentRoot: ledgerRoot, cwd: workerWorktree?.context.path || root, projectRoot: root, route, prompt, fastMode: fastModePolicy.fast_mode, serviceTier: fastModePolicy.service_tier, ...(workerWorktree ? { worktree: workerWorktree.context } : {}) };
|
|
416
|
+
const backendOpts = { ...opts, missionId, agentRoot: ledgerRoot, cwd: workerWorktree?.context.path || root, projectRoot: root, projectHash: namespace.root_hash, route, prompt, fastMode: fastModePolicy.fast_mode, serviceTier: fastModePolicy.service_tier, ...(workerWorktree ? { worktree: workerWorktree.context } : {}) };
|
|
416
417
|
const result = opts.nativeCliSwarm === false
|
|
417
418
|
? await runAgentByBackend(backend, runtimeAgent, runtimeSlice, backendOpts)
|
|
418
419
|
: await nativeCliSwarm.launchWorker({ agent: runtimeAgent, slice: runtimeSlice, opts: backendOpts });
|
|
@@ -684,6 +685,27 @@ export async function runNativeAgentOrchestrator(opts = {}) {
|
|
|
684
685
|
proof
|
|
685
686
|
};
|
|
686
687
|
}
|
|
688
|
+
export async function resolveAgentMissionPrompt(root, opts) {
|
|
689
|
+
const direct = String(opts.prompt || '').trim();
|
|
690
|
+
if (opts.promptExplicit === true || (direct && direct !== 'Native agent run'))
|
|
691
|
+
return direct || 'Native agent run';
|
|
692
|
+
const missionId = String(opts.missionId || '').trim();
|
|
693
|
+
if (!missionId)
|
|
694
|
+
return direct || 'Native agent run';
|
|
695
|
+
const dir = missionDir(root, missionId);
|
|
696
|
+
const [intake, routeContext, mission] = await Promise.all([
|
|
697
|
+
readJson(path.join(dir, 'request-intake.json'), null),
|
|
698
|
+
readJson(path.join(dir, 'route-context.json'), null),
|
|
699
|
+
readJson(path.join(dir, 'mission.json'), null)
|
|
700
|
+
]);
|
|
701
|
+
return String(intake?.transformed_prompt
|
|
702
|
+
|| routeContext?.transformed_prompt
|
|
703
|
+
|| routeContext?.task
|
|
704
|
+
|| routeContext?.prompt
|
|
705
|
+
|| mission?.prompt
|
|
706
|
+
|| direct
|
|
707
|
+
|| 'Native agent run').trim();
|
|
708
|
+
}
|
|
687
709
|
function normalizeMissionHardTimeoutMs(opts = {}, route = '') {
|
|
688
710
|
const raw = Number(opts.hardTimeoutMs || opts.agentHardTimeoutMs || process.env.SKS_AGENT_HARD_TIMEOUT_MS || 0);
|
|
689
711
|
if (Number.isFinite(raw) && raw > 0)
|
|
@@ -1989,7 +2011,7 @@ async function runAgentByBackend(backend, agent, slice, opts) {
|
|
|
1989
2011
|
zellijPaneId: null,
|
|
1990
2012
|
reliabilityPolicy: {
|
|
1991
2013
|
maxEmptyResultRetries: writePaths.length ? 1 : 2,
|
|
1992
|
-
timeoutClass: writePaths.length ? 'standard' : 'short'
|
|
2014
|
+
timeoutClass: codexTimeoutClassForRoute(opts.route, writePaths.length ? 'standard' : 'short')
|
|
1993
2015
|
}
|
|
1994
2016
|
});
|
|
1995
2017
|
const sdkWorkerResult = await readJson(sdkTask.workerResultPath, null);
|
|
@@ -34,7 +34,7 @@ export const AGENT_RESULT_RUNTIME_SCHEMA = {
|
|
|
34
34
|
task_slice_id: { type: 'string' },
|
|
35
35
|
work_item_kind: { type: 'string' },
|
|
36
36
|
status: { enum: ['done', 'blocked', 'failed'] },
|
|
37
|
-
backend: { enum: ['fake', 'process', 'codex-sdk', 'python-codex-sdk', 'zellij', 'ollama', 'local-llm'] },
|
|
37
|
+
backend: { enum: ['fake', 'process', 'codex-sdk', 'python-codex-sdk', 'codex-exec', 'zellij', 'tmux', 'ollama', 'local-llm'] },
|
|
38
38
|
summary: { type: 'string' },
|
|
39
39
|
findings: { type: 'array', items: { type: 'string' } },
|
|
40
40
|
proposed_changes: { type: 'array', items: { type: 'string' } },
|
|
@@ -1,44 +1,123 @@
|
|
|
1
|
-
import { AGENT_INTAKE_STAGE_ID
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { AGENT_INTAKE_STAGE_ID } from './agent-schema.js';
|
|
2
|
+
import { classifyTaskProfile, isTaskProfile } from '../runtime/task-profile.js';
|
|
3
|
+
import { DEFAULT_NARUTO_MAX_THREADS, DEFAULT_NARUTO_REQUESTED_SUBAGENTS, resolveSubagentThreadBudget } from '../subagents/thread-budget.js';
|
|
4
|
+
const OFFICIAL_SUBAGENT_ROUTE_KEYS = new Set([
|
|
5
|
+
'team', '$team',
|
|
6
|
+
'naruto', '$naruto',
|
|
7
|
+
'shadowclone', '$shadowclone',
|
|
8
|
+
'shadow-clone', '$shadow-clone',
|
|
9
|
+
'kagebunshin', '$kagebunshin',
|
|
10
|
+
'kage-bunshin', '$kage-bunshin',
|
|
11
|
+
'swarm', '$swarm',
|
|
12
|
+
'work', '$work'
|
|
5
13
|
]);
|
|
14
|
+
const EXPLICIT_SUBAGENT_RE = /\$(Team|Naruto|ShadowClone|Shadow-Clone|Kagebunshin|Kage-Bunshin|Swarm|Work)\b/i;
|
|
15
|
+
const PARALLELIZABLE_RE = /\b(parallel|subagents?|fan out|one agent per|independent|disjoint|multiple files|all files)\b|병렬|하위\s*에이전트|서브\s*에이전트|독립|분리된|여러\s*파일|모든\s*파일|분담/i;
|
|
6
16
|
function routeKey(route) {
|
|
7
17
|
return String(route?.id || route?.command || route?.name || route || '').trim().toLowerCase();
|
|
8
18
|
}
|
|
9
19
|
export function routeRequiresAgentIntake(route, input = {}) {
|
|
10
|
-
|
|
20
|
+
const options = normalizeOptions(input);
|
|
21
|
+
if (options.noAgents === true || options.agents === false)
|
|
11
22
|
return false;
|
|
12
|
-
if (
|
|
23
|
+
if (options.force === true || options.forceAgents === true)
|
|
13
24
|
return true;
|
|
14
|
-
const
|
|
15
|
-
|
|
25
|
+
const task = String(options.task || '');
|
|
26
|
+
const officialRouteWasImplicit = Boolean(route
|
|
27
|
+
&& typeof route === 'object'
|
|
28
|
+
&& !Array.isArray(route)
|
|
29
|
+
&& route.explicit_invocation === false);
|
|
30
|
+
if ((OFFICIAL_SUBAGENT_ROUTE_KEYS.has(routeKey(route)) && !officialRouteWasImplicit) || EXPLICIT_SUBAGENT_RE.test(task))
|
|
16
31
|
return true;
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
if (positiveNumber(options.requestedSubagents) || positiveNumber(options.agents))
|
|
33
|
+
return true;
|
|
34
|
+
const profile = taskProfile(options.taskProfile, task);
|
|
35
|
+
if (profile === 'parallel-read' || profile === 'parallel-write')
|
|
36
|
+
return true;
|
|
37
|
+
return profile === 'high-risk' && explicitlyParallelizable(task);
|
|
19
38
|
}
|
|
20
39
|
export function normalizeAgentPolicy(route, task = '', input = {}) {
|
|
21
|
-
const
|
|
40
|
+
const options = normalizeOptions(input);
|
|
41
|
+
const profile = taskProfile(options.taskProfile, String(task || ''));
|
|
42
|
+
const required = routeRequiresAgentIntake(route, { ...options, task, taskProfile: profile });
|
|
43
|
+
const requested = firstPositiveNumber(options.requestedSubagents, options.agents, options.independentSliceCount);
|
|
44
|
+
const budget = resolveSubagentThreadBudget({
|
|
45
|
+
...(requested === null ? {} : { requested }),
|
|
46
|
+
...(positiveNumber(options.maxThreads) ? { configuredMaxThreads: Number(options.maxThreads) } : {}),
|
|
47
|
+
...(positiveNumber(options.independentSliceCount) ? { independentSliceCount: Number(options.independentSliceCount) } : {})
|
|
48
|
+
});
|
|
49
|
+
const requestedSubagents = required ? budget.requestedSubagents : 0;
|
|
22
50
|
return {
|
|
23
|
-
schema: 'sks.
|
|
51
|
+
schema: 'sks.subagent-intake-policy.v1',
|
|
24
52
|
required,
|
|
53
|
+
subagents_required: required,
|
|
54
|
+
task_profile: profile,
|
|
25
55
|
stage_id: AGENT_INTAKE_STAGE_ID,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
workflow: 'official_codex_subagent',
|
|
57
|
+
requested_subagents: requestedSubagents,
|
|
58
|
+
max_threads: budget.maxThreads,
|
|
59
|
+
max_depth: budget.maxDepth,
|
|
60
|
+
first_wave: required ? budget.firstWave : 0,
|
|
61
|
+
wave_count: required ? budget.waveCount : 0,
|
|
62
|
+
agent_count: requestedSubagents,
|
|
63
|
+
backend: 'official-codex-subagent',
|
|
64
|
+
reason: policyReason(route, task, profile, required),
|
|
65
|
+
outputs: ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-parent-summary.json', 'subagent-evidence.json'],
|
|
66
|
+
deprecated_fields: ['agent_count']
|
|
29
67
|
};
|
|
30
68
|
}
|
|
31
69
|
export function agentPipelineStage(policy = {}) {
|
|
32
70
|
const required = policy.required !== false;
|
|
71
|
+
const requestedSubagents = required
|
|
72
|
+
? Math.max(1, Math.floor(Number(policy.requested_subagents || policy.agent_count || DEFAULT_NARUTO_REQUESTED_SUBAGENTS)))
|
|
73
|
+
: 0;
|
|
74
|
+
const maxThreads = required
|
|
75
|
+
? Math.max(1, Math.floor(Number(policy.max_threads || DEFAULT_NARUTO_MAX_THREADS)))
|
|
76
|
+
: 0;
|
|
33
77
|
return {
|
|
34
78
|
id: AGENT_INTAKE_STAGE_ID,
|
|
35
|
-
goal: 'Run
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
79
|
+
goal: 'Run a Codex official subagent workflow with disjoint ownership and correlated event evidence.',
|
|
80
|
+
workflow: 'official_codex_subagent',
|
|
81
|
+
requested_subagents: requestedSubagents,
|
|
82
|
+
max_parallel_agent_threads: Math.min(requestedSubagents, maxThreads),
|
|
83
|
+
max_threads: maxThreads,
|
|
84
|
+
max_depth: 1,
|
|
85
|
+
agent_count: requestedSubagents,
|
|
86
|
+
backend: 'official-codex-subagent',
|
|
39
87
|
read_only: false,
|
|
40
|
-
write_policy: 'bounded workspace-write
|
|
41
|
-
outputs: policy.outputs || ['
|
|
88
|
+
write_policy: 'bounded workspace-write with disjoint path leases; parent-owned integration',
|
|
89
|
+
outputs: policy.outputs || ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-parent-summary.json', 'subagent-evidence.json'],
|
|
90
|
+
deprecated_fields: ['agent_count']
|
|
42
91
|
};
|
|
43
92
|
}
|
|
93
|
+
export function explicitlyParallelizable(prompt) {
|
|
94
|
+
return PARALLELIZABLE_RE.test(String(prompt || ''));
|
|
95
|
+
}
|
|
96
|
+
function taskProfile(value, task) {
|
|
97
|
+
return isTaskProfile(value) ? value : classifyTaskProfile(task);
|
|
98
|
+
}
|
|
99
|
+
function normalizeOptions(input) {
|
|
100
|
+
if (typeof input === 'number' && Number.isFinite(input))
|
|
101
|
+
return { agents: input };
|
|
102
|
+
return input && typeof input === 'object' && !Array.isArray(input) ? input : {};
|
|
103
|
+
}
|
|
104
|
+
function firstPositiveNumber(...values) {
|
|
105
|
+
for (const value of values) {
|
|
106
|
+
if (positiveNumber(value))
|
|
107
|
+
return Math.floor(Number(value));
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
function positiveNumber(value) {
|
|
112
|
+
const parsed = Number(value);
|
|
113
|
+
return Number.isFinite(parsed) && parsed > 0;
|
|
114
|
+
}
|
|
115
|
+
function policyReason(route, task, profile, required) {
|
|
116
|
+
if (!required)
|
|
117
|
+
return `task_profile_${profile}_does_not_require_subagents`;
|
|
118
|
+
if (OFFICIAL_SUBAGENT_ROUTE_KEYS.has(routeKey(route)) || EXPLICIT_SUBAGENT_RE.test(String(task || ''))) {
|
|
119
|
+
return 'explicit_official_subagent_route';
|
|
120
|
+
}
|
|
121
|
+
return `task_profile_${profile}_requires_subagents`;
|
|
122
|
+
}
|
|
44
123
|
//# sourceMappingURL=agent-plan.js.map
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import { MANAGED_AGENT_ROLES, managedAgentRoleByFile, managedAgentRoleByName, managedAgentRoleContent,
|
|
3
|
+
import { nowIso, writeJsonAtomic } from '../fsx.js';
|
|
4
|
+
import { MANAGED_AGENT_ROLES, MANAGED_OFFICIAL_SUBAGENT_ROLES, managedAgentRoleByFile, managedAgentRoleByName, managedAgentRoleContent, managedOfficialSubagentRoleByFile, managedOfficialSubagentRoleByName, managedOfficialSubagentRoleContent } from '../managed-assets/managed-assets-manifest.js';
|
|
5
|
+
import { installOfficialSubagentAgentConfigs } from '../subagents/official-subagent-config.js';
|
|
5
6
|
export const AGENT_ROLE_CONFIG_REPAIR_SCHEMA = 'sks.agent-role-config-repair.v1';
|
|
6
|
-
export const SKS_OWNED_AGENT_CONFIGS = new Map(
|
|
7
|
-
role
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export const SKS_OWNED_AGENT_CONFIGS = new Map([
|
|
8
|
+
...MANAGED_OFFICIAL_SUBAGENT_ROLES.map((role) => [
|
|
9
|
+
role.filename,
|
|
10
|
+
{ name: role.codex_name, sandbox: role.sandbox ?? null, content: managedOfficialSubagentRoleContent(role), id: role.id }
|
|
11
|
+
]),
|
|
12
|
+
...MANAGED_AGENT_ROLES.map((role) => [
|
|
13
|
+
role.filename,
|
|
14
|
+
{ name: role.codex_name, sandbox: role.sandbox, content: managedAgentRoleContent(role), id: role.id }
|
|
15
|
+
])
|
|
16
|
+
]);
|
|
10
17
|
export function managedAgentRoleConfigForFile(file) {
|
|
18
|
+
const official = managedOfficialSubagentRoleByFile(file);
|
|
19
|
+
if (official)
|
|
20
|
+
return managedOfficialSubagentRoleContent(official);
|
|
11
21
|
const role = managedAgentRoleByFile(file);
|
|
12
22
|
return role ? managedAgentRoleContent(role) : null;
|
|
13
23
|
}
|
|
14
24
|
export function managedAgentRoleConfigForRole(role) {
|
|
25
|
+
const official = managedOfficialSubagentRoleByName(role);
|
|
26
|
+
if (official)
|
|
27
|
+
return { file: official.filename, content: managedOfficialSubagentRoleContent(official) };
|
|
15
28
|
const match = managedAgentRoleByName(role);
|
|
16
29
|
return match ? { file: match.filename, content: managedAgentRoleContent(match) } : null;
|
|
17
30
|
}
|
|
@@ -19,69 +32,50 @@ export async function repairAgentRoleConfigs(input) {
|
|
|
19
32
|
const root = path.resolve(input.root);
|
|
20
33
|
const codexHome = input.codexHome || process.env.CODEX_HOME || path.join(process.env.HOME || '', '.codex');
|
|
21
34
|
const candidates = [path.join(root, '.codex', 'agents'), path.join(codexHome, 'agents')];
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
35
|
+
const officialRepair = await installOfficialSubagentAgentConfigs(root, { apply: input.apply === true });
|
|
36
|
+
const missing = [...officialRepair.missing];
|
|
37
|
+
const stale = [...officialRepair.stale];
|
|
38
|
+
stale.push(...officialRepair.legacy_stale);
|
|
39
|
+
const created = [...officialRepair.created];
|
|
40
|
+
const repaired = [...officialRepair.updated];
|
|
41
|
+
const removed = [...officialRepair.removed_legacy];
|
|
42
|
+
const existing = [...officialRepair.existing];
|
|
43
|
+
const manualBlockers = [...officialRepair.manual_blockers];
|
|
44
|
+
// Exact historical SKS templates are removed by the official installer.
|
|
45
|
+
// Any user-authored or modified legacy TOML remains an extension surface and
|
|
46
|
+
// is only inventoried here; it is never normalized, overwritten, or deleted.
|
|
28
47
|
for (const role of MANAGED_AGENT_ROLES) {
|
|
29
48
|
const file = role.filename;
|
|
30
|
-
const content = managedAgentRoleContent(role);
|
|
31
49
|
const foundPaths = candidates.map((dir) => path.join(dir, file)).filter((filePath) => fs.existsSync(filePath));
|
|
32
|
-
let managedCopyFound = false;
|
|
33
50
|
for (const foundPath of foundPaths) {
|
|
34
|
-
|
|
35
|
-
if (isValidRoleConfig(text, role)) {
|
|
36
|
-
managedCopyFound = true;
|
|
37
|
-
existing.push(path.relative(root, foundPath) || foundPath);
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
const projectOwnedByFilename = foundPath.startsWith(`${projectAgentsDir}${path.sep}`);
|
|
41
|
-
if (!projectOwnedByFilename && !managedAgentRoleOwnsText(text, role))
|
|
42
|
-
continue;
|
|
43
|
-
managedCopyFound = true;
|
|
44
|
-
stale.push(file);
|
|
45
|
-
if (input.apply) {
|
|
46
|
-
await ensureDir(path.dirname(foundPath));
|
|
47
|
-
await writeTextAtomic(foundPath, content);
|
|
48
|
-
repaired.push(path.relative(root, foundPath) || foundPath);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (managedCopyFound)
|
|
52
|
-
continue;
|
|
53
|
-
missing.push(file);
|
|
54
|
-
if (input.apply) {
|
|
55
|
-
const target = path.join(projectAgentsDir, file);
|
|
56
|
-
await ensureDir(path.dirname(target));
|
|
57
|
-
await writeTextAtomic(target, content);
|
|
58
|
-
created.push(path.relative(root, target));
|
|
51
|
+
existing.push(path.relative(root, foundPath) || foundPath);
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
const requiredFixes = missing.length + stale.length;
|
|
62
|
-
const appliedFixes = created.length + repaired.length;
|
|
55
|
+
const appliedFixes = created.length + repaired.length + removed.length;
|
|
63
56
|
const report = {
|
|
64
57
|
schema: AGENT_ROLE_CONFIG_REPAIR_SCHEMA,
|
|
65
58
|
generated_at: nowIso(),
|
|
66
|
-
ok: input.apply ? requiredFixes === appliedFixes :
|
|
59
|
+
ok: input.apply ? requiredFixes === appliedFixes && manualBlockers.length === 0 : manualBlockers.length === 0,
|
|
67
60
|
apply: input.apply === true,
|
|
68
61
|
missing,
|
|
69
62
|
stale,
|
|
70
63
|
existing,
|
|
71
64
|
created,
|
|
72
65
|
repaired,
|
|
73
|
-
|
|
66
|
+
removed,
|
|
67
|
+
backups: officialRepair.backups,
|
|
68
|
+
manual_blockers: manualBlockers,
|
|
69
|
+
manifest_role_ids: MANAGED_OFFICIAL_SUBAGENT_ROLES.map((role) => role.id),
|
|
70
|
+
legacy_compatibility_role_ids: MANAGED_AGENT_ROLES.map((role) => role.id),
|
|
74
71
|
warnings_suppressed: true,
|
|
75
|
-
blockers:
|
|
72
|
+
blockers: [
|
|
73
|
+
...manualBlockers,
|
|
74
|
+
...(input.apply && requiredFixes !== appliedFixes ? ['agent_role_config_repair_incomplete'] : [])
|
|
75
|
+
]
|
|
76
76
|
};
|
|
77
77
|
if (input.reportPath)
|
|
78
78
|
await writeJsonAtomic(input.reportPath, report);
|
|
79
79
|
return report;
|
|
80
80
|
}
|
|
81
|
-
function isValidRoleConfig(text, role) {
|
|
82
|
-
return managedAgentRoleOwnsText(text, role)
|
|
83
|
-
&& text.includes('description = "')
|
|
84
|
-
&& text.includes('developer_instructions = """')
|
|
85
|
-
&& !/^\s*(?:model|model_reasoning_effort)\s*=/m.test(text);
|
|
86
|
-
}
|
|
87
81
|
//# sourceMappingURL=agent-role-config.js.map
|