@wowok/agent-mcp 2.5.2 → 2.5.3

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 (98) hide show
  1. package/dist/index.js +46 -6
  2. package/dist/knowledge/guard-design-patterns.js +104 -1
  3. package/dist/knowledge/guard-ledger.js +3 -3
  4. package/dist/knowledge/guard-lint.js +3 -3
  5. package/dist/knowledge/guard-risk.js +23 -15
  6. package/dist/knowledge/guard-templates.js +174 -2
  7. package/dist/knowledge/guard-translation.js +3 -3
  8. package/dist/knowledge/index.d.ts +3 -0
  9. package/dist/knowledge/index.js +9 -0
  10. package/dist/knowledge/machine-context.d.ts +1 -1
  11. package/dist/knowledge/machine-context.js +21 -0
  12. package/dist/knowledge/machine-ledger.d.ts +1 -0
  13. package/dist/knowledge/machine-ledger.js +31 -11
  14. package/dist/knowledge/machine-templates.js +32 -78
  15. package/dist/knowledge/overrides-loader.d.ts +13 -0
  16. package/dist/knowledge/overrides-loader.js +67 -0
  17. package/dist/knowledge/payment-risk.d.ts +4 -0
  18. package/dist/knowledge/payment-risk.js +67 -0
  19. package/dist/knowledge/repository-confirm.d.ts +4 -0
  20. package/dist/knowledge/repository-confirm.js +44 -0
  21. package/dist/knowledge/repository-risk.d.ts +8 -2
  22. package/dist/knowledge/repository-risk.js +61 -0
  23. package/dist/knowledge/repository-translation.js +23 -0
  24. package/dist/knowledge/scenario-modes.js +22 -5
  25. package/dist/knowledge/service-templates.js +38 -0
  26. package/dist/knowledge/treasury-templates.js +42 -0
  27. package/dist/loop-engineering/context-collect.d.ts +7 -0
  28. package/dist/loop-engineering/context-collect.js +83 -0
  29. package/dist/loop-engineering/improve.d.ts +29 -0
  30. package/dist/loop-engineering/improve.js +178 -0
  31. package/dist/project/context-assembly.d.ts +16 -0
  32. package/dist/project/context-assembly.js +130 -0
  33. package/dist/project/deployment-doc.d.ts +115 -0
  34. package/dist/project/deployment-doc.js +595 -0
  35. package/dist/project/index.js +37 -1
  36. package/dist/project/migration.d.ts +22 -0
  37. package/dist/project/migration.js +125 -0
  38. package/dist/project/project-store.d.ts +110 -0
  39. package/dist/project/project-store.js +425 -0
  40. package/dist/project/rollback-policy.d.ts +45 -0
  41. package/dist/project/rollback-policy.js +290 -0
  42. package/dist/project/stage-gate.d.ts +49 -0
  43. package/dist/project/stage-gate.js +310 -0
  44. package/dist/schema/call/allocation.d.ts +5 -0
  45. package/dist/schema/call/arbitration.d.ts +5 -0
  46. package/dist/schema/call/base.d.ts +3 -0
  47. package/dist/schema/call/base.js +1 -0
  48. package/dist/schema/call/bridge.d.ts +24 -0
  49. package/dist/schema/call/contact.d.ts +5 -0
  50. package/dist/schema/call/demand.d.ts +5 -0
  51. package/dist/schema/call/guard.d.ts +15 -0
  52. package/dist/schema/call/machine.d.ts +10 -0
  53. package/dist/schema/call/order.d.ts +5 -0
  54. package/dist/schema/call/payment.d.ts +5 -0
  55. package/dist/schema/call/permission.d.ts +5 -0
  56. package/dist/schema/call/personal.d.ts +5 -0
  57. package/dist/schema/call/progress.d.ts +5 -0
  58. package/dist/schema/call/proof.d.ts +10 -0
  59. package/dist/schema/call/repository.d.ts +5 -0
  60. package/dist/schema/call/reward.d.ts +5 -0
  61. package/dist/schema/call/service.d.ts +5 -0
  62. package/dist/schema/call/treasury.d.ts +5 -0
  63. package/dist/schema/operations.d.ts +210 -0
  64. package/dist/schema/operations.js +24 -0
  65. package/dist/schema/project/index.d.ts +2619 -106
  66. package/dist/schema/project/index.js +622 -2
  67. package/dist/schema/query/index.d.ts +601 -0
  68. package/dist/schema/query/index.js +61 -0
  69. package/dist/schemas/bridge_operation.schema.json +4 -0
  70. package/dist/schemas/guard2file.schema.json +4 -0
  71. package/dist/schemas/index.json +1 -1
  72. package/dist/schemas/machineNode2file.schema.json +4 -0
  73. package/dist/schemas/onchain_operations.schema.json +20 -0
  74. package/dist/schemas/onchain_operations_allocation.schema.json +4 -0
  75. package/dist/schemas/onchain_operations_arbitration.schema.json +4 -0
  76. package/dist/schemas/onchain_operations_contact.schema.json +4 -0
  77. package/dist/schemas/onchain_operations_demand.schema.json +4 -0
  78. package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -0
  79. package/dist/schemas/onchain_operations_gen_proof.schema.json +8 -0
  80. package/dist/schemas/onchain_operations_guard.schema.json +4 -0
  81. package/dist/schemas/onchain_operations_machine.schema.json +4 -0
  82. package/dist/schemas/onchain_operations_order.schema.json +4 -0
  83. package/dist/schemas/onchain_operations_payment.schema.json +4 -0
  84. package/dist/schemas/onchain_operations_permission.schema.json +4 -0
  85. package/dist/schemas/onchain_operations_personal.schema.json +4 -0
  86. package/dist/schemas/onchain_operations_progress.schema.json +4 -0
  87. package/dist/schemas/onchain_operations_proof.schema.json +4 -0
  88. package/dist/schemas/onchain_operations_repository.schema.json +4 -0
  89. package/dist/schemas/onchain_operations_reward.schema.json +4 -0
  90. package/dist/schemas/onchain_operations_service.schema.json +4 -0
  91. package/dist/schemas/onchain_operations_treasury.schema.json +4 -0
  92. package/dist/schemas/project_operation.output.json +1798 -0
  93. package/dist/schemas/project_operation.schema.json +132 -2
  94. package/dist/schemas/query_toolkit.output.json +407 -1
  95. package/dist/schemas/query_toolkit.schema.json +132 -0
  96. package/dist/tools/handlers/project.js +742 -1
  97. package/dist/tools/handlers/query.js +38 -2
  98. package/package.json +2 -2
@@ -376,6 +376,81 @@
376
376
  "items": {
377
377
  "type": "string"
378
378
  }
