sneakoscope 5.7.0 → 5.9.0

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 (88) hide show
  1. package/README.md +1 -1
  2. package/config/competitor-scorecard-baseline.json +97 -0
  3. package/config/perf-budgets.v1.json +10 -0
  4. package/crates/sks-core/Cargo.lock +1 -1
  5. package/crates/sks-core/Cargo.toml +1 -1
  6. package/crates/sks-core/src/main.rs +1 -1
  7. package/dist/bin/sks.js +61 -1
  8. package/dist/cli/command-registry.js +2 -3
  9. package/dist/cli/commands-fast.js +20 -0
  10. package/dist/cli/root-fast.js +48 -0
  11. package/dist/cli/router.js +3 -0
  12. package/dist/cli/super-search-command.js +221 -0
  13. package/dist/cli/xai-command.js +7 -7
  14. package/dist/commands/doctor.js +56 -24
  15. package/dist/config/skills-manifest.json +63 -70
  16. package/dist/core/agents/agent-codex-cockpit.js +3 -3
  17. package/dist/core/agents/agent-orchestrator.js +20 -2
  18. package/dist/core/agents/agent-wrongness.js +1 -1
  19. package/dist/core/agents/native-cli-session-swarm.js +14 -1
  20. package/dist/core/agents/parallel-runtime-proof.js +82 -8
  21. package/dist/core/agents/parallel-write-fixture.js +301 -0
  22. package/dist/core/commands/gc-command.js +12 -6
  23. package/dist/core/commands/run-command.js +20 -18
  24. package/dist/core/doctor/doctor-idempotence.js +93 -0
  25. package/dist/core/errors/blocker-humanizer.js +13 -0
  26. package/dist/core/errors/next-action-map.js +56 -0
  27. package/dist/core/feature-fixtures.js +15 -8
  28. package/dist/core/fsx.js +1 -1
  29. package/dist/core/init/skills.js +1 -2
  30. package/dist/core/install/installed-package-smoke.js +121 -0
  31. package/dist/core/mission.js +41 -15
  32. package/dist/core/naruto/naruto-active-pool.js +6 -2
  33. package/dist/core/perf/perf-budget.js +145 -0
  34. package/dist/core/quality/competitor-scorecard.js +116 -0
  35. package/dist/core/release/gate-timing.js +103 -0
  36. package/dist/core/release-parallel-full-coverage.js +1 -1
  37. package/dist/core/retention/retention-budget.js +62 -0
  38. package/dist/core/retention.js +1 -1
  39. package/dist/core/routes/constants.js +2 -2
  40. package/dist/core/routes.js +155 -53
  41. package/dist/core/source-intelligence/source-intelligence-policy.js +5 -5
  42. package/dist/core/source-intelligence/source-intelligence-proof.js +8 -8
  43. package/dist/core/source-intelligence/source-intelligence-runner.js +16 -16
  44. package/dist/core/strategy/strategy-gate.js +2 -1
  45. package/dist/core/super-search/doctor.js +63 -0
  46. package/dist/core/super-search/runtime-helpers.js +289 -0
  47. package/dist/core/super-search/runtime.js +270 -0
  48. package/dist/core/super-search/source-records.js +96 -0
  49. package/dist/core/super-search/types.js +3 -0
  50. package/dist/core/trust-kernel/trust-report.js +3 -3
  51. package/dist/core/verification/real-evidence-policy.js +55 -0
  52. package/dist/core/version.js +1 -1
  53. package/dist/scripts/agent-fast-mode-default-check.js +10 -1
  54. package/dist/scripts/agent-visual-consistency-check.js +1 -1
  55. package/dist/scripts/check-architecture.js +0 -1
  56. package/dist/scripts/competitor-scorecard-check.js +25 -0
  57. package/dist/scripts/doctor-idempotence-check.js +8 -0
  58. package/dist/scripts/gate-timing-check.js +8 -0
  59. package/dist/scripts/hook-latency-quantum-check.js +122 -0
  60. package/dist/scripts/installed-package-smoke-check.js +12 -0
  61. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +2 -0
  62. package/dist/scripts/mutation-callsite-coverage-check.js +7 -0
  63. package/dist/scripts/package-published-contract-check.js +7 -0
  64. package/dist/scripts/packlist-performance-check.js +31 -3
  65. package/dist/scripts/parallel-production-smoke-check.js +21 -0
  66. package/dist/scripts/perf-budget-check.js +14 -0
  67. package/dist/scripts/quantum-baseline-report.js +38 -0
  68. package/dist/scripts/release-check-stamp.js +117 -16
  69. package/dist/scripts/release-metadata-1-19-check.js +2 -2
  70. package/dist/scripts/release-parallel-check.js +2 -2
  71. package/dist/scripts/release-parallel-full-coverage-check.js +1 -1
  72. package/dist/scripts/retention-budget-check.js +8 -0
  73. package/dist/scripts/route-intent-regression-check.js +44 -0
  74. package/dist/scripts/sks-1-18-gate-lib.js +2 -2
  75. package/dist/scripts/source-intelligence-all-modes-check.js +2 -2
  76. package/dist/scripts/source-intelligence-policy-check.js +1 -1
  77. package/dist/scripts/super-search-live-smoke-check.js +70 -0
  78. package/dist/scripts/super-search-name-guard-check.js +98 -0
  79. package/dist/scripts/super-search-offline-contract-check.js +45 -0
  80. package/dist/scripts/{ultra-search-provider-interface-check.js → super-search-provider-interface-check.js} +9 -9
  81. package/dist/scripts/trust-fixture-check.js +19 -6
  82. package/package.json +26 -8
  83. package/schemas/agents/parallel-runtime-proof.schema.json +17 -1
  84. package/dist/cli/insane-search-command.js +0 -195
  85. package/dist/core/ultra-search/runtime.js +0 -502
  86. package/dist/core/ultra-search/types.js +0 -3
  87. package/dist/scripts/release-readiness-report.js +0 -1262
  88. /package/dist/core/{ultra-search → super-search}/index.js +0 -0
