devcontour-harness 0.1.0-alpha.26 → 0.1.0-alpha.28

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 (69) hide show
  1. package/README.md +15 -2
  2. package/docs/architecture.md +59 -0
  3. package/docs/compatibility.md +25 -12
  4. package/docs/connectors.md +5 -2
  5. package/docs/contracts.md +80 -25
  6. package/docs/release-notes/0.1.0-alpha.27.md +36 -0
  7. package/docs/release-notes/0.1.0-alpha.28.md +37 -0
  8. package/docs/review-protocol.md +10 -4
  9. package/docs/toolchains.md +83 -0
  10. package/docs/upgrade.md +22 -0
  11. package/lib/cli.js +13 -0
  12. package/lib/contracts/cli.d.ts +147 -19
  13. package/lib/contracts/cli.js +66 -0
  14. package/lib/contracts/diagnosis.d.ts +1 -1
  15. package/lib/contracts/events.d.ts +6 -6
  16. package/lib/contracts/execution.d.ts +268 -16
  17. package/lib/contracts/execution.js +3 -1
  18. package/lib/contracts/policy.d.ts +37 -5
  19. package/lib/contracts/policy.js +42 -2
  20. package/lib/contracts/profiles.d.ts +2 -0
  21. package/lib/contracts/published.d.ts +226 -20
  22. package/lib/contracts/result.d.ts +268 -12
  23. package/lib/contracts/result.js +66 -0
  24. package/lib/control/harness.d.ts +64 -7
  25. package/lib/control/harness.js +4 -0
  26. package/lib/control/recovery.d.ts +1 -1
  27. package/lib/control/review.js +6 -1
  28. package/lib/engine/engine.d.ts +117 -12
  29. package/lib/engine/joint-runner.d.ts +96 -6
  30. package/lib/engine/joint-runner.js +47 -1
  31. package/lib/engine/runner.d.ts +29 -0
  32. package/lib/engine/runner.js +200 -2
  33. package/lib/engine/worktree-cleanup.d.ts +131 -0
  34. package/lib/engine/worktree-cleanup.js +520 -0
  35. package/lib/environment/isolation.d.ts +1 -0
  36. package/lib/environment/isolation.js +2 -1
  37. package/lib/environment/os-tools.d.ts +4 -2
  38. package/lib/environment/os-tools.js +4 -2
  39. package/lib/environment/process.d.ts +5 -0
  40. package/lib/environment/process.js +40 -17
  41. package/lib/environment/resources.d.ts +9 -0
  42. package/lib/environment/resources.js +24 -0
  43. package/lib/index.d.ts +1 -0
  44. package/lib/index.js +1 -0
  45. package/lib/integrations/connector/commands.d.ts +2 -1
  46. package/lib/integrations/connector/commands.js +10 -2
  47. package/lib/integrations/connector/store.d.ts +1 -1
  48. package/lib/integrations/connector/store.js +11 -6
  49. package/lib/profiles/resolve.d.ts +8 -0
  50. package/lib/storage/document.d.ts +132 -12
  51. package/lib/toolchains/inspect.d.ts +1 -1
  52. package/lib/toolchains/inspect.js +29 -1
  53. package/lib/toolchains/probe.d.ts +16 -0
  54. package/lib/toolchains/probe.js +20 -0
  55. package/lib/verification/confirm.d.ts +3 -1
  56. package/lib/verification/confirm.js +16 -2
  57. package/lib/verification/dependencies.d.ts +3 -0
  58. package/lib/verification/dependencies.js +11 -0
  59. package/lib/verification/dependency-store.d.ts +117 -0
  60. package/lib/verification/dependency-store.js +811 -0
  61. package/lib/verification/gate-artifacts.d.ts +34 -0
  62. package/lib/verification/gate-artifacts.js +303 -0
  63. package/lib/verification/gates-at.js +18 -0
  64. package/lib/verification/gates.js +15 -0
  65. package/lib/verification/joint.d.ts +48 -3
  66. package/package.json +1 -1
  67. package/schemas/execution-document.schema.json +372 -0
  68. package/schemas/execution-policy.schema.json +56 -0
  69. package/schemas/joint-verification.schema.json +279 -0
