sneakoscope 4.2.0 → 4.4.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 (59) hide show
  1. package/README.md +9 -8
  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/command-registry.js +2 -1
  7. package/dist/cli/ultra-search-command.js +163 -0
  8. package/dist/cli/xai-command.js +28 -168
  9. package/dist/core/agents/agent-codex-cockpit.js +3 -3
  10. package/dist/core/agents/agent-wrongness.js +1 -1
  11. package/dist/core/codex-control/codex-app-server-v2-client.js +86 -2
  12. package/dist/core/codex-control/codex-reliability-shield.js +26 -5
  13. package/dist/core/codex-control/codex-task-runner.js +7 -1
  14. package/dist/core/codex-control/model-call-concurrency.js +1 -1
  15. package/dist/core/commands/qa-loop-command.js +23 -7
  16. package/dist/core/fsx.js +1 -1
  17. package/dist/core/hooks-runtime.js +1 -1
  18. package/dist/core/qa-loop/qa-app-server-driver.js +134 -0
  19. package/dist/core/qa-loop/qa-contract-v2.js +231 -0
  20. package/dist/core/qa-loop/qa-gate-v2.js +132 -0
  21. package/dist/core/qa-loop/qa-runtime-artifacts.js +53 -0
  22. package/dist/core/qa-loop/qa-surface-router.js +114 -0
  23. package/dist/core/qa-loop/qa-types.js +18 -0
  24. package/dist/core/qa-loop.js +83 -26
  25. package/dist/core/release/gate-manifest.js +1 -0
  26. package/dist/core/release/sla-scheduler.js +1 -1
  27. package/dist/core/release-parallel-full-coverage.js +1 -1
  28. package/dist/core/routes.js +22 -6
  29. package/dist/core/source-intelligence/source-intelligence-policy.js +45 -26
  30. package/dist/core/source-intelligence/source-intelligence-proof.js +10 -16
  31. package/dist/core/source-intelligence/source-intelligence-runner.js +56 -42
  32. package/dist/core/triwiki/triwiki-affected-graph.js +3 -2
  33. package/dist/core/trust-kernel/trust-report.js +3 -5
  34. package/dist/core/ultra-search/index.js +3 -0
  35. package/dist/core/ultra-search/runtime.js +502 -0
  36. package/dist/core/ultra-search/types.js +3 -0
  37. package/dist/core/version.js +1 -1
  38. package/dist/scripts/agent-visual-consistency-check.js +1 -1
  39. package/dist/scripts/codex-control-all-pipelines-check.js +1 -0
  40. package/dist/scripts/codex-control-model-capacity-fallback-check.js +53 -0
  41. package/dist/scripts/config-managed-merge-callsite-coverage-check.js +7 -1
  42. package/dist/scripts/loop-directive-check-lib.js +78 -1
  43. package/dist/scripts/qa-loop-app-server-driver-check.js +74 -0
  44. package/dist/scripts/qa-loop-surface-router-check.js +49 -0
  45. package/dist/scripts/release-check-dynamic-execute.js +1 -1
  46. package/dist/scripts/release-metadata-1-19-check.js +2 -2
  47. package/dist/scripts/release-parallel-check.js +2 -2
  48. package/dist/scripts/release-parallel-full-coverage-check.js +1 -1
  49. package/dist/scripts/release-readiness-report.js +6 -6
  50. package/dist/scripts/runtime-ts-rust-boundary-check.js +1 -1
  51. package/dist/scripts/sks-1-18-gate-lib.js +2 -2
  52. package/dist/scripts/source-intelligence-all-modes-check.js +9 -19
  53. package/dist/scripts/source-intelligence-policy-check.js +6 -6
  54. package/dist/scripts/triwiki-affected-graph-check.js +2 -2
  55. package/dist/scripts/ultra-search-provider-interface-check.js +27 -0
  56. package/package.json +7 -4
  57. package/dist/core/mcp/xai-mcp-detector.js +0 -157
  58. package/dist/core/mcp/xai-search-adapter.js +0 -100
  59. package/dist/scripts/xai-mcp-capability-check.js +0 -14
@@ -1,18 +1,16 @@
1
1
  import path from 'node:path';
