@pm_zhousl/xinyun-ai-init 1.7.2 → 1.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 (42) hide show
  1. package/README.md +1 -1
  2. package/init/xinyun-ai-init/README.md +33 -1
  3. package/init/xinyun-ai-init/rules/coordination.md +33 -0
  4. package/init/xinyun-ai-init/rules/directory-self-completion.md +15 -0
  5. package/init/xinyun-ai-init/rules/frontend-audit.md +9 -0
  6. package/init/xinyun-ai-init/rules/init-rules.md +17 -0
  7. package/init/xinyun-ai-init/rules/session-workbench.md +27 -0
  8. package/init/xinyun-ai-init/rules/skills.md +15 -0
  9. package/init/xinyun-ai-init/rules/temporary-sessions.md +9 -0
  10. package/init/xinyun-ai-init/rules/upgrade-rules.md +16 -0
  11. package/init/xinyun-ai-init/templates/AGENTS.template.md +17 -0
  12. package/init/xinyun-ai-init/templates/coordination-change-ledger.template.json +10 -0
  13. package/init/xinyun-ai-init/templates/coordination-conflict-record.template.json +13 -0
  14. package/init/xinyun-ai-init/templates/coordination-contract-snapshot.template.json +9 -0
  15. package/init/xinyun-ai-init/templates/coordination-project-facts.template.json +9 -0
  16. package/init/xinyun-ai-init/templates/coordination-transaction.template.json +16 -0
  17. package/init/xinyun-ai-init/templates/core-rules.template.md +33 -0
  18. package/init/xinyun-ai-init/templates/current-task.template.md +37 -0
  19. package/init/xinyun-ai-init/templates/frontend-audit.template.json +27 -0
  20. package/init/xinyun-ai-init/templates/init-result.template.json +14 -1
  21. package/init/xinyun-ai-init/templates/managed-baseline.template.json +2 -2
  22. package/init/xinyun-ai-init/templates/manifest.template.json +85 -7
  23. package/init/xinyun-ai-init/templates/project-check.template.md +23 -0
  24. package/init/xinyun-ai-init/templates/project-guide.template.md +20 -0
  25. package/init/xinyun-ai-init/templates/project-index.template.json +58 -0
  26. package/init/xinyun-ai-init/templates/role-execution.template.md +18 -0
  27. package/init/xinyun-ai-init/templates/role-session-binding.template.json +43 -0
  28. package/init/xinyun-ai-init/templates/skills-assignments.template.json +19 -0
  29. package/init/xinyun-ai-init/templates/skills-registry.template.json +10 -0
  30. package/init/xinyun-ai-init/templates/task-index.template.json +8 -0
  31. package/init/xinyun-ai-init/templates/team/README.md +10 -0
  32. package/init/xinyun-ai-init/templates/team/assignments.json +6 -1
  33. package/init/xinyun-ai-init/templates/temporary-session.template.json +32 -0
  34. package/init/xinyun-ai-init/version.json +2 -2
  35. package/package.json +1 -1
  36. package/scripts/verify-init-package.js +237 -23
  37. package/scripts/verify-rules-package.js +119 -8
  38. package/test-scenarios/README.md +14 -4
  39. package/test-scenarios/review-template.md +23 -3
  40. package/test-scenarios/scenarios.md +112 -4
  41. package/test-scenarios/v1.7.3-scenarios.md +79 -0
  42. package/test-scenarios/v1.8.0-scenarios.md +39 -0
@@ -103,18 +103,18 @@ function verifyPackageFiles() {
103
103
  );
104
104
 
105
105
  addCheck(
106
- "package.json 版本为 1.7.2",
107
- packageJson.version === "1.7.2",
106
+ "package.json 版本为 1.8.0",
107
+ packageJson.version === "1.8.0",
108
108
  `当前版本为 ${packageJson.version}`
109
109
  );
110
110
  addCheck(
111
- "version.json 版本为 1.7.2",
112
- versionJson.version === "1.7.2",
111
+ "version.json 版本为 1.8.0",
112
+ versionJson.version === "1.8.0",
113
113
  `当前版本为 ${versionJson.version}`
114
114
  );
115
115
  addCheck(
116
- "manifest.template.json 版本为 1.7.2",
117
- manifestTemplate.xinyunAiVersion === "1.7.2",
116
+ "manifest.template.json 版本为 1.8.0",
117
+ manifestTemplate.xinyunAiVersion === "1.8.0",
118
118
  `当前版本为 ${manifestTemplate.xinyunAiVersion}`
119
119
  );
120
120
  }
