devcontour-harness 0.1.0-alpha.44 → 0.1.0-alpha.46

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 (57) hide show
  1. package/README.md +20 -2
  2. package/docs/architecture.md +8 -0
  3. package/docs/contracts.md +122 -2
  4. package/docs/release-notes/0.1.0-alpha.45.md +77 -0
  5. package/docs/release-notes/0.1.0-alpha.46.md +63 -0
  6. package/docs/upgrade.md +98 -18
  7. package/lib/contracts/cli.d.ts +68 -0
  8. package/lib/contracts/cli.js +6 -1
  9. package/lib/contracts/events.d.ts +5 -0
  10. package/lib/contracts/events.js +2 -0
  11. package/lib/contracts/execution.d.ts +39 -0
  12. package/lib/contracts/execution.js +20 -2
  13. package/lib/contracts/handoff.d.ts +1 -0
  14. package/lib/contracts/handoff.js +6 -1
  15. package/lib/contracts/policy.d.ts +39 -0
  16. package/lib/contracts/policy.js +64 -0
  17. package/lib/contracts/profiles.d.ts +6 -0
  18. package/lib/contracts/published.d.ts +70 -0
  19. package/lib/contracts/result.d.ts +91 -0
  20. package/lib/contracts/result.js +31 -1
  21. package/lib/contracts/review.d.ts +1 -1
  22. package/lib/control/harness.d.ts +24 -2
  23. package/lib/control/workflow.d.ts +5 -1
  24. package/lib/control/workflow.js +18 -3
  25. package/lib/engine/engine.d.ts +30 -5
  26. package/lib/engine/engine.js +104 -13
  27. package/lib/engine/result.js +7 -3
  28. package/lib/engine/runner.d.ts +8 -0
  29. package/lib/engine/runner.js +96 -3
  30. package/lib/environment/git-trust.js +3 -0
  31. package/lib/environment/process.d.ts +2 -0
  32. package/lib/environment/process.js +7 -1
  33. package/lib/explain/state.js +1 -1
  34. package/lib/handoff/pack.js +7 -1
  35. package/lib/index.d.ts +1 -0
  36. package/lib/index.js +1 -0
  37. package/lib/integrations/connector/history.js +1 -1
  38. package/lib/integrations/connector/summary.js +2 -1
  39. package/lib/profiles/resolve.d.ts +6 -0
  40. package/lib/projections/attempt.d.ts +4 -2
  41. package/lib/projections/attempt.js +14 -1
  42. package/lib/report/compute.js +4 -3
  43. package/lib/storage/document.d.ts +26 -2
  44. package/lib/verification/acceptance.d.ts +12 -0
  45. package/lib/verification/acceptance.js +62 -7
  46. package/lib/verification/applicability.d.ts +157 -0
  47. package/lib/verification/applicability.js +406 -0
  48. package/lib/verification/gates.d.ts +6 -0
  49. package/lib/verification/proof.d.ts +18 -4
  50. package/lib/verification/proof.js +52 -9
  51. package/package.json +1 -1
  52. package/schemas/execution-document.schema.json +73 -1
  53. package/schemas/execution-policy.schema.json +38 -0
  54. package/schemas/handoff-pack.schema.json +4 -0
  55. package/schemas/result-envelope.schema.json +138 -2
  56. package/schemas/run-event.schema.json +4 -0
  57. package/schemas/run-result.schema.json +138 -2
@@ -218,6 +218,9 @@ export declare const publishedSchemas: {
218
218
  path: z.ZodString;
219
219
  }, z.core.$strict>;
220
220
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
221
+ when: z.ZodOptional<z.ZodObject<{
222
+ paths: z.ZodArray<z.ZodString>;
223
+ }, z.core.$strict>>;
221
224
  id: z.ZodString;
222
225
  command: z.ZodArray<z.ZodString>;
223
226
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -234,6 +237,9 @@ export declare const publishedSchemas: {
234
237
  path: z.ZodString;
235
238
  }, z.core.$strict>>;
236
239
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
240
+ when: z.ZodOptional<z.ZodObject<{
241
+ paths: z.ZodArray<z.ZodString>;
242
+ }, z.core.$strict>>;
237
243
  id: z.ZodString;
238
244
  command: z.ZodArray<z.ZodString>;
239
245
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -916,6 +922,7 @@ export declare const publishedSchemas: {
916
922
  test: "test";
917
923
  property: "property";
918
924
  consumer: "consumer";
925
+ "not-applicable": "not-applicable";
919
926
  }>;