@@ -22,8 +22,8 @@ export declare const evidenceRefSchema: z.ZodObject<{
22
22
  kind: z.ZodEnum<{
23
23
  check: "check";
24
24
  test: "test";
25
- property: "property";
26
25
  review: "review";
26
+ property: "property";
27
27
  consumer: "consumer";
28
28
  }>;
29
29
  phase: z.ZodEnum<{
@@ -238,8 +238,8 @@ export declare const runResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
238
238
  kind: z.ZodEnum<{
239
239
  check: "check";
240
240
  test: "test";
241
- property: "property";
242
241
  review: "review";
242
+ property: "property";
243
243
  consumer: "consumer";
244
244
  }>;
245
245
  phase: z.ZodEnum<{
@@ -460,8 +460,8 @@ export declare const runResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
460
460
  kind: z.ZodEnum<{
461
461
  check: "check";
462
462
  test: "test";
463
- property: "property";
464
463
  review: "review";
464
+ property: "property";
465
465
  consumer: "consumer";
466
466
  }>;
467
467
  phase: z.ZodEnum<{
@@ -667,8 +667,8 @@ export declare const resultEnvelopeSchema: z.ZodObject<{
667
667
  kind: z.ZodEnum<{
668
668
  check: "check";
669
669
  test: "test";
670
- property: "property";
671
670
  review: "review";
671
+ property: "property";
672
672
  consumer: "consumer";
673
673
  }>;
674
674
  phase: z.ZodEnum<{
@@ -889,8 +889,8 @@ export declare const resultEnvelopeSchema: z.ZodObject<{
889
889
  kind: z.ZodEnum<{
890
890
  check: "check";
891
891
  test: "test";
892
- property: "property";
893
892
  review: "review";
893
+ property: "property";
894
894
  consumer: "consumer";
895
895
  }>;
896
896
  phase: z.ZodEnum<{
@@ -1012,6 +1012,66 @@ export declare const jointManifestSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
1012
1012
  sha: z.ZodString;
1013
1013
  tree: z.ZodString;
1014
1014
  }, z.core.$strict>>;
1015
+ /** Пределы сохранения artifacts одного gate (`gates[].artifacts`, `workspaceGates[].artifacts`). */
1016
+ export declare const gateArtifactLimits: {
1017
+ /** Объявленных путей у gate задачи. */
1018
+ readonly paths: 16;
1019
+ readonly files: 64;
1020
+ readonly fileBytes: number;
1021
+ readonly totalBytes: number;
1022
+ /** Записей обхода каталогов: дальше обход не идёт. */
1023
+ readonly scan: 4096;
1024
+ /** Перечисленных пропусков; остальные считаются в `skippedMore`. */
1025
+ readonly skipped: 100;
1026
+ };
1027
+ export declare const gateArtifactExtensions: readonly [".png", ".json", ".txt", ".xml", ".log"];
1028
+ /**
1029
+ * Почему файл artifacts не сохранён: `missing` — пути нет; `symlink` — путь
1030
+ * или его компонент — ссылка (не разыменовывается); `outside` — путь вне
1031
+ * дерева; `not-regular` — не обычный файл; `hardlink` — у файла больше одной
1032
+ * жёсткой ссылки (мог быть файлом вне дерева); `secret` — в имени или в байтах
1033
+ * не текстового файла найден секрет окружения (изображение не переписывается);
1034
+ * `extension` — расширение вне списка; `file-limit`, `total-limit`,
1035
+ * `count-limit`, `scan-limit` — пределы; `copy-failed` — чтение или запись
1036
+ * копии не удались либо проверка отменена (причина в `detail`).
1037
+ */
1038
+ export declare const gateArtifactSkipReasons: readonly ["missing", "symlink", "outside", "not-regular", "hardlink", "secret", "extension", "file-limit", "total-limit", "count-limit", "scan-limit", "copy-failed"];
1039
+ /**
1040
+ * Artifacts gate, сохранённые как evidence при любом исходе gate: копии в
1041
+ * `dir` по путям относительно дерева, SHA-256 и размер сохранённых байтов.
1042
+ * `redacted` — в текстовом файле замаскирован секрет окружения: digest
1043
+ * относится к копии. Пропуски названы с причиной; исход gate от них не
1044
+ * зависит.
1045
+ */
1046
+ export declare const gateArtifactFilesSchema: z.ZodObject<{
1047
+ dir: z.ZodString;
1048
+ files: z.ZodArray<z.ZodObject<{
1049
+ path: z.ZodString;
1050
+ sha256: z.ZodString;
1051
+ bytes: z.ZodNumber;
1052
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1053
+ }, z.core.$strict>>;
1054
+ skipped: z.ZodArray<z.ZodObject<{
1055
+ path: z.ZodString;
1056
+ reason: z.ZodEnum<{
1057
+ missing: "missing";
1058
+ symlink: "symlink";
1059
+ outside: "outside";
1060
+ "not-regular": "not-regular";
1061
+ hardlink: "hardlink";
1062
+ secret: "secret";
1063
+ extension: "extension";
1064
+ "file-limit": "file-limit";
1065
+ "total-limit": "total-limit";
1066
+ "count-limit": "count-limit";
1067
+ "scan-limit": "scan-limit";
1068
+ "copy-failed": "copy-failed";
1069
+ }>;
1070
+ detail: z.ZodOptional<z.ZodString>;
1071
+ }, z.core.$strict>>;
1072
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1073
+ }, z.core.$strict>;
1074
+ export type GateArtifactFiles = z.infer<typeof gateArtifactFilesSchema>;
1015
1075
  export declare const jointEvidenceSchema: z.ZodObject<{
1016
1076
  gate: z.ZodString;
1017
1077
  passed: z.ZodBoolean;
@@ -1024,6 +1084,34 @@ export declare const jointEvidenceSchema: z.ZodObject<{
1024
1084
  path: z.ZodString;
1025
1085
  digest: z.ZodString;
1026
1086
  }, z.core.$strict>>;
1087
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1088
+ dir: z.ZodString;
1089
+ files: z.ZodArray<z.ZodObject<{
1090
+ path: z.ZodString;
1091
+ sha256: z.ZodString;
1092
+ bytes: z.ZodNumber;
1093
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1094
+ }, z.core.$strict>>;
1095
+ skipped: z.ZodArray<z.ZodObject<{
1096
+ path: z.ZodString;
1097
+ reason: z.ZodEnum<{
1098
+ missing: "missing";
1099
+ symlink: "symlink";
1100
+ outside: "outside";
1101
+ "not-regular": "not-regular";
1102
+ hardlink: "hardlink";
1103
+ secret: "secret";
1104
+ extension: "extension";
1105
+ "file-limit": "file-limit";
1106
+ "total-limit": "total-limit";
1107
+ "count-limit": "count-limit";
1108
+ "scan-limit": "scan-limit";
1109
+ "copy-failed": "copy-failed";
1110
+ }>;
1111
+ detail: z.ZodOptional<z.ZodString>;
1112
+ }, z.core.$strict>>;
1113
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1114
+ }, z.core.$strict>>;
1027
1115
  durationMs: z.ZodOptional<z.ZodNumber>;
1028
1116
  }, z.core.$strict>;
1029
1117
  export declare const jointImpactSchema: z.ZodObject<{
@@ -1031,8 +1119,8 @@ export declare const jointImpactSchema: z.ZodObject<{
1031
1119
  affected: z.ZodArray<z.ZodString>;
1032
1120
  gateIds: z.ZodArray<z.ZodString>;
1033
1121
  mode: z.ZodEnum<{
1034
- all: "all";
1035
1122
  affected: "affected";
1123
+ all: "all";
1036
1124
  }>;
1037
1125
  reason: z.ZodString;
1038
1126
  baseline: z.ZodOptional<z.ZodString>;
@@ -1061,8 +1149,8 @@ export declare const jointActiveSchema: z.ZodObject<{
1061
1149
  affected: z.ZodArray<z.ZodString>;
1062
1150
  gateIds: z.ZodArray<z.ZodString>;
1063
1151
  mode: z.ZodEnum<{
1064
- all: "all";
1065
1152
  affected: "affected";
1153
+ all: "all";
1066
1154
  }>;
1067
1155
  reason: z.ZodString;
1068
1156
  baseline: z.ZodOptional<z.ZodString>;
@@ -1079,6 +1167,34 @@ export declare const jointActiveSchema: z.ZodObject<{
1079
1167
  path: z.ZodString;
1080
1168
  digest: z.ZodString;
1081
1169
  }, z.core.$strict>>;
1170
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1171
+ dir: z.ZodString;
1172
+ files: z.ZodArray<z.ZodObject<{
1173
+ path: z.ZodString;
1174
+ sha256: z.ZodString;
1175
+ bytes: z.ZodNumber;
1176
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1177
+ }, z.core.$strict>>;
1178
+ skipped: z.ZodArray<z.ZodObject<{
1179
+ path: z.ZodString;
1180
+ reason: z.ZodEnum<{
1181
+ missing: "missing";
1182
+ symlink: "symlink";
1183
+ outside: "outside";
1184
+ "not-regular": "not-regular";
1185
+ hardlink: "hardlink";
1186
+ secret: "secret";
1187
+ extension: "extension";
1188
+ "file-limit": "file-limit";
1189
+ "total-limit": "total-limit";
1190
+ "count-limit": "count-limit";
1191
+ "scan-limit": "scan-limit";
1192
+ "copy-failed": "copy-failed";
1193
+ }>;
1194
+ detail: z.ZodOptional<z.ZodString>;
1195
+ }, z.core.$strict>>;
1196
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1197
+ }, z.core.$strict>>;
1082
1198
  durationMs: z.ZodOptional<z.ZodNumber>;
1083
1199
  }, z.core.$strict>>;
1084
1200
  }, z.core.$strict>;
@@ -1102,8 +1218,8 @@ export declare const jointFailedSchema: z.ZodObject<{
1102
1218
  affected: z.ZodArray<z.ZodString>;
1103
1219
  gateIds: z.ZodArray<z.ZodString>;
1104
1220
  mode: z.ZodEnum<{
1105
- all: "all";
1106
1221
  affected: "affected";
1222
+ all: "all";
1107
1223
  }>;
1108
1224
  reason: z.ZodString;
1109
1225
  baseline: z.ZodOptional<z.ZodString>;
@@ -1120,6 +1236,34 @@ export declare const jointFailedSchema: z.ZodObject<{
1120
1236
  path: z.ZodString;
1121
1237
  digest: z.ZodString;
1122
1238
  }, z.core.$strict>>;
1239
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1240
+ dir: z.ZodString;
1241
+ files: z.ZodArray<z.ZodObject<{
1242
+ path: z.ZodString;
1243
+ sha256: z.ZodString;
1244
+ bytes: z.ZodNumber;
1245
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1246
+ }, z.core.$strict>>;
1247
+ skipped: z.ZodArray<z.ZodObject<{
1248
+ path: z.ZodString;
1249
+ reason: z.ZodEnum<{
1250
+ missing: "missing";
1251
+ symlink: "symlink";
1252
+ outside: "outside";
1253
+ "not-regular": "not-regular";
1254
+ hardlink: "hardlink";
1255
+ secret: "secret";
1256
+ extension: "extension";
1257
+ "file-limit": "file-limit";
1258
+ "total-limit": "total-limit";
1259
+ "count-limit": "count-limit";
1260
+ "scan-limit": "scan-limit";
1261
+ "copy-failed": "copy-failed";
1262
+ }>;
1263
+ detail: z.ZodOptional<z.ZodString>;
1264
+ }, z.core.$strict>>;
1265
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1266
+ }, z.core.$strict>>;
1123
1267
  durationMs: z.ZodOptional<z.ZodNumber>;
1124
1268
  }, z.core.$strict>>;
1125
1269
  }, z.core.$strict>;
@@ -1142,8 +1286,8 @@ export declare const jointPassedSchema: z.ZodObject<{
1142
1286
  affected: z.ZodArray<z.ZodString>;
1143
1287
  gateIds: z.ZodArray<z.ZodString>;
1144
1288
  mode: z.ZodEnum<{
1145
- all: "all";
1146
1289
  affected: "affected";
1290
+ all: "all";
1147
1291
  }>;
1148
1292
  reason: z.ZodString;
1149
1293
  baseline: z.ZodOptional<z.ZodString>;
@@ -1160,6 +1304,34 @@ export declare const jointPassedSchema: z.ZodObject<{
1160
1304
  path: z.ZodString;
1161
1305
  digest: z.ZodString;
1162
1306
  }, z.core.$strict>>;
1307
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1308
+ dir: z.ZodString;
1309
+ files: z.ZodArray<z.ZodObject<{
1310
+ path: z.ZodString;
1311
+ sha256: z.ZodString;
1312
+ bytes: z.ZodNumber;
1313
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1314
+ }, z.core.$strict>>;
1315
+ skipped: z.ZodArray<z.ZodObject<{
1316
+ path: z.ZodString;
1317
+ reason: z.ZodEnum<{
1318
+ missing: "missing";
1319
+ symlink: "symlink";
1320
+ outside: "outside";
1321
+ "not-regular": "not-regular";
1322
+ hardlink: "hardlink";
1323
+ secret: "secret";
1324
+ extension: "extension";
1325
+ "file-limit": "file-limit";
1326
+ "total-limit": "total-limit";
1327
+ "count-limit": "count-limit";
1328
+ "scan-limit": "scan-limit";
1329
+ "copy-failed": "copy-failed";
1330
+ }>;
1331
+ detail: z.ZodOptional<z.ZodString>;
1332
+ }, z.core.$strict>>;
1333
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1334
+ }, z.core.$strict>>;
1163
1335
  durationMs: z.ZodOptional<z.ZodNumber>;
1164
1336
  }, z.core.$strict>>;
1165
1337
  }, z.core.$strict>;
@@ -1181,8 +1353,8 @@ export declare const jointVerificationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1181
1353
  affected: z.ZodArray<z.ZodString>;
1182
1354
  gateIds: z.ZodArray<z.ZodString>;
1183
1355
  mode: z.ZodEnum<{
1184
- all: "all";
1185
1356
  affected: "affected";
1357
+ all: "all";
1186
1358
  }>;
1187
1359
  reason: z.ZodString;
1188
1360
  baseline: z.ZodOptional<z.ZodString>;
@@ -1199,6 +1371,34 @@ export declare const jointVerificationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1199
1371
  path: z.ZodString;
1200
1372
  digest: z.ZodString;
1201
1373
  }, z.core.$strict>>;
1374
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1375
+ dir: z.ZodString;
1376
+ files: z.ZodArray<z.ZodObject<{
1377
+ path: z.ZodString;
1378
+ sha256: z.ZodString;
1379
+ bytes: z.ZodNumber;
1380
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1381
+ }, z.core.$strict>>;
1382
+ skipped: z.ZodArray<z.ZodObject<{
1383
+ path: z.ZodString;
1384
+ reason: z.ZodEnum<{
1385
+ missing: "missing";
1386
+ symlink: "symlink";
1387
+ outside: "outside";
1388
+ "not-regular": "not-regular";
1389
+ hardlink: "hardlink";
1390
+ secret: "secret";
1391
+ extension: "extension";
1392
+ "file-limit": "file-limit";
1393
+ "total-limit": "total-limit";
1394
+ "count-limit": "count-limit";
1395
+ "scan-limit": "scan-limit";
1396
+ "copy-failed": "copy-failed";
1397
+ }>;
1398
+ detail: z.ZodOptional<z.ZodString>;
1399
+ }, z.core.$strict>>;
1400
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1401
+ }, z.core.$strict>>;
1202
1402
  durationMs: z.ZodOptional<z.ZodNumber>;