@@ -469,8 +469,8 @@ function verifyInitRules() {
469
469
 
470
470
  function verifyTestScenarios() {
471
471
  requireIncludes("test-scenarios/scenarios.md", [
472
- "1-87",
473
- "88",
472
+ "1-105",
473
+ "106",
474
474
  "## 40. v1.6-A",
475
475
  "## 53. v1.6 tarball",
476
476
  "## 55. verify:rules",
@@ -479,15 +479,18 @@ function verifyTestScenarios() {
479
479
  "## 69. verify:rules JSON schema",
480
480
  "## 71. v1.7.1 主任务命名",
481
481
  "## 87. v1.7.1 普通咨询和版本回归",
482
- "## 88. Skill",
482
+ "## 89. v1.7.3 Codex 真实角色会话创建",
483
+ "## 96. v1.7.3 普通咨询边界",
484
+ "## 97. Skill",
483
485
  ]);
484
486
 
485
487
  requireIncludes("test-scenarios/README.md", [
486
- "pm_zhousl-xinyun-ai-init-1.7.2.tgz",
487
- "1-87",
488
- "88",
488
+ "pm_zhousl-xinyun-ai-init-1.8.0.tgz",
489
+ "1-96",
490
+ "97",
489
491
  "npm run verify:rules",
490
492
  "v1.7.2-scenarios.md",
493
+ "v1.7.3-scenarios.md",
491
494
  ]);
492
495
 
493
496
  requireIncludes("test-scenarios/v1.7.1-scenarios.md", [
@@ -507,6 +510,17 @@ function verifyTestScenarios() {
507
510
  "幂等补建",
508
511
  "补建失败和索引恢复",
509
512
  ]);
513
+
514
+ requireIncludes("test-scenarios/v1.7.3-scenarios.md", [
515
+ "真实角色子会话创建",
516
+ "provider=codex",
517
+ "sessionStatus=onboarding",
518
+ "taskId + roleId + provider + targetVersion",
519
+ "local-degraded-no-fake-session-id",
520
+ "created-but-writeback-failed",
521
+ "单角色失败不影响其他角色",
522
+ "普通咨询边界",
523
+ ]);
510
524
  }
511
525
  function verifyFrameworkRules() {
512
526
  const required = [
@@ -751,7 +765,7 @@ function verifyV16Contracts() {
751
765
  ]);
752
766
 
753
767
  requireIncludes("init/xinyun-ai-init/README.md", [
754
- "当前规则版本:`1.7.2`",
768
+ "当前规则版本:`1.8.0`",
755
769
  "v1.6 初始化任务、幂等恢复与结果记录",
756
770
  "xinyun-ai/tasks/.idempotency/",
757
771
  "xinyun-ai/init-result.json",
@@ -951,7 +965,7 @@ function verifyV16Contracts() {
951
965
  }
952
966
 
953
967
  addCheck("init-result mode 为 initialization", initResult.mode === "initialization");
954
- addCheck("init-result targetVersion=1.7.2", initResult.targetVersion === "1.7.2");
968
+ addCheck("init-result targetVersion=1.8.0", initResult.targetVersion === "1.8.0");
955
969
  addCheck("init-result businessCodeChanged 初始为 unknown", initResult.businessCodeChanged && initResult.businessCodeChanged.value === "unknown");
956
970
  addCheck("task-lock scope=xinyun-ai-control", taskLock.scope === "xinyun-ai-control");
957
971
  addCheck("task-lock audit 包含 released", Array.isArray(taskLock.audit) && taskLock.audit.some((item) => item.action === "released"));
@@ -1057,7 +1071,7 @@ function verifyV17Contracts() {
1057
1071
  addCheck("html migration pilot requires separate confirmation", htmlMigration.pilotPlan && htmlMigration.pilotPlan.requiresSeparateConfirmation === true);
1058
1072
 
1059
1073
  requireIncludes("init/xinyun-ai-init/README.md", [
1060
- "当前规则版本:`1.7.2`",
1074
+ "当前规则版本:`1.8.0`",
1061
1075
  "v1.7 规则包一致性检查与 verify:rules",
1062
1076
  "frameworkStatus=confirmed/inferred/not-found/unknown/detected-unsupported",
1063
1077
  "v1.7 深化预算:5 层目录、80 个关键文件、100 条证据",
@@ -1076,17 +1090,17 @@ function verifyV17Contracts() {
1076
1090
  ]);
1077
1091
 
1078
1092
  requireIncludes("test-scenarios/scenarios.md", [
1079
- "当前必测场景为 1-87",
1080
- "当前观察场景为 88",
1093
+ "当前必测场景为 1-105",
1094
+ "当前观察场景为 106",
1081
1095
  "## 55. verify:rules 正常通过",
1082
1096
  "## 69. verify:rules JSON schema 和重复执行",
1083
- "## 88. Skill 触发测试",
1097
+ "## 97. Skill 触发测试",
1084
1098
  ]);
1085
1099
 
1086
1100
  requireIncludes("test-scenarios/README.md", [
1087
- "pm_zhousl-xinyun-ai-init-1.7.2.tgz",
1088
- "当前必测场景为 `scenarios.md` 的 1-87",
1089
- "当前观察场景为 `scenarios.md` 的 88",
1101
+ "pm_zhousl-xinyun-ai-init-1.8.0.tgz",
1102
+ "当前必测场景为 `scenarios.md` 的 1-96",
1103
+ "当前观察场景为 `scenarios.md` 的 97",
1090
1104
  "npm run verify:rules",
1091
1105
  ]);
1092
1106
  }
@@ -1152,7 +1166,7 @@ function verifyV171Contracts() {
1152
1166
  addCheck("init-result taskTree role count", initResult.taskTree && initResult.taskTree.roleTaskCount === 5, "init-result taskTree.roleTaskCount 应为 5");
1153
1167
 
1154
1168
  requireIncludes("init/xinyun-ai-init/README.md", [
1155
- "当前规则版本:`1.7.2`",
1169
+ "当前规则版本:`1.8.0`",
1156
1170
  "项目初始化:<项目显示名>",
1157
1171
  "xinyun-ai/tasks/task-index.json",
1158
1172
  "xinyun-ai/tasks/.archive-transactions/<archiveTransactionId>.json",
@@ -1303,7 +1317,7 @@ function verifyV172Contracts() {
1303
1317
  addCheck(`role-execution template field ${field}`, roleExecution.includes(`- ${field}:`), `role-execution 模板缺少 ${field}`);
1304
1318
  }
1305
1319
  requireIncludes("init/xinyun-ai-init/README.md", [
1306
- "当前规则版本:`1.7.2`",
1320
+ "当前规则版本:`1.8.0`",
1307
1321
  "xinyun-ai/tasks/role-execution/<roleTaskId>.md",
1308
1322
  "activeTaskIds",
1309
1323
  "executableTaskIds",
@@ -1324,6 +1338,204 @@ function verifyV172Contracts() {
1324
1338
  requireIncludes("init/xinyun-ai-init/rules/session-workbench.md", ["v1.7.2 角色执行任务补充字段", "roleExecutionResult"]);
1325
1339
  }
1326
1340
 
1341
+ function verifyV173Contracts() {
1342
+ const manifestTemplate = JSON.parse(readText("init/xinyun-ai-init/templates/manifest.template.json"));
1343
+ const projectIndexTemplate = JSON.parse(readText("init/xinyun-ai-init/templates/project-index.template.json"));
1344
+ const taskIndex = JSON.parse(readText("init/xinyun-ai-init/templates/task-index.template.json"));
1345
+ const initResult = JSON.parse(readText("init/xinyun-ai-init/templates/init-result.template.json"));
1346
+ const assignments = JSON.parse(readText("init/xinyun-ai-init/templates/team/assignments.json"));
1347
+ const bindingTemplate = JSON.parse(readText("init/xinyun-ai-init/templates/role-session-binding.template.json"));
1348
+ const roleExecution = readText("init/xinyun-ai-init/templates/role-execution.template.md");
1349
+ const statusEnum = ["pending", "creating", "created", "onboarding", "ready", "blocked", "failed", "closed"];
1350
+
1351
+ requireFile("init/xinyun-ai-init/templates/role-session-binding.template.json");
1352
+ requireFile("test-scenarios/v1.7.3-scenarios.md");
1353
+
1354
+ addCheck(
1355
+ "manifest v1.7.3 codexRoleSessionOrchestration",
1356
+ manifestTemplate.capabilities && manifestTemplate.capabilities.codexRoleSessionOrchestration === true,
1357
+ "manifest 缺少 codexRoleSessionOrchestration 能力"
1358
+ );
1359
+ addCheck(
1360
+ "manifest roleSessions provider codex",
1361
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.provider === "codex",
1362
+ "manifest roleSessions.provider 必须为 codex"
1363
+ );
1364
+ addCheck(
1365
+ "manifest roleSessions targetVersion=1.8.0",
1366
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.targetVersion === "1.8.0",
1367
+ "manifest roleSessions.targetVersion 必须为 1.8.0"
1368
+ );
1369
+ addCheck(
1370
+ "manifest roleSessions bindings path",
1371
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.bindings === "xinyun-ai/sessions/role-session-bindings.json",
1372
+ "manifest roleSessions.bindings 不一致"
1373
+ );
1374
+ addCheck(
1375
+ "manifest roleSessions directory",
1376
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.directory === "xinyun-ai/sessions/roles/",
1377
+ "manifest roleSessions.directory 不一致"
1378
+ );
1379
+ addCheck(
1380
+ "manifest roleSessions bindingTemplate",
1381
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.bindingTemplate === "xinyun-ai-init/templates/role-session-binding.template.json",
1382
+ "manifest roleSessions.bindingTemplate 不一致"
1383
+ );
1384
+ addCheck(
1385
+ "manifest roleSessions requiredRoleCount=5",
1386
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.requiredRoleCount === 5,
1387
+ "manifest roleSessions.requiredRoleCount 必须为 5"
1388
+ );
1389
+ addCheck(
1390
+ "manifest roleSessions status enum",
1391
+ manifestTemplate.roleSessions && JSON.stringify(manifestTemplate.roleSessions.statusEnum) === JSON.stringify(statusEnum),
1392
+ "manifest roleSessions.statusEnum 不完整"
1393
+ );
1394
+ addCheck(
1395
+ "manifest roleSessions idempotency fields",
1396
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.idempotency && JSON.stringify(manifestTemplate.roleSessions.idempotency.keyFields) === JSON.stringify(["taskId", "roleId", "provider", "targetVersion"]),
1397
+ "manifest roleSessions.idempotency.keyFields 不一致"
1398
+ );
1399
+ addCheck(
1400
+ "manifest roleSessions host unsupported policy",
1401
+ manifestTemplate.roleSessions && manifestTemplate.roleSessions.hostUnsupportedPolicy === "local-degraded-no-fake-session-id",
1402
+ "manifest roleSessions.hostUnsupportedPolicy 不一致"
1403
+ );
1404
+
1405
+ addCheck(
1406
+ "project-index roleSessions path",
1407
+ projectIndexTemplate.roleSessions && projectIndexTemplate.roleSessions.bindings === "xinyun-ai/sessions/role-session-bindings.json",
1408
+ "project-index roleSessions.bindings 不一致"
1409
+ );
1410
+ addCheck(
1411
+ "project-index roleSessions status enum",
1412
+ projectIndexTemplate.roleSessions && JSON.stringify(projectIndexTemplate.roleSessions.statusEnum) === JSON.stringify(statusEnum),
1413
+ "project-index roleSessions.statusEnum 不完整"
1414
+ );
1415
+ addCheck("project-index roleSessions records array", projectIndexTemplate.roleSessions && Array.isArray(projectIndexTemplate.roleSessions.records), "project-index roleSessions.records 必须是数组");
1416
+
1417
+ addCheck("task-index roleSessionBindingIds array", Array.isArray(taskIndex.roleSessionBindingIds), "task-index roleSessionBindingIds 必须是数组");
1418
+ addCheck("task-index roleSessionBindings array", Array.isArray(taskIndex.roleSessionBindings), "task-index roleSessionBindings 必须是数组");
1419
+ addCheck(
1420
+ "task-index roleSession status enum",
1421
+ JSON.stringify(taskIndex.roleSessionStatusEnum) === JSON.stringify(statusEnum),
1422
+ "task-index roleSessionStatusEnum 不完整"
1423
+ );
1424
+ addCheck(
1425
+ "task-index roleSession idempotency fields",
1426
+ taskIndex.roleSessionIdempotency && JSON.stringify(taskIndex.roleSessionIdempotency.keyFields) === JSON.stringify(["taskId", "roleId", "provider", "targetVersion"]),
1427
+ "task-index roleSessionIdempotency.keyFields 不一致"
1428
+ );
1429
+
1430
+ addCheck("init-result roleSessions provider codex", initResult.roleSessions && initResult.roleSessions.provider === "codex", "init-result roleSessions.provider 必须为 codex");
1431
+ addCheck("init-result roleSessions requiredRoleCount=5", initResult.roleSessions && initResult.roleSessions.requiredRoleCount === 5, "init-result roleSessions.requiredRoleCount 必须为 5");
1432
+ for (const field of ["createdCount", "reusedCount", "failedCount", "blockedCount", "localDegradedCount"]) {
1433
+ addCheck(`init-result roleSessions ${field}`, initResult.roleSessions && typeof initResult.roleSessions[field] === "number", `init-result roleSessions.${field} 必须是数字`);
1434
+ }
1435
+
1436
+ for (const field of ["sessionId", "parentSessionId", "provider", "sessionStatus"]) {
1437
+ addCheck(`assignments required field ${field}`, assignments.recordContract && assignments.recordContract.requiredFields.includes(field), `assignments recordContract 缺少 ${field}`);
1438
+ }
1439
+ addCheck("assignments session binding rule mentions real host value", assignments.recordContract && assignments.recordContract.sessionBindingRule.includes("real host-returned value"), "assignments sessionBindingRule 必须说明真实宿主返回值");
1440
+
1441
+ addCheck("binding template provider codex", bindingTemplate.provider === "codex", "binding template provider 必须为 codex");
1442
+ addCheck("binding template targetVersion=1.8.0", bindingTemplate.targetVersion === "1.8.0", "binding template targetVersion 必须为 1.8.0");
1443
+ addCheck("binding template fakeSessionId prohibited", bindingTemplate.degradation && bindingTemplate.degradation.fakeSessionIdProhibited === true, "binding template 必须禁止伪造 sessionId");
1444
+ addCheck("binding template onboarding readOnly", bindingTemplate.onboarding && bindingTemplate.onboarding.readOnly === true, "binding template onboarding.readOnly 必须为 true");
1445
+
1446
+ for (const field of ["parentSessionId", "provider", "sessionStatus", "sessionBindingId", "sessionBindingPath", "sessionIdempotencyKey"]) {
1447
+ addCheck(`role-execution v1.7.3 field ${field}`, roleExecution.includes(`- ${field}:`), `role-execution 模板缺少 ${field}`);
1448
+ }
1449
+
1450
+ const snippets = [
1451
+ "v1.7.3 Codex 角色会话自动创建与绑定",
1452
+ "provider=codex",
1453
+ "sessionStatus=pending/creating/created/onboarding/ready/blocked/failed/closed",
1454
+ "taskId + roleId + provider + targetVersion",
1455
+ "真实 `sessionId`",
1456
+ "不得伪造 sessionId",
1457
+ "local-degraded-no-fake-session-id",
1458
+ "onboarding",
1459
+ "created-but-writeback-failed",
1460
+ "创建成功不等于业务代码修改授权",
1461
+ ];
1462
+ requireIncludes("init/xinyun-ai-init/README.md", snippets);
1463
+ requireIncludes("init/xinyun-ai-init/templates/core-rules.template.md", snippets);
1464
+ requireIncludes("init/xinyun-ai-init/templates/AGENTS.template.md", ["v1.7.3 Codex 角色会话自动创建与绑定", "provider=codex", "local-degraded-no-fake-session-id"]);
1465
+ requireIncludes("init/xinyun-ai-init/rules/init-rules.md", ["v1.7.3 Codex 角色会话初始化", "provider=codex", "local-degraded-no-fake-session-id"]);
1466
+ requireIncludes("init/xinyun-ai-init/rules/upgrade-rules.md", ["v1.7.3 升级创建和绑定真实角色会话", "created-but-writeback-failed", "不得伪造 sessionId"]);
1467
+ requireIncludes("init/xinyun-ai-init/rules/directory-self-completion.md", ["v1.7.3 角色会话绑定目录", "xinyun-ai/sessions/role-session-bindings.json", "local-degraded-no-fake-session-id"]);
1468
+ requireIncludes("init/xinyun-ai-init/rules/session-workbench.md", ["v1.7.3 角色会话交接字段", "roleSessionIdempotency", "不得伪造 sessionId"]);
1469
+ requireIncludes("init/xinyun-ai-init/templates/project-guide.template.md", ["v1.7.3 Codex role session anchors", "roleSessionIdempotency", "local-degraded-no-fake-session-id"]);
1470
+ requireIncludes("init/xinyun-ai-init/templates/project-check.template.md", ["v1.7.3 checks", "provider=codex", "不存在伪造 sessionId"]);
1471
+ requireIncludes("test-scenarios/scenarios.md", ["当前必测场景为 1-105", "当前观察场景为 106", "## 89. v1.7.3 Codex 真实角色会话创建", "## 96. v1.7.3 普通咨询边界", "## 97. Skill"]);
1472
+ requireIncludes("test-scenarios/review-template.md", ["1-105 必测", "89. v1.7.3 Codex 真实角色会话创建", "96. v1.7.3 普通咨询边界", "97. Skill"]);
1473
+ }
1474
+
1475
+ function verifyV18Contracts() {
1476
+ const manifest = JSON.parse(readText("init/xinyun-ai-init/templates/manifest.template.json"));
1477
+ const projectIndex = JSON.parse(readText("init/xinyun-ai-init/templates/project-index.template.json"));
1478
+ const skillAssignments = JSON.parse(readText("init/xinyun-ai-init/templates/skills-assignments.template.json"));
1479
+ const skillRegistry = JSON.parse(readText("init/xinyun-ai-init/templates/skills-registry.template.json"));
1480
+ const frontendAudit = JSON.parse(readText("init/xinyun-ai-init/templates/frontend-audit.template.json"));
1481
+ const temporarySession = JSON.parse(readText("init/xinyun-ai-init/templates/temporary-session.template.json"));
1482
+ const transaction = JSON.parse(readText("init/xinyun-ai-init/templates/coordination-transaction.template.json"));
1483
+ const requiredFiles = [
1484
+ "init/xinyun-ai-init/rules/coordination.md",
1485
+ "init/xinyun-ai-init/rules/skills.md",
1486
+ "init/xinyun-ai-init/rules/frontend-audit.md",
1487
+ "init/xinyun-ai-init/rules/temporary-sessions.md",
1488
+ "init/xinyun-ai-init/templates/coordination-project-facts.template.json",
1489
+ "init/xinyun-ai-init/templates/coordination-change-ledger.template.json",
1490
+ "init/xinyun-ai-init/templates/coordination-contract-snapshot.template.json",
1491
+ "init/xinyun-ai-init/templates/coordination-conflict-record.template.json",
1492
+ "init/xinyun-ai-init/templates/coordination-transaction.template.json",
1493
+ "init/xinyun-ai-init/templates/skills-registry.template.json",
1494
+ "init/xinyun-ai-init/templates/skills-assignments.template.json",
1495
+ "init/xinyun-ai-init/templates/frontend-audit.template.json",
1496
+ "init/xinyun-ai-init/templates/temporary-session.template.json",
1497
+ "test-scenarios/v1.8.0-scenarios.md",
1498
+ ];
1499
+ for (const file of requiredFiles) requireFile(file);
1500
+
1501
+ for (const capability of ["sharedProjectFactsCoordination", "skillRouting", "frontendCouplingAudit", "temporaryProgrammerSessions"]) {
1502
+ addCheck(`manifest capability ${capability}`, manifest.capabilities && manifest.capabilities[capability] === true, `manifest.capabilities.${capability} 必须为 true`);
1503
+ }
1504
+ const pathChecks = [
1505
+ [manifest.coordination, "directory", "xinyun-ai/coordination/"],
1506
+ [manifest.skills, "directory", "xinyun-ai/skills/"],
1507
+ [manifest.frontendAudit, "directory", "xinyun-ai/frontend-audits/"],
1508
+ [manifest.temporarySessions, "directory", "xinyun-ai/sessions/temporary/"],
1509
+ [projectIndex.coordination, "directory", "xinyun-ai/coordination/"],
1510
+ [projectIndex.skills, "directory", "xinyun-ai/skills/"],
1511
+ [projectIndex.frontendAudit, "directory", "xinyun-ai/frontend-audits/"],
1512
+ [projectIndex.temporarySessions, "directory", "xinyun-ai/sessions/temporary/"],
1513
+ ];
1514
+ for (const [object, field, expected] of pathChecks) addCheck(`v1.8 path ${expected}`, object && object[field] === expected, `路径必须为 ${expected}`);
1515
+
1516
+ addCheck("coordination transaction phase enum", JSON.stringify(transaction.phaseEnum) === JSON.stringify(["prepared", "validated", "renamed", "revision-updated", "committed", "recovery-required", "blocked"]), "事务阶段不完整");
1517
+ addCheck("Skill uses assignmentStatus", skillAssignments.recordContract && skillAssignments.recordContract.requiredFields.includes("assignmentStatus"), "Skill 分配必须使用 assignmentStatus");
1518
+ addCheck("Skill does not use status alias", !JSON.stringify(skillAssignments).includes("assignments.json.status"), "不得使用 assignments.json.status");
1519
+ addCheck("Skill usageStatus mapping exists", skillAssignments.recordContract && skillAssignments.recordContract.statusMapping && skillAssignments.recordContract.statusMapping.blocked.includes("failed"), "缺少失败到 blocked 的映射");
1520
+ addCheck("Skill failed requires reason/action", skillAssignments.recordContract && skillAssignments.recordContract.failedRule.includes("failureReason") && skillAssignments.recordContract.failedRule.includes("nextAction"), "缺少失败证据契约");
1521
+ addCheck("Skill registry separates availability/trust", skillRegistry.recordContract && skillRegistry.recordContract.requiredFields.includes("availabilityStatus") && skillRegistry.recordContract.requiredFields.includes("trustStatus"), "Skill 可用性和可信度必须独立");
1522
+ addCheck("frontend audit-only decision", frontendAudit.decision === "audit-only", "默认必须为 audit-only");
1523
+ addCheck("frontend audit status enum", frontendAudit.statusEnum && frontendAudit.statusEnum.includes("unknown"), "审计状态枚举不完整");
1524
+ addCheck("frontend refactor evidence contract", frontendAudit.refactorNowRequired && frontendAudit.refactorNowRequired.includes("userConfirmationId") && frontendAudit.refactorNowRequired.includes("diffEvidence"), "refactor-now 证据契约不完整");
1525
+ addCheck("temporary session maxConcurrent=3", temporarySession.maxConcurrent === 3, "临时会话并发上限必须为 3");
1526
+ addCheck("temporary session has occupancyStatus", temporarySession.occupancyStatusEnum && temporarySession.occupancyStatusEnum.includes("unknown"), "缺少 occupancyStatus=unknown");
1527
+
1528
+ const v18Snippets = ["v1.8", "factStatus", "changeStatus", "conflictStatus", "assignmentStatus", "usageStatus", "audit-only", "refactor-now", "occupancyStatus=unknown", "coordinationTransactionId"];
1529
+ requireIncludes("init/xinyun-ai-init/README.md", v18Snippets);
1530
+ requireIncludes("init/xinyun-ai-init/templates/core-rules.template.md", v18Snippets);
1531
+ requireIncludes("init/xinyun-ai-init/rules/coordination.md", ["三道门禁", "coordinationTransactionId", "status-inconsistent"]);
1532
+ requireIncludes("init/xinyun-ai-init/rules/skills.md", ["assignmentStatus", "usageStatus", "failureReason", "nextAction"]);
1533
+ requireIncludes("init/xinyun-ai-init/rules/frontend-audit.md", ["audit-only", "refactor-now", "unverifiedScope"]);
1534
+ requireIncludes("init/xinyun-ai-init/rules/temporary-sessions.md", ["最多同时占用 3 个运行额度", "occupancyStatus=unknown", "releaseAudit"]);
1535
+ requireIncludes("test-scenarios/scenarios.md", ["当前必测场景为 1-105", "当前观察场景为 106", "## 98. v1.8-A", "## 105. v1.8 敏感信息边界"]);
1536
+ requireIncludes("test-scenarios/review-template.md", ["1-105 必测", "98. v1.8-A 状态域和来源一致性", "105. v1.8 敏感信息边界"]);
1537
+ }
1538
+
1327
1539
  function main() {
1328
1540
  requireFile("bin/xinyun-ai-init.js");
1329
1541
  requireFile("init/xinyun-ai-init/README.md");
@@ -1338,6 +1550,8 @@ function main() {
1338
1550
  verifyV17Contracts();
1339
1551
  verifyV171Contracts();
1340
1552
  verifyV172Contracts();
1553
+ verifyV173Contracts();
1554
+ verifyV18Contracts();
1341
1555
  verifyTestScenarios();
1342
1556
  verifyJsonAndMarkdown();
1343
1557
 
@@ -5,7 +5,7 @@ const os = require("os");
5
5
  const path = require("path");
6
6
  const { spawnSync } = require("child_process");
7
7
 
8
- const VERSION = "1.7.2";
8
+ const VERSION = "1.8.0";
9
9
  const checks = [];
10
10
 
11
11
  function parseArgs(argv) {
@@ -150,6 +150,7 @@ function validatePackageFiles(root, target, isTarball) {
150
150
  "test-scenarios/scenarios.md",
151
151
  "test-scenarios/v1.7.1-scenarios.md",
152
152
  "test-scenarios/v1.7.2-scenarios.md",
153
+ "test-scenarios/v1.7.3-scenarios.md",
153
154
  "init/xinyun-ai-init/README.md",
154
155
  "init/xinyun-ai-init/rules/frameworks/README.md",
155
156
  "init/xinyun-ai-init/rules/frameworks/backend/php/thinkphp.md",
@@ -174,12 +175,27 @@ function validatePackageFiles(root, target, isTarball) {
174
175
  "init/xinyun-ai-init/templates/role-subtask.template.md",
175
176
  "init/xinyun-ai-init/templates/archive-transaction.template.json",
176
177
  "init/xinyun-ai-init/templates/role-execution.template.md",
178
+ "init/xinyun-ai-init/templates/role-session-binding.template.json",
179
+ "init/xinyun-ai-init/templates/coordination-project-facts.template.json",
180
+ "init/xinyun-ai-init/templates/coordination-change-ledger.template.json",
181
+ "init/xinyun-ai-init/templates/coordination-contract-snapshot.template.json",
182
+ "init/xinyun-ai-init/templates/coordination-conflict-record.template.json",
183
+ "init/xinyun-ai-init/templates/coordination-transaction.template.json",
184
+ "init/xinyun-ai-init/templates/skills-registry.template.json",
185
+ "init/xinyun-ai-init/templates/skills-assignments.template.json",
186
+ "init/xinyun-ai-init/templates/frontend-audit.template.json",
187
+ "init/xinyun-ai-init/templates/temporary-session.template.json",
188
+ "init/xinyun-ai-init/rules/coordination.md",
189
+ "init/xinyun-ai-init/rules/skills.md",
190
+ "init/xinyun-ai-init/rules/frontend-audit.md",
191
+ "init/xinyun-ai-init/rules/temporary-sessions.md",
192
+ "test-scenarios/v1.8.0-scenarios.md",
177
193
  ];
178
194
 
179
195
  for (const file of requiredFiles) requireFile(root, target, file);
180
196
 
181
197
  if (isTarball) {
182
- const sourceOnly = "version-plans/releases/v1.7.2.md";
198
+ const sourceOnly = "version-plans/releases/v1.8.0.md";
183
199
  addCheck(target, "package.source-only", "package", !existsPath(root, sourceOnly) ? "pass" : "warn", sourceOnly, null, "not required in tarball", existsPath(root, sourceOnly) ? "present" : "not present", "source-only version-plans is not required in tarball.", "No action required unless package policy changes.", "optional");
184
200
  }
185
201
  }
@@ -216,6 +232,7 @@ function validateRegistries(root, target) {
216
232
  "taskArchiveTransactions",
217
233
  "codeGraphRequiredInitialization",
218
234
  "roleExecutionVisibility",
235
+ "codexRoleSessionOrchestration",
219
236
  ]) {
220
237
  addCheck(target, "registry.manifest", "manifest", capabilities[flag] === true ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", `capabilities.${flag}`, true, capabilities[flag], "Manifest capability registered.", "Register the missing capability.");
221
238
  }
@@ -277,6 +294,9 @@ function validateRegistries(root, target) {
277
294
  }
278
295
  addCheck(target, "registry.manifest", "manifest", manifest.taskTree && manifest.taskTree.roleExecutionPathPattern === "xinyun-ai/tasks/role-execution/<roleTaskId>.md" ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "taskTree.roleExecutionPathPattern", "xinyun-ai/tasks/role-execution/<roleTaskId>.md", manifest.taskTree && manifest.taskTree.roleExecutionPathPattern, "Manifest role execution path checked.", "Register the role execution path.");
279
296
  addCheck(target, "registry.project-index", "project-index", projectIndex.taskTree && projectIndex.taskTree.roleExecutionPathPattern === "xinyun-ai/tasks/role-execution/<roleTaskId>.md" ? "pass" : "fail", "init/xinyun-ai-init/templates/project-index.template.json", "taskTree.roleExecutionPathPattern", "xinyun-ai/tasks/role-execution/<roleTaskId>.md", projectIndex.taskTree && projectIndex.taskTree.roleExecutionPathPattern, "Project-index role execution path checked.", "Register the role execution path.");
297
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.bindings === "xinyun-ai/sessions/role-session-bindings.json" ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.bindings", "xinyun-ai/sessions/role-session-bindings.json", manifest.roleSessions && manifest.roleSessions.bindings, "Manifest role session bindings checked.", "Register roleSessions.bindings.");
298
+ addCheck(target, "registry.project-index", "project-index", projectIndex.roleSessions && projectIndex.roleSessions.bindings === "xinyun-ai/sessions/role-session-bindings.json" ? "pass" : "fail", "init/xinyun-ai-init/templates/project-index.template.json", "roleSessions.bindings", "xinyun-ai/sessions/role-session-bindings.json", projectIndex.roleSessions && projectIndex.roleSessions.bindings, "Project-index role session bindings checked.", "Register roleSessions.bindings.");
299
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.provider === "codex" ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.provider", "codex", manifest.roleSessions && manifest.roleSessions.provider, "Manifest role session provider checked.", "Register roleSessions.provider.");
280
300
  }
281
301
 
282
302
  function validateV17Content(root, target) {
@@ -298,7 +318,7 @@ function validateV17Content(root, target) {
298
318
  "scope/unverifiedScope",
299
319
  "pauseReason=out-of-scope",
300
320
  ];
301
- requireIncludes(root, target, "init/xinyun-ai-init/README.md", ["当前规则版本:`1.7.2`", ...common]);
321
+ requireIncludes(root, target, "init/xinyun-ai-init/README.md", ["当前规则版本:`1.8.0`", ...common]);
302
322
  requireIncludes(root, target, "init/xinyun-ai-init/templates/core-rules.template.md", common);
303
323
  requireIncludes(root, target, "init/xinyun-ai-init/templates/AGENTS.template.md", ["v1.7 规则包一致性、技术栈 profile 与 HTML 迁移准备", "`verify:rules` 只读", "ThinkPHP 不得误套其他项目", ...common.slice(5)]);
304
324
  requireIncludes(root, target, "init/xinyun-ai-init/templates/current-task.template.md", ["verify:rules.status", "language", "runtime", "platform", "framework", ...common.slice(5)]);
@@ -310,9 +330,51 @@ function validateV17Content(root, target) {
310
330
  requireIncludes(root, target, "init/xinyun-ai-init/rules/session-workbench.md", ["v1.7 任务单补充字段", "verifyRulesStatus", "migrationStatus", "HTML 迁移只允许评估和单页面 / 区块试点计划"]);
311
331
  requireIncludes(root, target, "init/xinyun-ai-init/rules/frameworks/README.md", ["v1.7 技术栈 profile", "coverage=partial", ...common.slice(5, 10)]);
312
332
  requireIncludes(root, target, "init/xinyun-ai-init/rules/frameworks/backend/php/thinkphp.md", ["v1.7 ThinkPHP 深化模块", "frameworkStatus=confirmed", "moduleStatus=loaded", "Controller", "Request/Validate", "Service", "Model/ORM", "Middleware", "队列"]);
313
- requireIncludes(root, target, "test-scenarios/scenarios.md", ["当前必测场景为 1-87", "当前观察场景为 88", "## 55. verify:rules 正常通过", "## 69. verify:rules JSON schema 和重复执行"]);
314
- requireIncludes(root, target, "test-scenarios/review-template.md", ["55. verify:rules 正常通过", "69. verify:rules JSON schema 和重复执行", "88. Skill 触发测试"]);
315
- requireIncludes(root, target, "test-scenarios/README.md", ["npm run verify:rules", "pm_zhousl-xinyun-ai-init-1.7.2.tgz", "v1.7.2-scenarios.md", "当前必测场景为 `scenarios.md` 的 1-87", "当前观察场景为 `scenarios.md` 的 88"]);
333
+ requireIncludes(root, target, "test-scenarios/scenarios.md", ["当前必测场景为 1-105", "当前观察场景为 106", "## 55. verify:rules 正常通过", "## 69. verify:rules JSON schema 和重复执行"]);
334
+ requireIncludes(root, target, "test-scenarios/review-template.md", ["55. verify:rules 正常通过", "69. verify:rules JSON schema 和重复执行", "97. Skill 触发测试"]);
335
+ requireIncludes(root, target, "test-scenarios/README.md", ["npm run verify:rules", "pm_zhousl-xinyun-ai-init-1.8.0.tgz", "v1.7.2-scenarios.md", "v1.7.3-scenarios.md", "当前版本必测场景为 `scenarios.md` 的 1-105", "106 为观察项"]);
336
+ }
337
+
338
+ function validateV18Content(root, target) {
339
+ const required = [
340
+ ["init/xinyun-ai-init/rules/coordination.md", ["factStatus", "changeStatus", "conflictStatus", "coordinationTransactionId", "status-inconsistent"]],
341
+ ["init/xinyun-ai-init/rules/skills.md", ["assignmentStatus", "usageStatus", "failureReason", "nextAction", "availabilityStatus", "trustStatus"]],
342
+ ["init/xinyun-ai-init/rules/frontend-audit.md", ["audit-only", "refactor-now", "unverifiedScope", "coverage"]],
343
+ ["init/xinyun-ai-init/rules/temporary-sessions.md", ["occupancyStatus=unknown", "releaseAudit", "最多同时占用 3 个运行额度"]],
344
+ ["test-scenarios/v1.8.0-scenarios.md", ["v1.8-01", "v1.8-08", "forbiddenOperations", "sensitiveScan"]],
345
+ ["init/xinyun-ai-init/README.md", ["v1.8", "assignmentStatus", "occupancyStatus=unknown", "coordinationTransactionId"]],
346
+ ["init/xinyun-ai-init/templates/core-rules.template.md", ["factStatus", "changeStatus", "conflictStatus", "assignmentStatus", "usageStatus"]],
347
+ ["init/xinyun-ai-init/templates/AGENTS.template.md", ["assignments.json.status", "assignmentStatus", "occupancyStatus"]],
348
+ ];
349
+ for (const [file, snippets] of required) requireIncludes(root, target, file, snippets, "v1.8.content");
350
+
351
+ const manifest = readJson(root, "init/xinyun-ai-init/templates/manifest.template.json");
352
+ const projectIndex = readJson(root, "init/xinyun-ai-init/templates/project-index.template.json");
353
+ const capabilities = manifest.capabilities || {};
354
+ for (const flag of ["sharedProjectFactsCoordination", "skillRouting", "frontendCouplingAudit", "temporaryProgrammerSessions"]) {
355
+ addCheck(target, "v1.8.capability", "manifest", capabilities[flag] === true ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", `capabilities.${flag}`, true, capabilities[flag], "v1.8 capability checked.", "Register the v1.8 capability.");
356
+ }
357
+ const pathPairs = [
358
+ [manifest.coordination, "directory", "xinyun-ai/coordination/"],
359
+ [manifest.skills, "directory", "xinyun-ai/skills/"],
360
+ [manifest.frontendAudit, "directory", "xinyun-ai/frontend-audits/"],
361
+ [manifest.temporarySessions, "directory", "xinyun-ai/sessions/temporary/"],
362
+ [projectIndex.coordination, "directory", "xinyun-ai/coordination/"],
363
+ [projectIndex.skills, "directory", "xinyun-ai/skills/"],
364
+ [projectIndex.frontendAudit, "directory", "xinyun-ai/frontend-audits/"],
365
+ [projectIndex.temporarySessions, "directory", "xinyun-ai/sessions/temporary/"],
366
+ ];
367
+ for (const [object, field, expected] of pathPairs) addCheck(target, "v1.8.path", "registry", object && object[field] === expected ? "pass" : "fail", "manifest/project-index templates", field, expected, object && object[field], "v1.8 path registration checked.", "Register the v1.8 control path.");
368
+
369
+ const assignments = readJson(root, "init/xinyun-ai-init/templates/skills-assignments.template.json");
370
+ const transaction = readJson(root, "init/xinyun-ai-init/templates/coordination-transaction.template.json");
371
+ const frontend = readJson(root, "init/xinyun-ai-init/templates/frontend-audit.template.json");
372
+ const temporary = readJson(root, "init/xinyun-ai-init/templates/temporary-session.template.json");
373
+ addCheck(target, "v1.8.assignment.field", "schema", assignments.recordContract.requiredFields.includes("assignmentStatus") ? "pass" : "fail", "skills-assignments.template.json", "assignmentStatus", true, assignments.recordContract.requiredFields.includes("assignmentStatus"), "assignmentStatus field checked.", "Use assignmentStatus.");
374
+ addCheck(target, "v1.8.assignment.no-status-alias", "schema", !JSON.stringify(assignments).includes("assignments.json.status") ? "pass" : "fail", "skills-assignments.template.json", null, "no stale status alias", JSON.stringify(assignments), "No stale assignment status alias checked.", "Remove assignments.json.status.");
375
+ addCheck(target, "v1.8.transaction.phase", "schema", transaction.phaseEnum.includes("recovery-required") && transaction.phaseEnum.includes("blocked") ? "pass" : "fail", "coordination-transaction.template.json", "phaseEnum", "recovery-required,blocked", transaction.phaseEnum, "Transaction phases checked.", "Restore transaction phase enum.");
376
+ addCheck(target, "v1.8.frontend.audit-only", "schema", frontend.decision === "audit-only" && frontend.coverage === "unknown" ? "pass" : "fail", "frontend-audit.template.json", "decision/coverage", "audit-only/unknown", `${frontend.decision}/${frontend.coverage}`, "Frontend audit default checked.", "Use read-only audit defaults.");
377
+ addCheck(target, "v1.8.temporary.capacity", "schema", temporary.maxConcurrent === 3 && temporary.occupancyStatusEnum.includes("unknown") ? "pass" : "fail", "temporary-session.template.json", "maxConcurrent/occupancyStatusEnum", "3/unknown", `${temporary.maxConcurrent}/${temporary.occupancyStatusEnum}`, "Temporary session capacity checked.", "Restore capacity and unknown occupancy.");
316
378
  }
317
379
 
318
380
  function validateV171Content(root, target) {
@@ -341,7 +403,7 @@ function validateV171Content(root, target) {
341
403
  requireIncludes(root, target, "init/xinyun-ai-init/rules/upgrade-rules.md", ["v1.7.1 升级补齐"]);
342
404
  requireIncludes(root, target, "init/xinyun-ai-init/rules/directory-self-completion.md", ["v1.7.1 任务树、归档与 CodeGraph 目录"]);
343
405
  requireIncludes(root, target, "init/xinyun-ai-init/rules/session-workbench.md", ["v1.7.1 任务单补充字段"]);
344
- requireIncludes(root, target, "test-scenarios/scenarios.md", ["当前必测场景为 1-87", "当前观察场景为 88", "## 71. v1.7.1 主任务命名", "## 87. v1.7.1 普通咨询和版本回归"]);
406
+ requireIncludes(root, target, "test-scenarios/scenarios.md", ["当前必测场景为 1-105", "当前观察场景为 106", "## 71. v1.7.1 主任务命名", "## 87. v1.7.1 普通咨询和版本回归"]);
345
407
  requireIncludes(root, target, "test-scenarios/v1.7.1-scenarios.md", ["主任务命名", "CodeGraph记录与失败矩阵", "普通咨询边界"]);
346
408
  }
347
409
 
@@ -358,7 +420,7 @@ function validateV172Content(root, target) {
358
420
  "JCS-SHA-256",
359
421
  "blockedReason=write-failed",
360
422
  ];
361
- requireIncludes(root, target, "init/xinyun-ai-init/README.md", ["当前规则版本:`1.7.2`", ...snippets]);
423
+ requireIncludes(root, target, "init/xinyun-ai-init/README.md", ["当前规则版本:`1.8.0`", ...snippets]);
362
424
  requireIncludes(root, target, "init/xinyun-ai-init/templates/core-rules.template.md", snippets);
363
425
  requireIncludes(root, target, "init/xinyun-ai-init/rules/init-rules.md", ["v1.7.2 角色后续任务可见性", "role-execution"]);
364
426
  requireIncludes(root, target, "init/xinyun-ai-init/rules/upgrade-rules.md", ["v1.7.2 升级补建角色后续任务", "write-failed"]);
@@ -367,6 +429,52 @@ function validateV172Content(root, target) {
367
429
  requireIncludes(root, target, "test-scenarios/v1.7.2-scenarios.md", ["固定优先级", "幂等补建", "补建失败和索引恢复"]);
368
430
  }
369
431
 
432
+ function validateV173Content(root, target) {
433
+ const manifest = readJson(root, "init/xinyun-ai-init/templates/manifest.template.json");
434
+ const projectIndex = readJson(root, "init/xinyun-ai-init/templates/project-index.template.json");
435
+ const taskIndex = readJson(root, "init/xinyun-ai-init/templates/task-index.template.json");
436
+ const initResult = readJson(root, "init/xinyun-ai-init/templates/init-result.template.json");
437
+ const assignments = readJson(root, "init/xinyun-ai-init/templates/team/assignments.json");
438
+ const binding = readJson(root, "init/xinyun-ai-init/templates/role-session-binding.template.json");
439
+ const statusEnum = ["pending", "creating", "created", "onboarding", "ready", "blocked", "failed", "closed"];
440
+
441
+ addCheck(target, "registry.manifest", "manifest", manifest.capabilities && manifest.capabilities.codexRoleSessionOrchestration === true ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "capabilities.codexRoleSessionOrchestration", true, manifest.capabilities && manifest.capabilities.codexRoleSessionOrchestration, "Codex role session capability checked.", "Register codexRoleSessionOrchestration.");
442
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.provider === "codex" ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.provider", "codex", manifest.roleSessions && manifest.roleSessions.provider, "Role session provider checked.", "Set provider=codex.");
443
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.targetVersion === VERSION ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.targetVersion", VERSION, manifest.roleSessions && manifest.roleSessions.targetVersion, "Role session target version checked.", "Set targetVersion.");
444
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.bindings === "xinyun-ai/sessions/role-session-bindings.json" ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.bindings", "xinyun-ai/sessions/role-session-bindings.json", manifest.roleSessions && manifest.roleSessions.bindings, "Role session binding path checked.", "Register binding path.");
445
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.directory === "xinyun-ai/sessions/roles/" ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.directory", "xinyun-ai/sessions/roles/", manifest.roleSessions && manifest.roleSessions.directory, "Role session directory checked.", "Register role session directory.");
446
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && JSON.stringify(manifest.roleSessions.statusEnum) === JSON.stringify(statusEnum) ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.statusEnum", statusEnum, manifest.roleSessions && manifest.roleSessions.statusEnum, "Role session status enum checked.", "Use the fixed v1.7.3 enum.");
447
+ addCheck(target, "registry.manifest", "manifest", manifest.roleSessions && manifest.roleSessions.idempotency && JSON.stringify(manifest.roleSessions.idempotency.keyFields) === JSON.stringify(["taskId", "roleId", "provider", "targetVersion"]) ? "pass" : "fail", "init/xinyun-ai-init/templates/manifest.template.json", "roleSessions.idempotency.keyFields", ["taskId", "roleId", "provider", "targetVersion"], manifest.roleSessions && manifest.roleSessions.idempotency && manifest.roleSessions.idempotency.keyFields, "Role session idempotency fields checked.", "Use taskId + roleId + provider + targetVersion.");
448
+ addCheck(target, "registry.project-index", "project-index", projectIndex.roleSessions && projectIndex.roleSessions.provider === "codex" ? "pass" : "fail", "init/xinyun-ai-init/templates/project-index.template.json", "roleSessions.provider", "codex", projectIndex.roleSessions && projectIndex.roleSessions.provider, "Project-index role session provider checked.", "Set provider=codex.");
449
+ addCheck(target, "registry.project-index", "project-index", projectIndex.roleSessions && Array.isArray(projectIndex.roleSessions.records) ? "pass" : "fail", "init/xinyun-ai-init/templates/project-index.template.json", "roleSessions.records", "array", projectIndex.roleSessions && projectIndex.roleSessions.records, "Project-index role session records checked.", "Add records array.");
450
+ addCheck(target, "registry.task-index", "task-index", Array.isArray(taskIndex.roleSessionBindingIds) ? "pass" : "fail", "init/xinyun-ai-init/templates/task-index.template.json", "roleSessionBindingIds", "array", taskIndex.roleSessionBindingIds, "Task-index binding IDs checked.", "Add roleSessionBindingIds.");
451
+ addCheck(target, "registry.task-index", "task-index", Array.isArray(taskIndex.roleSessionBindings) ? "pass" : "fail", "init/xinyun-ai-init/templates/task-index.template.json", "roleSessionBindings", "array", taskIndex.roleSessionBindings, "Task-index bindings checked.", "Add roleSessionBindings.");
452
+ addCheck(target, "registry.task-index", "task-index", taskIndex.roleSessionIdempotency && JSON.stringify(taskIndex.roleSessionIdempotency.keyFields) === JSON.stringify(["taskId", "roleId", "provider", "targetVersion"]) ? "pass" : "fail", "init/xinyun-ai-init/templates/task-index.template.json", "roleSessionIdempotency.keyFields", ["taskId", "roleId", "provider", "targetVersion"], taskIndex.roleSessionIdempotency && taskIndex.roleSessionIdempotency.keyFields, "Task-index role session idempotency checked.", "Use fixed key fields.");
453
+ addCheck(target, "registry.init-result", "init-result", initResult.roleSessions && initResult.roleSessions.provider === "codex" ? "pass" : "fail", "init/xinyun-ai-init/templates/init-result.template.json", "roleSessions.provider", "codex", initResult.roleSessions && initResult.roleSessions.provider, "Init-result role session provider checked.", "Set provider=codex.");
454
+ addCheck(target, "registry.assignments", "assignments", assignments.recordContract && assignments.recordContract.requiredFields.includes("sessionStatus") ? "pass" : "fail", "init/xinyun-ai-init/templates/team/assignments.json", "recordContract.requiredFields", "sessionStatus", assignments.recordContract && assignments.recordContract.requiredFields, "Assignments sessionStatus checked.", "Add sessionStatus to assignments contract.");
455
+ addCheck(target, "registry.binding-template", "template", binding.provider === "codex" && binding.targetVersion === VERSION && binding.degradation && binding.degradation.fakeSessionIdProhibited === true ? "pass" : "fail", "init/xinyun-ai-init/templates/role-session-binding.template.json", "provider/targetVersion/degradation", "codex / version / fakeSessionIdProhibited", binding, "Role session binding template checked.", "Fix binding template.");
456
+
457
+ const snippets = [
458
+ "v1.7.3 Codex 角色会话自动创建与绑定",
459
+ "provider=codex",
460
+ "sessionStatus=pending/creating/created/onboarding/ready/blocked/failed/closed",
461
+ "taskId + roleId + provider + targetVersion",
462
+ "不得伪造 sessionId",
463
+ "local-degraded-no-fake-session-id",
464
+ "created-but-writeback-failed",
465
+ "创建成功不等于业务代码修改授权",
466
+ ];
467
+ requireIncludes(root, target, "init/xinyun-ai-init/README.md", ["当前规则版本:`1.8.0`", ...snippets]);
468
+ requireIncludes(root, target, "init/xinyun-ai-init/templates/core-rules.template.md", snippets);
469
+ requireIncludes(root, target, "init/xinyun-ai-init/templates/AGENTS.template.md", ["v1.7.3 Codex 角色会话自动创建与绑定", "provider=codex", "local-degraded-no-fake-session-id"]);
470
+ requireIncludes(root, target, "init/xinyun-ai-init/rules/init-rules.md", ["v1.7.3 Codex 角色会话初始化", "provider=codex", "local-degraded-no-fake-session-id"]);
471
+ requireIncludes(root, target, "init/xinyun-ai-init/rules/upgrade-rules.md", ["v1.7.3 升级创建和绑定真实角色会话", "created-but-writeback-failed", "不得伪造 sessionId"]);
472
+ requireIncludes(root, target, "init/xinyun-ai-init/rules/session-workbench.md", ["v1.7.3 角色会话交接字段", "roleSessionIdempotency", "不得伪造 sessionId"]);
473
+ requireIncludes(root, target, "init/xinyun-ai-init/rules/directory-self-completion.md", ["v1.7.3 角色会话绑定目录", "xinyun-ai/sessions/role-session-bindings.json", "local-degraded-no-fake-session-id"]);
474
+ requireIncludes(root, target, "test-scenarios/v1.7.3-scenarios.md", ["五个真实角色子会话创建", "会话绑定回写一致性", "onboarding 只读边界", "宿主不支持时本地降级"]);
475
+ requireIncludes(root, target, "test-scenarios/scenarios.md", ["当前必测场景为 1-105", "当前观察场景为 106", "## 89. v1.7.3 Codex 真实角色会话创建", "## 96. v1.7.3 普通咨询边界"]);
476
+ }
477
+
370
478
  function validateJsonFiles(root, target) {
371
479
  const jsonFiles = [
372
480
  "package.json",
@@ -377,6 +485,7 @@ function validateJsonFiles(root, target) {
377
485
  "init/xinyun-ai-init/templates/html-migration-record.template.json",
378
486
  "init/xinyun-ai-init/templates/task-index.template.json",
379
487
  "init/xinyun-ai-init/templates/archive-transaction.template.json",
488
+ "init/xinyun-ai-init/templates/role-session-binding.template.json",
380
489
  ];
381
490
 
382
491
  for (const file of jsonFiles) {
@@ -404,6 +513,8 @@ function validateRoot(root, target, isTarball = false) {
404
513
  validateV17Content(root, target);
405
514
  validateV171Content(root, target);
406
515
  validateV172Content(root, target);
516
+ validateV173Content(root, target);
517
+ validateV18Content(root, target);
407
518
  validateJsonFiles(root, target);
408
519
  }
409
520