sneakoscope 2.0.12 → 2.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 (86) hide show
  1. package/README.md +5 -1
  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/.sks-build-stamp.json +4 -4
  6. package/dist/bin/sks.js +1 -1
  7. package/dist/core/agents/agent-orchestrator.js +11 -4
  8. package/dist/core/agents/agent-output-validator.js +1 -1
  9. package/dist/core/codex-control/codex-fake-sdk-adapter.js +3 -3
  10. package/dist/core/codex-control/codex-sdk-adapter.js +10 -0
  11. package/dist/core/codex-control/codex-task-runner.js +4 -2
  12. package/dist/core/codex-control/gpt-final-review-schema.js +61 -14
  13. package/dist/core/commands/naruto-command.js +1 -0
  14. package/dist/core/commands/research-command.js +112 -19
  15. package/dist/core/fsx.js +1 -1
  16. package/dist/core/naruto/naruto-real-worker-child.js +11 -3
  17. package/dist/core/naruto/naruto-real-worker-runtime.js +4 -0
  18. package/dist/core/pipeline/final-gpt-patch-stage.js +20 -3
  19. package/dist/core/research/claim-evidence-matrix.js +160 -0
  20. package/dist/core/research/experiment-plan.js +53 -0
  21. package/dist/core/research/falsification.js +18 -0
  22. package/dist/core/research/implementation-blueprint-densifier.js +124 -0
  23. package/dist/core/research/implementation-blueprint-markdown.js +31 -0
  24. package/dist/core/research/implementation-blueprint.js +66 -0
  25. package/dist/core/research/replication-pack.js +50 -0
  26. package/dist/core/research/research-claim-builder.js +114 -0
  27. package/dist/core/research/research-cycle-runner.js +129 -0
  28. package/dist/core/research/research-final-reviewer.js +212 -0
  29. package/dist/core/research/research-handoff.js +51 -0
  30. package/dist/core/research/research-prompt-contract.js +24 -0
  31. package/dist/core/research/research-quality-contract.js +61 -0
  32. package/dist/core/research/research-report-quality.js +67 -0
  33. package/dist/core/research/research-source-ledger-merge.js +186 -0
  34. package/dist/core/research/research-source-shards.js +176 -0
  35. package/dist/core/research/research-stage-runner.js +515 -0
  36. package/dist/core/research/research-work-graph.js +166 -0
  37. package/dist/core/research/source-quality-report.js +94 -0
  38. package/dist/core/research.js +356 -44
  39. package/dist/core/version.js +1 -1
  40. package/dist/core/zellij/zellij-slot-column-anchor.js +5 -3
  41. package/dist/core/zellij/zellij-slot-pane-renderer.js +259 -16
  42. package/dist/scripts/codex-sdk-research-pipeline-check.js +44 -5
  43. package/dist/scripts/packlist-performance-check.js +1 -1
  44. package/dist/scripts/release-dag-full-coverage-check.js +14 -1
  45. package/dist/scripts/release-parallel-speed-budget-check.js +7 -2
  46. package/dist/scripts/research-blueprint-densifier-check.js +21 -0
  47. package/dist/scripts/research-claim-builder-check.js +19 -0
  48. package/dist/scripts/research-complete-package-fixture-check.js +23 -0
  49. package/dist/scripts/research-final-reviewer-blackbox.js +22 -0
  50. package/dist/scripts/research-parallel-source-shards-check.js +22 -0
  51. package/dist/scripts/research-quality-gate-check.js +111 -0
  52. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +14 -0
  53. package/dist/scripts/research-short-report-rejection-check.js +46 -0
  54. package/dist/scripts/research-source-ledger-merge-check.js +26 -0
  55. package/dist/scripts/research-stage-cycle-runtime-blackbox.js +24 -0
  56. package/dist/scripts/zellij-slot-column-anchor-check.js +26 -5
  57. package/dist/scripts/zellij-slot-pane-renderer-check.js +73 -5
  58. package/package.json +28 -1
  59. package/schemas/codex/agent-result.schema.json +1 -1
  60. package/schemas/research/claim-evidence-matrix.schema.json +37 -0
  61. package/schemas/research/experiment-plan.schema.json +17 -0
  62. package/schemas/research/implementation-blueprint.schema.json +30 -0
  63. package/schemas/research/replication-pack.schema.json +17 -0
  64. package/schemas/research/research-final-review.schema.json +16 -0
  65. package/schemas/research/research-quality-contract.schema.json +37 -0
  66. package/schemas/research/research-source-shard.schema.json +46 -0
  67. package/schemas/research/source-quality-report.schema.json +18 -0
  68. package/dist/build-manifest.json +0 -1168
  69. package/dist/scripts/release-readiness-report.js +0 -1146
  70. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/permission-request.command.input.schema.json +0 -61
  71. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/permission-request.command.output.schema.json +0 -103
  72. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-compact.command.input.schema.json +0 -52
  73. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-compact.command.output.schema.json +0 -24
  74. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-tool-use.command.input.schema.json +0 -67
  75. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/post-tool-use.command.output.schema.json +0 -84
  76. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-compact.command.input.schema.json +0 -52
  77. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-compact.command.output.schema.json +0 -24
  78. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-tool-use.command.input.schema.json +0 -65
  79. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/pre-tool-use.command.output.schema.json +0 -105
  80. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/session-start.command.input.schema.json +0 -59
  81. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/session-start.command.output.schema.json +0 -63
  82. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/snapshot-metadata.json +0 -31
  83. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/stop.command.input.schema.json +0 -63
  84. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/stop.command.output.schema.json +0 -45
  85. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/user-prompt-submit.command.input.schema.json +0 -59
  86. package/dist/vendor/openai-codex/rust-v0.131.0/hooks/user-prompt-submit.command.output.schema.json +0 -81
