dp-worker 0.1.30 → 0.1.34

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 (66) hide show
  1. package/builtin-skills/bilibili.md +57 -0
  2. package/builtin-skills/douyin.md +54 -0
  3. package/builtin-skills/linkedin.md +52 -0
  4. package/builtin-skills/weibo.md +61 -0
  5. package/builtin-skills/xiaohongshu.md +55 -0
  6. package/builtin-skills/zhihu.md +55 -0
  7. package/dist/agent/skill-generator.js +63 -0
  8. package/dist/agent/skill-generator.js.map +1 -1
  9. package/dist/browser/account-health.d.ts +16 -0
  10. package/dist/browser/account-health.js +33 -4
  11. package/dist/browser/account-health.js.map +1 -1
  12. package/dist/browser/workspace-lock.js +64 -3
  13. package/dist/browser/workspace-lock.js.map +1 -1
  14. package/dist/center/center-frontend.d.ts +10 -0
  15. package/dist/center/center-frontend.js +13 -3
  16. package/dist/center/center-frontend.js.map +1 -1
  17. package/dist/chrome-extension/omni-flow/manifest.json +1 -1
  18. package/node_modules/dp-shared/dist/bird-contracts.d.ts +8 -0
  19. package/node_modules/dp-shared/dist/bird-contracts.d.ts.map +1 -1
  20. package/node_modules/dp-shared/dist/bird-contracts.js +19 -0
  21. package/node_modules/dp-shared/dist/bird-contracts.js.map +1 -1
  22. package/node_modules/dp-shared/dist/desk-contracts.d.ts +478 -0
  23. package/node_modules/dp-shared/dist/desk-contracts.d.ts.map +1 -0
  24. package/node_modules/dp-shared/dist/desk-contracts.js +397 -0
  25. package/node_modules/dp-shared/dist/desk-contracts.js.map +1 -0
  26. package/node_modules/dp-shared/dist/identities.d.ts +2 -1
  27. package/node_modules/dp-shared/dist/identities.d.ts.map +1 -1
  28. package/node_modules/dp-shared/dist/identities.js +13 -1
  29. package/node_modules/dp-shared/dist/identities.js.map +1 -1
  30. package/node_modules/dp-shared/dist/index.d.ts +2 -0
  31. package/node_modules/dp-shared/dist/index.d.ts.map +1 -1
  32. package/node_modules/dp-shared/dist/index.js +2 -0
  33. package/node_modules/dp-shared/dist/index.js.map +1 -1
  34. package/node_modules/dp-shared/dist/post-drafts-contracts.d.ts +223 -6
  35. package/node_modules/dp-shared/dist/post-drafts-contracts.d.ts.map +1 -1
  36. package/node_modules/dp-shared/dist/post-drafts-contracts.js +133 -0
  37. package/node_modules/dp-shared/dist/post-drafts-contracts.js.map +1 -1
  38. package/node_modules/dp-shared/dist/promo-contracts.d.ts +183 -23
  39. package/node_modules/dp-shared/dist/promo-contracts.d.ts.map +1 -1
  40. package/node_modules/dp-shared/dist/promo-contracts.js +368 -16
  41. package/node_modules/dp-shared/dist/promo-contracts.js.map +1 -1
  42. package/node_modules/dp-shared/dist/relay-contracts.d.ts +439 -0
  43. package/node_modules/dp-shared/dist/relay-contracts.d.ts.map +1 -0
  44. package/node_modules/dp-shared/dist/relay-contracts.js +362 -0
  45. package/node_modules/dp-shared/dist/relay-contracts.js.map +1 -0
  46. package/node_modules/dp-shared/dist/signal/draft-rules.d.ts +169 -0
  47. package/node_modules/dp-shared/dist/signal/draft-rules.d.ts.map +1 -0
  48. package/node_modules/dp-shared/dist/signal/draft-rules.js +261 -0
  49. package/node_modules/dp-shared/dist/signal/draft-rules.js.map +1 -0
  50. package/node_modules/dp-shared/dist/signal/normalize-metric.d.ts +121 -0
  51. package/node_modules/dp-shared/dist/signal/normalize-metric.d.ts.map +1 -0
  52. package/node_modules/dp-shared/dist/signal/normalize-metric.js +373 -0
  53. package/node_modules/dp-shared/dist/signal/normalize-metric.js.map +1 -0
  54. package/node_modules/dp-shared/dist/signal/signal-score.d.ts +445 -0
  55. package/node_modules/dp-shared/dist/signal/signal-score.d.ts.map +1 -0
  56. package/node_modules/dp-shared/dist/signal/signal-score.js +1922 -0
  57. package/node_modules/dp-shared/dist/signal/signal-score.js.map +1 -0
  58. package/node_modules/dp-shared/dist/signal/validate-draft.d.ts +718 -0
  59. package/node_modules/dp-shared/dist/signal/validate-draft.d.ts.map +1 -0
  60. package/node_modules/dp-shared/dist/signal/validate-draft.js +433 -0
  61. package/node_modules/dp-shared/dist/signal/validate-draft.js.map +1 -0
  62. package/node_modules/dp-shared/dist/signal/weighted-length.d.ts +87 -0
  63. package/node_modules/dp-shared/dist/signal/weighted-length.d.ts.map +1 -0
  64. package/node_modules/dp-shared/dist/signal/weighted-length.js +195 -0
  65. package/node_modules/dp-shared/dist/signal/weighted-length.js.map +1 -0
  66. package/package.json +1 -1
