sneakoscope 7.0.2 → 7.0.3
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 +7 -5
- 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-registry.js +0 -2
- package/dist/cli/install-helpers-codex-lb-chain.js +24 -2
- package/dist/cli/install-helpers-codex-lb-config.js +0 -7
- 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.js +81 -96
- package/dist/cli/router.js +0 -22
- package/dist/commands/codex-lb.js +176 -22
- package/dist/commands/codex.js +3 -8
- package/dist/commands/doctor.js +4 -14
- 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 +0 -3
- package/dist/core/agents/agent-orchestrator.js +0 -4
- package/dist/core/agents/agent-proof-evidence.js +0 -2
- package/dist/core/agents/agent-runner-ollama.js +0 -3
- package/dist/core/agents/agent-scheduler.js +0 -5
- 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 +0 -13
- 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/official-goal-mode.js +0 -2
- 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/sks-menubar.js +0 -1
- package/dist/core/codex-app.js +0 -9
- 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-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 +118 -20
- 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 +0 -2
- package/dist/core/commands/agent-bridge-command.js +28 -8
- package/dist/core/commands/basic-cli.js +67 -26
- 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 +0 -38
- package/dist/core/commands/naruto-command.js +46 -12
- 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/doctor-codex-startup-repair.js +0 -3
- 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-managed-residue-private.js +0 -1
- package/dist/core/doctor/supabase-mcp-repair.js +0 -11
- package/dist/core/feature-fixture-executor.js +0 -48
- package/dist/core/feature-fixtures.js +0 -5
- package/dist/core/fsx.js +11 -12
- 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 +370 -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 +259 -535
- 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 +247 -74
- package/dist/core/init.js +15 -40
- 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 +0 -1
- 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 +0 -12
- package/dist/core/preflight/parallel-preflight-engine.js +0 -11
- 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/glm/bench/glm-benchmark-runner.js +0 -2
- package/dist/core/providers/glm/glm-request-cache.js +0 -3
- package/dist/core/providers/glm/naruto/glm-naruto-command.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-decomposer.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +0 -6
- package/dist/core/providers/glm/naruto/glm-naruto-trace.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +0 -1
- package/dist/core/providers/glm/naruto/glm-naruto-worktree.js +0 -1
- package/dist/core/providers/openrouter/openrouter-secret-store.js +0 -1
- package/dist/core/providers/openrouter/openrouter-stream.js +0 -2
- package/dist/core/questions.js +3 -3
- package/dist/core/release/gate-manifest.js +0 -5
- package/dist/core/release/package-size-budget.js +1 -1
- 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-hermetic-env.js +0 -5
- 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.js +89 -15
- 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 +1 -1
- package/dist/core/subagents/naruto-proof-projection.js +580 -12
- package/dist/core/subagents/official-subagent-config.js +0 -8
- package/dist/core/subagents/official-subagent-preparation.js +6 -5
- package/dist/core/subagents/official-subagent-prompt.js +29 -0
- package/dist/core/subagents/official-subagent-runner.js +343 -37
- package/dist/core/subagents/subagent-evidence.js +378 -9
- package/dist/core/subagents/thread-budget.js +5 -2
- 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 +21 -39
- package/dist/core/update-check.js +2 -14
- package/dist/core/version-manager.js +2 -0
- 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-lane-renderer.js +5 -46
- package/dist/core/zellij/zellij-lane-runtime.js +0 -1
- package/dist/core/zellij/zellij-launcher.js +0 -26
- 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-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 +0 -12
- 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/ProvidersViewController.swift +213 -27
- package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +95 -12
- 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-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-surface-update-e2e-check.js +0 -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 +3 -3
- package/dist/scripts/doctor-fastpath-check.js +0 -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/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 +3 -1
- 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 -1
- 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 +0 -1
- 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 +1 -1
|
@@ -1,12 +1,142 @@
|
|
|
1
1
|
import fsp from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { appendJsonlBounded, nowIso, writeJsonAtomic } from '../fsx.js';
|
|
3
|
+
import { appendJsonlBounded, nowIso, sha256, writeJsonAtomic } from '../fsx.js';
|
|
4
|
+
import { HOST_CAPABILITY_DESCRIPTORS, hostCapabilityDigest } from '../agent-bridge/agent-manifest.js';
|
|
5
|
+
import { HOST_CAPABILITY_EVIDENCE_SCHEMA, HOST_CAPABILITY_RUNTIME_SCHEMA } from '../agent-bridge/host-capability-runtime.js';
|
|
4
6
|
export const SUBAGENT_EVIDENCE_SCHEMA = 'sks.subagent-evidence.v1';
|
|
5
7
|
export const SUBAGENT_EVENT_SCHEMA = 'sks.subagent-event.v1';
|
|
6
8
|
export const SUBAGENT_PARENT_SUMMARY_SCHEMA = 'sks.subagent-parent-summary.v1';
|
|
7
9
|
export const SUBAGENT_EVIDENCE_FILENAME = 'subagent-evidence.json';
|
|
8
10
|
export const SUBAGENT_EVENT_LOG_FILENAME = 'subagent-events.jsonl';
|
|
9
11
|
export const SUBAGENT_PARENT_SUMMARY_FILENAME = 'subagent-parent-summary.json';
|
|
12
|
+
const MAX_PARENT_ARTIFACTS = 64;
|
|
13
|
+
const MAX_PARENT_ARTIFACT_PATH_CHARS = 512;
|
|
14
|
+
const MAX_PARENT_CAPABILITY_USES = 64;
|
|
15
|
+
const MAX_PARENT_CAPABILITY_TOOL_NAMES = 64;
|
|
16
|
+
const MAX_HOST_ARTIFACT_SOURCES = 64;
|
|
17
|
+
const SHA256_RECEIPT_PATTERN = /^sha256:[a-f0-9]{64}$/;
|
|
18
|
+
const ARTIFACT_ROLES = new Set(['deliverable', 'scratch', 'temp', 'log']);
|
|
19
|
+
const HOST_CAPABILITY_BY_ID = new Map(HOST_CAPABILITY_DESCRIPTORS.map((descriptor) => [descriptor.id, descriptor]));
|
|
20
|
+
const HOST_ARTIFACT_SOURCE_TOOLS = new Set(HOST_CAPABILITY_BY_ID.get('host.artifact.receipt.v1')?.tool_names || []);
|
|
21
|
+
export function trustedHostCapabilityReceiptBindingBlockers(evidence) {
|
|
22
|
+
const blockers = [];
|
|
23
|
+
const artifactSources = validateHostArtifactSources(evidence, blockers);
|
|
24
|
+
const requestedIds = evidence.runtime.requested_capability_ids;
|
|
25
|
+
const requested = new Set(requestedIds);
|
|
26
|
+
const receiptsById = new Map(evidence.capabilities_used.map((receipt) => [receipt.id, receipt]));
|
|
27
|
+
if (requested.size !== requestedIds.length
|
|
28
|
+
|| receiptsById.size !== evidence.capabilities_used.length
|
|
29
|
+
|| evidence.capabilities_used.some((receipt) => !requested.has(receipt.id))
|
|
30
|
+
|| requestedIds.some((id) => !receiptsById.has(id))) {
|
|
31
|
+
blockers.push('host_capability_requested_receipts_mismatch');
|
|
32
|
+
}
|
|
33
|
+
for (const id of requestedIds) {
|
|
34
|
+
const descriptor = HOST_CAPABILITY_BY_ID.get(id);
|
|
35
|
+
const receipt = receiptsById.get(id);
|
|
36
|
+
if (!descriptor || !receipt)
|
|
37
|
+
continue;
|
|
38
|
+
const relevantCalls = evidence.tool_calls.filter((call) => descriptor.tool_names.includes(call.tool));
|
|
39
|
+
if (descriptor.executable === false) {
|
|
40
|
+
blockers.push(...validateArtifactCapabilityReceipt(receipt, relevantCalls, evidence.artifacts, artifactSources));
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const expectedTools = uniqueStrings(relevantCalls.map((call) => call.tool)).sort();
|
|
44
|
+
const expectedHash = capabilityReceiptSha256(id, relevantCalls.map((call) => call.event_sha256), []);
|
|
45
|
+
if (JSON.stringify(receipt.tool_names) !== JSON.stringify(expectedTools)) {
|
|
46
|
+
blockers.push(`host_capability_receipt_tool_calls_mismatch:${id}`);
|
|
47
|
+
}
|
|
48
|
+
if (receipt.receipt_sha256 !== expectedHash) {
|
|
49
|
+
blockers.push(`host_capability_receipt_sha256_mismatch:${id}`);
|
|
50
|
+
}
|
|
51
|
+
if (receipt.status === 'passed') {
|
|
52
|
+
if (relevantCalls.length === 0)
|
|
53
|
+
blockers.push(`host_capability_passed_call_missing:${id}`);
|
|
54
|
+
if (relevantCalls.some((call) => call.status !== 'passed')) {
|
|
55
|
+
blockers.push(`host_capability_passed_call_failed:${id}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return uniqueStrings(blockers);
|
|
60
|
+
}
|
|
61
|
+
function validateArtifactCapabilityReceipt(receipt, relevantCalls, artifacts, artifactSources) {
|
|
62
|
+
const id = receipt.id;
|
|
63
|
+
const blockers = [];
|
|
64
|
+
const expectedTools = uniqueStrings(relevantCalls.map((call) => call.tool)).sort();
|
|
65
|
+
if (JSON.stringify(receipt.tool_names) !== JSON.stringify(expectedTools)) {
|
|
66
|
+
blockers.push(`host_capability_receipt_artifact_sources_mismatch:${id}`);
|
|
67
|
+
}
|
|
68
|
+
const expectedHash = capabilityReceiptSha256(id, relevantCalls.map((call) => call.event_sha256), artifactSources.map((source) => source.source_event_sha256));
|
|
69
|
+
if (receipt.receipt_sha256 !== expectedHash)
|
|
70
|
+
blockers.push(`host_capability_receipt_sha256_mismatch:${id}`);
|
|
71
|
+
if (receipt.status === 'passed') {
|
|
72
|
+
if (artifacts.length === 0)
|
|
73
|
+
blockers.push(`host_capability_passed_artifact_missing:${id}`);
|
|
74
|
+
if (artifactSources.length === 0)
|
|
75
|
+
blockers.push(`host_capability_passed_artifact_source_missing:${id}`);
|
|
76
|
+
if (relevantCalls.some((call) => call.status !== 'passed')) {
|
|
77
|
+
blockers.push(`host_capability_passed_call_failed:${id}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return blockers;
|
|
81
|
+
}
|
|
82
|
+
function validateHostArtifactSources(evidence, blockers) {
|
|
83
|
+
const value = evidence.artifact_sources;
|
|
84
|
+
if (!Array.isArray(value)) {
|
|
85
|
+
blockers.push('host_artifact_source_mapping_missing');
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
if (value.length > MAX_HOST_ARTIFACT_SOURCES)
|
|
89
|
+
blockers.push('host_artifact_source_mapping_too_many');
|
|
90
|
+
const sources = [];
|
|
91
|
+
for (const row of value.slice(0, MAX_HOST_ARTIFACT_SOURCES)) {
|
|
92
|
+
if (!isRecord(row)
|
|
93
|
+
|| Object.keys(row).some((key) => !['path', 'source_tool', 'source_event_sha256'].includes(key))) {
|
|
94
|
+
blockers.push('host_artifact_source_mapping_invalid');
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const artifactPath = normalizeParentArtifactPath(row.path);
|
|
98
|
+
const sourceTool = boundedParentToken(row.source_tool, 128, /^[A-Za-z][A-Za-z0-9_.:-]*$/);
|
|
99
|
+
const sourceEventSha256 = typeof row.source_event_sha256 === 'string'
|
|
100
|
+
? row.source_event_sha256.trim().toLowerCase()
|
|
101
|
+
: '';
|
|
102
|
+
if (!artifactPath || !sourceTool || !SHA256_RECEIPT_PATTERN.test(sourceEventSha256)) {
|
|
103
|
+
blockers.push('host_artifact_source_mapping_invalid');
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
sources.push({ path: artifactPath, source_tool: sourceTool, source_event_sha256: sourceEventSha256 });
|
|
107
|
+
}
|
|
108
|
+
const artifactPaths = evidence.artifacts.map((artifact) => artifact.path);
|
|
109
|
+
const sourcePaths = sources.map((source) => source.path);
|
|
110
|
+
if (JSON.stringify(artifactPaths) !== JSON.stringify([...artifactPaths].sort((left, right) => left.localeCompare(right)))) {
|
|
111
|
+
blockers.push('host_artifact_source_mapping_order_mismatch');
|
|
112
|
+
}
|
|
113
|
+
if (new Set(sourcePaths).size !== sourcePaths.length)
|
|
114
|
+
blockers.push('host_artifact_source_mapping_duplicate');
|
|
115
|
+
if (artifactPaths.some((artifactPath) => !sourcePaths.includes(artifactPath))) {
|
|
116
|
+
blockers.push('host_artifact_source_mapping_missing');
|
|
117
|
+
}
|
|
118
|
+
if (sourcePaths.some((sourcePath) => !artifactPaths.includes(sourcePath))) {
|
|
119
|
+
blockers.push('host_artifact_source_mapping_forged');
|
|
120
|
+
}
|
|
121
|
+
if (JSON.stringify(sourcePaths) !== JSON.stringify(artifactPaths)) {
|
|
122
|
+
blockers.push('host_artifact_source_mapping_order_mismatch');
|
|
123
|
+
}
|
|
124
|
+
for (const source of sources) {
|
|
125
|
+
if (!HOST_ARTIFACT_SOURCE_TOOLS.has(source.source_tool)) {
|
|
126
|
+
blockers.push('host_artifact_source_mapping_forged');
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const exactPassedCalls = evidence.tool_calls.filter((call) => (call.status === 'passed'
|
|
130
|
+
&& call.tool === source.source_tool
|
|
131
|
+
&& call.event_sha256 === source.source_event_sha256));
|
|
132
|
+
if (exactPassedCalls.length !== 1)
|
|
133
|
+
blockers.push('host_artifact_source_mapping_forged');
|
|
134
|
+
}
|
|
135
|
+
return sources;
|
|
136
|
+
}
|
|
137
|
+
function capabilityReceiptSha256(id, calls, artifacts) {
|
|
138
|
+
return `sha256:${sha256(JSON.stringify({ id, calls, artifacts }))}`;
|
|
139
|
+
}
|
|
10
140
|
export function normalizeSubagentEvent(payload, explicitEventName) {
|
|
11
141
|
const row = isRecord(payload) ? payload : {};
|
|
12
142
|
const nested = isRecord(row.payload)
|
|
@@ -38,9 +168,6 @@ export function normalizeSubagentEvent(payload, explicitEventName) {
|
|
|
38
168
|
const explicitThreadId = firstText(row.thread_id, row.threadId, row.agent_thread_id, row.agentThreadId, row.subagent_thread_id, row.subagentThreadId, nested.thread_id, nested.threadId, nested.agent_thread_id, nested.agentThreadId, nested.subagent_thread_id, nested.subagentThreadId, recordId(row.thread), recordId(nested.thread));
|
|
39
169
|
const agentId = firstText(row.agent_id, row.agentId, nested.agent_id, nested.agentId, recordId(row.agent), recordId(nested.agent));
|
|
40
170
|
const sessionId = firstText(row.session_id, row.sessionId, nested.session_id, nested.sessionId, recordId(row.session), recordId(nested.session));
|
|
41
|
-
// Official SubagentStart/SubagentStop payloads identify the child with
|
|
42
|
-
// agent_id. session_id is the parent/session scope and must never be used as
|
|
43
|
-
// a child identity because every sibling can share it.
|
|
44
171
|
const threadId = explicitThreadId || agentId || null;
|
|
45
172
|
const threadIdSource = explicitThreadId
|
|
46
173
|
? 'thread_id'
|
|
@@ -77,6 +204,8 @@ export function buildSubagentEvidence(input) {
|
|
|
77
204
|
.map((event) => normalizeSubagentEvent(event))
|
|
78
205
|
.filter((event) => Boolean(event));
|
|
79
206
|
const parentSummary = normalizeSubagentParentSummary(input.parentSummary);
|
|
207
|
+
const hostCapabilityEvidence = normalizeTrustedHostCapabilityEvidence(input.hostCapabilityEvidence);
|
|
208
|
+
const hostCapabilityBlockers = validateParentHostCapabilityBinding(parentSummary.raw, hostCapabilityEvidence);
|
|
80
209
|
const runScope = resolveRunScope(input, normalizedEvents, parentSummary);
|
|
81
210
|
const scopedEvents = scopeSubagentEvents(normalizedEvents, runScope);
|
|
82
211
|
const events = scopedEvents.events;
|
|
@@ -88,6 +217,7 @@ export function buildSubagentEvidence(input) {
|
|
|
88
217
|
const eventSources = new Set();
|
|
89
218
|
let missingThreadId = false;
|
|
90
219
|
const parentSummaryStructurallyTrustworthy = parentSummary.trustworthy
|
|
220
|
+
&& hostCapabilityBlockers.length === 0
|
|
91
221
|
&& runScope.blockers.length === 0
|
|
92
222
|
&& runScope.parentBlockers.length === 0;
|
|
93
223
|
const parentCompletedStructurallyTrustworthy = parentSummaryStructurallyTrustworthy
|
|
@@ -213,6 +343,17 @@ export function buildSubagentEvidence(input) {
|
|
|
213
343
|
blockers.push(...parentSummary.blockers);
|
|
214
344
|
if (parentSummary.status === 'failed')
|
|
215
345
|
blockers.push('parent_summary_failed');
|
|
346
|
+
blockers.push(...hostCapabilityBlockers);
|
|
347
|
+
if (input.hostCapabilityEvidence !== undefined && input.hostCapabilityEvidence !== null && !hostCapabilityEvidence) {
|
|
348
|
+
blockers.push('host_capability_evidence_invalid');
|
|
349
|
+
}
|
|
350
|
+
if (hostCapabilityEvidence) {
|
|
351
|
+
blockers.push(...hostCapabilityEvidence.blockers);
|
|
352
|
+
if (hostCapabilityEvidence.ok !== (hostCapabilityEvidence.blockers.length === 0
|
|
353
|
+
&& hostCapabilityEvidence.capabilities_used.every((receipt) => receipt.status === 'passed'))) {
|
|
354
|
+
blockers.push('host_capability_evidence_status_inconsistent');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
216
357
|
for (const blocker of input.additionalBlockers || []) {
|
|
217
358
|
const normalized = String(blocker || '').trim();
|
|
218
359
|
if (normalized)
|
|
@@ -224,7 +365,7 @@ export function buildSubagentEvidence(input) {
|
|
|
224
365
|
? 'preparation_only'
|
|
225
366
|
: ok
|
|
226
367
|
? 'completed'
|
|
227
|
-
: failedThreadIds.length > 0
|
|
368
|
+
: failedThreadIds.length > 0 || hostCapabilityBlockers.length > 0 || Boolean(hostCapabilityEvidence && !hostCapabilityEvidence.ok)
|
|
228
369
|
? 'blocked'
|
|
229
370
|
: 'incomplete';
|
|
230
371
|
return {
|
|
@@ -255,7 +396,8 @@ export function buildSubagentEvidence(input) {
|
|
|
255
396
|
preparation_only: preparationOnly,
|
|
256
397
|
status,
|
|
257
398
|
ok,
|
|
258
|
-
blockers: uniqueBlockers
|
|
399
|
+
blockers: uniqueBlockers,
|
|
400
|
+
...(hostCapabilityEvidence ? { host_capability_evidence: hostCapabilityEvidence } : {})
|
|
259
401
|
};
|
|
260
402
|
}
|
|
261
403
|
export async function recordSubagentEvent(artifactDir, payload, explicitEventName) {
|
|
@@ -392,7 +534,19 @@ export function normalizeSubagentParentSummary(value) {
|
|
|
392
534
|
const summary = String(parsed.summary || '').trim();
|
|
393
535
|
if (typeof parsed.summary !== 'string' || !summary)
|
|
394
536
|
blockers.push('parent_summary_text_missing');
|
|
395
|
-
const topLevelKeys = new Set([
|
|
537
|
+
const topLevelKeys = new Set([
|
|
538
|
+
'schema',
|
|
539
|
+
'status',
|
|
540
|
+
'summary',
|
|
541
|
+
'thread_outcomes',
|
|
542
|
+
'changed_files',
|
|
543
|
+
'verification',
|
|
544
|
+
'blockers',
|
|
545
|
+
'run_id',
|
|
546
|
+
'run_epoch',
|
|
547
|
+
'artifacts',
|
|
548
|
+
'capabilities_used'
|
|
549
|
+
]);
|
|
396
550
|
for (const key of Object.keys(parsed)) {
|
|
397
551
|
if (!topLevelKeys.has(key))
|
|
398
552
|
blockers.push(`parent_summary_unknown_field:${key}`);
|
|
@@ -411,6 +565,8 @@ export function normalizeSubagentParentSummary(value) {
|
|
|
411
565
|
if (parsed.blockers !== undefined && (!Array.isArray(parsed.blockers) || parsed.blockers.some((item) => typeof item !== 'string'))) {
|
|
412
566
|
blockers.push('parent_summary_blockers_invalid');
|
|
413
567
|
}
|
|
568
|
+
const parentArtifacts = validateParentArtifactReceipts(parsed.artifacts, blockers);
|
|
569
|
+
const parentCapabilities = validateParentCapabilityUseReceipts(parsed.capabilities_used, blockers);
|
|
414
570
|
if (!Array.isArray(parsed.thread_outcomes) || parsed.thread_outcomes.length === 0) {
|
|
415
571
|
blockers.push('parent_thread_outcomes_missing');
|
|
416
572
|
}
|
|
@@ -452,6 +608,17 @@ export function normalizeSubagentParentSummary(value) {
|
|
|
452
608
|
if (status === 'completed' && Array.isArray(parsed.blockers) && parsed.blockers.length > 0) {
|
|
453
609
|
blockers.push('parent_summary_completed_with_blockers');
|
|
454
610
|
}
|
|
611
|
+
if (status === 'completed') {
|
|
612
|
+
for (const receipt of parentCapabilities || []) {
|
|
613
|
+
if (receipt.status !== 'passed')
|
|
614
|
+
blockers.push(`parent_summary_capability_not_passed:${receipt.id}`);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const raw = {
|
|
618
|
+
...parsed,
|
|
619
|
+
...(parsed.artifacts === undefined ? {} : { artifacts: parentArtifacts || [] }),
|
|
620
|
+
...(parsed.capabilities_used === undefined ? {} : { capabilities_used: parentCapabilities || [] })
|
|
621
|
+
};
|
|
455
622
|
return {
|
|
456
623
|
present: true,
|
|
457
624
|
trustworthy: blockers.length === 0,
|
|
@@ -461,7 +628,7 @@ export function normalizeSubagentParentSummary(value) {
|
|
|
461
628
|
run_epoch: firstText(parsed.run_epoch) || null,
|
|
462
629
|
thread_outcomes: threadOutcomes,
|
|
463
630
|
blockers: uniqueStrings(blockers.length ? blockers : []),
|
|
464
|
-
raw
|
|
631
|
+
raw
|
|
465
632
|
};
|
|
466
633
|
}
|
|
467
634
|
function parseStructuredParentSummary(value) {
|
|
@@ -490,6 +657,208 @@ function validStructuredParentSummary(value) {
|
|
|
490
657
|
return null;
|
|
491
658
|
return value;
|
|
492
659
|
}
|
|
660
|
+
function validateParentArtifactReceipts(value, blockers) {
|
|
661
|
+
if (value === undefined)
|
|
662
|
+
return undefined;
|
|
663
|
+
if (!Array.isArray(value)) {
|
|
664
|
+
blockers.push('parent_summary_artifacts_invalid');
|
|
665
|
+
return undefined;
|
|
666
|
+
}
|
|
667
|
+
if (value.length > MAX_PARENT_ARTIFACTS)
|
|
668
|
+
blockers.push('parent_summary_artifacts_too_many');
|
|
669
|
+
const result = [];
|
|
670
|
+
const seen = new Set();
|
|
671
|
+
for (const row of value.slice(0, MAX_PARENT_ARTIFACTS)) {
|
|
672
|
+
if (!isRecord(row)) {
|
|
673
|
+
blockers.push('parent_summary_artifact_invalid');
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
const artifactPath = normalizeParentArtifactPath(row.path);
|
|
677
|
+
const kind = boundedParentToken(row.kind, 64, /^[a-z][a-z0-9_-]*$/);
|
|
678
|
+
const mediaType = boundedParentToken(row.media_type, 160, /^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/i);
|
|
679
|
+
const receiptHash = typeof row.sha256 === 'string' && SHA256_RECEIPT_PATTERN.test(row.sha256)
|
|
680
|
+
? row.sha256
|
|
681
|
+
: null;
|
|
682
|
+
const bytes = typeof row.bytes === 'number' && Number.isSafeInteger(row.bytes) && row.bytes > 0
|
|
683
|
+
? row.bytes
|
|
684
|
+
: null;
|
|
685
|
+
const role = typeof row.role === 'string' && ARTIFACT_ROLES.has(row.role)
|
|
686
|
+
? row.role
|
|
687
|
+
: null;
|
|
688
|
+
if (!artifactPath)
|
|
689
|
+
blockers.push('parent_summary_artifact_path_invalid');
|
|
690
|
+
if (!kind)
|
|
691
|
+
blockers.push('parent_summary_artifact_kind_invalid');
|
|
692
|
+
if (!mediaType)
|
|
693
|
+
blockers.push('parent_summary_artifact_media_type_invalid');
|
|
694
|
+
if (!receiptHash)
|
|
695
|
+
blockers.push('parent_summary_artifact_sha256_invalid');
|
|
696
|
+
if (bytes === null)
|
|
697
|
+
blockers.push('parent_summary_artifact_bytes_invalid');
|
|
698
|
+
if (!role)
|
|
699
|
+
blockers.push('parent_summary_artifact_role_invalid');
|
|
700
|
+
if (!artifactPath || !kind || !mediaType || !receiptHash || bytes === null || !role)
|
|
701
|
+
continue;
|
|
702
|
+
if (seen.has(artifactPath)) {
|
|
703
|
+
blockers.push('parent_summary_artifact_path_duplicate');
|
|
704
|
+
continue;
|
|
705
|
+
}
|
|
706
|
+
seen.add(artifactPath);
|
|
707
|
+
result.push({ path: artifactPath, kind, media_type: mediaType, sha256: receiptHash, bytes, role });
|
|
708
|
+
}
|
|
709
|
+
return result;
|
|
710
|
+
}
|
|
711
|
+
function validateParentCapabilityUseReceipts(value, blockers) {
|
|
712
|
+
if (value === undefined)
|
|
713
|
+
return undefined;
|
|
714
|
+
if (!Array.isArray(value)) {
|
|
715
|
+
blockers.push('parent_summary_capabilities_used_invalid');
|
|
716
|
+
return undefined;
|
|
717
|
+
}
|
|
718
|
+
if (value.length > MAX_PARENT_CAPABILITY_USES)
|
|
719
|
+
blockers.push('parent_summary_capabilities_used_too_many');
|
|
720
|
+
const result = [];
|
|
721
|
+
const seen = new Set();
|
|
722
|
+
for (const row of value.slice(0, MAX_PARENT_CAPABILITY_USES)) {
|
|
723
|
+
if (!isRecord(row)) {
|
|
724
|
+
blockers.push('parent_summary_capability_use_invalid');
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
const id = typeof row.id === 'string' ? row.id.trim() : '';
|
|
728
|
+
const descriptor = HOST_CAPABILITY_BY_ID.get(id);
|
|
729
|
+
const status = row.status === 'passed' || row.status === 'failed' ? row.status : null;
|
|
730
|
+
const toolNames = normalizeParentCapabilityToolNames(row.tool_names, descriptor?.tool_names || [], status);
|
|
731
|
+
const receiptHash = typeof row.receipt_sha256 === 'string' && SHA256_RECEIPT_PATTERN.test(row.receipt_sha256)
|
|
732
|
+
? row.receipt_sha256
|
|
733
|
+
: null;
|
|
734
|
+
if (!descriptor)
|
|
735
|
+
blockers.push(`parent_summary_capability_use_unknown:${id || '<missing>'}`);
|
|
736
|
+
if (!status)
|
|
737
|
+
blockers.push('parent_summary_capability_use_status_invalid');
|
|
738
|
+
if (!toolNames)
|
|
739
|
+
blockers.push('parent_summary_capability_use_tool_names_invalid');
|
|
740
|
+
if (!receiptHash)
|
|
741
|
+
blockers.push('parent_summary_capability_use_receipt_sha256_invalid');
|
|
742
|
+
if (!descriptor || !status || !toolNames || !receiptHash)
|
|
743
|
+
continue;
|
|
744
|
+
if (seen.has(id)) {
|
|
745
|
+
blockers.push(`parent_summary_capability_use_duplicate:${id}`);
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
seen.add(id);
|
|
749
|
+
result.push({ id, status, tool_names: toolNames, receipt_sha256: receiptHash });
|
|
750
|
+
}
|
|
751
|
+
return result;
|
|
752
|
+
}
|
|
753
|
+
function normalizeParentArtifactPath(value) {
|
|
754
|
+
if (typeof value !== 'string')
|
|
755
|
+
return null;
|
|
756
|
+
const original = value.trim();
|
|
757
|
+
if (!original || original.length > MAX_PARENT_ARTIFACT_PATH_CHARS || /[\r\n\0\\]/.test(original))
|
|
758
|
+
return null;
|
|
759
|
+
if (path.posix.isAbsolute(original) || path.win32.isAbsolute(original))
|
|
760
|
+
return null;
|
|
761
|
+
const normalized = path.posix.normalize(original).replace(/^\.\//, '');
|
|
762
|
+
if (!normalized || normalized === '.' || normalized === '..' || normalized.startsWith('../'))
|
|
763
|
+
return null;
|
|
764
|
+
return normalized.length <= MAX_PARENT_ARTIFACT_PATH_CHARS ? normalized : null;
|
|
765
|
+
}
|
|
766
|
+
function normalizeParentCapabilityToolNames(value, allowed, status) {
|
|
767
|
+
if (!Array.isArray(value) || value.length > MAX_PARENT_CAPABILITY_TOOL_NAMES)
|
|
768
|
+
return null;
|
|
769
|
+
if (status === 'passed' && value.length === 0)
|
|
770
|
+
return null;
|
|
771
|
+
const allowedSet = new Set(allowed);
|
|
772
|
+
const result = [];
|
|
773
|
+
const seen = new Set();
|
|
774
|
+
for (const item of value) {
|
|
775
|
+
const tool = boundedParentToken(item, 128, /^[A-Za-z][A-Za-z0-9_.:-]*$/);
|
|
776
|
+
if (!tool || !allowedSet.has(tool) || seen.has(tool))
|
|
777
|
+
return null;
|
|
778
|
+
seen.add(tool);
|
|
779
|
+
result.push(tool);
|
|
780
|
+
}
|
|
781
|
+
return result;
|
|
782
|
+
}
|
|
783
|
+
function boundedParentToken(value, maxChars, pattern) {
|
|
784
|
+
if (typeof value !== 'string')
|
|
785
|
+
return null;
|
|
786
|
+
const text = value.trim();
|
|
787
|
+
return text && text.length <= maxChars && !/[\r\n\0]/.test(text) && pattern.test(text) ? text : null;
|
|
788
|
+
}
|
|
789
|
+
function normalizeTrustedHostCapabilityEvidence(value) {
|
|
790
|
+
if (value === undefined || value === null)
|
|
791
|
+
return null;
|
|
792
|
+
if (!isRecord(value)
|
|
793
|
+
|| value.schema !== HOST_CAPABILITY_EVIDENCE_SCHEMA
|
|
794
|
+
|| typeof value.ok !== 'boolean'
|
|
795
|
+
|| !isRecord(value.runtime)
|
|
796
|
+
|| value.runtime.schema !== HOST_CAPABILITY_RUNTIME_SCHEMA
|
|
797
|
+
|| value.runtime.server !== 'acas-tools'
|
|
798
|
+
|| value.runtime.capability_digest !== hostCapabilityDigest(HOST_CAPABILITY_DESCRIPTORS)
|
|
799
|
+
|| !Array.isArray(value.runtime.requested_capability_ids)
|
|
800
|
+
|| value.runtime.requested_capability_ids.some((id) => typeof id !== 'string' || !HOST_CAPABILITY_BY_ID.has(id))
|
|
801
|
+
|| new Set(value.runtime.requested_capability_ids).size !== value.runtime.requested_capability_ids.length
|
|
802
|
+
|| !Array.isArray(value.tool_calls)
|
|
803
|
+
|| !Array.isArray(value.capabilities_used)
|
|
804
|
+
|| !Array.isArray(value.artifacts)
|
|
805
|
+
|| !Array.isArray(value.artifact_sources)
|
|
806
|
+
|| !Array.isArray(value.blockers)
|
|
807
|
+
|| value.blockers.some((blocker) => typeof blocker !== 'string')) {
|
|
808
|
+
return null;
|
|
809
|
+
}
|
|
810
|
+
const validationBlockers = [];
|
|
811
|
+
const capabilities = validateParentCapabilityUseReceipts(value.capabilities_used, validationBlockers);
|
|
812
|
+
const artifacts = validateParentArtifactReceipts(value.artifacts, validationBlockers);
|
|
813
|
+
if (!capabilities || !artifacts || validationBlockers.length > 0)
|
|
814
|
+
return null;
|
|
815
|
+
const knownTools = new Set(HOST_CAPABILITY_DESCRIPTORS.flatMap((descriptor) => descriptor.tool_names));
|
|
816
|
+
if (value.tool_calls.length > 1024 || value.tool_calls.some((row) => {
|
|
817
|
+
if (!isRecord(row))
|
|
818
|
+
return true;
|
|
819
|
+
return row.server !== 'acas-tools'
|
|
820
|
+
|| typeof row.tool !== 'string'
|
|
821
|
+
|| !knownTools.has(row.tool)
|
|
822
|
+
|| (row.status !== 'passed' && row.status !== 'failed')
|
|
823
|
+
|| typeof row.event_sha256 !== 'string'
|
|
824
|
+
|| !SHA256_RECEIPT_PATTERN.test(row.event_sha256);
|
|
825
|
+
}))
|
|
826
|
+
return null;
|
|
827
|
+
const evidence = {
|
|
828
|
+
...value,
|
|
829
|
+
capabilities_used: capabilities,
|
|
830
|
+
artifacts,
|
|
831
|
+
artifact_sources: value.artifact_sources
|
|
832
|
+
};
|
|
833
|
+
return trustedHostCapabilityReceiptBindingBlockers(evidence).length === 0 ? evidence : null;
|
|
834
|
+
}
|
|
835
|
+
function validateParentHostCapabilityBinding(parent, evidence) {
|
|
836
|
+
const parentClaims = hasNonEmptyHostCapabilityClaim(parent?.artifacts)
|
|
837
|
+
|| hasNonEmptyHostCapabilityClaim(parent?.capabilities_used);
|
|
838
|
+
if (!evidence)
|
|
839
|
+
return parentClaims ? ['parent_summary_host_capability_evidence_missing'] : [];
|
|
840
|
+
const bindingRequired = parentClaims
|
|
841
|
+
|| evidence.runtime.requested_capability_ids.length > 0
|
|
842
|
+
|| evidence.tool_calls.length > 0
|
|
843
|
+
|| evidence.artifacts.length > 0;
|
|
844
|
+
if (!bindingRequired)
|
|
845
|
+
return [];
|
|
846
|
+
const blockers = [];
|
|
847
|
+
const artifactBlockers = [];
|
|
848
|
+
const capabilityBlockers = [];
|
|
849
|
+
const parentArtifacts = validateParentArtifactReceipts(parent?.artifacts, artifactBlockers);
|
|
850
|
+
const parentCapabilities = validateParentCapabilityUseReceipts(parent?.capabilities_used, capabilityBlockers);
|
|
851
|
+
if (artifactBlockers.length > 0 || JSON.stringify(parentArtifacts || []) !== JSON.stringify(evidence.artifacts)) {
|
|
852
|
+
blockers.push('parent_summary_host_artifacts_mismatch');
|
|
853
|
+
}
|
|
854
|
+
if (capabilityBlockers.length > 0 || JSON.stringify(parentCapabilities || []) !== JSON.stringify(evidence.capabilities_used)) {
|
|
855
|
+
blockers.push('parent_summary_host_capabilities_mismatch');
|
|
856
|
+
}
|
|
857
|
+
return blockers;
|
|
858
|
+
}
|
|
859
|
+
function hasNonEmptyHostCapabilityClaim(value) {
|
|
860
|
+
return Array.isArray(value) ? value.length > 0 : value !== undefined;
|
|
861
|
+
}
|
|
493
862
|
function hasFocusedParentVerification(value) {
|
|
494
863
|
if (!Array.isArray(value))
|
|
495
864
|
return false;
|
|
@@ -578,7 +947,7 @@ function parentResultExplicitlyFailed(value) {
|
|
|
578
947
|
|| containsUnambiguousFailureText(resultText);
|
|
579
948
|
}
|
|
580
949
|
function isFailureWorkflowStatus(value) {
|
|
581
|
-
return /^(parent_failed|failed|blocked|incomplete|cancelled|canceled|timed[_ -]?out)$/i.test(String(value || '').trim());
|
|
950
|
+
return /^(parent_failed|host_capability_blocked|failed|blocked|incomplete|cancelled|canceled|timed[_ -]?out)$/i.test(String(value || '').trim());
|
|
582
951
|
}
|
|
583
952
|
function resolveRunScope(input, events, parentSummary) {
|
|
584
953
|
const requestedRunId = firstText(input.runId);
|
|
@@ -6,9 +6,12 @@ export const DEFAULT_NARUTO_REVIEWER_THREAD_RESERVATION = 1;
|
|
|
6
6
|
export function resolveSubagentThreadBudget(input = {}) {
|
|
7
7
|
const requested = clamp(input.requested ?? input.independentSliceCount ?? DEFAULT_NARUTO_REQUESTED_SUBAGENTS, 1, HARD_NARUTO_MAX_THREADS);
|
|
8
8
|
const configured = clamp(input.configuredMaxThreads ?? DEFAULT_NARUTO_MAX_THREADS, 1, HARD_NARUTO_MAX_THREADS);
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const requestedParentThreads = clampNonNegative(input.parentReservedThreads ?? DEFAULT_NARUTO_PARENT_THREAD_RESERVATION, HARD_NARUTO_MAX_THREADS);
|
|
10
|
+
const requestedReviewerThreads = clampNonNegative(input.reviewerReservedThreads ?? DEFAULT_NARUTO_REVIEWER_THREAD_RESERVATION, HARD_NARUTO_MAX_THREADS);
|
|
11
11
|
const activeThreads = clampNonNegative(input.activeThreadCount ?? 0, HARD_NARUTO_MAX_THREADS);
|
|
12
|
+
const reservationCapacity = Math.max(0, configured - activeThreads - 1);
|
|
13
|
+
const parentThreads = Math.min(requestedParentThreads, reservationCapacity);
|
|
14
|
+
const reviewerThreads = Math.min(requestedReviewerThreads, reservationCapacity - parentThreads);
|
|
12
15
|
const availableThreadSlots = Math.max(0, configured - parentThreads - reviewerThreads - activeThreads);
|
|
13
16
|
const marginalUsefulThroughputPositive = input.marginalUsefulThroughputPositive !== false;
|
|
14
17
|
const bounds = {
|
|
@@ -55,10 +55,6 @@ function selectAnchors(useFirst, hydrateHints, hydrateOrder, limit, query) {
|
|
|
55
55
|
return useFirst.slice(0, limit).map(stripOrder);
|
|
56
56
|
const selected = [];
|
|
57
57
|
const seen = new Set();
|
|
58
|
-
// Keep the leading high-trust policy anchors, then spend the remaining
|
|
59
|
-
// budget on query-relevant use_first or hydrate-first candidates. Hydrate-
|
|
60
|
-
// only rows stay hints: workers must open the cited source before relying on
|
|
61
|
-
// them, so relevance improves without treating lower-trust summaries as fact.
|
|
62
58
|
for (const anchor of useFirst.slice(0, Math.min(3, limit))) {
|
|
63
59
|
selected.push(stripOrder(anchor));
|
|
64
60
|
seen.add(anchor.id);
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
+
import { HARD_NARUTO_MAX_THREADS } from './thread-budget.js';
|
|
1
2
|
export const WAVE_PARENT_GUIDANCE_SCHEMA = 'sks.subagent-wave-parent-guidance.v1';
|
|
3
|
+
const SUBAGENT_WAVE_LIFECYCLE_SCHEMA = 'sks.subagent-wave-lifecycle.v1';
|
|
4
|
+
const OFFICIAL_SUBAGENT_PLAN_SCHEMA = 'sks.subagent-plan.v1';
|
|
5
|
+
const OFFICIAL_SUBAGENT_WORKFLOW = 'official_codex_subagent';
|
|
6
|
+
const CLOSE_COMPLETED_THREADS_ACTION = 'close_completed_child_threads_after_collecting_results';
|
|
7
|
+
const REFRESH_LIFECYCLE_ACTION = 'refresh_wave_lifecycle_and_ready_dag';
|
|
8
|
+
const SPAWN_NEXT_WAVE_ACTION = 'spawn_next_direct_child_wave_upto';
|
|
9
|
+
const EMIT_PARENT_SUMMARY_ACTION = 'integrate_settled_child_results_and_emit_parent_summary';
|
|
2
10
|
export function buildWaveParentGuidance(lifecycle) {
|
|
3
|
-
const remaining =
|
|
4
|
-
const openThreads =
|
|
5
|
-
const recovered =
|
|
11
|
+
const remaining = boundedLifecycleCount(lifecycle?.remaining_to_start);
|
|
12
|
+
const openThreads = boundedLifecycleCount(lifecycle?.open_threads);
|
|
13
|
+
const recovered = boundedLifecycleCount(lifecycle?.recovered_capacity);
|
|
6
14
|
const rescan = lifecycle?.post_wave_rescan_required === true;
|
|
7
15
|
const actions = [];
|
|
8
16
|
if (openThreads > 0) {
|
|
9
|
-
actions.push(
|
|
17
|
+
actions.push(CLOSE_COMPLETED_THREADS_ACTION);
|
|
10
18
|
}
|
|
11
19
|
if (rescan || remaining > 0) {
|
|
12
|
-
actions.push(
|
|
13
|
-
|
|
20
|
+
actions.push(REFRESH_LIFECYCLE_ACTION);
|
|
21
|
+
const nextWaveLimit = Math.max(1, Math.min(remaining || recovered, recovered || remaining || 1));
|
|
22
|
+
actions.push(`${SPAWN_NEXT_WAVE_ACTION}:${nextWaveLimit}`);
|
|
14
23
|
}
|
|
15
24
|
if (remaining === 0 && openThreads === 0 && !rescan) {
|
|
16
|
-
actions.push(
|
|
25
|
+
actions.push(EMIT_PARENT_SUMMARY_ACTION);
|
|
17
26
|
}
|
|
18
27
|
return {
|
|
19
28
|
schema: WAVE_PARENT_GUIDANCE_SCHEMA,
|
|
@@ -23,10 +32,41 @@ export function buildWaveParentGuidance(lifecycle) {
|
|
|
23
32
|
open_threads: openThreads,
|
|
24
33
|
recovered_capacity: recovered,
|
|
25
34
|
post_wave_rescan_required: rescan,
|
|
26
|
-
current_wave:
|
|
27
|
-
completed_waves:
|
|
35
|
+
current_wave: boundedLifecycleCount(lifecycle?.current_wave),
|
|
36
|
+
completed_waves: boundedLifecycleCount(lifecycle?.completed_waves)
|
|
28
37
|
};
|
|
29
38
|
}
|
|
39
|
+
export function buildBoundWaveParentGuidance(plan, binding) {
|
|
40
|
+
if (!plan || typeof plan !== 'object' || Array.isArray(plan))
|
|
41
|
+
return null;
|
|
42
|
+
const row = plan;
|
|
43
|
+
const missionId = String(binding.missionId || '').trim();
|
|
44
|
+
const workflowRunId = String(binding.workflowRunId || '').trim();
|
|
45
|
+
if (!missionId || !workflowRunId)
|
|
46
|
+
return null;
|
|
47
|
+
if (row.schema !== OFFICIAL_SUBAGENT_PLAN_SCHEMA || row.workflow !== OFFICIAL_SUBAGENT_WORKFLOW)
|
|
48
|
+
return null;
|
|
49
|
+
if (String(row.mission_id || '').trim() !== missionId)
|
|
50
|
+
return null;
|
|
51
|
+
if (String(row.workflow_run_id || '').trim() !== workflowRunId)
|
|
52
|
+
return null;
|
|
53
|
+
const lifecycle = row.wave_lifecycle;
|
|
54
|
+
if (!lifecycle || typeof lifecycle !== 'object' || Array.isArray(lifecycle))
|
|
55
|
+
return null;
|
|
56
|
+
const lifecycleRow = lifecycle;
|
|
57
|
+
if (lifecycleRow.schema !== SUBAGENT_WAVE_LIFECYCLE_SCHEMA)
|
|
58
|
+
return null;
|
|
59
|
+
if (String(lifecycleRow.workflow_run_id || '').trim() !== workflowRunId)
|
|
60
|
+
return null;
|
|
61
|
+
return buildWaveParentGuidance({
|
|
62
|
+
remaining_to_start: boundedLifecycleCount(lifecycleRow.remaining_to_start),
|
|
63
|
+
open_threads: boundedLifecycleCount(lifecycleRow.open_threads),
|
|
64
|
+
recovered_capacity: boundedLifecycleCount(lifecycleRow.recovered_capacity),
|
|
65
|
+
post_wave_rescan_required: lifecycleRow.post_wave_rescan_required === true,
|
|
66
|
+
current_wave: boundedLifecycleCount(lifecycleRow.current_wave),
|
|
67
|
+
completed_waves: boundedLifecycleCount(lifecycleRow.completed_waves)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
30
70
|
export function renderWaveParentGuidance(guidance) {
|
|
31
71
|
if (!guidance.required && guidance.actions.length === 0)
|
|
32
72
|
return '';
|
|
@@ -40,3 +80,8 @@ export function renderWaveParentGuidance(guidance) {
|
|
|
40
80
|
'- after collecting results, close completed child threads so recovered capacity can be reused'
|
|
41
81
|
].join('\n');
|
|
42
82
|
}
|
|
83
|
+
function boundedLifecycleCount(value) {
|
|
84
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
85
|
+
return 0;
|
|
86
|
+
return Math.max(0, Math.min(HARD_NARUTO_MAX_THREADS, Math.floor(value)));
|
|
87
|
+
}
|
|
@@ -11,7 +11,6 @@ const EXPORT_LINE_RE = /^\s*export\s+(?:default\s+)?(?:const|let|var|function|cl
|
|
|
11
11
|
const EXPORT_BRACE_RE = /^\s*export\s*\{/;
|
|
12
12
|
const EXPORT_STAR_RE = /^\s*export\s*\*/;
|
|
13
13
|
const IMPORT_SPEC_RE = /(?:from\s+|require\()\s*['"](\.\.?\/[^'"]+)['"]/g;
|
|
14
|
-
// High fan-in or a large file surface both correlate with change blast-radius; simple counts avoid needing a real dependency graph.
|
|
15
14
|
const RISK_HIGH_FAN_IN = 5;
|
|
16
15
|
const RISK_HIGH_FILE_COUNT = 40;
|
|
17
16
|
const RISK_MEDIUM_FAN_IN = 2;
|
|
@@ -258,7 +257,6 @@ function collectEntryPoints(root, dir, files) {
|
|
|
258
257
|
entryPoints.add(normalizeEntryPath(dir, value));
|
|
259
258
|
}
|
|
260
259
|
catch {
|
|
261
|
-
// malformed package.json at a module boundary is not this scanner's concern; skip entry-point inference for it
|
|
262
260
|
}
|
|
263
261
|
}
|
|
264
262
|
for (const file of files) {
|
|
@@ -304,7 +302,6 @@ function resolveRelativeImport(root, fromRel, specifier) {
|
|
|
304
302
|
const absolute = path.join(root, candidate);
|
|
305
303
|
if (!fs.existsSync(absolute))
|
|
306
304
|
continue;
|
|
307
|
-
// only resolve to a real file — a bare directory match (no extension) can't be looked up in the file->module index
|
|
308
305
|
if (fs.statSync(absolute).isFile())
|
|
309
306
|
return candidate;
|
|
310
307
|
}
|
|
@@ -17,19 +17,11 @@ export async function inspectCodePackHeadFreshness(root, packShaInput, opts = {}
|
|
|
17
17
|
return staleWithCurrentHead(root, null, timeoutMs, fastHead, false, 'invalid_pack_sha');
|
|
18
18
|
if (fastHead === packSha)
|
|
19
19
|
return freshness(true, true, 'exact_head', fastHead, packSha, false, []);
|
|
20
|
-
// Only the non-blocking hook consumes this cache. Authoritative wiki
|
|
21
|
-
// validation always replays Git history and never trusts advisory state.
|
|
22
20
|
if (opts.advisoryCache && fastHead) {
|
|
23
21
|
const cached = await readAdvisoryCache(root, packSha, fastHead);
|
|
24
22
|
if (cached)
|
|
25
23
|
return cached;
|
|
26
24
|
}
|
|
27
|
-
// One common-path Git process returns HEAD plus every committed path after
|
|
28
|
-
// the pack was generated. Excluding all parents of packSha keeps packSha in
|
|
29
|
-
// the walk (including a root commit), so its presence proves ancestry. We
|
|
30
|
-
// keep scanning after the pack marker because a later merge can introduce
|
|
31
|
-
// sibling-branch commits that Git orders after packSha. `-m` exposes merge
|
|
32
|
-
// resolution paths and `--no-renames` makes touched paths auditable.
|
|
33
25
|
const history = await runProcess('git', [
|
|
34
26
|
'-c',
|
|
35
27
|
'core.quotepath=true',
|
|
@@ -106,8 +98,6 @@ function parseHistory(stdout, packSha) {
|
|
|
106
98
|
}
|
|
107
99
|
if (activeCommit === packSha)
|
|
108
100
|
continue;
|
|
109
|
-
// Do not trim Git paths: leading/trailing whitespace is meaningful and
|
|
110
|
-
// must never be normalized into an allowlisted metadata path.
|
|
111
101
|
for (const changedPath of pathText.split('\t')) {
|
|
112
102
|
if (!changedPath || seenPaths.has(changedPath))
|
|
113
103
|
continue;
|