1203
1403
  }, z.core.$strict>>;
1204
1404
  }, z.core.$strict>, z.ZodObject<{
@@ -1221,8 +1421,8 @@ export declare const jointVerificationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1221
1421
  affected: z.ZodArray<z.ZodString>;
1222
1422
  gateIds: z.ZodArray<z.ZodString>;
1223
1423
  mode: z.ZodEnum<{
1224
- all: "all";
1225
1424
  affected: "affected";
1425
+ all: "all";
1226
1426
  }>;
1227
1427
  reason: z.ZodString;
1228
1428
  baseline: z.ZodOptional<z.ZodString>;
@@ -1239,6 +1439,34 @@ export declare const jointVerificationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1239
1439
  path: z.ZodString;
1240
1440
  digest: z.ZodString;
1241
1441
  }, z.core.$strict>>;
1442
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1443
+ dir: z.ZodString;
1444
+ files: z.ZodArray<z.ZodObject<{
1445
+ path: z.ZodString;
1446
+ sha256: z.ZodString;
1447
+ bytes: z.ZodNumber;
1448
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1449
+ }, z.core.$strict>>;
1450
+ skipped: z.ZodArray<z.ZodObject<{
1451
+ path: z.ZodString;
1452
+ reason: z.ZodEnum<{
1453
+ missing: "missing";
1454
+ symlink: "symlink";
1455
+ outside: "outside";
1456
+ "not-regular": "not-regular";
1457
+ hardlink: "hardlink";
1458
+ secret: "secret";
1459
+ extension: "extension";
1460
+ "file-limit": "file-limit";
1461
+ "total-limit": "total-limit";
1462
+ "count-limit": "count-limit";
1463
+ "scan-limit": "scan-limit";
1464
+ "copy-failed": "copy-failed";
1465
+ }>;
1466
+ detail: z.ZodOptional<z.ZodString>;
1467
+ }, z.core.$strict>>;
1468
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1469
+ }, z.core.$strict>>;
1242
1470
  durationMs: z.ZodOptional<z.ZodNumber>;