379
+ },
380
+ "gate_validation": {
381
+ "type": "object",
382
+ "properties": {
383
+ "stage": {
384
+ "type": "integer",
385
+ "minimum": 1,
386
+ "maximum": 5
387
+ },
388
+ "passed": {
389
+ "type": "boolean",
390
+ "description": "True when no FAIL checks exist."
391
+ },
392
+ "checks": {
393
+ "type": "array",
394
+ "items": {
395
+ "type": "object",
396
+ "properties": {
397
+ "dimension": {
398
+ "type": "string",
399
+ "enum": [
400
+ "semantic",
401
+ "tools",
402
+ "reversibility",
403
+ "risk",
404
+ "isolation",
405
+ "gas_budget"
406
+ ]
407
+ },
408
+ "status": {
409
+ "type": "string",
410
+ "enum": [
411
+ "PASS",
412
+ "FAIL",
413
+ "WARN"
414
+ ]
415
+ },
416
+ "message": {
417
+ "type": "string"
418
+ }
419
+ },
420
+ "required": [
421
+ "dimension",
422
+ "status",
423
+ "message"
424
+ ],
425
+ "additionalProperties": false
426
+ }
427
+ },
428
+ "blocking_issues": {
429
+ "type": "array",
430
+ "items": {
431
+ "type": "string"
432
+ }
433
+ },
434
+ "warnings": {
435
+ "type": "array",
436
+ "items": {
437
+ "type": "string"
438
+ }
439
+ },
440
+ "can_proceed": {
441
+ "type": "boolean"
442
+ }
443
+ },
444
+ "required": [
445
+ "stage",
446
+ "passed",
447
+ "checks",
448
+ "blocking_issues",
449
+ "warnings",
450
+ "can_proceed"
451
+ ],
452
+ "additionalProperties": false,
453
+ "description": "Stage gate validation result (6 dimensions: semantic/tools/reversibility/risk/isolation/gas_budget)."
379
454
  }
380
455
  },
381
456
  "required": [
@@ -605,6 +680,9 @@
605
680
  "user_action_required": {
606
681
  "type": "string",
607
682
  "description": "Human-readable next-step guidance."
683
+ },
684
+ "gate_validation": {
685
+ "$ref": "#/definitions/project_operation/properties/result/anyOf/10/properties/gate_validation"
608
686
  }
609
687
  },
610
688
  "required": [
@@ -760,6 +838,28 @@
760
838
  "additionalProperties": false,
761
839
  "description": "Gas cost estimate for deploying all objects."
762
840
  },
841
+ "persisted": {
842
+ "type": "object",
843
+ "properties": {
844
+ "all_files": {
845
+ "type": "array",
846
+ "items": {
847
+ "type": "string"
848
+ },
849
+ "description": "Project-relative paths of all generated files (27 total)."
850
+ },
851
+ "all_stages_passed": {
852
+ "type": "boolean",
853
+ "description": "Whether all 5 stage gates passed validation."
854
+ }
855
+ },
856
+ "required": [
857
+ "all_files",
858
+ "all_stages_passed"
859
+ ],
860
+ "additionalProperties": false,
861
+ "description": "Nested-autonomy doc set persistence result (§11). Present when the doc set was successfully written to disk."
862
+ },
763
863
  "can_proceed": {
764
864
  "type": "boolean",
765
865
  "description": "Whether the user can proceed to stage 5. False when D-errors exist."
@@ -775,6 +875,9 @@
775
875
  },
776
876
  "user_action_required": {
777
877
  "type": "string"
878
+ },
879
+ "gate_validation": {
880
+ "$ref": "#/definitions/project_operation/properties/result/anyOf/10/properties/gate_validation"
778
881
  }
779
882
  },
780
883
  "required": [
@@ -1000,6 +1103,9 @@
1000
1103
  },
1001
1104
  "user_action_required": {
1002
1105
  "type": "string"
1106
+ },
1107
+ "gate_validation": {
1108
+ "$ref": "#/definitions/project_operation/properties/result/anyOf/10/properties/gate_validation"
1003
1109
  }
1004
1110
  },
1005
1111
  "required": [
@@ -1079,6 +1185,1698 @@
1079
1185
  "can_proceed"
1080
1186
  ],
1081
1187
  "additionalProperties": false
