@vela-science/canopus 0.7.0 → 0.8.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 (94) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +67 -145
  3. package/capsules/erdos1056-k15/bin/linux-arm64/{10428801-10429000 → 10429201-10429400}/verifier +0 -0
  4. package/capsules/erdos1056-k15/bin/linux-x86_64/{10428801-10429000 → 10429201-10429400}/verifier +0 -0
  5. package/compatibility.json +25 -0
  6. package/dist/src/{receipt/map.d.ts → candidate/finalize.d.ts} +2 -9
  7. package/dist/src/candidate/finalize.js +71 -0
  8. package/dist/src/cli.js +89 -195
  9. package/dist/src/contracts/mission.d.ts +1 -13
  10. package/dist/src/contracts/mission.js +4 -42
  11. package/dist/src/contracts/validation.d.ts +1 -25
  12. package/dist/src/contracts/validation.js +1 -95
  13. package/dist/src/engines/codex-tools-native.js +2 -2
  14. package/dist/src/index.d.ts +5 -34
  15. package/dist/src/index.js +4 -34
  16. package/dist/src/mission/prepare.d.ts +10 -1
  17. package/dist/src/mission/prepare.js +29 -30
  18. package/dist/src/product/coverage.d.ts +17 -0
  19. package/dist/src/product/coverage.js +137 -0
  20. package/dist/src/product/doctor.d.ts +1 -2
  21. package/dist/src/product/doctor.js +29 -8
  22. package/dist/src/product/profile.js +8 -2
  23. package/dist/src/product/replay.js +11 -12
  24. package/dist/src/product/run.d.ts +5 -9
  25. package/dist/src/product/run.js +17 -81
  26. package/dist/src/product/submission.d.ts +40 -0
  27. package/dist/src/product/submission.js +217 -0
  28. package/dist/src/product/submit.d.ts +22 -0
  29. package/dist/src/product/submit.js +264 -0
  30. package/dist/src/product/version.d.ts +2 -2
  31. package/dist/src/product/version.js +27 -4
  32. package/dist/src/projection/current-run.d.ts +12 -0
  33. package/dist/src/projection/current-run.js +94 -0
  34. package/dist/src/projection/failure.d.ts +17 -7
  35. package/dist/src/projection/failure.js +43 -12
  36. package/dist/src/projection/retained-mission.d.ts +6 -0
  37. package/dist/src/projection/retained-mission.js +41 -0
  38. package/dist/src/projection/retained-run.d.ts +7 -0
  39. package/dist/src/projection/retained-run.js +50 -0
  40. package/dist/src/run.d.ts +43 -34
  41. package/dist/src/run.js +34 -397
  42. package/dist/src/util/canonical.d.ts +1 -5
  43. package/dist/src/util/canonical.js +1 -53
  44. package/dist/src/vela/cli.d.ts +7 -42
  45. package/dist/src/vela/cli.js +102 -475
  46. package/dist/src/vela/types.d.ts +3 -19
  47. package/dist/src/verifier/run.js +1 -1
  48. package/dist/src/workspace/prepare.d.ts +1 -1
  49. package/dist/src/workspace/prepare.js +15 -15
  50. package/docs/EVALUATION.md +142 -0
  51. package/docs/MISSIONS.md +42 -80
  52. package/docs/RUN_RECORD.md +77 -99
  53. package/docs/adr/0010-nonmutating-runs-and-explicit-submission.md +191 -0
  54. package/missions/erdos1056-k15-next/mission.draft.json +10 -8
  55. package/package.json +18 -15
  56. package/profiles/{erdos1056-k15-10428801-10429000.json → erdos1056-k15-10429201-10429400.json} +10 -10
  57. package/schemas/failure.v1.json +17 -0
  58. package/schemas/mission.v0.json +3 -4
  59. package/schemas/mission.v1.json +7 -28
  60. package/schemas/{run.v1.json → run.v2.json} +58 -116
  61. package/schemas/submission-bundle.v1.json +63 -0
  62. package/toolchain.lock.json +31 -0
  63. package/capsules/formal-erdos-505-test-dim-one/verifier +0 -105
  64. package/capsules/quantum-10-1-4/verifier.py +0 -152
  65. package/capsules/sidon-a24/bin/linux-arm64/verifier +0 -0
  66. package/capsules/sidon-a24/bin/linux-x86_64/verifier +0 -0
  67. package/dist/src/engines/codex-exec.d.ts +0 -17
  68. package/dist/src/engines/codex-exec.js +0 -136
  69. package/dist/src/engines/codex-tool-free.d.ts +0 -26
  70. package/dist/src/engines/codex-tool-free.js +0 -213
  71. package/dist/src/projection/diagnostic.d.ts +0 -12
  72. package/dist/src/projection/diagnostic.js +0 -61
  73. package/dist/src/projection/public-run.d.ts +0 -59
  74. package/dist/src/projection/public-run.js +0 -106
  75. package/dist/src/projection/publication.d.ts +0 -36
  76. package/dist/src/projection/publication.js +0 -47
  77. package/dist/src/projection/run.d.ts +0 -95
  78. package/dist/src/projection/run.js +0 -173
  79. package/dist/src/receipt/map.js +0 -168
  80. package/dist/src/repair/plan.d.ts +0 -2
  81. package/dist/src/repair/plan.js +0 -22
  82. package/dist/src/roles.d.ts +0 -2
  83. package/dist/src/roles.js +0 -9
  84. package/missions/formal-erdos-505-test-dim-one-gpt56/mission.draft.json +0 -40
  85. package/missions/quantum-10-1-4-retry/mission.draft.json +0 -40
  86. package/missions/sidon-a24-at-least-7194-gpt56/mission.draft.json +0 -42
  87. package/missions/sidon-a24-at-least-7194-gpt56-v2/mission.draft.json +0 -42
  88. package/missions/sidon-a24-at-least-7194-gpt56-v3/mission.draft.json +0 -42
  89. package/profiles/formal-erdos-505-test-dim-one-gpt56.json +0 -35
  90. package/profiles/quantum-10-1-4-stabilizer-retry.json +0 -35
  91. package/profiles/sidon-a24-at-least-7194-gpt56-v2.json +0 -35
  92. package/profiles/sidon-a24-at-least-7194-gpt56-v3.json +0 -35
  93. package/profiles/sidon-a24-at-least-7194-gpt56.json +0 -35
  94. package/schemas/canopus.public-run.v1.json +0 -116