@@ -0,0 +1,93 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { runProcess, tmpdir, writeJsonAtomic } from '../fsx.js';
4
+ export async function runDoctorIdempotence(root) {
5
+ const tmp = tmpdir('sks-doctor-idempotence-');
6
+ const home = path.join(tmp, 'home');
7
+ const codexHome = path.join(tmp, 'codex');
8
+ await Promise.all([home, codexHome].map((dir) => fs.mkdir(dir, { recursive: true })));
9
+ const first = await runDoctor(root, home, codexHome);
10
+ const second = await runDoctor(root, home, codexHome);
11
+ const rollbackManifestExists = await hasRollbackManifest(home, codexHome, root);
12
+ const changedFilesSecond = extractChangedFiles(second);
13
+ const blockers = [];
14
+ if (first.exit_code !== 0)
15
+ blockers.push(`first_doctor_exit_${first.exit_code}`);
16
+ if (second.exit_code !== 0)
17
+ blockers.push(`second_doctor_exit_${second.exit_code}`);
18
+ if (changedFilesSecond.length > 0)
19
+ blockers.push('second_doctor_not_noop');
20
+ const report = {
21
+ schema: 'sks.doctor-idempotence.v1',
22
+ ok: blockers.length === 0,
23
+ generated_at: new Date().toISOString(),
24
+ temp_dir: tmp,
25
+ first,
26
+ second,
27
+ rollback_manifest_exists: rollbackManifestExists,
28
+ changed_files_second: changedFilesSecond,
29
+ blockers: [...new Set(blockers)]
30
+ };
31
+ await writeJsonAtomic(path.join(root, '.sneakoscope', 'reports', 'doctor-idempotence.json'), report);
32
+ return report;
33
+ }
34
+ async function runDoctor(root, home, codexHome) {
35
+ const started = Date.now();
36
+ const res = await runProcess(process.execPath, ['./dist/bin/sks.js', 'doctor', '--fix', '--yes', '--json'], {
37
+ cwd: root,
38
+ timeoutMs: 180_000,
39
+ maxOutputBytes: 1024 * 1024,
40
+ env: {
41
+ HOME: home,
42
+ CODEX_HOME: codexHome,
43
+ SKS_TEST_ISOLATION: '1',
44
+ SKS_DISABLE_NETWORK: '1',
45
+ SKS_DISABLE_UPDATE_CHECK: '1'
46
+ }
47
+ });
48
+ let parsed = null;
49
+ try {
50
+ parsed = JSON.parse(res.stdout);
51
+ }
52
+ catch { }
53
+ const blockers = Array.isArray(parsed?.blockers) ? parsed.blockers.map(String) : [];
54
+ return {
55
+ exit_code: res.code,
56
+ duration_ms: Date.now() - started,
57
+ stdout_json: parsed != null,
58
+ ok: res.code === 0 && parsed?.ok !== false,
59
+ blockers,
60
+ parsed
61
+ };
62
+ }
63
+ function extractChangedFiles(run) {
64
+ const repair = run.parsed?.repair || {};
65
+ const candidates = [
66
+ repair.doctor_transaction?.changed_files,
67
+ run.parsed?.doctor_fix_transaction?.changed_files,
68
+ run.parsed?.changed_files
69
+ ];
70
+ return [...new Set(candidates.flatMap((value) => Array.isArray(value) ? value.map(String) : []))];
71
+ }
72
+ async function hasRollbackManifest(...roots) {
73
+ for (const dir of roots) {
74
+ const found = await findFileContaining(dir, /rollback|transaction|manifest/i, 4);
75
+ if (found)
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+ async function findFileContaining(dir, pattern, depth) {
81
+ if (depth < 0)
82
+ return false;
83
+ const entries = await fs.readdir(dir, { withFileTypes: true }).catch(() => []);
84
+ for (const entry of entries) {
85
+ const child = path.join(dir, entry.name);
86
+ if (entry.isFile() && pattern.test(entry.name))
87
+ return true;
88
+ if (entry.isDirectory() && await findFileContaining(child, pattern, depth - 1))
89
+ return true;
90
+ }
91
+ return false;
92
+ }
93
+ //# sourceMappingURL=doctor-idempotence.js.map
@@ -0,0 +1,13 @@
1
+ import { diagnosticForBlocker } from './next-action-map.js';
2
+ export function humanizeBlockers(blockers = [], evidencePaths = []) {
3
+ const uniqueBlockers = [...new Set(blockers.filter(Boolean))];
4
+ const diagnostics = uniqueBlockers.map((blocker) => diagnosticForBlocker(blocker));
5
+ return {
6
+ human_summary: diagnostics.length
7
+ ? diagnostics.map((diagnostic) => diagnostic.human_summary).join(' ')
8
+ : 'No blockers were recorded.',
9
+ next_actions: [...new Set(diagnostics.flatMap((diagnostic) => diagnostic.next_actions))],
10
+ evidence_paths: [...new Set(evidencePaths.filter(Boolean))]
11
+ };
12
+ }
13
+ //# sourceMappingURL=blocker-humanizer.js.map
@@ -0,0 +1,56 @@
1
+ const NEXT_ACTIONS = {
2
+ source_acquisition_unavailable: {
3
+ human_summary: 'Super-Search has no live source acquisition path available for this request.',
4
+ next_actions: ['sks super-search doctor --json']
5
+ },
6
+ parallel_runtime_events_missing: {
7
+ human_summary: 'Parallel worker runtime events were not recorded.',
8
+ next_actions: ['sks naruto proof latest --json']
9
+ },
10
+ worker_timestamp_overlap_missing: {
11
+ human_summary: 'There is no evidence that workers actually overlapped in time.',
12
+ next_actions: ['cat .sneakoscope/missions/latest/parallel-runtime-proof.json']
13
+ },
14
+ production_proof_mock_only: {
15
+ human_summary: 'A production gate received mock-only proof.',
16
+ next_actions: ['Inspect whether a mock backend path is connected to production proof.']
17
+ },
18
+ direct_url_fetch_adapter_unavailable: {
19
+ human_summary: 'Direct URL fetch is unavailable in this Node runtime.',
20
+ next_actions: ['node -e "console.log(typeof fetch)"']
21
+ },
22
+ direct_url_fetch_failed: {
23
+ human_summary: 'Direct URL fetch failed before verified content could be captured.',
24
+ next_actions: ['sks super-search doctor --json']
25
+ },
26
+ direct_url_fetch_timeout: {
27
+ human_summary: 'Direct URL fetch timed out before verified content could be captured.',
28
+ next_actions: ['Retry the fetch or inspect local network access.']
29
+ },
30
+ direct_url_fetch_empty_content: {
31
+ human_summary: 'Direct URL fetch returned no readable content.',
32
+ next_actions: ['Open the URL manually and check whether it requires authentication or JavaScript rendering.']
33
+ }
34
+ };
35
+ export function diagnosticForBlocker(blocker) {
36
+ const exact = NEXT_ACTIONS[blocker];
37
+ if (exact)
38
+ return exact;
39
+ if (/^direct_url_fetch_http_\d+$/.test(blocker)) {
40
+ return {
41
+ human_summary: `Direct URL fetch returned HTTP ${blocker.replace('direct_url_fetch_http_', '')}.`,
42
+ next_actions: ['Open the URL manually and verify whether it is public and reachable.']
43
+ };
44
+ }
45
+ if (blocker.startsWith('super_search_mission_artifact_missing:')) {
46
+ return {
47
+ human_summary: 'A required Super-Search evidence artifact is missing.',
48
+ next_actions: [`cat ${blocker.slice('super_search_mission_artifact_missing:'.length)}`]
49
+ };
50
+ }
51
+ return {
52
+ human_summary: `Gate blocked on machine reason: ${blocker}.`,
53
+ next_actions: ['Inspect the gate JSON and referenced evidence paths.']
54
+ };
55
+ }
56
+ //# sourceMappingURL=next-action-map.js.map
@@ -12,7 +12,9 @@ const FIXTURES = Object.freeze({
12
12
  'cli-help': fixture('execute', 'sks help', [], 'pass'),
13
13
  'cli-version': fixture('execute', 'sks --version', [], 'pass'),
14
14
  'cli-root': fixture('execute', 'sks root --json', [], 'pass'),
15
- 'cli-doctor': fixture('real_optional', 'sks doctor --json', [], 'pass'),
15
+ 'cli-doctor': fixture('execute', 'sks doctor --json', [], 'pass', {
16
+ reason: 'doctor without --fix is a read-only runtime readiness command, so the release fixture can execute it directly instead of counting it as optional integration evidence.'
17
+ }),
16
18
  'doctor:imagegen-repair': fixture('execute_and_validate_artifacts', 'sks doctor --json', [{ path: '.sneakoscope/reports/feature-fixtures/doctor-imagegen-repair.json', schema: 'sks.doctor-imagegen-repair.v1', optional: true }], 'pass', {
17
19
  quality: 'runtime_verified',
18
20
  validates_json_fields: ['imagegen_repair', 'repair.imagegen']
@@ -90,7 +92,7 @@ const FIXTURES = Object.freeze({
90
92
  'cli-codex-native': fixture('execute', 'sks codex-native status --json', [], 'pass'),
91
93
  'cli-zellij': fixture('execute', 'npm run zellij:capability --silent', [], 'pass'),
92
94
  'cli-tmux': fixture('not_available', null, [], 'not_required', {
93
- quality: 'missing',
95
+ quality: 'static_contract',
94
96
  reason: 'tmux runtime was removed from SKS (see tmuxCommand in basic-cli.ts and `sks tmux` deprecation notice); the prior fixture command string was not a real invocable command ("removed runtime migration notice: sks tmux --json"), so it is reclassified as not_available instead of being mislabeled mock.',
95
97
  root_mode: 'source_checkout_required'
96
98
  }),
@@ -104,8 +106,7 @@ const FIXTURES = Object.freeze({
104
106
  reason: 'Same underlying simpleGitCommitCommand() as cli-commit plus a real `git push`; genuinely destructive (commits and pushes to the remote) with no real --dry-run support. Left as documented mock rather than execute a real commit+push or invent an unsupported --dry-run mode.'
105
107
  }),
106
108
  'cli-context7': fixture('real_optional', 'sks context7 check --json', [], 'pass'),
107
- 'cli-insane-search': fixture('execute', 'sks insane-search doctor --json', [], 'pass'),
108
- 'cli-ultra-search': fixture('execute', 'sks ultra-search doctor --json', [], 'pass'),
109
+ 'cli-super-search': fixture('execute', 'sks super-search doctor --json', [], 'pass'),
109
110
  'cli-xai': fixture('real_optional', 'sks xai check --json', [], 'pass'),
110
111
  'cli-task': fixture('execute', 'sks task instant --plan --json', [], 'pass'),
111
112
  'cli-release': fixture('execute', 'sks release affected --json', [], 'blocked', { reason: '18차: the phantom requiredSections schema mismatch (five_lane_review/integration_evidence/session_cleanup, from commit d4526f84 with no producer ever wired up) has been fixed -- missing_sections is now honestly empty. The release-gate DAG still legitimately fails/blocks on other real gates (e.g. release:readiness) independent of this fix, so the command still exits non-zero and this fixture stays honestly blocked rather than claiming full green.' }),
@@ -142,9 +143,11 @@ const FIXTURES = Object.freeze({
142
143
  'route-plan': fixture('execute', 'sks plan "fixture" --json', [], 'pass'),
143
144
  'route-review': fixture('execute', 'sks review --diff HEAD --json', [], 'pass'),
144
145
  'route-shadowclone': fixture('static', '$ShadowClone alias of $Naruto shadow-clone swarm route', [], 'pass', {
146
+ quality: 'wiring_only',
145
147
  reason: 'Pure alias of $Naruto; no independent behavior to verify beyond route-naruto\'s own execute_and_validate_artifacts fixture.'
146
148
  }),
147
149
  'route-kagebunshin': fixture('static', '$Kagebunshin alias of $Naruto shadow-clone swarm route', [], 'pass', {
150
+ quality: 'wiring_only',
148
151
  reason: 'Pure alias of $Naruto; no independent behavior to verify beyond route-naruto\'s own execute_and_validate_artifacts fixture.'
149
152
  }),
150
153
  'route-qa-loop': fixture('execute_and_validate_artifacts', 'sks qa-loop run latest --mock --json', ['completion-proof.json', 'qa-gate.json'], 'blocked', { timeout_ms: 180000, reason: 'qaLoopRun() resolves "latest" via the same globally-unscoped findLatestMission used everywhere else and qa-loop is a two-step prepare-then-run workflow gated between steps by an active-route-not-closed check a single fixture command cannot express.' }),
@@ -157,15 +160,13 @@ const FIXTURES = Object.freeze({
157
160
  }),
158
161
  'route-dfix': fixture('execute_and_validate_artifacts', 'sks dfix fixture --json', ['completion-proof.json', 'dfix-gate.json', 'dfix-verification.json'], 'pass'),
159
162
  'route-answer': fixture('static', '$Answer answer-only route policy', [], 'pass', {
163
+ quality: 'wiring_only',
160
164
  reason: 'Policy-only route (answer-only conversational mode with no writes); nothing executable to run beyond static contract text.'
161
165
  }),
162
166
  'route-goal': fixture('mock', '$Goal bridge route', ['goal-workflow.json', 'completion-proof.json'], 'pass', {
163
167
  reason: 'sks goal create "<prompt>" --json never calls maybeFinalizeRoute, so it does not write completion-proof.json even on success; live-testing it also surfaced a real defect (loop-worker-runtime.ts omitted an explicit `agents` value, so buildAgentRoster() fell back to DEFAULT_AGENT_COUNT=5 while maxAgentCount was capped to the loop\'s smaller worker budget, throwing "Agent count 5 exceeds max N" for any ordinary fixture prompt) which has been fixed in this change, but goal-workflow.json/completion-proof.json parity still requires either wiring maybeFinalizeRoute into goalCreate or relaxing this fixture\'s expected_artifacts, both out of scope here; left as documented mock.'
164
168
  }),
165
- 'route-insane-search': fixture('execute', 'sks run "$Insane-Search source intelligence fixture" --execute --json', [], 'pass'),
166
- 'route-insanesearch': fixture('execute', 'sks run "$InsaneSearch source intelligence fixture" --execute --json', [], 'pass'),
167
- 'route-ultra-search': fixture('execute', 'sks run "$Ultra-Search source intelligence fixture" --execute --json', [], 'pass'),
168
- 'route-ultrasearch': fixture('execute', 'sks run "$UltraSearch source intelligence fixture" --execute --json', [], 'pass'),
169
+ 'route-super-search': fixture('execute', 'sks run "$Super-Search doctor" --execute --json', [], 'pass'),
169
170
  'route-seo-geo-optimizer': fixture('execute_and_validate_artifacts', 'sks seo-geo-optimizer fixture --mode geo --json', ['search-visibility/site-inventory.json', 'search-visibility/geo-findings.json', 'search-visibility/verification-report.json', 'geo-gate.json', 'completion-proof.json'], 'pass'),
170
171
  'route-autoresearch': fixture('mock', '$AutoResearch fixture route', ['research-gate.json', 'completion-proof.json'], 'pass', {
171
172
  reason: 'Producing research-gate.json + completion-proof.json requires the two-step `research prepare` then `research run latest --mock --autoresearch --json` sequence (same as route-research\'s safe-args setup step), which a single spawned command cannot express; the $AutoResearch pipeline-dispatch route (`sks run "$AutoResearch ..."`) instead writes autoresearch-gate.json, a different contract. Left as documented mock pending multi-step fixture setup support.'
@@ -184,23 +185,29 @@ const FIXTURES = Object.freeze({
184
185
  'route-wiki': fixture('execute_and_validate_artifacts', 'sks wiki image-ingest test/fixtures/images/one-by-one.png --json', [{ path: 'completion-proof.json', schema: 'sks.completion-proof.v1' }, { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }], 'pass'),
185
186
  'route-gx': fixture('execute_and_validate_artifacts', 'sks gx validate fixture --mock --json', ['completion-proof.json', { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }, 'gx-validation.json'], 'blocked', { reason: 'gxValidateFixture() intentionally exits non-zero (execution_class: mock_fixture) for an honest mock/blocked result; it does write all three declared artifacts.' }),
186
187
  'route-sks': fixture('static', '$SKS control-surface route', ['completion-proof.json'], 'pass', {
188
+ quality: 'wiring_only',
187
189
  reason: 'Pure control-surface alias route with no independent behavior beyond the underlying CLI command fixtures it dispatches to.'
188
190
  }),
189
191
  'route-fast-mode': fixture('execute', 'sks fast-mode status --json', [], 'pass'),
190
192
  'route-fast-on': fixture('static', '$Fast-On covered by hermetic fast-mode blackbox toggle test', [], 'pass', {
193
+ quality: 'wiring_only',
191
194
  reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic fast-mode blackbox toggle test suite, not a standalone CLI invocation.'
192
195
  }),
193
196
  'route-fast-off': fixture('static', '$Fast-Off covered by hermetic fast-mode blackbox toggle test', [], 'pass', {
197
+ quality: 'wiring_only',
194
198
  reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic fast-mode blackbox toggle test suite, not a standalone CLI invocation.'
195
199
  }),
196
200
  'route-local-model': fixture('execute', 'sks with-local-llm status --json', [], 'pass'),
197
201
  'route-with-local-llm-on': fixture('static', '$with-local-llm-on covered by hermetic local-model dollar-command blackbox toggle test', [], 'pass', {
202
+ quality: 'wiring_only',
198
203
  reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic local-model dollar-command blackbox toggle test suite, not a standalone CLI invocation.'
199
204
  }),
200
205
  'route-with-local-llm-off': fixture('static', '$with-local-llm-off covered by hermetic local-model dollar-command blackbox toggle test', [], 'pass', {
206
+ quality: 'wiring_only',
201
207
  reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic local-model dollar-command blackbox toggle test suite, not a standalone CLI invocation.'
202
208
  }),
203
209
  'route-help': fixture('static', '$Help lightweight route', [], 'pass', {
210
+ quality: 'wiring_only',
204
211
  reason: 'Pure alias of the cli-help command; no independent behavior to verify beyond cli-help\'s own execute fixture.'
205
212
  }),
206
213
  'route-commit': fixture('mock', '$Commit git route', ['completion-proof.json'], 'pass', {
package/dist/core/fsx.js CHANGED
@@ -5,7 +5,7 @@ import os from 'node:os';
5
5
  import crypto from 'node:crypto';
6
6
  import { spawn } from 'node:child_process';
7
7
  import { fileURLToPath } from 'node:url';
8
- export const PACKAGE_VERSION = '5.7.0';
8
+ export const PACKAGE_VERSION = '5.9.0';
9
9
  export const DEFAULT_PROCESS_TAIL_BYTES = 256 * 1024;
10
10
  export const DEFAULT_PROCESS_TIMEOUT_MS = 30 * 60 * 1000;
11
11
  export function nowIso() {
@@ -66,8 +66,7 @@ async function installOfficialSkills(root) {
66
66
  'reasoning-router': `---\nname: reasoning-router\ndescription: Temporary SKS reasoning-effort routing for every command and pipeline route.\n---\n\nmedium: simple copy/color/discovery/setup/mechanical edits. high: logic, safety, architecture, DB, orchestration, refactor, multi-file work. xhigh: research, AutoResearch, falsification, benchmarks, SEO/GEO, open-ended discovery, and From-Chat-IMG image work-order analysis. Routing is temporary; return to default after the gate. Inspect with sks reasoning and sks pipeline status.\n`,
67
67
  'pipeline-runner': `---\nname: pipeline-runner\ndescription: Execute SKS dollar-command routes as stateful pipelines with mission artifacts, route gates, Context7 evidence, temporary reasoning routing, reflection, and Honest Mode.\n---\n\nEvery $ command is a route. Use current.json, mission artifacts, and pipeline-plan.json as the execution plan: it records the lane, skipped stages, kept stages, verification, lean_decision, and no-unrequested-fallback invariant. Use temporary reasoning, TriWiki before stages, source hydration, Context7 when required, Team cleanup before reflection, reflection for full routes, and completion summary plus Honest Mode before final. Surface guard/scopes, record evidence, refresh/pack/validate TriWiki, and check sks pipeline status/resume/plan. ${leanEngineeringCompactText()} ${speedLanePolicyText()} ${skillDreamPolicyText()}\n`,
68
68
  'context7-docs': `---\nname: context7-docs\ndescription: Enforce Context7 MCP documentation evidence for SKS routes that depend on external libraries, frameworks, APIs, MCPs, package managers, DB SDKs, or generated docs.\n---\n\nWhen required, resolve-library-id, then query-docs for the resolved id. Legacy get-library-docs evidence is accepted. Prefer sks context7 tools/resolve/docs/evidence and finish only after both evidence stages exist. Check setup with sks context7 check.\n`,
69
- 'insane-search': `---\nname: insane-search\ndescription: Dollar-command route for $Insane-Search/$InsaneSearch provider-independent source intelligence.\n---\n\nUse when the user invokes $Insane-Search, $InsaneSearch, legacy $Ultra-Search/$UltraSearch, or asks for InsaneSearch source intelligence, source acquisition, X-search-style collection, URL acquisition, source normalization, claim ledgers, or citation proof. Prefer \`sks insane-search doctor --json\` for readiness and \`sks insane-search run "<query>" --mode balanced --json\` for provider-independent source proof; use \`sks insane-search x "<query>" --json\` for X-search intent and \`sks insane-search fetch "<url>" --json\` for URL acquisition. Context7 is required only when the query depends on current package/API/framework/MCP/generated documentation behavior. xAI/Grok credentials are optional and must not be required for route readiness. Evidence/artifacts remain under \`.sneakoscope/missions/<ultra-* or route mission>/ultra-search/\`: intent.json, axes.json, query-variants.json, provider-plan.json, source-ledger.json, lead-ledger.json, claim-ledger.json, synthesis.md, ultra-search-proof.json, ultra-search-gate.json, and ultra-search-result.json. Do not turn weak discovery into supported claims; finish with an Honest Mode summary of verified sources, blockers, and unverified external coverage.\n`,
70
- 'ultra-search': `---\nname: ultra-search\ndescription: Compatibility alias for $Insane-Search/$InsaneSearch provider-independent source intelligence.\n---\n\nUse when the user invokes legacy $Ultra-Search/$UltraSearch or asks for InsaneSearch source intelligence, source acquisition, X-search-style collection, URL acquisition, source normalization, claim ledgers, or citation proof. Prefer \`sks ultra-search doctor --json\` for readiness and \`sks ultra-search run "<query>" --mode balanced --json\` for provider-independent source proof; use \`sks ultra-search x "<query>" --json\` for X-search intent and \`sks ultra-search fetch "<url>" --json\` for URL acquisition. Context7 is required only when the query depends on current package/API/framework/MCP/generated documentation behavior. xAI/Grok credentials are optional and must not be required for route readiness. Evidence/artifacts live under \`.sneakoscope/missions/<ultra-* or route mission>/ultra-search/\`: intent.json, axes.json, query-variants.json, provider-plan.json, source-ledger.json, lead-ledger.json, claim-ledger.json, synthesis.md, ultra-search-proof.json, ultra-search-gate.json, and ultra-search-result.json. Do not turn weak discovery into supported claims; finish with an Honest Mode summary of verified sources, blockers, and unverified external coverage.\n`,
69
+ 'super-search': `---\nname: super-search\ndescription: Dollar-command route for $Super-Search provider-independent source intelligence.\n---\n\nUse when the user invokes $Super-Search or asks for Super-Search source intelligence, source acquisition, X-search-style collection, URL acquisition, source normalization, claim ledgers, or citation proof. Prefer \`sks super-search doctor --json\` for readiness and \`sks super-search run "<query>" --mode balanced --json\` for provider-independent source proof; use \`sks super-search x "<query>" --json\` for X-search intent and \`sks super-search fetch "<url>" --json\` for URL acquisition. Context7 is required only when the query depends on current package/API/framework/MCP/generated documentation behavior. xAI/Grok credentials are optional and must not be required for route readiness. Evidence/artifacts remain under \`.sneakoscope/missions/<super-search-* or route mission>/super-search/\`: intent.json, axes.json, query-variants.json, provider-plan.json, source-ledger.json, lead-ledger.json, claim-ledger.json, attempt-ledger.json, synthesis.md, super-search-proof.json, super-search-gate.json, and super-search-result.json. Do not turn weak discovery into supported claims; finish with an Honest Mode summary of verified sources, blockers, and unverified external coverage.\n`,
71
70
  'search-visibility-core': `---\nname: search-visibility-core\ndescription: Shared kernel for seo-geo-optimizer audit, plan, explicit apply, rollback, verification, gates, and Completion Proof.\n---\n\nPurpose: keep Search Engine Optimization and Generative Engine Optimization on one typed search-visibility kernel instead of duplicate implementations. Use when $SEO-GEO-OPTIMIZER or \`sks seo-geo-optimizer\` is selected. Workflow: doctor detects package/static/Next evidence; audit writes source-backed inventory and findings; plan compiles safe mutation operations; apply requires explicit \`--apply\`; verify separates source, build, HTTP, browser, production, and measured outcome; rollback only reverses mission-owned operations. Safety: default read-only, never overwrite unmanaged robots.txt, sitemap, llms.txt, metadata, or structured data; do not hard-code customer routes; do not invent prices, reviews, availability, rankings, traffic, or AI citation outcomes. Evidence/artifacts: search-visibility/intake.json, adapter-detection.json, site-inventory.json, route-graph.json, robots-policy.json, structured-data-ledger.json, mutation-plan.json, mutation-journal.jsonl, rollback-manifest.json, verification-report.json, route gate, and completion-proof.json. Failure/recovery: unsupported frameworks stay audit/plan-only; missing production/browser/Search Console evidence remains unverified, not fabricated. CLI entrypoint: \`sks seo-geo-optimizer ... --mode seo|geo\`.\n`,
72
71
  'seo-geo-optimizer': `---\nname: seo-geo-optimizer\ndescription: Unified $SEO-GEO-OPTIMIZER route for Search Engine Optimization and Generative Engine Optimization.\n---\n\nPurpose: use one route name for SEO and GEO work while keeping the internal search-visibility mode explicit. Use when: the user asks for SEO audit/fix/verification, package/npm/GitHub search visibility, canonical, sitemap, robots.txt, hreflang, metadata, structured data, AI answer visibility, LLM citation readiness, answerability, entity/claim provenance, crawler policy, OAI-SearchBot/GPTBot/ChatGPT-User, Claude-SearchBot/ClaudeBot/Claude-User, or optional llms.txt planning. GEO means Generative Engine Optimization, not geolocation, GeoIP, maps, CDN geography, location permission, or regional redirect bugs. Workflow: run \`sks seo-geo-optimizer doctor --mode seo|geo\`, then audit, plan, explicit apply, verify, status, and rollback. Use \`--mode seo\` for technical/package search optimization and \`--mode geo\` for entity facts, claim evidence, answerability, crawler policy, and optional llms.txt. Safety: audit and plan must not mutate source; apply checks base hashes, ownership, scope, protected paths, rollback manifest, and post-verify. AI crawler policy must split search, training, user-directed retrieval, and ads/other; never use one allow_ai toggle and never auto-allow training crawlers. Evidence/artifacts: site-inventory.json, route-graph.json, seo-findings.json or geo-findings.json, entity-facts.json, claim-evidence-ledger.json, answerability-report.json, ai-crawler-policy.json, llms-txt-plan.json, mutation-plan.json, verification-report.json, seo-gate.json or geo-gate.json, completion-proof.json. Failure/recovery: unsupported frameworks stay plan-only; browser/production/Search Console/analytics outcomes are marked unverified when not actually run. Forbidden claims: no ranking, indexing, traffic lift, rich-result, answer inclusion, or AI citation guarantee; no keyword stuffing, doorway pages, fake reviews, fake prices, fake availability, fake shipping, fake awards, hidden AI-only text, or scaled spam. CLI entrypoint: \`sks seo-geo-optimizer doctor|audit|plan|apply|verify|status|rollback|fixture --mode seo|geo\`.\n`,
73
72
  'reflection': `---\nname: reflection\ndescription: Post-route self-review for full SKS routes that records real misses, gaps, and corrective lessons into TriWiki memory.\n---\n\nUse after full route work/tests and before final. DFix, Answer, Help, Wiki, SKS discovery are exempt. Do not invent faults. Write reflection.md; append real lessons to ${REFLECTION_MEMORY_PATH}; refresh/pack, validate context-pack.json, pass reflection-gate.json.\n\n${reflectionInstructionText()}\n`,
@@ -0,0 +1,121 @@
1
+ import fs from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { runProcess, writeJsonAtomic } from '../fsx.js';
5
+ export async function runInstalledPackageSmoke(root) {
6
+ const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-installed-smoke-'));
7
+ const home = path.join(tmp, 'home');
8
+ const codexHome = path.join(tmp, 'codex-home');
9
+ const npmCache = path.join(tmp, 'npm-cache');
10
+ await Promise.all([home, codexHome, npmCache].map((dir) => fs.mkdir(dir, { recursive: true })));
11
+ const blockers = [];
12
+ const commands = [];
13
+ let tarball = null;
14
+ let installedVersion = null;
15
+ let packedVersion = null;
16
+ const pack = await runJsonCommand(root, ['npm', 'pack', '--json', '--ignore-scripts'], { npmCache });
17
+ commands.push(pack.command);
18
+ if (pack.exit_code !== 0)
19
+ blockers.push('npm_pack_failed');
20
+ const packInfo = packJsonObject(pack.json);
21
+ if (packInfo?.filename)
22
+ tarball = path.join(root, String(packInfo.filename));
23
+ if (packInfo?.version)
24
+ packedVersion = String(packInfo.version);
25
+ if (!tarball)
26
+ blockers.push('npm_pack_tarball_missing');
27
+ await fs.writeFile(path.join(tmp, 'package.json'), JSON.stringify({ private: true, type: 'module' }, null, 2));
28
+ if (tarball) {
29
+ const install = await runJsonCommand(tmp, ['npm', 'install', tarball, '--ignore-scripts'], { home, codexHome, npmCache });
30
+ commands.push(install.command);
31
+ if (install.exit_code !== 0)
32
+ blockers.push('npm_install_tarball_failed');
33
+ }
34
+ const bin = path.join(tmp, 'node_modules', '.bin', 'sks');
35
+ const smokeCommands = [
36
+ [bin, '--version'],
37
+ [bin, 'commands', '--json'],
38
+ [bin, 'bootstrap', '--json'],
39
+ [bin, 'doctor', '--json'],
40
+ [bin, 'super-search', 'doctor', '--json'],
41
+ [bin, 'selftest', '--mock']
42
+ ];
43
+ for (const argv of smokeCommands) {
44
+ const result = await runJsonCommand(tmp, argv, { home, codexHome, npmCache });
45
+ commands.push(result.command);
46
+ if (result.exit_code !== 0)
47
+ blockers.push(`installed_command_failed:${argv.slice(1).join('_') || 'version'}`);
48
+ if (argv.includes('--version')) {
49
+ const match = String(result.stdout || '').match(/([0-9]+\.[0-9]+\.[0-9]+)/);
50
+ if (match)
51
+ installedVersion = match[1] || null;
52
+ }
53
+ }
54
+ const forbiddenFindings = [];
55
+ if (process.env.HOME && home === process.env.HOME)
56
+ forbiddenFindings.push('host_home_reused');
57
+ if (process.env.CODEX_HOME && codexHome === process.env.CODEX_HOME)
58
+ forbiddenFindings.push('host_codex_home_reused');
59
+ if (packedVersion && installedVersion && packedVersion !== installedVersion)
60
+ blockers.push(`installed_version_mismatch:${installedVersion}:expected_${packedVersion}`);
61
+ blockers.push(...forbiddenFindings.map((item) => `forbidden:${item}`));
62
+ const report = {
63
+ schema: 'sks.installed-package-smoke.v1',
64
+ ok: blockers.length === 0,
65
+ generated_at: new Date().toISOString(),
66
+ tarball,
67
+ installed_version: installedVersion,
68
+ temp_dir: tmp,
69
+ commands,
70
+ forbidden_findings: forbiddenFindings,
71
+ blockers: [...new Set(blockers)]
72
+ };
73
+ await writeJsonAtomic(path.join(root, '.sneakoscope', 'reports', 'installed-package-smoke.json'), report);
74
+ return report;
75
+ }
76
+ async function runJsonCommand(cwd, argv, opts) {
77
+ const started = Date.now();
78
+ const [command, ...args] = argv;
79
+ const env = {
80
+ SKS_TEST_ISOLATION: '1',
81
+ SKS_DISABLE_NETWORK: '1',
82
+ SKS_DISABLE_UPDATE_CHECK: '1'
83
+ };
84
+ if (opts.home !== undefined)
85
+ env.HOME = opts.home;
86
+ if (opts.codexHome !== undefined)
87
+ env.CODEX_HOME = opts.codexHome;
88
+ if (opts.npmCache !== undefined) {
89
+ env.npm_config_cache = opts.npmCache;
90
+ env.NPM_CONFIG_CACHE = opts.npmCache;
91
+ }
92
+ const res = await runProcess(command || 'node', args, {
93
+ cwd,
94
+ timeoutMs: 120_000,
95
+ maxOutputBytes: 1024 * 1024,
96
+ env
97
+ });
98
+ let parsed = null;
99
+ try {
100
+ parsed = JSON.parse(res.stdout);
101
+ }
102
+ catch { }
103
+ return {
104
+ exit_code: res.code,
105
+ stdout: res.stdout,
106
+ json: parsed,
107
+ command: {
108
+ argv,
109
+ exit_code: res.code,
110
+ stdout_json: parsed != null,
111
+ duration_ms: Date.now() - started,
112
+ stdout_tail: res.stdout.slice(-1200),
113
+ stderr_tail: res.stderr.slice(-1200)
114
+ }
115
+ };
116
+ }
117
+ function packJsonObject(value) {
118
+ const row = Array.isArray(value) ? value[0] : value;
119
+ return row && typeof row === 'object' ? row : null;
120
+ }
121
+ //# sourceMappingURL=installed-package-smoke.js.map
@@ -116,21 +116,7 @@ export async function closeRouteState(root, input = {}) {
116
116
  if (input.missionId && current.mission_id && String(current.mission_id) !== String(input.missionId)) {
117
117
  return { ok: false, status: 'mission_mismatch', mission_id: missionId, current_mission_id: current.mission_id };
118
118
  }
119
- const next = {
120
- ...current,
121
- mission_id: missionId || current.mission_id || null,
122
- route_closed: true,
123
- route_closed_at: nowIso(),
124
- route_close_reason: input.reason || 'route_close_command',
125
- implementation_allowed: false,
126
- questions_allowed: true,
127
- mad_sks_active: false,
128
- permission_gate_active: false,
129
- gate_owner_mission_id: null,
130
- phase: current.phase ? `${current.phase}_CLOSED` : 'ROUTE_CLOSED',
131
- updated_at: nowIso(),
132
- ...(sessionKey ? { _session_key: sessionKey } : {})
133
- };
119
+ const next = closedRouteState(current, missionId, input.reason, sessionKey);
134
120
  if (sessionKey) {
135
121
  await ensureDir(stateSessionsDir(root));
136
122
  await writeJsonAtomic(targetFile, next);
@@ -138,6 +124,9 @@ export async function closeRouteState(root, input = {}) {
138
124
  }
139
125
  else {
140
126
  await writeJsonAtomic(stateFile(root), next);
127
+ for (const row of await matchingSessionStates(root, missionId, current._session_key)) {
128
+ await writeJsonAtomic(row.path, closedRouteState(row.state, missionId, input.reason, row.session_key));
129
+ }
141
130
  }
142
131
  if (missionId) {
143
132
  await appendJsonl(path.join(missionDir(root, missionId), 'events.jsonl'), {
@@ -150,6 +139,43 @@ export async function closeRouteState(root, input = {}) {
150
139
  return { ok: true, status: 'closed', mission_id: missionId || null, state_file: targetFile };
151
140
  });
152
141
  }
142
+ function closedRouteState(current, missionId, reason, sessionKey) {
143
+ const phase = String(current.phase || '');
144
+ return {
145
+ ...current,
146
+ mission_id: missionId || current.mission_id || null,
147
+ route_closed: true,
148
+ route_closed_at: nowIso(),
149
+ route_close_reason: reason || 'route_close_command',
150
+ implementation_allowed: false,
151
+ questions_allowed: true,
152
+ mad_sks_active: false,
153
+ permission_gate_active: false,
154
+ gate_owner_mission_id: null,
155
+ phase: phase ? (/_CLOSED$/i.test(phase) ? phase : `${phase}_CLOSED`) : 'ROUTE_CLOSED',
156
+ updated_at: nowIso(),
157
+ ...(sessionKey ? { _session_key: sessionKey } : {})
158
+ };
159
+ }
160
+ async function matchingSessionStates(root, missionId, preferredSessionKey) {
161
+ const dir = stateSessionsDir(root);
162
+ const rows = [];
163
+ if (!(await exists(dir)))
164
+ return rows;
165
+ const fs = await import('node:fs/promises');
166
+ const entries = await fs.readdir(dir, { withFileTypes: true }).catch(() => []);
167
+ for (const entry of entries) {
168
+ if (!entry.isFile() || !entry.name.endsWith('.json'))
169
+ continue;
170
+ const file = path.join(dir, entry.name);
171
+ const state = await readJson(file, {}).catch(() => ({}));
172
+ const key = String(state._session_key || entry.name.replace(/\.json$/, ''));
173
+ if (String(state.mission_id || '') === missionId || (preferredSessionKey && key === String(preferredSessionKey))) {
174
+ rows.push({ session_key: key, path: file, state });
175
+ }
176
+ }
177
+ return rows;
178
+ }
153
179
  function withStateLock(root, fn) {
154
180
  return withFileLock({ lockPath: stateLockPath(root), timeoutMs: 20_000, staleMs: 120_000 }, fn);
155
181
  }
@@ -51,8 +51,12 @@ export async function runNarutoRealActivePool(input) {
51
51
  maxObserved = Math.max(maxObserved, active.size);
52
52
  timeline.push({ tick, active: active.size, pending: pending.length, completed: completed.size, event: launched ? 'refill' : 'wait' });
53
53
  const done = await nextCollectableWorkers(active, input.hardTimeoutMs);
54
- if (!done.length)
55
- break;
54
+ if (!done.length) {
55
+ tick += 1;
56
+ if (tick > input.graph.work_items.length * 4 + 20)
57
+ break;
58
+ continue;
59
+ }
56
60
  for (const handle of done) {
57
61
  active.delete(handle.id);
58
62
  if (handle.placement.placement === 'zellij-pane')