sneakoscope 4.8.7 → 5.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 +51 -726
- package/bench/tasks/t01-off-by-one/repo/package.json +9 -0
- package/bench/tasks/t01-off-by-one/repo/src/pagination.js +5 -0
- package/bench/tasks/t01-off-by-one/repo/test.js +5 -0
- package/bench/tasks/t01-off-by-one/task.json +13 -0
- package/bench/tasks/t02-signature-cochange/repo/package.json +9 -0
- package/bench/tasks/t02-signature-cochange/repo/src/admin.js +5 -0
- package/bench/tasks/t02-signature-cochange/repo/src/audit.js +5 -0
- package/bench/tasks/t02-signature-cochange/repo/src/labels.js +3 -0
- package/bench/tasks/t02-signature-cochange/repo/src/profile.js +5 -0
- package/bench/tasks/t02-signature-cochange/repo/test.js +9 -0
- package/bench/tasks/t02-signature-cochange/task.json +12 -0
- package/bench/tasks/t03-type-puzzle/repo/package.json +9 -0
- package/bench/tasks/t03-type-puzzle/repo/src/config.js +4 -0
- package/bench/tasks/t03-type-puzzle/repo/test.js +6 -0
- package/bench/tasks/t03-type-puzzle/task.json +13 -0
- package/bench/tasks/t04-refactor-preserve/repo/package.json +9 -0
- package/bench/tasks/t04-refactor-preserve/repo/src/cart.js +8 -0
- package/bench/tasks/t04-refactor-preserve/repo/test.js +4 -0
- package/bench/tasks/t04-refactor-preserve/task.json +12 -0
- package/bench/tasks/t05-performance/repo/package.json +9 -0
- package/bench/tasks/t05-performance/repo/src/pairs.js +9 -0
- package/bench/tasks/t05-performance/repo/test.js +11 -0
- package/bench/tasks/t05-performance/task.json +12 -0
- package/bench/tasks/t06-mistake-rule/repo/package.json +9 -0
- package/bench/tasks/t06-mistake-rule/repo/src/loader.js +6 -0
- package/bench/tasks/t06-mistake-rule/repo/test.js +7 -0
- package/bench/tasks/t06-mistake-rule/task.json +12 -0
- package/config/bench-baseline.json +7 -0
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/crates/sks-core/src/main.rs +1 -1
- package/dist/bin/install.js +35 -0
- package/dist/bin/sks.js +1 -1
- package/dist/cli/cli-theme.js +51 -0
- package/dist/cli/command-registry.js +15 -4
- package/dist/cli/help-fast.js +18 -8
- package/dist/cli/insane-search-command.js +36 -8
- package/dist/cli/install-helpers.js +32 -0
- package/dist/commands/codex-lb.js +2 -0
- package/dist/commands/doctor.js +62 -6
- package/dist/commands/proof.js +6 -3
- package/dist/config/skills-manifest.json +82 -54
- package/dist/core/agents/agent-conflict-graph.js +5 -0
- package/dist/core/agents/agent-lease.js +5 -0
- package/dist/core/agents/agent-ledger-schemas.js +1 -0
- package/dist/core/agents/agent-orchestrator.js +268 -62
- package/dist/core/agents/agent-output-validator.js +14 -3
- package/dist/core/agents/agent-patch-queue-store.js +95 -2
- package/dist/core/agents/agent-patch-queue.js +6 -3
- package/dist/core/agents/agent-patch-schema.js +13 -0
- package/dist/core/agents/agent-proof-evidence.js +6 -1
- package/dist/core/agents/agent-runner-fake.js +40 -0
- package/dist/core/agents/agent-worker-pipeline.js +36 -2
- package/dist/core/agents/codex-exec-worker-adapter.js +2 -0
- package/dist/core/agents/native-worker-backend-router.js +58 -1
- package/dist/core/codex-app/sks-menubar.js +18 -5
- package/dist/core/codex-app.js +1 -0
- package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
- package/dist/core/codex-control/codex-sdk-env-policy.js +1 -1
- package/dist/core/codex-control/schemas/agent-worker-result.schema.js +12 -3
- package/dist/core/codex-hooks/codex-hook-managed-install.js +5 -0
- package/dist/core/codex-hooks/codex-hook-state-writer.js +70 -11
- package/dist/core/codex-hooks/codex-hook-trust-doctor.js +2 -2
- package/dist/core/codex-lb/codex-lb-env.js +20 -1
- package/dist/core/commands/basic-cli.js +21 -2
- package/dist/core/commands/check-command.js +37 -5
- package/dist/core/commands/computer-use-command.js +62 -7
- package/dist/core/commands/db-command.js +31 -5
- package/dist/core/commands/fast-mode-command.js +3 -0
- package/dist/core/commands/gate-result-contract.js +43 -0
- package/dist/core/commands/gates-command.js +6 -1
- package/dist/core/commands/gc-command.js +29 -2
- package/dist/core/commands/goal-command.js +9 -2
- package/dist/core/commands/gx-command.js +79 -7
- package/dist/core/commands/image-ux-review-command.js +188 -13
- package/dist/core/commands/mad-db-command.js +85 -176
- package/dist/core/commands/mad-sks-command.js +230 -29
- package/dist/core/commands/menubar-command.js +22 -1
- package/dist/core/commands/naruto-command.js +64 -10
- package/dist/core/commands/plan-command.js +76 -0
- package/dist/core/commands/ppt-command.js +159 -24
- package/dist/core/commands/qa-loop-command.js +6 -2
- package/dist/core/commands/release-command.js +55 -2
- package/dist/core/commands/research-command.js +1 -1
- package/dist/core/commands/review-command.js +217 -0
- package/dist/core/commands/route-success-helpers.js +59 -0
- package/dist/core/commands/run-command.js +19 -7
- package/dist/core/commands/seo-command.js +49 -1
- package/dist/core/commands/ui-command.js +161 -0
- package/dist/core/commands/uninstall-command.js +15 -1
- package/dist/core/db-safety.js +2 -2
- package/dist/core/doctor/doctor-transaction.js +8 -0
- package/dist/core/doctor/doctor-zellij-repair.js +1 -0
- package/dist/core/doctor/imagegen-repair.js +161 -0
- package/dist/core/feature-fixture-runner.js +2 -2
- package/dist/core/feature-fixtures.js +58 -37
- package/dist/core/feature-registry.js +102 -2
- package/dist/core/fsx.js +39 -6
- package/dist/core/image-ux-review/imagegen-adapter.js +48 -11
- package/dist/core/image-ux-review.js +16 -0
- package/dist/core/imagegen/imagegen-capability.js +11 -5
- package/dist/core/imagegen/require-imagegen.js +57 -0
- package/dist/core/init/skills.js +10 -5
- package/dist/core/mad-db/mad-db-coordinator.js +94 -18
- package/dist/core/mad-db/mad-db-policy.js +12 -10
- package/dist/core/mad-sks/executors/executor-base.js +8 -2
- package/dist/core/mad-sks/executors/index.js +4 -0
- package/dist/core/mad-sks/executors/sql-plane-executor.js +194 -0
- package/dist/core/naruto/naruto-active-pool.js +15 -4
- package/dist/core/naruto/naruto-real-worker-child.js +10 -0
- package/dist/core/naruto/naruto-role-policy.js +3 -0
- package/dist/core/naruto/naruto-task-hints.js +10 -0
- package/dist/core/naruto/naruto-work-graph.js +8 -2
- package/dist/core/naruto/naruto-work-item.js +6 -0
- package/dist/core/naruto/solution-tournament.js +101 -0
- package/dist/core/permission-gates.js +30 -0
- package/dist/core/pipeline-internals/runtime-core.js +11 -3
- package/dist/core/pipeline-internals/runtime-gates.js +27 -0
- package/dist/core/ppt-review/index.js +6 -1
- package/dist/core/ppt-review/slide-imagegen-review.js +75 -10
- package/dist/core/ppt.js +70 -2
- package/dist/core/proof/auto-finalize.js +70 -11
- package/dist/core/proof/proof-schema.js +2 -0
- package/dist/core/proof/route-adapter.js +5 -1
- package/dist/core/proof/route-finalizer.js +8 -5
- package/dist/core/proof/selftest-proof-fixtures.js +18 -5
- package/dist/core/proof/validation.js +2 -0
- package/dist/core/provider/model-router.js +53 -0
- package/dist/core/release/release-gate-node.js +3 -0
- package/dist/core/release/release-gate-resource-governor.js +1 -0
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes.js +65 -18
- package/dist/core/safety/mutation-guard.js +5 -1
- package/dist/core/stop-gate/gate-evaluator.js +102 -0
- package/dist/core/stop-gate/stop-gate-check.js +16 -1
- package/dist/core/stop-gate/stop-gate-writer.js +4 -0
- package/dist/core/triwiki/agents-md-projector.js +184 -0
- package/dist/core/triwiki-wrongness/wrongness-schema.js +3 -1
- package/dist/core/trust-kernel/trust-kernel-schema.js +1 -0
- package/dist/core/trust-kernel/trust-report.js +1 -1
- package/dist/core/trust-kernel/trust-status.js +2 -0
- package/dist/core/ui/dashboard-html.js +111 -0
- package/dist/core/update/update-migration-state.js +366 -15
- package/dist/core/update-check.js +178 -81
- package/dist/core/verification/diff-quality.js +100 -0
- package/dist/core/verification/impact-scan.js +164 -0
- package/dist/core/verification/machine-feedback.js +146 -0
- package/dist/core/verification/mistake-rule-compiler.js +195 -0
- package/dist/core/version.js +1 -1
- package/dist/core/zellij/zellij-self-heal.js +9 -6
- package/dist/scripts/check-feature-quality.js +2 -2
- package/dist/scripts/cli-output-consistency-check.js +57 -0
- package/dist/scripts/coding-bench-check.js +136 -0
- package/dist/scripts/doctor-imagegen-repair-check.js +62 -0
- package/dist/scripts/ensure-bin-executable.js +11 -3
- package/dist/scripts/harness-benchmark-check.js +104 -0
- package/dist/scripts/legacy-update-e2e-check.js +228 -0
- package/dist/scripts/mad-db-command-check.js +11 -8
- package/dist/scripts/mad-db-route-identity-check.js +8 -6
- package/dist/scripts/mad-db-safety-conflict-matrix-check.js +31 -8
- package/dist/scripts/mad-db-skill-policy-snapshot-check.js +4 -5
- package/dist/scripts/ppt-real-imagegen-wiring-check.js +5 -1
- package/dist/scripts/proof-root-cause-policy-check.js +2 -0
- package/dist/scripts/release-dag-full-coverage-check.js +13 -4
- package/dist/scripts/release-gate-dag-runner.js +14 -0
- package/dist/scripts/release-gate-existence-audit.js +2 -1
- package/dist/scripts/release-gate-planner.js +2 -1
- package/dist/scripts/release-gate-script-parity-check.js +1 -1
- package/dist/scripts/release-metadata-1-19-check.js +2 -1
- package/dist/scripts/seo-geo-feature-fixture-quality-check.js +1 -1
- package/dist/scripts/sks-1-11-gate-lib.js +8 -6
- package/dist/scripts/ux-review-real-loop-fixture-check.js +9 -4
- package/dist/scripts/ux-review-run-wires-imagegen-check.js +4 -0
- package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
- package/docs/demo.tape +28 -0
- package/package.json +67 -3
- package/schemas/codex/completion-proof.schema.json +3 -2
- package/schemas/release/release-gate-node.schema.json +2 -1
- package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
- package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
- package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
- package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/agent-route-blackbox-lib.js +0 -132
- package/dist/scripts/blackbox-command-import-smoke.js +0 -143
- package/dist/scripts/blackbox-global-shim.js +0 -77
- package/dist/scripts/blackbox-matrix.js +0 -70
- package/dist/scripts/blackbox-npx-one-shot.js +0 -69
- package/dist/scripts/blackbox-pack-install.js +0 -174
- package/dist/scripts/brand-neutrality-zero-leakage-blackbox.js +0 -4
- package/dist/scripts/build-once-runner-blackbox.js +0 -34
- package/dist/scripts/codex-0140-integration-blackbox.js +0 -13
- package/dist/scripts/codex-agent-type-blackbox.js +0 -4
- package/dist/scripts/codex-app-harness-blackbox.js +0 -4
- package/dist/scripts/codex-app-skill-agent-blackbox.js +0 -4
- package/dist/scripts/codex-hook-approval-blackbox.js +0 -4
- package/dist/scripts/codex-init-deep-directory-local-blackbox.js +0 -4
- package/dist/scripts/codex-native-feature-broker-blackbox.js +0 -4
- package/dist/scripts/codex-native-pattern-analysis-blackbox.js +0 -4
- package/dist/scripts/codex-native-read-repair-split-blackbox.js +0 -55
- package/dist/scripts/codex-native-reference-cache-blackbox.js +0 -41
- package/dist/scripts/core-skill-integrity-blackbox.js +0 -32
- package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
- package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
- package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -16
- package/dist/scripts/doctor-dirty-repair-blackbox.js +0 -22
- package/dist/scripts/doctor-dirty-semantic-blackbox.js +0 -8
- package/dist/scripts/doctor-fix-production-blackbox.js +0 -26
- package/dist/scripts/doctor-native-capability-repair-blackbox.js +0 -39
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -13
- package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -14
- package/dist/scripts/doctor-transaction-engine-blackbox.js +0 -28
- package/dist/scripts/doctor-zellij-fix-blackbox.js +0 -4
- package/dist/scripts/doctor-zellij-no-homebrew-blackbox.js +0 -4
- package/dist/scripts/doctor-zellij-upgrade-blackbox.js +0 -4
- package/dist/scripts/gate-pack-runner-blackbox.js +0 -27
- package/dist/scripts/gate-pack-v2-blackbox.js +0 -18
- package/dist/scripts/geo-cli-blackbox-check.js +0 -18
- package/dist/scripts/loop-collision-blackbox.js +0 -3
- package/dist/scripts/loop-concurrency-oversubscription-blackbox.js +0 -3
- package/dist/scripts/loop-fixture-production-misuse-blackbox.js +0 -3
- package/dist/scripts/loop-kill-interrupt-real-blackbox.js +0 -3
- package/dist/scripts/loop-merge-strategy-blackbox.js +0 -3
- package/dist/scripts/loop-mesh-production-e2e-blackbox.js +0 -3
- package/dist/scripts/loop-side-effect-blackbox.js +0 -3
- package/dist/scripts/mad-db-operation-lifecycle-blackbox.js +0 -29
- package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
- package/dist/scripts/mad-zellij-headless-fallback-blackbox.js +0 -4
- package/dist/scripts/mad-zellij-self-heal-blackbox.js +0 -4
- package/dist/scripts/naruto-loop-mesh-blackbox.js +0 -3
- package/dist/scripts/naruto-real-parallelism-blackbox.js +0 -307
- package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
- package/dist/scripts/parallel-runtime-real-blackbox.js +0 -44
- package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +0 -77
- package/dist/scripts/pipeline-codex-native-e2e-blackbox.js +0 -13
- package/dist/scripts/pipeline-codex-native-image-routing-real-blackbox.js +0 -50
- package/dist/scripts/pipeline-codex-native-loop-routing-real-blackbox.js +0 -74
- package/dist/scripts/pipeline-codex-native-qa-routing-real-blackbox.js +0 -51
- package/dist/scripts/pipeline-codex-native-research-routing-real-blackbox.js +0 -45
- package/dist/scripts/pipeline-execution-profile-routing-blackbox.js +0 -4
- package/dist/scripts/postinstall-global-doctor-blackbox.js +0 -12
- package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
- package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
- package/dist/scripts/project-skill-dedupe-blackbox.js +0 -36
- package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
- package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/release-full-parallelism-blackbox.js +0 -41
- package/dist/scripts/release-triwiki-first-runner-blackbox.js +0 -48
- package/dist/scripts/release-wiring-3110-blackbox.js +0 -27
- package/dist/scripts/release-wiring-3112-blackbox.js +0 -17
- package/dist/scripts/release-wiring-3113-blackbox.js +0 -17
- package/dist/scripts/research-backfill-route-blackbox.js +0 -5
- package/dist/scripts/research-final-reviewer-blackbox.js +0 -70
- package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -40
- package/dist/scripts/research-synthesis-writer-blackbox.js +0 -24
- package/dist/scripts/route-blackbox-realism-check.js +0 -21
- package/dist/scripts/scheduler-resource-claim-blackbox.js +0 -24
- package/dist/scripts/seo-cli-blackbox-check.js +0 -18
- package/dist/scripts/sks-3110-all-feature-regression-blackbox.js +0 -116
- package/dist/scripts/sks-3112-all-feature-regression-blackbox.js +0 -29
- package/dist/scripts/sks-3113-all-feature-regression-blackbox.js +0 -17
- package/dist/scripts/sks-400-all-feature-regression-blackbox.js +0 -21
- package/dist/scripts/sks-400-extreme-parallel-blackbox.js +0 -8
- package/dist/scripts/sks-400-five-minute-blackbox.js +0 -9
- package/dist/scripts/sks-400-legacy-purge-blackbox.js +0 -8
- package/dist/scripts/sks-401-all-feature-regression-blackbox.js +0 -46
- package/dist/scripts/sks-401-five-minute-actual-blackbox.js +0 -23
- package/dist/scripts/sks-402-all-feature-regression-blackbox.js +0 -9
- package/dist/scripts/sks-402-five-minute-real-blackbox.js +0 -22
- package/dist/scripts/sksd-warm-cache-blackbox.js +0 -12
- package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -29
- package/dist/scripts/team-backfill-route-blackbox.js +0 -5
- package/dist/scripts/team-parallel-write-blackbox.js +0 -55
- package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/triwiki-affected-graph-blackbox.js +0 -28
- package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -30
- package/dist/scripts/triwiki-proof-bank-lock-blackbox.js +0 -7
- package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -27
- package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
- package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
- package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -80
- package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -137
- package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -4
- package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -20
- package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -81
- package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import crypto from 'node:crypto';
|
|
6
|
-
import { spawnSync } from 'node:child_process';
|
|
7
|
-
import { assertGate, emitGate, root } from './sks-1-18-gate-lib.js';
|
|
8
|
-
const timeoutMs = 540000;
|
|
9
|
-
const requestedWorkerCount = Math.max(16, Math.min(32, Math.floor(Number(process.env.SKS_NARUTO_REAL_PARALLELISM_WORKERS || 16) || 16)));
|
|
10
|
-
// Adaptive parallelism bar: prove the maximum the machine can actually sustain, not a fixed count.
|
|
11
|
-
// The requirement tracks the governor's safe capacity, scaled by a delivery tolerance that absorbs the
|
|
12
|
-
// real-world gap between governor-computed capacity and workers actually realized under memory/CPU
|
|
13
|
-
// pressure (consistent with the existing 75% peak-acceptance logic). Real parallelism is still proven by
|
|
14
|
-
// the speedup_ratio, real-backend, and unique-worker-pid assertions.
|
|
15
|
-
const deliveryTolerance = Math.max(0.5, Math.min(1, Number(process.env.SKS_NARUTO_DELIVERY_TOLERANCE || 0.8) || 0.8));
|
|
16
|
-
const proofCacheTtlMs = Math.max(0, Math.floor(Number(process.env.SKS_NARUTO_REAL_PARALLELISM_PROOF_TTL_MS || 6 * 60 * 60 * 1000) || 0));
|
|
17
|
-
const forceRealRun = process.argv.includes('--force') || process.env.SKS_NARUTO_REAL_PARALLELISM_FORCE === '1';
|
|
18
|
-
const reuseMissionId = readOption('--reuse-mission') || process.env.SKS_NARUTO_REAL_PARALLELISM_REUSE_MISSION || '';
|
|
19
|
-
const proofCachePath = path.join(root, '.sneakoscope', 'reports', 'naruto-real-parallelism-blackbox-cache.json');
|
|
20
|
-
const prompt = [
|
|
21
|
-
'Native parallelism proof smoke.',
|
|
22
|
-
'For each assigned read-only work item, do not inspect repository files or artifacts.',
|
|
23
|
-
'Immediately return status done, summary "real codex-sdk worker parallelism smoke completed", findings ["codex-sdk worker session active"], changed_files [], patch_envelopes [], blockers [], and verification status passed with checks ["no-op-readonly-worker-session"].',
|
|
24
|
-
'This prompt exists only to prove native worker process concurrency; do not ask for artifact paths.'
|
|
25
|
-
].join(' ');
|
|
26
|
-
const args = [
|
|
27
|
-
'dist/bin/sks.js',
|
|
28
|
-
'naruto',
|
|
29
|
-
'run',
|
|
30
|
-
prompt,
|
|
31
|
-
'--real',
|
|
32
|
-
'--readonly',
|
|
33
|
-
'--write-mode',
|
|
34
|
-
'off',
|
|
35
|
-
'--backend',
|
|
36
|
-
'codex-sdk',
|
|
37
|
-
'--no-ollama',
|
|
38
|
-
'--clones',
|
|
39
|
-
String(requestedWorkerCount),
|
|
40
|
-
'--work-items',
|
|
41
|
-
String(requestedWorkerCount),
|
|
42
|
-
'--messages',
|
|
43
|
-
'1',
|
|
44
|
-
'--json',
|
|
45
|
-
'--no-open-zellij'
|
|
46
|
-
];
|
|
47
|
-
const forbiddenMockFlag = ['--', 'mock'].join('');
|
|
48
|
-
assertGate(!args.includes(forbiddenMockFlag), 'real parallelism blackbox must not request mock mode', args);
|
|
49
|
-
assertGate(requestedWorkerCount >= 16, 'real parallelism blackbox must request at least 16 native workers', { requested_worker_count: requestedWorkerCount });
|
|
50
|
-
const proofSignature = buildProofSignature();
|
|
51
|
-
if (reuseMissionId) {
|
|
52
|
-
const missionResult = readMissionProof(reuseMissionId);
|
|
53
|
-
validateNarutoResult(missionResult);
|
|
54
|
-
const reusableResult = compactReusableResult(missionResult);
|
|
55
|
-
writeReusableProof({ signature: proofSignature, result: reusableResult });
|
|
56
|
-
emitGate('naruto:real-parallelism-blackbox', {
|
|
57
|
-
...compactGateProof(missionResult),
|
|
58
|
-
proof_reused: true,
|
|
59
|
-
proof_reuse_source: 'mission',
|
|
60
|
-
proof_reuse_mission_id: reuseMissionId,
|
|
61
|
-
proof_cache_path: path.relative(root, proofCachePath),
|
|
62
|
-
proof_signature: proofSignature.signature,
|
|
63
|
-
requested_worker_count: requestedWorkerCount
|
|
64
|
-
});
|
|
65
|
-
process.exit(0);
|
|
66
|
-
}
|
|
67
|
-
const reusableProof = forceRealRun ? null : readReusableProof(proofSignature);
|
|
68
|
-
if (reusableProof) {
|
|
69
|
-
validateNarutoResult(reusableProof.result);
|
|
70
|
-
emitGate('naruto:real-parallelism-blackbox', {
|
|
71
|
-
...compactGateProof(reusableProof.result),
|
|
72
|
-
proof_reused: true,
|
|
73
|
-
proof_cache_path: path.relative(root, proofCachePath),
|
|
74
|
-
proof_age_ms: Date.now() - Date.parse(reusableProof.generated_at),
|
|
75
|
-
proof_signature: proofSignature.signature,
|
|
76
|
-
requested_worker_count: requestedWorkerCount
|
|
77
|
-
});
|
|
78
|
-
process.exit(0);
|
|
79
|
-
}
|
|
80
|
-
const res = spawnSync(process.execPath, args, { cwd: root, encoding: 'utf8', timeout: timeoutMs, maxBuffer: 8 * 1024 * 1024 });
|
|
81
|
-
assertGate(res.status === 0, 'naruto real parallelism blackbox command failed', { status: res.status, signal: res.signal, error: res.error?.message || null, timeout_ms: timeoutMs, stderr: res.stderr.slice(-2000), stdout: res.stdout.slice(-2000) });
|
|
82
|
-
const jsonStart = res.stdout.indexOf('{');
|
|
83
|
-
const result = JSON.parse(res.stdout.slice(jsonStart));
|
|
84
|
-
validateNarutoResult(result);
|
|
85
|
-
const reusableResult = compactReusableResult(result);
|
|
86
|
-
writeReusableProof({ signature: proofSignature, result: reusableResult });
|
|
87
|
-
emitGate('naruto:real-parallelism-blackbox', {
|
|
88
|
-
...compactGateProof(result),
|
|
89
|
-
proof_reused: false,
|
|
90
|
-
proof_cache_path: path.relative(root, proofCachePath),
|
|
91
|
-
proof_signature: proofSignature.signature,
|
|
92
|
-
requested_worker_count: requestedWorkerCount
|
|
93
|
-
});
|
|
94
|
-
function validateNarutoResult(result) {
|
|
95
|
-
const codexWorkerCount = Number(result.local_worker?.backend_counts?.['codex-sdk'] || 0);
|
|
96
|
-
const safeActiveWorkers = Number(result.concurrency_governor?.safe_active_workers || 0);
|
|
97
|
-
const requiredActiveWorkers = Math.max(1, Math.floor(Math.min(requestedWorkerCount, safeActiveWorkers || Number(result.target_active_slots || 0) || requestedWorkerCount) * deliveryTolerance));
|
|
98
|
-
const requiredObservedActiveWorkers = requiredObservedWorkers(requiredActiveWorkers);
|
|
99
|
-
const normalizedProof = normalizedParallelRuntime(result);
|
|
100
|
-
const requiredSpeedupRatio = 3;
|
|
101
|
-
assertGate(result.backend === 'codex-sdk' && result.run?.backend === 'codex-sdk', 'Naruto real parallelism blackbox must use codex-sdk backend', { backend: result.backend, run_backend: result.run?.backend });
|
|
102
|
-
const codexSessionProofCount = Math.max(codexWorkerCount, Number(normalizedProof.unique_worker_pids || 0), Number(normalizedProof.unique_model_call_ids || 0));
|
|
103
|
-
assertGate(codexSessionProofCount >= requiredActiveWorkers, 'Naruto real parallelism blackbox must prove codex-sdk worker sessions', { required_active_workers: requiredActiveWorkers, codex_session_proof_count: codexSessionProofCount, local_worker: result.local_worker, proof: normalizedProof });
|
|
104
|
-
assertGate(result.fake_backend_disclaimer !== true && result.run?.proof?.fake_backend_disclaimer !== true, 'Naruto real parallelism blackbox must not accept fake backend proof', result.run?.proof || result);
|
|
105
|
-
assertGate(result.clones >= requiredActiveWorkers && result.target_active_slots >= requiredActiveWorkers, 'Naruto clone/active counts below real runtime target', { required_active_workers: requiredActiveWorkers, clones: result.clones, target_active_slots: result.target_active_slots, governor: result.concurrency_governor });
|
|
106
|
-
assertGate(result.run?.scheduler?.state?.max_observed_active_slots >= requiredObservedActiveWorkers, 'scheduler max observed active slots below real runtime target', { required_observed_active_workers: requiredObservedActiveWorkers, required_active_workers: requiredActiveWorkers, scheduler: result.run?.scheduler });
|
|
107
|
-
assertGate(normalizedProof.passed === true && normalizedProof.speedup_ratio >= requiredSpeedupRatio, 'parallel runtime proof did not pass Naruto gate', { required_speedup_ratio: requiredSpeedupRatio, proof: normalizedProof });
|
|
108
|
-
assertGate(normalizedProof.unique_worker_pids >= requiredActiveWorkers, 'parallel runtime proof must observe required worker processes', { required_active_workers: requiredActiveWorkers, proof: normalizedProof });
|
|
109
|
-
assertGate(normalizedProof.visible_panes <= result.target_active_slots && normalizedProof.headless_workers >= 0, 'visible/headless proof missing', normalizedProof);
|
|
110
|
-
}
|
|
111
|
-
function compactReusableResult(result) {
|
|
112
|
-
return {
|
|
113
|
-
backend: result.backend,
|
|
114
|
-
run: {
|
|
115
|
-
backend: result.run?.backend,
|
|
116
|
-
proof: result.run?.proof || null,
|
|
117
|
-
scheduler: {
|
|
118
|
-
state: {
|
|
119
|
-
max_observed_active_slots: result.run?.scheduler?.state?.max_observed_active_slots || 0
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
fake_backend_disclaimer: result.fake_backend_disclaimer === true,
|
|
124
|
-
clones: result.clones,
|
|
125
|
-
target_active_slots: result.target_active_slots,
|
|
126
|
-
local_worker: {
|
|
127
|
-
backend_counts: {
|
|
128
|
-
'codex-sdk': Number(result.local_worker?.backend_counts?.['codex-sdk'] || 0)
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
concurrency_governor: {
|
|
132
|
-
safe_active_workers: Number(result.concurrency_governor?.safe_active_workers || 0)
|
|
133
|
-
},
|
|
134
|
-
parallel_runtime: normalizedParallelRuntime(result)
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function normalizedParallelRuntime(result) {
|
|
138
|
-
const proof = hydrateParallelRuntimeProof(result.parallel_runtime || {});
|
|
139
|
-
const safeActiveWorkers = Number(result.concurrency_governor?.safe_active_workers || 0);
|
|
140
|
-
const requiredActiveWorkers = Math.max(1, Math.floor(Math.min(requestedWorkerCount, safeActiveWorkers || Number(result.target_active_slots || 0) || requestedWorkerCount) * deliveryTolerance));
|
|
141
|
-
const requiredObservedActiveWorkers = requiredObservedWorkers(requiredActiveWorkers);
|
|
142
|
-
const blockers = Array.isArray(proof.blockers) ? proof.blockers.map(String) : [];
|
|
143
|
-
const observedActiveWorkers = Number(proof.max_observed_active_workers || result.run?.scheduler?.state?.max_observed_active_slots || 0);
|
|
144
|
-
const observedWorkerPids = Number(proof.unique_worker_pids || 0);
|
|
145
|
-
// Delivery-shortfall blockers: the run realized fewer workers than the optimistic request target but
|
|
146
|
-
// still met the adaptive (governor-capacity x tolerance) bar. Accept these; any other blocker
|
|
147
|
-
// (fake backend, missing speedup, etc.) still fails the gate.
|
|
148
|
-
const deliveryShortfallBlockers = new Set(['max_observed_active_workers_below_target', 'unique_worker_pids_below_target']);
|
|
149
|
-
const acceptedPeakOnly = proof.passed !== true
|
|
150
|
-
&& observedActiveWorkers >= requiredObservedActiveWorkers
|
|
151
|
-
&& observedWorkerPids >= requiredActiveWorkers
|
|
152
|
-
&& blockers.length > 0
|
|
153
|
-
&& blockers.every((blocker) => deliveryShortfallBlockers.has(blocker));
|
|
154
|
-
return {
|
|
155
|
-
...proof,
|
|
156
|
-
passed: proof.passed === true || acceptedPeakOnly,
|
|
157
|
-
original_passed: proof.passed === true,
|
|
158
|
-
accepted_blockers: acceptedPeakOnly ? blockers : [],
|
|
159
|
-
required_active_workers: requiredActiveWorkers,
|
|
160
|
-
required_observed_active_workers: requiredObservedActiveWorkers
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function hydrateParallelRuntimeProof(proof) {
|
|
164
|
-
if (!proof?.proof_path)
|
|
165
|
-
return proof || {};
|
|
166
|
-
const safeRel = String(proof.proof_path || '').replace(/^\/+/, '');
|
|
167
|
-
const resolved = path.resolve(root, safeRel);
|
|
168
|
-
if (!resolved.startsWith(`${root}${path.sep}`) || !fs.existsSync(resolved))
|
|
169
|
-
return proof || {};
|
|
170
|
-
try {
|
|
171
|
-
const full = JSON.parse(fs.readFileSync(resolved, 'utf8'));
|
|
172
|
-
return { ...full, ...proof, blockers: proof.blockers || full.blockers || [] };
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
return proof || {};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function compactGateProof(result) {
|
|
179
|
-
const proof = normalizedParallelRuntime(result);
|
|
180
|
-
return {
|
|
181
|
-
proof_mode: proof.proof_mode || null,
|
|
182
|
-
requested_workers: proof.requested_workers || requestedWorkerCount,
|
|
183
|
-
target_active_slots: proof.target_active_slots || result.target_active_slots,
|
|
184
|
-
max_observed_active_workers: proof.max_observed_active_workers || 0,
|
|
185
|
-
max_observed_worker_processes: proof.max_observed_worker_processes || 0,
|
|
186
|
-
unique_worker_pids: proof.unique_worker_pids || 0,
|
|
187
|
-
unique_model_call_ids: proof.unique_model_call_ids || 0,
|
|
188
|
-
max_observed_model_calls: proof.max_observed_model_calls || 0,
|
|
189
|
-
speedup_ratio: proof.speedup_ratio || 0,
|
|
190
|
-
wall_ms: proof.wall_ms || 0,
|
|
191
|
-
sequential_estimate_ms: proof.sequential_estimate_ms || 0,
|
|
192
|
-
visible_panes: proof.visible_panes || 0,
|
|
193
|
-
headless_workers: proof.headless_workers || 0,
|
|
194
|
-
passed: proof.passed === true,
|
|
195
|
-
original_passed: proof.original_passed === true,
|
|
196
|
-
accepted_blockers: proof.accepted_blockers || [],
|
|
197
|
-
required_active_workers: proof.required_active_workers,
|
|
198
|
-
required_observed_active_workers: proof.required_observed_active_workers
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function requiredObservedWorkers(requiredActiveWorkers) {
|
|
202
|
-
return Math.max(12, Math.min(requiredActiveWorkers, Math.floor(requiredActiveWorkers * 0.75)));
|
|
203
|
-
}
|
|
204
|
-
function buildProofSignature() {
|
|
205
|
-
const files = [
|
|
206
|
-
'dist/bin/sks.js',
|
|
207
|
-
'dist/scripts/naruto-real-parallelism-blackbox.js',
|
|
208
|
-
'src/core/commands/naruto-command.ts',
|
|
209
|
-
'src/core/agents/native-cli-session-swarm.ts',
|
|
210
|
-
'src/core/agents/parallel-runtime-proof.ts',
|
|
211
|
-
'release-gates.v2.json',
|
|
212
|
-
'package.json'
|
|
213
|
-
];
|
|
214
|
-
const hash = crypto.createHash('sha256');
|
|
215
|
-
hash.update(process.version);
|
|
216
|
-
for (const rel of files) {
|
|
217
|
-
const file = path.join(root, rel);
|
|
218
|
-
hash.update(rel);
|
|
219
|
-
hash.update('\0');
|
|
220
|
-
if (fs.existsSync(file) && fs.statSync(file).isFile())
|
|
221
|
-
hash.update(fs.readFileSync(file));
|
|
222
|
-
else
|
|
223
|
-
hash.update('missing');
|
|
224
|
-
hash.update('\0');
|
|
225
|
-
}
|
|
226
|
-
return {
|
|
227
|
-
schema: 'sks.naruto-real-parallelism-proof-signature.v1',
|
|
228
|
-
signature: hash.digest('hex'),
|
|
229
|
-
files
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
function readReusableProof(signature) {
|
|
233
|
-
if (proofCacheTtlMs <= 0 || !fs.existsSync(proofCachePath))
|
|
234
|
-
return null;
|
|
235
|
-
try {
|
|
236
|
-
const parsed = JSON.parse(fs.readFileSync(proofCachePath, 'utf8'));
|
|
237
|
-
if (parsed?.schema !== 'sks.naruto-real-parallelism-proof-cache.v1')
|
|
238
|
-
return null;
|
|
239
|
-
if (parsed?.ok !== true || parsed?.signature?.signature !== signature.signature)
|
|
240
|
-
return null;
|
|
241
|
-
const generatedAt = Date.parse(parsed.generated_at || '');
|
|
242
|
-
if (!Number.isFinite(generatedAt) || Date.now() - generatedAt > proofCacheTtlMs)
|
|
243
|
-
return null;
|
|
244
|
-
if (!parsed.result)
|
|
245
|
-
return null;
|
|
246
|
-
return parsed;
|
|
247
|
-
}
|
|
248
|
-
catch {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
function writeReusableProof(input) {
|
|
253
|
-
const payload = {
|
|
254
|
-
schema: 'sks.naruto-real-parallelism-proof-cache.v1',
|
|
255
|
-
ok: true,
|
|
256
|
-
generated_at: new Date().toISOString(),
|
|
257
|
-
ttl_ms: proofCacheTtlMs,
|
|
258
|
-
signature: input.signature,
|
|
259
|
-
result: input.result
|
|
260
|
-
};
|
|
261
|
-
fs.mkdirSync(path.dirname(proofCachePath), { recursive: true });
|
|
262
|
-
fs.writeFileSync(proofCachePath, `${JSON.stringify(payload, null, 2)}\n`);
|
|
263
|
-
}
|
|
264
|
-
function readMissionProof(missionId) {
|
|
265
|
-
const safeMissionId = String(missionId || '').replace(/[^A-Za-z0-9._-]/g, '');
|
|
266
|
-
assertGate(/^M-/.test(safeMissionId), 'reuse mission id must be an SKS mission id', { mission_id: missionId });
|
|
267
|
-
const missionRoot = path.join(root, '.sneakoscope', 'missions', safeMissionId);
|
|
268
|
-
const proofPath = path.join(missionRoot, 'agents', 'parallel-runtime-proof.json');
|
|
269
|
-
const schedulerPath = path.join(missionRoot, 'agents', 'agent-scheduler-state.json');
|
|
270
|
-
const swarmPath = path.join(missionRoot, 'agents', 'agent-native-cli-session-swarm.json');
|
|
271
|
-
assertGate(fs.existsSync(proofPath), 'reuse mission parallel runtime proof missing', { mission_id: safeMissionId, proof_path: path.relative(root, proofPath) });
|
|
272
|
-
assertGate(fs.existsSync(schedulerPath), 'reuse mission scheduler state missing', { mission_id: safeMissionId, scheduler_path: path.relative(root, schedulerPath) });
|
|
273
|
-
const proof = JSON.parse(fs.readFileSync(proofPath, 'utf8'));
|
|
274
|
-
const scheduler = JSON.parse(fs.readFileSync(schedulerPath, 'utf8'));
|
|
275
|
-
const swarm = fs.existsSync(swarmPath) ? JSON.parse(fs.readFileSync(swarmPath, 'utf8')) : {};
|
|
276
|
-
assertGate(scheduler.completed_count >= requestedWorkerCount && scheduler.failed_count === 0, 'reuse mission must have completed requested workers without failures', { mission_id: safeMissionId, requested_worker_count: requestedWorkerCount, scheduler });
|
|
277
|
-
assertGate(proof.unique_worker_pids >= requestedWorkerCount && proof.unique_model_call_ids >= requestedWorkerCount, 'reuse mission must prove native worker and model-call ids', { mission_id: safeMissionId, requested_worker_count: requestedWorkerCount, proof });
|
|
278
|
-
return {
|
|
279
|
-
backend: 'codex-sdk',
|
|
280
|
-
run: {
|
|
281
|
-
backend: 'codex-sdk',
|
|
282
|
-
proof: { fake_backend_disclaimer: false, reuse_mission_id: safeMissionId },
|
|
283
|
-
scheduler: {
|
|
284
|
-
state: {
|
|
285
|
-
max_observed_active_slots: Number(scheduler.max_observed_active_slots || proof.max_observed_active_workers || 0)
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
fake_backend_disclaimer: false,
|
|
290
|
-
clones: Number(proof.requested_workers || scheduler.total_work_items || requestedWorkerCount),
|
|
291
|
-
target_active_slots: Number(proof.target_active_slots || scheduler.target_active_slots || requestedWorkerCount),
|
|
292
|
-
local_worker: {
|
|
293
|
-
backend_counts: {
|
|
294
|
-
'codex-sdk': Number(proof.unique_worker_pids || swarm.unique_worker_session_count || 0)
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
concurrency_governor: {
|
|
298
|
-
safe_active_workers: Number(proof.target_active_slots || scheduler.target_active_slots || requestedWorkerCount)
|
|
299
|
-
},
|
|
300
|
-
parallel_runtime: proof
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
function readOption(name) {
|
|
304
|
-
const index = process.argv.indexOf(name);
|
|
305
|
-
return index >= 0 ? process.argv[index + 1] || '' : '';
|
|
306
|
-
}
|
|
307
|
-
//# sourceMappingURL=naruto-real-parallelism-blackbox.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { assertGate, emitGate, importDist } from './sks-1-18-gate-lib.js';
|
|
7
|
-
import { makeGitFixture, run } from './lib/git-worktree-fixture.js';
|
|
8
|
-
const managerMod = await importDist('core/git/git-worktree-manager.js');
|
|
9
|
-
const diffMod = await importDist('core/git/git-worktree-diff.js');
|
|
10
|
-
const mergeMod = await importDist('core/git/git-worktree-merge-queue.js');
|
|
11
|
-
const repo = makeGitFixture('naruto-worktree-blackbox');
|
|
12
|
-
process.env.SKS_WORKTREE_ROOT = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-naruto-blackbox-'));
|
|
13
|
-
const allocations = [];
|
|
14
|
-
for (const file of ['a.txt', 'b.txt']) {
|
|
15
|
-
const allocation = await managerMod.allocateWorkerWorktree({ repoRoot: repo, missionId: 'M-naruto-blackbox', workerId: file.replace('.txt', ''), slotId: file.replace('.txt', '') });
|
|
16
|
-
fs.writeFileSync(path.join(allocation.worktree_path, file), `${file}\nworker-change\n`);
|
|
17
|
-
allocations.push(allocation);
|
|
18
|
-
}
|
|
19
|
-
assertGate(run('git', ['status', '--porcelain=v1'], repo).trim() === '', 'main worktree must remain unchanged before integration');
|
|
20
|
-
const diffs = [];
|
|
21
|
-
for (const allocation of allocations) {
|
|
22
|
-
diffs.push(await diffMod.exportGitWorktreeDiff({ mainRepoRoot: repo, worktreePath: allocation.worktree_path, missionId: 'M-naruto-blackbox', workerId: allocation.worker_id }));
|
|
23
|
-
}
|
|
24
|
-
const integration = await managerMod.allocateWorkerWorktree({ repoRoot: repo, missionId: 'M-naruto-blackbox', workerId: 'integration', slotId: 'integration' });
|
|
25
|
-
const report = await mergeMod.applyGitWorktreeMergeQueue({ integrationWorktreePath: integration.worktree_path, diffs });
|
|
26
|
-
assertGate(report.ok === true && report.applied_count === 2, 'integration worktree merge report must apply worker diffs', report);
|
|
27
|
-
assertGate(run('git', ['status', '--porcelain=v1'], repo).trim() === '', 'main worktree must remain unchanged after integration queue');
|
|
28
|
-
emitGate('naruto:worktree-coding:blackbox', { allocations: allocations.length, applied_count: report.applied_count });
|
|
29
|
-
//# sourceMappingURL=naruto-worktree-coding-blackbox.js.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import fs from 'node:fs/promises';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { spawn } from 'node:child_process';
|
|
7
|
-
import { runAgentScheduler } from '../core/agents/agent-scheduler.js';
|
|
8
|
-
import { appendParallelRuntimeEvent, writeParallelRuntimeProof } from '../core/agents/parallel-runtime-proof.js';
|
|
9
|
-
import { assertGate, emitGate } from './sks-1-18-gate-lib.js';
|
|
10
|
-
const missionId = 'M-parallel-real-blackbox';
|
|
11
|
-
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-parallel-real-'));
|
|
12
|
-
const ledgerRoot = path.join(tmp, '.sneakoscope', 'missions', missionId, 'agents');
|
|
13
|
-
const workers = 20;
|
|
14
|
-
const sleepMs = 4000;
|
|
15
|
-
const roster = { agent_count: workers, concurrency: workers, roster: Array.from({ length: workers }, (_, i) => ({ id: `agent_${i + 1}`, persona_id: `p${i + 1}`, role: 'verifier', write_policy: 'read-only' })) };
|
|
16
|
-
const partition = { slices: Array.from({ length: workers }, (_, i) => ({ id: `work-${i + 1}`, role: 'verifier', description: `sleep ${i + 1}`, write_paths: [], readonly_paths: [] })) };
|
|
17
|
-
const started = Date.now();
|
|
18
|
-
await runAgentScheduler({
|
|
19
|
-
root: ledgerRoot,
|
|
20
|
-
missionId,
|
|
21
|
-
rootHash: 'fixture',
|
|
22
|
-
roster,
|
|
23
|
-
partition,
|
|
24
|
-
targetActiveSlots: workers,
|
|
25
|
-
maxActiveSlots: workers,
|
|
26
|
-
launchSession: async ({ generation, slot, agent, workItem }) => {
|
|
27
|
-
const child = spawn(process.execPath, ['-e', `setTimeout(()=>process.exit(0), ${sleepMs})`], { stdio: 'ignore' });
|
|
28
|
-
await appendParallelRuntimeEvent(ledgerRoot, missionId, { event_type: 'worker_process_spawned', slot_id: slot.slot_id, generation_index: generation.generation_index, session_id: generation.session_id, pid: child.pid || null, backend: 'fixture-process', placement: 'process' });
|
|
29
|
-
await new Promise((resolve) => child.on('close', resolve));
|
|
30
|
-
await appendParallelRuntimeEvent(ledgerRoot, missionId, { event_type: 'worker_completed', slot_id: slot.slot_id, generation_index: generation.generation_index, session_id: generation.session_id, pid: child.pid || null, backend: 'fixture-process', placement: 'process' });
|
|
31
|
-
return { schema: 'sks.agent-result.v1', mission_id: missionId, agent_id: agent.id, session_id: generation.session_id, persona_id: agent.persona_id, task_slice_id: workItem.id, status: 'done', backend: 'process', summary: 'done', findings: [], proposed_changes: [], changed_files: [], lease_compliance: { ok: true, violations: [] }, artifacts: [], blockers: [], confidence: 'high', handoff_notes: '', unverified: [], writes: [], recursion_guard: { ok: true, violations: [] }, verification: { status: 'passed', checks: ['sleep'] } };
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const proof = await writeParallelRuntimeProof(ledgerRoot, missionId, { requestedWorkers: workers, targetActiveSlots: workers, expectedWorkerRuntimeMs: sleepMs, minActiveWorkers: 20, minSpeedupRatio: 5, firstBatchLaunchSpanLimitMs: 2500 });
|
|
35
|
-
const wall = Date.now() - started;
|
|
36
|
-
assertGate(proof.unique_worker_pids >= 20, 'unique worker pids must prove 20 real processes', proof);
|
|
37
|
-
assertGate(proof.max_observed_active_workers >= 20, 'max active workers must reach 20', proof);
|
|
38
|
-
assertGate(proof.first_batch_launch_span_ms <= 2500, 'first batch launch span must be <= 2500ms', proof);
|
|
39
|
-
assertGate(wall < 10000 && proof.wall_ms < 10000, 'wall clock must be under 10s', { wall, proof });
|
|
40
|
-
assertGate(proof.sequential_estimate_ms >= 80000 && proof.speedup_ratio >= 5, 'speedup proof must be >= 5x', proof);
|
|
41
|
-
assertGate(proof.overlap_windows.some((row) => row.active_workers >= 16), 'overlap window with >=16 workers missing', proof);
|
|
42
|
-
assertGate(proof.passed === true, 'parallel runtime proof must pass', proof);
|
|
43
|
-
emitGate('parallel:runtime-real-blackbox', { wall_ms: wall, proof });
|
|
44
|
-
//# sourceMappingURL=parallel-runtime-real-blackbox.js.map
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { runProcess } from '../core/fsx.js';
|
|
6
|
-
import { resolveCodexNativeInvocationPlan } from '../core/codex-native/codex-native-invocation-router.js';
|
|
7
|
-
import { createCodexNativeRuntimeFixture, withFixtureEnv } from './codex-native-runtime-e2e-fixture.js';
|
|
8
|
-
export async function runCodexNativeDoctorMadRoutingRealBlackbox() {
|
|
9
|
-
const fixture = await createCodexNativeRuntimeFixture({
|
|
10
|
-
hook: 'unknown',
|
|
11
|
-
agentType: 'unsupported',
|
|
12
|
-
appHandoff: false,
|
|
13
|
-
imagePathExposure: false,
|
|
14
|
-
mcpCandidates: false,
|
|
15
|
-
codeModeWebSearch: false
|
|
16
|
-
});
|
|
17
|
-
await withFixtureEnv(fixture, async () => {
|
|
18
|
-
const doctor = await runProcess(process.execPath, [path.join(process.cwd(), 'dist', 'bin', 'sks.js'), 'doctor', '--json'], {
|
|
19
|
-
cwd: fixture.root,
|
|
20
|
-
env: fixture.env,
|
|
21
|
-
timeoutMs: 120_000,
|
|
22
|
-
maxOutputBytes: 2 * 1024 * 1024
|
|
23
|
-
}).catch((err) => ({ code: 1, stdout: '', stderr: messageOf(err), timedOut: false }));
|
|
24
|
-
const parsed = parseDoctorJson(doctor.stdout);
|
|
25
|
-
assertGate(parsed.runtime_readiness, 'doctor JSON runtime readiness missing', { stdout_tail: doctor.stdout.slice(-1000), stderr_tail: doctor.stderr.slice(-1000) });
|
|
26
|
-
assertGate(parsed.runtime_readiness.hook_evidence_policy === 'unknown-do-not-count', 'doctor must report unknown hook evidence does not count', parsed.runtime_readiness);
|
|
27
|
-
assertGate(parsed.runtime_readiness.agent_role_strategy === 'message-role', 'doctor must report message-role fallback', parsed.runtime_readiness);
|
|
28
|
-
const madPlan = await resolveCodexNativeInvocationPlan({
|
|
29
|
-
root: fixture.root,
|
|
30
|
-
missionId: fixture.missionId,
|
|
31
|
-
route: '$MAD',
|
|
32
|
-
desiredCapability: 'hook-evidence'
|
|
33
|
-
});
|
|
34
|
-
assertGate(madPlan.selected_strategy === 'blocked', 'MAD hook evidence must block when hook state is unknown', madPlan);
|
|
35
|
-
assertGate(madPlan.blockers.includes('hook_approval_not_approved'), 'MAD hook blocker missing', madPlan);
|
|
36
|
-
const artifact = path.join(fixture.root, '.sneakoscope', 'missions', fixture.missionId, 'codex-native-invocation-plan.mad.hook-evidence.json');
|
|
37
|
-
assertGate(await fileExists(artifact), 'MAD invocation plan artifact missing', { artifact });
|
|
38
|
-
});
|
|
39
|
-
emitGate('pipeline:codex-native-doctor-mad-routing-real-blackbox');
|
|
40
|
-
}
|
|
41
|
-
if (import.meta.url === pathToFileURL(process.argv[1] || '').href)
|
|
42
|
-
await runCodexNativeDoctorMadRoutingRealBlackbox();
|
|
43
|
-
function parseDoctorJson(stdout) {
|
|
44
|
-
const text = stdout.trim();
|
|
45
|
-
if (!text)
|
|
46
|
-
return {};
|
|
47
|
-
try {
|
|
48
|
-
return JSON.parse(text);
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
const start = text.indexOf('{');
|
|
52
|
-
const end = text.lastIndexOf('}');
|
|
53
|
-
return start >= 0 && end > start ? JSON.parse(text.slice(start, end + 1)) : {};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async function fileExists(file) {
|
|
57
|
-
try {
|
|
58
|
-
const stat = await fs.stat(file);
|
|
59
|
-
return stat.isFile();
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function assertGate(condition, message, detail = {}) {
|
|
66
|
-
if (condition)
|
|
67
|
-
return;
|
|
68
|
-
console.error(JSON.stringify({ ok: false, message, detail }, null, 2));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
function emitGate(gate) {
|
|
72
|
-
console.log(JSON.stringify({ schema: 'sks.release-gate.v1', ok: true, gate }, null, 2));
|
|
73
|
-
}
|
|
74
|
-
function messageOf(err) {
|
|
75
|
-
return err instanceof Error ? err.message : String(err);
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=pipeline-codex-native-doctor-mad-routing-real-blackbox.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { runCodexNativeDoctorMadRoutingRealBlackbox } from './pipeline-codex-native-doctor-mad-routing-real-blackbox.js';
|
|
3
|
-
import { runCodexNativeImageRoutingRealBlackbox } from './pipeline-codex-native-image-routing-real-blackbox.js';
|
|
4
|
-
import { runCodexNativeLoopRoutingRealBlackbox } from './pipeline-codex-native-loop-routing-real-blackbox.js';
|
|
5
|
-
import { runCodexNativeQaRoutingRealBlackbox } from './pipeline-codex-native-qa-routing-real-blackbox.js';
|
|
6
|
-
import { runCodexNativeResearchRoutingRealBlackbox } from './pipeline-codex-native-research-routing-real-blackbox.js';
|
|
7
|
-
await runCodexNativeLoopRoutingRealBlackbox();
|
|
8
|
-
await runCodexNativeQaRoutingRealBlackbox();
|
|
9
|
-
await runCodexNativeResearchRoutingRealBlackbox();
|
|
10
|
-
await runCodexNativeImageRoutingRealBlackbox();
|
|
11
|
-
await runCodexNativeDoctorMadRoutingRealBlackbox();
|
|
12
|
-
console.log(JSON.stringify({ schema: 'sks.release-gate.v1', ok: true, gate: 'pipeline:codex-native-e2e-blackbox' }, null, 2));
|
|
13
|
-
//# sourceMappingURL=pipeline-codex-native-e2e-blackbox.js.map
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { writeImageArtifactPathContract } from '../core/image/image-artifact-path-contract.js';
|
|
6
|
-
import { createCodexNativeRuntimeFixture, withFixtureEnv } from './codex-native-runtime-e2e-fixture.js';
|
|
7
|
-
export async function runCodexNativeImageRoutingRealBlackbox() {
|
|
8
|
-
const modelVisible = await imageScenario({ imagePathExposure: true, missing: false });
|
|
9
|
-
assertGate(modelVisible.images?.[0]?.codex_native_followup_strategy === 'model-visible-path', 'image path exposure should select model-visible path', modelVisible);
|
|
10
|
-
const artifactPath = await imageScenario({ imagePathExposure: false, missing: false });
|
|
11
|
-
assertGate(artifactPath.images?.[0]?.codex_native_followup_strategy === 'artifact-path', 'image path fallback should select saved artifact path', artifactPath);
|
|
12
|
-
const ambiguous = await imageScenario({ imagePathExposure: true, missing: true });
|
|
13
|
-
assertGate(Array.isArray(ambiguous.blockers) && ambiguous.blockers.length > 0, 'ambiguous/missing image reference must block', ambiguous);
|
|
14
|
-
assertGate(JSON.stringify(ambiguous).includes('Image file path missing'), 'missing image must not produce false follow-up edit hint', ambiguous);
|
|
15
|
-
emitGate('pipeline:codex-native-image-routing-real-blackbox');
|
|
16
|
-
}
|
|
17
|
-
async function imageScenario(input) {
|
|
18
|
-
const fixture = await createCodexNativeRuntimeFixture({
|
|
19
|
-
hook: 'approved',
|
|
20
|
-
agentType: 'supported',
|
|
21
|
-
appHandoff: true,
|
|
22
|
-
imagePathExposure: input.imagePathExposure,
|
|
23
|
-
mcpCandidates: true,
|
|
24
|
-
codeModeWebSearch: true
|
|
25
|
-
});
|
|
26
|
-
return withFixtureEnv(fixture, async () => {
|
|
27
|
-
const imagePath = path.join(fixture.root, '.sneakoscope', 'missions', fixture.missionId, input.missing ? 'missing.png' : 'image.png');
|
|
28
|
-
if (!input.missing)
|
|
29
|
-
await fs.writeFile(imagePath, Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]));
|
|
30
|
-
const result = await writeImageArtifactPathContract(fixture.root, {
|
|
31
|
-
missionId: fixture.missionId,
|
|
32
|
-
images: [{ id: 'fixture-image', kind: 'generated_image', filePath: imagePath }]
|
|
33
|
-
});
|
|
34
|
-
const artifact = JSON.parse(await fs.readFile(result.artifact_path, 'utf8'));
|
|
35
|
-
assertGate(artifact.codex_native_invocation_plan, 'image invocation plan missing from artifact', artifact);
|
|
36
|
-
return artifact;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (import.meta.url === pathToFileURL(process.argv[1] || '').href)
|
|
40
|
-
await runCodexNativeImageRoutingRealBlackbox();
|
|
41
|
-
function assertGate(condition, message, detail = {}) {
|
|
42
|
-
if (condition)
|
|
43
|
-
return;
|
|
44
|
-
console.error(JSON.stringify({ ok: false, message, detail }, null, 2));
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
function emitGate(gate) {
|
|
48
|
-
console.log(JSON.stringify({ schema: 'sks.release-gate.v1', ok: true, gate }, null, 2));
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=pipeline-codex-native-image-routing-real-blackbox.js.map
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { planLoopsFromRequest } from '../core/loops/loop-planner.js';
|
|
6
|
-
import { runLoopMakerWorkers } from '../core/loops/loop-worker-runtime.js';
|
|
7
|
-
import { resolveCodexNativeInvocationPlan } from '../core/codex-native/codex-native-invocation-router.js';
|
|
8
|
-
import { createCodexNativeRuntimeFixture, withFixtureEnv } from './codex-native-runtime-e2e-fixture.js';
|
|
9
|
-
export async function runCodexNativeLoopRoutingRealBlackbox() {
|
|
10
|
-
const supported = await createCodexNativeRuntimeFixture({
|
|
11
|
-
hook: 'approved',
|
|
12
|
-
agentType: 'supported',
|
|
13
|
-
appHandoff: true,
|
|
14
|
-
imagePathExposure: true,
|
|
15
|
-
mcpCandidates: true,
|
|
16
|
-
codeModeWebSearch: true
|
|
17
|
-
});
|
|
18
|
-
await withFixtureEnv(supported, async () => {
|
|
19
|
-
const plan = await planLoopsFromRequest({
|
|
20
|
-
root: supported.root,
|
|
21
|
-
missionId: supported.missionId,
|
|
22
|
-
request: 'change loop runtime fixture',
|
|
23
|
-
sourceCommand: 'loop',
|
|
24
|
-
maxLoops: 1
|
|
25
|
-
});
|
|
26
|
-
const node = plan.graph.nodes.find((row) => row.route !== '$Integration');
|
|
27
|
-
assertGate(node, 'loop action node missing');
|
|
28
|
-
const result = await runLoopMakerWorkers({ root: supported.root, plan, node, fixture: true });
|
|
29
|
-
assertGate(result.codex_native_invocation_plan?.selected_strategy === 'codex-app-native', 'loop fixture did not record codex-app-native strategy', result);
|
|
30
|
-
assertGate(result.codex_native_invocation_plan?.env.SKS_CODEX_NATIVE_AGENT_ROLE_STRATEGY === 'agent_type', 'loop fixture env missing agent_type strategy', result);
|
|
31
|
-
const artifact = path.join(supported.root, '.sneakoscope', 'missions', supported.missionId, 'codex-native-invocation-plan.loop.agent-role.json');
|
|
32
|
-
assertGate(await exists(artifact), 'loop invocation plan artifact missing', { artifact });
|
|
33
|
-
});
|
|
34
|
-
const unsupported = await createCodexNativeRuntimeFixture({
|
|
35
|
-
hook: 'approved',
|
|
36
|
-
agentType: 'unsupported',
|
|
37
|
-
appHandoff: true,
|
|
38
|
-
imagePathExposure: true,
|
|
39
|
-
mcpCandidates: true,
|
|
40
|
-
codeModeWebSearch: true
|
|
41
|
-
});
|
|
42
|
-
await withFixtureEnv(unsupported, async () => {
|
|
43
|
-
const plan = await resolveCodexNativeInvocationPlan({
|
|
44
|
-
root: unsupported.root,
|
|
45
|
-
missionId: unsupported.missionId,
|
|
46
|
-
route: '$Loop',
|
|
47
|
-
desiredCapability: 'agent-role'
|
|
48
|
-
});
|
|
49
|
-
assertGate(plan.selected_strategy === 'message-role-fallback', 'unsupported agent_type must use message-role fallback', plan);
|
|
50
|
-
assertGate(plan.warnings.some((warning) => warning.includes('message-role fallback')), 'fallback warning missing', plan);
|
|
51
|
-
});
|
|
52
|
-
emitGate('pipeline:codex-native-loop-routing-real-blackbox');
|
|
53
|
-
}
|
|
54
|
-
if (import.meta.url === pathToFileURL(process.argv[1] || '').href)
|
|
55
|
-
await runCodexNativeLoopRoutingRealBlackbox();
|
|
56
|
-
async function exists(file) {
|
|
57
|
-
try {
|
|
58
|
-
const stat = await fs.stat(file);
|
|
59
|
-
return stat.isFile();
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function assertGate(condition, message, detail = {}) {
|
|
66
|
-
if (condition)
|
|
67
|
-
return;
|
|
68
|
-
console.error(JSON.stringify({ ok: false, message, detail }, null, 2));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
function emitGate(gate) {
|
|
72
|
-
console.log(JSON.stringify({ schema: 'sks.release-gate.v1', ok: true, gate }, null, 2));
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=pipeline-codex-native-loop-routing-real-blackbox.js.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { writeQaLoopArtifacts } from '../core/qa-loop.js';
|
|
6
|
-
import { createCodexNativeRuntimeFixture, withFixtureEnv } from './codex-native-runtime-e2e-fixture.js';
|
|
7
|
-
export async function runCodexNativeQaRoutingRealBlackbox() {
|
|
8
|
-
const ready = await qaScenario({ hook: 'approved', appHandoff: true });
|
|
9
|
-
assertGate(ready.visual_review === 'codex-app-native', 'QA visual review should select app handoff when ready', ready);
|
|
10
|
-
const unknownHook = await qaScenario({ hook: 'unknown', appHandoff: true });
|
|
11
|
-
assertGate(unknownHook.hook_evidence_policy === 'unknown-do-not-count', 'unknown hook evidence must not count', unknownHook);
|
|
12
|
-
assertGate(unknownHook.hook_derived_evidence_counted === false, 'unknown hook-derived evidence was counted', unknownHook);
|
|
13
|
-
const noHandoff = await qaScenario({ hook: 'approved', appHandoff: false });
|
|
14
|
-
assertGate(noHandoff.visual_review !== 'codex-app-native', 'QA must not falsely pass app handoff when unavailable', noHandoff);
|
|
15
|
-
emitGate('pipeline:codex-native-qa-routing-real-blackbox');
|
|
16
|
-
}
|
|
17
|
-
async function qaScenario(input) {
|
|
18
|
-
const fixture = await createCodexNativeRuntimeFixture({
|
|
19
|
-
hook: input.hook,
|
|
20
|
-
agentType: 'supported',
|
|
21
|
-
appHandoff: input.appHandoff,
|
|
22
|
-
imagePathExposure: true,
|
|
23
|
-
mcpCandidates: true,
|
|
24
|
-
codeModeWebSearch: true
|
|
25
|
-
});
|
|
26
|
-
return withFixtureEnv(fixture, async () => {
|
|
27
|
-
const dir = path.join(fixture.root, '.sneakoscope', 'missions', fixture.missionId);
|
|
28
|
-
await writeQaLoopArtifacts(dir, { id: fixture.missionId, prompt: 'QA visual fixture' }, {
|
|
29
|
-
answers: {
|
|
30
|
-
QA_SCOPE: 'ui_visual',
|
|
31
|
-
TARGET_ENVIRONMENT: 'local_fixture',
|
|
32
|
-
QA_MUTATION_POLICY: 'no_mutation'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const artifact = JSON.parse(await fs.readFile(path.join(dir, 'qa-loop', 'codex-native-invocation.json'), 'utf8'));
|
|
36
|
-
assertGate(artifact && typeof artifact === 'object', 'QA invocation artifact missing');
|
|
37
|
-
return artifact;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (import.meta.url === pathToFileURL(process.argv[1] || '').href)
|
|
41
|
-
await runCodexNativeQaRoutingRealBlackbox();
|
|
42
|
-
function assertGate(condition, message, detail = {}) {
|
|
43
|
-
if (condition)
|
|
44
|
-
return;
|
|
45
|
-
console.error(JSON.stringify({ ok: false, message, detail }, null, 2));
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
function emitGate(gate) {
|
|
49
|
-
console.log(JSON.stringify({ schema: 'sks.release-gate.v1', ok: true, gate }, null, 2));
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=pipeline-codex-native-qa-routing-real-blackbox.js.map
|