sneakoscope 4.0.13 → 4.0.14

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.
Files changed (101) hide show
  1. package/README.md +10 -2
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/bin/sks.js +1 -1
  6. package/dist/cli/global-mode-router.js +2 -1
  7. package/dist/core/commands/mad-sks-command.js +3 -0
  8. package/dist/core/fsx.js +1 -1
  9. package/dist/core/providers/glm/bench/glm-bench-model-lock-proof.js +32 -3
  10. package/dist/core/providers/glm/bench/glm-benchmark-runner.js +29 -5
  11. package/dist/core/providers/glm/bench/glm-benchmark-types.js +1 -1
  12. package/dist/core/providers/glm/naruto/glm-naruto-critical-path.js +51 -0
  13. package/dist/core/providers/glm/naruto/glm-naruto-final-seal.js +9 -2
  14. package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +101 -15
  15. package/dist/core/providers/glm/naruto/glm-naruto-parallelism-summary.js +55 -0
  16. package/dist/core/providers/glm/naruto/glm-naruto-requirement-coverage.js +92 -0
  17. package/dist/core/providers/glm/naruto/glm-naruto-requirement-ledger.js +42 -0
  18. package/dist/core/providers/glm/naruto/glm-naruto-stage-scheduler.js +85 -0
  19. package/dist/core/providers/glm/naruto/glm-naruto-task-size-classifier.js +12 -0
  20. package/dist/core/providers/glm/naruto/glm-naruto-trace.js +4 -0
  21. package/dist/core/providers/glm/naruto/glm-naruto-verifier-output.js +5 -0
  22. package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +130 -44
  23. package/dist/core/providers/glm/naruto/glm-naruto-worker-runtime.js +6 -2
  24. package/dist/core/routes/model-mode-router.js +44 -0
  25. package/dist/core/version.js +1 -1
  26. package/package.json +24 -1
  27. package/dist/scripts/agent-dynamic-pool-fixture.js +0 -80
  28. package/dist/scripts/agent-native-release-gate.js +0 -274
  29. package/dist/scripts/agent-patch-swarm-gate-lib.js +0 -113
  30. package/dist/scripts/agent-real-codex-patch-envelope-smoke.js +0 -126
  31. package/dist/scripts/agent-route-blackbox-lib.js +0 -132
  32. package/dist/scripts/blackbox-command-import-smoke.js +0 -143
  33. package/dist/scripts/blackbox-global-shim.js +0 -77
  34. package/dist/scripts/blackbox-matrix.js +0 -70
  35. package/dist/scripts/blackbox-npx-one-shot.js +0 -69
  36. package/dist/scripts/blackbox-pack-install.js +0 -174
  37. package/dist/scripts/build-dist.js +0 -64
  38. package/dist/scripts/check-architecture.js +0 -135
  39. package/dist/scripts/check-cli-entrypoint.js +0 -43
  40. package/dist/scripts/check-command-module-budget.js +0 -25
  41. package/dist/scripts/check-dist-runtime.js +0 -100
  42. package/dist/scripts/check-feature-quality.js +0 -53
  43. package/dist/scripts/check-legacy-free.js +0 -66
  44. package/dist/scripts/check-package-boundary.js +0 -108
  45. package/dist/scripts/check-pipeline-budget.js +0 -69
  46. package/dist/scripts/check-pipeline-runtime.js +0 -25
  47. package/dist/scripts/check-publish-tag.js +0 -30
  48. package/dist/scripts/check-route-modularity.js +0 -82
  49. package/dist/scripts/check-runtime-schemas.js +0 -87
  50. package/dist/scripts/check-source-runtime.js +0 -4
  51. package/dist/scripts/check-ts-contracts.js +0 -69
  52. package/dist/scripts/check-ts-suppressions.js +0 -58
  53. package/dist/scripts/clean-dist.js +0 -8
  54. package/dist/scripts/codex-0140-feature-gate-lib.js +0 -14
  55. package/dist/scripts/codex-config-eperm-fixture.js +0 -32
  56. package/dist/scripts/codex-lb-missing-env-regression.js +0 -40
  57. package/dist/scripts/codex-native-runtime-e2e-fixture.js +0 -75
  58. package/dist/scripts/codex-project-config-policy-merge-regression.js +0 -92
  59. package/dist/scripts/core-skill-legacy-promotion-api-audit.js +0 -54
  60. package/dist/scripts/ensure-bin-executable.js +0 -10
  61. package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -51
  62. package/dist/scripts/github-release-body-helper.js +0 -65
  63. package/dist/scripts/gpt-image-2-real-file-smoke.js +0 -448
  64. package/dist/scripts/hooks-no-unsupported-handlers.js +0 -15
  65. package/dist/scripts/hooks-runtime-replay-warning-zero-v2.js +0 -26
  66. package/dist/scripts/hooks-runtime-replay-warning-zero.js +0 -10
  67. package/dist/scripts/hooks-trust-warning-zero.js +0 -14
  68. package/dist/scripts/lib/codex-sdk-gate-lib.js +0 -92
  69. package/dist/scripts/lib/ensure-dist-fresh.js +0 -142
  70. package/dist/scripts/lib/git-worktree-fixture.js +0 -33
  71. package/dist/scripts/lib/mad-sks-actual-executor-check-lib.js +0 -255
  72. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +0 -79
  73. package/dist/scripts/lib/real-codex-parallel-gate.js +0 -94
  74. package/dist/scripts/lib/real-codex-parallel-proof-fixture.js +0 -55
  75. package/dist/scripts/lib/valid-png-fixture.js +0 -25
  76. package/dist/scripts/mad-sks-live-protected-core-smoke.js +0 -5
  77. package/dist/scripts/naruto-real-local-gpt-final-smoke.js +0 -25
  78. package/dist/scripts/perf-gate.js +0 -39
  79. package/dist/scripts/prepublish-release-check-or-fast.js +0 -121
  80. package/dist/scripts/release-3112-required-gates.js +0 -30
  81. package/dist/scripts/release-3113-required-gates.js +0 -25
  82. package/dist/scripts/release-4000-required-gates.js +0 -36
  83. package/dist/scripts/release-4001-required-gates.js +0 -13
  84. package/dist/scripts/release-4002-required-gates.js +0 -14
  85. package/dist/scripts/release-check-dynamic-execute.js +0 -259
  86. package/dist/scripts/release-check-dynamic.js +0 -107
  87. package/dist/scripts/release-check-stamp.js +0 -261
  88. package/dist/scripts/release-gate-dag-runner.js +0 -56
  89. package/dist/scripts/release-gate-existence-audit.js +0 -111
  90. package/dist/scripts/release-gate-planner.js +0 -34
  91. package/dist/scripts/release-gate-worker.js +0 -10
  92. package/dist/scripts/release-speed-summary.js +0 -67
  93. package/dist/scripts/repo-audit.js +0 -83
  94. package/dist/scripts/rust-smoke.js +0 -5
  95. package/dist/scripts/sizecheck.js +0 -146
  96. package/dist/scripts/sks-1-11-gate-lib.js +0 -78
  97. package/dist/scripts/sks-1-18-gate-lib.js +0 -55
  98. package/dist/scripts/tmux-removal-inventory.js +0 -36
  99. package/dist/scripts/write-build-manifest.js +0 -71
  100. package/dist/scripts/zellij-dashboard-watch.js +0 -41
  101. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -162
