erdos-problems 0.1.8 → 0.1.9
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.
- package/AGENT_INTEGRATION.md +25 -0
- package/PROTOCOL.md +36 -0
- package/README.md +29 -0
- package/docs/RESEARCH_LOOP.md +19 -7
- package/package.json +5 -2
- package/src/cli/index.js +5 -0
- package/src/commands/bootstrap.js +3 -0
- package/src/commands/checkpoints.js +2 -0
- package/src/commands/orp.js +58 -0
- package/src/commands/problem.js +7 -1
- package/src/commands/seed.js +4 -0
- package/src/commands/state.js +2 -0
- package/src/commands/workspace.js +4 -0
- package/src/runtime/orp.js +83 -0
- package/src/runtime/paths.js +28 -0
- package/src/runtime/preflight.js +15 -1
- package/src/runtime/workspace.js +8 -0
- package/templates/CLAIM.md +9 -0
- package/templates/FAILED_TOPIC.md +8 -0
- package/templates/VERIFICATION_RECORD.md +10 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ORP Agent Integration
|
|
2
|
+
|
|
3
|
+
Use this when an agent is working inside an `erdos-problems` workspace.
|
|
4
|
+
|
|
5
|
+
## Core Rule
|
|
6
|
+
|
|
7
|
+
Do not let local route progress masquerade as global problem closure.
|
|
8
|
+
|
|
9
|
+
## Minimum Working Loop
|
|
10
|
+
|
|
11
|
+
1. select or seed a problem
|
|
12
|
+
2. sync ORP kit
|
|
13
|
+
3. sync state
|
|
14
|
+
4. run preflight
|
|
15
|
+
5. sync checkpoints
|
|
16
|
+
6. work the next honest move
|
|
17
|
+
|
|
18
|
+
## Canonical Artifact Boundary
|
|
19
|
+
|
|
20
|
+
Evidence belongs in:
|
|
21
|
+
- `problems/<id>/`
|
|
22
|
+
- pack artifacts under `packs/`
|
|
23
|
+
- workspace pulls and scaffolds under `.erdos/`
|
|
24
|
+
|
|
25
|
+
Protocol files and ORP templates are process scaffolding only.
|
package/PROTOCOL.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Open Research Protocol
|
|
2
|
+
|
|
3
|
+
`erdos-problems` ships a bundled ORP kit so every workspace can start with the same claim hygiene and verification frame.
|
|
4
|
+
|
|
5
|
+
## Canonical Truth
|
|
6
|
+
|
|
7
|
+
- Public problem metadata comes from the upstream Erdős snapshot plus the local canonical dossier.
|
|
8
|
+
- Pack context, route packets, and workspace state guide the loop but do not silently upgrade global problem status.
|
|
9
|
+
- ORP process files are protocol tools, not mathematical evidence.
|
|
10
|
+
|
|
11
|
+
## Claim Levels
|
|
12
|
+
|
|
13
|
+
- `Exact`
|
|
14
|
+
- `Verified`
|
|
15
|
+
- `Heuristic`
|
|
16
|
+
- `Conjecture`
|
|
17
|
+
|
|
18
|
+
When unsure, downgrade rather than overclaim.
|
|
19
|
+
|
|
20
|
+
## Required Discipline
|
|
21
|
+
|
|
22
|
+
- keep open problem / active route / route breakthrough / problem solved distinct
|
|
23
|
+
- record verification hooks for exact or verified claims
|
|
24
|
+
- preserve failed paths as useful artifacts, not invisible dead ends
|
|
25
|
+
- keep route claims tied to canonical dossier and pack artifacts
|
|
26
|
+
|
|
27
|
+
## Workspace ORP Kit
|
|
28
|
+
|
|
29
|
+
The CLI syncs this protocol into `.erdos/orp/`:
|
|
30
|
+
- `PROTOCOL.md`
|
|
31
|
+
- `AGENT_INTEGRATION.md`
|
|
32
|
+
- `templates/CLAIM.md`
|
|
33
|
+
- `templates/VERIFICATION_RECORD.md`
|
|
34
|
+
- `templates/FAILED_TOPIC.md`
|
|
35
|
+
|
|
36
|
+
Use `erdos orp sync` to refresh the workspace copy explicitly.
|
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Official binary:
|
|
|
18
18
|
|
|
19
19
|
- atlas layer with canonical local `problems/<id>/problem.yaml` records
|
|
20
20
|
- bundled upstream snapshot from `teorth/erdosproblems`
|
|
21
|
+
- bundled ORP kit with protocol and templates for claim hygiene
|
|
21
22
|
- workspace `.erdos/` state for active-problem selection, upstream refreshes, scaffolds, and pull bundles
|
|
22
23
|
- sunflower cluster as the first deep harness pack
|
|
23
24
|
- quartet-aware sunflower context for `20`, `536`, `856`, and `857`
|
|
@@ -51,6 +52,7 @@ erdos workspace show
|
|
|
51
52
|
|
|
52
53
|
What `bootstrap` does:
|
|
53
54
|
- sets the active workspace problem
|
|
55
|
+
- syncs the bundled ORP workspace kit into `.erdos/orp/`
|
|
54
56
|
- scaffolds the canonical dossier files into `.erdos/scaffolds/<id>/`
|
|
55
57
|
- includes the upstream record when a bundled or workspace snapshot is available
|
|
56
58
|
- copies pack-specific context and compute packets when the problem has them
|
|
@@ -60,6 +62,7 @@ What `seed` does:
|
|
|
60
62
|
- creates a pull bundle for any problem in the upstream snapshot
|
|
61
63
|
- promotes that bundle into `.erdos/seeded-problems/<id>/`
|
|
62
64
|
- auto-selects the problem in the workspace
|
|
65
|
+
- syncs the bundled ORP workspace kit into `.erdos/orp/`
|
|
63
66
|
- syncs the staged research loop state and checkpoint shelf
|
|
64
67
|
- makes the new dossier visible to the atlas commands immediately inside that workspace
|
|
65
68
|
- writes richer starter artifacts:
|
|
@@ -143,6 +146,27 @@ erdos sunflower status 857 --json
|
|
|
143
146
|
- problem-solved distinction
|
|
144
147
|
- compute posture when a packet exists
|
|
145
148
|
|
|
149
|
+
## ORP
|
|
150
|
+
|
|
151
|
+
`erdos-problems` now ships a bundled Open Research Protocol kit:
|
|
152
|
+
- `PROTOCOL.md`
|
|
153
|
+
- `AGENT_INTEGRATION.md`
|
|
154
|
+
- `templates/CLAIM.md`
|
|
155
|
+
- `templates/VERIFICATION_RECORD.md`
|
|
156
|
+
- `templates/FAILED_TOPIC.md`
|
|
157
|
+
|
|
158
|
+
Workspace copy:
|
|
159
|
+
- `.erdos/orp/PROTOCOL.md`
|
|
160
|
+
- `.erdos/orp/AGENT_INTEGRATION.md`
|
|
161
|
+
- `.erdos/orp/templates/`
|
|
162
|
+
|
|
163
|
+
Useful ORP commands:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
erdos orp show
|
|
167
|
+
erdos orp sync
|
|
168
|
+
```
|
|
169
|
+
|
|
146
170
|
## CLI
|
|
147
171
|
|
|
148
172
|
```bash
|
|
@@ -158,6 +182,8 @@ erdos problem artifacts 857 --json
|
|
|
158
182
|
erdos cluster list
|
|
159
183
|
erdos cluster show sunflower
|
|
160
184
|
erdos workspace show
|
|
185
|
+
erdos orp show
|
|
186
|
+
erdos orp sync
|
|
161
187
|
erdos sunflower status 857
|
|
162
188
|
erdos sunflower status --json
|
|
163
189
|
erdos dossier show
|
|
@@ -242,6 +268,9 @@ This runtime writes:
|
|
|
242
268
|
- `.erdos/QUESTION-LEDGER.md`
|
|
243
269
|
- `.erdos/checkpoints/CHECKPOINTS.md`
|
|
244
270
|
- `.erdos/checkpoints/CHECKPOINTS.json`
|
|
271
|
+
- `.erdos/orp/PROTOCOL.md`
|
|
272
|
+
- `.erdos/orp/AGENT_INTEGRATION.md`
|
|
273
|
+
- `.erdos/orp/templates/`
|
|
245
274
|
- `.erdos/registry/preflight/`
|
|
246
275
|
|
|
247
276
|
The public package uses the same status ladder we settled on in the lab:
|
package/docs/RESEARCH_LOOP.md
CHANGED
|
@@ -11,24 +11,29 @@ Workspace runtime files live under `.erdos/`:
|
|
|
11
11
|
- `QUESTION-LEDGER.md`
|
|
12
12
|
- `checkpoints/CHECKPOINTS.md`
|
|
13
13
|
- `checkpoints/CHECKPOINTS.json`
|
|
14
|
+
- `orp/PROTOCOL.md`
|
|
15
|
+
- `orp/AGENT_INTEGRATION.md`
|
|
16
|
+
- `orp/templates/`
|
|
14
17
|
- `registry/preflight/`
|
|
15
18
|
- `registry/compute/`
|
|
16
19
|
|
|
17
20
|
## Core loop
|
|
18
21
|
|
|
19
22
|
1. Select or bootstrap a problem.
|
|
20
|
-
2. Sync
|
|
21
|
-
3.
|
|
22
|
-
4.
|
|
23
|
-
5.
|
|
24
|
-
6.
|
|
25
|
-
7.
|
|
26
|
-
8.
|
|
23
|
+
2. Sync ORP.
|
|
24
|
+
3. Sync state.
|
|
25
|
+
4. Run preflight.
|
|
26
|
+
5. Set continuation mode.
|
|
27
|
+
6. Sync checkpoints.
|
|
28
|
+
7. Pull or scaffold artifacts.
|
|
29
|
+
8. Work the active route.
|
|
30
|
+
9. Sync checkpoints again at honest boundaries.
|
|
27
31
|
|
|
28
32
|
## Commands
|
|
29
33
|
|
|
30
34
|
```bash
|
|
31
35
|
erdos problem use 857
|
|
36
|
+
erdos orp sync
|
|
32
37
|
erdos state sync
|
|
33
38
|
erdos preflight
|
|
34
39
|
erdos continuation use route
|
|
@@ -52,6 +57,13 @@ The seeded dossier now also includes starter-loop artifacts:
|
|
|
52
57
|
- `ROUTES.md`
|
|
53
58
|
- `CHECKPOINT_NOTES.md`
|
|
54
59
|
|
|
60
|
+
The ORP kit travels with the workspace too:
|
|
61
|
+
- `PROTOCOL.md`
|
|
62
|
+
- `AGENT_INTEGRATION.md`
|
|
63
|
+
- `templates/CLAIM.md`
|
|
64
|
+
- `templates/VERIFICATION_RECORD.md`
|
|
65
|
+
- `templates/FAILED_TOPIC.md`
|
|
66
|
+
|
|
55
67
|
## Status ladder
|
|
56
68
|
|
|
57
69
|
The public package uses the same ladder we converged on in the lab:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erdos-problems",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "CLI atlas and staged research harness for Paul Erdos problems.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"README.md",
|
|
11
11
|
"LICENSE",
|
|
12
|
+
"PROTOCOL.md",
|
|
13
|
+
"AGENT_INTEGRATION.md",
|
|
12
14
|
"bin",
|
|
13
15
|
"data",
|
|
14
16
|
"docs",
|
|
15
17
|
"packs",
|
|
16
18
|
"problems",
|
|
17
|
-
"src"
|
|
19
|
+
"src",
|
|
20
|
+
"templates"
|
|
18
21
|
],
|
|
19
22
|
"scripts": {
|
|
20
23
|
"test": "node --test",
|
package/src/cli/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { runClusterCommand } from '../commands/cluster.js';
|
|
|
4
4
|
import { runContinuationCommand } from '../commands/continuation.js';
|
|
5
5
|
import { runDossierCommand } from '../commands/dossier.js';
|
|
6
6
|
import { runMaintainerCommand } from '../commands/maintainer.js';
|
|
7
|
+
import { runOrpCommand } from '../commands/orp.js';
|
|
7
8
|
import { runPreflightCommand } from '../commands/preflight.js';
|
|
8
9
|
import { runProblemCommand } from '../commands/problem.js';
|
|
9
10
|
import { runPullCommand } from '../commands/pull.js';
|
|
@@ -26,6 +27,8 @@ function printUsage() {
|
|
|
26
27
|
console.log(' erdos cluster list');
|
|
27
28
|
console.log(' erdos cluster show <name>');
|
|
28
29
|
console.log(' erdos workspace show');
|
|
30
|
+
console.log(' erdos orp show [--json]');
|
|
31
|
+
console.log(' erdos orp sync [--json]');
|
|
29
32
|
console.log(' erdos state sync [--json]');
|
|
30
33
|
console.log(' erdos state show [--json]');
|
|
31
34
|
console.log(' erdos continuation show [--json]');
|
|
@@ -59,6 +62,8 @@ if (!command || command === 'help' || command === '--help') {
|
|
|
59
62
|
exitCode = runClusterCommand(rest);
|
|
60
63
|
} else if (command === 'workspace') {
|
|
61
64
|
exitCode = runWorkspaceCommand(rest);
|
|
65
|
+
} else if (command === 'orp') {
|
|
66
|
+
exitCode = runOrpCommand(rest);
|
|
62
67
|
} else if (command === 'state') {
|
|
63
68
|
exitCode = runStateCommand(rest);
|
|
64
69
|
} else if (command === 'continuation') {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { getProblem } from '../atlas/catalog.js';
|
|
3
3
|
import { syncCheckpoints } from '../runtime/checkpoints.js';
|
|
4
|
+
import { syncOrpWorkspaceKit } from '../runtime/orp.js';
|
|
4
5
|
import { scaffoldProblem } from '../runtime/problem-artifacts.js';
|
|
5
6
|
import { getWorkspaceProblemScaffoldDir } from '../runtime/paths.js';
|
|
6
7
|
import { syncState } from '../runtime/state.js';
|
|
@@ -68,6 +69,7 @@ export async function runBootstrapCommand(args) {
|
|
|
68
69
|
console.log(`Workspace upstream snapshot refreshed: ${syncResult.workspacePaths.manifestPath}`);
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
const orp = syncOrpWorkspaceKit();
|
|
71
73
|
setCurrentProblem(problem.problemId);
|
|
72
74
|
const destination = parsed.destination
|
|
73
75
|
? path.resolve(parsed.destination)
|
|
@@ -81,6 +83,7 @@ export async function runBootstrapCommand(args) {
|
|
|
81
83
|
console.log(`Active route: ${state.activeRoute ?? '(none)'}`);
|
|
82
84
|
console.log(`Scaffold dir: ${result.destination}`);
|
|
83
85
|
console.log(`Artifacts copied: ${result.copiedArtifacts.length}`);
|
|
86
|
+
console.log(`ORP protocol: ${orp.protocolPath}`);
|
|
84
87
|
console.log(`Upstream record included: ${result.inventory.upstreamRecordIncluded ? 'yes' : 'no'}`);
|
|
85
88
|
console.log(`Checkpoint shelf: ${checkpoints.indexPath}`);
|
|
86
89
|
console.log(`Next honest move: ${state.nextHonestMove}`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { syncCheckpoints } from '../runtime/checkpoints.js';
|
|
2
|
+
import { syncOrpWorkspaceKit } from '../runtime/orp.js';
|
|
2
3
|
|
|
3
4
|
export function runCheckpointsCommand(args) {
|
|
4
5
|
const [subcommand, ...rest] = args;
|
|
@@ -21,6 +22,7 @@ export function runCheckpointsCommand(args) {
|
|
|
21
22
|
return 1;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
syncOrpWorkspaceKit();
|
|
24
26
|
const result = syncCheckpoints();
|
|
25
27
|
if (asJson) {
|
|
26
28
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getOrpStatus, syncOrpWorkspaceKit } from '../runtime/orp.js';
|
|
2
|
+
|
|
3
|
+
function printOrpStatus(status) {
|
|
4
|
+
console.log('Open Research Protocol');
|
|
5
|
+
console.log(`Workspace root: ${status.workspaceRoot}`);
|
|
6
|
+
console.log(`Bundled protocol: ${status.bundled.protocolPresent ? status.bundled.protocolPath : '(missing)'}`);
|
|
7
|
+
console.log(`Bundled integration: ${status.bundled.integrationPresent ? status.bundled.integrationPath : '(missing)'}`);
|
|
8
|
+
console.log(`Bundled templates: ${status.bundled.templateNames.join(', ') || '(none)'}`);
|
|
9
|
+
console.log(`Workspace ORP dir: ${status.workspace.orpDir}`);
|
|
10
|
+
console.log(`Workspace protocol: ${status.workspace.protocolPresent ? status.workspace.protocolPath : '(missing)'}`);
|
|
11
|
+
console.log(`Workspace integration: ${status.workspace.integrationPresent ? status.workspace.integrationPath : '(missing)'}`);
|
|
12
|
+
console.log(`Workspace templates: ${status.workspace.templateNames.join(', ') || '(none)'}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function runOrpCommand(args) {
|
|
16
|
+
const [subcommand, ...rest] = args;
|
|
17
|
+
const asJson = rest.includes('--json');
|
|
18
|
+
const unknown = rest.filter((arg) => arg !== '--json');
|
|
19
|
+
|
|
20
|
+
if (!subcommand || subcommand === 'help' || subcommand === '--help') {
|
|
21
|
+
console.log('Usage:');
|
|
22
|
+
console.log(' erdos orp show [--json]');
|
|
23
|
+
console.log(' erdos orp sync [--json]');
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (unknown.length > 0) {
|
|
28
|
+
console.error(`Unknown orp option: ${unknown[0]}`);
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (subcommand === 'show') {
|
|
33
|
+
const status = getOrpStatus();
|
|
34
|
+
if (asJson) {
|
|
35
|
+
console.log(JSON.stringify(status, null, 2));
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
printOrpStatus(status);
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (subcommand === 'sync') {
|
|
43
|
+
const result = syncOrpWorkspaceKit();
|
|
44
|
+
if (asJson) {
|
|
45
|
+
console.log(JSON.stringify(result, null, 2));
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
console.log('ORP workspace kit synced');
|
|
49
|
+
console.log(`Workspace ORP dir: ${result.orpDir}`);
|
|
50
|
+
console.log(`Protocol: ${result.protocolPath}`);
|
|
51
|
+
console.log(`Agent integration: ${result.integrationPath}`);
|
|
52
|
+
console.log(`Templates: ${result.templateNames.join(', ') || '(none)'}`);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.error(`Unknown orp subcommand: ${subcommand}`);
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
package/src/commands/problem.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { getProblem, listProblems } from '../atlas/catalog.js';
|
|
2
|
+
import { syncOrpWorkspaceKit } from '../runtime/orp.js';
|
|
3
|
+
import { syncCheckpoints } from '../runtime/checkpoints.js';
|
|
2
4
|
import { getProblemArtifactInventory } from '../runtime/problem-artifacts.js';
|
|
3
5
|
import { syncState } from '../runtime/state.js';
|
|
4
6
|
import { readCurrentProblem, setCurrentProblem } from '../runtime/workspace.js';
|
|
@@ -207,10 +209,14 @@ export function runProblemCommand(args) {
|
|
|
207
209
|
return 1;
|
|
208
210
|
}
|
|
209
211
|
setCurrentProblem(problem.problemId);
|
|
210
|
-
|
|
212
|
+
syncOrpWorkspaceKit();
|
|
213
|
+
syncState();
|
|
214
|
+
const checkpointResult = syncCheckpoints();
|
|
215
|
+
const state = checkpointResult.state;
|
|
211
216
|
console.log(`Active problem set to ${problem.problemId} (${problem.title})`);
|
|
212
217
|
console.log(`Active route: ${state.activeRoute ?? '(none)'}`);
|
|
213
218
|
console.log(`Next honest move: ${state.nextHonestMove}`);
|
|
219
|
+
console.log(`Checkpoint shelf: ${checkpointResult.indexPath}`);
|
|
214
220
|
return 0;
|
|
215
221
|
}
|
|
216
222
|
|
package/src/commands/seed.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { getProblem } from '../atlas/catalog.js';
|
|
3
3
|
import { syncCheckpoints } from '../runtime/checkpoints.js';
|
|
4
4
|
import { seedProblemFromPullBundle } from '../runtime/maintainer-seed.js';
|
|
5
|
+
import { syncOrpWorkspaceKit } from '../runtime/orp.js';
|
|
5
6
|
import { getWorkspaceProblemPullDir, getWorkspaceRoot, getWorkspaceSeededProblemsDir } from '../runtime/paths.js';
|
|
6
7
|
import { syncState } from '../runtime/state.js';
|
|
7
8
|
import { readCurrentProblem, setCurrentProblem } from '../runtime/workspace.js';
|
|
@@ -166,6 +167,7 @@ export async function runSeedCommand(args) {
|
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
const workspaceRoot = getWorkspaceRoot();
|
|
170
|
+
const orp = syncOrpWorkspaceKit(workspaceRoot);
|
|
169
171
|
const pullDir = getWorkspaceProblemPullDir(parsed.problemId, workspaceRoot);
|
|
170
172
|
const defaultSeedRoot = getWorkspaceSeededProblemsDir(workspaceRoot);
|
|
171
173
|
const destinationRoot = parsed.destRoot
|
|
@@ -232,6 +234,7 @@ export async function runSeedCommand(args) {
|
|
|
232
234
|
usedUpstreamRecord: result.usedUpstreamRecord,
|
|
233
235
|
usedSiteSnapshot: result.usedSiteSnapshot,
|
|
234
236
|
workspaceOverlayVisible: seedsIntoWorkspaceOverlay,
|
|
237
|
+
orpProtocol: orp.protocolPath,
|
|
235
238
|
};
|
|
236
239
|
|
|
237
240
|
if (parsed.asJson) {
|
|
@@ -247,6 +250,7 @@ export async function runSeedCommand(args) {
|
|
|
247
250
|
console.log(`Harness depth: ${result.record.harness.depth}`);
|
|
248
251
|
console.log(`Upstream record used: ${result.usedUpstreamRecord ? 'yes' : 'no'}`);
|
|
249
252
|
console.log(`Site snapshot used: ${result.usedSiteSnapshot ? 'yes' : 'no'}`);
|
|
253
|
+
console.log(`ORP protocol: ${orp.protocolPath}`);
|
|
250
254
|
console.log(`Workspace overlay visible: ${seedsIntoWorkspaceOverlay ? 'yes' : 'no'}`);
|
|
251
255
|
console.log(`Activated: ${activated ? 'yes' : 'no'}`);
|
|
252
256
|
console.log(`Loop synced: ${loopSynced ? 'yes' : 'no'}`);
|
package/src/commands/state.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getWorkspaceQuestionLedgerPath, getWorkspaceStateMarkdownPath } from '../runtime/paths.js';
|
|
2
|
+
import { syncOrpWorkspaceKit } from '../runtime/orp.js';
|
|
2
3
|
import { loadState, syncState } from '../runtime/state.js';
|
|
3
4
|
|
|
4
5
|
function printState(state) {
|
|
@@ -33,6 +34,7 @@ export function runStateCommand(args) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
if (subcommand === 'sync') {
|
|
37
|
+
syncOrpWorkspaceKit();
|
|
36
38
|
const state = syncState();
|
|
37
39
|
if (asJson) {
|
|
38
40
|
console.log(JSON.stringify(state, null, 2));
|
|
@@ -28,6 +28,10 @@ export function runWorkspaceCommand(args) {
|
|
|
28
28
|
console.log(`State markdown: ${summary.stateMarkdownPath}`);
|
|
29
29
|
console.log(`Question ledger: ${summary.questionLedgerPath}`);
|
|
30
30
|
console.log(`Checkpoint shelf: ${summary.checkpointIndexPath}`);
|
|
31
|
+
console.log(`Workspace ORP dir: ${summary.orpDir}`);
|
|
32
|
+
console.log(`Workspace ORP protocol: ${summary.orpProtocolPath}`);
|
|
33
|
+
console.log(`Workspace ORP integration: ${summary.orpIntegrationPath}`);
|
|
34
|
+
console.log(`Workspace ORP templates: ${summary.orpTemplatesDir}`);
|
|
31
35
|
console.log(`Workspace upstream dir: ${summary.upstreamDir}`);
|
|
32
36
|
console.log(`Workspace seeded-problems dir: ${summary.seededProblemsDir}`);
|
|
33
37
|
console.log(`Workspace scaffold dir: ${summary.scaffoldDir}`);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { copyFileIfPresent, ensureDir } from './files.js';
|
|
4
|
+
import {
|
|
5
|
+
getBundledOrpIntegrationPath,
|
|
6
|
+
getBundledOrpProtocolPath,
|
|
7
|
+
getBundledOrpTemplatesDir,
|
|
8
|
+
getWorkspaceOrpDir,
|
|
9
|
+
getWorkspaceOrpIntegrationPath,
|
|
10
|
+
getWorkspaceOrpProtocolPath,
|
|
11
|
+
getWorkspaceOrpTemplatesDir,
|
|
12
|
+
getWorkspaceRoot,
|
|
13
|
+
} from './paths.js';
|
|
14
|
+
|
|
15
|
+
function listTemplateNames(rootDir) {
|
|
16
|
+
if (!fs.existsSync(rootDir)) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
return fs
|
|
20
|
+
.readdirSync(rootDir, { withFileTypes: true })
|
|
21
|
+
.filter((entry) => entry.isFile())
|
|
22
|
+
.map((entry) => entry.name)
|
|
23
|
+
.sort();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getOrpStatus(workspaceRoot = getWorkspaceRoot()) {
|
|
27
|
+
const bundledTemplatesDir = getBundledOrpTemplatesDir();
|
|
28
|
+
const workspaceTemplatesDir = getWorkspaceOrpTemplatesDir(workspaceRoot);
|
|
29
|
+
const bundledTemplateNames = listTemplateNames(bundledTemplatesDir);
|
|
30
|
+
const workspaceTemplateNames = listTemplateNames(workspaceTemplatesDir);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
workspaceRoot,
|
|
34
|
+
bundled: {
|
|
35
|
+
protocolPath: getBundledOrpProtocolPath(),
|
|
36
|
+
integrationPath: getBundledOrpIntegrationPath(),
|
|
37
|
+
templatesDir: bundledTemplatesDir,
|
|
38
|
+
protocolPresent: fs.existsSync(getBundledOrpProtocolPath()),
|
|
39
|
+
integrationPresent: fs.existsSync(getBundledOrpIntegrationPath()),
|
|
40
|
+
templateNames: bundledTemplateNames,
|
|
41
|
+
},
|
|
42
|
+
workspace: {
|
|
43
|
+
orpDir: getWorkspaceOrpDir(workspaceRoot),
|
|
44
|
+
protocolPath: getWorkspaceOrpProtocolPath(workspaceRoot),
|
|
45
|
+
integrationPath: getWorkspaceOrpIntegrationPath(workspaceRoot),
|
|
46
|
+
templatesDir: workspaceTemplatesDir,
|
|
47
|
+
protocolPresent: fs.existsSync(getWorkspaceOrpProtocolPath(workspaceRoot)),
|
|
48
|
+
integrationPresent: fs.existsSync(getWorkspaceOrpIntegrationPath(workspaceRoot)),
|
|
49
|
+
templateNames: workspaceTemplateNames,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function syncOrpWorkspaceKit(workspaceRoot = getWorkspaceRoot()) {
|
|
55
|
+
const workspaceOrpDir = getWorkspaceOrpDir(workspaceRoot);
|
|
56
|
+
const workspaceTemplatesDir = getWorkspaceOrpTemplatesDir(workspaceRoot);
|
|
57
|
+
ensureDir(workspaceOrpDir);
|
|
58
|
+
ensureDir(workspaceTemplatesDir);
|
|
59
|
+
|
|
60
|
+
copyFileIfPresent(getBundledOrpProtocolPath(), getWorkspaceOrpProtocolPath(workspaceRoot));
|
|
61
|
+
copyFileIfPresent(getBundledOrpIntegrationPath(), getWorkspaceOrpIntegrationPath(workspaceRoot));
|
|
62
|
+
|
|
63
|
+
const bundledTemplatesDir = getBundledOrpTemplatesDir();
|
|
64
|
+
const copiedTemplates = [];
|
|
65
|
+
for (const templateName of listTemplateNames(bundledTemplatesDir)) {
|
|
66
|
+
const sourcePath = path.join(bundledTemplatesDir, templateName);
|
|
67
|
+
const destinationPath = path.join(workspaceTemplatesDir, templateName);
|
|
68
|
+
if (copyFileIfPresent(sourcePath, destinationPath)) {
|
|
69
|
+
copiedTemplates.push(templateName);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const status = getOrpStatus(workspaceRoot);
|
|
74
|
+
return {
|
|
75
|
+
workspaceRoot,
|
|
76
|
+
orpDir: workspaceOrpDir,
|
|
77
|
+
protocolPath: status.workspace.protocolPath,
|
|
78
|
+
integrationPath: status.workspace.integrationPath,
|
|
79
|
+
templatesDir: status.workspace.templatesDir,
|
|
80
|
+
templateNames: status.workspace.templateNames,
|
|
81
|
+
copiedTemplates,
|
|
82
|
+
};
|
|
83
|
+
}
|
package/src/runtime/paths.js
CHANGED
|
@@ -12,6 +12,22 @@ export function getWorkspaceDir(workspaceRoot = getWorkspaceRoot()) {
|
|
|
12
12
|
return path.join(workspaceRoot, '.erdos');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export function getWorkspaceOrpDir(workspaceRoot = getWorkspaceRoot()) {
|
|
16
|
+
return path.join(getWorkspaceDir(workspaceRoot), 'orp');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getWorkspaceOrpProtocolPath(workspaceRoot = getWorkspaceRoot()) {
|
|
20
|
+
return path.join(getWorkspaceOrpDir(workspaceRoot), 'PROTOCOL.md');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getWorkspaceOrpIntegrationPath(workspaceRoot = getWorkspaceRoot()) {
|
|
24
|
+
return path.join(getWorkspaceOrpDir(workspaceRoot), 'AGENT_INTEGRATION.md');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getWorkspaceOrpTemplatesDir(workspaceRoot = getWorkspaceRoot()) {
|
|
28
|
+
return path.join(getWorkspaceOrpDir(workspaceRoot), 'templates');
|
|
29
|
+
}
|
|
30
|
+
|
|
15
31
|
export function getWorkspaceConfigPath(workspaceRoot = getWorkspaceRoot()) {
|
|
16
32
|
return path.join(getWorkspaceDir(workspaceRoot), 'config.json');
|
|
17
33
|
}
|
|
@@ -128,6 +144,18 @@ export function getBundledDataDir() {
|
|
|
128
144
|
return path.join(repoRoot, 'data');
|
|
129
145
|
}
|
|
130
146
|
|
|
147
|
+
export function getBundledOrpProtocolPath() {
|
|
148
|
+
return path.join(repoRoot, 'PROTOCOL.md');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function getBundledOrpIntegrationPath() {
|
|
152
|
+
return path.join(repoRoot, 'AGENT_INTEGRATION.md');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function getBundledOrpTemplatesDir() {
|
|
156
|
+
return path.join(repoRoot, 'templates');
|
|
157
|
+
}
|
|
158
|
+
|
|
131
159
|
export function getBundledUpstreamDir() {
|
|
132
160
|
return path.join(getBundledDataDir(), 'upstream', 'erdosproblems');
|
|
133
161
|
}
|
package/src/runtime/preflight.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
getWorkspaceStatePath,
|
|
16
16
|
} from './paths.js';
|
|
17
17
|
import { getProblemArtifactInventory } from './problem-artifacts.js';
|
|
18
|
+
import { getOrpStatus } from './orp.js';
|
|
18
19
|
import { syncState } from './state.js';
|
|
19
20
|
|
|
20
21
|
function checkpointPath(workspaceRoot) {
|
|
@@ -27,6 +28,7 @@ export function buildPreflightReport(options = {}, workspaceRoot = getWorkspaceR
|
|
|
27
28
|
const state = syncState(workspaceRoot);
|
|
28
29
|
const problem = state.activeProblem ? getProblem(state.activeProblem) : null;
|
|
29
30
|
const inventory = problem ? getProblemArtifactInventory(problem) : null;
|
|
31
|
+
const orp = getOrpStatus(workspaceRoot);
|
|
30
32
|
const git = gitSummary(workspaceRoot);
|
|
31
33
|
|
|
32
34
|
const checks = {
|
|
@@ -54,6 +56,18 @@ export function buildPreflightReport(options = {}, workspaceRoot = getWorkspaceR
|
|
|
54
56
|
ok: fileExists(checkpointPath(workspaceRoot)),
|
|
55
57
|
detail: checkpointPath(workspaceRoot),
|
|
56
58
|
},
|
|
59
|
+
orpProtocol: {
|
|
60
|
+
ok: orp.workspace.protocolPresent,
|
|
61
|
+
detail: orp.workspace.protocolPath,
|
|
62
|
+
},
|
|
63
|
+
orpIntegration: {
|
|
64
|
+
ok: orp.workspace.integrationPresent,
|
|
65
|
+
detail: orp.workspace.integrationPath,
|
|
66
|
+
},
|
|
67
|
+
orpTemplates: {
|
|
68
|
+
ok: orp.workspace.templateNames.length >= 3,
|
|
69
|
+
detail: `${orp.workspace.templateNames.length} template(s)`,
|
|
70
|
+
},
|
|
57
71
|
activeProblem: {
|
|
58
72
|
ok: Boolean(problem),
|
|
59
73
|
detail: problem ? `${problem.problemId} (${problem.title})` : '(none)',
|
|
@@ -79,7 +93,7 @@ export function buildPreflightReport(options = {}, workspaceRoot = getWorkspaceR
|
|
|
79
93
|
let verdict = 'ok';
|
|
80
94
|
if (!checks.erdosRuntime.ok || !checks.configFile.ok || !checks.stateFile.ok || !checks.activeProblem.ok || !checks.canonicalDossier.ok || !checks.upstreamSnapshot.ok) {
|
|
81
95
|
verdict = 'blocked';
|
|
82
|
-
} else if (!checks.questionLedger.ok || !checks.checkpointShelf.ok || !checks.activeRoute.ok || !checks.workspaceGit.ok) {
|
|
96
|
+
} else if (!checks.questionLedger.ok || !checks.checkpointShelf.ok || !checks.orpProtocol.ok || !checks.orpIntegration.ok || !checks.orpTemplates.ok || !checks.activeRoute.ok || !checks.workspaceGit.ok) {
|
|
83
97
|
verdict = 'needs_attention';
|
|
84
98
|
}
|
|
85
99
|
|
package/src/runtime/workspace.js
CHANGED
|
@@ -4,6 +4,10 @@ import {
|
|
|
4
4
|
getWorkspaceCheckpointIndexPath,
|
|
5
5
|
getWorkspaceConfigPath,
|
|
6
6
|
getWorkspaceDir,
|
|
7
|
+
getWorkspaceOrpDir,
|
|
8
|
+
getWorkspaceOrpIntegrationPath,
|
|
9
|
+
getWorkspaceOrpProtocolPath,
|
|
10
|
+
getWorkspaceOrpTemplatesDir,
|
|
7
11
|
getWorkspaceProblemArtifactDir,
|
|
8
12
|
getWorkspaceProblemLiteratureDir,
|
|
9
13
|
getWorkspaceProblemPullDir,
|
|
@@ -78,6 +82,10 @@ export function getWorkspaceSummary(workspaceRoot = getWorkspaceRoot()) {
|
|
|
78
82
|
stateMarkdownPath: getWorkspaceStateMarkdownPath(workspaceRoot),
|
|
79
83
|
questionLedgerPath: getWorkspaceQuestionLedgerPath(workspaceRoot),
|
|
80
84
|
checkpointIndexPath: getWorkspaceCheckpointIndexPath(workspaceRoot),
|
|
85
|
+
orpDir: getWorkspaceOrpDir(workspaceRoot),
|
|
86
|
+
orpProtocolPath: getWorkspaceOrpProtocolPath(workspaceRoot),
|
|
87
|
+
orpIntegrationPath: getWorkspaceOrpIntegrationPath(workspaceRoot),
|
|
88
|
+
orpTemplatesDir: getWorkspaceOrpTemplatesDir(workspaceRoot),
|
|
81
89
|
upstreamDir: getWorkspaceUpstreamDir(workspaceRoot),
|
|
82
90
|
seededProblemsDir: getWorkspaceSeededProblemsDir(workspaceRoot),
|
|
83
91
|
scaffoldDir: activeProblem ? getWorkspaceProblemScaffoldDir(activeProblem, workspaceRoot) : getWorkspaceProblemScaffoldDir('<problem-id>', workspaceRoot),
|