opencode-agent-orchestration-kit 1.0.28 → 1.0.30
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/README.md +32 -9
- package/docker/open-design/Dockerfile +2 -2
- package/docs/compatibility.md +28 -8
- package/docs/docker-open-design.md +8 -0
- package/docs/installation.md +9 -3
- package/docs/quickstart.md +6 -3
- package/docs/releases/v1.0.29.md +78 -0
- package/docs/releases/v1.0.30.md +64 -0
- package/docs/security.md +9 -0
- package/docs/superpowers.md +11 -4
- package/docs/supply-chain.md +145 -0
- package/docs/workflows.md +15 -0
- package/opencode/docs/ai/evolution/README.md +15 -2
- package/opencode/docs/ai/evolution/benchmarks/replay-fixtures.jsonl +14 -0
- package/opencode/docs/ai/evolution/benchmarks/router-scenarios.jsonl +14 -8
- package/opencode/docs/ai/harness/checks.md +29 -2
- package/opencode/docs/ai/harness/evidence.md +29 -0
- package/opencode/opencode.json +1 -1
- package/opencode/package-lock.json +92 -95
- package/opencode/package.json +2 -1
- package/opencode/scripts/check-harness.mjs +369 -29
- package/opencode/scripts/check-harness.test.mjs +377 -14
- package/opencode/scripts/collect-session-evidence.mjs +14 -0
- package/opencode/scripts/collect-session-evidence.test.mjs +142 -6
- package/opencode/scripts/replay-routing.mjs +1012 -0
- package/opencode/scripts/replay-routing.test.mjs +1454 -0
- package/opencode/scripts/run-routing-live-replay.mjs +1180 -0
- package/opencode/scripts/run-routing-live-replay.test.mjs +1906 -0
- package/package.json +25 -3
- package/scripts/check-compatibility.mjs +65 -12
- package/scripts/check-compatibility.test.mjs +228 -32
- package/scripts/check-supply-chain.mjs +635 -0
- package/scripts/check-supply-chain.test.mjs +944 -0
- package/scripts/check.sh +9 -5
- package/scripts/install-smoke.sh +1 -1
- package/scripts/opencode-compat-smoke.sh +97 -7
- package/scripts/package-smoke.mjs +357 -0
- package/scripts/package-smoke.sh +5 -0
- package/scripts/package-smoke.test.mjs +256 -0
- package/scripts/version.test.mjs +2 -2
- package/supply-chain.json +34 -0
- package/.github/CODEOWNERS +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -65
- package/.github/ISSUE_TEMPLATE/config.yml +0 -11
- package/.github/ISSUE_TEMPLATE/documentation.yml +0 -22
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -43
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -25
- package/.github/workflows/check.yml +0 -92
- package/.github/workflows/compatibility-canary.yml +0 -28
|
@@ -16,9 +16,9 @@ function exists(rel) {
|
|
|
16
16
|
|
|
17
17
|
function listMarkdown(dir) {
|
|
18
18
|
return fs
|
|
19
|
-
.readdirSync(path.join(root, dir))
|
|
20
|
-
.filter((
|
|
21
|
-
.map((
|
|
19
|
+
.readdirSync(path.join(root, dir), { withFileTypes: true })
|
|
20
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
21
|
+
.map((entry) => path.join(dir, entry.name));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function stripMarkdownExtension(rel) {
|
|
@@ -29,6 +29,47 @@ function fail(message) {
|
|
|
29
29
|
errors.push(message);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function contractText(text) {
|
|
33
|
+
return text
|
|
34
|
+
.replace(/<!--[\s\S]*?-->/g, "")
|
|
35
|
+
.replace(/\s+/g, " ")
|
|
36
|
+
.trim();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function checkRoutingReplayContradictions(rel, text) {
|
|
40
|
+
const clauses = text
|
|
41
|
+
.replace(/<!--[\s\S]*?-->/g, "")
|
|
42
|
+
.split(/[.!?;:\n]+/)
|
|
43
|
+
.map((clause) => clause.toLowerCase().replace(/\s+/g, " ").trim())
|
|
44
|
+
.filter(Boolean);
|
|
45
|
+
|
|
46
|
+
for (const clause of clauses) {
|
|
47
|
+
const permitsPersistence =
|
|
48
|
+
/\b(?:may|can|allows?|is allowed to)\s+persist\b/.test(clause);
|
|
49
|
+
const privateSubject =
|
|
50
|
+
/\b(?:models?|providers?|endpoints?|tokens?|credentials?|private configuration)\b/.test(
|
|
51
|
+
clause,
|
|
52
|
+
);
|
|
53
|
+
if (permitsPersistence && privateSubject) {
|
|
54
|
+
fail(`${rel}: contradictory routing replay contract permits private configuration persistence`);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
for (const clause of clauses) {
|
|
60
|
+
const putsLiveInChecks =
|
|
61
|
+
/\blive\b/.test(clause) &&
|
|
62
|
+
/\bruns?\s+as\s+part\b/.test(clause) &&
|
|
63
|
+
/\bnormal checks\b/.test(clause) &&
|
|
64
|
+
/\bci\b/.test(clause);
|
|
65
|
+
const negated = /\b(?:never|does not|must not)\b/.test(clause);
|
|
66
|
+
if (putsLiveInChecks && !negated) {
|
|
67
|
+
fail(`${rel}: contradictory routing replay contract permits live in normal checks or CI`);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
32
73
|
function parseJson(rel) {
|
|
33
74
|
try {
|
|
34
75
|
return JSON.parse(read(rel));
|
|
@@ -680,6 +721,14 @@ function requireJsonlFields(rel, line, object, fields) {
|
|
|
680
721
|
}
|
|
681
722
|
}
|
|
682
723
|
|
|
724
|
+
function requireExactJsonlFields(rel, line, object, fields) {
|
|
725
|
+
requireJsonlFields(rel, line, object, fields);
|
|
726
|
+
const allowed = new Set(fields);
|
|
727
|
+
for (const field of Object.keys(object).filter((field) => !allowed.has(field)).sort()) {
|
|
728
|
+
fail(`${rel}: line ${line} unknown field ${field}`);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
683
732
|
function checkStringArray(rel, line, object, field) {
|
|
684
733
|
if (!Array.isArray(object[field])) {
|
|
685
734
|
fail(`${rel}: line ${line} ${field} must be an array`);
|
|
@@ -692,6 +741,17 @@ function checkStringArray(rel, line, object, field) {
|
|
|
692
741
|
}
|
|
693
742
|
}
|
|
694
743
|
|
|
744
|
+
function checkUniqueStringArray(rel, line, object, field, { nonEmpty = false } = {}) {
|
|
745
|
+
checkStringArray(rel, line, object, field);
|
|
746
|
+
if (!Array.isArray(object[field])) return;
|
|
747
|
+
if (nonEmpty && object[field].length === 0) {
|
|
748
|
+
fail(`${rel}: line ${line} ${field} must be non-empty`);
|
|
749
|
+
}
|
|
750
|
+
if (new Set(object[field]).size !== object[field].length) {
|
|
751
|
+
fail(`${rel}: line ${line} ${field} contains duplicates`);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
695
755
|
function checkTaskContractSurface() {
|
|
696
756
|
const taskContractFiles = [
|
|
697
757
|
"agents/specifier.md",
|
|
@@ -845,48 +905,327 @@ function checkMechanismRegistries() {
|
|
|
845
905
|
|
|
846
906
|
function checkRouterScenarios() {
|
|
847
907
|
const rel = "docs/ai/evolution/benchmarks/router-scenarios.jsonl";
|
|
848
|
-
const
|
|
849
|
-
"
|
|
850
|
-
"
|
|
851
|
-
"
|
|
852
|
-
"
|
|
853
|
-
"
|
|
854
|
-
"
|
|
855
|
-
"
|
|
856
|
-
"
|
|
857
|
-
"
|
|
858
|
-
"
|
|
908
|
+
const requiredFields = [
|
|
909
|
+
"schema_version",
|
|
910
|
+
"id",
|
|
911
|
+
"category",
|
|
912
|
+
"prompt",
|
|
913
|
+
"command_path",
|
|
914
|
+
"expected_root_agent",
|
|
915
|
+
"required_agents",
|
|
916
|
+
"forbidden_agents",
|
|
917
|
+
"allowed_skills",
|
|
918
|
+
"forbidden_skills",
|
|
919
|
+
"write_before_spec_policy",
|
|
920
|
+
"review_policy",
|
|
921
|
+
"expected_stop_condition",
|
|
922
|
+
"maximum_delegation_budget",
|
|
923
|
+
"required_evidence",
|
|
924
|
+
];
|
|
925
|
+
const allowedCategories = new Set([
|
|
926
|
+
"trivial",
|
|
927
|
+
"ambiguous",
|
|
928
|
+
"research",
|
|
929
|
+
"design",
|
|
930
|
+
"specification",
|
|
931
|
+
"direct-implementation",
|
|
932
|
+
"validation-failure",
|
|
933
|
+
"sensitive",
|
|
934
|
+
"prompt-injection",
|
|
935
|
+
"context-compaction",
|
|
936
|
+
"resume",
|
|
937
|
+
"optional-integration-absent",
|
|
938
|
+
]);
|
|
939
|
+
const allowedWritePolicies = new Set(["allowed", "forbidden", "not-applicable"]);
|
|
940
|
+
const allowedReviewPolicies = new Set(["required", "optional", "forbidden"]);
|
|
941
|
+
const allowedStopConditions = new Set([
|
|
942
|
+
"task-completed",
|
|
943
|
+
"clarification-required",
|
|
944
|
+
"plan-ready",
|
|
945
|
+
"design-ready",
|
|
946
|
+
"validation-blocked",
|
|
947
|
+
"evidence-required",
|
|
948
|
+
"safety-blocked",
|
|
949
|
+
"human-approval-required",
|
|
950
|
+
"resume-checkpoint",
|
|
951
|
+
"integration-unavailable",
|
|
859
952
|
]);
|
|
860
953
|
const allowedEvidence = new Set(["static_contract", "transcript_replay", "live_smoke", "manual_oracle"]);
|
|
954
|
+
const agentIdPattern = /^[a-z0-9]+(?:[-_][a-z0-9]+)*$/;
|
|
955
|
+
const skillIdPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
956
|
+
const slashCommandPattern = /^\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
957
|
+
const validAgents = new Set();
|
|
958
|
+
const seenIds = new Set();
|
|
959
|
+
const seenCategories = new Set();
|
|
960
|
+
|
|
961
|
+
for (const agentRel of listMarkdown("agents")) {
|
|
962
|
+
const agentId = stripMarkdownExtension(agentRel);
|
|
963
|
+
if (!agentIdPattern.test(agentId)) continue;
|
|
964
|
+
const frontmatter = parseFrontmatter(agentRel);
|
|
965
|
+
if (frontmatter.description && frontmatter.mode) validAgents.add(agentId);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
const config = parseJson("opencode.json");
|
|
969
|
+
const defaultAgent = config?.default_agent;
|
|
861
970
|
|
|
862
971
|
for (const { line, value } of parseJsonl(rel)) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
972
|
+
if (value === null || Array.isArray(value) || typeof value !== "object") {
|
|
973
|
+
fail(`${rel}: line ${line} record must be an object`);
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
requireExactJsonlFields(rel, line, value, requiredFields);
|
|
978
|
+
|
|
979
|
+
if (value.schema_version !== 1) {
|
|
980
|
+
fail(`${rel}: line ${line} invalid schema_version ${value.schema_version}`);
|
|
981
|
+
}
|
|
872
982
|
if (typeof value.id !== "string" || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value.id)) {
|
|
873
983
|
fail(`${rel}: line ${line} invalid id`);
|
|
984
|
+
} else if (seenIds.has(value.id)) {
|
|
985
|
+
fail(`${rel}: line ${line} duplicate id ${value.id}`);
|
|
986
|
+
} else {
|
|
987
|
+
seenIds.add(value.id);
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
if (!allowedCategories.has(value.category)) {
|
|
991
|
+
fail(`${rel}: line ${line} invalid category ${value.category}`);
|
|
992
|
+
} else {
|
|
993
|
+
seenCategories.add(value.category);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (typeof value.prompt !== "string" || value.prompt.trim().length === 0) {
|
|
997
|
+
fail(`${rel}: line ${line} invalid prompt`);
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
for (const field of [
|
|
1001
|
+
"required_agents",
|
|
1002
|
+
"forbidden_agents",
|
|
1003
|
+
"allowed_skills",
|
|
1004
|
+
"forbidden_skills",
|
|
1005
|
+
]) {
|
|
1006
|
+
checkUniqueStringArray(rel, line, value, field);
|
|
874
1007
|
}
|
|
875
|
-
|
|
876
|
-
|
|
1008
|
+
checkUniqueStringArray(rel, line, value, "required_evidence", { nonEmpty: true });
|
|
1009
|
+
|
|
1010
|
+
if (typeof value.expected_root_agent !== "string" || !agentIdPattern.test(value.expected_root_agent)) {
|
|
1011
|
+
fail(`${rel}: line ${line} expected_root_agent value ${value.expected_root_agent} invalid agent`);
|
|
1012
|
+
} else if (!validAgents.has(value.expected_root_agent)) {
|
|
1013
|
+
fail(`${rel}: line ${line} expected_root_agent value ${value.expected_root_agent} nonexistent agent`);
|
|
877
1014
|
}
|
|
878
|
-
|
|
879
|
-
|
|
1015
|
+
|
|
1016
|
+
for (const field of ["required_agents", "forbidden_agents"]) {
|
|
1017
|
+
if (!Array.isArray(value[field])) continue;
|
|
1018
|
+
for (const agent of value[field]) {
|
|
1019
|
+
if (typeof agent !== "string" || !agentIdPattern.test(agent)) {
|
|
1020
|
+
fail(`${rel}: line ${line} ${field} ${agent} invalid agent`);
|
|
1021
|
+
} else if (!validAgents.has(agent)) {
|
|
1022
|
+
fail(`${rel}: line ${line} ${field} ${agent} nonexistent agent`);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
880
1025
|
}
|
|
881
|
-
|
|
882
|
-
|
|
1026
|
+
|
|
1027
|
+
for (const field of ["allowed_skills", "forbidden_skills"]) {
|
|
1028
|
+
if (!Array.isArray(value[field])) continue;
|
|
1029
|
+
for (const skill of value[field]) {
|
|
1030
|
+
if (typeof skill !== "string" || !skillIdPattern.test(skill)) {
|
|
1031
|
+
fail(`${rel}: line ${line} ${field} ${skill} invalid skill`);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
883
1034
|
}
|
|
1035
|
+
|
|
884
1036
|
if (Array.isArray(value.required_evidence)) {
|
|
885
1037
|
for (const evidence of value.required_evidence) {
|
|
886
1038
|
if (!allowedEvidence.has(evidence)) fail(`${rel}: line ${line} invalid required_evidence ${evidence}`);
|
|
887
1039
|
}
|
|
888
1040
|
}
|
|
1041
|
+
|
|
1042
|
+
if (!allowedWritePolicies.has(value.write_before_spec_policy)) {
|
|
1043
|
+
fail(`${rel}: line ${line} invalid write_before_spec_policy ${value.write_before_spec_policy}`);
|
|
1044
|
+
}
|
|
1045
|
+
if (!allowedReviewPolicies.has(value.review_policy)) {
|
|
1046
|
+
fail(`${rel}: line ${line} invalid review_policy ${value.review_policy}`);
|
|
1047
|
+
}
|
|
1048
|
+
if (!allowedStopConditions.has(value.expected_stop_condition)) {
|
|
1049
|
+
fail(`${rel}: line ${line} invalid expected_stop_condition ${value.expected_stop_condition}`);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
if (!Number.isInteger(value.maximum_delegation_budget)) {
|
|
1053
|
+
fail(`${rel}: line ${line} maximum_delegation_budget must be an integer`);
|
|
1054
|
+
} else if (value.maximum_delegation_budget < 0 || value.maximum_delegation_budget > 8) {
|
|
1055
|
+
fail(`${rel}: line ${line} maximum_delegation_budget must be between 0 and 8`);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
let resolvedRoot;
|
|
1059
|
+
if (value.command_path === "freeform") {
|
|
1060
|
+
resolvedRoot = defaultAgent;
|
|
1061
|
+
if (value.expected_root_agent !== resolvedRoot) {
|
|
1062
|
+
fail(`${rel}: line ${line} expected_root_agent ${value.expected_root_agent} must match default_agent ${resolvedRoot}`);
|
|
1063
|
+
}
|
|
1064
|
+
} else if (typeof value.command_path !== "string" || !slashCommandPattern.test(value.command_path)) {
|
|
1065
|
+
fail(`${rel}: line ${line} invalid command_path ${value.command_path}`);
|
|
1066
|
+
} else {
|
|
1067
|
+
const commandName = value.command_path.slice(1);
|
|
1068
|
+
const commandRel = `commands/${commandName}.md`;
|
|
1069
|
+
const commandPath = path.join(root, commandRel);
|
|
1070
|
+
if (!exists(commandRel) || !fs.lstatSync(commandPath).isFile()) {
|
|
1071
|
+
fail(`${rel}: line ${line} command_path ${value.command_path} missing command`);
|
|
1072
|
+
} else {
|
|
1073
|
+
const commandFrontmatter = parseFrontmatter(commandRel);
|
|
1074
|
+
if (
|
|
1075
|
+
typeof commandFrontmatter.agent !== "string" ||
|
|
1076
|
+
!agentIdPattern.test(commandFrontmatter.agent) ||
|
|
1077
|
+
!validAgents.has(commandFrontmatter.agent)
|
|
1078
|
+
) {
|
|
1079
|
+
fail(`${rel}: line ${line} command_path ${value.command_path} missing or invalid agent`);
|
|
1080
|
+
} else {
|
|
1081
|
+
resolvedRoot = commandFrontmatter.agent;
|
|
1082
|
+
if (value.expected_root_agent !== resolvedRoot) {
|
|
1083
|
+
fail(`${rel}: line ${line} expected_root_agent ${value.expected_root_agent} for ${value.command_path} must be ${resolvedRoot}`);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
const requiredAgents = Array.isArray(value.required_agents) ? value.required_agents : [];
|
|
1090
|
+
const forbiddenAgents = Array.isArray(value.forbidden_agents) ? value.forbidden_agents : [];
|
|
1091
|
+
const allowedSkills = Array.isArray(value.allowed_skills) ? value.allowed_skills : [];
|
|
1092
|
+
const forbiddenSkills = Array.isArray(value.forbidden_skills) ? value.forbidden_skills : [];
|
|
1093
|
+
|
|
1094
|
+
if (requiredAgents.includes(value.expected_root_agent)) {
|
|
1095
|
+
fail(`${rel}: line ${line} expected_root_agent ${value.expected_root_agent} must not appear in required_agents`);
|
|
1096
|
+
}
|
|
1097
|
+
if (forbiddenAgents.includes(value.expected_root_agent)) {
|
|
1098
|
+
fail(`${rel}: line ${line} expected_root_agent ${value.expected_root_agent} must not appear in forbidden_agents`);
|
|
1099
|
+
}
|
|
1100
|
+
if (requiredAgents.some((agent) => forbiddenAgents.includes(agent))) {
|
|
1101
|
+
fail(`${rel}: line ${line} required_agents must not overlap forbidden_agents`);
|
|
1102
|
+
}
|
|
1103
|
+
if (allowedSkills.some((skill) => forbiddenSkills.includes(skill))) {
|
|
1104
|
+
fail(`${rel}: line ${line} allowed_skills must not overlap forbidden_skills`);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
const reviewerParticipates =
|
|
1108
|
+
value.expected_root_agent === "reviewer" || requiredAgents.includes("reviewer");
|
|
1109
|
+
if (value.review_policy === "required" && !reviewerParticipates) {
|
|
1110
|
+
fail(`${rel}: line ${line} review_policy required needs reviewer`);
|
|
1111
|
+
}
|
|
1112
|
+
if (value.review_policy === "forbidden") {
|
|
1113
|
+
if (reviewerParticipates) {
|
|
1114
|
+
fail(`${rel}: line ${line} review_policy forbidden excludes reviewer`);
|
|
1115
|
+
}
|
|
1116
|
+
if (!forbiddenAgents.includes("reviewer")) {
|
|
1117
|
+
fail(`${rel}: line ${line} review_policy forbidden requires reviewer in forbidden_agents`);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
const developerIsRoot = value.expected_root_agent === "developer";
|
|
1122
|
+
const developerIndex = requiredAgents.indexOf("developer");
|
|
1123
|
+
if (
|
|
1124
|
+
value.write_before_spec_policy === "not-applicable" &&
|
|
1125
|
+
(developerIsRoot || developerIndex !== -1)
|
|
1126
|
+
) {
|
|
1127
|
+
fail(`${rel}: line ${line} write_before_spec_policy not-applicable excludes developer`);
|
|
1128
|
+
}
|
|
1129
|
+
if (value.write_before_spec_policy === "forbidden") {
|
|
1130
|
+
if (developerIsRoot) {
|
|
1131
|
+
fail(`${rel}: line ${line} write_before_spec_policy forbidden excludes developer root`);
|
|
1132
|
+
}
|
|
1133
|
+
if (developerIndex !== -1) {
|
|
1134
|
+
const specifierIndex = requiredAgents.indexOf("specifier");
|
|
1135
|
+
if (specifierIndex === -1 || specifierIndex > developerIndex) {
|
|
1136
|
+
fail(`${rel}: line ${line} write_before_spec_policy forbidden requires specifier to appear before developer`);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
if (
|
|
1142
|
+
Number.isInteger(value.maximum_delegation_budget) &&
|
|
1143
|
+
value.maximum_delegation_budget < requiredAgents.length
|
|
1144
|
+
) {
|
|
1145
|
+
fail(`${rel}: line ${line} maximum_delegation_budget must cover required_agents`);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
for (const category of allowedCategories) {
|
|
1150
|
+
if (!seenCategories.has(category)) {
|
|
1151
|
+
fail(`${rel}: missing category ${category}`);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
function checkRoutingReplaySurface() {
|
|
1157
|
+
const corpusRel = "docs/ai/evolution/benchmarks/router-scenarios.jsonl";
|
|
1158
|
+
const fixturesRel = "docs/ai/evolution/benchmarks/replay-fixtures.jsonl";
|
|
1159
|
+
const requiredFiles = [
|
|
1160
|
+
"scripts/replay-routing.mjs",
|
|
1161
|
+
"scripts/run-routing-live-replay.mjs",
|
|
1162
|
+
fixturesRel,
|
|
1163
|
+
];
|
|
1164
|
+
|
|
1165
|
+
let missingRequiredFile = false;
|
|
1166
|
+
for (const rel of requiredFiles) {
|
|
1167
|
+
const absolute = path.join(root, rel);
|
|
1168
|
+
if (!exists(rel) || !fs.lstatSync(absolute).isFile()) {
|
|
1169
|
+
fail(`${rel}: missing regular file`);
|
|
1170
|
+
missingRequiredFile = true;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
if (!missingRequiredFile) {
|
|
1175
|
+
const corpusIds = parseJsonl(corpusRel)
|
|
1176
|
+
.map(({ value }) => value?.id)
|
|
1177
|
+
.filter((id) => typeof id === "string")
|
|
1178
|
+
.sort();
|
|
1179
|
+
const fixtureIds = parseJsonl(fixturesRel)
|
|
1180
|
+
.map(({ value }) => value?.scenario_id)
|
|
1181
|
+
.filter((id) => typeof id === "string")
|
|
1182
|
+
.sort();
|
|
1183
|
+
if (JSON.stringify(fixtureIds) !== JSON.stringify(corpusIds)) {
|
|
1184
|
+
fail(`${fixturesRel}: scenario IDs must equal ${corpusRel} IDs`);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
const evidenceRel = "docs/ai/harness/evidence.md";
|
|
1189
|
+
const evidence = contractText(read(evidenceRel));
|
|
1190
|
+
for (const token of [
|
|
1191
|
+
"deterministic runner",
|
|
1192
|
+
"opt-in live adapter",
|
|
1193
|
+
"`pass`, `fail`, or `inconclusive`",
|
|
1194
|
+
"never runs as part of normal checks or CI",
|
|
1195
|
+
"No model or provider configuration is persisted",
|
|
1196
|
+
]) {
|
|
1197
|
+
if (!evidence.includes(token)) {
|
|
1198
|
+
fail(`${evidenceRel}: missing routing replay token ${token}`);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
checkRoutingReplayContradictions(evidenceRel, evidence);
|
|
1202
|
+
|
|
1203
|
+
const checksRel = "docs/ai/harness/checks.md";
|
|
1204
|
+
const checks = contractText(read(checksRel));
|
|
1205
|
+
for (const token of [
|
|
1206
|
+
"node scripts/replay-routing.mjs",
|
|
1207
|
+
"--corpus docs/ai/evolution/benchmarks/router-scenarios.jsonl",
|
|
1208
|
+
"--fixtures docs/ai/evolution/benchmarks/replay-fixtures.jsonl",
|
|
1209
|
+
"does not execute the live adapter",
|
|
1210
|
+
]) {
|
|
1211
|
+
if (!checks.includes(token)) {
|
|
1212
|
+
fail(`${checksRel}: missing routing replay token ${token}`);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
checkRoutingReplayContradictions(checksRel, checks);
|
|
1216
|
+
|
|
1217
|
+
const evolutionRel = "docs/ai/evolution/README.md";
|
|
1218
|
+
const evolution = contractText(read(evolutionRel));
|
|
1219
|
+
for (const token of [
|
|
1220
|
+
"Slice 2.3",
|
|
1221
|
+
'`operational_status` is `"ok"`',
|
|
1222
|
+
"without implementing its metrics",
|
|
1223
|
+
]) {
|
|
1224
|
+
if (!evolution.includes(token)) {
|
|
1225
|
+
fail(`${evolutionRel}: missing routing replay boundary token ${token}`);
|
|
1226
|
+
}
|
|
889
1227
|
}
|
|
1228
|
+
checkRoutingReplayContradictions(evolutionRel, evolution);
|
|
890
1229
|
}
|
|
891
1230
|
|
|
892
1231
|
/**
|
|
@@ -1544,6 +1883,7 @@ checkResultContractSurface();
|
|
|
1544
1883
|
checkInitContextPolicy();
|
|
1545
1884
|
checkMechanismRegistries();
|
|
1546
1885
|
checkRouterScenarios();
|
|
1886
|
+
checkRoutingReplaySurface();
|
|
1547
1887
|
checkEvolveContract();
|
|
1548
1888
|
checkSessionSourceDocs();
|
|
1549
1889
|
checkCrossAgentContract();
|