@@ -1,132 +0,0 @@
1
- // @ts-nocheck
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import { spawnSync } from 'node:child_process';
5
- import { assertGate, emitGate, root } from './sks-1-18-gate-lib.js';
6
- const PROMPT = 'route truth dynamic scheduler fixture';
7
- const ROUTE_ARGS = ['--agents', '5', '--work-items', '8', '--target-active-slots', '5', '--minimum-work-items', '5', '--max-queue-expansion', '10', '--mock', '--json'];
8
- export function runRouteBackfillBlackbox(route, gate) {
9
- if (String(route).toLowerCase().includes('team'))
10
- return runActualTeamBackfillBlackbox(gate);
11
- if (String(route).toLowerCase().includes('research'))
12
- return runActualResearchBackfillBlackbox(gate);
13
- if (String(route).toLowerCase().includes('qa'))
14
- return runActualQaBackfillBlackbox(gate);
15
- return runActualAgentBackfillBlackbox(gate);
16
- }
17
- export function runActualAgentBackfillBlackbox(gate = 'agent:backfill-route-blackbox') {
18
- const json = runSks(['agent', 'run', PROMPT, '--route', '$Agent', ...ROUTE_ARGS], gate);
19
- validateNativeRun(json, gate, { route: '$Agent', command: 'sks agent run', kind: 'actual_agent_command' });
20
- return json;
21
- }
22
- export function runActualTeamBackfillBlackbox(gate = 'team:backfill-route-blackbox') {
23
- const json = runSks(['team', PROMPT, ...ROUTE_ARGS, '--no-open-zellij'], gate);
24
- validateNativeRun(json.native_agent_run, gate, { route: '$Team', command: 'sks team', kind: 'actual_team_command' });
25
- return json;
26
- }
27
- export function runActualResearchBackfillBlackbox(gate = 'research:backfill-route-blackbox') {
28
- const prepared = runSks(['research', 'prepare', PROMPT, '--json'], `${gate}:prepare`);
29
- const missionId = prepared.mission_id;
30
- assertGate(Boolean(missionId), `${gate} research prepare must return mission_id`, prepared);
31
- const json = runSks(['research', 'run', missionId, ...ROUTE_ARGS], gate);
32
- const native = json.native_agent_run || readMissionJson(missionId, 'research-native-agent-run.json');
33
- validateNativeRun(native, gate, { route: '$Research', command: 'sks research run', kind: 'actual_research_command' });
34
- return json;
35
- }
36
- export function runActualQaBackfillBlackbox(gate = 'qa:backfill-route-blackbox') {
37
- const prepared = runSks(['qa-loop', 'prepare', PROMPT, '--json'], `${gate}:prepare`);
38
- const missionId = prepared.mission_id;
39
- assertGate(Boolean(missionId), `${gate} qa prepare must return mission_id`, prepared);
40
- const json = runSks(['qa-loop', 'run', missionId, ...ROUTE_ARGS], gate);
41
- const native = json.native_agent_run || readMissionJson(missionId, 'qa-native-agent-run.json');
42
- validateNativeRun(native, gate, { route: '$QA-LOOP', command: 'sks qa-loop run', kind: 'actual_qa_command' });
43
- return json;
44
- }
45
- export function validateNativeRun(json, gate, expected = {}) {
46
- assertGate(Boolean(json), `${gate} native agent run JSON missing`, {});
47
- const state = json.scheduler?.state || {};
48
- const proof = json.proof || {};
49
- const ledgerRoot = path.join(root, json.ledger_root || '');
50
- assertGate(fs.existsSync(ledgerRoot), `${gate} ledger root missing`, { ledger_root: json.ledger_root });
51
- const events = readJsonl(path.join(ledgerRoot, 'agent-scheduler-events.jsonl'));
52
- const backfills = events.filter((event) => event.event_type === 'backfill_event');
53
- const graph = readJson(path.join(ledgerRoot, 'agent-task-graph.json'));
54
- const queue = readJson(path.join(ledgerRoot, 'agent-work-queue.json'));
55
- const supervisor = readJson(path.join(ledgerRoot, 'agent-zellij-lane-supervisor.json'));
56
- assertGate(json.ok === true, `${gate} proof must pass`, proof);
57
- assertGate(graph.schema === 'sks.agent-task-graph.v1', `${gate} task graph schema missing`, graph);
58
- assertGate(graph.target_active_slots === 5 && graph.total_work_items === 8, `${gate} task graph must split active slots and work items`, graph.route_work_count_summary);
59
- assertGate(queue.total_work_items === graph.total_work_items, `${gate} work queue must match task graph`, { queue: queue.total_work_items, graph: graph.total_work_items });
60
- assertGate(state.target_active_slots === 5, `${gate} target active slots must be 5`, state);
61
- assertGate(state.total_work_items === queue.total_work_items, `${gate} scheduler must match work queue`, { scheduler: state.total_work_items, queue: queue.total_work_items });
62
- assertGate(state.max_observed_active_slots === 5, `${gate} must observe 5 active slots`, state);
63
- assertGate(state.expected_backfill_count >= 2, `${gate} expected backfill count must be at least 2`, state);
64
- assertGate(state.backfill_count >= state.expected_backfill_count, `${gate} backfills must satisfy expectation`, state);
65
- assertGate(backfills.length >= 2, `${gate} must emit at least two backfill events`, { backfills });
66
- assertGate(events.some((event) => event.event_type === 'scheduler_draining'), `${gate} must emit scheduler_draining`, {});
67
- assertGate(state.pending_queue_drained === true, `${gate} queue must drain`, state);
68
- assertGate(state.all_generations_closed === true, `${gate} generations must close`, state);
69
- assertGate(proof.requested_work_items === 8, `${gate} proof must record requested work items`, proof);
70
- assertGate(proof.actual_total_work_items === 8, `${gate} proof must record actual total work items`, proof);
71
- assertGate(proof.task_graph_total_work_items === 8, `${gate} proof task graph total must be 8`, proof);
72
- assertGate(proof.work_queue_total_work_items === 8, `${gate} proof work queue total must be 8`, proof);
73
- assertGate(proof.scheduler_total_work_items === 8, `${gate} proof scheduler total must be 8`, proof);
74
- assertGate(proof.task_graph_matches_cli_options === true, `${gate} proof must bind task graph to CLI options`, proof);
75
- assertGate(proof.work_queue_matches_task_graph === true, `${gate} proof must bind work queue to task graph`, proof);
76
- assertGate(proof.scheduler_matches_work_queue === true, `${gate} proof must bind scheduler to work queue`, proof);
77
- assertGate(proof.generation_count >= state.total_work_items, `${gate} proof generation count must cover work items`, proof);
78
- assertGate(proof.terminal_close_report_count >= proof.generation_count, `${gate} close reports must cover generations`, proof);
79
- assertGate(proof.terminal_reports_match_generations === true, `${gate} proof must bind terminal reports to generations`, proof);
80
- assertGate(proof.source_intelligence_generation_refs_ok === true && proof.task_graph_source_refs_ok === true && proof.work_queue_source_refs_ok === true, `${gate} source refs must propagate`, proof);
81
- assertGate(proof.goal_mode_generation_refs_ok === true && proof.task_graph_goal_refs_ok === true && proof.work_queue_goal_refs_ok === true, `${gate} goal refs must propagate`, proof);
82
- assertGate(proof.lane_supervisor_integrated === true && supervisor.schema === 'sks.zellij-lane-supervisor.v1', `${gate} Zellij supervisor must be integrated`, { proof, supervisor });
83
- assertGate(proof.zellij_lane_no_flicker_verified === true, `${gate} Zellij no-flicker proof must pass`, proof);
84
- assertGate(proof.real_route_command_used === true, `${gate} must use real route command`, proof);
85
- assertGate(String(proof.route_command || '').includes(expected.command), `${gate} proof route command mismatch`, proof);
86
- assertGate(proof.route_blackbox_kind === expected.kind, `${gate} proof route blackbox kind mismatch`, proof);
87
- if (expected.route !== '$Agent') {
88
- assertGate(!/\bagent\s+run\b/i.test(String(proof.route_command || '')), `${gate} must not use agent run stand-in`, proof);
89
- }
90
- emitGate(gate, {
91
- route: expected.route,
92
- command: proof.route_command,
93
- mission_id: json.mission_id,
94
- target_active_slots: state.target_active_slots,
95
- total_work_items: state.total_work_items,
96
- expected_backfill_count: state.expected_backfill_count,
97
- backfill_count: state.backfill_count,
98
- generation_count: proof.generation_count
99
- });
100
- }
101
- function runSks(args, gate) {
102
- const result = spawnSync(process.execPath, ['dist/bin/sks.js', ...args], {
103
- cwd: root,
104
- encoding: 'utf8',
105
- env: { ...process.env, SKS_AGENT_DYNAMIC_BACKFILL_FIXTURE: '1' },
106
- maxBuffer: 1024 * 1024 * 16
107
- });
108
- assertGate(result.status === 0, `${gate} route command failed`, { args, stdout: result.stdout.slice(-4000), stderr: result.stderr.slice(-4000) });
109
- return parseJson(result.stdout, gate);
110
- }
111
- function parseJson(stdout, gate) {
112
- try {
113
- return JSON.parse(stdout);
114
- }
115
- catch (err) {
116
- const start = stdout.indexOf('{');
117
- const end = stdout.lastIndexOf('}');
118
- if (start >= 0 && end > start)
119
- return JSON.parse(stdout.slice(start, end + 1));
120
- assertGate(false, `${gate} did not emit JSON`, { stdout: stdout.slice(-4000), error: String(err) });
121
- }
122
- }
123
- function readMissionJson(missionId, rel) {
124
- return readJson(path.join(root, '.sneakoscope', 'missions', missionId, rel));
125
- }
126
- function readJson(file) {
127
- return JSON.parse(fs.readFileSync(file, 'utf8'));
128
- }
129
- function readJsonl(file) {
130
- return fs.readFileSync(file, 'utf8').trim().split(/\n+/).filter(Boolean).map((line) => JSON.parse(line));
131
- }
132
- //# sourceMappingURL=agent-route-blackbox-lib.js.map
@@ -1,143 +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 { spawnSync } from 'node:child_process';
7
- import { pathToFileURL } from 'node:url';
8
- import { currentDistFreshness } from './lib/ensure-dist-fresh.js';
9
- const root = process.cwd();
10
- const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
11
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-command-import-smoke-'));
12
- const cache = path.join(tmp, 'npm-cache');
13
- const consumer = path.join(tmp, 'consumer');
14
- const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
15
- const failures = [];
16
- const rows = [];
17
- fs.mkdirSync(consumer, { recursive: true });
18
- fs.writeFileSync(path.join(consumer, 'package.json'), `${JSON.stringify({ name: 'sks-command-smoke-consumer', private: true }, null, 2)}\n`);
19
- try {
20
- if (process.env.SKS_ENSURE_DIST_NO_REBUILD === '1' || process.env.SKS_RELEASE_DIST_FRESHNESS_NO_REBUILD === '1') {
21
- const freshness = currentDistFreshness();
22
- rows.push({ label: 'dist_freshness', ok: freshness.ok, status: freshness.ok ? 0 : 1, issues: freshness.issues });
23
- if (!freshness.ok)
24
- failures.push(`dist_not_fresh:${freshness.issues.join(',')}`);
25
- }
26
- else {
27
- run('build', npmBin, ['run', 'build'], { cwd: root });
28
- }
29
- const pack = run('npm_pack', npmBin, ['pack', '--json', '--ignore-scripts', '--pack-destination', tmp, '--registry', 'https://registry.npmjs.org/'], { cwd: root });
30
- const info = pack.ok ? JSON.parse(pack.stdout || '[]')[0] : null;
31
- const tarball = info ? path.join(tmp, info.filename) : null;
32
- if (tarball)
33
- extractPackedTarball(tarball);
34
- const pkgRoot = path.join(consumer, 'node_modules', 'sneakoscope');
35
- if (!fs.existsSync(pkgRoot))
36
- failures.push('installed_package_missing');
37
- else
38
- await smokeCommands(pkgRoot);
39
- }
40
- finally {
41
- if (failures.length && process.argv.includes('--keep')) {
42
- // Keep temp root for debugging only when explicitly requested.
43
- }
44
- else if (!process.argv.includes('--keep')) {
45
- fs.rmSync(tmp, { recursive: true, force: true });
46
- }
47
- }
48
- const result = {
49
- schema: 'sks.blackbox-command-import-smoke.v1',
50
- ok: failures.length === 0,
51
- temp_root: failures.length && process.argv.includes('--keep') ? tmp : null,
52
- rows,
53
- failures
54
- };
55
- console.log(JSON.stringify(result, null, 2));
56
- if (!result.ok)
57
- process.exitCode = 1;
58
- function run(label, cmd, args, options = {}) {
59
- const result = spawnSync(cmd, args, {
60
- cwd: options.cwd || root,
61
- encoding: 'utf8',
62
- timeout: options.timeout || 120_000,
63
- env: childNpmEnv(options.env)
64
- });
65
- const row = {
66
- label,
67
- command: [cmd, ...args].join(' '),
68
- status: result.status,
69
- ok: result.status === 0,
70
- stdout: result.stdout || '',
71
- stderr_tail: String(result.stderr || '').slice(-800)
72
- };
73
- rows.push({ ...row, stdout: undefined });
74
- if (!row.ok)
75
- failures.push(`${label}:${row.stderr_tail || result.stdout}`);
76
- return row;
77
- }
78
- function childNpmEnv(extra = {}) {
79
- const env = { ...process.env, npm_config_cache: cache, SKS_SKIP_NPM_FRESHNESS_CHECK: '1', CI: 'true', ...extra };
80
- delete env.npm_config_dry_run;
81
- delete env.NPM_CONFIG_DRY_RUN;
82
- return env;
83
- }
84
- function extractPackedTarball(tarball) {
85
- const pkgRoot = path.join(consumer, 'node_modules', 'sneakoscope');
86
- fs.mkdirSync(pkgRoot, { recursive: true });
87
- const stripFlag = process.platform === 'win32' ? '--strip-components=1' : '--strip-components';
88
- const args = process.platform === 'win32'
89
- ? ['-xzf', tarball, '-C', pkgRoot, stripFlag]
90
- : ['-xzf', tarball, '-C', pkgRoot, stripFlag, '1'];
91
- const extracted = run('extract_pack_tarball', 'tar', args, { cwd: consumer });
92
- if (!extracted.ok)
93
- return;
94
- linkRuntimeDependencies(pkgRoot);
95
- }
96
- function linkRuntimeDependencies(pkgRoot) {
97
- const deps = Object.keys(pkg.dependencies || {});
98
- if (!deps.length)
99
- return;
100
- const nodeModules = path.join(pkgRoot, 'node_modules');
101
- fs.mkdirSync(nodeModules, { recursive: true });
102
- for (const dep of deps) {
103
- const source = path.join(root, 'node_modules', dep);
104
- const target = path.join(nodeModules, dep);
105
- if (!fs.existsSync(source)) {
106
- failures.push(`dependency_missing:${dep}`);
107
- continue;
108
- }
109
- fs.mkdirSync(path.dirname(target), { recursive: true });
110
- try {
111
- fs.symlinkSync(source, target, process.platform === 'win32' ? 'junction' : 'dir');
112
- rows.push({ label: `link_dependency:${dep}`, ok: true, status: 0 });
113
- }
114
- catch (err) {
115
- failures.push(`dependency_link_failed:${dep}:${err.message}`);
116
- rows.push({ label: `link_dependency:${dep}`, ok: false, status: 1, stderr_tail: String(err.message).slice(-800) });
117
- }
118
- }
119
- }
120
- async function smokeCommands(pkgRoot) {
121
- const registryPath = path.join(pkgRoot, 'dist', 'cli', 'command-registry.js');
122
- if (!fs.existsSync(registryPath)) {
123
- failures.push('dist_cli_command_registry_missing');
124
- return;
125
- }
126
- const registry = await import(pathToFileURL(registryPath));
127
- const names = registry.commandNames();
128
- for (const name of names) {
129
- const entry = registry.COMMANDS[name];
130
- try {
131
- const mod = await entry.lazy();
132
- const runner = mod.run || mod.main || mod.default;
133
- if (typeof runner !== 'function')
134
- failures.push(`${name}:runner_missing`);
135
- rows.push({ label: `lazy_import:${name}`, ok: typeof runner === 'function', status: typeof runner === 'function' ? 0 : 1 });
136
- }
137
- catch (err) {
138
- failures.push(`${name}:${err.stack || err.message}`);
139
- rows.push({ label: `lazy_import:${name}`, ok: false, status: 1, stderr_tail: String(err.stack || err.message).slice(-800) });
140
- }
141
- }
142
- }
143
- //# sourceMappingURL=blackbox-command-import-smoke.js.map
@@ -1,77 +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 { spawnSync } from 'node:child_process';
7
- import { fileURLToPath } from 'node:url';
8
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
9
- const json = process.argv.includes('--json');
10
- const dryRun = process.argv.includes('--dry-run');
11
- const keep = process.argv.includes('--keep');
12
- const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
13
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-blackbox-global-'));
14
- const prefix = path.join(tmp, 'prefix');
15
- const cache = path.join(tmp, 'npm-cache');
16
- const binDir = process.platform === 'win32' ? prefix : path.join(prefix, 'bin');
17
- const shim = path.join(binDir, process.platform === 'win32' ? 'sks.cmd' : 'sks');
18
- const sneakoscopeShim = path.join(binDir, process.platform === 'win32' ? 'sneakoscope.cmd' : 'sneakoscope');
19
- const steps = [];
20
- function run(label, cmd, args, options = {}) {
21
- const result = dryRun
22
- ? { status: 0, signal: null, stdout: '', stderr: '' }
23
- : spawnSync(cmd, args, {
24
- cwd: options.cwd || root,
25
- encoding: 'utf8',
26
- timeout: options.timeout || 120_000,
27
- env: childNpmEnv(options.env)
28
- });
29
- const row = {
30
- label,
31
- command: [cmd, ...args].join(' '),
32
- cwd: options.cwd || root,
33
- status: result.status,
34
- ok: result.status === 0,
35
- stdout_bytes: Buffer.byteLength(result.stdout || ''),
36
- stderr_bytes: Buffer.byteLength(result.stderr || ''),
37
- stderr_tail: String(result.stderr || '').slice(-800)
38
- };
39
- steps.push(row);
40
- return { ...row, stdout: result.stdout || '', stderr: result.stderr || '' };
41
- }
42
- function childNpmEnv(extra = {}) {
43
- const env = { ...process.env, npm_config_cache: cache, npm_config_prefix: prefix, SKS_SKIP_NPM_FRESHNESS_CHECK: '1', CI: 'true', ...extra };
44
- delete env.npm_config_dry_run;
45
- delete env.NPM_CONFIG_DRY_RUN;
46
- return env;
47
- }
48
- let tarball = dryRun ? path.join(tmp, 'sneakoscope-0.0.0.tgz') : null;
49
- const pack = run('npm_pack', npmBin, ['pack', '--json', '--ignore-scripts', '--pack-destination', tmp, '--registry', 'https://registry.npmjs.org/']);
50
- if (pack.ok && !dryRun) {
51
- const info = JSON.parse(pack.stdout)[0];
52
- tarball = path.join(tmp, info.filename);
53
- }
54
- if (pack.ok)
55
- run('npm_install_global_prefix', npmBin, ['install', '--global', '--prefix', prefix, '--no-audit', '--no-fund', tarball]);
56
- if (steps.at(-1)?.ok)
57
- run('global_shim_version', shim, ['--version'], { cwd: tmp, env: pathEnv() });
58
- if (steps.at(-1)?.ok)
59
- run('global_sneakoscope_version', sneakoscopeShim, ['--version'], { cwd: tmp, env: pathEnv() });
60
- if (steps.at(-1)?.ok)
61
- run('global_sks_root_json', shim, ['root', '--json'], { cwd: tmp, env: pathEnv() });
62
- if (!keep)
63
- fs.rmSync(tmp, { recursive: true, force: true });
64
- const result = { schema: 'sks.blackbox-global-shim.v1', ok: steps.every((step) => step.ok), dry_run: dryRun, temp_root: keep ? tmp : null, steps };
65
- if (json)
66
- console.log(JSON.stringify(result, null, 2));
67
- else {
68
- console.log(`Blackbox global shim: ${result.ok ? 'ok' : 'blocked'}${dryRun ? ' (dry-run)' : ''}`);
69
- for (const step of steps)
70
- console.log(`- ${step.ok ? 'ok' : 'blocked'} ${step.label}`);
71
- }
72
- if (!result.ok)
73
- process.exitCode = 1;
74
- function pathEnv() {
75
- return { PATH: `${binDir}${path.delimiter}${process.env.PATH || ''}` };
76
- }
77
- //# sourceMappingURL=blackbox-global-shim.js.map
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-nocheck
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
- import { spawnSync } from 'node:child_process';
6
- const contract = process.argv.includes('--contract') || process.env.SKS_REAL_BLACKBOX_MATRIX === '0';
7
- const real = !contract;
8
- const root = process.cwd();
9
- const rows = [
10
- row('npm_pack_local_tarball', 'blackbox:pack-install', ['npm_pack']),
11
- row('temp_npm_install', 'blackbox:pack-install', ['npm_install_tarball']),
12
- row('npx_one_shot', 'blackbox:npx', ['npm_exec_one_shot_version', 'npm_exec_one_shot_root']),
13
- row('global_shim_temp_prefix', 'blackbox:global-shim', ['npm_install_global_prefix', 'global_shim_version']),
14
- row('fresh_home', 'blackbox:pack-install', ['npx_sks_root_json']),
15
- row('project_local_install', 'blackbox:pack-install', ['npx_sks_setup_local_only']),
16
- row('packed_run_execute', 'blackbox:pack-install', ['npx_sks_run_execute_mock']),
17
- row('no_git_repo_directory', 'blackbox:pack-install', ['npx_sks_root_json']),
18
- row('read_only_project_directory', 'blackbox:pack-install', ['npx_sks_root_json'], { optional: true }),
19
- row('path_with_spaces', 'blackbox:pack-install', ['npx_sks_root_json']),
20
- row('korean_unicode_path', 'blackbox:pack-install', ['npx_sks_root_json'])
21
- ];
22
- if (real) {
23
- for (const script of ['blackbox:pack-install', 'blackbox:npx', 'blackbox:global-shim']) {
24
- const result = spawnSync('npm', ['run', script, '--', '--json'], { cwd: root, encoding: 'utf8', stdio: 'pipe' });
25
- const parsed = parseJsonFromStdout(result.stdout);
26
- for (const item of rows.filter((entry) => entry.script === script)) {
27
- const labelsOk = item.required_step_labels.length
28
- ? item.required_step_labels.every((label) => parsed?.steps?.some((step) => step.label === label && step.ok))
29
- : result.status === 0;
30
- item.ok = item.optional ? true : (result.status === 0 && labelsOk);
31
- item.status = item.ok ? (item.optional && !labelsOk ? 'verified_partial' : 'verified') : 'blocked';
32
- item.stderr_tail = String(result.stderr || '').slice(-500);
33
- item.duration_ms = parsed?.steps?.filter((step) => item.required_step_labels.includes(step.label)).reduce((sum, step) => sum + Number(step.duration_ms || 0), 0) || null;
34
- }
35
- }
36
- }
37
- const report = {
38
- schema: 'sks.blackbox-matrix.v2',
39
- ok: rows.every((entry) => entry.ok),
40
- mode: real ? 'real' : 'contract',
41
- rows
42
- };
43
- const out = path.join(root, '.sneakoscope', 'reports', 'blackbox-matrix.json');
44
- fs.mkdirSync(path.dirname(out), { recursive: true });
45
- fs.writeFileSync(out, `${JSON.stringify(report, null, 2)}\n`);
46
- console.log(JSON.stringify({ ...report, report_path: out }, null, 2));
47
- if (!report.ok)
48
- process.exitCode = 1;
49
- function row(id, script, requiredStepLabels = [], extra = {}) {
50
- return {
51
- id,
52
- script,
53
- required_step_labels: requiredStepLabels,
54
- ok: !real,
55
- status: real ? 'pending' : 'verified_partial',
56
- command: script,
57
- note: real ? 'runs the selected package blackbox script in real mode' : 'contract quick mode; release gate uses real mode',
58
- ...extra
59
- };
60
- }
61
- function parseJsonFromStdout(stdout = '') {
62
- try {
63
- const start = String(stdout).indexOf('{');
64
- return start >= 0 ? JSON.parse(String(stdout).slice(start)) : null;
65
- }
66
- catch {
67
- return null;
68
- }
69
- }
70
- //# sourceMappingURL=blackbox-matrix.js.map
@@ -1,69 +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 { spawnSync } from 'node:child_process';
7
- import { fileURLToPath } from 'node:url';
8
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
9
- const json = process.argv.includes('--json');
10
- const dryRun = process.argv.includes('--dry-run');
11
- const keep = process.argv.includes('--keep');
12
- const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
13
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-blackbox-npx-'));
14
- const cache = path.join(tmp, 'npm-cache');
15
- const prefix = path.join(tmp, 'prefix');
16
- const steps = [];
17
- function run(label, cmd, args, options = {}) {
18
- const result = dryRun
19
- ? { status: 0, signal: null, stdout: '', stderr: '' }
20
- : spawnSync(cmd, args, {
21
- cwd: options.cwd || root,
22
- encoding: 'utf8',
23
- timeout: options.timeout || 120_000,
24
- env: childNpmEnv(options.env)
25
- });
26
- const row = {
27
- label,
28
- command: [cmd, ...args].join(' '),
29
- cwd: options.cwd || root,
30
- status: result.status,
31
- ok: result.status === 0,
32
- stdout_bytes: Buffer.byteLength(result.stdout || ''),
33
- stderr_bytes: Buffer.byteLength(result.stderr || ''),
34
- stderr_tail: String(result.stderr || '').slice(-800)
35
- };
36
- steps.push(row);
37
- return { ...row, stdout: result.stdout || '', stderr: result.stderr || '' };
38
- }
39
- function childNpmEnv(extra = {}) {
40
- const env = { ...process.env, npm_config_cache: cache, npm_config_prefix: prefix, SKS_SKIP_NPM_FRESHNESS_CHECK: '1', CI: 'true', ...extra };
41
- delete env.npm_config_dry_run;
42
- delete env.NPM_CONFIG_DRY_RUN;
43
- return env;
44
- }
45
- let tarball = dryRun ? path.join(tmp, 'sneakoscope-0.0.0.tgz') : null;
46
- const pack = run('npm_pack', npmBin, ['pack', '--json', '--ignore-scripts', '--pack-destination', tmp, '--registry', 'https://registry.npmjs.org/']);
47
- if (pack.ok && !dryRun) {
48
- const info = JSON.parse(pack.stdout)[0];
49
- tarball = path.join(tmp, info.filename);
50
- }
51
- if (pack.ok)
52
- run('npm_exec_one_shot_version', npmBin, ['exec', '--yes', '--package', tarball, '--', 'sks', '--version'], { cwd: tmp });
53
- if (steps.at(-1)?.ok)
54
- run('npm_exec_one_shot_root', npmBin, ['exec', '--yes', '--package', tarball, '--', 'sks', 'root', '--json'], { cwd: tmp });
55
- if (steps.at(-1)?.ok)
56
- run('npm_exec_one_shot_selftest', npmBin, ['exec', '--yes', '--package', tarball, '--', 'sks', 'selftest', '--mock'], { cwd: tmp, timeout: 180_000 });
57
- if (!keep)
58
- fs.rmSync(tmp, { recursive: true, force: true });
59
- const result = { schema: 'sks.blackbox-npx-one-shot.v1', ok: steps.every((step) => step.ok), dry_run: dryRun, temp_root: keep ? tmp : null, steps };
60
- if (json)
61
- console.log(JSON.stringify(result, null, 2));
62
- else {
63
- console.log(`Blackbox npx one-shot: ${result.ok ? 'ok' : 'blocked'}${dryRun ? ' (dry-run)' : ''}`);
64
- for (const step of steps)
65
- console.log(`- ${step.ok ? 'ok' : 'blocked'} ${step.label}`);
66
- }
67
- if (!result.ok)
68
- process.exitCode = 1;
69
- //# sourceMappingURL=blackbox-npx-one-shot.js.map
@@ -1,174 +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 { spawnSync } from 'node:child_process';
7
- import { fileURLToPath } from 'node:url';
8
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
9
- const json = process.argv.includes('--json');
10
- const dryRun = process.argv.includes('--dry-run');
11
- const keep = process.argv.includes('--keep');
12
- const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
13
- const npxBin = process.platform === 'win32' ? 'npx.cmd' : 'npx';
14
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-blackbox-pack-install-'));
15
- const cache = path.join(tmp, 'npm-cache');
16
- const prefix = path.join(tmp, 'prefix');
17
- const consumer = path.join(tmp, 'consumer');
18
- fs.mkdirSync(consumer, { recursive: true });
19
- fs.writeFileSync(path.join(consumer, 'package.json'), `${JSON.stringify({ name: 'sks-blackbox-consumer', private: true, version: '0.0.0' }, null, 2)}\n`);
20
- const steps = [];
21
- function spawnStep(label, cmd, args, options = {}) {
22
- const result = dryRun
23
- ? { status: 0, signal: null, stdout: '', stderr: '' }
24
- : spawnSync(cmd, args, {
25
- cwd: options.cwd || root,
26
- encoding: 'utf8',
27
- timeout: options.timeout || 120_000,
28
- env: childNpmEnv(options.env)
29
- });
30
- return {
31
- label,
32
- command: [cmd, ...args].join(' '),
33
- cwd: options.cwd || root,
34
- status: result.status,
35
- ok: result.status === 0,
36
- stdout_bytes: Buffer.byteLength(result.stdout || ''),
37
- stderr_bytes: Buffer.byteLength(result.stderr || ''),
38
- stdout_tail: String(result.stdout || '').slice(-800),
39
- stderr_tail: String(result.stderr || '').slice(-800),
40
- stdout: result.stdout || '',
41
- stderr: result.stderr || ''
42
- };
43
- }
44
- function childNpmEnv(extra = {}) {
45
- const env = { ...process.env, npm_config_cache: cache, npm_config_prefix: prefix, SKS_SKIP_NPM_FRESHNESS_CHECK: '1', CI: 'true', ...extra };
46
- delete env.npm_config_dry_run;
47
- delete env.NPM_CONFIG_DRY_RUN;
48
- return env;
49
- }
50
- function run(label, cmd, args, options = {}) {
51
- const row = spawnStep(label, cmd, args, options);
52
- steps.push(recordStep(row));
53
- return row;
54
- }
55
- function runWithRetry(label, cmd, args, options = {}) {
56
- const attempts = Math.max(1, Number(options.attempts || 2));
57
- const attemptRows = [];
58
- for (let index = 0; index < attempts; index += 1) {
59
- if (index > 0)
60
- cleanupInstallAttempt(options.cwd || root);
61
- const row = spawnStep(label, cmd, args, options);
62
- attemptRows.push(row);
63
- if (row.ok || dryRun) {
64
- const final = { ...row, label, attempts: index + 1, retry_count: index, attempts_log: attemptRows.map(compactAttempt) };
65
- steps.push(recordStep(final));
66
- return final;
67
- }
68
- }
69
- const last = attemptRows.at(-1);
70
- const final = { ...last, label, attempts, retry_count: attempts - 1, attempts_log: attemptRows.map(compactAttempt) };
71
- steps.push(recordStep(final));
72
- return final;
73
- }
74
- function recordStep(row) {
75
- const { stdout, stderr, ...recorded } = row;
76
- return recorded;
77
- }
78
- function compactAttempt(row) {
79
- return {
80
- status: row.status,
81
- ok: row.ok,
82
- stdout_bytes: row.stdout_bytes,
83
- stderr_bytes: row.stderr_bytes,
84
- stdout_tail: row.stdout_tail,
85
- stderr_tail: row.stderr_tail
86
- };
87
- }
88
- function cleanupInstallAttempt(cwd) {
89
- if (dryRun)
90
- return;
91
- for (const rel of ['node_modules', 'package-lock.json']) {
92
- fs.rmSync(path.join(cwd, rel), { recursive: true, force: true });
93
- }
94
- }
95
- let tarball = dryRun ? path.join(tmp, 'sneakoscope-0.0.0.tgz') : null;
96
- const pack = run('npm_pack', npmBin, ['pack', '--json', '--ignore-scripts', '--pack-destination', tmp, '--registry', 'https://registry.npmjs.org/']);
97
- if (pack.ok && !dryRun) {
98
- const info = JSON.parse(pack.stdout || '[]')[0];
99
- tarball = path.join(tmp, info.filename);
100
- }
101
- if (pack.ok)
102
- runWithRetry('npm_install_tarball', npmBin, ['install', '--no-audit', '--no-fund', tarball], { cwd: consumer, attempts: 2 });
103
- if (steps.at(-1)?.ok)
104
- run('npx_sks_version', npxBin, ['sks', '--version'], { cwd: consumer });
105
- if (steps.at(-1)?.ok)
106
- run('npx_sks_root_json', npxBin, ['sks', 'root', '--json'], { cwd: consumer });
107
- if (steps.at(-1)?.ok)
108
- run('npx_sks_setup_local_only', npxBin, ['sks', 'setup', '--local-only', '--json'], { cwd: consumer });
109
- if (steps.at(-1)?.ok)
110
- run('npx_sks_selftest_mock', npxBin, ['sks', 'selftest', '--mock'], { cwd: consumer, timeout: 180_000 });
111
- if (steps.at(-1)?.ok)
112
- run('npx_sks_run_execute_mock', npxBin, ['sks', 'run', 'blackbox execute fixture', '--execute', '--mock', '--json'], { cwd: consumer, timeout: 180_000 });
113
- if (steps.at(-1)?.ok)
114
- run('npx_sks_agent_mock', npxBin, ['sks', 'agent', 'run', 'blackbox native agent fixture', '--mock', '--json'], { cwd: consumer, timeout: 180_000 });
115
- let qaMissionId = null;
116
- if (steps.at(-1)?.ok) {
117
- const qaPrepare = run('npx_sks_qa_loop_prepare', npxBin, ['sks', 'qa-loop', 'prepare', 'blackbox API QA', '--json'], { cwd: consumer, timeout: 180_000 });
118
- try {
119
- qaMissionId = JSON.parse(qaPrepare.stdout).mission_id || null;
120
- }
121
- catch { }
122
- }
123
- if (steps.at(-1)?.ok)
124
- run('npx_sks_qa_loop_run_mock', npxBin, ['sks', 'qa-loop', 'run', qaMissionId || 'latest', '--mock', '--json'], { cwd: consumer, timeout: 180_000 });
125
- if (steps.at(-1)?.ok) {
126
- const proofFile = dryRun ? '<dry-run>' : latestCompletionProof(consumer);
127
- steps.push({
128
- label: 'verify_completion_proof_exists',
129
- command: 'fs.existsSync(.sneakoscope/missions/<latest>/completion-proof.json)',
130
- cwd: consumer,
131
- status: proofFile ? 0 : 1,
132
- ok: Boolean(proofFile),
133
- stdout_bytes: 0,
134
- stderr_bytes: 0,
135
- stderr_tail: proofFile || 'completion-proof.json missing'
136
- });
137
- }
138
- const result = { schema: 'sks.blackbox-pack-install.v1', ok: steps.every((step) => step.ok), dry_run: dryRun, temp_root: keep ? tmp : null, steps };
139
- if (!result.ok)
140
- result.temp_root = tmp;
141
- if (!keep && result.ok)
142
- fs.rmSync(tmp, { recursive: true, force: true });
143
- if (json)
144
- console.log(JSON.stringify(result, null, 2));
145
- else {
146
- console.log(`Blackbox pack install: ${result.ok ? 'ok' : 'blocked'}${dryRun ? ' (dry-run)' : ''}`);
147
- for (const step of steps) {
148
- console.log(`- ${step.ok ? 'ok' : 'blocked'} ${step.label}${step.attempts ? ` attempts=${step.attempts}` : ''}`);
149
- if (!step.ok && step.stderr_tail)
150
- console.log(` stderr_tail: ${step.stderr_tail.replace(/\n/g, '\\n')}`);
151
- if (!step.ok && step.stdout_tail)
152
- console.log(` stdout_tail: ${step.stdout_tail.replace(/\n/g, '\\n')}`);
153
- }
154
- if (!result.ok)
155
- console.log(`temp_root: ${tmp}`);
156
- }
157
- if (!result.ok)
158
- process.exitCode = 1;
159
- function latestCompletionProof(rootDir) {
160
- const missions = path.join(rootDir, '.sneakoscope', 'missions');
161
- if (!fs.existsSync(missions))
162
- return null;
163
- const ids = fs.readdirSync(missions, { withFileTypes: true })
164
- .filter((entry) => entry.isDirectory() && entry.name.startsWith('M-'))
165
- .map((entry) => entry.name)
166
- .sort();
167
- for (const id of ids.reverse()) {
168
- const proof = path.join(missions, id, 'completion-proof.json');
169
- if (fs.existsSync(proof))
170
- return proof;
171
- }
172
- return null;
173
- }
174
- //# sourceMappingURL=blackbox-pack-install.js.map