@@ -0,0 +1,166 @@
1
+ import path from 'node:path';
2
+ import { nowIso, writeJsonAtomic } from '../fsx.js';
3
+ import { RESEARCH_SOURCE_LAYERS } from './research-source-shards.js';
4
+ export const RESEARCH_WORK_GRAPH_ARTIFACT = 'research-work-graph.json';
5
+ export const REQUIRED_SOURCE_SHARD_IDS = Object.freeze([
6
+ 'source_shard_academic_literature',
7
+ 'source_shard_official_government_data',
8
+ 'source_shard_standards_primary_docs',
9
+ 'source_shard_news_current_events',
10
+ 'source_shard_public_discourse',
11
+ 'source_shard_developer_practitioner',
12
+ 'source_shard_counterevidence_factcheck',
13
+ 'source_shard_local_project_evidence'
14
+ ]);
15
+ function researchStages() {
16
+ const sourceShards = RESEARCH_SOURCE_LAYERS.map((layer) => ({
17
+ id: `source_shard_${layer.id}`,
18
+ title: `Source shard: ${layer.label}`,
19
+ kind: 'research',
20
+ stage_kind: 'source_shard',
21
+ layer_id: layer.id,
22
+ dependencies: [],
23
+ outputs: [`research/cycle-\${cycle}/source-shards/${layer.id}.json`]
24
+ }));
25
+ const shardIds = sourceShards.map((stage) => stage.id);
26
+ return [
27
+ ...sourceShards,
28
+ {
29
+ id: 'source_ledger_merge',
30
+ title: 'Source-ledger partial merge',
31
+ kind: 'research',
32
+ stage_kind: 'source_merge',
33
+ dependencies: shardIds,
34
+ outputs: ['source-ledger.json', 'source-quality-report.json']
35
+ },
36
+ {
37
+ id: 'claim_matrix_build',
38
+ title: 'Claim-evidence matrix build from merged source shards',
39
+ kind: 'research',
40
+ stage_kind: 'claim_matrix_build',
41
+ dependencies: [...shardIds, 'source_ledger_merge'],
42
+ outputs: ['claim-evidence-matrix.json']
43
+ },
44
+ {
45
+ id: 'falsification',
46
+ title: 'Counterevidence and falsification stage',
47
+ kind: 'verification',
48
+ stage_kind: 'falsification',
49
+ dependencies: ['claim_matrix_build', 'source_shard_counterevidence_factcheck'],
50
+ outputs: ['falsification-ledger.json']
51
+ },
52
+ {
53
+ id: 'implementation_blueprint',
54
+ title: 'Concrete implementation blueprint and handoff',
55
+ kind: 'documentation',
56
+ stage_kind: 'implementation_blueprint',
57
+ dependencies: ['claim_matrix_build', 'source_shard_local_project_evidence'],
58
+ outputs: ['implementation-blueprint.json', 'implementation-blueprint.md', 'team-handoff-goal.md']
59
+ },
60
+ {
61
+ id: 'experiment_plan',
62
+ title: 'Experiment plan and replication pack',
63
+ kind: 'verification',
64
+ stage_kind: 'experiment_plan',
65
+ dependencies: ['implementation_blueprint', 'falsification'],
66
+ outputs: ['experiment-plan.json', 'experiment-plan.md', 'replication-pack.json']
67
+ },
68
+ {
69
+ id: 'synthesis',
70
+ title: 'Research report and manuscript synthesis',
71
+ kind: 'research',
72
+ stage_kind: 'synthesis',
73
+ dependencies: ['claim_matrix_build', 'falsification', 'implementation_blueprint', 'experiment_plan'],
74
+ outputs: ['research-report.md', 'research-paper.md', 'genius-opinion-summary.md', 'agent-ledger.json', 'debate-ledger.json', 'novelty-ledger.json']
75
+ },
76
+ {
77
+ id: 'final_review',
78
+ title: 'Static plus Codex/GPT research final reviewer',
79
+ kind: 'verification',
80
+ stage_kind: 'final_review',
81
+ dependencies: ['synthesis'],
82
+ outputs: ['research-final-review.static.json', 'research-final-review.codex.json', 'research-final-review.json']
83
+ },
84
+ {
85
+ id: 'verification',
86
+ title: 'Research gate evaluation and route finalization input',
87
+ kind: 'final_review_input_pack',
88
+ stage_kind: 'verification',
89
+ dependencies: ['final_review'],
90
+ outputs: ['research-gate.json', 'research-gate.evaluated.json']
91
+ }
92
+ ];
93
+ }
94
+ function workItem(stage, index, allStages, plan = null) {
95
+ const missionPrefix = plan?.mission_id ? `.sneakoscope/missions/${plan.mission_id}/` : '';
96
+ const item = {
97
+ id: stage.id,
98
+ kind: stage.kind,
99
+ title: stage.title,
100
+ target_paths: stage.outputs.map((artifact) => `${missionPrefix}${artifact}`),
101
+ readonly_paths: [
102
+ `${missionPrefix}research-plan.json`,
103
+ `${missionPrefix}research-quality-contract.json`,
104
+ `${missionPrefix}source-ledger.json`,
105
+ `${missionPrefix}claim-evidence-matrix.json`,
106
+ `${missionPrefix}falsification-ledger.json`
107
+ ],
108
+ write_paths: [],
109
+ required_role: index < RESEARCH_SOURCE_LAYERS.length ? 'research' : stage.kind === 'documentation' ? 'planner' : 'verifier',
110
+ write_allowed: false,
111
+ verification_required: true,
112
+ dependencies: stage.dependencies,
113
+ can_run_in_parallel_with: allStages.filter((candidate) => candidate.id !== stage.id && !stage.dependencies.includes(candidate.id)).map((candidate) => candidate.id),
114
+ conflicts_with: [],
115
+ estimated_cost: { tokens: stage.stage_kind === 'source_shard' ? 2500 : 4000, latency_ms: stage.stage_kind === 'source_shard' ? 30000 : 60000, cpu_weight: 1, memory_mb: 256, gpu_weight: 0 },
116
+ lease_requirements: stage.outputs.map((artifact) => ({ path: `${missionPrefix}${artifact}`, kind: 'read' })),
117
+ acceptance: { requires_patch_envelope: false, requires_verification: true, requires_gpt_final: stage.stage_kind === 'final_review' },
118
+ owner: null,
119
+ allocation_reason: 'Stage-aware read-only research pipeline work graph with source-layer shard parallelism',
120
+ allocation_score: 1,
121
+ allocation_hints: { domains: [stage.kind], write_paths: [], read_only_paths: stage.outputs },
122
+ lane: null,
123
+ worktree: { mode: 'patch-envelope-only', required: false, allocation_required: false }
124
+ };
125
+ return {
126
+ ...item,
127
+ stage_kind: stage.stage_kind,
128
+ layer_id: stage.layer_id || null,
129
+ output_artifacts: stage.outputs,
130
+ required: stage.required !== false
131
+ };
132
+ }
133
+ export function buildResearchWorkGraph(plan = null) {
134
+ const stages = researchStages();
135
+ const requestedClones = Math.max(8, Number(plan?.native_agent_plan?.session_count || 0), RESEARCH_SOURCE_LAYERS.length);
136
+ const workItems = stages.map((stage, index) => workItem(stage, index, stages, plan));
137
+ const sourceShardIds = workItems.filter((item) => item.stage_kind === 'source_shard').map((item) => item.id);
138
+ const closeoutIds = workItems.filter((item) => item.stage_kind !== 'source_shard').map((item) => item.id);
139
+ return {
140
+ schema: 'sks.naruto-work-graph.v1',
141
+ route: '$Naruto',
142
+ requested_clones: requestedClones,
143
+ total_work_items: workItems.length,
144
+ readonly: true,
145
+ write_capable: false,
146
+ work_items: workItems,
147
+ active_waves: [
148
+ { wave_id: 'parallel-source-shard-wave', work_item_ids: sourceShardIds, write_paths: [], conflict_count: 0 },
149
+ { wave_id: 'research-closeout-wave', work_item_ids: closeoutIds, write_paths: [], conflict_count: 0 }
150
+ ],
151
+ mixed_work_kinds: [...new Set(workItems.map((item) => item.kind))],
152
+ write_allowed_count: 0,
153
+ worktree_policy: { mode: 'patch-envelope-only', required: false, main_repo_root: null, worktree_root: null, fallback_reason: 'Research route is read-only.' },
154
+ blockers: [],
155
+ ok: true
156
+ };
157
+ }
158
+ export async function writeResearchWorkGraph(dir, plan = null) {
159
+ const graph = buildResearchWorkGraph(plan);
160
+ await writeJsonAtomic(path.join(dir, RESEARCH_WORK_GRAPH_ARTIFACT), {
161
+ ...graph,
162
+ generated_at: nowIso()
163
+ });
164
+ return graph;
165
+ }
166
+ //# sourceMappingURL=research-work-graph.js.map
@@ -0,0 +1,94 @@
1
+ import path from 'node:path';
2
+ import { nowIso, readJson, writeJsonAtomic } from '../fsx.js';
3
+ export const SOURCE_QUALITY_REPORT_ARTIFACT = 'source-quality-report.json';
4
+ const REQUIRED_SOURCE_FIELDS = Object.freeze([
5
+ 'id',
6
+ 'layer',
7
+ 'kind',
8
+ 'title',
9
+ 'locator',
10
+ 'publisher_or_author',
11
+ 'accessed_at',
12
+ 'reliability',
13
+ 'credibility',
14
+ 'stance',
15
+ 'claim_ids'
16
+ ]);
17
+ function asArray(value) {
18
+ return Array.isArray(value) ? value : [];
19
+ }
20
+ function sourceRows(sourceLedger = null) {
21
+ return [
22
+ ...asArray(sourceLedger?.sources),
23
+ ...asArray(sourceLedger?.counterevidence_sources)
24
+ ];
25
+ }
26
+ function missingFields(row) {
27
+ return REQUIRED_SOURCE_FIELDS.filter((field) => {
28
+ const value = row?.[field];
29
+ if (Array.isArray(value))
30
+ return value.length === 0;
31
+ return value === undefined || value === null || String(value).trim() === '';
32
+ });
33
+ }
34
+ export function buildSourceQualityReport(sourceLedger = null, claimMatrix = null) {
35
+ const rows = sourceRows(sourceLedger);
36
+ const rowReports = rows.map((row) => {
37
+ const missing = missingFields(row);
38
+ return {
39
+ id: String(row?.id || ''),
40
+ layer: row?.layer || row?.layer_id || row?.source_layer || null,
41
+ stance: row?.stance || null,
42
+ claim_ids: asArray(row?.claim_ids).map(String),
43
+ reliability: row?.reliability || null,
44
+ credibility: row?.credibility || null,
45
+ missing_fields: missing,
46
+ ok: missing.length === 0
47
+ };
48
+ });
49
+ const sourceLayerRows = asArray(sourceLedger?.source_layers);
50
+ const coveredLayerIds = sourceLayerRows
51
+ .filter((layer) => layer?.status === 'covered')
52
+ .map((layer) => String(layer.id || layer.layer || ''))
53
+ .filter(Boolean);
54
+ const keyClaimIds = asArray(claimMatrix?.key_claim_ids).map(String);
55
+ const citedClaimIds = new Set(rows.flatMap((row) => asArray(row?.claim_ids).map(String)));
56
+ const uncitedKeyClaimIds = keyClaimIds.filter((id) => !citedClaimIds.has(id));
57
+ const blockers = [
58
+ ...rowReports.flatMap((row) => row.ok ? [] : [`source_metadata_incomplete:${row.id || 'unknown'}`]),
59
+ ...(keyClaimIds.length && uncitedKeyClaimIds.length ? ['key_claim_citation_coverage_incomplete'] : []),
60
+ ...(sourceLedger?.citation_coverage?.all_key_claims_cited === false ? ['source_ledger_reports_uncited_key_claims'] : [])
61
+ ];
62
+ return {
63
+ schema: 'sks.research-source-quality-report.v1',
64
+ generated_at: nowIso(),
65
+ ok: blockers.length === 0,
66
+ blockers,
67
+ required_source_fields: [...REQUIRED_SOURCE_FIELDS],
68
+ summary: {
69
+ source_entries: asArray(sourceLedger?.sources).length,
70
+ counterevidence_entries: asArray(sourceLedger?.counterevidence_sources).length,
71
+ total_entries: rows.length,
72
+ rows_with_complete_metadata: rowReports.filter((row) => row.ok).length,
73
+ source_layers_covered: coveredLayerIds.length,
74
+ key_claims: keyClaimIds.length,
75
+ cited_key_claims: keyClaimIds.length - uncitedKeyClaimIds.length,
76
+ uncited_key_claims: uncitedKeyClaimIds.length
77
+ },
78
+ citation_coverage: {
79
+ all_key_claims_cited: uncitedKeyClaimIds.length === 0 && sourceLedger?.citation_coverage?.all_key_claims_cited === true,
80
+ cited_claim_ids: [...citedClaimIds].sort(),
81
+ uncited_key_claim_ids: uncitedKeyClaimIds
82
+ },
83
+ sources: rowReports
84
+ };
85
+ }
86
+ export async function readSourceQualityReport(dir) {
87
+ return readJson(path.join(dir, SOURCE_QUALITY_REPORT_ARTIFACT), null);
88
+ }
89
+ export async function writeSourceQualityReport(dir, sourceLedger = null, claimMatrix = null) {
90
+ const report = buildSourceQualityReport(sourceLedger, claimMatrix);
91
+ await writeJsonAtomic(path.join(dir, SOURCE_QUALITY_REPORT_ARTIFACT), report);
92
+ return report;
93
+ }
94
+ //# sourceMappingURL=source-quality-report.js.map