devcontour-harness 0.1.0-alpha.31 → 0.1.0-alpha.35

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 (84) hide show
  1. package/README.md +28 -3
  2. package/docs/architecture.md +12 -0
  3. package/docs/compatibility.md +21 -18
  4. package/docs/contracts.md +189 -21
  5. package/docs/release-notes/0.1.0-alpha.32.md +33 -0
  6. package/docs/release-notes/0.1.0-alpha.33.md +29 -0
  7. package/docs/release-notes/0.1.0-alpha.34.md +32 -0
  8. package/docs/release-notes/0.1.0-alpha.35.md +27 -0
  9. package/docs/upgrade.md +172 -0
  10. package/lib/agents/cli-adapter.d.ts +10 -1
  11. package/lib/agents/cli-adapter.js +38 -7
  12. package/lib/agents/usage.d.ts +9 -0
  13. package/lib/agents/usage.js +22 -1
  14. package/lib/cli.js +2 -2
  15. package/lib/contracts/cli.d.ts +344 -6
  16. package/lib/contracts/cli.js +1 -0
  17. package/lib/contracts/diagnosis.d.ts +3 -1
  18. package/lib/contracts/diagnosis.js +1 -0
  19. package/lib/contracts/errors.d.ts +3 -1
  20. package/lib/contracts/errors.js +2 -0
  21. package/lib/contracts/events.d.ts +365 -4
  22. package/lib/contracts/events.js +63 -2
  23. package/lib/contracts/execution.d.ts +32 -1
  24. package/lib/contracts/execution.js +19 -0
  25. package/lib/contracts/failure.d.ts +12 -3
  26. package/lib/contracts/failure.js +10 -2
  27. package/lib/contracts/handoff.d.ts +17 -0
  28. package/lib/contracts/handoff.js +17 -3
  29. package/lib/contracts/planning.d.ts +2 -0
  30. package/lib/contracts/ports.d.ts +10 -2
  31. package/lib/contracts/published.d.ts +205 -3
  32. package/lib/contracts/repair-policy.d.ts +10 -1
  33. package/lib/contracts/repair-policy.js +18 -0
  34. package/lib/contracts/report.d.ts +118 -2
  35. package/lib/contracts/report.js +61 -3
  36. package/lib/contracts/result.d.ts +2 -0
  37. package/lib/control/base-move.d.ts +7 -2
  38. package/lib/control/base-move.js +14 -1
  39. package/lib/control/harness.d.ts +54 -18
  40. package/lib/control/harness.js +8 -96
  41. package/lib/control/recovery.d.ts +1 -1
  42. package/lib/control/status.d.ts +235 -0
  43. package/lib/control/status.js +101 -0
  44. package/lib/engine/budget.d.ts +78 -0
  45. package/lib/engine/budget.js +13 -2
  46. package/lib/engine/classify.d.ts +14 -1
  47. package/lib/engine/classify.js +34 -0
  48. package/lib/engine/engine.d.ts +25 -11
  49. package/lib/engine/engine.js +78 -5
  50. package/lib/engine/failure.d.ts +1 -1
  51. package/lib/engine/failure.js +1 -1
  52. package/lib/engine/prompt.js +11 -1
  53. package/lib/engine/property-recovery.js +2 -0
  54. package/lib/engine/repair.js +4 -2
  55. package/lib/engine/reuse.js +2 -0
  56. package/lib/engine/runner.js +13 -5
  57. package/lib/environment/isolation.d.ts +67 -3
  58. package/lib/environment/isolation.js +148 -5
  59. package/lib/environment/lifecycle.js +1 -1
  60. package/lib/explain/state.d.ts +26 -5
  61. package/lib/explain/state.js +39 -4
  62. package/lib/handoff/index.d.ts +1 -1
  63. package/lib/handoff/markdown.js +4 -2
  64. package/lib/handoff/pack.d.ts +38 -8
  65. package/lib/handoff/pack.js +57 -18
  66. package/lib/index.d.ts +19 -4
  67. package/lib/index.js +19 -3
  68. package/lib/integrations/connector/testing.js +1 -1
  69. package/lib/projections/next.d.ts +3 -1
  70. package/lib/projections/next.js +4 -1
  71. package/lib/projections/stop.d.ts +14 -1
  72. package/lib/projections/stop.js +68 -11
  73. package/lib/report/compute.js +229 -21
  74. package/lib/report/document.js +32 -8
  75. package/lib/storage/document.d.ts +8 -6
  76. package/lib/verification/gates.js +20 -4
  77. package/package.json +1 -1
  78. package/schemas/execution-document.schema.json +11 -0
  79. package/schemas/handoff-pack.schema.json +15 -0
  80. package/schemas/result-envelope.schema.json +1 -0
  81. package/schemas/run-event.schema.json +322 -0
  82. package/schemas/run-result.schema.json +1 -0
  83. package/schemas/stop-diagnosis.schema.json +2 -0
  84. package/schemas/value-report.schema.json +236 -3
