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
package/docs/upgrade.md CHANGED
@@ -167,6 +167,28 @@ recovery.
167
167
  отказа чтения учётных данных. Подробнее —
168
168
  [заметки выпуска](release-notes/0.1.0-alpha.24.md).
169
169
 
170
+ ### alpha.27: хранилище зависимостей
171
+
172
+ Форматы состояния и публичные поля API прежние; без
173
+ `repositories[].dependencyStore` политика и её digest не меняются. Поле
174
+ необязательно, строгая схема прежних версий его не принимает: при откате
175
+ уберите его из политики. Каталог `dependency-store` в состоянии и таблицу
176
+ `seed_pins` в `resources.sqlite` прежние версии не читают. Подробнее —
177
+ [заметки выпуска](release-notes/0.1.0-alpha.27.md) и
178
+ [хранилище зависимостей](toolchains.md#хранилище-зависимостей).
179
+
180
+ ### alpha.28: артефакты gates
181
+
182
+ Форматы состояния и публичные поля API прежние; без
183
+ `repositories[].gates[].artifacts` политика и её digest не меняются. Поле
184
+ необязательно, строгая схема прежних версий его не принимает: при откате
185
+ уберите его из политики. Новое необязательное поле `artifactFiles` в evidence
186
+ gate и в записи совместной проверки прежние версии не знают: состояние с ним
187
+ читает только эта версия и новее, откат — через копию состояния. Копии
188
+ лежат в каталоге артефактов фазы (`<gate>.artifacts/`) и при откате не нужны.
189
+ Подробнее — [заметки выпуска](release-notes/0.1.0-alpha.28.md) и
190
+ [договоры](contracts.md#executionpolicy).
191
+
170
192
  ## Перед обновлением
171
193
 
172
194
  1. **Остановить записывающих.** Запретить новые выдачи (`harness pause`),
package/lib/cli.js CHANGED
@@ -210,6 +210,7 @@ const options = {
210
210
  basis: { type: 'string' },
211
211
  contracts: { type: 'string' },
212
212
  requirements: { type: 'string', multiple: true },
213
+ 'dry-run': { type: 'boolean' },
213
214
  };
214
215
  /** Новые флаги H1 допустимы только у своих команд; прежние команды их не принимают. */
215
216
  const flagOwners = {
@@ -221,6 +222,7 @@ const flagOwners = {
221
222
  brief: ['plan-request', 'plan-check'],
222
223
  contracts: ['plan-request', 'plan-check'],
223
224
  requirements: ['plan-request'],
225
+ 'dry-run': ['worktree-cleanup'],
224
226
  };
225
227
  /** Явное человеческое представление успешного ответа (`--human`). */
226
228
  const presenters = {
@@ -481,6 +483,17 @@ async function run(argv) {
481
483
  h.close();
482
484
  }
483
485
  }
486
+ case 'worktree-cleanup': {
487
+ const dryRun = !!v['dry-run'];
488
+ const h = open(need('state'), binding(need('state')), dryRun ? 'state' : false);
489
+ try {
490
+ const data = await h.cleanupWorktrees({ dryRun });
491
+ return { command, data, ...(data.failed ? { code: 4 } : {}) };
492
+ }
493
+ finally {
494
+ h.close();
495
+ }
496
+ }
484
497
  case 'profile': {
485
498
  const profile = resolveProfile(need('profile'), {
486
499
  ...(v.repository ? { repository: v.repository } : {}),
@@ -210,6 +210,18 @@ export declare const cliCommands: {
210
210
  }];
211
211
  readonly refusals: ["NOT_FOUND", "REVISION_CONFLICT"];
212
212
  };
213
+ readonly 'worktree-cleanup': {
214
+ readonly description: "Убрать рабочие деревья закончившихся попыток: ветки и достижимые коммиты остаются, неподтверждённые правки сохраняются проверенным патчем в артефактах попытки, игнорируемые файлы не сохраняются и перечисляются в ответе; индекс, который патч не сохранит, — отказ; в сомнении дерево остаётся, а отказ назван; модель не вызывается";
215
+ readonly writes: true;
216
+ readonly idempotency: "Повтор не находит уже убранных деревьев и ничего не меняет";
217
+ readonly args: [CliArgument, {
218
+ readonly name: "--dry-run";
219
+ readonly value: "flag";
220
+ readonly required: false;
221
+ readonly description: "Только показать, что было бы убрано, что исчезнет (игнорируемое) и почему отказано; ничего не пишет";
222
+ }];
223
+ readonly refusals: ["NOT_FOUND", "NOT_READY"];
224
+ };
213
225
  readonly cleanup: {
214
226
  readonly description: "Довести незавершённую очистку закончившейся попытки: повторить teardown по сохранённым receipt окружений и убрать её рабочие деревья; модели, gates и Git-приёмка не вызываются";
215
227
  readonly writes: true;
@@ -486,8 +498,8 @@ export declare const statusDataSchema: z.ZodObject<{
486
498
  gate: "gate";
487
499
  unknown: "unknown";
488
500
  review: "review";
489
- environment: "environment";
490
501
  cancelled: "cancelled";
502
+ environment: "environment";
491
503
  timeout: "timeout";
492
504
  "provider-auth": "provider-auth";
493
505
  "stale-base": "stale-base";
@@ -737,8 +749,8 @@ export declare const eventsDataSchema: z.ZodObject<{
737
749
  gate: "gate";
738
750
  unknown: "unknown";
739
751
  review: "review";
740
- environment: "environment";
741
752
  cancelled: "cancelled";
753
+ environment: "environment";
742
754
  timeout: "timeout";
743
755
  "provider-auth": "provider-auth";
744
756
  "stale-base": "stale-base";
@@ -778,8 +790,8 @@ export declare const eventsDataSchema: z.ZodObject<{
778
790
  gate: "gate";
779
791
  unknown: "unknown";
780
792
  review: "review";
781
- environment: "environment";
782
793
  cancelled: "cancelled";
794
+ environment: "environment";
783
795
  timeout: "timeout";
784
796
  "provider-auth": "provider-auth";
785
797
  "stale-base": "stale-base";
@@ -999,8 +1011,8 @@ export declare const eventsDataSchema: z.ZodObject<{
999
1011
  gate: "gate";
1000
1012
  unknown: "unknown";
1001
1013
  review: "review";
1002
- environment: "environment";
1003
1014
  cancelled: "cancelled";
1015
+ environment: "environment";
1004
1016
  timeout: "timeout";
1005
1017
  "provider-auth": "provider-auth";
1006
1018
  "stale-base": "stale-base";
@@ -1040,8 +1052,8 @@ export declare const eventsDataSchema: z.ZodObject<{
1040
1052
  gate: "gate";
1041
1053
  unknown: "unknown";
1042
1054
  review: "review";
1043
- environment: "environment";
1044
1055
  cancelled: "cancelled";
1056
+ environment: "environment";
1045
1057
  timeout: "timeout";
1046
1058
  "provider-auth": "provider-auth";
1047
1059
  "stale-base": "stale-base";
@@ -1265,8 +1277,8 @@ export declare const controlDataSchema: z.ZodObject<{
1265
1277
  gate: "gate";
1266
1278
  unknown: "unknown";
1267
1279
  review: "review";
1268
- environment: "environment";
1269
1280
  cancelled: "cancelled";
1281
+ environment: "environment";
1270
1282
  timeout: "timeout";
1271
1283
  "provider-auth": "provider-auth";
1272
1284
  "stale-base": "stale-base";
@@ -1457,6 +1469,7 @@ export declare const profileDataSchema: z.ZodObject<{
1457
1469
  type: z.ZodLiteral<"junit">;
1458
1470
  path: z.ZodString;
1459
1471
  }, z.core.$strict>;
1472
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
1460
1473
  id: z.ZodString;
1461
1474
  command: z.ZodArray<z.ZodString>;
1462
1475
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -1472,6 +1485,7 @@ export declare const profileDataSchema: z.ZodObject<{
1472
1485
  type: z.ZodLiteral<"junit">;
1473
1486
  path: z.ZodString;
1474
1487
  }, z.core.$strict>>;
1488
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
1475
1489
  id: z.ZodString;
1476
1490
  command: z.ZodArray<z.ZodString>;
1477
1491
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -1784,6 +1798,62 @@ export declare const cleanupDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1784
1798
  status: z.ZodLiteral<"cleaned">;
1785
1799
  receipts: z.ZodArray<z.ZodString>;
1786
1800
  }, z.core.$strict>], "status">;
1801
+ export declare const worktreeCleanupDataSchema: z.ZodObject<{
1802
+ dryRun: z.ZodBoolean;
1803
+ removed: z.ZodNumber;
1804
+ removable: z.ZodNumber;
1805
+ refused: z.ZodNumber;
1806
+ failed: z.ZodNumber;
1807
+ reclaimedKb: z.ZodNumber;
1808
+ worktrees: z.ZodArray<z.ZodObject<{
1809
+ path: z.ZodString;
1810
+ repositoryId: z.ZodString;
1811
+ attemptId: z.ZodOptional<z.ZodString>;
1812
+ action: z.ZodEnum<{
1813
+ refused: "refused";
1814
+ failed: "failed";
1815
+ removed: "removed";
1816
+ remove: "remove";
1817
+ }>;
1818
+ reason: z.ZodOptional<z.ZodEnum<{
1819
+ "scan-limit": "scan-limit";
1820
+ active: "active";
1821
+ recoverable: "recoverable";
1822
+ "cleanup-pending": "cleanup-pending";
1823
+ "cleanup-unreadable": "cleanup-unreadable";
1824
+ "unknown-attempt": "unknown-attempt";
1825
+ untrusted: "untrusted";
1826
+ "embedded-repository": "embedded-repository";
1827
+ "scan-failed": "scan-failed";
1828
+ "read-only-path": "read-only-path";
1829
+ "undecodable-path": "undecodable-path";
1830
+ "worktree-locked": "worktree-locked";
1831
+ "clean-filter": "clean-filter";
1832
+ "tree-changed": "tree-changed";
1833
+ "ignore-rules-changed": "ignore-rules-changed";
1834
+ "hidden-changes": "hidden-changes";
1835
+ "staged-ignored": "staged-ignored";
1836
+ "staged-differs": "staged-differs";
1837
+ "unreachable-head": "unreachable-head";
1838
+ "patch-unusable": "patch-unusable";
1839
+ "removal-incomplete": "removal-incomplete";
1840
+ "not-registered": "not-registered";
1841
+ }>>;
1842
+ error: z.ZodOptional<z.ZodString>;
1843
+ head: z.ZodOptional<z.ZodString>;
1844
+ sizeKb: z.ZodOptional<z.ZodNumber>;
1845
+ uncommitted: z.ZodOptional<z.ZodNumber>;
1846
+ ignored: z.ZodOptional<z.ZodObject<{
1847
+ count: z.ZodNumber;
1848
+ paths: z.ZodArray<z.ZodString>;
1849
+ }, z.core.$strict>>;
1850
+ record: z.ZodOptional<z.ZodString>;
1851
+ removalStarted: z.ZodOptional<z.ZodBoolean>;
1852
+ registered: z.ZodOptional<z.ZodBoolean>;
1853
+ treePresent: z.ZodOptional<z.ZodBoolean>;
1854
+ patch: z.ZodOptional<z.ZodString>;
1855
+ }, z.core.$strict>>;
1856
+ }, z.core.$strict>;
1787
1857
  /** `init`: план или результат подготовки проекта. */
1788
1858
  export declare const initDataSchema: z.ZodObject<{
1789
1859
  mode: z.ZodEnum<{
@@ -1942,8 +2012,8 @@ export declare const explainDataSchema: z.ZodObject<{
1942
2012
  gate: "gate";
1943
2013
  unknown: "unknown";
1944
2014
  review: "review";
1945
- environment: "environment";
1946
2015
  cancelled: "cancelled";
2016
+ environment: "environment";
1947
2017
  timeout: "timeout";
1948
2018
  "provider-auth": "provider-auth";
1949
2019
  "stale-base": "stale-base";
@@ -2221,8 +2291,8 @@ export declare const cliDataSchemas: {
2221
2291
  gate: "gate";
2222
2292
  unknown: "unknown";
2223
2293
  review: "review";
2224
- environment: "environment";
2225
2294
  cancelled: "cancelled";
2295
+ environment: "environment";
2226
2296
  timeout: "timeout";
2227
2297
  "provider-auth": "provider-auth";
2228
2298
  "stale-base": "stale-base";
@@ -2472,8 +2542,8 @@ export declare const cliDataSchemas: {
2472
2542
  gate: "gate";
2473
2543
  unknown: "unknown";
2474
2544
  review: "review";
2475
- environment: "environment";
2476
2545
  cancelled: "cancelled";
2546
+ environment: "environment";
2477
2547
  timeout: "timeout";
2478
2548
  "provider-auth": "provider-auth";
2479
2549
  "stale-base": "stale-base";
@@ -2513,8 +2583,8 @@ export declare const cliDataSchemas: {
2513
2583
  gate: "gate";
2514
2584
  unknown: "unknown";
2515
2585
  review: "review";
2516
- environment: "environment";
2517
2586
  cancelled: "cancelled";
2587
+ environment: "environment";
2518
2588
  timeout: "timeout";
2519
2589
  "provider-auth": "provider-auth";
2520
2590
  "stale-base": "stale-base";
@@ -2734,8 +2804,8 @@ export declare const cliDataSchemas: {
2734
2804
  gate: "gate";
2735
2805
  unknown: "unknown";
2736
2806
  review: "review";
2737
- environment: "environment";
2738
2807
  cancelled: "cancelled";
2808
+ environment: "environment";
2739
2809
  timeout: "timeout";
2740
2810
  "provider-auth": "provider-auth";
2741
2811
  "stale-base": "stale-base";
@@ -2775,8 +2845,8 @@ export declare const cliDataSchemas: {
2775
2845
  gate: "gate";
2776
2846
  unknown: "unknown";
2777
2847
  review: "review";
2778
- environment: "environment";
2779
2848
  cancelled: "cancelled";
2849
+ environment: "environment";
2780
2850
  timeout: "timeout";
2781
2851
  "provider-auth": "provider-auth";
2782
2852
  "stale-base": "stale-base";
@@ -2912,8 +2982,8 @@ export declare const cliDataSchemas: {
2912
2982
  gate: "gate";
2913
2983
  unknown: "unknown";
2914
2984
  review: "review";
2915
- environment: "environment";
2916
2985
  cancelled: "cancelled";
2986
+ environment: "environment";
2917
2987
  timeout: "timeout";
2918
2988
  "provider-auth": "provider-auth";
2919
2989
  "stale-base": "stale-base";
@@ -2967,8 +3037,8 @@ export declare const cliDataSchemas: {
2967
3037
  gate: "gate";
2968
3038
  unknown: "unknown";
2969
3039
  review: "review";
2970
- environment: "environment";
2971
3040
  cancelled: "cancelled";
3041
+ environment: "environment";
2972
3042
  timeout: "timeout";
2973
3043
  "provider-auth": "provider-auth";
2974
3044
  "stale-base": "stale-base";
@@ -3127,8 +3197,8 @@ export declare const cliDataSchemas: {
3127
3197
  kind: z.ZodEnum<{
3128
3198
  check: "check";
3129
3199
  test: "test";
3130
- property: "property";
3131
3200
  review: "review";
3201
+ property: "property";
3132
3202
  consumer: "consumer";
3133
3203
  }>;
3134
3204
  phase: z.ZodEnum<{
@@ -3349,8 +3419,8 @@ export declare const cliDataSchemas: {
3349
3419
  kind: z.ZodEnum<{
3350
3420
  check: "check";
3351
3421
  test: "test";
3352
- property: "property";
3353
3422
  review: "review";
3423
+ property: "property";
3354
3424
  consumer: "consumer";
3355
3425
  }>;
3356
3426
  phase: z.ZodEnum<{
@@ -3549,8 +3619,8 @@ export declare const cliDataSchemas: {
3549
3619
  kind: z.ZodEnum<{
3550
3620
  check: "check";
3551
3621
  test: "test";
3552
- property: "property";
3553
3622
  review: "review";
3623
+ property: "property";
3554
3624
  consumer: "consumer";
3555
3625
  }>;
3556
3626
  phase: z.ZodEnum<{
@@ -3771,8 +3841,8 @@ export declare const cliDataSchemas: {
3771
3841
  kind: z.ZodEnum<{
3772
3842
  check: "check";
3773
3843
  test: "test";
3774
- property: "property";
3775
3844
  review: "review";
3845
+ property: "property";
3776
3846
  consumer: "consumer";
3777
3847
  }>;
3778
3848
  phase: z.ZodEnum<{
@@ -3888,6 +3958,62 @@ export declare const cliDataSchemas: {
3888
3958
  status: z.ZodLiteral<"cleaned">;
3889
3959
  receipts: z.ZodArray<z.ZodString>;
3890
3960
  }, z.core.$strict>], "status">;
3961
+ readonly 'worktree-cleanup': z.ZodObject<{
3962
+ dryRun: z.ZodBoolean;
3963
+ removed: z.ZodNumber;
3964
+ removable: z.ZodNumber;
3965
+ refused: z.ZodNumber;
3966
+ failed: z.ZodNumber;
3967
+ reclaimedKb: z.ZodNumber;
3968
+ worktrees: z.ZodArray<z.ZodObject<{
3969
+ path: z.ZodString;
3970
+ repositoryId: z.ZodString;
3971
+ attemptId: z.ZodOptional<z.ZodString>;
3972
+ action: z.ZodEnum<{
3973
+ refused: "refused";
3974
+ failed: "failed";
3975
+ removed: "removed";
3976
+ remove: "remove";
3977
+ }>;
3978
+ reason: z.ZodOptional<z.ZodEnum<{
3979
+ "scan-limit": "scan-limit";
3980
+ active: "active";
3981
+ recoverable: "recoverable";
3982
+ "cleanup-pending": "cleanup-pending";
3983
+ "cleanup-unreadable": "cleanup-unreadable";
3984
+ "unknown-attempt": "unknown-attempt";
3985
+ untrusted: "untrusted";
3986
+ "embedded-repository": "embedded-repository";
3987
+ "scan-failed": "scan-failed";
3988
+ "read-only-path": "read-only-path";
3989
+ "undecodable-path": "undecodable-path";
3990
+ "worktree-locked": "worktree-locked";
3991
+ "clean-filter": "clean-filter";
3992
+ "tree-changed": "tree-changed";
3993
+ "ignore-rules-changed": "ignore-rules-changed";
3994
+ "hidden-changes": "hidden-changes";
3995
+ "staged-ignored": "staged-ignored";
3996
+ "staged-differs": "staged-differs";
3997
+ "unreachable-head": "unreachable-head";
3998
+ "patch-unusable": "patch-unusable";
3999
+ "removal-incomplete": "removal-incomplete";
4000
+ "not-registered": "not-registered";
4001
+ }>>;
4002
+ error: z.ZodOptional<z.ZodString>;
4003
+ head: z.ZodOptional<z.ZodString>;
4004
+ sizeKb: z.ZodOptional<z.ZodNumber>;
4005
+ uncommitted: z.ZodOptional<z.ZodNumber>;
4006
+ ignored: z.ZodOptional<z.ZodObject<{
4007
+ count: z.ZodNumber;
4008
+ paths: z.ZodArray<z.ZodString>;
4009
+ }, z.core.$strict>>;
4010
+ record: z.ZodOptional<z.ZodString>;
4011
+ removalStarted: z.ZodOptional<z.ZodBoolean>;
4012
+ registered: z.ZodOptional<z.ZodBoolean>;
4013
+ treePresent: z.ZodOptional<z.ZodBoolean>;
4014
+ patch: z.ZodOptional<z.ZodString>;
4015
+ }, z.core.$strict>>;
4016
+ }, z.core.$strict>;
3891
4017
  readonly profile: z.ZodObject<{
3892
4018
  pin: z.ZodObject<{
3893
4019
  id: z.ZodString;
@@ -3909,6 +4035,7 @@ export declare const cliDataSchemas: {
3909
4035
  type: z.ZodLiteral<"junit">;
3910
4036
  path: z.ZodString;
3911
4037
  }, z.core.$strict>;
4038
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
3912
4039
  id: z.ZodString;
3913
4040
  command: z.ZodArray<z.ZodString>;
3914
4041
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -3924,6 +4051,7 @@ export declare const cliDataSchemas: {
3924
4051
  type: z.ZodLiteral<"junit">;
3925
4052
  path: z.ZodString;
3926
4053
  }, z.core.$strict>>;
4054
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
3927
4055
  id: z.ZodString;
3928
4056
  command: z.ZodArray<z.ZodString>;
3929
4057
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -4287,8 +4415,8 @@ export declare const cliDataSchemas: {
4287
4415
  gate: "gate";
4288
4416
  unknown: "unknown";
4289
4417
  review: "review";
4290
- environment: "environment";
4291
4418
  cancelled: "cancelled";
4419
+ environment: "environment";
4292
4420
  timeout: "timeout";
4293
4421
  "provider-auth": "provider-auth";
4294
4422
  "stale-base": "stale-base";
@@ -250,6 +250,21 @@ export const cliCommands = {
250
250
  ],
251
251
  refusals: ['NOT_FOUND', 'REVISION_CONFLICT'],
252
252
  },
253
+ 'worktree-cleanup': {
254
+ description: 'Убрать рабочие деревья закончившихся попыток: ветки и достижимые коммиты остаются, неподтверждённые правки сохраняются проверенным патчем в артефактах попытки, игнорируемые файлы не сохраняются и перечисляются в ответе; индекс, который патч не сохранит, — отказ; в сомнении дерево остаётся, а отказ назван; модель не вызывается',
255
+ writes: true,
256
+ idempotency: 'Повтор не находит уже убранных деревьев и ничего не меняет',
257
+ args: [
258
+ state,
259
+ {
260
+ name: '--dry-run',
261
+ value: 'flag',
262
+ required: false,
263
+ description: 'Только показать, что было бы убрано, что исчезнет (игнорируемое) и почему отказано; ничего не пишет',
264
+ },
265
+ ],
266
+ refusals: ['NOT_FOUND', 'NOT_READY'],
267
+ },
253
268
  cleanup: {
254
269
  description: 'Довести незавершённую очистку закончившейся попытки: повторить teardown по сохранённым receipt окружений и убрать её рабочие деревья; модели, gates и Git-приёмка не вызываются',
255
270
  writes: true,
@@ -802,6 +817,56 @@ export const cleanupDataSchema = z.discriminatedUnion('status', [
802
817
  /** Очищено: receipts окружений, по которым повторён teardown. */
803
818
  z.strictObject({ status: z.literal('cleaned'), receipts: z.array(z.string()) }),
804
819
  ]);
820
+ export const worktreeCleanupDataSchema = z.strictObject({
821
+ dryRun: z.boolean(),
822
+ removed: z.number().int(),
823
+ removable: z.number().int(),
824
+ refused: z.number().int(),
825
+ failed: z.number().int(),
826
+ reclaimedKb: z.number().int(),
827
+ worktrees: z.array(z.strictObject({
828
+ path: z.string(),
829
+ repositoryId: z.string(),
830
+ attemptId: z.string().optional(),
831
+ action: z.enum(['remove', 'removed', 'refused', 'failed']),
832
+ reason: z
833
+ .enum([
834
+ 'active',
835
+ 'recoverable',
836
+ 'cleanup-pending',
837
+ 'cleanup-unreadable',
838
+ 'unknown-attempt',
839
+ 'untrusted',
840
+ 'embedded-repository',
841
+ 'scan-limit',
842
+ 'scan-failed',
843
+ 'read-only-path',
844
+ 'undecodable-path',
845
+ 'worktree-locked',
846
+ 'clean-filter',
847
+ 'tree-changed',
848
+ 'ignore-rules-changed',
849
+ 'hidden-changes',
850
+ 'staged-ignored',
851
+ 'staged-differs',
852
+ 'unreachable-head',
853
+ 'patch-unusable',
854
+ 'removal-incomplete',
855
+ 'not-registered',
856
+ ])
857
+ .optional(),
858
+ error: z.string().optional(),
859
+ head: z.string().optional(),
860
+ sizeKb: z.number().int().optional(),
861
+ uncommitted: z.number().int().optional(),
862
+ ignored: z.strictObject({ count: z.number().int(), paths: z.array(z.string()) }).optional(),
863
+ record: z.string().optional(),
864
+ removalStarted: z.boolean().optional(),
865
+ registered: z.boolean().optional(),
866
+ treePresent: z.boolean().optional(),
867
+ patch: z.string().optional(),
868
+ })),
869
+ });
805
870
  /** `init`: план или результат подготовки проекта. */
806
871
  export const initDataSchema = z.strictObject({
807
872
  mode: z.enum(['plan', 'apply']),
@@ -851,6 +916,7 @@ export const cliDataSchemas = {
851
916
  result: resultEnvelopeSchema,
852
917
  deliver: resultEnvelopeSchema,
853
918
  cleanup: cleanupDataSchema,
919
+ 'worktree-cleanup': worktreeCleanupDataSchema,
854
920
  profile: profileDataSchema,
855
921
  doctor: doctorDataSchema,
856
922
  init: initDataSchema,
@@ -46,8 +46,8 @@ export declare const stopDiagnosisSchema: z.ZodObject<{
46
46
  gate: "gate";
47
47
  unknown: "unknown";
48
48
  review: "review";
49
- environment: "environment";
50
49
  cancelled: "cancelled";
50
+ environment: "environment";
51
51
  timeout: "timeout";
52
52
  "provider-auth": "provider-auth";
53
53
  "stale-base": "stale-base";
@@ -108,8 +108,8 @@ export declare const eventPayloads: {
108
108
  gate: "gate";
109
109
  unknown: "unknown";
110
110
  review: "review";
111
- environment: "environment";
112
111
  cancelled: "cancelled";
112
+ environment: "environment";
113
113
  timeout: "timeout";
114
114
  "provider-auth": "provider-auth";
115
115
  "stale-base": "stale-base";
@@ -155,8 +155,8 @@ export declare const eventPayloads: {
155
155
  gate: "gate";
156
156
  unknown: "unknown";
157
157
  review: "review";
158
- environment: "environment";
159
158
  cancelled: "cancelled";
159
+ environment: "environment";
160
160
  timeout: "timeout";
161
161
  "provider-auth": "provider-auth";
162
162
  "stale-base": "stale-base";
@@ -415,8 +415,8 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
415
415
  gate: "gate";
416
416
  unknown: "unknown";
417
417
  review: "review";
418
- environment: "environment";
419
418
  cancelled: "cancelled";
419
+ environment: "environment";
420
420
  timeout: "timeout";
421
421
  "provider-auth": "provider-auth";
422
422
  "stale-base": "stale-base";
@@ -456,8 +456,8 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
456
456
  gate: "gate";
457
457
  unknown: "unknown";
458
458
  review: "review";
459
- environment: "environment";
460
459
  cancelled: "cancelled";
460
+ environment: "environment";
461
461
  timeout: "timeout";
462
462
  "provider-auth": "provider-auth";
463
463
  "stale-base": "stale-base";
@@ -677,8 +677,8 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
677
677
  gate: "gate";
678
678
  unknown: "unknown";
679
679
  review: "review";
680
- environment: "environment";
681
680
  cancelled: "cancelled";
681
+ environment: "environment";
682
682
  timeout: "timeout";
683
683
  "provider-auth": "provider-auth";
684
684
  "stale-base": "stale-base";
@@ -718,8 +718,8 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
718
718
  gate: "gate";
719
719
  unknown: "unknown";
720
720
  review: "review";
721
- environment: "environment";
722
721
  cancelled: "cancelled";
722
+ environment: "environment";
723
723
  timeout: "timeout";
724
724
  "provider-auth": "provider-auth";
725
725
  "stale-base": "stale-base";