erdos-problems 0.1.4 → 0.1.6

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 (40) hide show
  1. package/README.md +103 -13
  2. package/docs/ERDOS_PROBLEMS_PROBLEM_SCHEMA.md +65 -60
  3. package/docs/ERDOS_PROBLEMS_REPO_SPEC.md +97 -214
  4. package/docs/RESEARCH_LOOP.md +47 -0
  5. package/package.json +1 -1
  6. package/packs/sunflower/README.md +6 -4
  7. package/packs/sunflower/compute/20/u3_uniform_transfer_window_v0.yaml +16 -0
  8. package/packs/sunflower/problems/20/CONTEXT.md +14 -0
  9. package/packs/sunflower/problems/20/context.yaml +31 -0
  10. package/packs/sunflower/problems/536/CONTEXT.md +9 -0
  11. package/packs/sunflower/problems/536/context.yaml +17 -0
  12. package/packs/sunflower/problems/856/CONTEXT.md +9 -0
  13. package/packs/sunflower/problems/856/context.yaml +17 -0
  14. package/packs/sunflower/problems/857/CONTEXT.md +14 -0
  15. package/packs/sunflower/problems/857/context.yaml +32 -0
  16. package/problems/20/problem.yaml +8 -2
  17. package/problems/536/problem.yaml +9 -3
  18. package/problems/856/problem.yaml +9 -3
  19. package/src/cli/index.js +24 -0
  20. package/src/commands/bootstrap.js +7 -0
  21. package/src/commands/checkpoints.js +36 -0
  22. package/src/commands/continuation.js +60 -0
  23. package/src/commands/maintainer.js +182 -0
  24. package/src/commands/preflight.js +44 -0
  25. package/src/commands/problem.js +10 -0
  26. package/src/commands/pull.js +192 -41
  27. package/src/commands/state.js +57 -0
  28. package/src/commands/sunflower.js +12 -0
  29. package/src/commands/workspace.js +22 -0
  30. package/src/runtime/checkpoints.js +208 -0
  31. package/src/runtime/config.js +37 -0
  32. package/src/runtime/continuation.js +65 -0
  33. package/src/runtime/git.js +52 -0
  34. package/src/runtime/maintainer-seed.js +294 -0
  35. package/src/runtime/paths.js +75 -27
  36. package/src/runtime/preflight.js +106 -0
  37. package/src/runtime/problem-artifacts.js +63 -1
  38. package/src/runtime/state.js +269 -0
  39. package/src/runtime/sunflower.js +126 -6
  40. package/src/runtime/workspace.js +42 -22
@@ -1,55 +1,61 @@
1
1
  import fs from 'node:fs';
2
2
  import {
3
3
  getCurrentProblemPath,
4
+ getWorkspaceCheckpointIndexPath,
5
+ getWorkspaceConfigPath,
4
6
  getWorkspaceDir,
7
+ getWorkspaceProblemArtifactDir,
8
+ getWorkspaceProblemLiteratureDir,
5
9
  getWorkspaceProblemPullDir,
6
10
  getWorkspaceProblemScaffoldDir,
11
+ getWorkspaceQuestionLedgerPath,
7
12
  getWorkspaceRoot,
13
+ getWorkspaceStateMarkdownPath,
8
14
  getWorkspaceStatePath,
9
15
  getWorkspaceUpstreamDir,
10
16
  } from './paths.js';
11
17
  import { writeJson } from './files.js';
12
18
 