@@ -1,47 +0,0 @@
1
- import { contentDigest } from "../util/canonical.js";
2
- import { projectPublicRun } from "./public-run.js";
3
- export function buildPublicationBundle(options) {
4
- const projection = projectPublicRun(options);
5
- const pendingCommands = {
6
- schema: "canopus.pending-commands.v1",
7
- authority: "none",
8
- proposal_id: projection.policy.proposal_id,
9
- commands: [
10
- {
11
- purpose: "reproduce_pending_artifact",
12
- authority: "read_only",
13
- command: `vela reproduce . --proposal ${projection.policy.proposal_id} --json`,
14
- },
15
- {
16
- purpose: "inspect_review_material",
17
- authority: "read_only",
18
- command: `vela review show . ${projection.policy.proposal_id} --json`,
19
- },
20
- {
21
- purpose: "retain_independent_verifier_evidence",
22
- authority: "evidence_only",
23
- command: `vela verify attach . <attachment.json> --proposal ${projection.policy.proposal_id} --as verifier:<actor> --json`,
24
- },
25
- ],
26
- };
27
- const webImport = {
28
- schema: "vela-web.canopus-import.v1",
29
- authority: "read_only",
30
- run_id: projection.run_id,
31
- projection_path: "public-run.json",
32
- projection_root: contentDigest(projection),
33
- route: "defer",
34
- accepted_state_delta: 0,
35
- };
36
- const manifest = {
37
- schema: "canopus.publication-manifest.v1",
38
- authority: "none",
39
- run_id: projection.run_id,
40
- files: {
41
- "pending-commands.json": contentDigest(pendingCommands),
42
- "public-run.json": contentDigest(projection),
43
- "web-import.json": contentDigest(webImport),
44
- },
45
- };
46
- return { projection, pendingCommands, webImport, manifest };
47
- }
@@ -1,95 +0,0 @@
1
- import type { MissionRoots } from "../contracts/mission.js";
2
- export declare const RUN_RECORD_SCHEMA: "canopus.run.v1";
3
- export declare const LEGACY_RUN_RECORD_SCHEMA: "canopus.run.v0";
4
- export declare const RUN_PROJECTION_SCHEMA: "canopus.run-projection.v0";
5
- export interface RunRecord {
6
- schema: typeof RUN_RECORD_SCHEMA | typeof LEGACY_RUN_RECORD_SCHEMA;
7
- run_id: string;
8
- status: "completed";
9
- authority: "non_authoritative";
10
- external_gate_credit: false;
11
- mission: {
12
- id: string;
13
- target: string;
14
- digest: string;
15
- starting_roots: MissionRoots;
16
- };
17
- candidate: {
18
- digest: string;
19
- status: "success" | "null" | "failed";
20
- claim: string;
21
- artifacts: Array<{
22
- path: string;
23
- kind: string;
24
- digest: string;
25
- bytes: number;
26
- }>;
27
- caveats: string[];
28
- };
29
- observations?: {
30
- worker_observations: string[];
31
- verifier_observations: string[];
32
- standing_caveats: string[];
33
- };
34
- verifier: {
35
- status: "passed" | "failed" | "error";
36
- sandbox: "macos_sandbox" | "container_network_denied";
37
- record: {
38
- argv: string[];
39
- executable_digest: string;
40
- exit_code: number;
41
- stdout_digest: string;
42
- stderr_digest: string;
43
- duration_ms: number;
44
- };
45
- };
46
- landing: {
47
- operation_id: string;
48
- receipt_root: string;
49
- proposal_id: string;
50
- route: "permit" | "defer" | "exact_retry";
51
- original_route: "permit" | "defer" | null;
52
- accepted_event_delta: number | null;
53
- publication_state: string;
54
- };
55
- final_roots: MissionRoots;
56
- reproduction: {
57
- matched: boolean;
58
- roots: MissionRoots;
59
- verifier_status: "passed" | "failed" | "error";
60
- stdout_digest: string;
61
- stderr_digest: string;
62
- };
63
- budget: {
64
- research_elapsed_ms: number;
65
- research_processes: number;
66
- research_output_bytes: number;
67
- prompt_bytes: number;
68
- artifact_bytes: number;
69
- attempts: number;
70
- observed_tokens: number;
71
- };
72
- }
73
- export interface RunProjection {
74
- schema: typeof RUN_PROJECTION_SCHEMA;
75
- authority: "read_only_projection";
76
- run_id: string;
77
- mission_id: string;
78
- target: string;
79
- starting_roots: MissionRoots;
80
- final_roots: MissionRoots;
81
- candidate_digest: string;
82
- candidate_status: "success" | "null" | "failed";
83
- artifact_digests: string[];
84
- verifier_status: "passed" | "failed" | "error";
85
- receipt_root: string;
86
- proposal_id: string;
87
- route: "permit" | "defer" | "exact_retry";
88
- original_route: "permit" | "defer" | null;
89
- accepted_state_effect: "policy_admitted" | "unchanged_pending" | "exact_retry";
90
- publication_state: string;
91
- clean_clone_reproduced: boolean;
92
- deletion_test: "Vela replay and accepted state do not depend on this projection.";
93
- }
94
- export declare function parseRunRecord(value: unknown): RunRecord;
95
- export declare function projectRun(record: RunRecord): RunProjection;
@@ -1,173 +0,0 @@
1
- import { arrayAt, enumAt, exactKeys, gitObjectAt, integerAt, objectAt, relativePathAt, sha256At, stringAt, } from "../contracts/validation.js";
2
- export const RUN_RECORD_SCHEMA = "canopus.run.v1";
3
- export const LEGACY_RUN_RECORD_SCHEMA = "canopus.run.v0";
4
- export const RUN_PROJECTION_SCHEMA = "canopus.run-projection.v0";
5
- function literal(value, expected, at) {
6
- if (value !== expected)
7
- throw new Error(`${at} must be ${String(expected)}`);
8
- return expected;
9
- }
10
- function rootsAt(value, at) {
11
- const object = objectAt(value, at);
12
- exactKeys(object, ["git_commit", "git_tree", "vela_event_log", "vela_snapshot"], [], at);
13
- return {
14
- git_commit: gitObjectAt(object.git_commit, `${at}.git_commit`),
15
- git_tree: gitObjectAt(object.git_tree, `${at}.git_tree`),
16
- vela_event_log: sha256At(object.vela_event_log, `${at}.vela_event_log`),
17
- vela_snapshot: sha256At(object.vela_snapshot, `${at}.vela_snapshot`),
18
- };
19
- }
20
- function nullableRoute(value, at) {
21
- return value === null ? null : enumAt(value, at, ["permit", "defer"]);
22
- }
23
- function nullableCount(value, at) {
24
- return value === null ? null : integerAt(value, at, 0, Number.MAX_SAFE_INTEGER);
25
- }
26
- export function parseRunRecord(value) {
27
- const record = objectAt(value, "run");
28
- const schema = enumAt(record.schema, "run.schema", [RUN_RECORD_SCHEMA, LEGACY_RUN_RECORD_SCHEMA]);
29
- exactKeys(record, [
30
- "schema", "run_id", "status", "authority", "external_gate_credit", "mission",
31
- "candidate", "verifier", "landing", "final_roots", "reproduction", "budget",
32
- ...(schema === RUN_RECORD_SCHEMA ? ["observations"] : []),
33
- ], schema === LEGACY_RUN_RECORD_SCHEMA ? ["observations"] : [], "run");
34
- const mission = objectAt(record.mission, "run.mission");
35
- exactKeys(mission, ["id", "target", "digest", "starting_roots"], [], "run.mission");
36
- const candidate = objectAt(record.candidate, "run.candidate");
37
- exactKeys(candidate, ["digest", "status", "claim", "artifacts", "caveats"], [], "run.candidate");
38
- const verifier = objectAt(record.verifier, "run.verifier");
39
- exactKeys(verifier, ["status", "sandbox", "record"], [], "run.verifier");
40
- const testRecord = objectAt(verifier.record, "run.verifier.record");
41
- exactKeys(testRecord, ["argv", "executable_digest", "exit_code", "stdout_digest", "stderr_digest", "duration_ms"], [], "run.verifier.record");
42
- const landing = objectAt(record.landing, "run.landing");
43
- exactKeys(landing, [
44
- "operation_id", "receipt_root", "proposal_id", "route", "original_route",
45
- "accepted_event_delta", "publication_state",
46
- ], [], "run.landing");
47
- const reproduction = objectAt(record.reproduction, "run.reproduction");
48
- exactKeys(reproduction, ["matched", "roots", "verifier_status", "stdout_digest", "stderr_digest"], [], "run.reproduction");
49
- const budget = objectAt(record.budget, "run.budget");
50
- exactKeys(budget, [
51
- "research_elapsed_ms", "research_processes", "research_output_bytes", "prompt_bytes",
52
- "artifact_bytes", "attempts", "observed_tokens",
53
- ], [], "run.budget");
54
- const observations = record.observations === undefined ? undefined : (() => {
55
- const stages = objectAt(record.observations, "run.observations");
56
- exactKeys(stages, ["worker_observations", "verifier_observations", "standing_caveats"], [], "run.observations");
57
- const strings = (value, at) => arrayAt(value, at, { max: 16 }, (item, itemAt) => stringAt(item, itemAt, { min: 1, max: 4096 }));
58
- return {
59
- worker_observations: strings(stages.worker_observations, "run.observations.worker_observations"),
60
- verifier_observations: strings(stages.verifier_observations, "run.observations.verifier_observations"),
61
- standing_caveats: strings(stages.standing_caveats, "run.observations.standing_caveats"),
62
- };
63
- })();
64
- return {
65
- schema,
66
- run_id: stringAt(record.run_id, "run.run_id", { min: 5, max: 128 }),
67
- status: literal(record.status, "completed", "run.status"),
68
- authority: literal(record.authority, "non_authoritative", "run.authority"),
69
- external_gate_credit: literal(record.external_gate_credit, false, "run.external_gate_credit"),
70
- mission: {
71
- id: stringAt(mission.id, "run.mission.id", { min: 1, max: 134 }),
72
- target: stringAt(mission.target, "run.mission.target", { min: 1, max: 256 }),
73
- digest: sha256At(mission.digest, "run.mission.digest"),
74
- starting_roots: rootsAt(mission.starting_roots, "run.mission.starting_roots"),
75
- },
76
- candidate: {
77
- digest: sha256At(candidate.digest, "run.candidate.digest"),
78
- status: enumAt(candidate.status, "run.candidate.status", ["success", "null", "failed"]),
79
- claim: stringAt(candidate.claim, "run.candidate.claim", { min: 1, max: 8192 }),
80
- artifacts: arrayAt(candidate.artifacts, "run.candidate.artifacts", { max: 10 }, (item, at) => {
81
- const artifact = objectAt(item, at);
82
- exactKeys(artifact, ["path", "kind", "digest", "bytes"], [], at);
83
- return {
84
- path: relativePathAt(artifact.path, `${at}.path`),
85
- kind: stringAt(artifact.kind, `${at}.kind`, { min: 1, max: 128 }),
86
- digest: sha256At(artifact.digest, `${at}.digest`),
87
- bytes: integerAt(artifact.bytes, `${at}.bytes`, 0, 1_073_741_824),
88
- };
89
- }),
90
- caveats: arrayAt(candidate.caveats, "run.candidate.caveats", { max: 10 }, (item, at) => stringAt(item, at, { min: 1, max: 4096 })),
91
- },
92
- ...(observations === undefined ? {} : { observations }),
93
- verifier: {
94
- status: enumAt(verifier.status, "run.verifier.status", ["passed", "failed", "error"]),
95
- sandbox: enumAt(verifier.sandbox, "run.verifier.sandbox", ["macos_sandbox", "container_network_denied"]),
96
- record: {
97
- argv: arrayAt(testRecord.argv, "run.verifier.record.argv", { min: 1, max: 64 }, (item, at) => stringAt(item, at, { max: 4096 })),
98
- executable_digest: sha256At(testRecord.executable_digest, "run.verifier.record.executable_digest"),
99
- exit_code: integerAt(testRecord.exit_code, "run.verifier.record.exit_code", -1, 255),
100
- stdout_digest: sha256At(testRecord.stdout_digest, "run.verifier.record.stdout_digest"),
101
- stderr_digest: sha256At(testRecord.stderr_digest, "run.verifier.record.stderr_digest"),
102
- duration_ms: integerAt(testRecord.duration_ms, "run.verifier.record.duration_ms", 0, 3_600_000),
103
- },
104
- },
105
- landing: {
106
- operation_id: stringAt(landing.operation_id, "run.landing.operation_id", { min: 1, max: 256 }),
107
- receipt_root: sha256At(landing.receipt_root, "run.landing.receipt_root"),
108
- proposal_id: stringAt(landing.proposal_id, "run.landing.proposal_id", { min: 1, max: 256 }),
109
- route: enumAt(landing.route, "run.landing.route", ["permit", "defer", "exact_retry"]),
110
- original_route: nullableRoute(landing.original_route, "run.landing.original_route"),
111
- accepted_event_delta: nullableCount(landing.accepted_event_delta, "run.landing.accepted_event_delta"),
112
- publication_state: stringAt(landing.publication_state, "run.landing.publication_state", { min: 1, max: 64 }),
113
- },
114
- final_roots: rootsAt(record.final_roots, "run.final_roots"),
115
- reproduction: {
116
- matched: literal(reproduction.matched, true, "run.reproduction.matched"),
117
- roots: rootsAt(reproduction.roots, "run.reproduction.roots"),
118
- verifier_status: enumAt(reproduction.verifier_status, "run.reproduction.verifier_status", ["passed", "failed", "error"]),
119
- stdout_digest: sha256At(reproduction.stdout_digest, "run.reproduction.stdout_digest"),
120
- stderr_digest: sha256At(reproduction.stderr_digest, "run.reproduction.stderr_digest"),
121
- },
122
- budget: {
123
- research_elapsed_ms: integerAt(budget.research_elapsed_ms, "run.budget.research_elapsed_ms", 0, 3_600_000),
124
- research_processes: integerAt(budget.research_processes, "run.budget.research_processes", 0, 64),
125
- research_output_bytes: integerAt(budget.research_output_bytes, "run.budget.research_output_bytes", 0, 67_108_864),
126
- prompt_bytes: integerAt(budget.prompt_bytes, "run.budget.prompt_bytes", 0, 8_388_608),
127
- artifact_bytes: integerAt(budget.artifact_bytes, "run.budget.artifact_bytes", 0, 1_073_741_824),
128
- attempts: integerAt(budget.attempts, "run.budget.attempts", 0, 8),
129
- observed_tokens: integerAt(budget.observed_tokens, "run.budget.observed_tokens", 0, 1_000_000),
130
- },
131
- };
132
- }
133
- export function projectRun(record) {
134
- if ((record.landing.route === "exact_retry") !== (record.landing.original_route !== null)) {
135
- throw new Error("exact retry must name exactly one durable original route");
136
- }
137
- const effectiveRoute = record.landing.route === "exact_retry"
138
- ? record.landing.original_route
139
- : record.landing.route;
140
- if (effectiveRoute === null)
141
- throw new Error("landing has no effective route");
142
- const expectedDelta = effectiveRoute === "permit" ? 1 : 0;
143
- if (record.landing.accepted_event_delta !== null &&
144
- record.landing.accepted_event_delta !== expectedDelta) {
145
- throw new Error(`${record.landing.route} landing has invalid accepted-event delta ${String(record.landing.accepted_event_delta)}`);
146
- }
147
- const acceptedStateEffect = record.landing.route === "permit"
148
- ? "policy_admitted"
149
- : record.landing.route === "defer"
150
- ? "unchanged_pending"
151
- : "exact_retry";
152
- return {
153
- schema: RUN_PROJECTION_SCHEMA,
154
- authority: "read_only_projection",
155
- run_id: record.run_id,
156
- mission_id: record.mission.id,
157
- target: record.mission.target,
158
- starting_roots: record.mission.starting_roots,
159
- final_roots: record.final_roots,
160
- candidate_digest: record.candidate.digest,
161
- candidate_status: record.candidate.status,
162
- artifact_digests: record.candidate.artifacts.map((artifact) => artifact.digest),
163
- verifier_status: record.verifier.status,
164
- receipt_root: record.landing.receipt_root,
165
- proposal_id: record.landing.proposal_id,
166
- route: record.landing.route,
167
- original_route: record.landing.original_route,
168
- accepted_state_effect: acceptedStateEffect,
169
- publication_state: record.landing.publication_state,
170
- clean_clone_reproduced: record.reproduction.matched,
171
- deletion_test: "Vela replay and accepted state do not depend on this projection.",
172
- };
173
- }
@@ -1,168 +0,0 @@
1
- import { constants } from "node:fs";
2
- import { chmod, copyFile, mkdir } from "node:fs/promises";
3
- import path from "node:path";
4
- import { hashRegularFile, } from "../artifact/freeze.js";
5
- import { parseCandidate } from "../contracts/candidate.js";
6
- function unique(values) {
7
- return [...new Set(values)];
8
- }
9
- function finalizeWorkerCaveat(value) {
10
- if (/verif(?:y|ication|ier).*(?:pending|has not run)|pending.*verif(?:y|ication|ier)/iu.test(value)) {
11
- return "The worker handed off without verifier authority; Canopus subsequently recorded the separate verifier outcome.";
12
- }
13
- return value;
14
- }
15
- export function finalizeCandidate(options) {
16
- const draftPaths = options.engine.draft.artifacts.map((artifact) => `${artifact.path}:${artifact.kind}`).sort();
17
- const supporting = new Map((options.supportingArtifacts ?? []).map((entry) => [entry.path, entry.kind]));
18
- const frozenPaths = options.frozen
19
- .filter((entry) => !supporting.has(entry.artifact.path))
20
- .map((entry) => `${entry.artifact.path}:${entry.artifact.kind}`)
21
- .sort();
22
- if (JSON.stringify(draftPaths) !== JSON.stringify(frozenPaths)) {
23
- throw new Error("frozen artifacts do not exactly match the engine declaration");
24
- }
25
- for (const [path, kind] of supporting) {
26
- const entry = options.frozen.find((candidate) => candidate.artifact.path === path);
27
- if (entry === undefined || entry.artifact.kind !== kind) {
28
- throw new Error(`supporting artifact ${path} is absent or misclassified`);
29
- }
30
- }
31
- const verifierFailed = options.engine.draft.status === "success" && options.verifier.status !== "passed";
32
- const status = verifierFailed ? "failed" : options.engine.draft.status;
33
- const exactPositiveClaim = options.mission.schema === "canopus.mission.v1" &&
34
- options.mission.result_contract !== undefined &&
35
- options.engine.draft.status === "success" &&
36
- options.verifier.status === "passed"
37
- ? options.mission.result_contract.claim_exact
38
- : undefined;
39
- const claim = verifierFailed
40
- ? `The engine proposed a candidate, but the declared verifier did not pass: ${options.engine.draft.claim}`
41
- : exactPositiveClaim ?? options.engine.draft.claim;
42
- const caveats = unique([
43
- ...options.engine.draft.caveats.map(finalizeWorkerCaveat),
44
- `Declared verifier outcome: ${options.verifier.status}.`,
45
- "Canopus produced this record; it is not a human acceptance decision.",
46
- ]);
47
- const base = {
48
- schema: "canopus.candidate.v0",
49
- mission_id: options.mission.id,
50
- status,
51
- claim,
52
- artifacts: options.frozen.map((entry) => entry.artifact),
53
- observations: options.engine.draft.observations,
54
- tests: [options.verifier.record],
55
- costs: {
56
- wall_time_ms: options.budget.research_elapsed_ms,
57
- attempt: options.budget.attempts,
58
- input_tokens: options.engine.usage.input_tokens,
59
- output_tokens: options.engine.usage.output_tokens,
60
- },
61
- caveats,
62
- engine: options.engine.engine,
63
- };
64
- return parseCandidate(options.mission.parent_candidate === undefined
65
- ? base
66
- : {
67
- ...base,
68
- repair: {
69
- parent_candidate: options.mission.parent_candidate,
70
- reason: options.mission.repair_reason ?? "Bounded repair of the named candidate.",
71
- },
72
- });
73
- }
74
- export function mapCandidateToReceipt(mission, candidate, verifier, work) {
75
- if (candidate.mission_id !== mission.id) {
76
- throw new Error("candidate belongs to a different mission");
77
- }
78
- if (candidate.artifacts.length === 0) {
79
- throw new Error("Receipt v1 requires at least one frozen artifact");
80
- }
81
- if (candidate.status === "success" && verifier.status !== "passed") {
82
- throw new Error("a success candidate requires a passing declared verifier");
83
- }
84
- if (mission.schema === "canopus.mission.v1" && mission.result_contract !== undefined) {
85
- const contract = mission.result_contract;
86
- if (candidate.status !== contract.candidate_status ||
87
- candidate.claim !== contract.claim_exact ||
88
- verifier.status !== contract.verifier_status ||
89
- mission.target !== contract.target ||
90
- mission.claim_type !== contract.claim_type ||
91
- mission.replayability !== contract.replayability) {
92
- throw new Error("candidate does not satisfy the exact positive result contract");
93
- }
94
- const artifactKinds = new Set(candidate.artifacts.map((artifact) => artifact.kind));
95
- for (const kind of contract.required_artifact_kinds) {
96
- if (!artifactKinds.has(kind)) {
97
- throw new Error(`candidate is missing result-contract artifact kind ${kind}`);
98
- }
99
- }
100
- }
101
- const result = verifier.status === "passed"
102
- ? "The declared verifier exited zero on the frozen artifact set."
103
- : verifier.status === "failed"
104
- ? `The declared verifier returned nonzero exit ${verifier.record.exit_code}.`
105
- : `The declared verifier could not complete: ${verifier.error ?? "unspecified error"}.`;
106
- const evidence = [
107
- ...candidate.artifacts.map((artifact) => `artifact:${artifact.digest}`),
108
- `verifier_executable:${verifier.record.executable_digest}`,
109
- `verifier_stdout:${verifier.record.stdout_digest}`,
110
- `verifier_stderr:${verifier.record.stderr_digest}`,
111
- ];
112
- const counterevidence = verifier.status === "passed"
113
- ? []
114
- : [
115
- `verifier_outcome:${verifier.status}`,
116
- ];
117
- const prediction = "predicted_observable" in mission.scientific_chain
118
- ? { predictedObservable: mission.scientific_chain.predicted_observable }
119
- : { notApplicable: true };
120
- return {
121
- claim: candidate.claim,
122
- claimType: mission.claim_type,
123
- replayability: mission.replayability,
124
- artifacts: candidate.artifacts.map((artifact) => ({
125
- path: artifact.path,
126
- kind: artifact.kind,
127
- })),
128
- caveats: unique(candidate.caveats),
129
- ...prediction,
130
- performedTest: mission.scientific_chain.performed_test,
131
- result,
132
- evidence,
133
- counterevidence,
134
- ...(mission.schema === "canopus.mission.v1" && mission.execution_binding !== undefined
135
- ? { executionBinding: mission.execution_binding }
136
- : {}),
137
- ...(work === undefined ? {} : { work }),
138
- };
139
- }
140
- export async function installFrozenArtifacts(options) {
141
- const frontierRoot = path.resolve(options.landingRepo, options.frontier);
142
- const installed = [];
143
- for (const entry of options.frozen) {
144
- const target = path.resolve(frontierRoot, entry.artifact.path);
145
- const relative = path.relative(frontierRoot, target);
146
- if (relative === "" ||
147
- relative === ".." ||
148
- relative.startsWith(`..${path.sep}`) ||
149
- path.isAbsolute(relative)) {
150
- throw new Error(`artifact path escapes the landing frontier: ${entry.artifact.path}`);
151
- }
152
- await mkdir(path.dirname(target), { recursive: true, mode: 0o700 });
153
- try {
154
- await copyFile(entry.frozenPath, target, constants.COPYFILE_EXCL);
155
- }
156
- catch (error) {
157
- if (error.code !== "EEXIST")
158
- throw error;
159
- }
160
- const observed = await hashRegularFile(target, options.maxBytes);
161
- if (observed.digest !== entry.artifact.digest || observed.bytes !== entry.artifact.bytes) {
162
- throw new Error(`installed artifact ${entry.artifact.path} does not match frozen bytes`);
163
- }
164
- await chmod(target, 0o444);
165
- installed.push(target);
166
- }
167
- return installed;
168
- }
@@ -1,2 +0,0 @@
1
- import type { Mission } from "../contracts/mission.js";
2
- export declare function planRepair(mission: Mission, parentCandidate: string, reason: string, remainingAttempts: number): Mission;
@@ -1,22 +0,0 @@
1
- import { parseMission } from "../contracts/mission.js";
2
- import { sha256At, stringAt } from "../contracts/validation.js";
3
- import { contentDigest } from "../util/canonical.js";
4
- export function planRepair(mission, parentCandidate, reason, remainingAttempts) {
5
- const parent = sha256At(parentCandidate, "parent_candidate");
6
- const repairReason = stringAt(reason, "repair_reason", { min: 1, max: 4096 });
7
- if (!Number.isSafeInteger(remainingAttempts) || remainingAttempts < 1) {
8
- throw new Error("repair requires at least one remaining attempt");
9
- }
10
- const suffix = contentDigest({ mission: mission.id, parent, repairReason }).slice(7, 19);
11
- return parseMission({
12
- ...mission,
13
- id: `mission_repair_${suffix}`,
14
- objective: `Repair candidate ${parent}: ${repairReason}`.slice(0, 8192),
15
- budgets: {
16
- ...mission.budgets,
17
- max_attempts: Math.min(mission.budgets.max_attempts, remainingAttempts),
18
- },
19
- parent_candidate: parent,
20
- repair_reason: repairReason,
21
- });
22
- }
@@ -1,2 +0,0 @@
1
- import type { MissionRole } from "./contracts/mission.js";
2
- export declare function roleInstruction(role: MissionRole): string;
package/dist/src/roles.js DELETED
@@ -1,9 +0,0 @@
1
- const ROLE_INSTRUCTIONS = {
2
- producer: "Construct the smallest candidate that meets the completion condition. Preserve a null result when the evidence does not support the claim.",
3
- adversary: "Try to falsify or narrow the inherited candidate. Prefer a concrete counterexample or an explicit no-counterexample result over stylistic criticism.",
4
- verifier: "Inspect whether the candidate and declared checks correspond. You do not replace the separate frozen verifier and you do not issue an acceptance verdict.",
5
- fidelity: "Check that the claim says no more than the frozen artifacts and verifier facts support. Record mismatches as caveats or a failed candidate.",
6
- };
7
- export function roleInstruction(role) {
8
- return ROLE_INSTRUCTIONS[role];
9
- }
@@ -1,40 +0,0 @@
1
- {
2
- "id": "mission_formal_erdos_505_test_dim_one_gpt56_native1",
3
- "target": "auto",
4
- "frontier": ".",
5
- "actor": "agent:canopus-local",
6
- "role": "producer",
7
- "claim_type": "theoretical",
8
- "replayability": "exact",
9
- "objective": "Produce one exactly checkable, sorry-free Lean proof term for Erdos505.erdos_505.test_dim_one in the frozen Lean 4.27.0 and Mathlib environment bound by the target packet. Write exactly one UTF-8 artifact at artifacts/erdos505-test-dim-one-proof.lean. The file must begin with by and contain only the proof term: no imports, theorem declaration, JSON, markdown fence, or surrounding prose. Do not use sorry, admit, an axiom declaration, or an unsafe declaration. Return engine status success only after the exact artifact exists. This bounded mission proves only the frozen one-dimensional category test; it does not prove the general Erdős 505 statement or establish scientific acceptance.",
10
- "completion_condition": "The independent frozen capsule supplies the exact theorem statement, elaborates the candidate with Lean 4.27.0 against the frozen formal-conjectures and Mathlib commits, and confirms that its axiom closure contains only propext, Classical.choice, and Quot.sound and never sorryAx.",
11
- "allowed_paths": [
12
- "artifacts/erdos505-test-dim-one-proof.lean"
13
- ],
14
- "budgets": {
15
- "max_research_wall_time_ms": 1800000,
16
- "max_research_processes": 8,
17
- "max_research_output_bytes": 16777216,
18
- "max_prompt_bytes": 2097152,
19
- "max_artifact_bytes": 131072,
20
- "max_attempts": 1,
21
- "max_observed_tokens": 120000
22
- },
23
- "worker": {
24
- "model": "gpt-5.6-sol"
25
- },
26
- "verifier": {
27
- "argv": [
28
- "capsule/verifier",
29
- "{artifact:artifacts/erdos505-test-dim-one-proof.lean}"
30
- ],
31
- "cwd": "targets",
32
- "timeout_ms": 600000,
33
- "max_output_bytes": 65536,
34
- "capsule_path": "capsule/verifier"
35
- },
36
- "scientific_chain": {
37
- "predicted_observable": "The frozen Lean verifier elaborates the exact candidate against Erdos505.erdos_505.test_dim_one, reports only the registered standard axioms, and exits zero on the unchanged proof bytes.",
38
- "performed_test": "capsule/verifier artifacts/erdos505-test-dim-one-proof.lean"
39
- }
40
- }
@@ -1,40 +0,0 @@
1
- {
2
- "id": "mission_quantum_10_1_4_stabilizer_v2",
3
- "target": "quantum:[[10,1,4]]",
4
- "frontier": ".",
5
- "actor": "agent:canopus-local",
6
- "role": "producer",
7
- "claim_type": "computational",
8
- "replayability": "exact",
9
- "objective": "Produce exactly one explicit stabilizer witness at artifacts/quantum-10-1-4.witness.json. The JSON fields must be exactly schema, target, n, k, and generators. Set schema to canopus.quantum-stabilizer-witness.v1, target to quantum:[[10,1,4]], n to 10, k to 1, and generators to exactly nine distinct length-10 strings over I, X, Y, Z. The generators must be non-identity, pairwise commuting, GF(2)-independent, and define no undetectable non-stabilizer Pauli of weight one, two, or three. A null or failed result is valid if no candidate is found. Work only from the supplied frontier and do not assume access to any earlier run artifact. Do not claim classification, optimality, or universal nonexistence.",
10
- "completion_condition": "The frozen verifier independently checks generator validity, pairwise symplectic commutation, rank nine, stabilizer-span membership, and all 3,675 Pauli errors of weight one through three in a separate network-denied and write-denied container.",
11
- "allowed_paths": [
12
- "artifacts/quantum-10-1-4.witness.json"
13
- ],
14
- "budgets": {
15
- "max_research_wall_time_ms": 1800000,
16
- "max_research_processes": 16,
17
- "max_research_output_bytes": 16777216,
18
- "max_prompt_bytes": 2097152,
19
- "max_artifact_bytes": 65536,
20
- "max_attempts": 1,
21
- "max_observed_tokens": 400000
22
- },
23
- "worker": {
24
- "model": "gpt-5.4"
25
- },
26
- "verifier": {
27
- "argv": [
28
- "capsule/verifier",
29
- "{artifact:artifacts/quantum-10-1-4.witness.json}"
30
- ],
31
- "cwd": "targets",
32
- "timeout_ms": 30000,
33
- "max_output_bytes": 65536,
34
- "capsule_path": "capsule/verifier"
35
- },
36
- "scientific_chain": {
37
- "predicted_observable": "The frozen verifier reports rank nine, stabilizer size 512, exactly 3,675 checked Pauli errors, and distance_at_least=4 for the supplied generator set.",
38
- "performed_test": "capsule/verifier artifacts/quantum-10-1-4.witness.json"
39
- }
40
- }
@@ -1,42 +0,0 @@
1
- {
2
- "id": "mission_sidon_a24_at_least_7194_gpt56_v1",
3
- "target": "auto",
4
- "frontier": ".",
5
- "actor": "agent:canopus-local",
6
- "role": "producer",
7
- "claim_type": "computational",
8
- "replayability": "exact",
9
- "objective": "Produce exactly one genuinely new Vela-native Sidon witness at artifacts/sidon-a24-gpt56-7194.witness.json and declare it as kind vela-witness. The input frontier contains a mechanically verified but pending 7,193-point baseline at artifacts/sidon-a24-improvement.witness.json with SHA-256 f3712b47633a239133b5e0491e68fffc85831b761c27402ba9de8057f09252e7, plus the prior exact 1-for-2 exchange implementation and benchmark under research/. Use those immutable inputs as a starting point, but do not return the existing 7,193 witness or merely replay its already-known one-point-extension and 1-for-2 result. Design, implement, and execute a stronger bounded search capable of a net improvement, such as a broader 1-for-2 search on the 7,193 baseline, a 2-for-3 or larger conflict-hypergraph exchange, or another exact collision-preserving repair method. Temporary source and diagnostics may be created outside the declared artifact path, but the only declared scientific artifact is the final witness. The artifact must be compact JSON with kind sidon, n 24, claimed_size at least 7194, and points as claimed_size distinct arrays of exactly 24 binary integers. Before reporting success, independently recheck the complete candidate by generating all m(m+1)/2 componentwise integer pair sums and confirming they are distinct. Report engine status success only after that check passes. If the bounded search does not find a valid improvement, return null with the strongest exact negative observations and no artifact. Do not claim maximality, classification, scientific acceptance, or a world record.",
10
- "completion_condition": "The separate frozen Vela verifier parses the declared witness, independently checks 24-bit distinctness and every unordered componentwise pair sum, binds the exact claim that a Sidon subset of {0,1}^24 with at least 7,194 elements exists, and exits zero in a network-denied, read-only container. Canopus then clean-clone replays the same artifact and verifier roots and Vela routes the Receipt to Defer with accepted-state delta zero.",
11
- "allowed_paths": [
12
- "artifacts/sidon-a24-gpt56-7194.witness.json"
13
- ],
14
- "budgets": {
15
- "max_research_wall_time_ms": 1800000,
16
- "max_research_processes": 16,
17
- "max_research_output_bytes": 16777216,
18
- "max_prompt_bytes": 2097152,
19
- "max_artifact_bytes": 1048576,
20
- "max_attempts": 1,
21
- "max_observed_tokens": 400000
22
- },
23
- "worker": {
24
- "model": "gpt-5.6-sol"
25
- },
26
- "verifier": {
27
- "argv": [
28
- "capsule/verifier",
29
- "--claim",
30
- "There exists a Sidon subset of {0,1}^24 with at least 7,194 elements.",
31
- "{artifact:artifacts/sidon-a24-gpt56-7194.witness.json}"
32
- ],
33
- "cwd": "targets",
34
- "timeout_ms": 300000,
35
- "max_output_bytes": 65536,
36
- "capsule_path": "capsule/verifier"
37
- },
38
- "scientific_chain": {
39
- "predicted_observable": "A newly produced set contains at least 7,194 distinct 24-bit points and all of its unordered componentwise integer pair sums are distinct.",
40
- "performed_test": "capsule/verifier --claim 'There exists a Sidon subset of {0,1}^24 with at least 7,194 elements.' artifacts/sidon-a24-gpt56-7194.witness.json"
41
- }
42
- }