@@ -164,6 +164,7 @@ export const cliCommands = {
164
164
  'BUDGET_EXHAUSTED',
165
165
  'BUDGET_UNKNOWN',
166
166
  'ATTEMPTS_EXHAUSTED',
167
+ 'CONTEXT_EXHAUSTED',
167
168
  ],
168
169
  },
169
170
  status: {
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const diagnosisActors: readonly ["controller", "lead", "user"];
3
3
  export declare const diagnosisActions: readonly ["none", "wait", "review-plan", "retry", "diagnose-failure", "reset-attempts", "raise-budget", "replan-dependents", "recovery-decision", "user-decision", "resume-queue", "fix-environment", "fix-access"];
4
- export declare const diagnosisCauses: readonly ["provider-auth", "environment", "timeout", "stalled", "stale-base", "empty-result", "unfinished", "scope-violation", "gate", "review", "review-protocol", "merge", "cancelled", "budget", "needs-lead", "unknown", "runtime-missing", "controller-busy", "operator-pause", "approval-required", "not-ready"];
4
+ export declare const diagnosisCauses: readonly ["provider-auth", "environment", "timeout", "stalled", "context-exhausted", "stale-base", "empty-result", "unfinished", "scope-violation", "gate", "review", "review-protocol", "merge", "cancelled", "budget", "needs-lead", "unknown", "runtime-missing", "controller-busy", "operator-pause", "approval-required", "not-ready"];
5
5
  export declare const diagnosisPhases: readonly ["preflight", "claim", "implementation", "gates", "review", "integration", "delivery"];
6
6
  /** Объяснение остановки: код, причина, фаза, кто действует и что допустимо. */
7
7
  export declare const stopDiagnosisSchema: z.ZodObject<{
@@ -29,6 +29,7 @@ export declare const stopDiagnosisSchema: z.ZodObject<{
29
29
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
30
30
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
31
31
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
32
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
32
33
  REVISION_CONFLICT: "REVISION_CONFLICT";
33
34
  CANCELLED: "CANCELLED";
34
35
  NOT_FOUND: "NOT_FOUND";
@@ -51,6 +52,7 @@ export declare const stopDiagnosisSchema: z.ZodObject<{
51
52
  timeout: "timeout";
52
53
  "provider-auth": "provider-auth";
53
54
  stalled: "stalled";
55
+ "context-exhausted": "context-exhausted";
54
56
  "stale-base": "stale-base";
55
57
  "empty-result": "empty-result";
56
58
  unfinished: "unfinished";
@@ -23,6 +23,7 @@ export const diagnosisCauses = [
23
23
  'environment',
24
24
  'timeout',
25
25
  'stalled',
26
+ 'context-exhausted',
26
27
  'stale-base',
27
28
  'empty-result',
28
29
  'unfinished',
@@ -37,6 +37,8 @@ export declare const errorCodes: {
37
37
  readonly BUDGET_EXHAUSTED: "refused";
38
38
  readonly BUDGET_UNKNOWN: "refused";
39
39
  readonly ATTEMPTS_EXHAUSTED: "refused";
40
+ /** Задача или её контекст не помещаются в окно контекста модели (`context-exhausted`). */
41
+ readonly CONTEXT_EXHAUSTED: "refused";
40
42
  readonly REVISION_CONFLICT: "refused";
41
43
  readonly CANCELLED: "refused";
42
44
  readonly NOT_FOUND: "refused";
@@ -67,7 +69,7 @@ export declare class HarnessError extends Error {
67
69
  readonly class: ErrorClass;
68
70
  constructor(code: ErrorCode, message: string, issues?: ErrorIssue[]);
69
71
  toJSON(): {
70
- code: "INVALID_INPUT" | "UNSUPPORTED_COMMAND" | "UNSUPPORTED_VERSION" | "GRAPH_CYCLE" | "GRAPH_UNKNOWN_DEPENDENCY" | "GRAPH_DUPLICATE_ID" | "GATE_UNKNOWN" | "GATE_GROUP_CYCLE" | "REVIEWER_SAME_VENDOR" | "REVIEWER_MISSING" | "RESPONSE_TOO_LARGE" | "APPROVAL_STALE" | "APPROVAL_REQUIRED" | "LEASE_STALE" | "CONTROLLER_BUSY" | "PAUSED" | "NOT_READY" | "SCOPE_VIOLATION" | "GATE_FAILED" | "REVIEW_REJECTED" | "BUDGET_EXHAUSTED" | "BUDGET_UNKNOWN" | "ATTEMPTS_EXHAUSTED" | "REVISION_CONFLICT" | "CANCELLED" | "NOT_FOUND" | "PATH_CONFLICT" | "STATE_VERSION_UNSUPPORTED" | "RUNTIME_UNAVAILABLE" | "REVIEW_PROTOCOL_INVALID" | "SANDBOX_UNAVAILABLE" | "GIT_FAILED" | "STORAGE_FAILED" | "DELIVERY_FAILED" | "INTERNAL";
72
+ code: "INVALID_INPUT" | "UNSUPPORTED_COMMAND" | "UNSUPPORTED_VERSION" | "GRAPH_CYCLE" | "GRAPH_UNKNOWN_DEPENDENCY" | "GRAPH_DUPLICATE_ID" | "GATE_UNKNOWN" | "GATE_GROUP_CYCLE" | "REVIEWER_SAME_VENDOR" | "REVIEWER_MISSING" | "RESPONSE_TOO_LARGE" | "APPROVAL_STALE" | "APPROVAL_REQUIRED" | "LEASE_STALE" | "CONTROLLER_BUSY" | "PAUSED" | "NOT_READY" | "SCOPE_VIOLATION" | "GATE_FAILED" | "REVIEW_REJECTED" | "BUDGET_EXHAUSTED" | "BUDGET_UNKNOWN" | "ATTEMPTS_EXHAUSTED" | "CONTEXT_EXHAUSTED" | "REVISION_CONFLICT" | "CANCELLED" | "NOT_FOUND" | "PATH_CONFLICT" | "STATE_VERSION_UNSUPPORTED" | "RUNTIME_UNAVAILABLE" | "REVIEW_PROTOCOL_INVALID" | "SANDBOX_UNAVAILABLE" | "GIT_FAILED" | "STORAGE_FAILED" | "DELIVERY_FAILED" | "INTERNAL";
71
73
  class: "input" | "refused" | "infrastructure";
72
74
  message: string;
73
75
  issues: ErrorIssue[];
@@ -36,6 +36,8 @@ export const errorCodes = {
36
36
  BUDGET_EXHAUSTED: 'refused',
37
37
  BUDGET_UNKNOWN: 'refused',
38
38
  ATTEMPTS_EXHAUSTED: 'refused',
39
+ /** Задача или её контекст не помещаются в окно контекста модели (`context-exhausted`). */
40
+ CONTEXT_EXHAUSTED: 'refused',
39
41
  REVISION_CONFLICT: 'refused',
40
42
  CANCELLED: 'refused',
41
43
  NOT_FOUND: 'refused',
@@ -1,4 +1,37 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * Причина отказа окружения (`attempt.diagnosed`): ставится в точке
4
+ * обнаружения (песочница gate, сеть установки зависимостей, провайдер,
5
+ * транспорт), а не разбором текста потом. `none` — отказ не окружения
6
+ * (код, ревью, область); `other` — отказ окружения без известной причины.
7
+ */
8
+ export declare const environmentCauses: readonly ["sandbox-launch", "sandbox-network", "sandbox-filesystem", "sandbox-policy", "dependency-network", "provider-auth", "provider-limit", "transport", "preflight", "lease-expired", "stalled", "shutdown", "other", "none"];
9
+ export declare const environmentCauseSchema: z.ZodEnum<{
10
+ preflight: "preflight";
11
+ transport: "transport";
12
+ none: "none";
13
+ other: "other";
14
+ "provider-auth": "provider-auth";
15
+ stalled: "stalled";
16
+ shutdown: "shutdown";
17
+ "sandbox-launch": "sandbox-launch";
18
+ "sandbox-network": "sandbox-network";
19
+ "sandbox-filesystem": "sandbox-filesystem";
20
+ "sandbox-policy": "sandbox-policy";
21
+ "dependency-network": "dependency-network";
22
+ "provider-limit": "provider-limit";
23
+ "lease-expired": "lease-expired";
24
+ }>;
25
+ export type EnvironmentCause = (typeof environmentCauses)[number];
26
+ /** Кто повторил поручение (`work.retried`): `host` — хост не назвал актёра. */
27
+ export declare const retryActors: readonly ["operator", "recovery", "host"];
28
+ export type RetryActor = (typeof retryActors)[number];
29
+ /** Кто отменил поручение (`work.cancelled`): `graph` — новая редакция графа его убрала. */
30
+ export declare const cancelActors: readonly ["operator", "host", "graph"];
31
+ export type CancelActor = (typeof cancelActors)[number];
32
+ /** Кто сдвинул ref базы (`base.moved`): `host` — хост не назвал актёра. */
33
+ export declare const baseMoveActors: readonly ["operator", "controller", "host"];
34
+ export type BaseMoveActor = (typeof baseMoveActors)[number];
2
35
  /** Предел имени стадии в событии `attempt.stage`. */
3
36
  export declare const STAGE_NAME_LIMIT = 300;
4
37
  /**
@@ -180,6 +213,7 @@ export declare const eventPayloads: {
180
213
  timeout: "timeout";
181
214
  "provider-auth": "provider-auth";
182
215
  stalled: "stalled";
216
+ "context-exhausted": "context-exhausted";
183
217
  "stale-base": "stale-base";
184
218
  "empty-result": "empty-result";
185
219
  unfinished: "unfinished";
@@ -192,6 +226,49 @@ export declare const eventPayloads: {
192
226
  message: z.ZodString;
193
227
  blocked: z.ZodBoolean;
194
228
  }, z.core.$strict>;
229
+ /**
230
+ * Причина отказа попытки: пишется в той же транзакции, что `attempt.failed`
231
+ * (и `attempt.expired`, причина `lease-expired`). `counted` — отказ
232
+ * засчитан в предел попыток поручения. Текста отказа здесь нет.
233
+ */
234
+ readonly 'attempt.diagnosed': z.ZodObject<{
235
+ failureKind: z.ZodEnum<{
236
+ gate: "gate";
237
+ unknown: "unknown";
238
+ review: "review";
239
+ cancelled: "cancelled";
240
+ environment: "environment";
241
+ timeout: "timeout";
242
+ "provider-auth": "provider-auth";
243
+ stalled: "stalled";
244
+ "context-exhausted": "context-exhausted";
245
+ "stale-base": "stale-base";
246
+ "empty-result": "empty-result";
247
+ unfinished: "unfinished";
248
+ "scope-violation": "scope-violation";
249
+ "review-protocol": "review-protocol";
250
+ merge: "merge";
251
+ budget: "budget";
252
+ "needs-lead": "needs-lead";
253
+ }>;
254
+ cause: z.ZodEnum<{
255
+ preflight: "preflight";
256
+ transport: "transport";
257
+ none: "none";
258
+ other: "other";
259
+ "provider-auth": "provider-auth";
260
+ stalled: "stalled";
261
+ shutdown: "shutdown";
262
+ "sandbox-launch": "sandbox-launch";
263
+ "sandbox-network": "sandbox-network";
264
+ "sandbox-filesystem": "sandbox-filesystem";
265
+ "sandbox-policy": "sandbox-policy";
266
+ "dependency-network": "dependency-network";
267
+ "provider-limit": "provider-limit";
268
+ "lease-expired": "lease-expired";
269
+ }>;
270
+ counted: z.ZodBoolean;
271
+ }, z.core.$strict>;
195
272
  readonly 'attempt.expired': z.ZodObject<{
196
273
  leaseUntil: z.ZodNumber;
197
274
  }, z.core.$strict>;
@@ -207,6 +284,34 @@ export declare const eventPayloads: {
207
284
  resultSha: z.ZodString;
208
285
  integrationSha: z.ZodString;
209
286
  }, z.core.$strict>;
287
+ /**
288
+ * Поручение возвращено в очередь повтором (`engine.retry`). `reset` —
289
+ * сброс исчерпанного предела; `spent` — засчитанных попыток до сброса
290
+ * (сброс обнуляет счётчик). Причины сброса нет: только её длина.
291
+ */
292
+ readonly 'work.retried': z.ZodObject<{
293
+ by: z.ZodEnum<{
294
+ operator: "operator";
295
+ recovery: "recovery";
296
+ host: "host";
297
+ }>;
298
+ reset: z.ZodBoolean;
299
+ spent: z.ZodOptional<z.ZodNumber>;
300
+ reasonLength: z.ZodOptional<z.ZodNumber>;
301
+ }, z.core.$strict>;
302
+ /**
303
+ * Поручение отменено (`engine.cancel` или новая редакция графа).
304
+ * `hadAttempt` — отменена и активная попытка (её `attempt.cancelled` — в
305
+ * той же транзакции).
306
+ */
307
+ readonly 'work.cancelled': z.ZodObject<{
308
+ by: z.ZodEnum<{
309
+ operator: "operator";
310
+ graph: "graph";
311
+ host: "host";
312
+ }>;
313
+ hadAttempt: z.ZodBoolean;
314
+ }, z.core.$strict>;
210
315
  readonly 'work.blocked': z.ZodObject<{
211
316
  code: z.ZodString;
212
317
  message: z.ZodString;
@@ -228,6 +333,7 @@ export declare const eventPayloads: {
228
333
  timeout: "timeout";
229
334
  "provider-auth": "provider-auth";
230
335
  stalled: "stalled";
336
+ "context-exhausted": "context-exhausted";
231
337
  "stale-base": "stale-base";
232
338
  "empty-result": "empty-result";
233
339
  unfinished: "unfinished";
@@ -250,6 +356,17 @@ export declare const eventPayloads: {
250
356
  readonly 'controller.acquired': z.ZodObject<{
251
357
  owner: z.ZodString;
252
358
  }, z.core.$strict>;
359
+ /**
360
+ * Ref базы сдвинут (`fencedRefMove`) — в той же транзакции, что проверка
361
+ * владения и `git update-ref`. Одно событие на репозиторий.
362
+ */
363
+ readonly 'base.moved': z.ZodObject<{
364
+ by: z.ZodEnum<{
365
+ operator: "operator";
366
+ controller: "controller";
367
+ host: "host";
368
+ }>;
369
+ }, z.core.$strict>;
253
370
  readonly 'controller.released': z.ZodObject<{
254
371
  owner: z.ZodString;
255
372
  }, z.core.$strict>;
@@ -436,7 +553,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
436
553
  workId: z.ZodOptional<z.ZodString>;
437
554
  runId: z.ZodOptional<z.ZodString>;
438
555
  attempt: z.ZodOptional<z.ZodNumber>;
439
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
556
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
440
557
  payload: z.ZodObject<{
441
558
  digest: z.ZodString;
442
559
  orders: z.ZodNumber;
@@ -587,6 +704,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
587
704
  timeout: "timeout";
588
705
  "provider-auth": "provider-auth";
589
706
  stalled: "stalled";
707
+ "context-exhausted": "context-exhausted";
590
708
  "stale-base": "stale-base";
591
709
  "empty-result": "empty-result";
592
710
  unfinished: "unfinished";
@@ -598,6 +716,43 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
598
716
  }>;
599
717
  message: z.ZodString;
600
718
  blocked: z.ZodBoolean;
719
+ }, z.core.$strict> | z.ZodObject<{
720
+ failureKind: z.ZodEnum<{
721
+ gate: "gate";
722
+ unknown: "unknown";
723
+ review: "review";
724
+ cancelled: "cancelled";
725
+ environment: "environment";
726
+ timeout: "timeout";
727
+ "provider-auth": "provider-auth";
728
+ stalled: "stalled";
729
+ "context-exhausted": "context-exhausted";
730
+ "stale-base": "stale-base";
731
+ "empty-result": "empty-result";
732
+ unfinished: "unfinished";
733
+ "scope-violation": "scope-violation";
734
+ "review-protocol": "review-protocol";
735
+ merge: "merge";
736
+ budget: "budget";
737
+ "needs-lead": "needs-lead";
738
+ }>;
739
+ cause: z.ZodEnum<{
740
+ preflight: "preflight";
741
+ transport: "transport";
742
+ none: "none";
743
+ other: "other";
744
+ "provider-auth": "provider-auth";
745
+ stalled: "stalled";
746
+ shutdown: "shutdown";
747
+ "sandbox-launch": "sandbox-launch";
748
+ "sandbox-network": "sandbox-network";
749
+ "sandbox-filesystem": "sandbox-filesystem";
750
+ "sandbox-policy": "sandbox-policy";
751
+ "dependency-network": "dependency-network";
752
+ "provider-limit": "provider-limit";
753
+ "lease-expired": "lease-expired";
754
+ }>;
755
+ counted: z.ZodBoolean;
601
756
  }, z.core.$strict> | z.ZodObject<{
602
757
  leaseUntil: z.ZodNumber;
603
758
  }, z.core.$strict> | z.ZodObject<{
@@ -609,6 +764,22 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
609
764
  }, z.core.$strict> | z.ZodObject<{
610
765
  resultSha: z.ZodString;
611
766
  integrationSha: z.ZodString;
767
+ }, z.core.$strict> | z.ZodObject<{
768
+ by: z.ZodEnum<{
769
+ operator: "operator";
770
+ recovery: "recovery";
771
+ host: "host";
772
+ }>;
773
+ reset: z.ZodBoolean;
774
+ spent: z.ZodOptional<z.ZodNumber>;
775
+ reasonLength: z.ZodOptional<z.ZodNumber>;
776
+ }, z.core.$strict> | z.ZodObject<{
777
+ by: z.ZodEnum<{
778
+ operator: "operator";
779
+ graph: "graph";
780
+ host: "host";
781
+ }>;
782
+ hadAttempt: z.ZodBoolean;
612
783
  }, z.core.$strict> | z.ZodObject<{
613
784
  code: z.ZodString;
614
785
  message: z.ZodString;
@@ -629,6 +800,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
629
800
  timeout: "timeout";
630
801
  "provider-auth": "provider-auth";
631
802
  stalled: "stalled";
803
+ "context-exhausted": "context-exhausted";
632
804
  "stale-base": "stale-base";
633
805
  "empty-result": "empty-result";
634
806
  unfinished: "unfinished";
@@ -648,6 +820,12 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
648
820
  }>;
649
821
  }, z.core.$strict> | z.ZodObject<{
650
822
  owner: z.ZodString;
823
+ }, z.core.$strict> | z.ZodObject<{
824
+ by: z.ZodEnum<{
825
+ operator: "operator";
826
+ controller: "controller";
827
+ host: "host";
828
+ }>;
651
829
  }, z.core.$strict> | z.ZodObject<{
652
830
  owner: z.ZodString;
653
831
  }, z.core.$strict> | z.ZodObject<{
@@ -790,7 +968,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
790
968
  workId: z.ZodOptional<z.ZodString>;
791
969
  runId: z.ZodOptional<z.ZodString>;
792
970
  attempt: z.ZodOptional<z.ZodNumber>;
793
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
971
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
794
972
  payload: z.ZodObject<{
795
973
  digest: z.ZodString;
796
974
  orders: z.ZodNumber;
@@ -941,6 +1119,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
941
1119
  timeout: "timeout";
942
1120
  "provider-auth": "provider-auth";
943
1121
  stalled: "stalled";
1122
+ "context-exhausted": "context-exhausted";
944
1123
  "stale-base": "stale-base";
945
1124
  "empty-result": "empty-result";
946
1125
  unfinished: "unfinished";
@@ -952,6 +1131,43 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
952
1131
  }>;
953
1132
  message: z.ZodString;
954
1133
  blocked: z.ZodBoolean;
1134
+ }, z.core.$strict> | z.ZodObject<{
1135
+ failureKind: z.ZodEnum<{
1136
+ gate: "gate";
1137
+ unknown: "unknown";
1138
+ review: "review";
1139
+ cancelled: "cancelled";
1140
+ environment: "environment";
1141
+ timeout: "timeout";
1142
+ "provider-auth": "provider-auth";
1143
+ stalled: "stalled";
1144
+ "context-exhausted": "context-exhausted";
1145
+ "stale-base": "stale-base";
1146
+ "empty-result": "empty-result";
1147
+ unfinished: "unfinished";
1148
+ "scope-violation": "scope-violation";
1149
+ "review-protocol": "review-protocol";
1150
+ merge: "merge";
1151
+ budget: "budget";
1152
+ "needs-lead": "needs-lead";
1153
+ }>;
1154
+ cause: z.ZodEnum<{
1155
+ preflight: "preflight";
1156
+ transport: "transport";
1157
+ none: "none";
1158
+ other: "other";
1159
+ "provider-auth": "provider-auth";
1160
+ stalled: "stalled";
1161
+ shutdown: "shutdown";
1162
+ "sandbox-launch": "sandbox-launch";
1163
+ "sandbox-network": "sandbox-network";
1164
+ "sandbox-filesystem": "sandbox-filesystem";
1165
+ "sandbox-policy": "sandbox-policy";
1166
+ "dependency-network": "dependency-network";
1167
+ "provider-limit": "provider-limit";
1168
+ "lease-expired": "lease-expired";
1169
+ }>;
1170
+ counted: z.ZodBoolean;
955
1171
  }, z.core.$strict> | z.ZodObject<{
956
1172
  leaseUntil: z.ZodNumber;
957
1173
  }, z.core.$strict> | z.ZodObject<{
@@ -963,6 +1179,22 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
963
1179
  }, z.core.$strict> | z.ZodObject<{
964
1180
  resultSha: z.ZodString;
965
1181
  integrationSha: z.ZodString;
1182
+ }, z.core.$strict> | z.ZodObject<{
1183
+ by: z.ZodEnum<{
1184
+ operator: "operator";
1185
+ recovery: "recovery";
1186
+ host: "host";
1187
+ }>;
1188
+ reset: z.ZodBoolean;
1189
+ spent: z.ZodOptional<z.ZodNumber>;
1190
+ reasonLength: z.ZodOptional<z.ZodNumber>;
1191
+ }, z.core.$strict> | z.ZodObject<{
1192
+ by: z.ZodEnum<{
1193
+ operator: "operator";
1194
+ graph: "graph";
1195
+ host: "host";
1196
+ }>;
1197
+ hadAttempt: z.ZodBoolean;
966
1198
  }, z.core.$strict> | z.ZodObject<{
967
1199
  code: z.ZodString;
968
1200
  message: z.ZodString;
@@ -983,6 +1215,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
983
1215
  timeout: "timeout";
984
1216
  "provider-auth": "provider-auth";
985
1217
  stalled: "stalled";
1218
+ "context-exhausted": "context-exhausted";
986
1219
  "stale-base": "stale-base";
987
1220
  "empty-result": "empty-result";
988
1221
  unfinished: "unfinished";
@@ -1002,6 +1235,12 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1002
1235
  }>;
1003
1236
  }, z.core.$strict> | z.ZodObject<{
1004
1237
  owner: z.ZodString;
1238
+ }, z.core.$strict> | z.ZodObject<{
1239
+ by: z.ZodEnum<{
1240
+ operator: "operator";
1241
+ controller: "controller";
1242
+ host: "host";
1243
+ }>;
1005
1244
  }, z.core.$strict> | z.ZodObject<{
1006
1245
  owner: z.ZodString;
1007
1246
  }, z.core.$strict> | z.ZodObject<{
@@ -1174,7 +1413,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1174
1413
  workId: z.ZodOptional<z.ZodString>;
1175
1414
  runId: z.ZodOptional<z.ZodString>;
1176
1415
  attempt: z.ZodOptional<z.ZodNumber>;
1177
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1416
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1178
1417
  payload: z.ZodObject<{
1179
1418
  digest: z.ZodString;
1180
1419
  orders: z.ZodNumber;
@@ -1325,6 +1564,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1325
1564
  timeout: "timeout";
1326
1565
  "provider-auth": "provider-auth";
1327
1566
  stalled: "stalled";
1567
+ "context-exhausted": "context-exhausted";
1328
1568
  "stale-base": "stale-base";
1329
1569
  "empty-result": "empty-result";
1330
1570
  unfinished: "unfinished";
@@ -1336,6 +1576,43 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1336
1576
  }>;
1337
1577
  message: z.ZodString;
1338
1578
  blocked: z.ZodBoolean;
1579
+ }, z.core.$strict> | z.ZodObject<{
1580
+ failureKind: z.ZodEnum<{
1581
+ gate: "gate";
1582
+ unknown: "unknown";
1583
+ review: "review";
1584
+ cancelled: "cancelled";
1585
+ environment: "environment";
1586
+ timeout: "timeout";
1587
+ "provider-auth": "provider-auth";
1588
+ stalled: "stalled";
1589
+ "context-exhausted": "context-exhausted";
1590
+ "stale-base": "stale-base";
1591
+ "empty-result": "empty-result";
1592
+ unfinished: "unfinished";
1593
+ "scope-violation": "scope-violation";
1594
+ "review-protocol": "review-protocol";
1595
+ merge: "merge";
1596
+ budget: "budget";
1597
+ "needs-lead": "needs-lead";
1598
+ }>;
1599
+ cause: z.ZodEnum<{
1600
+ preflight: "preflight";
1601
+ transport: "transport";
1602
+ none: "none";
1603
+ other: "other";
1604
+ "provider-auth": "provider-auth";
1605
+ stalled: "stalled";
1606
+ shutdown: "shutdown";
1607
+ "sandbox-launch": "sandbox-launch";
1608
+ "sandbox-network": "sandbox-network";
1609
+ "sandbox-filesystem": "sandbox-filesystem";
1610
+ "sandbox-policy": "sandbox-policy";
1611
+ "dependency-network": "dependency-network";
1612
+ "provider-limit": "provider-limit";
1613
+ "lease-expired": "lease-expired";
1614
+ }>;
1615
+ counted: z.ZodBoolean;
1339
1616
  }, z.core.$strict> | z.ZodObject<{
1340
1617
  leaseUntil: z.ZodNumber;
1341
1618
  }, z.core.$strict> | z.ZodObject<{
@@ -1347,6 +1624,22 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1347
1624
  }, z.core.$strict> | z.ZodObject<{
1348
1625
  resultSha: z.ZodString;
1349
1626
  integrationSha: z.ZodString;
1627
+ }, z.core.$strict> | z.ZodObject<{
1628
+ by: z.ZodEnum<{
1629
+ operator: "operator";
1630
+ recovery: "recovery";
1631
+ host: "host";
1632
+ }>;
1633
+ reset: z.ZodBoolean;
1634
+ spent: z.ZodOptional<z.ZodNumber>;
1635
+ reasonLength: z.ZodOptional<z.ZodNumber>;
1636
+ }, z.core.$strict> | z.ZodObject<{
1637
+ by: z.ZodEnum<{
1638
+ operator: "operator";
1639
+ graph: "graph";
1640
+ host: "host";
1641
+ }>;
1642
+ hadAttempt: z.ZodBoolean;
1350
1643
  }, z.core.$strict> | z.ZodObject<{
1351
1644
  code: z.ZodString;
1352
1645
  message: z.ZodString;
@@ -1367,6 +1660,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1367
1660
  timeout: "timeout";
1368
1661
  "provider-auth": "provider-auth";
1369
1662
  stalled: "stalled";
1663
+ "context-exhausted": "context-exhausted";
1370
1664
  "stale-base": "stale-base";
1371
1665
  "empty-result": "empty-result";
1372
1666
  unfinished: "unfinished";
@@ -1386,6 +1680,12 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1386
1680
  }>;
1387
1681
  }, z.core.$strict> | z.ZodObject<{
1388
1682
  owner: z.ZodString;
1683
+ }, z.core.$strict> | z.ZodObject<{
1684
+ by: z.ZodEnum<{
1685
+ operator: "operator";
1686
+ controller: "controller";
1687
+ host: "host";
1688
+ }>;
1389
1689
  }, z.core.$strict> | z.ZodObject<{
1390
1690
  owner: z.ZodString;
1391
1691
  }, z.core.$strict> | z.ZodObject<{
@@ -1528,7 +1828,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1528
1828
  workId: z.ZodOptional<z.ZodString>;
1529
1829
  runId: z.ZodOptional<z.ZodString>;
1530
1830
  attempt: z.ZodOptional<z.ZodNumber>;
1531
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1831
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1532
1832
  payload: z.ZodObject<{
1533
1833
  digest: z.ZodString;
1534
1834
  orders: z.ZodNumber;
@@ -1679,6 +1979,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1679
1979
  timeout: "timeout";
1680
1980
  "provider-auth": "provider-auth";
1681
1981
  stalled: "stalled";
1982
+ "context-exhausted": "context-exhausted";
1682
1983
  "stale-base": "stale-base";
1683
1984
  "empty-result": "empty-result";
1684
1985
  unfinished: "unfinished";
@@ -1690,6 +1991,43 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1690
1991
  }>;
1691
1992
  message: z.ZodString;
1692
1993
  blocked: z.ZodBoolean;
1994
+ }, z.core.$strict> | z.ZodObject<{
1995
+ failureKind: z.ZodEnum<{
1996
+ gate: "gate";
1997
+ unknown: "unknown";
1998
+ review: "review";
1999
+ cancelled: "cancelled";
2000
+ environment: "environment";
2001
+ timeout: "timeout";
2002
+ "provider-auth": "provider-auth";
2003
+ stalled: "stalled";
2004
+ "context-exhausted": "context-exhausted";
2005
+ "stale-base": "stale-base";
2006
+ "empty-result": "empty-result";
2007
+ unfinished: "unfinished";
2008
+ "scope-violation": "scope-violation";
2009
+ "review-protocol": "review-protocol";
2010
+ merge: "merge";
2011
+ budget: "budget";
2012
+ "needs-lead": "needs-lead";
2013
+ }>;
2014
+ cause: z.ZodEnum<{
2015
+ preflight: "preflight";
2016
+ transport: "transport";
2017
+ none: "none";
2018
+ other: "other";
2019
+ "provider-auth": "provider-auth";
2020
+ stalled: "stalled";
2021
+ shutdown: "shutdown";
2022
+ "sandbox-launch": "sandbox-launch";
2023
+ "sandbox-network": "sandbox-network";
2024
+ "sandbox-filesystem": "sandbox-filesystem";
2025
+ "sandbox-policy": "sandbox-policy";
2026
+ "dependency-network": "dependency-network";
2027
+ "provider-limit": "provider-limit";
2028
+ "lease-expired": "lease-expired";
2029
+ }>;
2030
+ counted: z.ZodBoolean;
1693
2031
  }, z.core.$strict> | z.ZodObject<{
1694
2032
  leaseUntil: z.ZodNumber;
1695
2033
  }, z.core.$strict> | z.ZodObject<{
@@ -1701,6 +2039,22 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1701
2039
  }, z.core.$strict> | z.ZodObject<{
1702
2040
  resultSha: z.ZodString;
1703
2041
  integrationSha: z.ZodString;
2042
+ }, z.core.$strict> | z.ZodObject<{
2043
+ by: z.ZodEnum<{
2044
+ operator: "operator";
2045
+ recovery: "recovery";
2046
+ host: "host";
2047
+ }>;
2048
+ reset: z.ZodBoolean;
2049
+ spent: z.ZodOptional<z.ZodNumber>;
2050
+ reasonLength: z.ZodOptional<z.ZodNumber>;
2051
+ }, z.core.$strict> | z.ZodObject<{
2052
+ by: z.ZodEnum<{
2053
+ operator: "operator";
2054
+ graph: "graph";
2055
+ host: "host";
2056
+ }>;
2057
+ hadAttempt: z.ZodBoolean;
1704
2058
  }, z.core.$strict> | z.ZodObject<{
1705
2059
  code: z.ZodString;
1706
2060
  message: z.ZodString;
@@ -1721,6 +2075,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1721
2075
  timeout: "timeout";
1722
2076
  "provider-auth": "provider-auth";
1723
2077
  stalled: "stalled";
2078
+ "context-exhausted": "context-exhausted";
1724
2079
  "stale-base": "stale-base";
1725
2080
  "empty-result": "empty-result";
1726
2081
  unfinished: "unfinished";
@@ -1740,6 +2095,12 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1740
2095
  }>;
1741
2096
  }, z.core.$strict> | z.ZodObject<{
1742
2097
  owner: z.ZodString;
2098
+ }, z.core.$strict> | z.ZodObject<{
2099
+ by: z.ZodEnum<{
2100
+ operator: "operator";
2101
+ controller: "controller";
2102
+ host: "host";
2103
+ }>;
1743
2104
  }, z.core.$strict> | z.ZodObject<{
1744
2105
  owner: z.ZodString;
1745
2106
  }, z.core.$strict> | z.ZodObject<{