1243
1471
  }, z.core.$strict>>;
1244
1472
  }, z.core.$strict>, z.ZodObject<{
@@ -1260,8 +1488,8 @@ export declare const jointVerificationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1260
1488
  affected: z.ZodArray<z.ZodString>;
1261
1489
  gateIds: z.ZodArray<z.ZodString>;
1262
1490
  mode: z.ZodEnum<{
1263
- all: "all";
1264
1491
  affected: "affected";
1492
+ all: "all";
1265
1493
  }>;
1266
1494
  reason: z.ZodString;
1267
1495
  baseline: z.ZodOptional<z.ZodString>;
@@ -1278,6 +1506,34 @@ export declare const jointVerificationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1278
1506
  path: z.ZodString;
1279
1507
  digest: z.ZodString;
1280
1508
  }, z.core.$strict>>;
1509
+ artifactFiles: z.ZodOptional<z.ZodObject<{
1510
+ dir: z.ZodString;
1511
+ files: z.ZodArray<z.ZodObject<{
1512
+ path: z.ZodString;
1513
+ sha256: z.ZodString;
1514
+ bytes: z.ZodNumber;
1515
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
1516
+ }, z.core.$strict>>;
1517
+ skipped: z.ZodArray<z.ZodObject<{
1518
+ path: z.ZodString;
1519
+ reason: z.ZodEnum<{
1520
+ missing: "missing";
1521
+ symlink: "symlink";
1522
+ outside: "outside";
1523
+ "not-regular": "not-regular";
1524
+ hardlink: "hardlink";
1525
+ secret: "secret";
1526
+ extension: "extension";
1527
+ "file-limit": "file-limit";
1528
+ "total-limit": "total-limit";
1529
+ "count-limit": "count-limit";
1530
+ "scan-limit": "scan-limit";
1531
+ "copy-failed": "copy-failed";
1532
+ }>;
1533
+ detail: z.ZodOptional<z.ZodString>;
1534
+ }, z.core.$strict>>;
1535
+ skippedMore: z.ZodOptional<z.ZodNumber>;
1536
+ }, z.core.$strict>>;
1281
1537
  durationMs: z.ZodOptional<z.ZodNumber>;
