sneakoscope 2.0.11 → 2.0.13

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 (75) hide show
  1. package/README.md +9 -3
  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/build-manifest.json +27 -8
  8. package/dist/core/agents/agent-orchestrator.js +279 -1
  9. package/dist/core/agents/agent-scheduler.js +12 -1
  10. package/dist/core/agents/agent-slot-pane-binding-proof.js +3 -3
  11. package/dist/core/agents/agent-work-queue.js +26 -2
  12. package/dist/core/agents/agent-worker-pipeline.js +2 -0
  13. package/dist/core/agents/native-cli-session-swarm.js +2 -2
  14. package/dist/core/codex-control/codex-sdk-adapter.js +10 -0
  15. package/dist/core/codex-control/codex-task-runner.js +4 -2
  16. package/dist/core/commands/naruto-command.js +104 -51
  17. package/dist/core/commands/research-command.js +43 -4
  18. package/dist/core/fsx.js +1 -1
  19. package/dist/core/git/git-worktree-merge-queue.js +34 -14
  20. package/dist/core/naruto/naruto-rebalance-policy.js +15 -3
  21. package/dist/core/naruto/naruto-work-graph.js +13 -0
  22. package/dist/core/research/claim-evidence-matrix.js +160 -0
  23. package/dist/core/research/experiment-plan.js +53 -0
  24. package/dist/core/research/falsification.js +18 -0
  25. package/dist/core/research/implementation-blueprint-markdown.js +31 -0
  26. package/dist/core/research/implementation-blueprint.js +66 -0
  27. package/dist/core/research/replication-pack.js +50 -0
  28. package/dist/core/research/research-cycle-runner.js +25 -0
  29. package/dist/core/research/research-final-reviewer.js +58 -0
  30. package/dist/core/research/research-handoff.js +51 -0
  31. package/dist/core/research/research-prompt-contract.js +24 -0
  32. package/dist/core/research/research-quality-contract.js +61 -0
  33. package/dist/core/research/research-report-quality.js +67 -0
  34. package/dist/core/research/research-stage-runner.js +16 -0
  35. package/dist/core/research/research-work-graph.js +75 -0
  36. package/dist/core/research/source-quality-report.js +94 -0
  37. package/dist/core/research.js +344 -44
  38. package/dist/core/version.js +1 -1
  39. package/dist/core/zellij/zellij-slot-column-anchor.js +165 -4
  40. package/dist/core/zellij/zellij-slot-pane-renderer.js +259 -16
  41. package/dist/core/zellij/zellij-worker-pane-manager.js +13 -7
  42. package/dist/scripts/agent-real-codex-in-zellij-worker-pane-check.js +8 -2
  43. package/dist/scripts/agent-slot-pane-binding-proof-check.js +4 -4
  44. package/dist/scripts/codex-sdk-release-review-pipeline-check.js +2 -1
  45. package/dist/scripts/codex-sdk-research-pipeline-check.js +7 -0
  46. package/dist/scripts/codex-sdk-zellij-pane-binding-check.js +2 -2
  47. package/dist/scripts/git-worktree-cross-rebase-check.js +13 -1
  48. package/dist/scripts/git-worktree-merge-queue-check.js +1 -0
  49. package/dist/scripts/local-collab-worktree-gpt-final-apply-policy-check.js +63 -0
  50. package/dist/scripts/naruto-actual-worker-control-plane-check.js +30 -3
  51. package/dist/scripts/naruto-allocation-runtime-wiring-check.js +92 -0
  52. package/dist/scripts/naruto-orchestrator-runtime-source-check.js +65 -6
  53. package/dist/scripts/naruto-rebalance-policy-check.js +15 -2
  54. package/dist/scripts/naruto-shadow-clone-swarm-check.js +1 -1
  55. package/dist/scripts/packlist-performance-check.js +1 -1
  56. package/dist/scripts/release-dag-full-coverage-check.js +4 -0
  57. package/dist/scripts/release-real-check.js +258 -77
  58. package/dist/scripts/research-quality-gate-check.js +86 -0
  59. package/dist/scripts/zellij-first-slot-down-stack-check.js +1 -1
  60. package/dist/scripts/zellij-first-slot-down-stack-real-check.js +344 -4
  61. package/dist/scripts/zellij-right-column-manager-check.js +1 -1
  62. package/dist/scripts/zellij-slot-column-anchor-check.js +45 -3
  63. package/dist/scripts/zellij-slot-only-ui-check.js +3 -1
  64. package/dist/scripts/zellij-slot-pane-renderer-check.js +73 -5
  65. package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +59 -0
  66. package/dist/scripts/zellij-worker-pane-manager-check.js +23 -1
  67. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +21 -4
  68. package/package.json +17 -2
  69. package/schemas/research/claim-evidence-matrix.schema.json +37 -0
  70. package/schemas/research/experiment-plan.schema.json +17 -0
  71. package/schemas/research/implementation-blueprint.schema.json +30 -0
  72. package/schemas/research/replication-pack.schema.json +17 -0
  73. package/schemas/research/research-final-review.schema.json +16 -0
  74. package/schemas/research/research-quality-contract.schema.json +37 -0
  75. package/schemas/research/source-quality-report.schema.json +18 -0
