erdos-problems 0.2.10 → 0.3.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 (73) hide show
  1. package/README.md +45 -21
  2. package/data/upstream/erdosproblems/SYNC_MANIFEST.json +4 -4
  3. package/docs/CANONICAL_REPO_MIGRATION_PLAN.md +279 -0
  4. package/docs/DEEP_RESEARCH_BUNDLE_SPEC.md +129 -0
  5. package/docs/ERDOS_PROBLEMS_PROBLEM_SCHEMA.md +27 -20
  6. package/docs/ERDOS_PROBLEMS_REPO_SPEC.md +22 -13
  7. package/docs/PAPER_WRITER_MODE.md +118 -0
  8. package/package.json +1 -1
  9. package/problems/1/AGENT_START.md +1 -1
  10. package/problems/1/EVIDENCE.md +1 -1
  11. package/problems/1/FORMALIZATION.md +2 -2
  12. package/problems/1/problem.yaml +6 -6
  13. package/problems/1008/problem.yaml +5 -5
  14. package/problems/18/problem.yaml +5 -5
  15. package/problems/19/AGENT_START.md +1 -1
  16. package/problems/19/EVIDENCE.md +1 -1
  17. package/problems/19/FORMALIZATION.md +2 -2
  18. package/problems/19/problem.yaml +6 -6
  19. package/problems/2/AGENT_START.md +1 -1
  20. package/problems/2/EVIDENCE.md +1 -1
  21. package/problems/2/FORMALIZATION.md +2 -2
  22. package/problems/2/problem.yaml +6 -6
  23. package/problems/20/problem.yaml +5 -5
  24. package/problems/21/AGENT_START.md +1 -1
  25. package/problems/21/EVIDENCE.md +1 -1
  26. package/problems/21/FORMALIZATION.md +2 -2
  27. package/problems/21/problem.yaml +6 -6
  28. package/problems/22/AGENT_START.md +1 -1
  29. package/problems/22/EVIDENCE.md +1 -1
  30. package/problems/22/FORMALIZATION.md +2 -2
  31. package/problems/22/problem.yaml +6 -6
  32. package/problems/3/AGENT_START.md +1 -1
  33. package/problems/3/EVIDENCE.md +1 -1
  34. package/problems/3/FORMALIZATION.md +2 -2
  35. package/problems/3/problem.yaml +6 -6
  36. package/problems/4/AGENT_START.md +1 -1
  37. package/problems/4/EVIDENCE.md +1 -1
  38. package/problems/4/FORMALIZATION.md +2 -2
  39. package/problems/4/problem.yaml +6 -6
  40. package/problems/5/AGENT_START.md +1 -1
  41. package/problems/5/EVIDENCE.md +1 -1
  42. package/problems/5/FORMALIZATION.md +2 -2
  43. package/problems/5/problem.yaml +6 -6
  44. package/problems/536/problem.yaml +5 -5
  45. package/problems/542/problem.yaml +5 -5
  46. package/problems/6/AGENT_START.md +1 -1
  47. package/problems/6/EVIDENCE.md +1 -1
  48. package/problems/6/FORMALIZATION.md +2 -2
  49. package/problems/6/problem.yaml +6 -6
  50. package/problems/7/AGENT_START.md +1 -1
  51. package/problems/7/EVIDENCE.md +1 -1
  52. package/problems/7/FORMALIZATION.md +2 -2
  53. package/problems/7/problem.yaml +6 -6
  54. package/problems/856/problem.yaml +5 -5
  55. package/problems/857/problem.yaml +5 -5
  56. package/problems/89/problem.yaml +5 -5
  57. package/src/atlas/catalog.js +6 -5
  58. package/src/cli/index.js +10 -5
  59. package/src/commands/bootstrap.js +1 -1
  60. package/src/commands/dossier.js +1 -1
  61. package/src/commands/maintainer.js +2 -2
  62. package/src/commands/paper.js +147 -0
  63. package/src/commands/problem.js +9 -9
  64. package/src/commands/pull.js +8 -8
  65. package/src/commands/scaffold.js +1 -1
  66. package/src/commands/seed.js +1 -1
  67. package/src/commands/upstream.js +27 -24
  68. package/src/runtime/maintainer-seed.js +12 -12
  69. package/src/runtime/paper.js +720 -0
  70. package/src/runtime/paths.js +16 -0
  71. package/src/runtime/problem-artifacts.js +2 -2
  72. package/src/runtime/state.js +1 -1
  73. package/src/upstream/sync.js +18 -18
@@ -136,6 +136,14 @@ export function getWorkspaceArchiveDir(problemId, workspaceRoot = getWorkspaceRo
136
136
  return path.join(getWorkspaceArchivesDir(workspaceRoot), String(problemId));
137
137
  }
138
138
 