13
- export function readWorkspaceState() {
14
- const filePath = getWorkspaceStatePath();
19
+ export function readWorkspaceState(workspaceRoot = getWorkspaceRoot()) {
20
+ const filePath = getWorkspaceStatePath(workspaceRoot);
15
21
  if (!fs.existsSync(filePath)) {
16
22
  return null;
17
23
  }
18
24
  return JSON.parse(fs.readFileSync(filePath, 'utf8'));
19
25
  }
20
26
 
21
- export function ensureWorkspaceState() {
22
- const existing = readWorkspaceState();
27
+ export function ensureWorkspaceState(workspaceRoot = getWorkspaceRoot()) {
28
+ const existing = readWorkspaceState(workspaceRoot);
23
29
  if (existing) {
24
30
  return existing;
25
31
  }
26
32
  const now = new Date().toISOString();
27
33
  const state = {
28
- workspaceRoot: getWorkspaceRoot(),
34
+ workspaceRoot,
29
35
  createdAt: now,
30
36
  updatedAt: now,
31
37
  };
32
- writeJson(getWorkspaceStatePath(), state);
38
+ writeJson(getWorkspaceStatePath(workspaceRoot), state);
33
39
  return state;
34
40
  }
35
41
 
36
- export function setCurrentProblem(problemId) {
37
- const existing = ensureWorkspaceState();
42
+ export function setCurrentProblem(problemId, workspaceRoot = getWorkspaceRoot()) {
43
+ const existing = ensureWorkspaceState(workspaceRoot);
38
44
  const now = new Date().toISOString();
39
- writeJson(getCurrentProblemPath(), {
45
+ writeJson(getCurrentProblemPath(workspaceRoot), {
40
46
  problemId: String(problemId),
41
47
  selectedAt: now,
42
48
  });
43
- writeJson(getWorkspaceStatePath(), {
44
- workspaceRoot: getWorkspaceRoot(),
45
- createdAt: existing.createdAt ?? now,
49
+ writeJson(getWorkspaceStatePath(workspaceRoot), {
50
+ ...existing,
51
+ workspaceRoot,
46
52
  updatedAt: now,
47
53
  activeProblem: String(problemId),
48
54
  });
49
55
  }
50
56
 
51
- export function readCurrentProblem() {
52
- const filePath = getCurrentProblemPath();
57
+ export function readCurrentProblem(workspaceRoot = getWorkspaceRoot()) {
58
+ const filePath = getCurrentProblemPath(workspaceRoot);
53
59
  if (!fs.existsSync(filePath)) {
54
60
  return null;
55
61
  }
@@ -57,17 +63,31 @@ export function readCurrentProblem() {
57
63
  return payload.problemId ?? null;
58
64
  }
59
65
 
60
- export function getWorkspaceSummary() {
61
- const state = readWorkspaceState();
62
- const activeProblem = readCurrentProblem();
66
+ export function getWorkspaceSummary(workspaceRoot = getWorkspaceRoot()) {
67
+ const state = readWorkspaceState(workspaceRoot);
68
+ const activeProblem = readCurrentProblem(workspaceRoot);
63
69
  return {
64
- workspaceRoot: getWorkspaceRoot(),
65
- stateDir: getWorkspaceDir(),
70
+ workspaceRoot,
71
+ stateDir: getWorkspaceDir(workspaceRoot),
66
72
  hasState: Boolean(state),
67
73
  activeProblem,
68
- upstreamDir: getWorkspaceUpstreamDir(),
69
- scaffoldDir: activeProblem ? getWorkspaceProblemScaffoldDir(activeProblem) : getWorkspaceProblemScaffoldDir('<problem-id>'),
70
- pullDir: activeProblem ? getWorkspaceProblemPullDir(activeProblem) : getWorkspaceProblemPullDir('<problem-id>'),
74
+ configPath: getWorkspaceConfigPath(workspaceRoot),
75
+ statePath: getWorkspaceStatePath(workspaceRoot),
76
+ stateMarkdownPath: getWorkspaceStateMarkdownPath(workspaceRoot),
77
+ questionLedgerPath: getWorkspaceQuestionLedgerPath(workspaceRoot),
78
+ checkpointIndexPath: getWorkspaceCheckpointIndexPath(workspaceRoot),
79
+ upstreamDir: getWorkspaceUpstreamDir(workspaceRoot),
80
+ scaffoldDir: activeProblem ? getWorkspaceProblemScaffoldDir(activeProblem, workspaceRoot) : getWorkspaceProblemScaffoldDir('<problem-id>', workspaceRoot),
81
+ pullDir: activeProblem ? getWorkspaceProblemPullDir(activeProblem, workspaceRoot) : getWorkspaceProblemPullDir('<problem-id>', workspaceRoot),
82
+ artifactDir: activeProblem ? getWorkspaceProblemArtifactDir(activeProblem, workspaceRoot) : getWorkspaceProblemArtifactDir('<problem-id>', workspaceRoot),
83
+ literatureDir: activeProblem ? getWorkspaceProblemLiteratureDir(activeProblem, workspaceRoot) : getWorkspaceProblemLiteratureDir('<problem-id>', workspaceRoot),
71
84
  updatedAt: state?.updatedAt ?? null,
85
+ continuationMode: state?.continuation?.mode ?? null,
86
+ activeRoute: state?.activeRoute ?? null,
87
+ routeBreakthrough: state?.routeBreakthrough ?? false,
88
+ problemSolved: state?.problemSolved ?? false,
89
+ currentFrontier: state?.currentFrontier ?? null,
90
+ nextHonestMove: state?.nextHonestMove ?? null,
91
+ lastCheckpointSyncAt: state?.lastCheckpointSyncAt ?? null,
72
92
  };
73
93
  }