@@ -0,0 +1,67 @@
1
+ export const REQUIRED_RESEARCH_REPORT_HEADINGS = [
2
+ 'Question',
3
+ 'Methodology',
4
+ 'Source Map',
5
+ 'Key Claims',
6
+ 'Evidence Matrix Summary',
7
+ 'Counterevidence',
8
+ 'Falsification',
9
+ 'Implementation Blueprint',
10
+ 'Experiment / Validation Plan',
11
+ 'Limitations',
12
+ 'References'
13
+ ];
14
+ export function analyzeResearchReportQuality(text) {
15
+ const body = String(text || '');
16
+ const headings = body.split(/\r?\n/)
17
+ .map((line) => line.match(/^#{1,6}\s+(.+?)\s*#*\s*$/)?.[1]?.trim())
18
+ .filter((value) => Boolean(value));
19
+ const lowerHeadings = headings.map((heading) => normalizeHeading(heading));
20
+ const headingsPresent = REQUIRED_RESEARCH_REPORT_HEADINGS.filter((heading) => lowerHeadings.some((value) => value.includes(normalizeHeading(heading))));
21
+ const missingHeadings = REQUIRED_RESEARCH_REPORT_HEADINGS.filter((heading) => !headingsPresent.includes(heading));
22
+ const implementationText = sectionText(body, 'Implementation Blueprint');
23
+ const referencesText = sectionText(body, 'References');
24
+ const referencesSourceIds = [...new Set([
25
+ ...body.matchAll(/\b(?:source|src|mock-source|counter|mock-counter)-[A-Za-z0-9_.:-]+\b/g)
26
+ ].map((match) => match[0]))];
27
+ const blockers = [
28
+ ...missingHeadings.map((heading) => `research_report_heading_missing:${normalizeHeading(heading).replace(/\s+/g, '_')}`),
29
+ ...(referencesSourceIds.length ? [] : ['research_report_references_missing_source_ids'])
30
+ ];
31
+ return {
32
+ schema: 'sks.research-report-quality.v1',
33
+ word_count: countWords(body),
34
+ headings_present: headingsPresent,
35
+ missing_headings: missingHeadings,
36
+ implementation_section_words: countWords(implementationText),
37
+ references_source_ids: referencesText ? referencesSourceIds : [],
38
+ blockers,
39
+ ok: blockers.length === 0
40
+ };
41
+ }
42
+ export function countWords(text) {
43
+ return String(text || '').trim().split(/\s+/).filter(Boolean).length;
44
+ }
45
+ function normalizeHeading(value) {
46
+ return String(value || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
47
+ }
48
+ function sectionText(text, heading) {
49
+ const lines = String(text || '').split(/\r?\n/);
50
+ const target = normalizeHeading(heading);
51
+ let capture = false;
52
+ const out = [];
53
+ for (const line of lines) {
54
+ const match = line.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
55
+ if (match) {
56
+ const normalized = normalizeHeading(match[2] || '');
57
+ if (capture)
58
+ break;
59
+ capture = normalized.includes(target);
60
+ continue;
61
+ }
62
+ if (capture)
63
+ out.push(line);
64
+ }
65
+ return out.join('\n');
66
+ }
67
+ //# sourceMappingURL=research-report-quality.js.map
@@ -0,0 +1,16 @@
1
+ import path from 'node:path';
2
+ import { nowIso, writeJsonAtomic } from '../fsx.js';
3
+ export async function runResearchStage(dir, stage, opts = {}) {
4
+ const record = {
5
+ schema: 'sks.research-stage-run.v1',
6
+ stage_id: stage?.id || opts.stageId || 'unknown',
7
+ status: opts.status || 'recorded',
8
+ readonly: true,
9
+ started_at: opts.startedAt || nowIso(),
10
+ completed_at: nowIso(),
11
+ notes: opts.notes || []
12
+ };
13
+ await writeJsonAtomic(path.join(dir, 'research', 'stages', `${record.stage_id}.json`), record);
14
+ return record;
15
+ }
16
+ //# sourceMappingURL=research-stage-runner.js.map
@@ -0,0 +1,75 @@
1
+ import path from 'node:path';
2
+ import { nowIso, writeJsonAtomic } from '../fsx.js';
3
+ export const RESEARCH_WORK_GRAPH_ARTIFACT = 'research-work-graph.json';
4
+ const STAGES = [
5
+ { id: 'research_source_quality', title: 'Source quality and layered retrieval audit', kind: 'research', outputs: ['source-ledger.json', 'source-quality-report.json'] },
6
+ { id: 'research_claim_matrix', title: 'Claim-evidence matrix and citation coverage', kind: 'research', outputs: ['claim-evidence-matrix.json'] },
7
+ { id: 'research_falsification', title: 'Counterevidence and falsification strengthening', kind: 'research', outputs: ['falsification-ledger.json'] },
8
+ { id: 'research_synthesis_report', title: 'Research report and manuscript synthesis', kind: 'research', outputs: ['research-report.md'] },
9
+ { id: 'research_blueprint', title: 'Implementation blueprint and handoff', kind: 'documentation', outputs: ['implementation-blueprint.json', 'implementation-blueprint.md', 'team-handoff-goal.md'] },
10
+ { id: 'research_experiment', title: 'Experiment plan and replication pack', kind: 'verification', outputs: ['experiment-plan.json', 'replication-pack.json'] },
11
+ { id: 'research_final_review', title: 'Final reviewer quality audit', kind: 'verification', outputs: ['research-final-review.json'] },
12
+ { id: 'research_gate_close', title: 'Research gate evaluation and completion output', kind: 'final_review_input_pack', outputs: ['research-gate.evaluated.json', 'research-gate.json'] }
13
+ ];
14
+ function workItem(stage, index, plan = null) {
15
+ const missionPrefix = plan?.mission_id ? `.sneakoscope/missions/${plan.mission_id}/` : '';
16
+ return {
17
+ id: stage.id,
18
+ kind: stage.kind,
19
+ title: stage.title,
20
+ target_paths: stage.outputs.map((artifact) => `${missionPrefix}${artifact}`),
21
+ readonly_paths: [
22
+ `${missionPrefix}research-plan.json`,
23
+ `${missionPrefix}research-quality-contract.json`,
24
+ `${missionPrefix}source-ledger.json`,
25
+ `${missionPrefix}claim-evidence-matrix.json`
26
+ ],
27
+ write_paths: [],
28
+ required_role: index < 4 ? 'research' : 'verifier',
29
+ write_allowed: false,
30
+ verification_required: true,
31
+ dependencies: index === 0 ? [] : [STAGES[index - 1]?.id].filter(Boolean),
32
+ can_run_in_parallel_with: STAGES.filter((candidate) => candidate.id !== stage.id).map((candidate) => candidate.id),
33
+ conflicts_with: [],
34
+ estimated_cost: { tokens: 4000, latency_ms: 60000, cpu_weight: 1, memory_mb: 256, gpu_weight: 0 },
35
+ lease_requirements: stage.outputs.map((artifact) => ({ path: `${missionPrefix}${artifact}`, kind: 'read' })),
36
+ acceptance: { requires_patch_envelope: false, requires_verification: true, requires_gpt_final: false },
37
+ owner: null,
38
+ allocation_reason: 'Stage-aware read-only research pipeline work graph',
39
+ allocation_score: 1,
40
+ allocation_hints: { domains: [stage.kind], write_paths: [], read_only_paths: stage.outputs },
41
+ lane: null,
42
+ worktree: { mode: 'patch-envelope-only', required: false, allocation_required: false }
43
+ };
44
+ }
45
+ export function buildResearchWorkGraph(plan = null) {
46
+ const requestedClones = Math.max(8, Number(plan?.native_agent_plan?.session_count || 0));
47
+ const workItems = STAGES.map((stage, index) => workItem(stage, index, plan));
48
+ return {
49
+ schema: 'sks.naruto-work-graph.v1',
50
+ route: '$Naruto',
51
+ requested_clones: requestedClones,
52
+ total_work_items: workItems.length,
53
+ readonly: true,
54
+ write_capable: false,
55
+ work_items: workItems,
56
+ active_waves: [
57
+ { wave_id: 'research-quality-wave', work_item_ids: workItems.slice(0, 4).map((item) => item.id), write_paths: [], conflict_count: 0 },
58
+ { wave_id: 'research-closeout-wave', work_item_ids: workItems.slice(4).map((item) => item.id), write_paths: [], conflict_count: 0 }
59
+ ],
60
+ mixed_work_kinds: [...new Set(workItems.map((item) => item.kind))],
61
+ write_allowed_count: 0,
62
+ worktree_policy: { mode: 'patch-envelope-only', required: false, main_repo_root: null, worktree_root: null, fallback_reason: 'Research route is read-only.' },
63
+ blockers: [],
64
+ ok: true
65
+ };
66
+ }
67
+ export async function writeResearchWorkGraph(dir, plan = null) {
68
+ const graph = buildResearchWorkGraph(plan);
69
+ await writeJsonAtomic(path.join(dir, RESEARCH_WORK_GRAPH_ARTIFACT), {
70
+ ...graph,
71
+ generated_at: nowIso()
72
+ });
73
+ return graph;
74
+ }
75
+ //# 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