1188
+ },
1189
+ {
1190
+ "type": "object",
1191
+ "properties": {
1192
+ "action": {
1193
+ "type": "string",
1194
+ "const": "load_project"
1195
+ },
1196
+ "items": {
1197
+ "type": "array",
1198
+ "items": {
1199
+ "type": "object",
1200
+ "properties": {
1201
+ "prefix": {
1202
+ "type": "string"
1203
+ },
1204
+ "version": {
1205
+ "type": "string"
1206
+ },
1207
+ "dir_name": {
1208
+ "type": "string"
1209
+ },
1210
+ "initialized": {
1211
+ "type": "boolean"
1212
+ },
1213
+ "archived": {
1214
+ "type": "boolean"
1215
+ },
1216
+ "needs_migration": {
1217
+ "type": "boolean",
1218
+ "description": "Whether schema_version differs from current."
1219
+ },
1220
+ "forked_from": {
1221
+ "type": "string"
1222
+ },
1223
+ "chain_exists": {
1224
+ "type": "boolean",
1225
+ "description": "Whether the project prefix exists on-chain."
1226
+ },
1227
+ "sync_status": {
1228
+ "type": "string",
1229
+ "enum": [
1230
+ "synced",
1231
+ "local_only",
1232
+ "archived",
1233
+ "uninitialized"
1234
+ ],
1235
+ "description": "Cross-validation of local filesystem vs chain truth."
1236
+ }
1237
+ },
1238
+ "required": [
1239
+ "prefix",
1240
+ "version",
1241
+ "dir_name",
1242
+ "initialized",
1243
+ "archived",
1244
+ "needs_migration",
1245
+ "chain_exists",
1246
+ "sync_status"
1247
+ ],
1248
+ "additionalProperties": false
1249
+ }
1250
+ },
1251
+ "total": {
1252
+ "type": "integer"
1253
+ },
1254
+ "project": {
1255
+ "type": "string"
1256
+ },
1257
+ "version": {
1258
+ "type": "string"
1259
+ },
1260
+ "local_exists": {
1261
+ "type": "boolean"
1262
+ },
1263
+ "manifest": {
1264
+ "type": "object",
1265
+ "properties": {
1266
+ "schema_version": {
1267
+ "type": "string"
1268
+ },
1269
+ "mcp_version": {
1270
+ "type": "string"
1271
+ },
1272
+ "prefix": {
1273
+ "type": "string"
1274
+ },
1275
+ "version": {
1276
+ "type": "string"
1277
+ },
1278
+ "created_at": {
1279
+ "type": "string"
1280
+ },
1281
+ "updated_at": {
1282
+ "type": "string"
1283
+ },
1284
+ "forked_from": {
1285
+ "type": "string"
1286
+ },
1287
+ "needs_recalibration": {
1288
+ "type": "boolean"
1289
+ }
1290
+ },
1291
+ "required": [
1292
+ "schema_version",
1293
+ "mcp_version",
1294
+ "prefix",
1295
+ "version",
1296
+ "created_at",
1297
+ "updated_at"
1298
+ ],
1299
+ "additionalProperties": false
1300
+ },
1301
+ "stage_state": {
1302
+ "type": "object",
1303
+ "properties": {
1304
+ "stage": {
1305
+ "type": "integer",
1306
+ "minimum": 1,
1307
+ "maximum": 5
1308
+ },
1309
+ "updated_at": {
1310
+ "type": "integer"
1311
+ },
1312
+ "has_published_object": {
1313
+ "type": "boolean"
1314
+ },
1315
+ "archived": {
1316
+ "type": "boolean"
1317
+ }
1318
+ },
1319
+ "additionalProperties": false
1320
+ },
1321
+ "sync_status": {
1322
+ "type": "object",
1323
+ "properties": {
1324
+ "local_exists": {
1325
+ "type": "boolean"
1326
+ },
1327
+ "initialized": {
1328
+ "type": "boolean"
1329
+ },
1330
+ "needs_migration": {
1331
+ "type": "boolean"
1332
+ },
1333
+ "archived": {
1334
+ "type": "boolean"
1335
+ }
1336
+ },
1337
+ "required": [
1338
+ "local_exists",
1339
+ "initialized",
1340
+ "needs_migration",
1341
+ "archived"
1342
+ ],
1343
+ "additionalProperties": false
1344
+ },
1345
+ "migration": {
1346
+ "type": "object",
1347
+ "properties": {
1348
+ "migrated": {
1349
+ "type": "boolean",
1350
+ "description": "Whether a migration was performed."
1351
+ },
1352
+ "from_version": {
1353
+ "type": "string"
1354
+ },
1355
+ "to_version": {
1356
+ "type": "string"
1357
+ },
1358
+ "steps_executed": {
1359
+ "type": "array",
1360
+ "items": {
1361
+ "type": "string"
1362
+ }
1363
+ },
1364
+ "backup_path": {
1365
+ "type": "string"
1366
+ },
1367
+ "needs_recalibration": {
1368
+ "type": "boolean"
1369
+ },
1370
+ "message": {
1371
+ "type": "string"
1372
+ }
1373
+ },
1374
+ "required": [
1375
+ "migrated",
1376
+ "from_version",
1377
+ "to_version",
1378
+ "steps_executed",
1379
+ "needs_recalibration",
1380
+ "message"
1381
+ ],
1382
+ "additionalProperties": false
1383
+ },
1384
+ "message": {
1385
+ "type": "string"
1386
+ }
1387
+ },
1388
+ "required": [
1389
+ "action"
1390
+ ],
1391
+ "additionalProperties": false
1392
+ },
1393
+ {
1394
+ "type": "object",
1395
+ "properties": {
1396
+ "action": {
1397
+ "type": "string",
1398
+ "const": "fork_project"
1399
+ },
1400
+ "new_prefix": {
1401
+ "type": "string"
1402
+ },
1403
+ "new_version": {
1404
+ "type": "string"
1405
+ },
1406
+ "new_path": {
1407
+ "type": "string",
1408
+ "description": "Absolute filesystem path of the new project directory."
1409
+ },
1410
+ "forked_from": {
1411
+ "type": "string",
1412
+ "description": "Absolute path of the source project directory."
1413
+ },
1414
+ "copied_files": {
1415
+ "type": "array",
1416
+ "items": {
1417
+ "type": "string"
1418
+ },
1419
+ "description": "Project-relative paths of copied files (excludes stage.json + audit.jsonl)."
1420
+ },
1421
+ "copied_file_count": {
1422
+ "type": "integer"
1423
+ },
1424
+ "warning": {
1425
+ "type": "string",
1426
+ "description": "Project isolation notice — forked project must re-create its own objects."
1427
+ },
1428
+ "next_action": {
1429
+ "type": "string",
1430
+ "const": "analyze_intent",
1431
+ "description": "The forked project starts at stage 2 (analyze_intent)."
1432
+ }
1433
+ },
1434
+ "required": [
1435
+ "action",
1436
+ "new_prefix",
1437
+ "new_version",
1438
+ "new_path",
1439
+ "forked_from",
1440
+ "copied_files",
1441
+ "copied_file_count",
1442
+ "warning",
1443
+ "next_action"
1444
+ ],
1445
+ "additionalProperties": false
1446
+ },
1447
+ {
1448
+ "type": "object",
1449
+ "properties": {
1450
+ "action": {
1451
+ "type": "string",
1452
+ "const": "export_project"
1453
+ },
1454
+ "project": {
1455
+ "type": "string"
1456
+ },
1457
+ "version": {
1458
+ "type": "string"
1459
+ },
1460
+ "files": {
1461
+ "type": "array",
1462
+ "items": {
1463
+ "type": "object",
1464
+ "properties": {
1465
+ "path": {
1466
+ "type": "string",
1467
+ "description": "Project-relative file path."
1468
+ },
1469
+ "size": {
1470
+ "type": "integer",
1471
+ "description": "File size in bytes."
1472
+ },
1473
+ "kind": {
1474
+ "type": "string",
1475
+ "enum": [
1476
+ "json",
1477
+ "markdown",
1478
+ "jsonl",
1479
+ "other"
1480
+ ]
1481
+ },
1482
+ "content": {
1483
+ "type": "string",
1484
+ "description": "File content (text)."
1485
+ }
1486
+ },
1487
+ "required": [
1488
+ "path",
1489
+ "size",
1490
+ "kind",
1491
+ "content"
1492
+ ],
1493
+ "additionalProperties": false
1494
+ }
1495
+ },
1496
+ "total_files": {
1497
+ "type": "integer"
1498
+ }
1499
+ },
1500
+ "required": [
1501
+ "action",
1502
+ "project",
1503
+ "version",
1504
+ "files",
1505
+ "total_files"
1506
+ ],
1507
+ "additionalProperties": false
1508
+ },
1509
+ {
1510
+ "type": "object",
1511
+ "properties": {
1512
+ "action": {
1513
+ "type": "string",
1514
+ "const": "get_project_files"
1515
+ },
1516
+ "project": {
1517
+ "type": "string"
1518
+ },
1519
+ "version": {
1520
+ "type": "string"
1521
+ },
1522
+ "files": {
1523
+ "type": "array",
1524
+ "items": {
1525
+ "type": "object",
1526
+ "properties": {
1527
+ "path": {
1528
+ "type": "string",
1529
+ "description": "Project-relative file path."
1530
+ },
1531
+ "size": {
1532
+ "type": "integer",
1533
+ "description": "File size in bytes."
1534
+ },
1535
+ "kind": {
1536
+ "type": "string",
1537
+ "enum": [
1538
+ "json",
1539
+ "markdown",
1540
+ "jsonl",
1541
+ "other"
1542
+ ]
1543
+ },
1544
+ "mtime": {
1545
+ "type": "integer",
1546
+ "description": "Last modified time (ms)."
1547
+ }
1548
+ },
1549
+ "required": [
1550
+ "path",
1551
+ "size",
1552
+ "kind",
1553
+ "mtime"
1554
+ ],
1555
+ "additionalProperties": false
1556
+ }
1557
+ },
1558
+ "total_files": {
1559
+ "type": "integer"
1560
+ }
1561
+ },
1562
+ "required": [
1563
+ "action",
1564
+ "project",
1565
+ "version",
1566
+ "files",
1567
+ "total_files"
1568
+ ],
1569
+ "additionalProperties": false
1570
+ },
1571
+ {
1572
+ "type": "object",
1573
+ "properties": {
1574
+ "action": {
1575
+ "type": "string",
1576
+ "const": "validate_stage_unit"
1577
+ },
1578
+ "project": {
1579
+ "type": "string"
1580
+ },
1581
+ "version": {
1582
+ "type": "string"
1583
+ },
1584
+ "stage": {
1585
+ "type": "integer",
1586
+ "minimum": 1,
1587
+ "maximum": 5
1588
+ },
1589
+ "valid": {
1590
+ "type": "boolean",
1591
+ "description": "True when all 4 stage unit files exist and pass consistency checks."
1592
+ },
1593
+ "missing_files": {
1594
+ "type": "array",
1595
+ "items": {
1596
+ "type": "string"
1597
+ },
1598
+ "description": "Project-relative paths of missing stage unit files (empty if all present)."
1599
+ },
1600
+ "checks": {
1601
+ "type": "array",
1602
+ "items": {
1603
+ "type": "object",
1604
+ "properties": {
1605
+ "check_id": {
1606
+ "type": "string"
1607
+ },
1608
+ "status": {
1609
+ "type": "string",
1610
+ "enum": [
1611
+ "pass",
1612
+ "fail",
1613
+ "warn"
1614
+ ]
1615
+ },
1616
+ "message": {
1617
+ "type": "string"
1618
+ }
1619
+ },
1620
+ "required": [
1621
+ "check_id",
1622
+ "status",
1623
+ "message"
1624
+ ],
1625
+ "additionalProperties": false
1626
+ }
1627
+ },
1628
+ "blocking_issues": {
1629
+ "type": "array",
1630
+ "items": {
1631
+ "type": "string"
1632
+ }
1633
+ },
1634
+ "stage_passed": {
1635
+ "type": "boolean",
1636
+ "description": "From verification.json stage_passed field (undefined if file missing)."
1637
+ }
1638
+ },
1639
+ "required": [
1640
+ "action",
1641
+ "project",
1642
+ "version",
1643
+ "stage",
1644
+ "valid",
1645
+ "missing_files",
1646
+ "checks",
1647
+ "blocking_issues"
1648
+ ],
1649
+ "additionalProperties": false
1650
+ },
1651
+ {
1652
+ "type": "object",
1653
+ "properties": {
1654
+ "action": {
1655
+ "type": "string",
1656
+ "const": "get_stage_assessment"
1657
+ },
1658
+ "project": {
1659
+ "type": "string"
1660
+ },
1661
+ "version": {
1662
+ "type": "string"
1663
+ },
1664
+ "stage": {
1665
+ "type": "integer",
1666
+ "minimum": 1,
1667
+ "maximum": 5
1668
+ },
1669
+ "found": {
1670
+ "type": "boolean"
1671
+ },
1672
+ "assessment": {
1673
+ "type": "object",
1674
+ "properties": {
1675
+ "stage": {
1676
+ "type": "integer",
1677
+ "minimum": 1,
1678
+ "maximum": 5
1679
+ },
1680
+ "assessed_at": {
1681
+ "type": "integer"
1682
+ },
1683
+ "goal_completion": {
1684
+ "type": "object",
1685
+ "additionalProperties": {
1686
+ "type": "number"
1687
+ }
1688
+ },
1689
+ "findings": {
1690
+ "type": "array",
1691
+ "items": {
1692
+ "type": "object",
1693
+ "properties": {
1694
+ "finding_id": {
1695
+ "type": "string"
1696
+ },
1697
+ "severity": {
1698
+ "type": "string",
1699
+ "enum": [
1700
+ "info",
1701
+ "warn",
1702
+ "critical"
1703
+ ]
1704
+ },
1705
+ "criterion_id": {
1706
+ "type": "string"
1707
+ },
1708
+ "description": {
1709
+ "type": "string"
1710
+ },
1711
+ "evidence": {}
1712
+ },
1713
+ "required": [
1714
+ "finding_id",
1715
+ "severity",
1716
+ "criterion_id",
1717
+ "description"
1718
+ ],
1719
+ "additionalProperties": false
1720
+ }
1721
+ },
1722
+ "recommendations": {
1723
+ "type": "array",
1724
+ "items": {
1725
+ "type": "string"
1726
+ }
1727
+ }
1728
+ },
1729
+ "required": [
1730
+ "stage",
1731
+ "assessed_at",
1732
+ "goal_completion",
1733
+ "findings",
1734
+ "recommendations"
1735
+ ],
1736
+ "additionalProperties": false,
1737
+ "description": "The stage assessment object (from assessment.json)."
1738
+ }
1739
+ },
1740
+ "required": [
1741
+ "action",
1742
+ "project",
1743
+ "version",
1744
+ "stage",
1745
+ "found"
1746
+ ],
1747
+ "additionalProperties": false
1748
+ },
1749
+ {
1750
+ "type": "object",
1751
+ "properties": {
1752
+ "action": {
1753
+ "type": "string",
1754
+ "const": "get_stage_risk_policy"
1755
+ },
1756
+ "project": {
1757
+ "type": "string"
1758
+ },
1759
+ "version": {
1760
+ "type": "string"
1761
+ },
1762
+ "stage": {
1763
+ "type": "integer",
1764
+ "minimum": 1,
1765
+ "maximum": 5
1766
+ },
1767
+ "found": {
1768
+ "type": "boolean"
1769
+ },
1770
+ "risk_policy": {
1771
+ "type": "object",
1772
+ "properties": {
1773
+ "stage": {
1774
+ "type": "integer",
1775
+ "minimum": 1,
1776
+ "maximum": 5
1777
+ },
1778
+ "risks": {
1779
+ "type": "array",
1780
+ "items": {
1781
+ "type": "object",
1782
+ "properties": {
1783
+ "risk_id": {
1784
+ "type": "string"
1785
+ },
1786
+ "category": {
1787
+ "type": "string",
1788
+ "enum": [
1789
+ "naming",
1790
+ "dependency",
1791
+ "operational",
1792
+ "financial",
1793
+ "security"
1794
+ ]
1795
+ },
1796
+ "description": {
1797
+ "type": "string"
1798
+ },
1799
+ "likelihood": {
1800
+ "type": "string",
1801
+ "enum": [
1802
+ "low",
1803
+ "medium",
1804
+ "high"
1805
+ ]
1806
+ },
1807
+ "impact": {
1808
+ "type": "string",
1809
+ "enum": [
1810
+ "low",
1811
+ "medium",
1812
+ "high",
1813
+ "critical"
1814
+ ]
1815
+ },
1816
+ "mitigation": {
1817
+ "type": "string"
1818
+ },
1819
+ "owner": {
1820
+ "type": "string",
1821
+ "enum": [
1822
+ "ai",
1823
+ "user",
1824
+ "system"
1825
+ ]
1826
+ }
1827
+ },
1828
+ "required": [
1829
+ "risk_id",
1830
+ "category",
1831
+ "description",
1832
+ "likelihood",
1833
+ "impact",
1834
+ "mitigation",
1835
+ "owner"
1836
+ ],
1837
+ "additionalProperties": false
1838
+ }
1839
+ },
1840
+ "active_controls": {
1841
+ "type": "array",
1842
+ "items": {
1843
+ "type": "object",
1844
+ "properties": {
1845
+ "control_id": {
1846
+ "type": "string"
1847
+ },
1848
+ "control_type": {
1849
+ "type": "string",
1850
+ "enum": [
1851
+ "preventive",
1852
+ "detective",
1853
+ "corrective"
1854
+ ]
1855
+ },
1856
+ "target_risk": {
1857
+ "type": "string"
1858
+ },
1859
+ "implementation": {
1860
+ "type": "string"
1861
+ },
1862
+ "verified": {
1863
+ "type": "boolean"
1864
+ }
1865
+ },
1866
+ "required": [
1867
+ "control_id",
1868
+ "control_type",
1869
+ "target_risk",
1870
+ "implementation",
1871
+ "verified"
1872
+ ],
1873
+ "additionalProperties": false
1874
+ }
1875
+ },
1876
+ "residual_risks": {
1877
+ "type": "array",
1878
+ "items": {
1879
+ "type": "string"
1880
+ }
1881
+ }
1882
+ },
1883
+ "required": [
1884
+ "stage",
1885
+ "risks",
1886
+ "active_controls",
1887
+ "residual_risks"
1888
+ ],
1889
+ "additionalProperties": false,
1890
+ "description": "The stage risk policy object (from risk-policy.json)."
1891
+ }
1892
+ },
1893
+ "required": [
1894
+ "action",
1895
+ "project",
1896
+ "version",
1897
+ "stage",
1898
+ "found"
1899
+ ],
1900
+ "additionalProperties": false
1901
+ },
1902
+ {
1903
+ "type": "object",
1904
+ "properties": {
1905
+ "action": {
1906
+ "type": "string",
1907
+ "const": "get_doc_relations"
1908
+ },
1909
+ "project": {
1910
+ "type": "string"
1911
+ },
1912
+ "version": {
1913
+ "type": "string"
1914
+ },
1915
+ "found": {
1916
+ "type": "boolean"
1917
+ },
1918
+ "relations": {
1919
+ "type": "object",
1920
+ "properties": {
1921
+ "version": {
1922
+ "type": "string"
1923
+ },
1924
+ "generated_at": {
1925
+ "type": "integer"
1926
+ },
1927
+ "project_invariants": {
1928
+ "type": "array",
1929
+ "items": {
1930
+ "type": "object",
1931
+ "properties": {
1932
+ "invariant_id": {
1933
+ "type": "string"
1934
+ },
1935
+ "description": {
1936
+ "type": "string"
1937
+ },
1938
+ "verified_by_stages": {
1939
+ "type": "array",
1940
+ "items": {
1941
+ "type": "integer"
1942
+ }
1943
+ }
1944
+ },
1945
+ "required": [
1946
+ "invariant_id",
1947
+ "description",
1948
+ "verified_by_stages"
1949
+ ],
1950
+ "additionalProperties": false
1951
+ }
1952
+ },
1953
+ "stage_units": {
1954
+ "type": "array",
1955
+ "items": {
1956
+ "type": "object",
1957
+ "properties": {
1958
+ "stage": {
1959
+ "type": "integer",
1960
+ "minimum": 1,
1961
+ "maximum": 5
1962
+ },
1963
+ "goal_id": {
1964
+ "type": "string"
1965
+ },
1966
+ "assessment_id": {
1967
+ "type": "string"
1968
+ },
1969
+ "risk_policy_id": {
1970
+ "type": "string"
1971
+ },
1972
+ "verification_id": {
1973
+ "type": "string"
1974
+ },
1975
+ "artifacts": {
1976
+ "type": "array",
1977
+ "items": {
1978
+ "type": "string"
1979
+ }
1980
+ }
1981
+ },
1982
+ "required": [
1983
+ "stage",
1984
+ "goal_id",
1985
+ "assessment_id",
1986
+ "risk_policy_id",
1987
+ "verification_id",
1988
+ "artifacts"
1989
+ ],
1990
+ "additionalProperties": false
1991
+ }
1992
+ },
1993
+ "derivations": {
1994
+ "type": "array",
1995
+ "items": {
1996
+ "type": "object",
1997
+ "properties": {
1998
+ "source_type": {
1999
+ "type": "string",
2000
+ "enum": [
2001
+ "project_invariant",
2002
+ "project_goal"
2003
+ ]
2004
+ },
2005
+ "source_id": {
2006
+ "type": "string"
2007
+ },
2008
+ "target_type": {
2009
+ "type": "string",
2010
+ "enum": [
2011
+ "stage_goal",
2012
+ "stage_risk",
2013
+ "stage_verification"
2014
+ ]
2015
+ },
2016
+ "target_stage": {
2017
+ "type": "integer",
2018
+ "minimum": 1,
2019
+ "maximum": 5
2020
+ },
2021
+ "target_id": {
2022
+ "type": "string"
2023
+ },
2024
+ "derivation_logic": {
2025
+ "type": "string"
2026
+ }
2027
+ },
2028
+ "required": [
2029
+ "source_type",
2030
+ "source_id",
2031
+ "target_type",
2032
+ "target_stage",
2033
+ "target_id",
2034
+ "derivation_logic"
2035
+ ],
2036
+ "additionalProperties": false
2037
+ }
2038
+ },
2039
+ "propagation_rules": {
2040
+ "type": "array",
2041
+ "items": {
2042
+ "type": "object",
2043
+ "properties": {
2044
+ "rule_id": {
2045
+ "type": "string"
2046
+ },
2047
+ "trigger": {
2048
+ "type": "object",
2049
+ "properties": {
2050
+ "stage": {
2051
+ "type": "integer"
2052
+ },
2053
+ "event": {
2054
+ "type": "string",
2055
+ "enum": [
2056
+ "verification_passed",
2057
+ "verification_failed"
2058
+ ]
2059
+ }
2060
+ },
2061
+ "required": [
2062
+ "stage",
2063
+ "event"
2064
+ ],
2065
+ "additionalProperties": false
2066
+ },
2067
+ "effect": {
2068
+ "type": "object",
2069
+ "properties": {
2070
+ "target": {
2071
+ "type": "string",
2072
+ "enum": [
2073
+ "project_invariant",
2074
+ "next_stage"
2075
+ ]
2076
+ },
2077
+ "action": {
2078
+ "type": "string",
2079
+ "enum": [
2080
+ "verify",
2081
+ "block"
2082
+ ]
2083
+ }
2084
+ },
2085
+ "required": [
2086
+ "target",
2087
+ "action"
2088
+ ],
2089
+ "additionalProperties": false
2090
+ }
2091
+ },
2092
+ "required": [
2093
+ "rule_id",
2094
+ "trigger",
2095
+ "effect"
2096
+ ],
2097
+ "additionalProperties": false
2098
+ }
2099
+ },
2100
+ "impact_map": {
2101
+ "type": "object",
2102
+ "additionalProperties": {
2103
+ "type": "array",
2104
+ "items": {
2105
+ "type": "string"
2106
+ }
2107
+ }
2108
+ }
2109
+ },
2110
+ "required": [
2111
+ "version",
2112
+ "generated_at",
2113
+ "project_invariants",
2114
+ "stage_units",
2115
+ "derivations",
2116
+ "propagation_rules",
2117
+ "impact_map"
2118
+ ],
2119
+ "additionalProperties": false,
2120
+ "description": "The validation chain graph (from relations.json)."
2121
+ }
2122
+ },
2123
+ "required": [
2124
+ "action",
2125
+ "project",
2126
+ "version",
2127
+ "found"
2128
+ ],
2129
+ "additionalProperties": false
2130
+ },
2131
+ {
2132
+ "type": "object",
2133
+ "properties": {
2134
+ "action": {
2135
+ "type": "string",
2136
+ "const": "update_deployment_doc"
2137
+ },
2138
+ "project": {
2139
+ "type": "string"
2140
+ },
2141
+ "version": {
2142
+ "type": "string"
2143
+ },
2144
+ "updated": {
2145
+ "type": "boolean",
2146
+ "description": "Whether the deployment doc set was regenerated."
2147
+ },
2148
+ "updated_files": {
2149
+ "type": "array",
2150
+ "items": {
2151
+ "type": "string"
2152
+ },
2153
+ "description": "Project-relative paths of regenerated files."
2154
+ },
2155
+ "updated_file_count": {
2156
+ "type": "integer"
2157
+ },
2158
+ "all_stages_passed": {
2159
+ "type": "boolean",
2160
+ "description": "Whether all stages passed their D-checks after the update."
2161
+ },
2162
+ "impact_summary": {
2163
+ "type": "object",
2164
+ "properties": {
2165
+ "stages_affected": {
2166
+ "type": "array",
2167
+ "items": {
2168
+ "type": "integer"
2169
+ },
2170
+ "description": "Stage numbers whose content changed."
2171
+ },
2172
+ "relations_rebuilt": {
2173
+ "type": "boolean",
2174
+ "description": "Whether relations.json was regenerated."
2175
+ }
2176
+ },
2177
+ "required": [
2178
+ "stages_affected",
2179
+ "relations_rebuilt"
2180
+ ],
2181
+ "additionalProperties": false,
2182
+ "description": "Summary of what changed (based on relations.json impact analysis)."
2183
+ },
2184
+ "next_action": {
2185
+ "type": "string",
2186
+ "enum": [
2187
+ "validate_validation_chain",
2188
+ "trace_substeps",
2189
+ "none"
2190
+ ],
2191
+ "description": "Next action: validate the chain after update, or proceed to trace_substeps."
2192
+ }
2193
+ },
2194
+ "required": [
2195
+ "action",
2196
+ "project",
2197
+ "version",
2198
+ "updated",
2199
+ "updated_files",
2200
+ "updated_file_count",
2201
+ "all_stages_passed",
2202
+ "impact_summary",
2203
+ "next_action"
2204
+ ],
2205
+ "additionalProperties": false
2206
+ },
2207
+ {
2208
+ "type": "object",
2209
+ "properties": {
2210
+ "action": {
2211
+ "type": "string",
2212
+ "const": "validate_validation_chain"
2213
+ },
2214
+ "project": {
2215
+ "type": "string"
2216
+ },
2217
+ "version": {
2218
+ "type": "string"
2219
+ },
2220
+ "valid": {
2221
+ "type": "boolean",
2222
+ "description": "True when derivation, propagation, cross-stage, and impact-map checks all pass."
2223
+ },
2224
+ "derivation_checks": {
2225
+ "type": "array",
2226
+ "items": {
2227
+ "type": "object",
2228
+ "properties": {
2229
+ "check_id": {
2230
+ "type": "string"
2231
+ },
2232
+ "status": {
2233
+ "type": "string",
2234
+ "enum": [
2235
+ "pass",
2236
+ "fail",
2237
+ "warn"
2238
+ ]
2239
+ },
2240
+ "message": {
2241
+ "type": "string"
2242
+ }
2243
+ },
2244
+ "required": [
2245
+ "check_id",
2246
+ "status",
2247
+ "message"
2248
+ ],
2249
+ "additionalProperties": false
2250
+ }
2251
+ },
2252
+ "propagation_checks": {
2253
+ "type": "array",
2254
+ "items": {
2255
+ "type": "object",
2256
+ "properties": {
2257
+ "check_id": {
2258
+ "type": "string"
2259
+ },
2260
+ "status": {
2261
+ "type": "string",
2262
+ "enum": [
2263
+ "pass",
2264
+ "fail",
2265
+ "warn"
2266
+ ]
2267
+ },
2268
+ "message": {
2269
+ "type": "string"
2270
+ }
2271
+ },
2272
+ "required": [
2273
+ "check_id",
2274
+ "status",
2275
+ "message"
2276
+ ],
2277
+ "additionalProperties": false
2278
+ }
2279
+ },
2280
+ "cross_stage_checks": {
2281
+ "type": "array",
2282
+ "items": {
2283
+ "type": "object",
2284
+ "properties": {
2285
+ "check_id": {
2286
+ "type": "string"
2287
+ },
2288
+ "status": {
2289
+ "type": "string",
2290
+ "enum": [
2291
+ "pass",
2292
+ "fail",
2293
+ "warn"
2294
+ ]
2295
+ },
2296
+ "message": {
2297
+ "type": "string"
2298
+ }
2299
+ },
2300
+ "required": [
2301
+ "check_id",
2302
+ "status",
2303
+ "message"
2304
+ ],
2305
+ "additionalProperties": false
2306
+ }
2307
+ },
2308
+ "impact_map_checks": {
2309
+ "type": "array",
2310
+ "items": {
2311
+ "type": "object",
2312
+ "properties": {
2313
+ "check_id": {
2314
+ "type": "string"
2315
+ },
2316
+ "status": {
2317
+ "type": "string",
2318
+ "enum": [
2319
+ "pass",
2320
+ "fail",
2321
+ "warn"
2322
+ ]
2323
+ },
2324
+ "message": {
2325
+ "type": "string"
2326
+ }
2327
+ },
2328
+ "required": [
2329
+ "check_id",
2330
+ "status",
2331
+ "message"
2332
+ ],
2333
+ "additionalProperties": false
2334
+ }
2335
+ },
2336
+ "blocking_issues": {
2337
+ "type": "array",
2338
+ "items": {
2339
+ "type": "string"
2340
+ }
2341
+ },
2342
+ "warnings": {
2343
+ "type": "array",
2344
+ "items": {
2345
+ "type": "string"
2346
+ }
2347
+ }
2348
+ },
2349
+ "required": [
2350
+ "action",
2351
+ "project",
2352
+ "version",
2353
+ "valid",
2354
+ "derivation_checks",
2355
+ "propagation_checks",
2356
+ "cross_stage_checks",
2357
+ "impact_map_checks",
2358
+ "blocking_issues",
2359
+ "warnings"
2360
+ ],
2361
+ "additionalProperties": false
2362
+ },
2363
+ {
2364
+ "type": "object",
2365
+ "properties": {
2366
+ "action": {
2367
+ "type": "string",
2368
+ "const": "apply_improvement"
2369
+ },
2370
+ "proposal_id": {
2371
+ "type": "string"
2372
+ },
2373
+ "previous_status": {
2374
+ "type": "string"
2375
+ },
2376
+ "new_status": {
2377
+ "type": "string"
2378
+ },
2379
+ "applied": {
2380
+ "type": "boolean",
2381
+ "description": "Whether the proposal was applied (true for approved+config_override, true for approved+source_patch producing patch file)."
2382
+ },
2383
+ "apply_mode": {
2384
+ "type": "string",
2385
+ "enum": [
2386
+ "config_override",
2387
+ "source_patch"
2388
+ ]
2389
+ },
2390
+ "override_file": {
2391
+ "type": "string",
2392
+ "description": "Path of the override file written (config_override only)."
2393
+ },
2394
+ "patch_file": {
2395
+ "type": "string",
2396
+ "description": "Path of the patch file written (source_patch only)."
2397
+ },
2398
+ "message": {
2399
+ "type": "string"
2400
+ },
2401
+ "next_action": {
2402
+ "type": "string",
2403
+ "enum": [
2404
+ "get_improvement_queue",
2405
+ "get_flywheel_config",
2406
+ "none"
2407
+ ],
2408
+ "description": "Next action: check more proposals or view flywheel status."
2409
+ }
2410
+ },
2411
+ "required": [
2412
+ "action",
2413
+ "proposal_id",
2414
+ "previous_status",
2415
+ "new_status",
2416
+ "applied",
2417
+ "apply_mode",
2418
+ "message",
2419
+ "next_action"
2420
+ ],
2421
+ "additionalProperties": false
2422
+ },
2423
+ {
2424
+ "type": "object",
2425
+ "properties": {
2426
+ "action": {
2427
+ "type": "string",
2428
+ "const": "get_improvement_queue"
2429
+ },
2430
+ "total": {
2431
+ "type": "integer"
2432
+ },
2433
+ "filtered_count": {
2434
+ "type": "integer"
2435
+ },
2436
+ "proposals": {
2437
+ "type": "array",
2438
+ "items": {
2439
+ "type": "object",
2440
+ "properties": {
2441
+ "proposal_id": {
2442
+ "type": "string"
2443
+ },
2444
+ "source_diagnosis_id": {
2445
+ "type": "string"
2446
+ },
2447
+ "type": {
2448
+ "type": "string"
2449
+ },
2450
+ "priority": {
2451
+ "type": "string"
2452
+ },
2453
+ "automation": {
2454
+ "type": "string",
2455
+ "enum": [
2456
+ "full",
2457
+ "semi",
2458
+ "manual"
2459
+ ]
2460
+ },
2461
+ "apply_mode": {
2462
+ "type": "string",
2463
+ "enum": [
2464
+ "config_override",
2465
+ "source_patch"
2466
+ ]
2467
+ },
2468
+ "override_category": {
2469
+ "type": "string"
2470
+ },
2471
+ "title": {
2472
+ "type": "string"
2473
+ },
2474
+ "description": {
2475
+ "type": "string"
2476
+ },
2477
+ "target": {
2478
+ "type": "string"
2479
+ },
2480
+ "review_status": {
2481
+ "type": "string",
2482
+ "enum": [
2483
+ "pending",
2484
+ "approved",
2485
+ "rejected",
2486
+ "applied"
2487
+ ]
2488
+ },
2489
+ "ab_test_recommended": {
2490
+ "type": "boolean"
2491
+ },
2492
+ "persisted_at": {
2493
+ "type": "string"
2494
+ },
2495
+ "reviewed_at": {
2496
+ "type": "string"
2497
+ }
2498
+ },
2499
+ "required": [
2500
+ "proposal_id",
2501
+ "source_diagnosis_id",
2502
+ "type",
2503
+ "priority",
2504
+ "automation",
2505
+ "apply_mode",
2506
+ "title",
2507
+ "description",
2508
+ "target",
2509
+ "review_status",
2510
+ "ab_test_recommended"
2511
+ ],
2512
+ "additionalProperties": false
2513
+ }
2514
+ },
2515
+ "summary": {
2516
+ "type": "string"
2517
+ }
2518
+ },
2519
+ "required": [
2520
+ "action",
2521
+ "total",
2522
+ "filtered_count",
2523
+ "proposals",
2524
+ "summary"
2525
+ ],
2526
+ "additionalProperties": false
2527
+ },
2528
+ {
2529
+ "type": "object",
2530
+ "properties": {
2531
+ "action": {
2532
+ "type": "string",
2533
+ "const": "get_flywheel_config"
2534
+ },
2535
+ "queue_path": {
2536
+ "type": "string"
2537
+ },
2538
+ "overrides_dir": {
2539
+ "type": "string"
2540
+ },
2541
+ "patches_dir": {
2542
+ "type": "string"
2543
+ },
2544
+ "total_proposals": {
2545
+ "type": "integer"
2546
+ },
2547
+ "pending_count": {
2548
+ "type": "integer"
2549
+ },
2550
+ "approved_count": {
2551
+ "type": "integer"
2552
+ },
2553
+ "applied_count": {
2554
+ "type": "integer"
2555
+ },
2556
+ "rejected_count": {
2557
+ "type": "integer"
2558
+ },
2559
+ "override_files": {
2560
+ "type": "array",
2561
+ "items": {
2562
+ "type": "string"
2563
+ }
2564
+ },
2565
+ "recent_proposals": {
2566
+ "type": "array",
2567
+ "items": {
2568
+ "type": "object",
2569
+ "properties": {
2570
+ "proposal_id": {
2571
+ "type": "string"
2572
+ },
2573
+ "type": {
2574
+ "type": "string"
2575
+ },
2576
+ "priority": {
2577
+ "type": "string"
2578
+ },
2579
+ "review_status": {
2580
+ "type": "string",
2581
+ "enum": [
2582
+ "pending",
2583
+ "approved",
2584
+ "rejected",
2585
+ "applied"
2586
+ ]
2587
+ },
2588
+ "title": {
2589
+ "type": "string"
2590
+ }
2591
+ },
2592
+ "required": [
2593
+ "proposal_id",
2594
+ "type",
2595
+ "priority",
2596
+ "review_status",
2597
+ "title"
2598
+ ],
2599
+ "additionalProperties": false
2600
+ }
2601
+ },
2602
+ "reflow_status": {
2603
+ "type": "string",
2604
+ "enum": [
2605
+ "active",
2606
+ "idle",
2607
+ "blocked"
2608
+ ],
2609
+ "description": "active=pending proposals exist; idle=no proposals; blocked=approved but not applied."
2610
+ }
2611
+ },
2612
+ "required": [
2613
+ "action",
2614
+ "queue_path",
2615
+ "overrides_dir",
2616
+ "patches_dir",
2617
+ "total_proposals",
2618
+ "pending_count",
2619
+ "approved_count",
2620
+ "applied_count",
2621
+ "rejected_count",
2622
+ "override_files",
2623
+ "recent_proposals",
2624
+ "reflow_status"
2625
+ ],
2626
+ "additionalProperties": false
2627
+ },
2628
+ {
2629
+ "type": "object",
2630
+ "properties": {
2631
+ "action": {
2632
+ "type": "string",
2633
+ "const": "rollback_stage"
2634
+ },
2635
+ "success": {
2636
+ "type": "boolean",
2637
+ "description": "Whether the rollback was executed (or would be, if dry_run=false)."
2638
+ },
2639
+ "dry_run": {
2640
+ "type": "boolean",
2641
+ "description": "Whether this was a policy evaluation only (no execution)."
2642
+ },
2643
+ "target_stage": {
2644
+ "type": "integer",
2645
+ "minimum": 1,
2646
+ "maximum": 5
2647
+ },
2648
+ "previous_stage": {
2649
+ "type": "integer",
2650
+ "minimum": 1,
2651
+ "maximum": 5
2652
+ },
2653
+ "allowed": {
2654
+ "type": "boolean",
2655
+ "description": "Whether the rollback is allowed by policy."
2656
+ },
2657
+ "block_reason": {
2658
+ "type": "string",
2659
+ "description": "Present when allowed=false — explains why rollback is blocked."
2660
+ },
2661
+ "files_to_clean": {
2662
+ "type": "array",
2663
+ "items": {
2664
+ "type": "string"
2665
+ },
2666
+ "description": "Files/directories that will be (or were) deleted during rollback."
2667
+ },
2668
+ "files_cleaned": {
2669
+ "type": "array",
2670
+ "items": {
2671
+ "type": "string"
2672
+ },
2673
+ "description": "Files/directories actually deleted (empty in dry_run mode)."
2674
+ },
2675
+ "warnings": {
2676
+ "type": "array",
2677
+ "items": {
2678
+ "type": "string"
2679
+ },
2680
+ "description": "Non-blocking warnings (e.g., data loss reminder)."
2681
+ },
2682
+ "iteration_strategy": {
2683
+ "type": "object",
2684
+ "properties": {
2685
+ "strategy": {
2686
+ "type": "string",
2687
+ "enum": [
2688
+ "in_place",
2689
+ "fork"
2690
+ ]
2691
+ },
2692
+ "reason": {
2693
+ "type": "string"
2694
+ },
2695
+ "fork_to_version": {
2696
+ "type": "string"
2697
+ },
2698
+ "published_objects": {
2699
+ "type": "array",
2700
+ "items": {
2701
+ "type": "string"
2702
+ }
2703
+ }
2704
+ },
2705
+ "required": [
2706
+ "strategy",
2707
+ "reason"
2708
+ ],
2709
+ "additionalProperties": false
2710
+ },
2711
+ "message": {
2712
+ "type": "string",
2713
+ "description": "Human-readable summary."
2714
+ }
2715
+ },
2716
+ "required": [
2717
+ "action",
2718
+ "success",
2719
+ "dry_run",
2720
+ "target_stage",
2721
+ "previous_stage",
2722
+ "allowed",
2723
+ "files_to_clean",
2724
+ "files_cleaned",
2725
+ "warnings",
2726
+ "iteration_strategy",
2727
+ "message"
2728
+ ],
2729
+ "additionalProperties": false
2730
+ },
2731
+ {
2732
+ "type": "object",
2733
+ "properties": {
2734
+ "action": {
2735
+ "type": "string",
2736
+ "const": "get_reversibility"
2737
+ },
2738
+ "query": {
2739
+ "type": "object",
2740
+ "properties": {
2741
+ "object_type": {
2742
+ "type": "string"
2743
+ },
2744
+ "lifecycle_state": {
2745
+ "type": "string"
2746
+ }
2747
+ },
2748
+ "additionalProperties": false,
2749
+ "description": "The query parameters used (empty = full matrix returned)."
2750
+ },
2751
+ "entries": {
2752
+ "type": "array",
2753
+ "items": {
2754
+ "type": "object",
2755
+ "properties": {
2756
+ "object_type": {
2757
+ "type": "string"
2758
+ },
2759
+ "lifecycle_state": {
2760
+ "type": "string",
2761
+ "enum": [
2762
+ "created",
2763
+ "referenced",
2764
+ "published",
2765
+ "bound"
2766
+ ]
2767
+ },
2768
+ "struct_reversible": {
2769
+ "type": "string",
2770
+ "enum": [
2771
+ "reversible",
2772
+ "limited",
2773
+ "immutable"
2774
+ ]
2775
+ },
2776
+ "behavior_reversible": {
2777
+ "type": "boolean"
2778
+ },
2779
+ "gas_impact": {
2780
+ "type": "string",
2781
+ "enum": [
2782
+ "low",
2783
+ "medium",
2784
+ "high",
2785
+ "none"
2786
+ ]
2787
+ },
2788
+ "explanation": {
2789
+ "type": "string"
2790
+ }
2791
+ },
2792
+ "required": [
2793
+ "object_type",
2794
+ "lifecycle_state",
2795
+ "struct_reversible",
2796
+ "behavior_reversible",
2797
+ "gas_impact",
2798
+ "explanation"
2799
+ ],
2800
+ "additionalProperties": false
2801
+ }
2802
+ },
2803
+ "total": {
2804
+ "type": "integer",
2805
+ "description": "Number of matrix entries returned."
2806
+ }
2807
+ },
2808
+ "required": [
2809
+ "action",
2810
+ "query",
2811
+ "entries",
2812
+ "total"
2813
+ ],
2814
+ "additionalProperties": false
2815
+ },
2816
+ {
2817
+ "type": "object",
2818
+ "properties": {
2819
+ "action": {
2820
+ "type": "string",
2821
+ "const": "assemble_context"
2822
+ },
2823
+ "objects": {
2824
+ "type": "array",
2825
+ "items": {},
2826
+ "description": "Current on-chain states of the requested objects (from query_objects)."
2827
+ },
2828
+ "events": {
2829
+ "type": "array",
2830
+ "items": {},
2831
+ "description": "Recent state-transition events (only when include_events=true). Includes NewOrderEvent, ProgressEvent, ArbEvent, etc."
2832
+ },
2833
+ "embedded_history": {
2834
+ "type": "object",
2835
+ "additionalProperties": {},
2836
+ "description": "Operation history extracted from object states — NOT from tx queries. Progress objects: session.forwards (who did what, when, accomplished). Order objects: disputes, claimed_by, progress_object. This is the CORRECT history source: convergent, no infinite recursion."
2837
+ },
2838
+ "semantic_summary": {
2839
+ "description": "Business semantic annotations generated by buildDataSemantic — maps raw object fields to business-meaningful concepts for LLM consumption."
2840
+ },
2841
+ "context_digest": {
2842
+ "type": "string",
2843
+ "description": "Unique digest for this assembled context (SHA of object IDs + versions + timestamp). Use for caching or to detect state changes between two assembly calls."
2844
+ },
2845
+ "next_action": {
2846
+ "type": "string",
2847
+ "description": "Suggested next action: use onchain_transaction to verify a specific past tx, or proceed with onchain_operations to modify state, or re-call assemble_context after state changes."
2848
+ },
2849
+ "flywheel_collected": {
2850
+ "type": "object",
2851
+ "properties": {
2852
+ "signature_recorded": {
2853
+ "type": "boolean",
2854
+ "description": "Whether the experience signature was recorded in the real-time experience layer."
2855
+ },
2856
+ "proposal_created": {
2857
+ "type": "boolean",
2858
+ "description": "Whether an improvement proposal was created for the offline distillation flywheel."
2859
+ },
2860
+ "proposal_id": {
2861
+ "type": "string",
2862
+ "description": "The proposal ID, if created."
2863
+ }
2864
+ },
2865
+ "required": [
2866
+ "signature_recorded",
2867
+ "proposal_created"
2868
+ ],
2869
+ "additionalProperties": false,
2870
+ "description": "Distillation flywheel collection result. Non-blocking — may be undefined if collection fails. When present, the assembled context has been fed back into the experience layer and/or improvement queue."
2871
+ }
2872
+ },
2873
+ "required": [
2874
+ "action",
2875
+ "objects",
2876
+ "context_digest",
2877
+ "next_action"
2878
+ ],
2879
+ "additionalProperties": false
1082
2880
  }
1083
2881
  ],
1084
2882
  "description": "Query result — shape depends on action"