139
+ export function getWorkspacePapersDir(workspaceRoot = getWorkspaceRoot()) {
140
+ return path.join(getWorkspaceDir(workspaceRoot), 'papers');
141
+ }
142
+
143
+ export function getWorkspaceProblemPaperDir(problemId, workspaceRoot = getWorkspaceRoot()) {
144
+ return path.join(getWorkspacePapersDir(workspaceRoot), String(problemId));
145
+ }
146
+
139
147
  export function getWorkspaceProblemCheckpointsDir(workspaceRoot = getWorkspaceRoot()) {
140
148
  return path.join(getWorkspaceCheckpointsDir(workspaceRoot), 'problem-checkpoints');
141
149
  }
@@ -196,6 +204,14 @@ export function getRepoUpstreamDiffPath() {
196
204
  return path.join(getRepoAnalysisDir(), 'UPSTREAM_DIFF.md');
197
205
  }
198
206
 
207
+ export function getRepoPaperDir() {
208
+ return path.join(repoRoot, 'paper');
209
+ }
210
+
211
+ export function getRepoProblemPaperDir(problemId) {
212
+ return path.join(getRepoPaperDir(), 'problems', String(problemId));
213
+ }
214
+
199
215
  export function getPackDir(packName) {
200
216
  return path.join(repoRoot, 'packs', String(packName));
201
217
  }
@@ -134,7 +134,7 @@ export function getProblemArtifactInventory(problem) {
134
134
  manifestPath: snapshot.manifestPath,
135
135
  indexPath: snapshot.indexPath,
136
136
  yamlPath: snapshot.yamlPath,
137
- upstreamCommit: snapshot.manifest.upstream_commit ?? null,
137
+ upstreamCommit: snapshot.manifest.imported_commit ?? snapshot.manifest.upstream_commit ?? null,
138
138
  fetchedAt: snapshot.manifest.fetched_at,
139
139
  }
140
140
  : null,