2
2
  import { ensureDir, nowIso, sha256, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
3
- import { detectXaiMcp } from '../mcp/xai-mcp-detector.js';
4
- import { runXaiSearch } from '../mcp/xai-search-adapter.js';
5
- import { detectCodexWebSearchCapability, runCodexWebSearch } from '../codex/codex-web-search-adapter.js';
3
+ import { detectCodexWebSearchCapability } from '../codex/codex-web-search-adapter.js';
4
+ import { runUltraSearch } from '../ultra-search/index.js';
6
5
  import { buildSourceIntelligencePolicy, writeSourceIntelligencePolicyArtifact } from './source-intelligence-policy.js';
7
6
  import { buildSourceIntelligenceProof } from './source-intelligence-proof.js';
8
7
  import { buildAppshotsEvidence, writeAppshotsEvidenceArtifact } from './appshots-evidence.js';
9
- export const SOURCE_INTELLIGENCE_EVIDENCE_SCHEMA = 'sks.source-intelligence-evidence.v1';
8
+ export const SOURCE_INTELLIGENCE_EVIDENCE_SCHEMA = 'sks.source-intelligence-evidence.v2';
10
9
  export async function runSourceIntelligence(input) {
11
10
  const root = path.resolve(input.root || process.cwd());
12
11
  const missionDir = path.resolve(input.missionDir);
13
12
  const artifactDir = path.join(missionDir, 'source-intelligence');
14
13
  await ensureDir(artifactDir);
15
- const xaiDetection = input.xaiDetection || await detectXaiMcp({ root });
16
14
  const codexWebCapability = detectCodexWebSearchCapability({
17
15
  ...(input.env ? { env: input.env } : {}),
18
16
  ...(input.offline === undefined ? {} : { offline: input.offline })
@@ -22,28 +20,27 @@ export async function runSourceIntelligence(input) {
22
20
  ...(input.offline === undefined ? {} : { offline: input.offline }),
23
21
  ...(input.context7Available === undefined ? {} : { context7Available: input.context7Available }),
24
22
  codexWebCapability,
25
- xaiDetection
23
+ query: input.query,
24
+ ...(input.xaiDetection === undefined ? {} : { xaiDetection: input.xaiDetection })
25
+ });
26
+ const context7 = await runContext7(input.query, {
27
+ required: policy.context7.required,
28
+ available: policy.context7.available,
29
+ offline: input.offline === true,
30
+ ...(input.context7 ? { context7: input.context7 } : {})
31
+ });
32
+ const ultraMode = sourceModeToUltraMode(policy.mode);
33
+ const ultraSearch = await runUltraSearch({
34
+ root,
35
+ missionDir,
36
+ route: input.route || 'unknown',
37
+ query: input.query,
38
+ mode: ultraMode,
39
+ ...(input.offline === undefined ? {} : { offline: input.offline }),
40
+ ...(input.context7 ? { context7: input.context7 } : {}),
41
+ ...(input.codexWebSearch ? { codexWebSearch: input.codexWebSearch } : {}),
42
+ ...(input.env ? { env: input.env } : {})
26
43
  });
27
- const cacheKey = sha256(JSON.stringify({ route: input.route || 'unknown', query: input.query, mode: policy.mode })).slice(0, 16);
28
- const providerTasks = [
29
- runContext7(input.query, {
30
- available: policy.context7.available,
31
- offline: input.offline === true,
32
- ...(input.context7 ? { context7: input.context7 } : {})
33
- }),
34
- policy.codex_web_search.required ? runCodexWebSearch(input.query, {
35
- ...(input.codexWebSearch ? { search: input.codexWebSearch } : {}),
36
- artifactDir,
37
- ...(input.offline === undefined ? {} : { offline: input.offline }),
38
- ...(input.env ? { env: input.env } : {})
39
- }) : Promise.resolve(null),
40
- policy.xai_mcp.required ? runXaiSearch(input.query, {
41
- ...(input.xaiSearch ? { search: input.xaiSearch } : {}),
42
- artifactDir,
43
- configured: true
44
- }) : Promise.resolve(null)
45
- ];
46
- const [context7, codexWeb, xaiSearch] = await Promise.all(providerTasks);
47
44
  const appshots = buildAppshotsEvidence({
48
45
  root,
49
46
  prompt: input.query,
@@ -54,19 +51,17 @@ export async function runSourceIntelligence(input) {
54
51
  ...(input.appshots?.operatorActionRecorded === undefined ? {} : { operatorActionRecorded: input.appshots.operatorActionRecorded }),
55
52
  ...(input.appshots?.appshotsToolAvailable === undefined ? {} : { appshotsToolAvailable: input.appshots.appshotsToolAvailable })
56
53
  });
57
- const providersRequested = [
58
- 'context7',
59
- ...(policy.codex_web_search.required ? ['codex_web_search'] : []),
60
- ...(policy.xai_mcp.required ? ['xai_search'] : [])
61
- ];
54
+ const providersRequested = policy.selected_providers;
62
55
  const providersCompleted = [
63
- ...(context7.ok ? ['context7'] : []),
64
- ...(codexWeb?.ok ? ['codex_web_search'] : []),
65
- ...(xaiSearch?.ok ? ['xai_search'] : [])
56
+ ...(context7.ok && policy.context7.required ? ['context7'] : []),
57
+ ...(ultraSearch.sources.some((source) => source.provider_id === 'codex_web') ? ['codex_web'] : []),
58
+ ...(ultraSearch.sources.some((source) => source.provider_id === 'x_public') ? ['x_public'] : []),
59
+ 'ultra_search'
66
60
  ];
67
- const proof = buildSourceIntelligenceProof(policy, { context7, codex_web_search: codexWeb, xai_search: xaiSearch, appshots });
68
- const blockers = [...policy.blockers, ...context7.blockers, ...(codexWeb?.blockers || []), ...appshots.blockers, ...(proof.blockers || [])];
69
- const warnings = [...policy.warnings, ...(codexWeb?.warnings || []), ...appshots.warnings, ...(xaiSearch?.blockers || []).filter((blocker) => !blockers.includes(blocker))];
61
+ const proof = buildSourceIntelligenceProof(policy, { context7, ultra_search: ultraSearch, appshots });
62
+ const blockers = [...new Set([...policy.blockers, ...context7.blockers, ...appshots.blockers, ...proof.blockers])];
63
+ const warnings = [...new Set([...policy.warnings, ...ultraSearch.warnings, ...appshots.warnings])];
64
+ const cacheKey = sha256(JSON.stringify({ route: input.route || 'unknown', query: input.query, mode: policy.mode })).slice(0, 16);
70
65
  const evidence = {
71
66
  schema: SOURCE_INTELLIGENCE_EVIDENCE_SCHEMA,
72
67
  generated_at: nowIso(),
@@ -81,12 +76,13 @@ export async function runSourceIntelligence(input) {
81
76
  },
82
77
  cache: {
83
78
  key: cacheKey,
84
- local_only: true
79
+ local_only: true,
80
+ ultra_search_hit: ultraSearch.cache.hit
85
81
  },
86
82
  policy,
87
83
  context7,
88
- codex_web_search: codexWeb,
89
- xai_search: xaiSearch,
84
+ codex_web_search: null,
85
+ ultra_search: ultraSearch,
90
86
  appshots,
91
87
  proof,
92
88
  blockers,
@@ -106,15 +102,33 @@ export function renderSourceIntelligenceEvidenceMarkdown(evidence) {
106
102
  `- Route: ${evidence.route}`,
107
103
  `- Mode: ${evidence.mode}`,
108
104
  `- Context7: ${evidence.context7.status}`,
109
- `- Codex Web Search: ${evidence.codex_web_search?.status || 'not_required'}`,
110
- `- X AI Search: ${evidence.xai_search?.status || 'not_required'}`,
105
+ `- UltraSearch: ${evidence.ultra_search.proof.ok ? 'ok' : 'partial'}`,
106
+ `- Legacy x-search MCP: not_required`,
111
107
  `- Appshots: ${evidence.appshots?.status || 'not_required'}`,
112
108
  `- Providers completed: ${evidence.parallel.providers_completed.join(', ') || 'none'}`,
113
109
  `- Blockers: ${evidence.blockers.length ? evidence.blockers.join(', ') : 'none'}`,
114
110
  ''
115
111
  ].join('\n');
116
112
  }
113
+ function sourceModeToUltraMode(mode) {
114
+ if (mode === 'ultra_fast')
115
+ return 'fast';
116
+ if (mode === 'ultra_deep')
117
+ return 'deep';
118
+ if (mode === 'ultra_exhaustive')
119
+ return 'exhaustive';
120
+ if (mode === 'url_acquisition')
121
+ return 'url_acquisition';
122
+ if (mode === 'x_search')
123
+ return 'x_search';
124
+ if (mode === 'offline_cache')
125
+ return 'offline_cache';
126
+ return 'balanced';
127
+ }
117
128
  async function runContext7(query, opts) {
129
+ if (!opts.required) {
130
+ return { schema: 'sks.context7-source-evidence.v1', ok: true, status: 'not_required', query, result_count: 0, blockers: [] };
131
+ }
118
132
  if (opts.available === false) {
119
133
  return { schema: 'sks.context7-source-evidence.v1', ok: false, status: 'missing', query, result_count: 0, blockers: ['docs_context_missing'] };
120
134
  }
@@ -35,7 +35,8 @@ export function computeTriWikiAffectedGraph(input) {
35
35
  const gatePacks = new Set();
36
36
  for (const impact of selected)
37
37
  gatePacks.add(impact.gate_pack);
38
- const proofLookup = selected.map((impact) => {
38
+ const includeProofLookup = input.includeProofLookup !== false;
39
+ const proofLookup = includeProofLookup ? selected.map((impact) => {
39
40
  const cacheKey = computeTriWikiCacheKey({
40
41
  root: input.root,
41
42
  id: impact.gate_id,
@@ -46,7 +47,7 @@ export function computeTriWikiAffectedGraph(input) {
46
47
  });
47
48
  const hit = readReusableTriWikiProofCard({ root: input.root, subjectId: impact.gate_id, cacheKey: cacheKey.key });
48
49
  return { impact, hit };
49
- });
50
+ }) : [];
50
51
  const reusedProofs = proofLookup
51
52
  .filter((row) => row.hit.hit && row.hit.card && row.hit.path)
52
53
  .map((row) => ({ gate_id: row.impact.gate_id, proof_id: row.hit.card.proof_id, path: row.hit.path }))
@@ -138,12 +138,10 @@ function sourceIntelligenceTrust(proof = {}) {
138
138
  return { issues: [], summary: { required: false, status: 'not_required' } };
139
139
  const proofBlockers = evidence.proof?.blockers || evidence.blockers || [];
140
140
  const issues = [...proofBlockers];
141
- if (evidence.policy?.xai_mcp?.required === true && evidence.xai_search?.ok !== true)
142
- issues.push('xai_available_not_used');
143
141
  if (evidence.policy?.context7?.required === true && evidence.context7?.ok !== true)
144
142
  issues.push('context7_missing');
145
- if (evidence.policy?.codex_web_search?.required === true && evidence.codex_web_search?.ok !== true && evidence.mode !== 'context7_only_degraded')
146
- issues.push('codex_web_search_missing');
143
+ if (evidence.policy?.codex_web_search?.required === true && evidence.ultra_search?.proof?.provider_independent !== true)
144
+ issues.push('ultra_search_provider_independent_proof_missing');
147
145
  return {
148
146
  issues: [...new Set(issues.map(String))],
149
147
  summary: {
@@ -153,7 +151,7 @@ function sourceIntelligenceTrust(proof = {}) {
153
151
  mode: evidence.mode || evidence.policy?.mode || 'unknown',
154
152
  context7_status: evidence.context7?.status || 'unknown',
155
153
  codex_web_status: evidence.codex_web_search?.status || 'not_required',
156
- xai_status: evidence.xai_search?.status || 'not_required',
154
+ ultra_search_status: evidence.ultra_search?.proof?.ok === true ? 'verified' : evidence.ultra_search ? 'partial' : 'not_required',
157
155
  providers_completed: evidence.parallel?.providers_completed || [],
158
156
  blockers: proofBlockers
159
157
  }
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './runtime.js';
3
+ //# sourceMappingURL=index.js.map