1282
1538
  }, z.core.$strict>>;
1283
1539
  }, z.core.$strict>], "status">;
@@ -247,6 +247,70 @@ export const resultEnvelopeSchema = z.strictObject({
247
247
  * результат привязан к manifest, и смена любого SHA делает его устаревшим.
248
248
  */
249
249
  export const jointManifestSchema = z.record(idSchema, z.strictObject({ sha: gitShaSchema, tree: gitShaSchema }));
250
+ /** Пределы сохранения artifacts одного gate (`gates[].artifacts`, `workspaceGates[].artifacts`). */
251
+ export const gateArtifactLimits = {
252
+ /** Объявленных путей у gate задачи. */
253
+ paths: 16,
254
+ files: 64,
255
+ fileBytes: 8 * 1024 * 1024,
256
+ totalBytes: 20 * 1024 * 1024,
257
+ /** Записей обхода каталогов: дальше обход не идёт. */
258
+ scan: 4096,
259
+ /** Перечисленных пропусков; остальные считаются в `skippedMore`. */
260
+ skipped: 100,
261
+ };
262
+ export const gateArtifactExtensions = ['.png', '.json', '.txt', '.xml', '.log'];
263
+ /**
264
+ * Почему файл artifacts не сохранён: `missing` — пути нет; `symlink` — путь
265
+ * или его компонент — ссылка (не разыменовывается); `outside` — путь вне
266
+ * дерева; `not-regular` — не обычный файл; `hardlink` — у файла больше одной
267
+ * жёсткой ссылки (мог быть файлом вне дерева); `secret` — в имени или в байтах
268
+ * не текстового файла найден секрет окружения (изображение не переписывается);
269
+ * `extension` — расширение вне списка; `file-limit`, `total-limit`,
270
+ * `count-limit`, `scan-limit` — пределы; `copy-failed` — чтение или запись
271
+ * копии не удались либо проверка отменена (причина в `detail`).
272
+ */
273
+ export const gateArtifactSkipReasons = [
274
+ 'missing',
275
+ 'symlink',
276
+ 'outside',
277
+ 'not-regular',
278
+ 'hardlink',
279
+ 'secret',
280
+ 'extension',
281
+ 'file-limit',
282
+ 'total-limit',
283
+ 'count-limit',
284
+ 'scan-limit',
285
+ 'copy-failed',
286
+ ];
287
+ /**
288
+ * Artifacts gate, сохранённые как evidence при любом исходе gate: копии в
289
+ * `dir` по путям относительно дерева, SHA-256 и размер сохранённых байтов.
290
+ * `redacted` — в текстовом файле замаскирован секрет окружения: digest
291
+ * относится к копии. Пропуски названы с причиной; исход gate от них не
292
+ * зависит.
293
+ */
294
+ export const gateArtifactFilesSchema = z.strictObject({
295
+ dir: z.string().min(1),
296
+ files: z
297
+ .array(z.strictObject({
298
+ path: z.string().min(1).max(1000),
299
+ sha256: digestSchema,
300
+ bytes: z.number().int().min(0),
301
+ redacted: z.literal(true).optional(),
302
+ }))
303
+ .max(gateArtifactLimits.files),
304
+ skipped: z
305
+ .array(z.strictObject({
306
+ path: z.string().min(1).max(1000),
307
+ reason: z.enum(gateArtifactSkipReasons),
308
+ detail: z.string().max(500).optional(),
309
+ }))
310
+ .max(gateArtifactLimits.skipped),
311
+ /** Пропусков сверх перечисленных. */
312
+ skippedMore: z.number().int().positive().optional(),
313
+ });
250
314
  export const jointEvidenceSchema = z.strictObject({
251
315
  gate: idSchema,
252
316
  passed: z.boolean(),
@@ -256,6 +320,8 @@ export const jointEvidenceSchema = z.strictObject({
256
320
  digest: digestSchema,
257
321
  summary: z.string(),
258
322
  artifacts: z.array(artifactPin),
323
+ /** Копии artifacts gate (нет у прежних записей). */
324
+ artifactFiles: gateArtifactFilesSchema.optional(),
259
325
  durationMs: z.number().min(0).optional(),
260
326
  });
261
327
  export const jointImpactSchema = z.strictObject({
@@ -88,6 +88,21 @@ export declare class Harness {
88
88
  path: string;
89
89
  digest: string;
90
90
  }[];
91
+ artifactFiles?: {
92
+ dir: string;
93
+ files: {
94
+ path: string;
95
+ sha256: string;
96
+ bytes: number;
97
+ redacted?: true | undefined;
98
+ }[];
99
+ skipped: {
100
+ path: string;
101
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
102
+ detail?: string | undefined;
103
+ }[];
104
+ skippedMore?: number | undefined;
105
+ } | undefined;
91
106
  durationMs?: number | undefined;
92
107
  }[];
93
108
  manifest?: Record<string, {
@@ -99,7 +114,7 @@ export declare class Harness {
99
114
  changed: string[];
100
115
  affected: string[];
101
116
  gateIds: string[];
102
- mode: "all" | "affected";
117
+ mode: "affected" | "all";
103
118
  reason: string;
104
119
  baseline?: string | undefined;
105
120
  } | undefined;
@@ -125,6 +140,21 @@ export declare class Harness {
125
140
  path: string;
126
141
  digest: string;
127
142
  }[];
143
+ artifactFiles?: {
144
+ dir: string;
145
+ files: {
146
+ path: string;
147
+ sha256: string;
148
+ bytes: number;
149
+ redacted?: true | undefined;
150
+ }[];
151
+ skipped: {
152
+ path: string;
153
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
154
+ detail?: string | undefined;
155
+ }[];
156
+ skippedMore?: number | undefined;
157
+ } | undefined;
128
158
  durationMs?: number | undefined;
129
159
  }[];
130
160
  manifest?: Record<string, {
@@ -136,7 +166,7 @@ export declare class Harness {
136
166
  changed: string[];
137
167
  affected: string[];
138
168
  gateIds: string[];
139
- mode: "all" | "affected";
169
+ mode: "affected" | "all";
140
170
  reason: string;
141
171
  baseline?: string | undefined;
142
172
  } | undefined;
@@ -166,13 +196,28 @@ export declare class Harness {
166
196
  path: string;
167
197
  digest: string;
168
198
  }[];
199
+ artifactFiles?: {
200
+ dir: string;
201
+ files: {
202
+ path: string;
203
+ sha256: string;
204
+ bytes: number;
205
+ redacted?: true | undefined;
206
+ }[];
207
+ skipped: {
208
+ path: string;
209
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
210
+ detail?: string | undefined;
211
+ }[];
212
+ skippedMore?: number | undefined;
213
+ } | undefined;
169
214
  durationMs?: number | undefined;
170
215
  }[];
171
216
  impact?: {
172
217
  changed: string[];
173
218
  affected: string[];
174
219
  gateIds: string[];
175
- mode: "all" | "affected";
220
+ mode: "affected" | "all";
176
221
  reason: string;
177
222
  baseline?: string | undefined;
178
223
  } | undefined;
@@ -254,6 +299,18 @@ export declare class Harness {
254
299
  status: "cleaned";
255
300
  receipts: string[];
256
301
  }>;
302
+ /** Убрать рабочие деревья закончившихся попыток; ветки и артефакты остаются. */
303
+ cleanupWorktrees(options?: {
304
+ dryRun?: boolean;
305
+ }): Promise<{
306
+ dryRun: boolean;
307
+ removed: number;
308
+ removable: number;
309
+ refused: number;
310
+ failed: number;
311
+ reclaimedKb: number;
312
+ worktrees: import("../engine/worktree-cleanup.ts").WorktreeCleanupEntry[];
313
+ }>;
257
314
  private repoPath;
258
315
  /**
259
316
  * Снимок контекста для ревью плана: без нужного графу источника — отказ
@@ -741,7 +798,7 @@ export declare class Harness {
741
798
  pauseReason?: "runtime" | "operator" | "shutdown" | "base-check" | "reconfigure" | undefined;
742
799
  pausedAt?: string | undefined;
743
800
  pauseOperation?: string | undefined;
744
- pauseFailures?: ("gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
801
+ pauseFailures?: ("gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
745
802
  waits?: {
746
803
  kind: "base-check" | "context-lock";
747
804
  detail: string;
@@ -798,7 +855,7 @@ export declare class Harness {
798
855
  pauseReason?: "runtime" | "operator" | "shutdown" | "base-check" | "reconfigure" | undefined;
799
856
  pausedAt?: string | undefined;
800
857
  pauseOperation?: string | undefined;
801
- pauseFailures?: ("gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
858
+ pauseFailures?: ("gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
802
859
  waits?: {
803
860
  kind: "base-check" | "context-lock";
804
861
  detail: string;
@@ -914,7 +971,7 @@ export declare class Harness {
914
971
  };
915
972
  evidence: {
916
973
  id: string;
917
- kind: "check" | "test" | "property" | "review" | "consumer";
974
+ kind: "check" | "test" | "review" | "property" | "consumer";
918
975
  phase: "candidate" | "integration";
919
976
  gate: string;
920
977
  sha: string;
@@ -1055,7 +1112,7 @@ export declare class Harness {
1055
1112
  };
1056
1113
  evidence: {
1057
1114
  id: string;
1058
- kind: "check" | "test" | "property" | "review" | "consumer";
1115
+ kind: "check" | "test" | "review" | "property" | "consumer";
1059
1116
  phase: "candidate" | "integration";
1060
1117
  gate: string;
1061
1118
  sha: string;
@@ -136,6 +136,10 @@ export class Harness {
136
136
  cleanup(runId) {
137
137
  return this.runner.finishCleanup(runId);
138
138
  }
139
+ /** Убрать рабочие деревья закончившихся попыток; ветки и артефакты остаются. */
140
+ cleanupWorktrees(options = {}) {
141
+ return this.runner.cleanupWorktrees(options);
142
+ }
139
143
  repoPath(path) {
140
144
  return isAbsolute(path) ? path : resolve(this.options.baseDir, path);
141
145
  }
@@ -205,7 +205,7 @@ export declare function recoveryBrief(view: ExecutionView, work: WorkState, poli
205
205
  attempts: {
206
206
  run: string;
207
207
  attempt: number;
208
- failureKind: "gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead" | undefined;
208
+ failureKind: "gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead" | undefined;
209
209
  error: string | undefined;
210
210
  findings: {
211
211
  severity: string;