920
927
  phase: z.ZodEnum<{
921
928
  candidate: "candidate";
@@ -952,6 +959,17 @@ export declare const publishedSchemas: {
952
959
  }, z.core.$strict>>;
953
960
  }, z.core.$strict>>;
954
961
  }, z.core.$strict>>;
962
+ notApplicable: z.ZodOptional<z.ZodObject<{
963
+ gateDigest: z.ZodString;
964
+ patterns: z.ZodArray<z.ZodString>;
965
+ ranges: z.ZodArray<z.ZodObject<{
966
+ from: z.ZodString;
967
+ to: z.ZodString;
968
+ }, z.core.$strict>>;
969
+ count: z.ZodNumber;
970
+ files: z.ZodArray<z.ZodString>;
971
+ pathsDigest: z.ZodString;
972
+ }, z.core.$strict>>;
955
973
  reviewer: z.ZodOptional<z.ZodObject<{
956
974
  runtime: z.ZodEnum<{
957
975
  codex: "codex";
@@ -1140,6 +1158,7 @@ export declare const publishedSchemas: {
1140
1158
  test: "test";
1141
1159
  property: "property";
1142
1160
  consumer: "consumer";
1161
+ "not-applicable": "not-applicable";
1143
1162
  }>;
1144
1163
  phase: z.ZodEnum<{
1145
1164
  candidate: "candidate";
@@ -1176,6 +1195,17 @@ export declare const publishedSchemas: {
1176
1195
  }, z.core.$strict>>;
1177
1196
  }, z.core.$strict>>;
1178
1197
  }, z.core.$strict>>;
1198
+ notApplicable: z.ZodOptional<z.ZodObject<{
1199
+ gateDigest: z.ZodString;
1200
+ patterns: z.ZodArray<z.ZodString>;
1201
+ ranges: z.ZodArray<z.ZodObject<{
1202
+ from: z.ZodString;
1203
+ to: z.ZodString;
1204
+ }, z.core.$strict>>;
1205
+ count: z.ZodNumber;
1206
+ files: z.ZodArray<z.ZodString>;
1207
+ pathsDigest: z.ZodString;
1208
+ }, z.core.$strict>>;
1179
1209
  reviewer: z.ZodOptional<z.ZodObject<{
1180
1210
  runtime: z.ZodEnum<{
1181
1211
  codex: "codex";
@@ -1321,6 +1351,7 @@ export declare const publishedSchemas: {
1321
1351
  test: "test";
1322
1352
  property: "property";
1323
1353
  consumer: "consumer";
1354
+ "not-applicable": "not-applicable";
1324
1355
  }>;
1325
1356
  phase: z.ZodEnum<{
1326
1357
  candidate: "candidate";
@@ -1357,6 +1388,17 @@ export declare const publishedSchemas: {
1357
1388
  }, z.core.$strict>>;
1358
1389
  }, z.core.$strict>>;
1359
1390
  }, z.core.$strict>>;
1391
+ notApplicable: z.ZodOptional<z.ZodObject<{
1392
+ gateDigest: z.ZodString;
1393
+ patterns: z.ZodArray<z.ZodString>;
1394
+ ranges: z.ZodArray<z.ZodObject<{
1395
+ from: z.ZodString;
1396
+ to: z.ZodString;
1397
+ }, z.core.$strict>>;
1398
+ count: z.ZodNumber;
1399
+ files: z.ZodArray<z.ZodString>;
1400
+ pathsDigest: z.ZodString;
1401
+ }, z.core.$strict>>;
1360
1402
  reviewer: z.ZodOptional<z.ZodObject<{
1361
1403
  runtime: z.ZodEnum<{
1362
1404
  codex: "codex";
@@ -1545,6 +1587,7 @@ export declare const publishedSchemas: {
1545
1587
  test: "test";
1546
1588
  property: "property";
1547
1589
  consumer: "consumer";
1590
+ "not-applicable": "not-applicable";
1548
1591
  }>;
1549
1592
  phase: z.ZodEnum<{
1550
1593
  candidate: "candidate";
@@ -1581,6 +1624,17 @@ export declare const publishedSchemas: {
1581
1624
  }, z.core.$strict>>;
1582
1625
  }, z.core.$strict>>;
1583
1626
  }, z.core.$strict>>;
1627
+ notApplicable: z.ZodOptional<z.ZodObject<{
1628
+ gateDigest: z.ZodString;
1629
+ patterns: z.ZodArray<z.ZodString>;
1630
+ ranges: z.ZodArray<z.ZodObject<{
1631
+ from: z.ZodString;
1632
+ to: z.ZodString;
1633
+ }, z.core.$strict>>;
1634
+ count: z.ZodNumber;
1635
+ files: z.ZodArray<z.ZodString>;
1636
+ pathsDigest: z.ZodString;
1637
+ }, z.core.$strict>>;
1584
1638
  reviewer: z.ZodOptional<z.ZodObject<{
1585
1639
  runtime: z.ZodEnum<{
1586
1640
  codex: "codex";
@@ -1729,6 +1783,7 @@ export declare const publishedSchemas: {
1729
1783
  passed: z.ZodBoolean;
1730
1784
  evidenceId: z.ZodString;
1731
1785
  consumer: z.ZodOptional<z.ZodString>;
1786
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
1732
1787
  recheck: z.ZodOptional<z.ZodObject<{
1733
1788
  of: z.ZodString;
1734
1789
  outcome: z.ZodEnum<{
@@ -2227,6 +2282,7 @@ export declare const publishedSchemas: {
2227
2282
  passed: z.ZodBoolean;
2228
2283
  evidenceId: z.ZodString;
2229
2284
  consumer: z.ZodOptional<z.ZodString>;
2285
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
2230
2286
  recheck: z.ZodOptional<z.ZodObject<{
2231
2287
  of: z.ZodString;
2232
2288
  outcome: z.ZodEnum<{
@@ -3506,6 +3562,7 @@ export declare const publishedSchemas: {
3506
3562
  kind: z.ZodEnum<{
3507
3563
  review: "review";
3508
3564
  test: "test";
3565
+ "not-applicable": "not-applicable";
3509
3566
  }>;
3510
3567
  phase: z.ZodEnum<{
3511
3568
  candidate: "candidate";
@@ -3746,6 +3803,18 @@ export declare const publishedSchemas: {
3746
3803
  skippedMore: z.ZodOptional<z.ZodNumber>;
3747
3804
  }, z.core.$strict>>;
3748
3805
  checks: z.ZodOptional<z.ZodString>;
3806
+ gateBasis: z.ZodOptional<z.ZodString>;
3807
+ notApplicable: z.ZodOptional<z.ZodObject<{
3808
+ gateDigest: z.ZodString;
3809
+ patterns: z.ZodArray<z.ZodString>;
3810
+ ranges: z.ZodArray<z.ZodObject<{
3811
+ from: z.ZodString;
3812
+ to: z.ZodString;
3813
+ }, z.core.$strict>>;
3814
+ count: z.ZodNumber;
3815
+ files: z.ZodArray<z.ZodString>;
3816
+ pathsDigest: z.ZodString;
3817
+ }, z.core.$strict>>;
3749
3818
  alreadySatisfied: z.ZodOptional<z.ZodObject<{
3750
3819
  gates: z.ZodArray<z.ZodString>;
3751
3820
  evidence: z.ZodString;
@@ -5610,6 +5679,7 @@ export declare const publishedSchemas: {
5610
5679
  }, z.core.$strict>>;
5611
5680
  repairs: z.ZodArray<z.ZodObject<{
5612
5681
  graphId: z.ZodString;
5682
+ key: z.ZodOptional<z.ZodString>;
5613
5683
  status: z.ZodString;
5614
5684
  used: z.ZodNumber;
5615
5685
  budget: z.ZodNumber;
@@ -13,6 +13,37 @@ export declare const findingSchema: z.ZodObject<{
13
13
  }>>;
14
14
  }, z.core.$strict>;
15
15
  export type Finding = z.infer<typeof findingSchema>;
16
+ /** Пределы сведений о неприменимости gate (`when.paths`). */
17
+ export declare const gateApplicabilityLimits: {
18
+ /** Шаблонов путей у gate. */
19
+ readonly patterns: 64;
20
+ /** Перечисленных изменённых путей; остальные — числом (`count`) и digest. */
21
+ readonly files: 50;
22
+ /** Изменённых путей, сверх которых diff не разбирается и gate исполняется. */
23
+ readonly changed: 5000;
24
+ };
25
+ /**
26
+ * Почему gate с `when.paths` не исполнялся: настоящий diff фазы (не заявление
27
+ * исполнителя) не задел ни одного его пути и ни одного неявного входа. Это не
28
+ * PASS: запись вида `not-applicable` закрывает только обычный обязательный
29
+ * gate, но не доказательство требования, свойства или testcase.
30
+ * `gateDigest` — digest определения gate (`gateDigest`), под которым принято
31
+ * решение; `ranges` — сравненные пары коммитов, `count` — число изменённых
32
+ * путей, `files` — первые из них, `pathsDigest` — SHA-256 отсортированного
33
+ * полного списка, разделённого NUL.
34
+ */
35
+ export declare const gateApplicabilitySchema: z.ZodObject<{
36
+ gateDigest: z.ZodString;
37
+ patterns: z.ZodArray<z.ZodString>;
38
+ ranges: z.ZodArray<z.ZodObject<{
39
+ from: z.ZodString;
40
+ to: z.ZodString;
41
+ }, z.core.$strict>>;
42
+ count: z.ZodNumber;
43
+ files: z.ZodArray<z.ZodString>;
44
+ pathsDigest: z.ZodString;
45
+ }, z.core.$strict>;
46
+ export type GateApplicability = z.infer<typeof gateApplicabilitySchema>;
16
47
  /**
17
48
  * Ссылка на доказательство. Само evidence (логи, отчёты) хранит
18
49
  * ExecutionStore; результат несёт digest и SHA, по которым его сверяют.
@@ -25,6 +56,7 @@ export declare const evidenceRefSchema: z.ZodObject<{
25
56
  test: "test";
26
57
  property: "property";
27
58
  consumer: "consumer";
59
+ "not-applicable": "not-applicable";
28
60
  }>;
29
61
  phase: z.ZodEnum<{
30
62
  candidate: "candidate";
@@ -61,6 +93,17 @@ export declare const evidenceRefSchema: z.ZodObject<{
61
93
  }, z.core.$strict>>;
62
94
  }, z.core.$strict>>;
63
95
  }, z.core.$strict>>;
96
+ notApplicable: z.ZodOptional<z.ZodObject<{
97
+ gateDigest: z.ZodString;
98
+ patterns: z.ZodArray<z.ZodString>;
99
+ ranges: z.ZodArray<z.ZodObject<{
100
+ from: z.ZodString;
101
+ to: z.ZodString;
102
+ }, z.core.$strict>>;
103
+ count: z.ZodNumber;
104
+ files: z.ZodArray<z.ZodString>;
105
+ pathsDigest: z.ZodString;
106
+ }, z.core.$strict>>;
64
107
  reviewer: z.ZodOptional<z.ZodObject<{
65
108
  runtime: z.ZodEnum<{
66
109
  codex: "codex";
@@ -241,6 +284,7 @@ export declare const runResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
241
284
  test: "test";
242
285
  property: "property";
243
286
  consumer: "consumer";
287
+ "not-applicable": "not-applicable";
244
288
  }>;
245
289
  phase: z.ZodEnum<{
246
290
  candidate: "candidate";
@@ -277,6 +321,17 @@ export declare const runResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
277
321
  }, z.core.$strict>>;
278
322
  }, z.core.$strict>>;
279
323
  }, z.core.$strict>>;
324
+ notApplicable: z.ZodOptional<z.ZodObject<{
325
+ gateDigest: z.ZodString;
326
+ patterns: z.ZodArray<z.ZodString>;
327
+ ranges: z.ZodArray<z.ZodObject<{
328
+ from: z.ZodString;
329
+ to: z.ZodString;
330
+ }, z.core.$strict>>;
331
+ count: z.ZodNumber;
332
+ files: z.ZodArray<z.ZodString>;
333
+ pathsDigest: z.ZodString;
334
+ }, z.core.$strict>>;
280
335
  reviewer: z.ZodOptional<z.ZodObject<{
281
336
  runtime: z.ZodEnum<{
282
337
  codex: "codex";
@@ -465,6 +520,7 @@ export declare const runResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
465
520
  test: "test";
466
521
  property: "property";
467
522
  consumer: "consumer";
523
+ "not-applicable": "not-applicable";
468
524
  }>;
469
525
  phase: z.ZodEnum<{
470
526
  candidate: "candidate";
@@ -501,6 +557,17 @@ export declare const runResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
501
557
  }, z.core.$strict>>;
502
558
  }, z.core.$strict>>;
503
559
  }, z.core.$strict>>;
560
+ notApplicable: z.ZodOptional<z.ZodObject<{
561
+ gateDigest: z.ZodString;
562
+ patterns: z.ZodArray<z.ZodString>;
563
+ ranges: z.ZodArray<z.ZodObject<{
564
+ from: z.ZodString;
565
+ to: z.ZodString;
566
+ }, z.core.$strict>>;
567
+ count: z.ZodNumber;
568
+ files: z.ZodArray<z.ZodString>;
569
+ pathsDigest: z.ZodString;
570
+ }, z.core.$strict>>;
504
571
  reviewer: z.ZodOptional<z.ZodObject<{
505
572
  runtime: z.ZodEnum<{
506
573
  codex: "codex";
@@ -672,6 +739,7 @@ export declare const resultEnvelopeSchema: z.ZodObject<{
672
739
  test: "test";
673
740
  property: "property";
674
741
  consumer: "consumer";
742
+ "not-applicable": "not-applicable";
675
743
  }>;
676
744
  phase: z.ZodEnum<{
677
745
  candidate: "candidate";
@@ -708,6 +776,17 @@ export declare const resultEnvelopeSchema: z.ZodObject<{
708
776
  }, z.core.$strict>>;
709
777
  }, z.core.$strict>>;
710
778
  }, z.core.$strict>>;
779
+ notApplicable: z.ZodOptional<z.ZodObject<{
780
+ gateDigest: z.ZodString;
781
+ patterns: z.ZodArray<z.ZodString>;
782
+ ranges: z.ZodArray<z.ZodObject<{
783
+ from: z.ZodString;
784
+ to: z.ZodString;
785
+ }, z.core.$strict>>;
786
+ count: z.ZodNumber;
787
+ files: z.ZodArray<z.ZodString>;
788
+ pathsDigest: z.ZodString;
789
+ }, z.core.$strict>>;
711
790
  reviewer: z.ZodOptional<z.ZodObject<{
712
791
  runtime: z.ZodEnum<{
713
792
  codex: "codex";
@@ -896,6 +975,7 @@ export declare const resultEnvelopeSchema: z.ZodObject<{
896
975
  test: "test";
897
976
  property: "property";
898
977
  consumer: "consumer";
978
+ "not-applicable": "not-applicable";
899
979
  }>;
900
980
  phase: z.ZodEnum<{
901
981
  candidate: "candidate";
@@ -932,6 +1012,17 @@ export declare const resultEnvelopeSchema: z.ZodObject<{
932
1012
  }, z.core.$strict>>;
933
1013
  }, z.core.$strict>>;
934
1014
  }, z.core.$strict>>;
1015
+ notApplicable: z.ZodOptional<z.ZodObject<{
1016
+ gateDigest: z.ZodString;
1017
+ patterns: z.ZodArray<z.ZodString>;
1018
+ ranges: z.ZodArray<z.ZodObject<{
1019
+ from: z.ZodString;
1020
+ to: z.ZodString;
1021
+ }, z.core.$strict>>;
1022
+ count: z.ZodNumber;
1023
+ files: z.ZodArray<z.ZodString>;
1024
+ pathsDigest: z.ZodString;
1025
+ }, z.core.$strict>>;
935
1026
  reviewer: z.ZodOptional<z.ZodObject<{
936
1027
  runtime: z.ZodEnum<{
937
1028
  codex: "codex";
@@ -15,13 +15,41 @@ export const findingSchema = z.strictObject({
15
15
  /** Статус находки на момент раунда, в котором она записана. */
16
16
  status: z.enum(['open', 'closed', 'withdrawn']).optional(),
17
17
  });
18
+ /** Пределы сведений о неприменимости gate (`when.paths`). */
19
+ export const gateApplicabilityLimits = {
20
+ /** Шаблонов путей у gate. */
21
+ patterns: 64,
22
+ /** Перечисленных изменённых путей; остальные — числом (`count`) и digest. */
23
+ files: 50,
24
+ /** Изменённых путей, сверх которых diff не разбирается и gate исполняется. */
25
+ changed: 5000,
26
+ };
27
+ /**
28
+ * Почему gate с `when.paths` не исполнялся: настоящий diff фазы (не заявление
29
+ * исполнителя) не задел ни одного его пути и ни одного неявного входа. Это не
30
+ * PASS: запись вида `not-applicable` закрывает только обычный обязательный
31
+ * gate, но не доказательство требования, свойства или testcase.
32
+ * `gateDigest` — digest определения gate (`gateDigest`), под которым принято
33
+ * решение; `ranges` — сравненные пары коммитов, `count` — число изменённых
34
+ * путей, `files` — первые из них, `pathsDigest` — SHA-256 отсортированного
35
+ * полного списка, разделённого NUL.
36
+ */
37
+ export const gateApplicabilitySchema = z.strictObject({
38
+ gateDigest: digestSchema,
39
+ patterns: z.array(z.string().min(1).max(200)).max(gateApplicabilityLimits.patterns),
40
+ ranges: z.array(z.strictObject({ from: gitShaSchema, to: gitShaSchema })).max(4),
41
+ count: z.number().int().min(0).max(gateApplicabilityLimits.changed),
42
+ files: z.array(z.string().min(1).max(1000)).max(gateApplicabilityLimits.files),
43
+ pathsDigest: digestSchema,
44
+ });
18
45
  /**
19
46
  * Ссылка на доказательство. Само evidence (логи, отчёты) хранит
20
47
  * ExecutionStore; результат несёт digest и SHA, по которым его сверяют.
21
48
  */
22
49
  export const evidenceRefSchema = z.strictObject({
23
50
  id: z.string().min(1).max(200),
24
- kind: z.enum(['test', 'check', 'review', 'property', 'consumer']),
51
+ /** `not-applicable` — gate не исполнялся по `when.paths` (`notApplicable`); не PASS. */
52
+ kind: z.enum(['test', 'check', 'review', 'property', 'consumer', 'not-applicable']),
25
53
  phase: z.enum(['candidate', 'integration']),
26
54
  gate: z.string().min(1).max(200),
27
55
  sha: gitShaSchema,
@@ -62,6 +90,8 @@ export const evidenceRefSchema = z.strictObject({
62
90
  .optional(),
63
91
  })
64
92
  .optional(),
93
+ /** Только у записи `not-applicable`: правило и diff, по которым gate не исполнялся. */
94
+ notApplicable: gateApplicabilitySchema.optional(),
65
95
  reviewer: z
66
96
  .strictObject({
67
97
  runtime: runtimeNameSchema,
@@ -471,7 +471,7 @@ export interface HistoryAttempt {
471
471
  evidence: {
472
472
  id: string;
473
473
  runId: string;
474
- kind: 'test' | 'review';
474
+ kind: 'test' | 'review' | 'not-applicable';
475
475
  phase: 'candidate' | 'integration';
476
476
  sha: string;
477
477
  passed: boolean;
@@ -3995,7 +3995,7 @@ export declare class Harness {
3995
3995
  };
3996
3996
  evidence: {
3997
3997
  id: string;
3998
- kind: "check" | "review" | "test" | "property" | "consumer";
3998
+ kind: "check" | "review" | "test" | "property" | "consumer" | "not-applicable";
3999
3999
  phase: "candidate" | "integration";
4000
4000
  gate: string;
4001
4001
  sha: string;
@@ -4021,6 +4021,17 @@ export declare class Harness {
4021
4021
  } | undefined;
4022
4022
  } | undefined;
4023
4023
  } | undefined;
4024
+ notApplicable?: {
4025
+ gateDigest: string;
4026
+ patterns: string[];
4027
+ ranges: {
4028
+ from: string;
4029
+ to: string;
4030
+ }[];
4031
+ count: number;
4032
+ files: string[];
4033
+ pathsDigest: string;
4034
+ } | undefined;
4024
4035
  reviewer?: {
4025
4036
  runtime: "codex" | "claude" | "fixture";
4026
4037
  sameVendor: boolean;
@@ -4136,7 +4147,7 @@ export declare class Harness {
4136
4147
  };
4137
4148
  evidence: {
4138
4149
  id: string;
4139
- kind: "check" | "review" | "test" | "property" | "consumer";
4150
+ kind: "check" | "review" | "test" | "property" | "consumer" | "not-applicable";
4140
4151
  phase: "candidate" | "integration";
4141
4152
  gate: string;
4142
4153
  sha: string;
@@ -4162,6 +4173,17 @@ export declare class Harness {
4162
4173
  } | undefined;
4163
4174
  } | undefined;
4164
4175
  } | undefined;
4176
+ notApplicable?: {
4177
+ gateDigest: string;
4178
+ patterns: string[];
4179
+ ranges: {
4180
+ from: string;
4181
+ to: string;
4182
+ }[];
4183
+ count: number;
4184
+ files: string[];
4185
+ pathsDigest: string;
4186
+ } | undefined;
4165
4187
  reviewer?: {
4166
4188
  runtime: "codex" | "claude" | "fixture";
4167
4189
  sameVendor: boolean;
@@ -221,7 +221,11 @@ export declare class WorkflowQueue {
221
221
  finishedAt?: string | undefined;
222
222
  error?: string | undefined;
223
223
  };
224
- /** Отказ стадии: прерванная — снова в очереди, изменившийся вход — `stale`, иначе `failed`. */
224
+ /**
225
+ * Отказ стадии: прерванная — снова в очереди, изменившийся вход — `stale`,
226
+ * иначе `failed`. Новый статус — событие истории; остановленное задание
227
+ * (`failed`, `stale`) получает время окончания.
228
+ */
225
229
  fail(job: WorkflowJob, message: string, interrupted?: boolean): void;
226
230
  /**
227
231
  * Записать восстановление и выполнить его одной транзакцией. Счётчик и само
@@ -166,6 +166,8 @@ export class WorkflowQueue {
166
166
  next.leaseUntil = this.now() + this.policy.leaseMs;
167
167
  next.attempts = job.attempts + 1;
168
168
  }
169
+ if (next.status !== 'running')
170
+ next.finishedAt = iso(this.now());
169
171
  next.history.push({ at: iso(this.now()), stage: job.stage, event: next.status });
170
172
  tx.putLocal('workflow-jobs', WorkflowQueue.owner(owner), key, next);
171
173
  return next.status === 'running' ? next : undefined;
@@ -232,16 +234,24 @@ export class WorkflowQueue {
232
234
  return next;
233
235
  });
234
236
  }
235
- /** Отказ стадии: прерванная — снова в очереди, изменившийся вход — `stale`, иначе `failed`. */
237
+ /**
238
+ * Отказ стадии: прерванная — снова в очереди, изменившийся вход — `stale`,
239
+ * иначе `failed`. Новый статус — событие истории; остановленное задание
240
+ * (`failed`, `stale`) получает время окончания.
241
+ */
236
242
  fail(job, message, interrupted = false) {
237
243
  this.store.transact('workflow.updated', (tx) => {
238
244
  const current = tx.local('workflow-jobs', WorkflowQueue.owner(job.owner), job.key);
239
245
  if (!current || current.token !== job.token || current.status !== 'running')
240
246
  return;
247
+ const at = iso(this.now());
248
+ const status = !this.current(job, tx) ? 'stale' : interrupted ? 'queued' : 'failed';
241
249
  const next = {
242
250
  ...current,
243
- status: !this.current(job, tx) ? 'stale' : interrupted ? 'queued' : 'failed',
251
+ status,
244
252
  error: message.slice(0, 1000),
253
+ history: [...current.history, { at, stage: current.stage, event: status }],
254
+ ...(status === 'queued' ? {} : { finishedAt: at }),
245
255
  };
246
256
  delete next.token;
247
257
  delete next.leaseUntil;
@@ -274,8 +284,13 @@ export class WorkflowQueue {
274
284
  throw new HarnessError('NOT_READY', 'Повтор задания недоступен; проверьте статус и попытки');
275
285
  if (!this.current(job, tx))
276
286
  throw new HarnessError('APPROVAL_STALE', 'Вход задания изменился: нужно новое задание');
277
- const next = { ...job, status: 'queued' };
287
+ const next = {
288
+ ...job,
289
+ status: 'queued',
290
+ history: [...job.history, { at: iso(this.now()), stage: job.stage, event: 'queued' }],
291
+ };
278
292
  delete next.error;
293
+ delete next.finishedAt;
279
294
  tx.putLocal('workflow-jobs', WorkflowQueue.owner(owner), key, next);
280
295
  return next;
281
296
  });
@@ -1,5 +1,6 @@
1
1
  import { type ReproductionRecord, type AttemptState, type RunEventPayload, type CancelActor, type ContextLimit, type EnvironmentCause, type RetryActor, type JointBudgetReset, type JointResetActor, type Author, type CallRecord, type ContractDocument, type EvidenceRecord, type ExecutionHost, type ExecutionPolicy, type ExecutionTransaction, type ExecutionView, type FailureKind, type GraphState, type InputActor, type InputAnswer, type InputOutcome, type InputRequest, type ContextSnapshot, type JointVerification, type JointVerificationState, type NotPromise, type Prerequisite, type PropertyRecovery, type ReviewRecord, type TechnicalApproval, type TransactionKind, type WorkGraph, type WorkState } from '../contracts/index.ts';
2
2
  import { type BudgetContext, type CallMeta } from './budget.ts';
3
+ import { type ChangedPaths } from '../verification/applicability.ts';
3
4
  /** Префикс причины неудавшегося продления: первая причина не затирается следствиями. */
4
5
  export declare const HEARTBEAT_FAILED = "\u041F\u0440\u043E\u0434\u043B\u0435\u043D\u0438\u0435 \u0432\u043B\u0430\u0434\u0435\u043D\u0438\u044F \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C";
5
6
  export interface EngineOptions {
@@ -494,7 +495,10 @@ export declare class Engine {
494
495
  * Снять паузу — решение человека (семантика DevContour `pause(false)`):
495
496
  * снимает паузу оператора, штатной остановки и отказа runtime вместе с её
496
497
  * классами отказов. Паузу операции reconfigure снимает только сама
497
- * операция: `PAUSED`.
498
+ * операция: `PAUSED`. Это и явный маршрут человека «подтвердить базу и
499
+ * начать»: `resume` снимает ожидания `base-check`. Других путей снять их у
500
+ * движка нет — пока такое ожидание есть, `claim` не выдаёт работу при
501
+ * любом значении `paused`.
498
502
  */
499
503
  resume(): {
500
504
  control: {
@@ -526,7 +530,14 @@ export declare class Engine {
526
530
  };
527
531
  changed: boolean;
528
532
  };
529
- /** Снять паузу отказа после устранения причины: только названные классы. */
533
+ /**
534
+ * Снять паузу отказа после устранения причины: только названные классы.
535
+ * Пока есть ожидание `base-check`, пауза остаётся и переходит в паузу
536
+ * `base-check`: устранённый отказ не подтверждает перенесённую базу (это
537
+ * делает человек через `resume`), а пауза `runtime` без классов отказа
538
+ * звала бы чинить окружение. Новая причина — новая пауза: `pausedAt` —
539
+ * время перехода (как у перехода хоста DevContour).
540
+ */
530
541
  clearFailure(kinds: FailureKind[]): {
531
542
  paused: boolean;
532
543
  pauseReason?: "operator" | "runtime" | "shutdown" | "base-check" | "reconfigure" | undefined;
@@ -695,9 +706,11 @@ export declare class Engine {
695
706
  * поручений: покрытие — по фактическому собственному evidence на принятом
696
707
  * SHA попытки под текущим основанием политики, для любой области. Evidence потребителя — проверка другого
697
708
  * компонента и не в счёт; запись ревью не закрывает одноимённый test gate.
698
- * Решение о приёмке набора поручений — за хостом.
709
+ * Gate с `when`, признанный где-то неприменимым, решается по объединённому
710
+ * diff набора `changes` (`uncoveredGates` проверки). Решение о приёмке набора
711
+ * поручений — за хостом.
699
712
  */
700
- uncoveredGates(workIds: string[]): {
713
+ uncoveredGates(workIds: string[], changes?: Readonly<Record<string, ChangedPaths>>, finalShas?: Readonly<Record<string, string>>): {
701
714
  repositoryId: string;
702
715
  gates: string[];
703
716
  }[];
@@ -745,7 +758,7 @@ export declare class Engine {
745
758
  evidence(id: string, token: string, evidence: Omit<EvidenceRecord, 'id' | 'runId' | 'createdAt'>): {
746
759
  id: string;
747
760
  runId: string;
748
- kind: "review" | "test";
761
+ kind: "review" | "test" | "not-applicable";
749
762
  phase: "candidate" | "integration";
750
763
  sha: string;
751
764
  gate: string;
@@ -901,6 +914,18 @@ export declare class Engine {
901
914
  skippedMore?: number | undefined;
902
915
  } | undefined;
903
916
  checks?: string | undefined;
917
+ gateBasis?: string | undefined;
918
+ notApplicable?: {
919
+ gateDigest: string;
920
+ patterns: string[];
921
+ ranges: {
922
+ from: string;
923
+ to: string;
924
+ }[];
925
+ count: number;
926
+ files: string[];
927
+ pathsDigest: string;
928
+ } | undefined;
904
929
  alreadySatisfied?: {
905
930
  gates: string[];
906
931
  evidence: string;