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

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 (116) hide show
  1. package/README.md +16 -2
  2. package/docs/contracts.md +261 -33
  3. package/docs/release-notes/0.1.0-alpha.36.md +26 -0
  4. package/docs/release-notes/0.1.0-alpha.37.md +40 -0
  5. package/docs/standalone.md +20 -0
  6. package/docs/toolchains.md +57 -2
  7. package/docs/upgrade.md +108 -0
  8. package/lib/agents/schemas.d.ts +84 -2
  9. package/lib/agents/schemas.js +49 -1
  10. package/lib/cli.js +149 -1
  11. package/lib/contracts/cli.d.ts +1495 -170
  12. package/lib/contracts/cli.js +232 -2
  13. package/lib/contracts/diagnosis.d.ts +8 -4
  14. package/lib/contracts/diagnosis.js +3 -0
  15. package/lib/contracts/errors.d.ts +7 -1
  16. package/lib/contracts/errors.js +6 -0
  17. package/lib/contracts/events.d.ts +453 -60
  18. package/lib/contracts/events.js +79 -0
  19. package/lib/contracts/execution.d.ts +270 -50
  20. package/lib/contracts/execution.js +41 -0
  21. package/lib/contracts/failure.d.ts +14 -1
  22. package/lib/contracts/failure.js +9 -1
  23. package/lib/contracts/handoff.d.ts +70 -20
  24. package/lib/contracts/handoff.js +42 -1
  25. package/lib/contracts/index.d.ts +1 -0
  26. package/lib/contracts/index.js +1 -0
  27. package/lib/contracts/input-state.d.ts +13 -0
  28. package/lib/contracts/input-state.js +32 -0
  29. package/lib/contracts/input.d.ts +442 -0
  30. package/lib/contracts/input.js +321 -0
  31. package/lib/contracts/planning.d.ts +2 -0
  32. package/lib/contracts/policy.d.ts +17 -2
  33. package/lib/contracts/policy.js +31 -2
  34. package/lib/contracts/ports.d.ts +54 -0
  35. package/lib/contracts/project.d.ts +127 -0
  36. package/lib/contracts/project.js +99 -0
  37. package/lib/contracts/published.d.ts +603 -92
  38. package/lib/contracts/published.js +4 -1
  39. package/lib/contracts/repair-policy.d.ts +20 -0
  40. package/lib/contracts/repair-policy.js +34 -0
  41. package/lib/contracts/report.d.ts +53 -21
  42. package/lib/contracts/report.js +33 -2
  43. package/lib/contracts/result.d.ts +26 -24
  44. package/lib/contracts/review.d.ts +47 -8
  45. package/lib/contracts/review.js +21 -1
  46. package/lib/control/harness.d.ts +2555 -51
  47. package/lib/control/harness.js +112 -6
  48. package/lib/control/recovery.d.ts +2 -2
  49. package/lib/control/report.js +1 -0
  50. package/lib/control/status.d.ts +30 -22
  51. package/lib/control/status.js +11 -1
  52. package/lib/control/workflow.d.ts +8 -8
  53. package/lib/engine/budget.d.ts +86 -3
  54. package/lib/engine/budget.js +45 -10
  55. package/lib/engine/engine.d.ts +3091 -85
  56. package/lib/engine/engine.js +1206 -101
  57. package/lib/engine/input-policy.d.ts +68 -0
  58. package/lib/engine/input-policy.js +285 -0
  59. package/lib/engine/input-requests.d.ts +64 -0
  60. package/lib/engine/input-requests.js +187 -0
  61. package/lib/engine/measured.d.ts +6 -1
  62. package/lib/engine/measured.js +12 -1
  63. package/lib/engine/prompt.d.ts +4 -2
  64. package/lib/engine/prompt.js +3 -1
  65. package/lib/engine/property-recovery.js +2 -0
  66. package/lib/engine/repair.d.ts +2 -0
  67. package/lib/engine/repair.js +10 -3
  68. package/lib/engine/runner.d.ts +33 -4
  69. package/lib/engine/runner.js +266 -23
  70. package/lib/environment/lifecycle.d.ts +8 -0
  71. package/lib/environment/lifecycle.js +15 -2
  72. package/lib/explain/state.d.ts +16 -2
  73. package/lib/explain/state.js +254 -77
  74. package/lib/handoff/markdown.js +10 -0
  75. package/lib/handoff/pack.js +42 -1
  76. package/lib/index.d.ts +10 -0
  77. package/lib/index.js +10 -0
  78. package/lib/init/inspect.d.ts +34 -0
  79. package/lib/init/inspect.js +292 -0
  80. package/lib/init/project.js +14 -31
  81. package/lib/integrations/connector/commands.d.ts +12 -12
  82. package/lib/integrations/connector/config.d.ts +4 -4
  83. package/lib/integrations/connector/delivery.d.ts +1 -1
  84. package/lib/integrations/relay-v2/protocol.d.ts +4 -4
  85. package/lib/profiles/resolve.d.ts +2 -1
  86. package/lib/projections/enums.d.ts +1 -1
  87. package/lib/projections/enums.js +4 -0
  88. package/lib/projections/index.d.ts +1 -0
  89. package/lib/projections/index.js +1 -0
  90. package/lib/projections/input.d.ts +17 -0
  91. package/lib/projections/input.js +28 -0
  92. package/lib/projections/stop.d.ts +40 -1
  93. package/lib/projections/stop.js +87 -4
  94. package/lib/report/compute.d.ts +4 -1
  95. package/lib/report/compute.js +25 -0
  96. package/lib/report/document.js +1 -0
  97. package/lib/storage/document.d.ts +66 -28
  98. package/lib/testing/index.d.ts +1 -1
  99. package/lib/testing/index.js +1 -1
  100. package/lib/testing/store-contract.d.ts +8 -1
  101. package/lib/testing/store-contract.js +194 -1
  102. package/lib/verification/confirm.d.ts +3 -3
  103. package/lib/verification/corpus.d.ts +9 -9
  104. package/lib/verification/gates.d.ts +119 -0
  105. package/lib/verification/gates.js +311 -4
  106. package/package.json +1 -1
  107. package/schemas/execution-document.schema.json +130 -0
  108. package/schemas/execution-policy.schema.json +26 -0
  109. package/schemas/handoff-pack.schema.json +146 -4
  110. package/schemas/input-request.schema.json +665 -0
  111. package/schemas/project-facts.schema.json +393 -0
  112. package/schemas/result-envelope.schema.json +1 -0
  113. package/schemas/run-event.schema.json +625 -0
  114. package/schemas/run-result.schema.json +1 -0
  115. package/schemas/stop-diagnosis.schema.json +5 -1
  116. package/schemas/value-report.schema.json +78 -7
