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
@@ -1035,6 +1035,7 @@ export declare const publishedSchemas: {
1035
1035
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
1036
1036
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
1037
1037
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
1038
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
1038
1039
  REVISION_CONFLICT: "REVISION_CONFLICT";
1039
1040
  CANCELLED: "CANCELLED";
1040
1041
  NOT_FOUND: "NOT_FOUND";
@@ -1438,6 +1439,7 @@ export declare const publishedSchemas: {
1438
1439
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
1439
1440
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
1440
1441
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
1442
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
1441
1443
  REVISION_CONFLICT: "REVISION_CONFLICT";
1442
1444
  CANCELLED: "CANCELLED";
1443
1445
  NOT_FOUND: "NOT_FOUND";
@@ -1651,7 +1653,7 @@ export declare const publishedSchemas: {
1651
1653
  workId: z.ZodOptional<z.ZodString>;
1652
1654
  runId: z.ZodOptional<z.ZodString>;
1653
1655
  attempt: z.ZodOptional<z.ZodNumber>;
1654
- 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">;
1656
+ 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">;
1655
1657
  payload: z.ZodObject<{
1656
1658
  digest: z.ZodString;
1657
1659
  orders: z.ZodNumber;
@@ -1802,6 +1804,7 @@ export declare const publishedSchemas: {
1802
1804
  timeout: "timeout";
1803
1805
  "provider-auth": "provider-auth";
1804
1806
  stalled: "stalled";
1807
+ "context-exhausted": "context-exhausted";
1805
1808
  "stale-base": "stale-base";
1806
1809
  "empty-result": "empty-result";
1807
1810
  unfinished: "unfinished";
@@ -1813,6 +1816,43 @@ export declare const publishedSchemas: {
1813
1816
  }>;
1814
1817
  message: z.ZodString;
1815
1818
  blocked: z.ZodBoolean;
1819
+ }, z.core.$strict> | z.ZodObject<{
1820
+ failureKind: z.ZodEnum<{
1821
+ gate: "gate";
1822
+ unknown: "unknown";
1823
+ review: "review";
1824
+ cancelled: "cancelled";
1825
+ environment: "environment";
1826
+ timeout: "timeout";
1827
+ "provider-auth": "provider-auth";
1828
+ stalled: "stalled";
1829
+ "context-exhausted": "context-exhausted";
1830
+ "stale-base": "stale-base";
1831
+ "empty-result": "empty-result";
1832
+ unfinished: "unfinished";
1833
+ "scope-violation": "scope-violation";
1834
+ "review-protocol": "review-protocol";
1835
+ merge: "merge";
1836
+ budget: "budget";
1837
+ "needs-lead": "needs-lead";
1838
+ }>;
1839
+ cause: z.ZodEnum<{
1840
+ preflight: "preflight";
1841
+ transport: "transport";
1842
+ none: "none";
1843
+ other: "other";
1844
+ "provider-auth": "provider-auth";
1845
+ stalled: "stalled";
1846
+ shutdown: "shutdown";
1847
+ "sandbox-launch": "sandbox-launch";
1848
+ "sandbox-network": "sandbox-network";
1849
+ "sandbox-filesystem": "sandbox-filesystem";
1850
+ "sandbox-policy": "sandbox-policy";
1851
+ "dependency-network": "dependency-network";
1852
+ "provider-limit": "provider-limit";
1853
+ "lease-expired": "lease-expired";
1854
+ }>;
1855
+ counted: z.ZodBoolean;
1816
1856
  }, z.core.$strict> | z.ZodObject<{
1817
1857
  leaseUntil: z.ZodNumber;
1818
1858
  }, z.core.$strict> | z.ZodObject<{
@@ -1824,6 +1864,22 @@ export declare const publishedSchemas: {
1824
1864
  }, z.core.$strict> | z.ZodObject<{
1825
1865
  resultSha: z.ZodString;
1826
1866
  integrationSha: z.ZodString;
1867
+ }, z.core.$strict> | z.ZodObject<{
1868
+ by: z.ZodEnum<{
1869
+ operator: "operator";
1870
+ recovery: "recovery";
1871
+ host: "host";
1872
+ }>;
1873
+ reset: z.ZodBoolean;
1874
+ spent: z.ZodOptional<z.ZodNumber>;
1875
+ reasonLength: z.ZodOptional<z.ZodNumber>;
1876
+ }, z.core.$strict> | z.ZodObject<{
1877
+ by: z.ZodEnum<{
1878
+ operator: "operator";
1879
+ graph: "graph";
1880
+ host: "host";
1881
+ }>;
1882
+ hadAttempt: z.ZodBoolean;
1827
1883
  }, z.core.$strict> | z.ZodObject<{
1828
1884
  code: z.ZodString;
1829
1885
  message: z.ZodString;
@@ -1844,6 +1900,7 @@ export declare const publishedSchemas: {
1844
1900
  timeout: "timeout";
1845
1901
  "provider-auth": "provider-auth";
1846
1902
  stalled: "stalled";
1903
+ "context-exhausted": "context-exhausted";
1847
1904
  "stale-base": "stale-base";
1848
1905
  "empty-result": "empty-result";
1849
1906
  unfinished: "unfinished";
@@ -1863,6 +1920,12 @@ export declare const publishedSchemas: {
1863
1920
  }>;
1864
1921
  }, z.core.$strict> | z.ZodObject<{
1865
1922
  owner: z.ZodString;
1923
+ }, z.core.$strict> | z.ZodObject<{
1924
+ by: z.ZodEnum<{
1925
+ operator: "operator";
1926
+ controller: "controller";
1927
+ host: "host";
1928
+ }>;
1866
1929
  }, z.core.$strict> | z.ZodObject<{
1867
1930
  owner: z.ZodString;
1868
1931
  }, z.core.$strict> | z.ZodObject<{
@@ -2005,7 +2068,7 @@ export declare const publishedSchemas: {
2005
2068
  workId: z.ZodOptional<z.ZodString>;
2006
2069
  runId: z.ZodOptional<z.ZodString>;
2007
2070
  attempt: z.ZodOptional<z.ZodNumber>;
2008
- 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">;
2071
+ 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">;
2009
2072
  payload: z.ZodObject<{
2010
2073
  digest: z.ZodString;
2011
2074
  orders: z.ZodNumber;
@@ -2156,6 +2219,7 @@ export declare const publishedSchemas: {
2156
2219
  timeout: "timeout";
2157
2220
  "provider-auth": "provider-auth";
2158
2221
  stalled: "stalled";
2222
+ "context-exhausted": "context-exhausted";
2159
2223
  "stale-base": "stale-base";
2160
2224
  "empty-result": "empty-result";
2161
2225
  unfinished: "unfinished";
@@ -2167,6 +2231,43 @@ export declare const publishedSchemas: {
2167
2231
  }>;
2168
2232
  message: z.ZodString;
2169
2233
  blocked: z.ZodBoolean;
2234
+ }, z.core.$strict> | z.ZodObject<{
2235
+ failureKind: z.ZodEnum<{
2236
+ gate: "gate";
2237
+ unknown: "unknown";
2238
+ review: "review";
2239
+ cancelled: "cancelled";
2240
+ environment: "environment";
2241
+ timeout: "timeout";
2242
+ "provider-auth": "provider-auth";
2243
+ stalled: "stalled";
2244
+ "context-exhausted": "context-exhausted";
2245
+ "stale-base": "stale-base";
2246
+ "empty-result": "empty-result";
2247
+ unfinished: "unfinished";
2248
+ "scope-violation": "scope-violation";
2249
+ "review-protocol": "review-protocol";
2250
+ merge: "merge";
2251
+ budget: "budget";
2252
+ "needs-lead": "needs-lead";
2253
+ }>;
2254
+ cause: z.ZodEnum<{
2255
+ preflight: "preflight";
2256
+ transport: "transport";
2257
+ none: "none";
2258
+ other: "other";
2259
+ "provider-auth": "provider-auth";
2260
+ stalled: "stalled";
2261
+ shutdown: "shutdown";
2262
+ "sandbox-launch": "sandbox-launch";
2263
+ "sandbox-network": "sandbox-network";
2264
+ "sandbox-filesystem": "sandbox-filesystem";
2265
+ "sandbox-policy": "sandbox-policy";
2266
+ "dependency-network": "dependency-network";
2267
+ "provider-limit": "provider-limit";
2268
+ "lease-expired": "lease-expired";
2269
+ }>;
2270
+ counted: z.ZodBoolean;
2170
2271
  }, z.core.$strict> | z.ZodObject<{
2171
2272
  leaseUntil: z.ZodNumber;
2172
2273
  }, z.core.$strict> | z.ZodObject<{
@@ -2178,6 +2279,22 @@ export declare const publishedSchemas: {
2178
2279
  }, z.core.$strict> | z.ZodObject<{
2179
2280
  resultSha: z.ZodString;
2180
2281
  integrationSha: z.ZodString;
2282
+ }, z.core.$strict> | z.ZodObject<{
2283
+ by: z.ZodEnum<{
2284
+ operator: "operator";
2285
+ recovery: "recovery";
2286
+ host: "host";
2287
+ }>;
2288
+ reset: z.ZodBoolean;
2289
+ spent: z.ZodOptional<z.ZodNumber>;
2290
+ reasonLength: z.ZodOptional<z.ZodNumber>;
2291
+ }, z.core.$strict> | z.ZodObject<{
2292
+ by: z.ZodEnum<{
2293
+ operator: "operator";
2294
+ graph: "graph";
2295
+ host: "host";
2296
+ }>;
2297
+ hadAttempt: z.ZodBoolean;
2181
2298
  }, z.core.$strict> | z.ZodObject<{
2182
2299
  code: z.ZodString;
2183
2300
  message: z.ZodString;
@@ -2198,6 +2315,7 @@ export declare const publishedSchemas: {
2198
2315
  timeout: "timeout";
2199
2316
  "provider-auth": "provider-auth";
2200
2317
  stalled: "stalled";
2318
+ "context-exhausted": "context-exhausted";
2201
2319
  "stale-base": "stale-base";
2202
2320
  "empty-result": "empty-result";
2203
2321
  unfinished: "unfinished";
@@ -2217,6 +2335,12 @@ export declare const publishedSchemas: {
2217
2335
  }>;
2218
2336
  }, z.core.$strict> | z.ZodObject<{
2219
2337
  owner: z.ZodString;
2338
+ }, z.core.$strict> | z.ZodObject<{
2339
+ by: z.ZodEnum<{
2340
+ operator: "operator";
2341
+ controller: "controller";
2342
+ host: "host";
2343
+ }>;
2220
2344
  }, z.core.$strict> | z.ZodObject<{
2221
2345
  owner: z.ZodString;
2222
2346
  }, z.core.$strict> | z.ZodObject<{
@@ -2757,6 +2881,7 @@ export declare const publishedSchemas: {
2757
2881
  timeout: "timeout";
2758
2882
  "provider-auth": "provider-auth";
2759
2883
  stalled: "stalled";
2884
+ "context-exhausted": "context-exhausted";
2760
2885
  "stale-base": "stale-base";
2761
2886
  "empty-result": "empty-result";
2762
2887
  unfinished: "unfinished";
@@ -2974,6 +3099,7 @@ export declare const publishedSchemas: {
2974
3099
  timeout: "timeout";
2975
3100
  "provider-auth": "provider-auth";
2976
3101
  stalled: "stalled";
3102
+ "context-exhausted": "context-exhausted";
2977
3103
  "stale-base": "stale-base";
2978
3104
  "empty-result": "empty-result";
2979
3105
  unfinished: "unfinished";
@@ -2983,6 +3109,10 @@ export declare const publishedSchemas: {
2983
3109
  budget: "budget";
2984
3110
  "needs-lead": "needs-lead";
2985
3111
  }>>;
3112
+ contextLimit: z.ZodOptional<z.ZodEnum<{
3113
+ "prompt-too-long": "prompt-too-long";
3114
+ "blocking-limit": "blocking-limit";
3115
+ }>>;
2986
3116
  failureFingerprint: z.ZodOptional<z.ZodString>;
2987
3117
  requiredGates: z.ZodOptional<z.ZodArray<z.ZodString>>;
2988
3118
  consumers: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -3087,6 +3217,7 @@ export declare const publishedSchemas: {
3087
3217
  timeout: "timeout";
3088
3218
  "provider-auth": "provider-auth";
3089
3219
  stalled: "stalled";
3220
+ "context-exhausted": "context-exhausted";
3090
3221
  "stale-base": "stale-base";
3091
3222
  "empty-result": "empty-result";
3092
3223
  unfinished: "unfinished";
@@ -3655,6 +3786,7 @@ export declare const publishedSchemas: {
3655
3786
  timeout: "timeout";
3656
3787
  "provider-auth": "provider-auth";
3657
3788
  stalled: "stalled";
3789
+ "context-exhausted": "context-exhausted";
3658
3790
  "stale-base": "stale-base";
3659
3791
  "empty-result": "empty-result";
3660
3792
  unfinished: "unfinished";
@@ -3861,6 +3993,7 @@ export declare const publishedSchemas: {
3861
3993
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
3862
3994
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
3863
3995
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
3996
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
3864
3997
  REVISION_CONFLICT: "REVISION_CONFLICT";
3865
3998
  CANCELLED: "CANCELLED";
3866
3999
  NOT_FOUND: "NOT_FOUND";
@@ -3883,6 +4016,7 @@ export declare const publishedSchemas: {
3883
4016
  timeout: "timeout";
3884
4017
  "provider-auth": "provider-auth";
3885
4018
  stalled: "stalled";
4019
+ "context-exhausted": "context-exhausted";
3886
4020
  "stale-base": "stale-base";
3887
4021
  "empty-result": "empty-result";
3888
4022
  unfinished: "unfinished";
@@ -4173,6 +4307,36 @@ export declare const publishedSchemas: {
4173
4307
  retries: z.ZodNullable<z.ZodNumber>;
4174
4308
  resets: z.ZodNullable<z.ZodNumber>;
4175
4309
  baseMoves: z.ZodNullable<z.ZodNumber>;
4310
+ recorded: z.ZodNullable<z.ZodObject<{
4311
+ from: z.ZodISODateTime;
4312
+ bound: z.ZodEnum<{
4313
+ exact: "exact";
4314
+ lower: "lower";
4315
+ }>;
4316
+ retries: z.ZodObject<{
4317
+ operator: z.ZodNumber;
4318
+ recovery: z.ZodNumber;
4319
+ host: z.ZodNumber;
4320
+ }, z.core.$strict>;
4321
+ resets: z.ZodObject<{
4322
+ operator: z.ZodNumber;
4323
+ recovery: z.ZodNumber;
4324
+ host: z.ZodNumber;
4325
+ }, z.core.$strict>;
4326
+ cancellations: z.ZodObject<{
4327
+ operator: z.ZodNumber;
4328
+ graph: z.ZodNumber;
4329
+ host: z.ZodNumber;
4330
+ }, z.core.$strict>;
4331
+ cancelledWithoutAttempt: z.ZodNumber;
4332
+ baseMoves: z.ZodObject<{
4333
+ operator: z.ZodNumber;
4334
+ controller: z.ZodNumber;
4335
+ host: z.ZodNumber;
4336
+ }, z.core.$strict>;
4337
+ baseMovesBound: z.ZodLiteral<"lower">;
4338
+ gaps: z.ZodNumber;
4339
+ }, z.core.$strict>>;
4176
4340
  }, z.core.$strict>;
4177
4341
  approvals: z.ZodObject<{
4178
4342
  operator: z.ZodNumber;
@@ -4204,6 +4368,7 @@ export declare const publishedSchemas: {
4204
4368
  timeout: "timeout";
4205
4369
  "provider-auth": "provider-auth";
4206
4370
  stalled: "stalled";
4371
+ "context-exhausted": "context-exhausted";
4207
4372
  "stale-base": "stale-base";
4208
4373
  "empty-result": "empty-result";
4209
4374
  unfinished: "unfinished";
@@ -4411,7 +4576,34 @@ export declare const publishedSchemas: {
4411
4576
  }, z.core.$strict>;
4412
4577
  setupCheckFailures: z.ZodNumber;
4413
4578
  timeLimit: z.ZodNumber;
4414
- causes: z.ZodNull;
4579
+ causes: z.ZodNullable<z.ZodObject<{
4580
+ rows: z.ZodArray<z.ZodObject<{
4581
+ cause: z.ZodEnum<{
4582
+ preflight: "preflight";
4583
+ transport: "transport";
4584
+ none: "none";
4585
+ other: "other";
4586
+ "provider-auth": "provider-auth";
4587
+ stalled: "stalled";
4588
+ shutdown: "shutdown";
4589
+ "sandbox-launch": "sandbox-launch";
4590
+ "sandbox-network": "sandbox-network";
4591
+ "sandbox-filesystem": "sandbox-filesystem";
4592
+ "sandbox-policy": "sandbox-policy";
4593
+ "dependency-network": "dependency-network";
4594
+ "provider-limit": "provider-limit";
4595
+ "lease-expired": "lease-expired";
4596
+ }>;
4597
+ count: z.ZodNumber;
4598
+ counted: z.ZodNumber;
4599
+ }, z.core.$strict>>;
4600
+ diagnosed: z.ZodNumber;
4601
+ undiagnosed: z.ZodNumber;
4602
+ bound: z.ZodEnum<{
4603
+ exact: "exact";
4604
+ lower: "lower";
4605
+ }>;
4606
+ }, z.core.$strict>>;
4415
4607
  neutral: z.ZodObject<{
4416
4608
  costBound: z.ZodEnum<{
4417
4609
  exact: "exact";
@@ -4559,6 +4751,7 @@ export declare const publishedSchemas: {
4559
4751
  timeout: "timeout";
4560
4752
  "provider-auth": "provider-auth";
4561
4753
  stalled: "stalled";
4754
+ "context-exhausted": "context-exhausted";
4562
4755
  "stale-base": "stale-base";
4563
4756
  "empty-result": "empty-result";
4564
4757
  unfinished: "unfinished";
@@ -4593,6 +4786,7 @@ export declare const publishedSchemas: {
4593
4786
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
4594
4787
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
4595
4788
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
4789
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
4596
4790
  REVISION_CONFLICT: "REVISION_CONFLICT";
4597
4791
  CANCELLED: "CANCELLED";
4598
4792
  NOT_FOUND: "NOT_FOUND";
@@ -4713,6 +4907,7 @@ export declare const publishedSchemas: {
4713
4907
  timeout: "timeout";
4714
4908
  "provider-auth": "provider-auth";
4715
4909
  stalled: "stalled";
4910
+ "context-exhausted": "context-exhausted";
4716
4911
  "stale-base": "stale-base";
4717
4912
  "empty-result": "empty-result";
4718
4913
  unfinished: "unfinished";
@@ -4758,6 +4953,7 @@ export declare const publishedSchemas: {
4758
4953
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
4759
4954
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
4760
4955
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
4956
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
4761
4957
  REVISION_CONFLICT: "REVISION_CONFLICT";
4762
4958
  CANCELLED: "CANCELLED";
4763
4959
  NOT_FOUND: "NOT_FOUND";
@@ -4846,6 +5042,7 @@ export declare const publishedSchemas: {
4846
5042
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
4847
5043
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
4848
5044
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
5045
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
4849
5046
  REVISION_CONFLICT: "REVISION_CONFLICT";
4850
5047
  CANCELLED: "CANCELLED";
4851
5048
  NOT_FOUND: "NOT_FOUND";
@@ -4868,6 +5065,7 @@ export declare const publishedSchemas: {
4868
5065
  timeout: "timeout";
4869
5066
  "provider-auth": "provider-auth";
4870
5067
  stalled: "stalled";
5068
+ "context-exhausted": "context-exhausted";
4871
5069
  "stale-base": "stale-base";
4872
5070
  "empty-result": "empty-result";
4873
5071
  unfinished: "unfinished";
@@ -4969,6 +5167,7 @@ export declare const publishedSchemas: {
4969
5167
  timeout: "timeout";
4970
5168
  "provider-auth": "provider-auth";
4971
5169
  stalled: "stalled";
5170
+ "context-exhausted": "context-exhausted";
4972
5171
  "stale-base": "stale-base";
4973
5172
  "empty-result": "empty-result";
4974
5173
  unfinished: "unfinished";
@@ -5002,6 +5201,7 @@ export declare const publishedSchemas: {
5002
5201
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
5003
5202
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
5004
5203
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
5204
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
5005
5205
  REVISION_CONFLICT: "REVISION_CONFLICT";
5006
5206
  CANCELLED: "CANCELLED";
5007
5207
  NOT_FOUND: "NOT_FOUND";
@@ -5125,6 +5325,7 @@ export declare const publishedSchemas: {
5125
5325
  BUDGET_EXHAUSTED: "BUDGET_EXHAUSTED";
5126
5326
  BUDGET_UNKNOWN: "BUDGET_UNKNOWN";
5127
5327
  ATTEMPTS_EXHAUSTED: "ATTEMPTS_EXHAUSTED";
5328
+ CONTEXT_EXHAUSTED: "CONTEXT_EXHAUSTED";
5128
5329
  REVISION_CONFLICT: "REVISION_CONFLICT";
5129
5330
  CANCELLED: "CANCELLED";
5130
5331
  NOT_FOUND: "NOT_FOUND";
@@ -5147,6 +5348,7 @@ export declare const publishedSchemas: {
5147
5348
  unfinished: z.ZodNumber;
5148
5349
  budgets: z.ZodNumber;
5149
5350
  budgetsWithin: z.ZodNumber;
5351
+ budgetsShared: z.ZodDefault<z.ZodNumber>;
5150
5352
  repairs: z.ZodNumber;
5151
5353
  intentions: z.ZodNumber;
5152
5354
  intentionsDropped: z.ZodNumber;
@@ -1,4 +1,4 @@
1
- import type { FailureKind } from './execution.ts';
1
+ import type { AttemptState, ContextLimit, FailureKind } from './execution.ts';
2
2
  export interface RepairRule {
3
3
  /** `retry` — новая попытка той же задачи; `stop` — звать человека. */
4
4
  action: 'retry' | 'stop';
@@ -36,3 +36,12 @@ export interface RepairRule {
36
36
  */
37
37
  export declare const MAX_NEUTRAL_FAILURES = 3;
38
38
  export declare const repairPolicy: Record<FailureKind, RepairRule>;
39
+ /**
40
+ * Повторы одного отпечатка, разрешённые классу, с учётом предела окна
41
+ * контекста последнего отказа: `prompt-too-long` — уже первая реплика больше
42
+ * окна, повтор только удлинит подсказку отказом прошлой попытки, поэтому
43
+ * повторов нет; `blocking-limit` — повтор по правилу класса.
44
+ */
45
+ export declare function repairRepeats(kind: FailureKind, contextLimit?: ContextLimit): number;
46
+ /** Предел окна контекста последнего завершившегося отказом попытки поручения. */
47
+ export declare const lastContextLimit: (attempts: readonly Pick<AttemptState, "status" | "contextLimit">[]) => "prompt-too-long" | "blocking-limit" | undefined;
@@ -36,6 +36,11 @@ export const repairPolicy = {
36
36
  repeats: 1,
37
37
  explain: 'Процесс попытки жив, но дольше порога не выводил, не расходовал процессор и не менял стадий; обход controller его остановил. Это зависание среды или внешнего ожидания, а не замечание к коду: однократный повтор оправдан, второй такой же отказ — повод чинить среду (сеть, сервис, блокировку) или поднять порог stallSweep осознанно. Снимок процессов и хвост вывода — в событии attempt.liveness.',
38
38
  },
39
+ 'context-exhausted': {
40
+ action: 'retry',
41
+ repeats: 1,
42
+ explain: 'Исполнителю не хватило окна контекста модели внутри попытки (runtime сообщил, что запрос больше окна). Успешное автоматическое сжатие контекста отказом не считается. Когда ход остановлен у предела окна (blocking-limit), однократный повтор оправдан: следующая попытка получает этот отказ в подсказке и может читать меньше. Когда окно превышено уже первым запросом (prompt-too-long), повтора нет: подсказка только вырастет. Второй такой же исход означает, что задача не помещается в попытку: её нужно разделить или сократить контекст (меньше файлов и вывода в подсказке, уже область).',
43
+ },
39
44
  'stale-base': {
40
45
  action: 'stop',
41
46
  repeats: 0,
@@ -97,3 +102,16 @@ export const repairPolicy = {
97
102
  explain: 'Класс отказа не определён. Автоматическое восстановление вслепую дороже и опаснее остановки.',
98
103
  },
99
104
  };
105
+ /**
106
+ * Повторы одного отпечатка, разрешённые классу, с учётом предела окна
107
+ * контекста последнего отказа: `prompt-too-long` — уже первая реплика больше
108
+ * окна, повтор только удлинит подсказку отказом прошлой попытки, поэтому
109
+ * повторов нет; `blocking-limit` — повтор по правилу класса.
110
+ */
111
+ export function repairRepeats(kind, contextLimit) {
112
+ return kind === 'context-exhausted' && contextLimit === 'prompt-too-long'
113
+ ? 0
114
+ : repairPolicy[kind].repeats;
115
+ }
116
+ /** Предел окна контекста последнего завершившегося отказом попытки поручения. */
117
+ export const lastContextLimit = (attempts) => attempts.findLast((a) => a.status === 'failed')?.contextLimit;
@@ -258,6 +258,36 @@ export declare const valueReportSchema: z.ZodObject<{
258
258
  retries: z.ZodNullable<z.ZodNumber>;
259
259
  resets: z.ZodNullable<z.ZodNumber>;
260
260
  baseMoves: z.ZodNullable<z.ZodNumber>;
261
+ recorded: z.ZodNullable<z.ZodObject<{
262
+ from: z.ZodISODateTime;
263
+ bound: z.ZodEnum<{
264
+ exact: "exact";
265
+ lower: "lower";
266
+ }>;
267
+ retries: z.ZodObject<{
268
+ operator: z.ZodNumber;
269
+ recovery: z.ZodNumber;
270
+ host: z.ZodNumber;
271
+ }, z.core.$strict>;
272
+ resets: z.ZodObject<{
273
+ operator: z.ZodNumber;
274
+ recovery: z.ZodNumber;
275
+ host: z.ZodNumber;
276
+ }, z.core.$strict>;
277
+ cancellations: z.ZodObject<{
278
+ operator: z.ZodNumber;
279
+ graph: z.ZodNumber;
280
+ host: z.ZodNumber;
281
+ }, z.core.$strict>;
282
+ cancelledWithoutAttempt: z.ZodNumber;
283
+ baseMoves: z.ZodObject<{
284
+ operator: z.ZodNumber;
285
+ controller: z.ZodNumber;
286
+ host: z.ZodNumber;
287
+ }, z.core.$strict>;
288
+ baseMovesBound: z.ZodLiteral<"lower">;
289
+ gaps: z.ZodNumber;
290
+ }, z.core.$strict>>;
261
291
  }, z.core.$strict>;
262
292
  approvals: z.ZodObject<{
263
293
  operator: z.ZodNumber;
@@ -289,6 +319,7 @@ export declare const valueReportSchema: z.ZodObject<{
289
319
  timeout: "timeout";
290
320
  "provider-auth": "provider-auth";
291
321
  stalled: "stalled";
322
+ "context-exhausted": "context-exhausted";
292
323
  "stale-base": "stale-base";
293
324
  "empty-result": "empty-result";
294
325
  unfinished: "unfinished";
@@ -496,7 +527,34 @@ export declare const valueReportSchema: z.ZodObject<{
496
527
  }, z.core.$strict>;
497
528
  setupCheckFailures: z.ZodNumber;
498
529
  timeLimit: z.ZodNumber;
499
- causes: z.ZodNull;
530
+ causes: z.ZodNullable<z.ZodObject<{
531
+ rows: z.ZodArray<z.ZodObject<{
532
+ cause: z.ZodEnum<{
533
+ preflight: "preflight";
534
+ transport: "transport";
535
+ none: "none";
536
+ other: "other";
537
+ "provider-auth": "provider-auth";
538
+ stalled: "stalled";
539
+ shutdown: "shutdown";
540
+ "sandbox-launch": "sandbox-launch";
541
+ "sandbox-network": "sandbox-network";
542
+ "sandbox-filesystem": "sandbox-filesystem";
543
+ "sandbox-policy": "sandbox-policy";
544
+ "dependency-network": "dependency-network";
545
+ "provider-limit": "provider-limit";
546
+ "lease-expired": "lease-expired";
547
+ }>;
548
+ count: z.ZodNumber;
549
+ counted: z.ZodNumber;
550
+ }, z.core.$strict>>;
551
+ diagnosed: z.ZodNumber;
552
+ undiagnosed: z.ZodNumber;
553
+ bound: z.ZodEnum<{
554
+ exact: "exact";
555
+ lower: "lower";
556
+ }>;
557
+ }, z.core.$strict>>;
500
558
  neutral: z.ZodObject<{
501
559
  costBound: z.ZodEnum<{
502
560
  exact: "exact";
@@ -803,6 +861,36 @@ export declare const reportDataSchema: z.ZodUnion<readonly [z.ZodObject<{
803
861
  retries: z.ZodNullable<z.ZodNumber>;
804
862
  resets: z.ZodNullable<z.ZodNumber>;
805
863
  baseMoves: z.ZodNullable<z.ZodNumber>;
864
+ recorded: z.ZodNullable<z.ZodObject<{
865
+ from: z.ZodISODateTime;
866
+ bound: z.ZodEnum<{
867
+ exact: "exact";
868
+ lower: "lower";
869
+ }>;
870
+ retries: z.ZodObject<{
871
+ operator: z.ZodNumber;
872
+ recovery: z.ZodNumber;
873
+ host: z.ZodNumber;
874
+ }, z.core.$strict>;
875
+ resets: z.ZodObject<{
876
+ operator: z.ZodNumber;
877
+ recovery: z.ZodNumber;
878
+ host: z.ZodNumber;
879
+ }, z.core.$strict>;
880
+ cancellations: z.ZodObject<{
881
+ operator: z.ZodNumber;
882
+ graph: z.ZodNumber;
883
+ host: z.ZodNumber;
884
+ }, z.core.$strict>;
885
+ cancelledWithoutAttempt: z.ZodNumber;
886
+ baseMoves: z.ZodObject<{
887
+ operator: z.ZodNumber;
888
+ controller: z.ZodNumber;
889
+ host: z.ZodNumber;
890
+ }, z.core.$strict>;
891
+ baseMovesBound: z.ZodLiteral<"lower">;
892
+ gaps: z.ZodNumber;
893
+ }, z.core.$strict>>;
806
894
  }, z.core.$strict>;
807
895
  approvals: z.ZodObject<{
808
896
  operator: z.ZodNumber;
@@ -834,6 +922,7 @@ export declare const reportDataSchema: z.ZodUnion<readonly [z.ZodObject<{
834
922
  timeout: "timeout";
835
923
  "provider-auth": "provider-auth";
836
924
  stalled: "stalled";
925
+ "context-exhausted": "context-exhausted";
837
926
  "stale-base": "stale-base";
838
927
  "empty-result": "empty-result";
839
928
  unfinished: "unfinished";
@@ -1041,7 +1130,34 @@ export declare const reportDataSchema: z.ZodUnion<readonly [z.ZodObject<{
1041
1130
  }, z.core.$strict>;
1042
1131
  setupCheckFailures: z.ZodNumber;
1043
1132
  timeLimit: z.ZodNumber;
1044
- causes: z.ZodNull;
1133
+ causes: z.ZodNullable<z.ZodObject<{
1134
+ rows: z.ZodArray<z.ZodObject<{
1135
+ cause: z.ZodEnum<{
1136
+ preflight: "preflight";
1137
+ transport: "transport";
1138
+ none: "none";
1139
+ other: "other";
1140
+ "provider-auth": "provider-auth";
1141
+ stalled: "stalled";
1142
+ shutdown: "shutdown";
1143
+ "sandbox-launch": "sandbox-launch";
1144
+ "sandbox-network": "sandbox-network";
1145
+ "sandbox-filesystem": "sandbox-filesystem";
1146
+ "sandbox-policy": "sandbox-policy";
1147
+ "dependency-network": "dependency-network";
1148
+ "provider-limit": "provider-limit";
1149
+ "lease-expired": "lease-expired";
1150
+ }>;
1151
+ count: z.ZodNumber;
1152
+ counted: z.ZodNumber;
1153
+ }, z.core.$strict>>;
1154
+ diagnosed: z.ZodNumber;
1155
+ undiagnosed: z.ZodNumber;
1156
+ bound: z.ZodEnum<{
1157
+ exact: "exact";
1158
+ lower: "lower";
1159
+ }>;
1160
+ }, z.core.$strict>>;
1045
1161
  neutral: z.ZodObject<{
1046
1162
  costBound: z.ZodEnum<{
1047
1163
  exact: "exact";