@@ -0,0 +1,718 @@
1
+ /**
2
+ * `POST /internal/validate-draft` — the one wire contract, imported by both
3
+ * sides (CONTRACT-FREEZE §C-01, frozen contract #1).
4
+ *
5
+ * Three designs each shipped their own response shape, and the frontend on top
6
+ * of them hard-coded `Q-02` / `Q-14` / `Q-15` to `blocked` while also making
7
+ * `blocked` disable the approve button — a system that could not publish a
8
+ * single post, with every test green. So:
9
+ *
10
+ * - There is one schema and it lives here. Both Workers `import` it; a field
11
+ * rename breaks both builds in the same commit.
12
+ * - The response has **three sections derived from one evaluation**:
13
+ * `checks[]` — the engine's internal checks, each carrying `rule_ids[]`
14
+ * `q_checklist[15]` — docB 三.5 numbering, the reviewer-facing view
15
+ * `must_include[]` — the per-level mandatory-element view
16
+ * `q_checklist` and `must_include` are projections of `checks`, computed by
17
+ * the engine. They cannot disagree because they are not separately decided.
18
+ * - **The frontend renders `q_checklist` and `must_include` only.** Reading
19
+ * `checks[].check_id` in UI code is a contract violation; `checks[]` is for
20
+ * audit rows, span highlighting and ops queries.
21
+ * - `blocked` may only come from `state` in this payload. No hard-coding.
22
+ *
23
+ * ## Five states, and why `human` and `unevaluable` are separate
24
+ *
25
+ * `pass` / `warn` / `blocked` / `human` / `unevaluable`.
26
+ *
27
+ * `human` is "a person must tick this" (docB Q-01 and Q-04 cannot be automated
28
+ * and pretending otherwise produces blind ticking). `unevaluable` is "the gate
29
+ * itself could not reach a conclusion" — empty ledger, extractor error, judge
30
+ * abstained. They look alike in a UI and are opposite in an ops review: a rise
31
+ * in `human` is workload, a rise in `unevaluable` is an outage. Collapsing them
32
+ * is how a broken extractor comes to look like a quiet news day.
33
+ */
34
+ import { z } from "zod";
35
+ /**
36
+ * Bumped whenever this file's shapes change.
37
+ *
38
+ * Both Workers are deployed by hand, so they *will* skew. `/health` exposes
39
+ * this and the two sides compare **each other's** value rather than their own
40
+ * — self-comparison is always consistent and always useless.
41
+ */
42
+ export declare const VALIDATE_DRAFT_CONTRACT_VERSION = "2026-09-18.1";
43
+ export declare const LevelSchema: z.ZodEnum<{
44
+ WATCH: "WATCH";
45
+ FLASH: "FLASH";
46
+ IMPACT: "IMPACT";
47
+ }>;
48
+ export type LevelWire = z.infer<typeof LevelSchema>;
49
+ export declare const VerdictSchema: z.ZodEnum<{
50
+ pass: "pass";
51
+ fail: "fail";
52
+ unevaluable: "unevaluable";
53
+ }>;
54
+ export declare const SeveritySchema: z.ZodEnum<{
55
+ block: "block";
56
+ warn: "warn";
57
+ human: "human";
58
+ }>;
59
+ export declare const LayerSchema: z.ZodEnum<{
60
+ D0: "D0";
61
+ D1: "D1";
62
+ D2: "D2";
63
+ PROBE: "PROBE";
64
+ J1: "J1";
65
+ J2: "J2";
66
+ J3: "J3";
67
+ H: "H";
68
+ }>;
69
+ /** The five UI states. CONTRACT-FREEZE §C-01. */
70
+ export declare const CheckStateSchema: z.ZodEnum<{
71
+ blocked: "blocked";
72
+ warn: "warn";
73
+ human: "human";
74
+ pass: "pass";
75
+ unevaluable: "unevaluable";
76
+ }>;
77
+ export type CheckState = z.infer<typeof CheckStateSchema>;
78
+ /**
79
+ * The structured envelope the generator emits alongside the prose.
80
+ *
81
+ * Structured-first is the trick that turns roughly eight "ask the model whether
82
+ * the post contains X" questions into code: the generator commits to the fields
83
+ * first, and the judge only has to answer "does the prose say what the fields
84
+ * say". N-W-03 in particular (at most two watch variables) is a counting
85
+ * constraint, and models systematically write three.
86
+ */
87
+ export declare const DraftStructuredSchema: z.ZodObject<{
88
+ watch_variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
89
+ metric: z.ZodString;
90
+ time_point: z.ZodNullable<z.ZodString>;
91
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ }, z.core.$strip>>>;
93
+ invalidation: z.ZodDefault<z.ZodNullable<z.ZodObject<{
94
+ metric: z.ZodString;
95
+ comparator: z.ZodEnum<{
96
+ ">": ">";
97
+ ">=": ">=";
98
+ "<": "<";
99
+ "<=": "<=";
100
+ "==": "==";
101
+ "!=": "!=";
102
+ crosses: "crosses";
103
+ occurs: "occurs";
104
+ }>;
105
+ threshold: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
106
+ unit: z.ZodNullable<z.ZodString>;
107
+ deadline_at: z.ZodNullable<z.ZodString>;
108
+ }, z.core.$strip>>>;
109
+ quantitative_data: z.ZodDefault<z.ZodArray<z.ZodObject<{
110
+ asset: z.ZodString;
111
+ direction: z.ZodEnum<{
112
+ flat: "flat";
113
+ up: "up";
114
+ down: "down";
115
+ widen: "widen";
116
+ narrow: "narrow";
117
+ unchanged: "unchanged";
118
+ }>;
119
+ magnitude: z.ZodString;
120
+ window: z.ZodString;
121
+ fact_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
+ }, z.core.$strip>>>;
123
+ impact_assets: z.ZodDefault<z.ZodArray<z.ZodObject<{
124
+ symbol: z.ZodString;
125
+ evidence_id: z.ZodNullable<z.ZodString>;
126
+ has_data_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
127
+ }, z.core.$strip>>>;
128
+ thesis_status: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
129
+ maintained: "maintained";
130
+ strengthened: "strengthened";
131
+ invalidated: "invalidated";
132
+ }>>>;
133
+ event_time_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ consensus: z.ZodDefault<z.ZodNullable<z.ZodObject<{
135
+ value: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
136
+ dispersion: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
137
+ source_ref: z.ZodNullable<z.ZodString>;
138
+ }, z.core.$strip>>>;
139
+ template_deviation_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
140
+ }, z.core.$strip>;
141
+ export type DraftStructured = z.infer<typeof DraftStructuredSchema>;
142
+ /**
143
+ * One row of the fact ledger, as dp-center hands it over.
144
+ *
145
+ * `kind` matters and the reason is only visible where two subsystems meet:
146
+ * gate_A must **exclude** `market` facts from its increment diff (otherwise
147
+ * quoting today's price counts as new information and every re-run of an old
148
+ * story triggers), while this gate must **include** them (otherwise every price
149
+ * legitimately quoted in an IMPACT post reads as an ungrounded hallucination
150
+ * and IMPACT deadlocks). Same table, same normalized_key, opposite filters.
151
+ */
152
+ export declare const LedgerFactSchema: z.ZodObject<{
153
+ fact_id: z.ZodString;
154
+ normalized_key: z.ZodString;
155
+ kind: z.ZodString;
156
+ unit_class: z.ZodString;
157
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
158
+ value_num: z.ZodNullable<z.ZodNumber>;
159
+ value_norm: z.ZodNullable<z.ZodNumber>;
160
+ unit: z.ZodNullable<z.ZodString>;
161
+ is_key_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
162
+ verified_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
163
+ observed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ }, z.core.$strip>;
165
+ export type LedgerFact = z.infer<typeof LedgerFactSchema>;
166
+ /**
167
+ * Why the ledger looks the way it does.
168
+ *
169
+ * Three causes that a boolean would fuse into one, with opposite correct
170
+ * handling. "The source genuinely had no numbers" is a fine draft; "our
171
+ * extractor threw" and "we never fetched the page" are outages that must not
172
+ * be charged to the draft. This distinction is the first of the gate's escape
173
+ * hatches (see `ledger-gate.ts`).
174
+ */
175
+ export declare const LedgerStatusSchema: z.ZodEnum<{
176
+ ok: "ok";
177
+ no_numbers_in_source: "no_numbers_in_source";
178
+ extractor_error: "extractor_error";
179
+ source_unavailable: "source_unavailable";
180
+ }>;
181
+ export type LedgerStatus = z.infer<typeof LedgerStatusSchema>;
182
+ export declare const PriorPublishedSchema: z.ZodObject<{
183
+ publish_record_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
184
+ level: z.ZodEnum<{
185
+ WATCH: "WATCH";
186
+ FLASH: "FLASH";
187
+ IMPACT: "IMPACT";
188
+ }>;
189
+ published_at: z.ZodString;
190
+ text: z.ZodString;
191
+ content_class: z.ZodNullable<z.ZodString>;
192
+ quantitative_keys: z.ZodDefault<z.ZodArray<z.ZodString>>;
193
+ }, z.core.$strip>;
194
+ export type PriorPublished = z.infer<typeof PriorPublishedSchema>;
195
+ /**
196
+ * Who is asking. Injected by dp-center's service binding as `x-signal-actor`.
197
+ *
198
+ * `system` exists only for the assisted-dispatch reconciliation job and is
199
+ * allowed on a two-route allowlist; it must never reach this route, because a
200
+ * validation attributed to nobody is a validation nobody can be asked about.
201
+ */
202
+ export declare const SignalActorSchema: z.ZodObject<{
203
+ kind: z.ZodEnum<{
204
+ user: "user";
205
+ system: "system";
206
+ }>;
207
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
208
+ job: z.ZodOptional<z.ZodNullable<z.ZodString>>;
209
+ }, z.core.$strip>;
210
+ export type SignalActor = z.infer<typeof SignalActorSchema>;
211
+ /**
212
+ * Note on the Signal-Desk 0.6.1 clipboard workflow.
213
+ *
214
+ * 0.6.1's zero-LLM path — tick N articles, generate a Breaking News / Market
215
+ * Case / SEO Article prompt, copy it out — survives and is not replaced by this
216
+ * pipeline. But its output must never enter the publish path directly, and that
217
+ * is structural rather than a rule anyone has to remember: this request requires
218
+ * an `event_id` that reached M-01 through the four gates, plus a structured
219
+ * envelope. A clipboard composition of three unrelated articles has neither and
220
+ * cannot be expressed here. To publish, it re-enters at M-01 — otherwise the
221
+ * fifteen checks and the whole S-01..S-10 record come out empty.
222
+ */
223
+ export declare const ValidateDraftRequestSchema: z.ZodObject<{
224
+ event_id: z.ZodString;
225
+ draft_id: z.ZodString;
226
+ rev: z.ZodNumber;
227
+ level: z.ZodEnum<{
228
+ WATCH: "WATCH";
229
+ FLASH: "FLASH";
230
+ IMPACT: "IMPACT";
231
+ }>;
232
+ stage: z.ZodEnum<{
233
+ draft: "draft";
234
+ final: "final";
235
+ }>;
236
+ draft_text: z.ZodString;
237
+ link_url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
238
+ hashtags: z.ZodDefault<z.ZodArray<z.ZodString>>;
239
+ campaign_key: z.ZodDefault<z.ZodNullable<z.ZodString>>;
240
+ campaign: z.ZodDefault<z.ZodNullable<z.ZodObject<{
241
+ campaign_key: z.ZodString;
242
+ allowed_link_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
243
+ allowed_tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
244
+ cta_text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
245
+ valid_from_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
246
+ valid_to_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
247
+ }, z.core.$strip>>>;
248
+ structured: z.ZodObject<{
249
+ watch_variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
250
+ metric: z.ZodString;
251
+ time_point: z.ZodNullable<z.ZodString>;
252
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
253
+ }, z.core.$strip>>>;
254
+ invalidation: z.ZodDefault<z.ZodNullable<z.ZodObject<{
255
+ metric: z.ZodString;
256
+ comparator: z.ZodEnum<{
257
+ ">": ">";
258
+ ">=": ">=";
259
+ "<": "<";
260
+ "<=": "<=";
261
+ "==": "==";
262
+ "!=": "!=";
263
+ crosses: "crosses";
264
+ occurs: "occurs";
265
+ }>;
266
+ threshold: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
267
+ unit: z.ZodNullable<z.ZodString>;
268
+ deadline_at: z.ZodNullable<z.ZodString>;
269
+ }, z.core.$strip>>>;
270
+ quantitative_data: z.ZodDefault<z.ZodArray<z.ZodObject<{
271
+ asset: z.ZodString;
272
+ direction: z.ZodEnum<{
273
+ flat: "flat";
274
+ up: "up";
275
+ down: "down";
276
+ widen: "widen";
277
+ narrow: "narrow";
278
+ unchanged: "unchanged";
279
+ }>;
280
+ magnitude: z.ZodString;
281
+ window: z.ZodString;
282
+ fact_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
283
+ }, z.core.$strip>>>;
284
+ impact_assets: z.ZodDefault<z.ZodArray<z.ZodObject<{
285
+ symbol: z.ZodString;
286
+ evidence_id: z.ZodNullable<z.ZodString>;
287
+ has_data_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
288
+ }, z.core.$strip>>>;
289
+ thesis_status: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
290
+ maintained: "maintained";
291
+ strengthened: "strengthened";
292
+ invalidated: "invalidated";
293
+ }>>>;
294
+ event_time_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
295
+ consensus: z.ZodDefault<z.ZodNullable<z.ZodObject<{
296
+ value: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
297
+ dispersion: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
298
+ source_ref: z.ZodNullable<z.ZodString>;
299
+ }, z.core.$strip>>>;
300
+ template_deviation_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
301
+ }, z.core.$strip>;
302
+ ledger_status: z.ZodDefault<z.ZodEnum<{
303
+ ok: "ok";
304
+ no_numbers_in_source: "no_numbers_in_source";
305
+ extractor_error: "extractor_error";
306
+ source_unavailable: "source_unavailable";
307
+ }>>;
308
+ facts: z.ZodDefault<z.ZodArray<z.ZodObject<{
309
+ fact_id: z.ZodString;
310
+ normalized_key: z.ZodString;
311
+ kind: z.ZodString;
312
+ unit_class: z.ZodString;
313
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
314
+ value_num: z.ZodNullable<z.ZodNumber>;
315
+ value_norm: z.ZodNullable<z.ZodNumber>;
316
+ unit: z.ZodNullable<z.ZodString>;
317
+ is_key_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
318
+ verified_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
319
+ observed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
320
+ }, z.core.$strip>>>;
321
+ source_chars_indexed: z.ZodDefault<z.ZodNumber>;
322
+ symbols: z.ZodDefault<z.ZodArray<z.ZodString>>;
323
+ prev_published: z.ZodDefault<z.ZodArray<z.ZodObject<{
324
+ publish_record_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
325
+ level: z.ZodEnum<{
326
+ WATCH: "WATCH";
327
+ FLASH: "FLASH";
328
+ IMPACT: "IMPACT";
329
+ }>;
330
+ published_at: z.ZodString;
331
+ text: z.ZodString;
332
+ content_class: z.ZodNullable<z.ZodString>;
333
+ quantitative_keys: z.ZodDefault<z.ZodArray<z.ZodString>>;
334
+ }, z.core.$strip>>>;
335
+ content_class: z.ZodDefault<z.ZodNullable<z.ZodString>>;
336
+ source_headlines: z.ZodDefault<z.ZodArray<z.ZodString>>;
337
+ source_urls: z.ZodDefault<z.ZodArray<z.ZodString>>;
338
+ approver_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
339
+ approved_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
340
+ published_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
341
+ gate_a_pass_int: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
342
+ is_contested_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
343
+ independent_source_count: z.ZodDefault<z.ZodNumber>;
344
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
345
+ check_id: z.ZodString;
346
+ reason: z.ZodString;
347
+ approver_id: z.ZodString;
348
+ at: z.ZodString;
349
+ }, z.core.$strip>>>;
350
+ model_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
351
+ prompt_version: z.ZodDefault<z.ZodNullable<z.ZodString>>;
352
+ actor: z.ZodObject<{
353
+ kind: z.ZodEnum<{
354
+ user: "user";
355
+ system: "system";
356
+ }>;
357
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
358
+ job: z.ZodOptional<z.ZodNullable<z.ZodString>>;
359
+ }, z.core.$strip>;
360
+ }, z.core.$strip>;
361
+ export type ValidateDraftRequest = z.infer<typeof ValidateDraftRequestSchema>;
362
+ export declare const MatchStatusSchema: z.ZodEnum<{
363
+ matched: "matched";
364
+ unevaluable: "unevaluable";
365
+ rounded: "rounded";
366
+ unmatched: "unmatched";
367
+ exempt: "exempt";
368
+ ambiguous: "ambiguous";
369
+ }>;
370
+ export type MatchStatus = z.infer<typeof MatchStatusSchema>;
371
+ /**
372
+ * One number in the draft, with where it came from.
373
+ *
374
+ * Spans exist so the approval page can underline the body and show the source
375
+ * card. `unmatched` red, `rounded` amber, `ambiguous` grey — the colour is the
376
+ * reviewer's entire explanation of why the draft is held.
377
+ */
378
+ export declare const DraftAnchorSchema: z.ZodObject<{
379
+ span_start: z.ZodNumber;
380
+ span_end: z.ZodNumber;
381
+ raw: z.ZodString;
382
+ match_status: z.ZodEnum<{
383
+ matched: "matched";
384
+ unevaluable: "unevaluable";
385
+ rounded: "rounded";
386
+ unmatched: "unmatched";
387
+ exempt: "exempt";
388
+ ambiguous: "ambiguous";
389
+ }>;
390
+ fact_id: z.ZodNullable<z.ZodString>;
391
+ unit_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
392
+ value_norm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
393
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
394
+ }, z.core.$strip>;
395
+ export type DraftAnchor = z.infer<typeof DraftAnchorSchema>;
396
+ export declare const CheckResultSchema: z.ZodObject<{
397
+ check_id: z.ZodString;
398
+ rule_ids: z.ZodArray<z.ZodString>;
399
+ layer: z.ZodEnum<{
400
+ D0: "D0";
401
+ D1: "D1";
402
+ D2: "D2";
403
+ PROBE: "PROBE";
404
+ J1: "J1";
405
+ J2: "J2";
406
+ J3: "J3";
407
+ H: "H";
408
+ }>;
409
+ verdict: z.ZodEnum<{
410
+ pass: "pass";
411
+ fail: "fail";
412
+ unevaluable: "unevaluable";
413
+ }>;
414
+ severity: z.ZodEnum<{
415
+ block: "block";
416
+ warn: "warn";
417
+ human: "human";
418
+ }>;
419
+ state: z.ZodEnum<{
420
+ blocked: "blocked";
421
+ warn: "warn";
422
+ human: "human";
423
+ pass: "pass";
424
+ unevaluable: "unevaluable";
425
+ }>;
426
+ confidence: z.ZodNullable<z.ZodNumber>;
427
+ abstain_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
428
+ overridable: z.ZodBoolean;
429
+ overridden_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
430
+ override_reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
431
+ reason: z.ZodString;
432
+ evidence: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
433
+ spans: z.ZodDefault<z.ZodArray<z.ZodObject<{
434
+ start: z.ZodNumber;
435
+ end: z.ZodNumber;
436
+ }, z.core.$strip>>>;
437
+ skipped_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
438
+ }, z.core.$strip>;
439
+ export type CheckResult = z.infer<typeof CheckResultSchema>;
440
+ export declare const QChecklistRowSchema: z.ZodObject<{
441
+ q: z.ZodString;
442
+ group: z.ZodEnum<{
443
+ fact: "fact";
444
+ judgement: "judgement";
445
+ copy: "copy";
446
+ }>;
447
+ mode: z.ZodEnum<{
448
+ llm: "llm";
449
+ auto: "auto";
450
+ human: "human";
451
+ }>;
452
+ state: z.ZodEnum<{
453
+ blocked: "blocked";
454
+ warn: "warn";
455
+ human: "human";
456
+ pass: "pass";
457
+ unevaluable: "unevaluable";
458
+ }>;
459
+ label: z.ZodString;
460
+ detail: z.ZodString;
461
+ requires_tick: z.ZodBoolean;
462
+ }, z.core.$strip>;
463
+ export type QChecklistRow = z.infer<typeof QChecklistRowSchema>;
464
+ export declare const MustIncludeRowSchema: z.ZodObject<{
465
+ rule_id: z.ZodString;
466
+ level: z.ZodEnum<{
467
+ WATCH: "WATCH";
468
+ FLASH: "FLASH";
469
+ IMPACT: "IMPACT";
470
+ }>;
471
+ label: z.ZodString;
472
+ state: z.ZodEnum<{
473
+ blocked: "blocked";
474
+ warn: "warn";
475
+ human: "human";
476
+ pass: "pass";
477
+ unevaluable: "unevaluable";
478
+ }>;
479
+ detail: z.ZodString;
480
+ decided_by: z.ZodEnum<{
481
+ text: "text";
482
+ structured: "structured";
483
+ "structured+text": "structured+text";
484
+ not_applicable: "not_applicable";
485
+ }>;
486
+ }, z.core.$strip>;
487
+ export type MustIncludeRow = z.infer<typeof MustIncludeRowSchema>;
488
+ export declare const GateDFinalSchema: z.ZodObject<{
489
+ pass: z.ZodBoolean;
490
+ confidence: z.ZodNumber;
491
+ abstain: z.ZodBoolean;
492
+ reason: z.ZodString;
493
+ components: z.ZodDefault<z.ZodArray<z.ZodString>>;
494
+ evidence: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
495
+ }, z.core.$strip>;
496
+ export type GateDFinal = z.infer<typeof GateDFinalSchema>;
497
+ export declare const ValidateTelemetrySchema: z.ZodObject<{
498
+ ledger_status: z.ZodEnum<{
499
+ ok: "ok";
500
+ no_numbers_in_source: "no_numbers_in_source";
501
+ extractor_error: "extractor_error";
502
+ source_unavailable: "source_unavailable";
503
+ }>;
504
+ ledger_rows: z.ZodNumber;
505
+ source_chars_indexed: z.ZodNumber;
506
+ tokens_parsed: z.ZodNumber;
507
+ unmatched: z.ZodNumber;
508
+ canary_pass_int: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
509
+ degraded_int: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
510
+ breaker_open_int: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
511
+ llm_calls: z.ZodNumber;
512
+ layers_short_circuited: z.ZodDefault<z.ZodArray<z.ZodEnum<{
513
+ D0: "D0";
514
+ D1: "D1";
515
+ D2: "D2";
516
+ PROBE: "PROBE";
517
+ J1: "J1";
518
+ J2: "J2";
519
+ J3: "J3";
520
+ H: "H";
521
+ }>>>;
522
+ duration_ms: z.ZodNumber;
523
+ }, z.core.$strip>;
524
+ export type ValidateTelemetry = z.infer<typeof ValidateTelemetrySchema>;
525
+ export declare const ValidateDraftResponseSchema: z.ZodObject<{
526
+ contract_version: z.ZodLiteral<"2026-09-18.1">;
527
+ validator_version: z.ZodString;
528
+ judge_model: z.ZodNullable<z.ZodString>;
529
+ judge_version: z.ZodString;
530
+ evaluated_at: z.ZodString;
531
+ draft_id: z.ZodString;
532
+ rev: z.ZodNumber;
533
+ stage: z.ZodEnum<{
534
+ draft: "draft";
535
+ final: "final";
536
+ }>;
537
+ text_sha256: z.ZodString;
538
+ verdict: z.ZodEnum<{
539
+ block: "block";
540
+ pass: "pass";
541
+ needs_human: "needs_human";
542
+ }>;
543
+ gate_d_final: z.ZodObject<{
544
+ pass: z.ZodBoolean;
545
+ confidence: z.ZodNumber;
546
+ abstain: z.ZodBoolean;
547
+ reason: z.ZodString;
548
+ components: z.ZodDefault<z.ZodArray<z.ZodString>>;
549
+ evidence: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
550
+ }, z.core.$strip>;
551
+ checks: z.ZodArray<z.ZodObject<{
552
+ check_id: z.ZodString;
553
+ rule_ids: z.ZodArray<z.ZodString>;
554
+ layer: z.ZodEnum<{
555
+ D0: "D0";
556
+ D1: "D1";
557
+ D2: "D2";
558
+ PROBE: "PROBE";
559
+ J1: "J1";
560
+ J2: "J2";
561
+ J3: "J3";
562
+ H: "H";
563
+ }>;
564
+ verdict: z.ZodEnum<{
565
+ pass: "pass";
566
+ fail: "fail";
567
+ unevaluable: "unevaluable";
568
+ }>;
569
+ severity: z.ZodEnum<{
570
+ block: "block";
571
+ warn: "warn";
572
+ human: "human";
573
+ }>;
574
+ state: z.ZodEnum<{
575
+ blocked: "blocked";
576
+ warn: "warn";
577
+ human: "human";
578
+ pass: "pass";
579
+ unevaluable: "unevaluable";
580
+ }>;
581
+ confidence: z.ZodNullable<z.ZodNumber>;
582
+ abstain_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
583
+ overridable: z.ZodBoolean;
584
+ overridden_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
585
+ override_reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
586
+ reason: z.ZodString;
587
+ evidence: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
588
+ spans: z.ZodDefault<z.ZodArray<z.ZodObject<{
589
+ start: z.ZodNumber;
590
+ end: z.ZodNumber;
591
+ }, z.core.$strip>>>;
592
+ skipped_int: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
593
+ }, z.core.$strip>>;
594
+ q_checklist: z.ZodArray<z.ZodObject<{
595
+ q: z.ZodString;
596
+ group: z.ZodEnum<{
597
+ fact: "fact";
598
+ judgement: "judgement";
599
+ copy: "copy";
600
+ }>;
601
+ mode: z.ZodEnum<{
602
+ llm: "llm";
603
+ auto: "auto";
604
+ human: "human";
605
+ }>;
606
+ state: z.ZodEnum<{
607
+ blocked: "blocked";
608
+ warn: "warn";
609
+ human: "human";
610
+ pass: "pass";
611
+ unevaluable: "unevaluable";
612
+ }>;
613
+ label: z.ZodString;
614
+ detail: z.ZodString;
615
+ requires_tick: z.ZodBoolean;
616
+ }, z.core.$strip>>;
617
+ must_include: z.ZodArray<z.ZodObject<{
618
+ rule_id: z.ZodString;
619
+ level: z.ZodEnum<{
620
+ WATCH: "WATCH";
621
+ FLASH: "FLASH";
622
+ IMPACT: "IMPACT";
623
+ }>;
624
+ label: z.ZodString;
625
+ state: z.ZodEnum<{
626
+ blocked: "blocked";
627
+ warn: "warn";
628
+ human: "human";
629
+ pass: "pass";
630
+ unevaluable: "unevaluable";
631
+ }>;
632
+ detail: z.ZodString;
633
+ decided_by: z.ZodEnum<{
634
+ text: "text";
635
+ structured: "structured";
636
+ "structured+text": "structured+text";
637
+ not_applicable: "not_applicable";
638
+ }>;
639
+ }, z.core.$strip>>;
640
+ anchors: z.ZodArray<z.ZodObject<{
641
+ span_start: z.ZodNumber;
642
+ span_end: z.ZodNumber;
643
+ raw: z.ZodString;
644
+ match_status: z.ZodEnum<{
645
+ matched: "matched";
646
+ unevaluable: "unevaluable";
647
+ rounded: "rounded";
648
+ unmatched: "unmatched";
649
+ exempt: "exempt";
650
+ ambiguous: "ambiguous";
651
+ }>;
652
+ fact_id: z.ZodNullable<z.ZodString>;
653
+ unit_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
654
+ value_norm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
655
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
656
+ }, z.core.$strip>>;
657
+ x_length: z.ZodObject<{
658
+ weighted: z.ZodNumber;
659
+ limit: z.ZodNumber;
660
+ reserve: z.ZodNumber;
661
+ over_by: z.ZodNumber;
662
+ url_count: z.ZodNumber;
663
+ }, z.core.$strip>;
664
+ telemetry: z.ZodObject<{
665
+ ledger_status: z.ZodEnum<{
666
+ ok: "ok";
667
+ no_numbers_in_source: "no_numbers_in_source";
668
+ extractor_error: "extractor_error";
669
+ source_unavailable: "source_unavailable";
670
+ }>;
671
+ ledger_rows: z.ZodNumber;
672
+ source_chars_indexed: z.ZodNumber;
673
+ tokens_parsed: z.ZodNumber;
674
+ unmatched: z.ZodNumber;
675
+ canary_pass_int: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
676
+ degraded_int: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
677
+ breaker_open_int: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
678
+ llm_calls: z.ZodNumber;
679
+ layers_short_circuited: z.ZodDefault<z.ZodArray<z.ZodEnum<{
680
+ D0: "D0";
681
+ D1: "D1";
682
+ D2: "D2";
683
+ PROBE: "PROBE";
684
+ J1: "J1";
685
+ J2: "J2";
686
+ J3: "J3";
687
+ H: "H";
688
+ }>>>;
689
+ duration_ms: z.ZodNumber;
690
+ }, z.core.$strip>;
691
+ pending_reason: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
692
+ key_fact_unverified: "key_fact_unverified";
693
+ tier1_unavailable: "tier1_unavailable";
694
+ ledger_unevaluable: "ledger_unevaluable";
695
+ judge_unavailable: "judge_unavailable";
696
+ }>>>;
697
+ }, z.core.$strip>;
698
+ export type ValidateDraftResponse = z.infer<typeof ValidateDraftResponseSchema>;
699
+ /**
700
+ * `(verdict, severity)` → the five-state UI value. The ONE place this mapping
701
+ * exists; both the `checks[]` rows and the two views go through it, which is
702
+ * the mechanical reason the three sections cannot disagree.
703
+ *
704
+ * `severity: 'human'` always yields `human` on a non-failing verdict: those
705
+ * checks (Q-01's ledger-diff snapshot, the glossary) are not automatable, and a
706
+ * green tick the reviewer did not make is worse than no tick at all.
707
+ */
708
+ export declare function stateFor(verdict: z.infer<typeof VerdictSchema>, severity: z.infer<typeof SeveritySchema>, options?: {
709
+ overridden?: boolean;
710
+ abstain?: boolean;
711
+ }): CheckState;
712
+ /** Roll a set of states into one. A row is as bad as its worst check. */
713
+ export declare function worstState(states: readonly CheckState[]): CheckState;
714
+ /** Does this state stop the approve button? Only `blocked` does. */
715
+ export declare function blocksApproval(state: CheckState): boolean;
716
+ /** Does this state require an explicit human tick before approval? */
717
+ export declare function requiresTick(state: CheckState): boolean;
718
+ //# sourceMappingURL=validate-draft.d.ts.map