@@ -0,0 +1,442 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Вопрос исполнителя и продолжение после ответа (H02).
4
+ *
5
+ * Writer, не сумевший закончить без решения человека или ведущего, отдаёт
6
+ * вместе с `completed: false` вопрос (`inputRequest`); более мелкие развилки
7
+ * он решает сам и записывает допущением (`assumptions`). Где проходит
8
+ * граница — задаёт `inputPolicy` политики: порог серьёзности, закреплённый в
9
+ * попытке при выдаче, и критические пути. Самооценку модели controller
10
+ * поднимает до потолка (10), когда вопрос касается критической области
11
+ * (`affects`) или попытка изменила критический путь: модель этих минимумов
12
+ * понизить не может.
13
+ *
14
+ * Канонический запрос (`InputRequest`) хранится в локальном пространстве
15
+ * `input-requests` у владельца-репозитория. Вопрос и основание исходной
16
+ * попытки неизменяемы; ответы только дополняются; применение называет
17
+ * точный digest ответа и проверенное основание продолжения (`target`).
18
+ */
19
+ /** Области, вопрос о которых всегда критичен: их меняет только согласование, а не исполнитель. */
20
+ export declare const criticalAreas: readonly ["contract", "acceptance", "product", "api", "migration"];
21
+ export declare const criticalAreaSchema: z.ZodEnum<{
22
+ acceptance: "acceptance";
23
+ contract: "contract";
24
+ product: "product";
25
+ api: "api";
26
+ migration: "migration";
27
+ }>;
28
+ export type CriticalArea = (typeof criticalAreas)[number];
29
+ /** Пределы вопроса и ответа — как у вопросов подготовки DevContour. */
30
+ export declare const INPUT_LIMITS: {
31
+ readonly question: 1500;
32
+ readonly answer: 3000;
33
+ readonly options: 6;
34
+ readonly answers: 20;
35
+ readonly assumptions: 20;
36
+ readonly rationale: 2000;
37
+ };
38
+ /** Потолок серьёзности; порог 11 — полностью автономный режим (исполнитель не останавливается). */
39
+ export declare const INPUT_SEVERITY_MAX = 10;
40
+ export declare const INPUT_AUTONOMOUS = 11;
41
+ export declare const inputOptionSchema: z.ZodObject<{
42
+ id: z.ZodString;
43
+ label: z.ZodString;
44
+ consequence: z.ZodNullable<z.ZodString>;
45
+ }, z.core.$strict>;
46
+ export type InputOption = z.infer<typeof inputOptionSchema>;
47
+ /**
48
+ * Вопрос исполнителя: текст, варианты (до шести), рекомендуемый вариант,
49
+ * самооценка серьёзности по шкале запроса (1 — косметика, обратимо, локально;
50
+ * 10 — меняет требования, договор, модель данных, безопасность или все
51
+ * задачи), основание оценки и затронутые критические области.
52
+ */
53
+ export declare const inputQuestionSchema: z.ZodObject<{
54
+ question: z.ZodString;
55
+ options: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ label: z.ZodString;
58
+ consequence: z.ZodNullable<z.ZodString>;
59
+ }, z.core.$strict>>;
60
+ recommended: z.ZodNullable<z.ZodString>;
61
+ severity: z.ZodNumber;
62
+ rationale: z.ZodString;
63
+ affects: z.ZodArray<z.ZodEnum<{
64
+ acceptance: "acceptance";
65
+ contract: "contract";
66
+ product: "product";
67
+ api: "api";
68
+ migration: "migration";
69
+ }>>;
70
+ }, z.core.$strict>;
71
+ export type InputQuestion = z.infer<typeof inputQuestionSchema>;
72
+ /** Развилка, которую исполнитель решил сам: вопрос, выбор, основание, самооценка, области. */
73
+ export declare const assumptionSchema: z.ZodObject<{
74
+ question: z.ZodString;
75
+ chosen: z.ZodString;
76
+ rationale: z.ZodString;
77
+ severity: z.ZodNumber;
78
+ affects: z.ZodArray<z.ZodEnum<{
79
+ acceptance: "acceptance";
80
+ contract: "contract";
81
+ product: "product";
82
+ api: "api";
83
+ migration: "migration";
84
+ }>>;
85
+ }, z.core.$strict>;
86
+ export type Assumption = z.infer<typeof assumptionSchema>;
87
+ /** Почему серьёзность поднята до потолка: объявленная область или изменённый критический путь. */
88
+ export declare const inputFloors: readonly ["declared", "critical-path"];
89
+ export declare const inputFloorSchema: z.ZodEnum<{
90
+ declared: "declared";
91
+ "critical-path": "critical-path";
92
+ }>;
93
+ export type InputFloor = (typeof inputFloors)[number];
94
+ /** Допущение попытки с оценкой controller: действующая серьёзность и сработавшие минимумы. */
95
+ export declare const recordedAssumptionSchema: z.ZodObject<{
96
+ question: z.ZodString;
97
+ chosen: z.ZodString;
98
+ rationale: z.ZodString;
99
+ severity: z.ZodNumber;
100
+ affects: z.ZodArray<z.ZodEnum<{
101
+ acceptance: "acceptance";
102
+ contract: "contract";
103
+ product: "product";
104
+ api: "api";
105
+ migration: "migration";
106
+ }>>;
107
+ effectiveSeverity: z.ZodNumber;
108
+ floors: z.ZodArray<z.ZodEnum<{
109
+ declared: "declared";
110
+ "critical-path": "critical-path";
111
+ }>>;
112
+ }, z.core.$strict>;
113
+ export type RecordedAssumption = z.infer<typeof recordedAssumptionSchema>;
114
+ /**
115
+ * Политика вопросов исполнителя. `threshold` 1–10: вопрос с действующей
116
+ * серьёзностью не ниже порога останавливает попытку (`needs-input`), ниже —
117
+ * исполнитель решает сам и записывает допущение. 11 — полностью автономный
118
+ * режим: остановок нет, каждое решение — допущение; критические — ещё и
119
+ * неблокирующий запрос ведущему (follow-up), утверждённое не меняется.
120
+ * `criticalPaths` — пути (как `writeScope`: каталог или файл), изменение
121
+ * которых делает вопрос и допущение попытки критическими.
122
+ *
123
+ * Политика закрепляется в попытке при выдаче: новое значение действует со
124
+ * следующей попытки. В `executionDigest` она не входит — смена порога не
125
+ * требует нового согласования графа и не меняет основания reuse.
126
+ */
127
+ export declare const inputPolicySchema: z.ZodObject<{
128
+ threshold: z.ZodDefault<z.ZodNumber>;
129
+ criticalPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
130
+ }, z.core.$strict>;
131
+ export type InputPolicy = z.infer<typeof inputPolicySchema>;
132
+ export declare const DEFAULT_INPUT_POLICY: InputPolicy;
133
+ /** Кто ответил или закрыл запрос: оператор, ведущий агент или хост от их имени. */
134
+ export declare const inputActorSchema: z.ZodObject<{
135
+ kind: z.ZodEnum<{
136
+ operator: "operator";
137
+ lead: "lead";
138
+ host: "host";
139
+ }>;
140
+ id: z.ZodOptional<z.ZodString>;
141
+ }, z.core.$strict>;
142
+ export type InputActor = z.infer<typeof inputActorSchema>;
143
+ /**
144
+ * Ответ — неизменяемая запись. `kind`: `clarification` — уточнение той же
145
+ * работы (продолжение через `applyInput`), `requirement-change` — изменение
146
+ * требований (обычная ревизия и `supersede`, не продолжение). `messageRef` —
147
+ * непрозрачная ссылка хоста на сообщение обсуждения. `digest` —
148
+ * `answerDigest(requestId, answer)`.
149
+ */
150
+ export declare const inputAnswerSchema: z.ZodObject<{
151
+ revision: z.ZodNumber;
152
+ text: z.ZodString;
153
+ optionId: z.ZodNullable<z.ZodString>;
154
+ kind: z.ZodEnum<{
155
+ clarification: "clarification";
156
+ "requirement-change": "requirement-change";
157
+ }>;
158
+ actor: z.ZodObject<{
159
+ kind: z.ZodEnum<{
160
+ operator: "operator";
161
+ lead: "lead";
162
+ host: "host";
163
+ }>;
164
+ id: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strict>;
166
+ messageRef: z.ZodOptional<z.ZodString>;
167
+ digest: z.ZodString;
168
+ at: z.ZodISODateTime;
169
+ }, z.core.$strict>;
170
+ export type InputAnswer = z.infer<typeof inputAnswerSchema>;
171
+ /** Digest ответа: запрос, номер версии и содержание (без времени). */
172
+ export declare const answerDigest: (requestId: string, answer: Pick<InputAnswer, "revision" | "text" | "optionId" | "kind">) => string;
173
+ /**
174
+ * Основание исходной попытки: откуда вопрос. Неизменяемо. `inputPolicy` —
175
+ * закреплённая в попытке политика, по которой вопрос стал остановкой.
176
+ */
177
+ export declare const inputOriginSchema: z.ZodObject<{
178
+ source: z.ZodObject<{
179
+ connector: z.ZodString;
180
+ ref: z.ZodString;
181
+ revision: z.ZodString;
182
+ }, z.core.$strict>;
183
+ graphId: z.ZodString;
184
+ graphDigest: z.ZodString;
185
+ orderDigest: z.ZodString;
186
+ policyDigest: z.ZodString;
187
+ contextDigest: z.ZodNullable<z.ZodString>;
188
+ baseSha: z.ZodNullable<z.ZodString>;
189
+ inputPolicy: z.ZodObject<{
190
+ threshold: z.ZodDefault<z.ZodNumber>;
191
+ criticalPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
192
+ }, z.core.$strict>;
193
+ contentDigest: z.ZodOptional<z.ZodString>;
194
+ }, z.core.$strict>;
195
+ export type InputOrigin = z.infer<typeof inputOriginSchema>;
196
+ /**
197
+ * Основание продолжения, которое активирует `applyInput`: тот же граф и
198
+ * постановка, проверенный снимок контекста с ответом, раунд ревью плана и
199
+ * актёр согласования. `digest` — `targetDigest(target)`.
200
+ */
201
+ export declare const inputTargetSchema: z.ZodObject<{
202
+ originDigest: z.ZodString;
203
+ answerDigest: z.ZodString;
204
+ graphDigest: z.ZodString;
205
+ orderDigest: z.ZodString;
206
+ contentDigest: z.ZodOptional<z.ZodString>;
207
+ policyDigest: z.ZodString;
208
+ contextDigest: z.ZodNullable<z.ZodString>;
209
+ review: z.ZodNullable<z.ZodObject<{
210
+ round: z.ZodNumber;
211
+ approved: z.ZodBoolean;
212
+ reviewerBinding: z.ZodNullable<z.ZodString>;
213
+ }, z.core.$strict>>;
214
+ actor: z.ZodEnum<{
215
+ operator: "operator";
216
+ agent: "agent";
217
+ }>;
218
+ digest: z.ZodString;
219
+ }, z.core.$strict>;
220
+ export type InputTarget = z.infer<typeof inputTargetSchema>;
221
+ export declare const targetDigest: (target: Omit<InputTarget, "digest">) => string;
222
+ export declare const inputLifecycles: readonly ["pending", "answered", "applied", "cancelled", "superseded"];
223
+ export type InputLifecycle = (typeof inputLifecycles)[number];
224
+ /**
225
+ * Состояние вопроса для проекций и отчёта (`contracts/input-state.ts`
226
+ * повторяет перечень без zod; тест сверяет оба): ждёт ответа, ответ не
227
+ * применён, применён и ждёт вызова, передан исполнителю, перенесённый ответ
228
+ * устарел до выдачи.
229
+ */
230
+ export declare const inputStateNames: readonly ["awaiting-answer", "answered-not-applied", "applied-awaiting-claim", "delivered", "carry-stale"];
231
+ export declare const inputRequestSchema: z.ZodObject<{
232
+ id: z.ZodString;
233
+ kind: z.ZodEnum<{
234
+ question: "question";
235
+ "follow-up": "follow-up";
236
+ }>;
237
+ blocking: z.ZodBoolean;
238
+ workId: z.ZodString;
239
+ graphId: z.ZodString;
240
+ runId: z.ZodString;
241
+ attempt: z.ZodNumber;
242
+ callId: z.ZodNullable<z.ZodString>;
243
+ question: z.ZodObject<{
244
+ question: z.ZodString;
245
+ options: z.ZodArray<z.ZodObject<{
246
+ id: z.ZodString;
247
+ label: z.ZodString;
248
+ consequence: z.ZodNullable<z.ZodString>;
249
+ }, z.core.$strict>>;
250
+ recommended: z.ZodNullable<z.ZodString>;
251
+ severity: z.ZodNumber;
252
+ rationale: z.ZodString;
253
+ affects: z.ZodArray<z.ZodEnum<{
254
+ acceptance: "acceptance";
255
+ contract: "contract";
256
+ product: "product";
257
+ api: "api";
258
+ migration: "migration";
259
+ }>>;
260
+ }, z.core.$strict>;
261
+ effectiveSeverity: z.ZodNumber;
262
+ floors: z.ZodArray<z.ZodEnum<{
263
+ declared: "declared";
264
+ "critical-path": "critical-path";
265
+ }>>;
266
+ criticalHits: z.ZodArray<z.ZodString>;
267
+ draft: z.ZodNullable<z.ZodObject<{
268
+ digest: z.ZodString;
269
+ files: z.ZodArray<z.ZodString>;
270
+ }, z.core.$strict>>;
271
+ createdAt: z.ZodISODateTime;
272
+ originBasis: z.ZodObject<{
273
+ source: z.ZodObject<{
274
+ connector: z.ZodString;
275
+ ref: z.ZodString;
276
+ revision: z.ZodString;
277
+ }, z.core.$strict>;
278
+ graphId: z.ZodString;
279
+ graphDigest: z.ZodString;
280
+ orderDigest: z.ZodString;
281
+ policyDigest: z.ZodString;
282
+ contextDigest: z.ZodNullable<z.ZodString>;
283
+ baseSha: z.ZodNullable<z.ZodString>;
284
+ inputPolicy: z.ZodObject<{
285
+ threshold: z.ZodDefault<z.ZodNumber>;
286
+ criticalPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
287
+ }, z.core.$strict>;
288
+ contentDigest: z.ZodOptional<z.ZodString>;
289
+ }, z.core.$strict>;
290
+ lifecycle: z.ZodEnum<{
291
+ pending: "pending";
292
+ answered: "answered";
293
+ applied: "applied";
294
+ cancelled: "cancelled";
295
+ superseded: "superseded";
296
+ }>;
297
+ answers: z.ZodArray<z.ZodObject<{
298
+ revision: z.ZodNumber;
299
+ text: z.ZodString;
300
+ optionId: z.ZodNullable<z.ZodString>;
301
+ kind: z.ZodEnum<{
302
+ clarification: "clarification";
303
+ "requirement-change": "requirement-change";
304
+ }>;
305
+ actor: z.ZodObject<{
306
+ kind: z.ZodEnum<{
307
+ operator: "operator";
308
+ lead: "lead";
309
+ host: "host";
310
+ }>;
311
+ id: z.ZodOptional<z.ZodString>;
312
+ }, z.core.$strict>;
313
+ messageRef: z.ZodOptional<z.ZodString>;
314
+ digest: z.ZodString;
315
+ at: z.ZodISODateTime;
316
+ }, z.core.$strict>>;
317
+ target: z.ZodOptional<z.ZodObject<{
318
+ originDigest: z.ZodString;
319
+ answerDigest: z.ZodString;
320
+ graphDigest: z.ZodString;
321
+ orderDigest: z.ZodString;
322
+ contentDigest: z.ZodOptional<z.ZodString>;
323
+ policyDigest: z.ZodString;
324
+ contextDigest: z.ZodNullable<z.ZodString>;
325
+ review: z.ZodNullable<z.ZodObject<{
326
+ round: z.ZodNumber;
327
+ approved: z.ZodBoolean;
328
+ reviewerBinding: z.ZodNullable<z.ZodString>;
329
+ }, z.core.$strict>>;
330
+ actor: z.ZodEnum<{
331
+ operator: "operator";
332
+ agent: "agent";
333
+ }>;
334
+ digest: z.ZodString;
335
+ }, z.core.$strict>>;
336
+ delivered: z.ZodOptional<z.ZodObject<{
337
+ runId: z.ZodString;
338
+ callId: z.ZodString;
339
+ at: z.ZodISODateTime;
340
+ }, z.core.$strict>>;
341
+ closed: z.ZodOptional<z.ZodObject<{
342
+ at: z.ZodISODateTime;
343
+ by: z.ZodEnum<{
344
+ operator: "operator";
345
+ lead: "lead";
346
+ host: "host";
347
+ controller: "controller";
348
+ }>;
349
+ reason: z.ZodString;
350
+ successor: z.ZodOptional<z.ZodString>;
351
+ carry: z.ZodOptional<z.ZodBoolean>;
352
+ previous: z.ZodOptional<z.ZodObject<{
353
+ at: z.ZodISODateTime;
354
+ by: z.ZodEnum<{
355
+ operator: "operator";
356
+ lead: "lead";
357
+ host: "host";
358
+ controller: "controller";
359
+ }>;
360
+ reason: z.ZodString;
361
+ successor: z.ZodOptional<z.ZodString>;
362
+ carry: z.ZodOptional<z.ZodBoolean>;
363
+ }, z.core.$strict>>;
364
+ }, z.core.$strict>>;
365
+ stale: z.ZodOptional<z.ZodObject<{
366
+ targetDigest: z.ZodString;
367
+ reason: z.ZodEnum<{
368
+ context: "context";
369
+ graph: "graph";
370
+ order: "order";
371
+ policy: "policy";
372
+ }>;
373
+ at: z.ZodISODateTime;
374
+ }, z.core.$strict>>;
375
+ normalized: z.ZodOptional<z.ZodArray<z.ZodString>>;
376
+ version: z.ZodNumber;
377
+ }, z.core.$strict>;
378
+ export type InputRequest = z.infer<typeof inputRequestSchema>;
379
+ /** Вопрос или допущение с оценкой controller. */
380
+ export interface RatedInput {
381
+ question: InputQuestion;
382
+ effectiveSeverity: number;
383
+ floors: InputFloor[];
384
+ }
385
+ /**
386
+ * Что ответ writer оставил движку вместе с исходом попытки: вопрос
387
+ * (`question` — остановка `needs-input`, `declined` — вопрос ниже порога у
388
+ * незавершённой попытки), допущения с оценкой, неблокирующие запросы ведущему
389
+ * (автономный режим), изменённые критические пути и вызов, в ответе которого
390
+ * всё это пришло. Только память процесса: сохраняется движком в
391
+ * `input-requests` и `AttemptState.assumptions`.
392
+ */
393
+ export interface InputOutcome {
394
+ question?: RatedInput & {
395
+ mode: 'request' | 'declined';
396
+ };
397
+ assumptions: RecordedAssumption[];
398
+ followUps: RatedInput[];
399
+ criticalHits: string[];
400
+ callId: string | null;
401
+ /** Ответ был вне схемы: что controller исправил, чтобы не потерять вопрос. */
402
+ normalized?: string[];
403
+ }
404
+ /** Запрос держит работу: вопрос, ещё не применённый и не закрытый. */
405
+ export declare const blocksWork: (r: Pick<InputRequest, "blocking" | "lifecycle"> & Partial<Pick<InputRequest, "stale" | "target">>) => boolean;
406
+ /** Ответ запроса связан с основанием выдачи: применённый или перенесённый. */
407
+ export declare const linksAnswer: (r: Pick<InputRequest, "kind" | "lifecycle" | "target">) => boolean;
408
+ /** Последний ответ запроса. */
409
+ export declare const latestAnswer: (r: Pick<InputRequest, "answers">) => {
410
+ revision: number;
411
+ text: string;
412
+ optionId: string | null;
413
+ kind: "clarification" | "requirement-change";
414
+ actor: {
415
+ kind: "operator" | "lead" | "host";
416
+ id?: string | undefined;
417
+ };
418
+ digest: string;
419
+ at: string;
420
+ messageRef?: string | undefined;
421
+ } | undefined;
422
+ /** ID запроса: детерминированный от попытки и порядкового номера внутри неё. */
423
+ export declare const inputRequestId: (runId: string, index: number) => string;
424
+ /** Вид источника контекста с ответом на запрос. */
425
+ export declare const INPUT_SOURCE_KIND = "input-answer";
426
+ /** ID источника контекста ответа на запрос `requestId`. */
427
+ export declare const inputSourceId: (requestId: string) => string;
428
+ /**
429
+ * Manifest источника ответа: какой запрос, какой точно ответ (digest и
430
+ * версия) и какие сообщения обсуждения хоста (ID, версия, digest) включены.
431
+ */
432
+ export declare const inputManifestSchema: z.ZodObject<{
433
+ requestId: z.ZodString;
434
+ answerDigest: z.ZodString;
435
+ revision: z.ZodNumber;
436
+ messages: z.ZodArray<z.ZodObject<{
437
+ id: z.ZodString;
438
+ revision: z.ZodNumber;
439
+ digest: z.ZodString;
440
+ }, z.core.$strict>>;
441
+ }, z.core.$strict>;
442
+ export type InputManifest = z.infer<typeof inputManifestSchema>;