@@ -263,7 +263,7 @@ export function scaffoldProblem(problem, destination) {
263
263
  `- Source: ${problem.sourceUrl}`,
264
264
  `- Repo status: ${problem.repoStatus}`,
265
265
  `- Harness depth: ${problem.harnessDepth}`,
266
- `- Upstream record included: ${inventory.upstreamRecordIncluded ? 'yes' : 'no'}`,
266
+ `- Imported record included: ${inventory.upstreamRecordIncluded ? 'yes' : 'no'}`,
267
267
  `- Starter loop artifacts copied: ${copiedStarterArtifacts.length}`,
268
268
  `- Pack problem artifacts copied: ${packProblemArtifacts.length}`,
269
269
  `- Compute packets copied: ${computeArtifacts.length}`,
@@ -156,7 +156,7 @@ function deriveGenericProblemSummary(problem) {
156
156
  routeStory: activeRoute
157
157
  ? `Advance ${activeRoute} without blurring local route state into global problem status.`
158
158
  : 'No active route is recorded for this dossier yet.',
159
- checkpointFocus: 'Keep dossier truth, upstream provenance, and local route state sharply separated.',
159
+ checkpointFocus: 'Keep dossier truth, import provenance, and local route state sharply separated.',
160
160
  nextHonestMove,
161
161
  packArtifacts: null,
162
162
  activeTicketId: null,
@@ -17,9 +17,9 @@ import {
17
17
  getWorkspaceUpstreamYamlPath,
18
18
  } from '../runtime/paths.js';
19
19
 
20
- const UPSTREAM_REPO_URL = 'https://github.com/teorth/erdosproblems';
21
- const RAW_PROBLEMS_URL = 'https://raw.githubusercontent.com/teorth/erdosproblems/master/data/problems.yaml';
22
- const COMMIT_API_URL = 'https://api.github.com/repos/teorth/erdosproblems/commits?path=data/problems.yaml&per_page=1';
20
+ const EXTERNAL_REPO_URL = 'https://github.com/teorth/erdosproblems';
21
+ const EXTERNAL_RAW_PROBLEMS_URL = 'https://raw.githubusercontent.com/teorth/erdosproblems/master/data/problems.yaml';
22
+ const EXTERNAL_COMMIT_API_URL = 'https://api.github.com/repos/teorth/erdosproblems/commits?path=data/problems.yaml&per_page=1';
23
23
 
24
24
  function sha256(text) {
25
25
  return crypto.createHash('sha256').update(text).digest('hex');
@@ -51,7 +51,7 @@ function normalizeUpstreamRecord(entry) {
51
51
  }
52
52
 
53
53
  async function fetchUpstreamCommit() {
54
- const response = await fetch(COMMIT_API_URL, {
54
+ const response = await fetch(EXTERNAL_COMMIT_API_URL, {
55
55
  headers: {
56
56
  'User-Agent': 'erdos-problems-cli',
57
57
  Accept: 'application/vnd.github+json',
@@ -65,7 +65,7 @@ async function fetchUpstreamCommit() {
65
65
  }
66
66
 
67
67
  export async function fetchUpstreamSnapshot() {
68
- const response = await fetch(RAW_PROBLEMS_URL, {
68
+ const response = await fetch(EXTERNAL_RAW_PROBLEMS_URL, {
69
69
  headers: {
70
70
  'User-Agent': 'erdos-problems-cli',
71
71
  Accept: 'text/plain',
@@ -79,11 +79,11 @@ export async function fetchUpstreamSnapshot() {
79
79
  const records = parsed.map(normalizeUpstreamRecord);
80
80
  const commit = await fetchUpstreamCommit();
81
81
  const manifest = {
82
- upstream_repo: UPSTREAM_REPO_URL,
83
- source_url: RAW_PROBLEMS_URL,
84
- source_file: 'data/problems.yaml',
82
+ external_repo: EXTERNAL_REPO_URL,
83
+ external_source_url: EXTERNAL_RAW_PROBLEMS_URL,
84
+ external_source_file: 'data/problems.yaml',
85
85
  fetched_at: new Date().toISOString(),
86
- upstream_commit: commit,
86
+ imported_commit: commit,
87
87
  raw_sha256: sha256(rawYaml),
88
88
  entry_count: records.length,
89
89
  };
@@ -154,7 +154,7 @@ function compareTagSets(localProblem, upstreamRecord) {
154
154
  export function buildUpstreamDiff() {
155
155
  const snapshot = loadActiveUpstreamSnapshot();
156
156
  if (!snapshot) {
157
- throw new Error('No upstream snapshot available. Run `erdos upstream sync` first.');
157
+ throw new Error('No import snapshot available. Run `erdos import sync` first.');
158
158
  }
159
159
 
160
160
  const localProblems = loadLocalProblems();
@@ -170,7 +170,7 @@ export function buildUpstreamDiff() {
170
170
  }
171
171
 
172
172
  const statusMatches = normalizeStatus(problem.siteStatus) === normalizeStatus(upstream.status.state);
173
- const formalizedMatches = normalizeStatus(problem.upstreamFormalizedState) === normalizeStatus(upstream.formalized.state);
173
+ const formalizedMatches = normalizeStatus(problem.importedFormalizedState) === normalizeStatus(upstream.formalized.state);
174
174
  const tagDiff = compareTagSets(problem, upstream);
175
175
 
176
176
  overlaps.push({
@@ -180,7 +180,7 @@ export function buildUpstreamDiff() {
180
180
  localSiteStatus: problem.siteStatus,
181
181
  upstreamSiteStatus: upstream.status.state,
182
182
  statusMatches,
183
- localFormalized: problem.upstreamFormalizedState,
183
+ localFormalized: problem.importedFormalizedState,
184
184
  upstreamFormalized: upstream.formalized.state,
185
185
  formalizedMatches,
186
186
  localPrize: problem.prize,
@@ -207,20 +207,20 @@ export function buildUpstreamDiff() {
207
207
 
208
208
  export function renderUpstreamDiffMarkdown(diff) {
209
209
  const lines = [];
210
- lines.push('# Upstream Diff');
210
+ lines.push('# External Atlas Diff');
211
211
  lines.push('');
212
212
  lines.push(`Snapshot kind: \
213
213
  ${diff.snapshot.kind}`.replace('\
214
214
  ', ''));
215
- lines.push(`Upstream commit: ${diff.snapshot.manifest.upstream_commit ?? '(unknown)'}`);
215
+ lines.push(`Imported commit: ${diff.snapshot.manifest.imported_commit ?? '(unknown)'}`);
216
216
  lines.push(`Fetched at: ${diff.snapshot.manifest.fetched_at}`);
217
217
  lines.push(`Local seeded problems: ${diff.localProblemCount}`);
218
- lines.push(`Upstream total problems: ${diff.upstreamProblemCount}`);
219
- lines.push(`Upstream-only problems not yet locally seeded: ${diff.upstreamOnlyCount}`);
218
+ lines.push(`External atlas total problems: ${diff.upstreamProblemCount}`);
219
+ lines.push(`External-only problems not yet locally seeded: ${diff.upstreamOnlyCount}`);
220
220
  lines.push('');
221
221
  lines.push('## Overlap');
222
222
  lines.push('');
223
- lines.push('| ID | Cluster | Local site | Upstream site | Status | Local formalized | Upstream formalized | Tags |');
223
+ lines.push('| ID | Cluster | Local site | External site | Status | Local formalized | Imported formalized | Tags |');
224
224
  lines.push('| --- | --- | --- | --- | --- | --- | --- | --- |');
225
225
  for (const row of diff.overlaps) {
226
226
  const status = row.statusMatches ? 'match' : 'DIFF';
@@ -235,7 +235,7 @@ ${diff.snapshot.kind}`.replace('\
235
235
  lines.push(`| ${row.problemId} | ${row.cluster} | ${row.localSiteStatus} | ${row.upstreamSiteStatus} | ${status} | ${row.localFormalized ?? '(unset)'} | ${row.upstreamFormalized ?? '(unset)'} | ${tagNotes.join('; ') || 'match'} |`);
236
236
  }
237
237
  lines.push('');
238
- lines.push('## Upstream-Only Preview');
238
+ lines.push('## External-Only Preview');
239
239
  lines.push('');
240
240
  lines.push(diff.upstreamOnlyPreview.join(', ') || '(none)');
241
241
  lines.push('');