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 @@
1
+ {"version":3,"file":"validate-draft.d.ts","sourceRoot":"","sources":["../../src/signal/validate-draft.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,iBAAiB,CAAC;AAE9D,eAAO,MAAM,WAAW;;;;EAAuC,CAAC;AAChE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,eAAO,MAAM,aAAa;;;;EAA0C,CAAC;AACrE,eAAO,MAAM,cAAc;;;;EAAqC,CAAC;AACjE,eAAO,MAAM,WAAW;;;;;;;;;EAA6D,CAAC;AAEtF,iDAAiD;AACjD,eAAO,MAAM,gBAAgB;;;;;;EAA8D,CAAC;AAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmDhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAa3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,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,EAAE,GAAG,UAAU,CAMpE;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEzD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEvD"}
@@ -0,0 +1,433 @@
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 const VALIDATE_DRAFT_CONTRACT_VERSION = "2026-09-18.1";
43
+ export const LevelSchema = z.enum(["WATCH", "FLASH", "IMPACT"]);
44
+ export const VerdictSchema = z.enum(["pass", "fail", "unevaluable"]);
45
+ export const SeveritySchema = z.enum(["block", "warn", "human"]);
46
+ export const LayerSchema = z.enum(["D0", "D1", "D2", "PROBE", "J1", "J2", "J3", "H"]);
47
+ /** The five UI states. CONTRACT-FREEZE §C-01. */
48
+ export const CheckStateSchema = z.enum(["pass", "warn", "blocked", "human", "unevaluable"]);
49
+ /* ============================================================================
50
+ * Request
51
+ * ========================================================================== */
52
+ /**
53
+ * The structured envelope the generator emits alongside the prose.
54
+ *
55
+ * Structured-first is the trick that turns roughly eight "ask the model whether
56
+ * the post contains X" questions into code: the generator commits to the fields
57
+ * first, and the judge only has to answer "does the prose say what the fields
58
+ * say". N-W-03 in particular (at most two watch variables) is a counting
59
+ * constraint, and models systematically write three.
60
+ */
61
+ export const DraftStructuredSchema = z.object({
62
+ /** N-W-03 / P-08 / Q-09. Upper bound of 2 is enforced for WATCH. */
63
+ watch_variables: z.array(z.object({
64
+ metric: z.string().min(1),
65
+ /** Q-09: a variable with no time point is "watch the market". */
66
+ time_point: z.string().min(1).nullable(),
67
+ note: z.string().nullable().optional(),
68
+ })).default([]),
69
+ /** Q-10 / P-08 / B-A-06: the four-tuple that makes automatic re-checking possible. */
70
+ invalidation: z.object({
71
+ metric: z.string().min(1),
72
+ comparator: z.enum([">", ">=", "<", "<=", "==", "!=", "crosses", "occurs"]),
73
+ threshold: z.union([z.number(), z.string()]),
74
+ unit: z.string().nullable(),
75
+ /** Absolute ISO instant. A relative deadline cannot be scheduled. */
76
+ deadline_at: z.string().nullable(),
77
+ }).nullable().default(null),
78
+ /** C-I-08 / Q-05 / N-I-02: every market datum, four-tuple, no exceptions. */
79
+ quantitative_data: z.array(z.object({
80
+ asset: z.string().min(1),
81
+ direction: z.enum(["up", "down", "flat", "widen", "narrow", "unchanged"]),
82
+ magnitude: z.string().min(1),
83
+ window: z.string().min(1),
84
+ /** Links the datum to a ledger fact so D1 can match it without guessing. */
85
+ fact_id: z.string().nullable().optional(),
86
+ })).default([]),
87
+ /** P-05 / N-F-03 / N-I-03: assets we have evidence for. Naming others fails. */
88
+ impact_assets: z.array(z.object({
89
+ symbol: z.string().min(1),
90
+ evidence_id: z.string().nullable(),
91
+ /** N-I-03 needs data on both sides of a cross-asset claim. */
92
+ has_data_int: z.union([z.literal(0), z.literal(1)]).default(0),
93
+ })).default([]),
94
+ /** N-I-04. Requires the previous post's View to have been stored structurally. */
95
+ thesis_status: z.enum(["maintained", "strengthened", "invalidated"]).nullable().default(null),
96
+ /** N-W-01: the event's scheduled instant, written in the body as UTC. */
97
+ event_time_at: z.string().nullable().optional(),
98
+ /** N-W-02: consensus value or dispersion, traceable to a source. */
99
+ consensus: z.object({
100
+ value: z.union([z.number(), z.string()]).nullable(),
101
+ dispersion: z.union([z.number(), z.string()]).nullable(),
102
+ source_ref: z.string().nullable(),
103
+ }).nullable().default(null),
104
+ /** O-04: set when the generator deliberately left the four-part template. */
105
+ template_deviation_reason: z.string().nullable().optional(),
106
+ });
107
+ /**
108
+ * One row of the fact ledger, as dp-center hands it over.
109
+ *
110
+ * `kind` matters and the reason is only visible where two subsystems meet:
111
+ * gate_A must **exclude** `market` facts from its increment diff (otherwise
112
+ * quoting today's price counts as new information and every re-run of an old
113
+ * story triggers), while this gate must **include** them (otherwise every price
114
+ * legitimately quoted in an IMPACT post reads as an ungrounded hallucination
115
+ * and IMPACT deadlocks). Same table, same normalized_key, opposite filters.
116
+ */
117
+ export const LedgerFactSchema = z.object({
118
+ fact_id: z.string(),
119
+ normalized_key: z.string(),
120
+ kind: z.string(),
121
+ unit_class: z.string(),
122
+ /** Currency code when `unit_class === 'currency'`; matching requires equality. */
123
+ currency: z.string().nullable().optional(),
124
+ value_num: z.number().nullable(),
125
+ value_norm: z.number().nullable(),
126
+ unit: z.string().nullable(),
127
+ is_key_int: z.union([z.literal(0), z.literal(1)]).default(0),
128
+ verified_int: z.union([z.literal(0), z.literal(1)]).default(0),
129
+ observed_at: z.string().nullable().optional(),
130
+ });
131
+ /**
132
+ * Why the ledger looks the way it does.
133
+ *
134
+ * Three causes that a boolean would fuse into one, with opposite correct
135
+ * handling. "The source genuinely had no numbers" is a fine draft; "our
136
+ * extractor threw" and "we never fetched the page" are outages that must not
137
+ * be charged to the draft. This distinction is the first of the gate's escape
138
+ * hatches (see `ledger-gate.ts`).
139
+ */
140
+ export const LedgerStatusSchema = z.enum([
141
+ "ok",
142
+ "no_numbers_in_source",
143
+ "extractor_error",
144
+ "source_unavailable",
145
+ ]);
146
+ export const PriorPublishedSchema = z.object({
147
+ publish_record_id: z.string().nullable().optional(),
148
+ level: LevelSchema,
149
+ published_at: z.string(),
150
+ text: z.string(),
151
+ content_class: z.string().nullable(),
152
+ /** R-04: the quantitative data that existed at FLASH time, frozen then. */
153
+ quantitative_keys: z.array(z.string()).default([]),
154
+ });
155
+ /**
156
+ * Who is asking. Injected by dp-center's service binding as `x-signal-actor`.
157
+ *
158
+ * `system` exists only for the assisted-dispatch reconciliation job and is
159
+ * allowed on a two-route allowlist; it must never reach this route, because a
160
+ * validation attributed to nobody is a validation nobody can be asked about.
161
+ */
162
+ export const SignalActorSchema = z.object({
163
+ kind: z.enum(["user", "system"]),
164
+ user_id: z.string().nullable().optional(),
165
+ job: z.string().nullable().optional(),
166
+ });
167
+ /**
168
+ * Note on the Signal-Desk 0.6.1 clipboard workflow.
169
+ *
170
+ * 0.6.1's zero-LLM path — tick N articles, generate a Breaking News / Market
171
+ * Case / SEO Article prompt, copy it out — survives and is not replaced by this
172
+ * pipeline. But its output must never enter the publish path directly, and that
173
+ * is structural rather than a rule anyone has to remember: this request requires
174
+ * an `event_id` that reached M-01 through the four gates, plus a structured
175
+ * envelope. A clipboard composition of three unrelated articles has neither and
176
+ * cannot be expressed here. To publish, it re-enters at M-01 — otherwise the
177
+ * fifteen checks and the whole S-01..S-10 record come out empty.
178
+ */
179
+ export const ValidateDraftRequestSchema = z.object({
180
+ event_id: z.string().min(1),
181
+ draft_id: z.string().min(1),
182
+ rev: z.number().int().min(0),
183
+ level: LevelSchema,
184
+ /**
185
+ * `draft` is advisory and cacheable; `final` runs at the approve click and is
186
+ * never served from cache — B-D-06 wants a second, fresh adjudication, and a
187
+ * cached "pass" from before the editor's last change is exactly the hole.
188
+ */
189
+ stage: z.enum(["draft", "final"]),
190
+ draft_text: z.string(),
191
+ /** Link appended at publish time. Counted as 23 for P-11 whatever its length. */
192
+ link_url: z.string().nullable().default(null),
193
+ hashtags: z.array(z.string()).default([]),
194
+ campaign_key: z.string().nullable().default(null),
195
+ /**
196
+ * The campaign config itself, resolved by dp-center from `signal_campaigns`.
197
+ *
198
+ * Passed rather than looked up: the table lives in dp-center's database and
199
+ * CENTER_DB is restricted to `llm_profiles` and `users`. `null` is a real
200
+ * state and it means "no campaign", which Q-14 reads as *no links and no tags
201
+ * are permitted* — not as "anything goes".
202
+ */
203
+ campaign: z.object({
204
+ campaign_key: z.string(),
205
+ allowed_link_domains: z.array(z.string()).default([]),
206
+ allowed_tags: z.array(z.string()).default([]),
207
+ cta_text: z.string().nullable().default(null),
208
+ valid_from_at: z.string().nullable().default(null),
209
+ valid_to_at: z.string().nullable().default(null),
210
+ }).nullable().default(null),
211
+ structured: DraftStructuredSchema,
212
+ /** D1 inputs. */
213
+ ledger_status: LedgerStatusSchema.default("ok"),
214
+ facts: z.array(LedgerFactSchema).default([]),
215
+ /** Characters of source body text the extractor actually indexed. Telemetry. */
216
+ source_chars_indexed: z.number().int().min(0).default(0),
217
+ /** Asset symbols known to the system, so `4 ETH` parses as a quantity not a year. */
218
+ symbols: z.array(z.string()).default([]),
219
+ /** D2 inputs. */
220
+ prev_published: z.array(PriorPublishedSchema).default([]),
221
+ content_class: z.string().nullable().default(null),
222
+ /** Source headlines — the baseline VIEW_INCREMENT measures against. */
223
+ source_headlines: z.array(z.string()).default([]),
224
+ /** PROBE inputs. Probing is done by the caller-facing layer, results passed in. */
225
+ source_urls: z.array(z.string()).default([]),
226
+ /** D0 inputs for APPROVER_AUTH (Q-15). */
227
+ approver_id: z.string().nullable().default(null),
228
+ approved_at: z.string().nullable().default(null),
229
+ published_at: z.string().nullable().default(null),
230
+ /** Q-01 / Q-04 human-gate inputs. */
231
+ gate_a_pass_int: z.union([z.literal(0), z.literal(1)]).nullable().default(null),
232
+ is_contested_int: z.union([z.literal(0), z.literal(1)]).default(0),
233
+ independent_source_count: z.number().int().min(0).default(0),
234
+ /** Overrides already signed off, replayed so a re-validation stays consistent. */
235
+ overrides: z.array(z.object({
236
+ check_id: z.string(),
237
+ reason: z.string().min(20),
238
+ approver_id: z.string().min(1),
239
+ at: z.string(),
240
+ })).default([]),
241
+ model_id: z.string().nullable().default(null),
242
+ prompt_version: z.string().nullable().default(null),
243
+ actor: SignalActorSchema,
244
+ });
245
+ /* ============================================================================
246
+ * Response
247
+ * ========================================================================== */
248
+ export const MatchStatusSchema = z.enum([
249
+ "matched",
250
+ "rounded",
251
+ "unmatched",
252
+ "exempt",
253
+ "ambiguous",
254
+ "unevaluable",
255
+ ]);
256
+ /**
257
+ * One number in the draft, with where it came from.
258
+ *
259
+ * Spans exist so the approval page can underline the body and show the source
260
+ * card. `unmatched` red, `rounded` amber, `ambiguous` grey — the colour is the
261
+ * reviewer's entire explanation of why the draft is held.
262
+ */
263
+ export const DraftAnchorSchema = z.object({
264
+ span_start: z.number().int().min(0),
265
+ span_end: z.number().int().min(0),
266
+ raw: z.string(),
267
+ match_status: MatchStatusSchema,
268
+ fact_id: z.string().nullable(),
269
+ unit_class: z.string().nullable().optional(),
270
+ value_norm: z.number().nullable().optional(),
271
+ note: z.string().nullable().optional(),
272
+ });
273
+ export const CheckResultSchema = z.object({
274
+ check_id: z.string(),
275
+ rule_ids: z.array(z.string()).min(1),
276
+ layer: LayerSchema,
277
+ verdict: VerdictSchema,
278
+ severity: SeveritySchema,
279
+ /** The five-state projection. This, and only this, may drive the UI. */
280
+ state: CheckStateSchema,
281
+ /** `null` for deterministic layers — they do not guess, so they do not score. */
282
+ confidence: z.number().min(0).max(1).nullable(),
283
+ /** The judge declined rather than picked a side. Treated as `unevaluable`. */
284
+ abstain_int: z.union([z.literal(0), z.literal(1)]).default(0),
285
+ overridable: z.boolean(),
286
+ overridden_by: z.string().nullable().default(null),
287
+ override_reason: z.string().nullable().default(null),
288
+ /** Human-readable, machine-stable. Enumerated so E-10 can aggregate causes. */
289
+ reason: z.string(),
290
+ evidence: z.unknown().nullable().default(null),
291
+ /** Character ranges in `draft_text` to highlight. Re-verified by `indexOf`. */
292
+ spans: z.array(z.object({ start: z.number().int(), end: z.number().int() })).default([]),
293
+ /** Set when the check never ran because an earlier layer short-circuited. */
294
+ skipped_int: z.union([z.literal(0), z.literal(1)]).default(0),
295
+ });
296
+ export const QChecklistRowSchema = z.object({
297
+ q: z.string(),
298
+ group: z.enum(["fact", "judgement", "copy"]),
299
+ /** docB asks each of the fifteen to be labelled automatic / judge / human. */
300
+ mode: z.enum(["auto", "llm", "human"]),
301
+ state: CheckStateSchema,
302
+ label: z.string(),
303
+ /** What to show under the row. Never a check_id. */
304
+ detail: z.string(),
305
+ /** True when a human tick is required before approval may proceed. */
306
+ requires_tick: z.boolean(),
307
+ });
308
+ export const MustIncludeRowSchema = z.object({
309
+ /** docB rule id of the mandatory element, e.g. `N-W-02`. */
310
+ rule_id: z.string(),
311
+ level: LevelSchema,
312
+ label: z.string(),
313
+ state: CheckStateSchema,
314
+ detail: z.string(),
315
+ /** How it was decided — structured field, body reconciliation, or both. */
316
+ decided_by: z.enum(["structured", "text", "structured+text", "not_applicable"]),
317
+ });
318
+ export const GateDFinalSchema = z.object({
319
+ pass: z.boolean(),
320
+ confidence: z.number().min(0).max(1),
321
+ abstain: z.boolean(),
322
+ reason: z.string(),
323
+ /** D-01..D-05 components the judge could actually cite. Closed enum upstream. */
324
+ components: z.array(z.string()).default([]),
325
+ evidence: z.unknown().nullable().default(null),
326
+ });
327
+ export const ValidateTelemetrySchema = z.object({
328
+ ledger_status: LedgerStatusSchema,
329
+ ledger_rows: z.number().int().min(0),
330
+ source_chars_indexed: z.number().int().min(0),
331
+ tokens_parsed: z.number().int().min(0),
332
+ unmatched: z.number().int().min(0),
333
+ canary_pass_int: z.union([z.literal(0), z.literal(1)]),
334
+ /** The gate suspects itself. Blocking checks degrade to `human` while set. */
335
+ degraded_int: z.union([z.literal(0), z.literal(1)]),
336
+ /** Circuit breaker open: the ledger check has been demoted from block to human. */
337
+ breaker_open_int: z.union([z.literal(0), z.literal(1)]),
338
+ llm_calls: z.number().int().min(0),
339
+ layers_short_circuited: z.array(LayerSchema).default([]),
340
+ duration_ms: z.number().int().min(0),
341
+ });
342
+ export const ValidateDraftResponseSchema = z.object({
343
+ contract_version: z.literal(VALIDATE_DRAFT_CONTRACT_VERSION),
344
+ validator_version: z.string(),
345
+ judge_model: z.string().nullable(),
346
+ judge_version: z.string(),
347
+ evaluated_at: z.string(),
348
+ draft_id: z.string(),
349
+ rev: z.number().int(),
350
+ stage: z.enum(["draft", "final"]),
351
+ text_sha256: z.string(),
352
+ /**
353
+ * The single roll-up.
354
+ *
355
+ * `block` — at least one blocking check failed.
356
+ * `needs_human` — nothing blocks, but something is unevaluable, abstained, or
357
+ * awaits a tick. This is docB H-02's landing zone: neither pass nor fail.
358
+ * `pass` — everything blocking passed and nothing is pending.
359
+ */
360
+ verdict: z.enum(["pass", "block", "needs_human"]),
361
+ gate_d_final: GateDFinalSchema,
362
+ checks: z.array(CheckResultSchema),
363
+ q_checklist: z.array(QChecklistRowSchema).length(15),
364
+ must_include: z.array(MustIncludeRowSchema),
365
+ anchors: z.array(DraftAnchorSchema),
366
+ x_length: z.object({
367
+ weighted: z.number().int(),
368
+ limit: z.number().int(),
369
+ reserve: z.number().int(),
370
+ over_by: z.number().int(),
371
+ url_count: z.number().int(),
372
+ }),
373
+ telemetry: ValidateTelemetrySchema,
374
+ /** Set when the draft must park in `pending_verification` (M-11 / K-02). */
375
+ pending_reason: z.enum([
376
+ "key_fact_unverified",
377
+ "tier1_unavailable",
378
+ "ledger_unevaluable",
379
+ "judge_unavailable",
380
+ ]).nullable().default(null),
381
+ });
382
+ /* ============================================================================
383
+ * Same-source derivation
384
+ * ========================================================================== */
385
+ /**
386
+ * `(verdict, severity)` → the five-state UI value. The ONE place this mapping
387
+ * exists; both the `checks[]` rows and the two views go through it, which is
388
+ * the mechanical reason the three sections cannot disagree.
389
+ *
390
+ * `severity: 'human'` always yields `human` on a non-failing verdict: those
391
+ * checks (Q-01's ledger-diff snapshot, the glossary) are not automatable, and a
392
+ * green tick the reviewer did not make is worse than no tick at all.
393
+ */
394
+ export function stateFor(verdict, severity, options = {}) {
395
+ if (options.overridden)
396
+ return "warn";
397
+ if (verdict === "unevaluable" || options.abstain)
398
+ return "unevaluable";
399
+ if (verdict === "fail") {
400
+ if (severity === "block")
401
+ return "blocked";
402
+ if (severity === "warn")
403
+ return "warn";
404
+ return "human";
405
+ }
406
+ return severity === "human" ? "human" : "pass";
407
+ }
408
+ /** Worst-first ordering, used to roll several checks into one checklist row. */
409
+ const STATE_RANK = {
410
+ blocked: 4,
411
+ unevaluable: 3,
412
+ human: 2,
413
+ warn: 1,
414
+ pass: 0,
415
+ };
416
+ /** Roll a set of states into one. A row is as bad as its worst check. */
417
+ export function worstState(states) {
418
+ let worst = "pass";
419
+ for (const state of states) {
420
+ if (STATE_RANK[state] > STATE_RANK[worst])
421
+ worst = state;
422
+ }
423
+ return worst;
424
+ }
425
+ /** Does this state stop the approve button? Only `blocked` does. */
426
+ export function blocksApproval(state) {
427
+ return state === "blocked";
428
+ }
429
+ /** Does this state require an explicit human tick before approval? */
430
+ export function requiresTick(state) {
431
+ return state === "human" || state === "unevaluable";
432
+ }
433
+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IAAI,OAAO,CAAC,UAAU;QAAE,OAAO,MAAM,CAAC;IACtC,IAAI,OAAO,KAAK,aAAa,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,aAAa,CAAC;IACvE,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,IAAI,QAAQ,KAAK,OAAO;YAAE,OAAO,SAAS,CAAC;QAC3C,IAAI,QAAQ,KAAK,MAAM;YAAE,OAAO,MAAM,CAAC;QACvC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,GAA+B;IAC7C,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;CACR,CAAC;AAEF,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,MAA6B;IACtD,IAAI,KAAK,GAAe,MAAM,CAAC;IAC/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC;YAAE,KAAK,GAAG,KAAK,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,OAAO,KAAK,KAAK,SAAS,CAAC;AAC7B,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,OAAO,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,aAAa,CAAC;AACtD,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * X (Twitter) official **weighted character count** — CONTRACT-FREEZE §C-15.
3
+ *
4
+ * docB P-11 / Q-12 / X-05 all reduce to one number, and that number is NOT
5
+ * `String.prototype.length`. The three traps, verbatim from P-11's hiddenTrap:
6
+ *
7
+ * 1. X counts **weighted** characters. CJK / emoji weigh 2, Latin weighs 1.
8
+ * 2. **Any** URL counts as exactly 23 (t.co), regardless of its real length.
9
+ * 3. The document says "reserve space for a link or tags" but gives no
10
+ * number — so half the rule is untestable until we pick one.
11
+ *
12
+ * dp-center's `rewrite.ts` uses `.length` everywhere (`shortBodyBudget:694`,
13
+ * `capShortCombinedBody:699`, `enforceCharLimit:1059`). For pure ASCII the two
14
+ * agree, which is exactly why the bug survives review: a ZWJ family emoji is 11
15
+ * to JS and 2 to X, and `.length` has no idea a URL is 23. The verified
16
+ * `SHORT_LINK_RESERVE = 25` at `rewrite.ts:688` is 23 (t.co) + 2 (newline), and
17
+ * that already-shipped constant is what fills the X-05 hole: `reserve_chars`
18
+ * defaults to 25 and lives in `signal_settings`, with 25 kept here as the
19
+ * fallback for when config injection fails. So X-05 is closed with a number the
20
+ * repo already agreed to, not a fresh guess.
21
+ *
22
+ * Why vendored rather than `npm i twitter-text`: we need one function and one
23
+ * table of ranges. twitter-text drags three transitive deps for the rest of its
24
+ * surface (extractors, autolinkers, HTML escapers) that we never call.
25
+ *
26
+ * Configuration below is twitter-text v3 `config/v3.json`, verbatim.
27
+ */
28
+ /** twitter-text v3 `config/v3.json`. Do not "tidy" these numbers. */
29
+ export declare const WEIGHTED_RANGES: readonly (readonly [number, number])[];
30
+ /** `transformedURLLength`. Every URL is this, long or short, http or https. */
31
+ export declare const TCO_URL_LENGTH = 23;
32
+ /** `maxWeightedTweetLength`. */
33
+ export declare const X_MAX_WEIGHTED_LENGTH = 280;
34
+ /**
35
+ * Default reserve for the trailing link/tags (X-05).
36
+ *
37
+ * 23 (t.co) + 2 (the separating newline pair) — byte-identical to the verified
38
+ * `SHORT_LINK_RESERVE = 25` at `dp-center-worker/src/lib/content/rewrite.ts:688`.
39
+ * `signal_settings.reserve_chars` overrides it; this is the fallback used when
40
+ * settings cannot be read, so a settings outage cannot silently raise the cap.
41
+ */
42
+ export declare const DEFAULT_RESERVE_CHARS = 25;
43
+ /** Every `https?://…` run in `text`, in order of appearance. */
44
+ export declare function extractUrls(text: string): string[];
45
+ /**
46
+ * X weighted length of `text`.
47
+ *
48
+ * NFC-normalizes first, exactly as twitter-text does: `é` typed as `e` + U+0301
49
+ * is 2 un-normalized and 1 after NFC, and users paste both forms.
50
+ */
51
+ export declare function weightedLength(text: string): number;
52
+ /**
53
+ * Reserve budget (X-05).
54
+ *
55
+ * `base` is `signal_settings.reserve_chars`. Hashtags are charged their own
56
+ * weighted length plus one separating space each, because a tag is not a URL
57
+ * and does not collapse to 23.
58
+ */
59
+ export declare function reserveChars(options: {
60
+ hashtags?: readonly string[];
61
+ base?: number;
62
+ }): number;
63
+ export interface WeightedLengthReport {
64
+ /** X weighted length of the body as written. */
65
+ weighted: number;
66
+ /** Always 280. Kept in the payload so the UI never hard-codes it. */
67
+ limit: number;
68
+ /** Budget withheld for the link/tags that get appended at publish time. */
69
+ reserve: number;
70
+ /** `weighted - (limit - reserve)`, clamped at 0. Non-zero means over. */
71
+ over_by: number;
72
+ /** How many URLs were collapsed to 23. Explains surprising counts to editors. */
73
+ url_count: number;
74
+ }
75
+ /**
76
+ * The single P-11 / Q-12 verdict input.
77
+ *
78
+ * Note the cap is `280 - reserve`, not 280: X-05's whole point is that a post
79
+ * measured at exactly 280 becomes 303 the moment the campaign link is appended,
80
+ * and the human who then deletes words to fit is editing text that already
81
+ * passed fact-checking.
82
+ */
83
+ export declare function measureWeighted(text: string, options?: {
84
+ hashtags?: readonly string[];
85
+ reserveBase?: number;
86
+ }): WeightedLengthReport;
87
+ //# sourceMappingURL=weighted-length.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weighted-length.d.ts","sourceRoot":"","sources":["../../src/signal/weighted-length.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,qEAAqE;AACrE,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAKxD,CAAC;AASX,+EAA+E;AAC/E,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,gCAAgC;AAChC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAwExC,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGlD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BnD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAKT;AAED,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACnE,oBAAoB,CAWtB"}