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
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
- import { HarnessError, WORKSPACE_OWNER, contextDigest, findingId, mcpEnvironment, reviewIssues, issuePath, reviewResultSchema, selectReviewer, } from "../contracts/index.js";
4
+ import { HarnessError, REVIEW_ITEMS_LIMIT, WORKSPACE_OWNER, contextDigest, findingId, mcpEnvironment, reviewIssues, issuePath, reviewResultSchema, selectReviewer, } from "../contracts/index.js";
5
5
  import { reviewOutputSchema } from "../agents/schemas.js";
6
6
  import { redactInspection } from "../agents/inspect.js";
7
7
  import { executionEnvironment } from "../environment/lifecycle.js";
@@ -51,6 +51,11 @@ export async function technicalReview(engine, policy, adapters, input) {
51
51
  if (!adapter)
52
52
  throw new HarnessError('RUNTIME_UNAVAILABLE', 'Runtime не подключён: ' + choice.reviewer.runtime);
53
53
  const open = lastFindings.filter((f) => f.status === 'open');
54
+ // Ответ обязан назвать каждую открытую находку по ID, а `previous` ограничен:
55
+ // такой раунд не одобрить, и вызов модели был бы оплачен впустую.
56
+ const named = new Set(open.map((f) => f.id)).size;
57
+ if (named > REVIEW_ITEMS_LIMIT)
58
+ throw new HarnessError('REVIEW_PROTOCOL_INVALID', `Ревью ${kind} ${subject}: открытых находок ${named}, предел раунда ревью ${REVIEW_ITEMS_LIMIT}; нового вызова нет`);
54
59
  const round = before + 1;
55
60
  const dir = input.artifactDir;
56
61
  await mkdir(dir, { recursive: true });
@@ -255,7 +255,7 @@ export declare class Engine {
255
255
  pauseReason?: "runtime" | "operator" | "shutdown" | "base-check" | "reconfigure" | undefined;
256
256
  pausedAt?: string | undefined;
257
257
  pauseOperation?: string | undefined;
258
- pauseFailures?: ("gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
258
+ pauseFailures?: ("gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
259
259
  waits?: {
260
260
  kind: "base-check" | "context-lock";
261
261
  detail: string;
@@ -291,7 +291,7 @@ export declare class Engine {
291
291
  pauseReason?: "runtime" | "operator" | "shutdown" | "base-check" | "reconfigure" | undefined;
292
292
  pausedAt?: string | undefined;
293
293
  pauseOperation?: string | undefined;
294
- pauseFailures?: ("gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
294
+ pauseFailures?: ("gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
295
295
  waits?: {
296
296
  kind: "base-check" | "context-lock";
297
297
  detail: string;
@@ -321,7 +321,7 @@ export declare class Engine {
321
321
  pauseReason?: "runtime" | "operator" | "shutdown" | "base-check" | "reconfigure" | undefined;
322
322
  pausedAt?: string | undefined;
323
323
  pauseOperation?: string | undefined;
324
- pauseFailures?: ("gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
324
+ pauseFailures?: ("gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead")[] | undefined;
325
325
  waits?: {
326
326
  kind: "base-check" | "context-lock";
327
327
  detail: string;
@@ -628,6 +628,21 @@ export declare class Engine {
628
628
  } | undefined;
629
629
  coverage?: string[] | undefined;
630
630
  } | undefined;
631
+ artifactFiles?: {
632
+ dir: string;
633
+ files: {
634
+ path: string;
635
+ sha256: string;
636
+ bytes: number;
637
+ redacted?: true | undefined;
638
+ }[];
639
+ skipped: {
640
+ path: string;
641
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
642
+ detail?: string | undefined;
643
+ }[];
644
+ skippedMore?: number | undefined;
645
+ } | undefined;
631
646
  checks?: string | undefined;
632
647
  alreadySatisfied?: {
633
648
  gates: string[];
@@ -692,7 +707,7 @@ export declare class Engine {
692
707
  properties?: string[] | undefined;
693
708
  workId: string;
694
709
  runId: string;
695
- kind: "gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead";
710
+ kind: "gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead";
696
711
  blocked: boolean;
697
712
  /** Работа возвращена в очередь (штатная остановка); иначе — обычный отказ. */
698
713
  interrupted: boolean;
@@ -1046,7 +1061,7 @@ export declare class Engine {
1046
1061
  changed: string[];
1047
1062
  affected: string[];
1048
1063
  gateIds: string[];
1049
- mode: "all" | "affected";
1064
+ mode: "affected" | "all";
1050
1065
  reason: string;
1051
1066
  baseline?: string | undefined;
1052
1067
  };
@@ -1069,6 +1084,21 @@ export declare class Engine {
1069
1084
  path: string;
1070
1085
  digest: string;
1071
1086
  }[];
1087
+ artifactFiles?: {
1088
+ dir: string;
1089
+ files: {
1090
+ path: string;
1091
+ sha256: string;
1092
+ bytes: number;
1093
+ redacted?: true | undefined;
1094
+ }[];
1095
+ skipped: {
1096
+ path: string;
1097
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
1098
+ detail?: string | undefined;
1099
+ }[];
1100
+ skippedMore?: number | undefined;
1101
+ } | undefined;
1072
1102
  durationMs?: number | undefined;
1073
1103
  }[];
1074
1104
  token: string;
@@ -1084,7 +1114,7 @@ export declare class Engine {
1084
1114
  changed: string[];
1085
1115
  affected: string[];
1086
1116
  gateIds: string[];
1087
- mode: "all" | "affected";
1117
+ mode: "affected" | "all";
1088
1118
  reason: string;
1089
1119
  baseline?: string | undefined;
1090
1120
  };
@@ -1109,6 +1139,21 @@ export declare class Engine {
1109
1139
  path: string;
1110
1140
  digest: string;
1111
1141
  }[];
1142
+ artifactFiles?: {
1143
+ dir: string;
1144
+ files: {
1145
+ path: string;
1146
+ sha256: string;
1147
+ bytes: number;
1148
+ redacted?: true | undefined;
1149
+ }[];
1150
+ skipped: {
1151
+ path: string;
1152
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
1153
+ detail?: string | undefined;
1154
+ }[];
1155
+ skippedMore?: number | undefined;
1156
+ } | undefined;
1112
1157
  durationMs?: number | undefined;
1113
1158
  }[];
1114
1159
  token: string;
@@ -1124,7 +1169,7 @@ export declare class Engine {
1124
1169
  changed: string[];
1125
1170
  affected: string[];
1126
1171
  gateIds: string[];
1127
- mode: "all" | "affected";
1172
+ mode: "affected" | "all";
1128
1173
  reason: string;
1129
1174
  baseline?: string | undefined;
1130
1175
  };
@@ -1148,6 +1193,21 @@ export declare class Engine {
1148
1193
  path: string;
1149
1194
  digest: string;
1150
1195
  }[];
1196
+ artifactFiles?: {
1197
+ dir: string;
1198
+ files: {
1199
+ path: string;
1200
+ sha256: string;
1201
+ bytes: number;
1202
+ redacted?: true | undefined;
1203
+ }[];
1204
+ skipped: {
1205
+ path: string;
1206
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
1207
+ detail?: string | undefined;
1208
+ }[];
1209
+ skippedMore?: number | undefined;
1210
+ } | undefined;
1151
1211
  durationMs?: number | undefined;
1152
1212
  }[];
1153
1213
  token: string;
@@ -1176,6 +1236,21 @@ export declare class Engine {
1176
1236
  path: string;
1177
1237
  digest: string;
1178
1238
  }[];
1239
+ artifactFiles?: {
1240
+ dir: string;
1241
+ files: {
1242
+ path: string;
1243
+ sha256: string;
1244
+ bytes: number;
1245
+ redacted?: true | undefined;
1246
+ }[];
1247
+ skipped: {
1248
+ path: string;
1249
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
1250
+ detail?: string | undefined;
1251
+ }[];
1252
+ skippedMore?: number | undefined;
1253
+ } | undefined;
1179
1254
  durationMs?: number | undefined;
1180
1255
  }[];
1181
1256
  manifest?: Record<string, {
@@ -1187,7 +1262,7 @@ export declare class Engine {
1187
1262
  changed: string[];
1188
1263
  affected: string[];
1189
1264
  gateIds: string[];
1190
- mode: "all" | "affected";
1265
+ mode: "affected" | "all";
1191
1266
  reason: string;
1192
1267
  baseline?: string | undefined;
1193
1268
  } | undefined;
@@ -1213,6 +1288,21 @@ export declare class Engine {
1213
1288
  path: string;
1214
1289
  digest: string;
1215
1290
  }[];
1291
+ artifactFiles?: {
1292
+ dir: string;
1293
+ files: {
1294
+ path: string;
1295
+ sha256: string;
1296
+ bytes: number;
1297
+ redacted?: true | undefined;
1298
+ }[];
1299
+ skipped: {
1300
+ path: string;
1301
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
1302
+ detail?: string | undefined;
1303
+ }[];
1304
+ skippedMore?: number | undefined;
1305
+ } | undefined;
1216
1306
  durationMs?: number | undefined;
1217
1307
  }[];
1218
1308
  manifest?: Record<string, {
@@ -1224,7 +1314,7 @@ export declare class Engine {
1224
1314
  changed: string[];
1225
1315
  affected: string[];
1226
1316
  gateIds: string[];
1227
- mode: "all" | "affected";
1317
+ mode: "affected" | "all";
1228
1318
  reason: string;
1229
1319
  baseline?: string | undefined;
1230
1320
  } | undefined;
@@ -1254,13 +1344,28 @@ export declare class Engine {
1254
1344
  path: string;
1255
1345
  digest: string;
1256
1346
  }[];
1347
+ artifactFiles?: {
1348
+ dir: string;
1349
+ files: {
1350
+ path: string;
1351
+ sha256: string;
1352
+ bytes: number;
1353
+ redacted?: true | undefined;
1354
+ }[];
1355
+ skipped: {
1356
+ path: string;
1357
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
1358
+ detail?: string | undefined;
1359
+ }[];
1360
+ skippedMore?: number | undefined;
1361
+ } | undefined;
1257
1362
  durationMs?: number | undefined;
1258
1363
  }[];
1259
1364
  impact?: {
1260
1365
  changed: string[];
1261
1366
  affected: string[];
1262
1367
  gateIds: string[];
1263
- mode: "all" | "affected";
1368
+ mode: "affected" | "all";
1264
1369
  reason: string;
1265
1370
  baseline?: string | undefined;
1266
1371
  } | undefined;
@@ -1338,7 +1443,7 @@ export declare class Engine {
1338
1443
  activeRunId?: string | undefined;
1339
1444
  resultSha?: string | undefined;
1340
1445
  failure?: string | undefined;
1341
- failureKind?: "gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead" | undefined;
1446
+ failureKind?: "gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead" | undefined;
1342
1447
  failureFingerprint?: string | undefined;
1343
1448
  approvedAt?: string | undefined;
1344
1449
  approvedDigest?: string | undefined;
@@ -1496,7 +1601,7 @@ export declare class Engine {
1496
1601
  activeRunId?: string | undefined;
1497
1602
  resultSha?: string | undefined;
1498
1603
  failure?: string | undefined;
1499
- failureKind?: "gate" | "unknown" | "review" | "environment" | "cancelled" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead" | undefined;
1604
+ failureKind?: "gate" | "unknown" | "review" | "cancelled" | "environment" | "timeout" | "provider-auth" | "stale-base" | "empty-result" | "unfinished" | "scope-violation" | "review-protocol" | "merge" | "budget" | "needs-lead" | undefined;
1500
1605
  failureFingerprint?: string | undefined;
1501
1606
  approvedAt?: string | undefined;
1502
1607
  approvedDigest?: string | undefined;
@@ -56,6 +56,21 @@ export declare class JointRunner {
56
56
  path: string;
57
57
  digest: string;
58
58
  }[];
59
+ artifactFiles?: {
60
+ dir: string;
61
+ files: {
62
+ path: string;
63
+ sha256: string;
64
+ bytes: number;
65
+ redacted?: true | undefined;
66
+ }[];
67
+ skipped: {
68
+ path: string;
69
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
70
+ detail?: string | undefined;
71
+ }[];
72
+ skippedMore?: number | undefined;
73
+ } | undefined;
59
74
  durationMs?: number | undefined;
60
75
  }[];
61
76
  manifest?: Record<string, {
@@ -67,7 +82,7 @@ export declare class JointRunner {
67
82
  changed: string[];
68
83
  affected: string[];
69
84
  gateIds: string[];
70
- mode: "all" | "affected";
85
+ mode: "affected" | "all";
71
86
  reason: string;
72
87
  baseline?: string | undefined;
73
88
  } | undefined;
@@ -93,6 +108,21 @@ export declare class JointRunner {
93
108
  path: string;
94
109
  digest: string;
95
110
  }[];
111
+ artifactFiles?: {
112
+ dir: string;
113
+ files: {
114
+ path: string;
115
+ sha256: string;
116
+ bytes: number;
117
+ redacted?: true | undefined;
118
+ }[];
119
+ skipped: {
120
+ path: string;
121
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
122
+ detail?: string | undefined;
123
+ }[];
124
+ skippedMore?: number | undefined;
125
+ } | undefined;
96
126
  durationMs?: number | undefined;
97
127
  }[];
98
128
  manifest?: Record<string, {
@@ -104,7 +134,7 @@ export declare class JointRunner {
104
134
  changed: string[];
105
135
  affected: string[];
106
136
  gateIds: string[];
107
- mode: "all" | "affected";
137
+ mode: "affected" | "all";
108
138
  reason: string;
109
139
  baseline?: string | undefined;
110
140
  } | undefined;
@@ -134,13 +164,28 @@ export declare class JointRunner {
134
164
  path: string;
135
165
  digest: string;
136
166
  }[];
167
+ artifactFiles?: {
168
+ dir: string;
169
+ files: {
170
+ path: string;
171
+ sha256: string;
172
+ bytes: number;
173
+ redacted?: true | undefined;
174
+ }[];
175
+ skipped: {
176
+ path: string;
177
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
178
+ detail?: string | undefined;
179
+ }[];
180
+ skippedMore?: number | undefined;
181
+ } | undefined;
137
182
  durationMs?: number | undefined;
138
183
  }[];
139
184
  impact?: {
140
185
  changed: string[];
141
186
  affected: string[];
142
187
  gateIds: string[];
143
- mode: "all" | "affected";
188
+ mode: "affected" | "all";
144
189
  reason: string;
145
190
  baseline?: string | undefined;
146
191
  } | undefined;
@@ -169,6 +214,21 @@ export declare class JointRunner {
169
214
  path: string;
170
215
  digest: string;
171
216
  }[];
217
+ artifactFiles?: {
218
+ dir: string;
219
+ files: {
220
+ path: string;
221
+ sha256: string;
222
+ bytes: number;
223
+ redacted?: true | undefined;
224
+ }[];
225
+ skipped: {
226
+ path: string;
227
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
228
+ detail?: string | undefined;
229
+ }[];
230
+ skippedMore?: number | undefined;
231
+ } | undefined;
172
232
  durationMs?: number | undefined;
173
233
  }[];
174
234
  manifest?: Record<string, {
@@ -180,7 +240,7 @@ export declare class JointRunner {
180
240
  changed: string[];
181
241
  affected: string[];
182
242
  gateIds: string[];
183
- mode: "all" | "affected";
243
+ mode: "affected" | "all";
184
244
  reason: string;
185
245
  baseline?: string | undefined;
186
246
  } | undefined;
@@ -206,6 +266,21 @@ export declare class JointRunner {
206
266
  path: string;
207
267
  digest: string;
208
268
  }[];
269
+ artifactFiles?: {
270
+ dir: string;
271
+ files: {
272
+ path: string;
273
+ sha256: string;
274
+ bytes: number;
275
+ redacted?: true | undefined;
276
+ }[];
277
+ skipped: {
278
+ path: string;
279
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
280
+ detail?: string | undefined;
281
+ }[];
282
+ skippedMore?: number | undefined;
283
+ } | undefined;
209
284
  durationMs?: number | undefined;
210
285
  }[];
211
286
  manifest?: Record<string, {
@@ -217,7 +292,7 @@ export declare class JointRunner {
217
292
  changed: string[];
218
293
  affected: string[];
219
294
  gateIds: string[];
220
- mode: "all" | "affected";
295
+ mode: "affected" | "all";
221
296
  reason: string;
222
297
  baseline?: string | undefined;
223
298
  } | undefined;
@@ -247,13 +322,28 @@ export declare class JointRunner {
247
322
  path: string;
248
323
  digest: string;
249
324
  }[];
325
+ artifactFiles?: {
326
+ dir: string;
327
+ files: {
328
+ path: string;
329
+ sha256: string;
330
+ bytes: number;
331
+ redacted?: true | undefined;
332
+ }[];
333
+ skipped: {
334
+ path: string;
335
+ reason: "missing" | "symlink" | "outside" | "not-regular" | "hardlink" | "secret" | "extension" | "file-limit" | "total-limit" | "count-limit" | "scan-limit" | "copy-failed";
336
+ detail?: string | undefined;
337
+ }[];
338
+ skippedMore?: number | undefined;
339
+ } | undefined;
250
340
  durationMs?: number | undefined;
251
341
  }[];
252
342
  impact?: {
253
343
  changed: string[];
254
344
  affected: string[];
255
345
  gateIds: string[];
256
- mode: "all" | "affected";
346
+ mode: "affected" | "all";
257
347
  reason: string;
258
348
  baseline?: string | undefined;
259
349
  } | undefined;
@@ -8,6 +8,8 @@ import { credentialPaths } from "../environment/isolation.js";
8
8
  import { CleanupFailure, availableRedactor, executionEnvironment, withEnvironment, } from "../environment/lifecycle.js";
9
9
  import { composeRedactors } from "../environment/redaction.js";
10
10
  import { defaultResourceDatabase, withResources } from "../environment/resources.js";
11
+ import { dependencyStoreRoot, materializeStore } from "../verification/dependency-store.js";
12
+ import { keepGateArtifacts } from "../verification/gate-artifacts.js";
11
13
  import { junitSummary, prepareReportPath, runCheck } from "../verification/gates.js";
12
14
  import { orderedWorkspaceGates, publicJoint } from "../verification/joint.js";
13
15
  /**
@@ -48,6 +50,7 @@ export class JointRunner {
48
50
  const controller = new AbortController();
49
51
  const signal = outer ? AbortSignal.any([outer, controller.signal]) : controller.signal;
50
52
  const timer = setTimeout(() => controller.abort(), this.policy.runTimeoutMs);
53
+ const deadline = Date.now() + this.policy.runTimeoutMs;
51
54
  const heartbeat = setInterval(() => {
52
55
  try {
53
56
  this.engine.jointHeartbeat(v.id, v.token);
@@ -136,7 +139,37 @@ export class JointRunner {
136
139
  };
137
140
  const first = paths[this.policy.repositories[0].id];
138
141
  await withEnvironment(this.policy.workspaceLifecycle, first, join(dir, 'environment'), executionEnvironment([this.policy.environment], common, source), signal, async () => {
139
- for (const gate of orderedWorkspaceGates(this.policy.workspaceGates).filter((g) => impact.gateIds.includes(g.id))) {
142
+ const gates = orderedWorkspaceGates(this.policy.workspaceGates).filter((g) => impact.gateIds.includes(g.id));
143
+ // У совместной проверки нет `prepare`: хранилище разворачивается
144
+ // здесь, в компоненты, чьи gates будут исполняться.
145
+ const stores = {};
146
+ for (const repo of this.policy.repositories) {
147
+ if (!repo.dependencyStore || !gates.some((g) => g.repositoryId === repo.id))
148
+ continue;
149
+ const receipt = await materializeStore({
150
+ policy: this.policy,
151
+ root: (id) => dependencyStoreRoot(placement, this.options.stateDir, id),
152
+ repoPath: (r) => this.repoPath(r),
153
+ boundary: {
154
+ hidden: [
155
+ this.options.stateDir,
156
+ ...this.policy.repositories.map((r) => this.repoPath(r)),
157
+ ],
158
+ ...(placement.root ? { checkouts: [placement.root] } : {}),
159
+ },
160
+ resourceDatabase: this.options.resourceDatabase ?? defaultResourceDatabase(),
161
+ deadline,
162
+ phaseMs: this.policy.runTimeoutMs,
163
+ }, {
164
+ repo,
165
+ cwd: paths[repo.id],
166
+ execution: executionEnvironment([this.policy.environment, repo.environment], common, source),
167
+ signal,
168
+ dir: join(dir, 'dependency-store', repo.id),
169
+ });
170
+ stores[repo.id] = receipt.env;
171
+ }
172
+ for (const gate of gates) {
140
173
  if (signal.aborted)
141
174
  throw new Error('Совместная проверка отменена');
142
175
  const cwd = paths[gate.repositoryId];
@@ -183,6 +216,7 @@ export class JointRunner {
183
216
  settingsDir: join(dir, gate.id),
184
217
  env: {
185
218
  ...environment.env,
219
+ ...stores[gate.repositoryId],
186
220
  ...(reportPath
187
221
  ? { DEVCONTOUR_REPORT_PATH: reportPath, HARNESS_REPORT_PATH: reportPath }
188
222
  : {}),
@@ -222,6 +256,17 @@ export class JointRunner {
222
256
  summary = redact(error instanceof Error ? error.message : String(error));
223
257
  log += '\n' + summary;
224
258
  }
259
+ // Объявленные artifacts сохраняются копиями при любом исходе;
260
+ // их наличие и неизменность по-прежнему проверяет сам gate.
261
+ const artifactFiles = gate.artifacts.length
262
+ ? await keepGateArtifacts({
263
+ root: cwd,
264
+ paths: gate.artifacts,
265
+ dest: join(dir, `${gate.id}.artifacts`),
266
+ redact,
267
+ signal,
268
+ })
269
+ : undefined;
225
270
  log = redact(log);
226
271
  await writeFile(logPath, log);
227
272
  const evidence = {
@@ -233,6 +278,7 @@ export class JointRunner {
233
278
  digest: createHash('sha256').update(log).digest('hex'),
234
279
  summary: redact(summary).slice(0, 4000),
235
280
  artifacts,
281
+ ...(artifactFiles ? { artifactFiles } : {}),
236
282
  durationMs: Date.now() - startedAt,
237
283
  };
238
284
  this.engine.jointEvidence(v.id, v.token, evidence);
@@ -1,4 +1,5 @@
1
1
  import { type ImplementationResult, type AttemptState, type ContextSnapshot, type ExecutionPolicy, type RuntimeAdapter, type RuntimeName, type WorkState } from '../contracts/index.ts';
2
+ import { type WorktreeCleanupEntry } from './worktree-cleanup.ts';
2
3
  import { type CheckoutRoot } from '../environment/checkout-root.ts';
3
4
  import { type FailureKind } from './failure.ts';
4
5
  import { type Engine } from './engine.ts';
@@ -101,11 +102,15 @@ export declare class Runner {
101
102
  /** Каталог попыток репозитория. */
102
103
  private dirOf;
103
104
  private placement?;
105
+ /** Когда истекает текущий предел времени попытки: от остатка считается бюджет хранилища. */
106
+ private phaseDeadlines;
104
107
  /**
105
108
  * Действующий корень рабочих деревьев (`checkout-root.ts`): хост
106
109
  * показывает его в диагностике. Выбирается один раз на исполнитель.
107
110
  */
108
111
  checkoutRoot(): CheckoutRoot;
112
+ /** Хранилище зависимостей: те же корень и граница, что у деревьев попытки. */
113
+ private storeContext;
109
114
  /** Каталог рабочего дерева вида `kind`: вне дерева или прежний в каталоге попыток. */
110
115
  private checkout;
111
116
  repoPath(repo: Repo): string;
@@ -176,6 +181,8 @@ export declare class Runner {
176
181
  private adapter;
177
182
  /** Область записи кандидата: защищённые пути, пустой результат, выход за область поручения и роли. */
178
183
  private assertScope;
184
+ /** Хранилище зависимостей checkout до `prepare`; без него этапа нет и в замерах. */
185
+ private dependencyStore;
179
186
  /** Стадия попытки с замером: начало, конец и исход записываются под fencing. */
180
187
  private timed;
181
188
  /**
@@ -214,6 +221,28 @@ export declare class Runner {
214
221
  status: "cleaned";
215
222
  receipts: string[];
216
223
  }>;
224
+ /** Предел обхода дерева при очистке: дошедший до него обход отказывает. */
225
+ static cleanupScanLimit: number;
226
+ /** Предел удаления одного дерева: большие деревья удаляются минутами. */
227
+ static cleanupRemovalMs: number;
228
+ /**
229
+ * Убрать рабочие деревья закончившихся попыток. Ветки и достижимые коммиты
230
+ * остаются; неподтверждённые правки сохраняются патчем в артефактах попытки
231
+ * до удаления. В сомнении дерево остаётся: отказ назван поимённо и не срывает
232
+ * остальные деревья. Один запуск на каталог состояния; `dryRun` ничего не пишет.
233
+ */
234
+ cleanupWorktrees({ dryRun }?: {
235
+ dryRun?: boolean;
236
+ }): Promise<{
237
+ dryRun: boolean;
238
+ removed: number;
239
+ removable: number;
240
+ refused: number;
241
+ failed: number;
242
+ reclaimedKb: number;
243
+ worktrees: WorktreeCleanupEntry[];
244
+ }>;
245
+ private sweepWorktrees;
217
246
  private gate;
218
247
  /**
219
248
  * Gate интеграции с одним повтором на кандидата. Провал собственного gate на