@gobing-ai/knowledge-kit 0.1.25 → 0.1.28
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/board/collect/index.js +10 -0
- package/dist/board/daily-voice/index.js +1327 -2168
- package/dist/board/itc/index.js +10 -0
- package/dist/index.js +6043 -4620
- package/package.json +1 -1
- package/plugins/ingestions/aihot-ingest/dist/index.js +4 -1
- package/plugins/ingestions/aihot-ingest/src/rss.ts +22 -11
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/cn-lead-gate.ts +494 -0
- package/plugins/kk/scripts/daily-stages.ts +423 -141
- package/plugins/kk/scripts/kk-workflow-stages.ts +53 -3
- package/plugins/kk/skills/news-editorial/SKILL.md +20 -3
- package/plugins/kk/skills/news-editorial/references/selection.md +42 -0
- package/plugins/kk/workflows/kk-news-generate.yaml +1 -1
- package/plugins/publishings/bilibili-pub/dist/index.js +114 -82
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/cnblogs-pub/dist/index.js +114 -82
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/csdn-pub/dist/index.js +114 -82
- package/plugins/publishings/csdn-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/infoq-pub/dist/index.js +114 -82
- package/plugins/publishings/infoq-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/jike-pub/dist/index.js +114 -82
- package/plugins/publishings/jike-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/juejin-pub/dist/index.js +114 -82
- package/plugins/publishings/juejin-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/linkedin-pub/dist/index.js +165 -93
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +51 -6
- package/plugins/publishings/linkedin-pub/src/index.ts +126 -9
- package/plugins/publishings/medium-pub/dist/index.js +114 -82
- package/plugins/publishings/medium-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/shipinhao-pub/dist/index.js +305 -87
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +145 -5
- package/plugins/publishings/shipinhao-pub/src/cover-crop.ts +60 -0
- package/plugins/publishings/shipinhao-pub/src/flow.ts +15 -2
- package/plugins/publishings/shipinhao-pub/src/profile-check.ts +15 -12
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +22 -1
- package/plugins/publishings/sspai-pub/dist/index.js +114 -82
- package/plugins/publishings/sspai-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/substack-pub/dist/index.js +114 -82
- package/plugins/publishings/substack-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/surfdash-pub/dist/index.js +96 -20
- package/plugins/publishings/surfdash-pub/src/index.ts +31 -4
- package/plugins/publishings/surfdash-pub/src/patch.ts +81 -12
- package/plugins/publishings/threads-pub/dist/index.js +119 -83
- package/plugins/publishings/threads-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/threads-pub/src/index.ts +10 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +149 -86
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +68 -4
- package/plugins/publishings/wechatmp-pub/src/index.ts +64 -1
- package/plugins/publishings/weibo-pub/dist/index.js +273 -91
- package/plugins/publishings/weibo-pub/dist/profile-check.js +178 -11
- package/plugins/publishings/weibo-pub/plugin.json +1 -1
- package/plugins/publishings/weibo-pub/src/index.ts +136 -10
- package/plugins/publishings/weibo-pub/src/profile-check.ts +4 -2
- package/plugins/publishings/x-pub/dist/index.js +114 -82
- package/plugins/publishings/x-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/xhs-pub/dist/index.js +114 -82
- package/plugins/publishings/xhs-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +114 -82
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +34 -3
|
@@ -1538,6 +1538,24 @@ function publishMatrixPartial(args: string[]): void {
|
|
|
1538
1538
|
});
|
|
1539
1539
|
}
|
|
1540
1540
|
|
|
1541
|
+
/**
|
|
1542
|
+
* 0432 R2/R3: the warning a skipped cover patch deserves, or undefined when the cover was applied.
|
|
1543
|
+
*
|
|
1544
|
+
* A patch whose only shortfall is the remote cover is NOT a failed target: the post is already live
|
|
1545
|
+
* and its og:image resolves from the CMS row, so reporting the row failed invited a needless
|
|
1546
|
+
* re-publish (2026-11-24 dogfood). The diagnostic is the plugin's `metadata.coverPatch`, and the
|
|
1547
|
+
* page URL is what makes the warning actionable.
|
|
1548
|
+
*/
|
|
1549
|
+
function coverPatchWarning(metadata: Record<string, unknown>, fallbackPageUrl = ''): string | undefined {
|
|
1550
|
+
const coverPatch = metadata.coverPatch;
|
|
1551
|
+
if (coverPatch === null || typeof coverPatch !== 'object' || Array.isArray(coverPatch)) return undefined;
|
|
1552
|
+
const entry = coverPatch as Record<string, unknown>;
|
|
1553
|
+
if (entry.status !== 'skipped') return undefined;
|
|
1554
|
+
const pageUrl = typeof entry.pageUrl === 'string' && entry.pageUrl !== '' ? entry.pageUrl : fallbackPageUrl.trim();
|
|
1555
|
+
const reason = typeof entry.reason === 'string' && entry.reason !== '' ? entry.reason : 'no remote https:// cover';
|
|
1556
|
+
return `patch-surfdash: WARNING: cover patch skipped — ${reason} (page ${pageUrl === '' ? 'unknown' : pageUrl}); the post is already live and its og:image resolves, so nothing is republished`;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1541
1559
|
/**
|
|
1542
1560
|
* `publish-matrix-patch-surfdash` (0333): patch podcast links into a real surfdash post.
|
|
1543
1561
|
*
|
|
@@ -1614,6 +1632,7 @@ function publishMatrixPatchSurfdash(args: string[]): void {
|
|
|
1614
1632
|
typeof podReceipt?.aggregatePath === 'string' ? podReceipt.aggregatePath : undefined,
|
|
1615
1633
|
);
|
|
1616
1634
|
const podMeta = (podTarget.metadata ?? {}) as Record<string, unknown>;
|
|
1635
|
+
const sdMeta = (sdTarget.metadata ?? {}) as Record<string, unknown>;
|
|
1617
1636
|
const runDate = String(readJson(join(publishDir, `outcome.${window}.json`))?.runDate ?? '');
|
|
1618
1637
|
const compactDate = runDate.replaceAll('-', '');
|
|
1619
1638
|
const bundle = readJson(join(workDir, 'bundle.json')) as { episode?: { title?: unknown } } | null;
|
|
@@ -1632,6 +1651,22 @@ function publishMatrixPatchSurfdash(args: string[]): void {
|
|
|
1632
1651
|
: typeof bundle?.episode?.title === 'string'
|
|
1633
1652
|
? bundle.episode.title
|
|
1634
1653
|
: '';
|
|
1654
|
+
// 0432 R1: the cover source, in precedence order.
|
|
1655
|
+
// 1. the podcast row's own media URL (what a successful episode hosts today);
|
|
1656
|
+
// 2. the SURFDASH side's hosted cover — the URL its `publish` uploaded to podcast-media and
|
|
1657
|
+
// now reports in its receipt, which is the only https cover a held podcast row leaves;
|
|
1658
|
+
// 3. this run's rendered cover file, which the plugin uploads itself (`uploadLocalCover`).
|
|
1659
|
+
// Sourcing 2/3 is what stops a live page from failing the patch when `podcast-pub.episode`
|
|
1660
|
+
// is excluded by the safety verdict (2026-11-24 dogfood).
|
|
1661
|
+
const podcastCover = podReal && typeof podMeta.imageUrl === 'string' ? podMeta.imageUrl.trim() : '';
|
|
1662
|
+
const surfdashCover = typeof sdMeta.coverUrl === 'string' ? sdMeta.coverUrl.trim() : '';
|
|
1663
|
+
const coverUrl = podcastCover !== '' ? podcastCover : surfdashCover;
|
|
1664
|
+
const localCover =
|
|
1665
|
+
compactDate.length === 8 && isFile(join(workDir, '23-cover', `${compactDate}_07_cover_cover.png`))
|
|
1666
|
+
? join(workDir, '23-cover', `${compactDate}_07_cover_cover.png`)
|
|
1667
|
+
: '';
|
|
1668
|
+
// 0432 R2: the live page the patch heals, so a cover skip names a URL instead of a slug.
|
|
1669
|
+
const pageUrl = typeof sdTarget.url === 'string' ? sdTarget.url.trim() : '';
|
|
1635
1670
|
const payload = join(publishDir, 'patch-surfdash.payload.json');
|
|
1636
1671
|
sted('write', payload, () =>
|
|
1637
1672
|
writeJqText(payload, {
|
|
@@ -1639,8 +1674,10 @@ function publishMatrixPatchSurfdash(args: string[]): void {
|
|
|
1639
1674
|
options: {
|
|
1640
1675
|
operation: 'patch',
|
|
1641
1676
|
postPath,
|
|
1642
|
-
coverUrl
|
|
1677
|
+
coverUrl,
|
|
1643
1678
|
showNotesUrl: podReal && typeof podTarget.url === 'string' ? podTarget.url : '',
|
|
1679
|
+
...(localCover !== '' ? { localCover } : {}),
|
|
1680
|
+
...(pageUrl !== '' ? { pageUrl } : {}),
|
|
1644
1681
|
...(episodeTitle !== '' ? { episodeTitle } : {}),
|
|
1645
1682
|
...(compactDate.length === 8
|
|
1646
1683
|
? {
|
|
@@ -1663,14 +1700,19 @@ function publishMatrixPatchSurfdash(args: string[]): void {
|
|
|
1663
1700
|
soft: true,
|
|
1664
1701
|
});
|
|
1665
1702
|
const result = readJson(resultPath);
|
|
1703
|
+
const meta = (result?.metadata ?? {}) as Record<string, unknown>;
|
|
1704
|
+
const coverWarning = coverPatchWarning(meta, pageUrl);
|
|
1666
1705
|
if (result?.ok === true) {
|
|
1667
|
-
const meta = (result.metadata ?? {}) as Record<string, unknown>;
|
|
1668
1706
|
console.error(
|
|
1669
1707
|
`patch-surfdash: ${String(result.message ?? 'patched')} — cms-resync ${String(meta.cmsResync ?? 'ok')}`,
|
|
1670
1708
|
);
|
|
1709
|
+
if (coverWarning !== undefined) console.error(coverWarning);
|
|
1671
1710
|
return;
|
|
1672
1711
|
}
|
|
1673
|
-
|
|
1712
|
+
// 0432 R2/R3: a cover the patch could not source is a WARNING, not a failed target — the post
|
|
1713
|
+
// is already live and its og:image resolves. Every other patch failure keeps failing here.
|
|
1714
|
+
// Order matters (review P2): a failed CMS re-sync is a real soft-channel failure and must be
|
|
1715
|
+
// reported as such even when the cover was skipped too, so it is checked first.
|
|
1674
1716
|
if (meta.cmsResync === 'failed') {
|
|
1675
1717
|
// The posts are patched and committed; only the CMS re-sync (a soft channel) failed.
|
|
1676
1718
|
console.error(
|
|
@@ -1678,6 +1720,10 @@ function publishMatrixPatchSurfdash(args: string[]): void {
|
|
|
1678
1720
|
);
|
|
1679
1721
|
return;
|
|
1680
1722
|
}
|
|
1723
|
+
if (coverWarning !== undefined) {
|
|
1724
|
+
console.error(coverWarning);
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1681
1727
|
failWith(1, `patch-surfdash: ${String(result?.error ?? `surfdash-pub patch exited ${status}`)}`);
|
|
1682
1728
|
});
|
|
1683
1729
|
}
|
|
@@ -1925,10 +1971,14 @@ function dailyPatchSurfdash(args: string[]): void {
|
|
|
1925
1971
|
);
|
|
1926
1972
|
const result = isFile(resultPath) ? readJson(resultPath) : null;
|
|
1927
1973
|
const meta = (result?.metadata ?? {}) as Record<string, unknown>;
|
|
1974
|
+
// 0432 R2: the same cover-skip warning the matrix stage reports — the plugin no longer fails
|
|
1975
|
+
// for it, and the operator needs the page URL either way.
|
|
1976
|
+
const coverWarning = coverPatchWarning(meta);
|
|
1928
1977
|
if (result?.ok === true) {
|
|
1929
1978
|
console.error(
|
|
1930
1979
|
`patch-surfdash: ${String(result.message ?? 'patched')} — cms-resync ${String(meta.cmsResync ?? 'ok')}, commit ${String(meta.gitCommit ?? 'unchanged')}${Array.isArray(meta.absentLocales) && meta.absentLocales.length > 0 ? `, no post for ${(meta.absentLocales as string[]).join('/')}` : ''}`,
|
|
1931
1980
|
);
|
|
1981
|
+
if (coverWarning !== undefined) console.error(coverWarning);
|
|
1932
1982
|
return;
|
|
1933
1983
|
}
|
|
1934
1984
|
// The posts are patched and committed; only the EmDash rows keep the unservable cover. That is
|
|
@@ -68,7 +68,21 @@ validator enforces mechanically, so violating them means the plan is rejected.
|
|
|
68
68
|
corroborates it. Unverified inference has exactly two legal shapes — explicit attribution (据报道 / 当事人称 /
|
|
69
69
|
公司未证实) or omission. Keep hedges (据报道 / 称 / 承诺); never add scaffold hedges (读者宜另行核实 /
|
|
70
70
|
仍待验证) to look careful. If the material is thin, write less — omission is the default, not a softening.
|
|
71
|
-
4. **
|
|
71
|
+
4. **CN lead constraint (0433 R1/R2 — enforceable, not advisory).** Every episode this skill plans is
|
|
72
|
+
written for a CN-distributed cut (小宇宙 / 微信公众号 / 视频号 / 即刻) as well as the overseas surfaces.
|
|
73
|
+
A mainline in **时政 / 贸易管制 / 公共安全审查** — political affairs, export or trade controls,
|
|
74
|
+
state-/public-security review, foreign-intelligence framing — must **not** be the episode's lead title,
|
|
75
|
+
headline or summary on that cut: platform review items `XY-02`
|
|
76
|
+
(`../content-safety/references/platforms/xiaoyuzhou.md`) and `WX-01` (`.../wechatmp.md`) block it, and a
|
|
77
|
+
blocked lead costs the day its primary channel *after* the audio is paid for. Such a story usually stays
|
|
78
|
+
**in scope as an item** (shared rule 2 keeps export controls and regulation that decide AI capacity
|
|
79
|
+
reportable) — it is the **lead position** that is constrained, not the story. Chosen behaviour when the
|
|
80
|
+
blocked story is the day's biggest: **demote it to a body item with a neutral headline and let the first
|
|
81
|
+
clean in-scope story lead** (one cut, one synthesis bill, no second render path; tradeoff recorded in
|
|
82
|
+
`references/selection.md` § CN lead). `daily-curate-check` enforces this deterministically
|
|
83
|
+
(`plugins/kk/scripts/cn-lead-gate.ts`) and rejects the plan with rule `cn-lead:XY-02`, naming the matched
|
|
84
|
+
terms — that rejection is the instruction, not a warning.
|
|
85
|
+
5. **Copy discipline.** Use reader-facing spoken Chinese. Do not use scaffold labels (可做角度 / 背景 /
|
|
72
86
|
潜在影响) or hedge labels (读者宜另行核实 / 仍待验证), use 「」 for quotes, and never add a greeting,
|
|
73
87
|
sign-off or AI-production footer. The builder adds those.
|
|
74
88
|
|
|
@@ -95,7 +109,10 @@ At the episode level, write:
|
|
|
95
109
|
- `cover`: either one concrete visual scene in English (a plain string, ≤240 chars: objects, settings, symbols, metaphor; no text, letters, numbers, logos, flags, or recognizable people — compose it per `references/daily-visual-composition.md`) or — required for the 0385 R4 title — the object form
|
|
96
110
|
`{ "scene": "…", "headline": "…", "sourceIds": ["<plan item id>"] }`:
|
|
97
111
|
- `headline` (required, ≤25 chars): the 当日要点 the episode title freezes — one line, the day's most important
|
|
98
|
-
development in plain language, no date/issue/column name. The title prefix supplies the rest.
|
|
112
|
+
development in plain language, no date/issue/column name. The title prefix supplies the rest. **This title
|
|
113
|
+
publishes to the CN channels, so it obeys shared rule 4 too:** when the day's biggest story was demoted for
|
|
114
|
+
the CN lead constraint, the headline anchors the story that now leads instead — never restate the demoted
|
|
115
|
+
mainline's 时政/贸易管制/公共安全审查 framing as the episode's 当日要点.
|
|
99
116
|
- `scene` (optional for validation, but then the cover image falls back to the default subject): same English
|
|
100
117
|
visual contract as the string form.
|
|
101
118
|
- `sourceIds` (optional): the plan item id(s) the point rests on — normally the lead. Name them so that when
|
|
@@ -157,7 +174,7 @@ See `references/selection.md`. Reads QC candidates (`--in`) and writes two JSON
|
|
|
157
174
|
1. `--out-plan` (`21-plan/<date>_03_plan_plan.json`): bare `Doc[]` of **kept** items only, in editorial order (lead first), with `title`, `body` and `metadata.brief` adapted into spoken simplified Chinese.
|
|
158
175
|
2. `--out-excluded` (`21-plan/<date>_03_curate_excluded.json`): `[{"id":"<Doc.id>","reason":"<具体中文原因>"}]` for every dropped candidate (`[]` when none dropped). Every candidate id must land in **exactly one** of the two files.
|
|
159
176
|
|
|
160
|
-
With `--fix <errors.json>` (`missing-plan`, `invalid-json`, `unknown-id`, `missing-item`, `conflict-id`, `empty-plan`), repair the partition so every candidate id is accounted for exactly once and at least one in-scope item is kept.
|
|
177
|
+
With `--fix <errors.json>` (`missing-plan`, `invalid-json`, `unknown-id`, `missing-item`, `conflict-id`, `empty-plan`, `cn-lead:XY-02`), repair the partition so every candidate id is accounted for exactly once and at least one in-scope item is kept. `cn-lead:XY-02` (its `detail` carries the matched terms and the message) is not an inventory problem: move that item out of the lead position and rewrite its title/`metadata.brief` into a neutral headline that names the AI-industry fact, keeping every fact and number — see `references/selection.md` § CN lead.
|
|
161
178
|
|
|
162
179
|
## Mode: align
|
|
163
180
|
|
|
@@ -32,6 +32,44 @@ Every candidate `id` from `21-plan/<date>_04_quality-control-content_candidates.
|
|
|
32
32
|
gives the per-driver character rates. If kept items cannot reach the floor, keep more in-scope items rather
|
|
33
33
|
than padding.
|
|
34
34
|
|
|
35
|
+
## CN lead constraint (0433)
|
|
36
|
+
|
|
37
|
+
The plan feeds a **CN-distributed cut** (小宇宙 / 微信公众号 / 视频号 / 即刻) and the overseas surfaces from the
|
|
38
|
+
same script. Platform review items `XY-02` (`../content-safety/references/platforms/xiaoyuzhou.md`) and `WX-01`
|
|
39
|
+
(`.../wechatmp.md`) block a 单集 whose mainline is **时政 / 贸易管制 / 公共安全审查** — political affairs, export
|
|
40
|
+
or trade controls (出口管制/实体清单/关税/制裁), state- or public-security review (国家安全审查/情报/审查委员会),
|
|
41
|
+
foreign-intelligence framing. So:
|
|
42
|
+
|
|
43
|
+
- **Never lead a CN cut with that mainline.** It may not be the lead title, the cover headline or the episode
|
|
44
|
+
summary. It normally stays in scope as an **item** (SKILL.md shared rule 2 keeps regulation and export
|
|
45
|
+
controls that decide AI capacity reportable, and the 2026-11-24 operator ruling grades an overseas vendor
|
|
46
|
+
under its own regulator as `note`); only the lead position is constrained.
|
|
47
|
+
- **Chosen behaviour when it is also the day's biggest story: demote.** Move it to the best body position and
|
|
48
|
+
lead with the first clean in-scope story, and rewrite the demoted title/`metadata.brief` as a neutral
|
|
49
|
+
headline that names the AI-industry fact (融资、产能、客户、定价、产品) instead of the state-security or
|
|
50
|
+
trade-control framing. Keep every fact, number and name — this is a framing change, never a fact change.
|
|
51
|
+
- **Tradeoff, recorded.** The alternative was **two cuts** (a CN lead and an overseas lead). The pipeline
|
|
52
|
+
ships one zh script, one TTS pass and one bundle, so two leads would mean a second render path, a second
|
|
53
|
+
headline slot and two audio variants — far more than the day's loss. Demote keeps one cut and one
|
|
54
|
+
synthesis bill, at the cost of the CN surface not leading with the day's biggest story. If the losing
|
|
55
|
+
story is genuinely the only consequential one, the run refuses before synthesis instead
|
|
56
|
+
(`daily-curate-check --final` writes `21-plan/<date>_03_cn-lead-refusal.json` and exits non-zero rather
|
|
57
|
+
than pay for an episode the CN rows would drop afterwards).
|
|
58
|
+
- **Enforced in code, not by this prose.** `daily-curate-check` runs `plugins/kk/scripts/cn-lead-gate.ts` on
|
|
59
|
+
the lead (plan index 0). The scanned surface is the `title` plus the first of `metadata.brief` / `summary` /
|
|
60
|
+
the body's first sentence — the same fallback the CN show notes use. A trip rejects the plan with rule
|
|
61
|
+
`cn-lead:XY-02`, naming the matched terms in the error's `detail`. The vocabulary lives in that module,
|
|
62
|
+
which cites `XY-02`/`WX-01` as its source of truth — re-verify against the platform files when a platform
|
|
63
|
+
ruling changes.
|
|
64
|
+
- **Weak-lead fallback (0438).** On `--final`, when no candidate is clean, the first candidate whose hits all
|
|
65
|
+
come from the two-signal heuristic (AI object × policy signal — it also fires on some product copy) leads,
|
|
66
|
+
and the run logs `weak lead <id> (<terms>)` instead of refusing. The refusal is kept for a pool where every
|
|
67
|
+
candidate carries an enumerated vocabulary term.
|
|
68
|
+
- **Re-measure before changing the gate.** `plugins/kk/tests/fixtures/cn-lead-calibration.json` holds 30
|
|
69
|
+
class leads (≥28 must trip), 86 product leads (≤3 may trip) and the accepted misses; run
|
|
70
|
+
`bun test plugins/kk/tests/cn-lead-gate-0438.test.ts`. Add rows for a new shape; never edit a row after
|
|
71
|
+
seeing the gate's output, and pin each new term or actor with a class row that goes clean without it.
|
|
72
|
+
|
|
35
73
|
## Spoken Chinese adaptation
|
|
36
74
|
|
|
37
75
|
For kept items (especially those marked `needsTranslation`), adapt `title`, `body` and `metadata.brief` into spoken simplified Chinese:
|
|
@@ -49,3 +87,7 @@ When `daily-curate-check` writes `21-plan/<date>_03_curate_errors.json` (`[{ "it
|
|
|
49
87
|
- `missing-item`: add the missing candidate id either to `--out-plan` (translated) or to `--out-excluded` (with a Chinese reason).
|
|
50
88
|
- `conflict-id`: remove the id from one of the two files so it appears in only one.
|
|
51
89
|
- `unknown-id`: remove any id that does not exist in `candidates.json`'s `metadata.docs`.
|
|
90
|
+
- `cn-lead:XY-02`: the lead (plan index 0) carries a 时政/贸易管制/公共安全审查 mainline in its `title` or
|
|
91
|
+
`metadata.brief`; the error's `detail` names the matched terms. Demote that item to a body position, lead
|
|
92
|
+
with the first clean in-scope story, and rewrite the demoted `title`/`metadata.brief` into a neutral headline
|
|
93
|
+
(see § CN lead). Do **not** drop the item: it is still reportable, just not as the lead.
|
|
@@ -258,7 +258,7 @@ nodes:
|
|
|
258
258
|
Content to evaluate: ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
|
|
259
259
|
Plan docs reference: ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
|
|
260
260
|
Rubric: news-balance
|
|
261
|
-
Load the rubric definition from
|
|
261
|
+
Load the rubric definition from ${vars.visual_skill_root}/content-judge/references/rubrics.md (section: news-balance) and the contract from ${vars.visual_skill_root}/content-judge/SKILL.md.
|
|
262
262
|
Evaluate the script plan against every criterion in news-balance (news-first, commentary-share, no-restatement, tech-depth, ordering).
|
|
263
263
|
Write the verdict JSON (with confidence HIGH | MEDIUM | LOW) to ${vars.work_dir}/24-script/${vars.run_date}_08_editorial-judge_verdict.json.
|
|
264
264
|
expectFile: ${vars.work_dir}/24-script/${vars.run_date}_08_editorial-judge_verdict.json
|
|
@@ -20171,6 +20171,86 @@ var ATTACHED_CLOSERS = new Set(["\u201D", "\u2019", "\u300D", "\u300F", "\uFF09"
|
|
|
20171
20171
|
import { homedir } from "os";
|
|
20172
20172
|
import { join, resolve } from "path";
|
|
20173
20173
|
|
|
20174
|
+
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20175
|
+
import {
|
|
20176
|
+
chmodSync,
|
|
20177
|
+
closeSync,
|
|
20178
|
+
copyFileSync,
|
|
20179
|
+
lstatSync,
|
|
20180
|
+
mkdirSync as mkdirSync2,
|
|
20181
|
+
openSync,
|
|
20182
|
+
readdirSync as readdirSync2,
|
|
20183
|
+
readlinkSync,
|
|
20184
|
+
realpathSync as realpathSync2,
|
|
20185
|
+
renameSync as renameSync2,
|
|
20186
|
+
rmdirSync,
|
|
20187
|
+
unlinkSync
|
|
20188
|
+
} from "fs";
|
|
20189
|
+
function lstat(path) {
|
|
20190
|
+
try {
|
|
20191
|
+
return lstatSync(path);
|
|
20192
|
+
} catch (error) {
|
|
20193
|
+
if (error.code === "ENOENT")
|
|
20194
|
+
return null;
|
|
20195
|
+
throw error;
|
|
20196
|
+
}
|
|
20197
|
+
}
|
|
20198
|
+
function realpath(path) {
|
|
20199
|
+
return realpathSync2(path);
|
|
20200
|
+
}
|
|
20201
|
+
function mkdirExclusive(path, mode = 448) {
|
|
20202
|
+
try {
|
|
20203
|
+
mkdirSync2(path, { mode });
|
|
20204
|
+
return true;
|
|
20205
|
+
} catch (error) {
|
|
20206
|
+
if (error.code === "EEXIST")
|
|
20207
|
+
return false;
|
|
20208
|
+
throw error;
|
|
20209
|
+
}
|
|
20210
|
+
}
|
|
20211
|
+
function rmdir(path) {
|
|
20212
|
+
try {
|
|
20213
|
+
rmdirSync(path);
|
|
20214
|
+
return true;
|
|
20215
|
+
} catch (error) {
|
|
20216
|
+
const code = error.code;
|
|
20217
|
+
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20218
|
+
return false;
|
|
20219
|
+
throw error;
|
|
20220
|
+
}
|
|
20221
|
+
}
|
|
20222
|
+
function readlink(path) {
|
|
20223
|
+
try {
|
|
20224
|
+
return readlinkSync(path);
|
|
20225
|
+
} catch {
|
|
20226
|
+
return null;
|
|
20227
|
+
}
|
|
20228
|
+
}
|
|
20229
|
+
function unlink(path) {
|
|
20230
|
+
try {
|
|
20231
|
+
unlinkSync(path);
|
|
20232
|
+
return true;
|
|
20233
|
+
} catch (error) {
|
|
20234
|
+
if (error.code === "ENOENT")
|
|
20235
|
+
return false;
|
|
20236
|
+
throw error;
|
|
20237
|
+
}
|
|
20238
|
+
}
|
|
20239
|
+
function rename(from, to) {
|
|
20240
|
+
try {
|
|
20241
|
+
renameSync2(from, to);
|
|
20242
|
+
return true;
|
|
20243
|
+
} catch (error) {
|
|
20244
|
+
if (error.code === "ENOENT")
|
|
20245
|
+
return false;
|
|
20246
|
+
throw error;
|
|
20247
|
+
}
|
|
20248
|
+
}
|
|
20249
|
+
function chmod(path, mode) {
|
|
20250
|
+
chmodSync(path, mode);
|
|
20251
|
+
}
|
|
20252
|
+
|
|
20253
|
+
// ../../packages/publish-harness/src/index.ts
|
|
20174
20254
|
class FakeTransportCore {
|
|
20175
20255
|
callLogs = [];
|
|
20176
20256
|
nextResult;
|
|
@@ -20437,85 +20517,6 @@ init_dist();
|
|
|
20437
20517
|
import { homedir as homedir4 } from "os";
|
|
20438
20518
|
import { isAbsolute, join as join4, relative, resolve as resolve4, sep } from "path";
|
|
20439
20519
|
|
|
20440
|
-
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20441
|
-
import {
|
|
20442
|
-
chmodSync,
|
|
20443
|
-
closeSync,
|
|
20444
|
-
copyFileSync,
|
|
20445
|
-
lstatSync,
|
|
20446
|
-
mkdirSync as mkdirSync2,
|
|
20447
|
-
openSync,
|
|
20448
|
-
readdirSync as readdirSync2,
|
|
20449
|
-
readlinkSync,
|
|
20450
|
-
realpathSync as realpathSync2,
|
|
20451
|
-
renameSync as renameSync2,
|
|
20452
|
-
rmdirSync,
|
|
20453
|
-
unlinkSync
|
|
20454
|
-
} from "fs";
|
|
20455
|
-
function lstat(path) {
|
|
20456
|
-
try {
|
|
20457
|
-
return lstatSync(path);
|
|
20458
|
-
} catch (error) {
|
|
20459
|
-
if (error.code === "ENOENT")
|
|
20460
|
-
return null;
|
|
20461
|
-
throw error;
|
|
20462
|
-
}
|
|
20463
|
-
}
|
|
20464
|
-
function realpath(path) {
|
|
20465
|
-
return realpathSync2(path);
|
|
20466
|
-
}
|
|
20467
|
-
function mkdirExclusive(path, mode = 448) {
|
|
20468
|
-
try {
|
|
20469
|
-
mkdirSync2(path, { mode });
|
|
20470
|
-
return true;
|
|
20471
|
-
} catch (error) {
|
|
20472
|
-
if (error.code === "EEXIST")
|
|
20473
|
-
return false;
|
|
20474
|
-
throw error;
|
|
20475
|
-
}
|
|
20476
|
-
}
|
|
20477
|
-
function rmdir(path) {
|
|
20478
|
-
try {
|
|
20479
|
-
rmdirSync(path);
|
|
20480
|
-
return true;
|
|
20481
|
-
} catch (error) {
|
|
20482
|
-
const code = error.code;
|
|
20483
|
-
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20484
|
-
return false;
|
|
20485
|
-
throw error;
|
|
20486
|
-
}
|
|
20487
|
-
}
|
|
20488
|
-
function readlink(path) {
|
|
20489
|
-
try {
|
|
20490
|
-
return readlinkSync(path);
|
|
20491
|
-
} catch {
|
|
20492
|
-
return null;
|
|
20493
|
-
}
|
|
20494
|
-
}
|
|
20495
|
-
function unlink(path) {
|
|
20496
|
-
try {
|
|
20497
|
-
unlinkSync(path);
|
|
20498
|
-
return true;
|
|
20499
|
-
} catch (error) {
|
|
20500
|
-
if (error.code === "ENOENT")
|
|
20501
|
-
return false;
|
|
20502
|
-
throw error;
|
|
20503
|
-
}
|
|
20504
|
-
}
|
|
20505
|
-
function rename(from, to) {
|
|
20506
|
-
try {
|
|
20507
|
-
renameSync2(from, to);
|
|
20508
|
-
return true;
|
|
20509
|
-
} catch (error) {
|
|
20510
|
-
if (error.code === "ENOENT")
|
|
20511
|
-
return false;
|
|
20512
|
-
throw error;
|
|
20513
|
-
}
|
|
20514
|
-
}
|
|
20515
|
-
function chmod(path, mode) {
|
|
20516
|
-
chmodSync(path, mode);
|
|
20517
|
-
}
|
|
20518
|
-
|
|
20519
20520
|
// ../../packages/publish-harness/src/bot-transaction.ts
|
|
20520
20521
|
import { homedir as homedir2 } from "os";
|
|
20521
20522
|
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
@@ -20540,7 +20541,12 @@ async function acquireProfileLease(profileDir, options = {}) {
|
|
|
20540
20541
|
const leaseDir = join3(leaseRoot, id);
|
|
20541
20542
|
await fileSystem.ensureDir(leaseRoot);
|
|
20542
20543
|
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20543
|
-
|
|
20544
|
+
if (!await reclaimDeadOwnerLease(fileSystem, leaseDir)) {
|
|
20545
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20546
|
+
}
|
|
20547
|
+
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20548
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20549
|
+
}
|
|
20544
20550
|
}
|
|
20545
20551
|
const token = randomBytes(16).toString("hex");
|
|
20546
20552
|
const owner = {
|
|
@@ -20656,9 +20662,35 @@ async function busyGuidance(fileSystem, leaseDir) {
|
|
|
20656
20662
|
}
|
|
20657
20663
|
return `browser lease ${leaseDir} already exists with no owner record \u2014 a previous run may have crashed mid-acquire; confirm no kk browser still uses this profile, then remove ${leaseDir} manually`;
|
|
20658
20664
|
}
|
|
20659
|
-
const
|
|
20665
|
+
const live = isProcessAlive(owner.pid) ? [] : await liveChildHolders(fileSystem, leaseDir);
|
|
20666
|
+
const suffix = live.length > 0 ? `pid ${owner.pid} is gone but child holders ${live.join(", ")} are still running \u2014 stop those processes before retrying` : isProcessAlive(owner.pid) ? "confirm that process and any browser for this profile have stopped; stale ownership is never auto-removed" : `pid ${owner.pid} is no longer running and the lease could not be reclassified \u2014 confirm no browser for this profile is open, then remove the stale lease with: rm -rf ${leaseDir}`;
|
|
20660
20667
|
return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
|
|
20661
20668
|
}
|
|
20669
|
+
async function reclaimDeadOwnerLease(fileSystem, leaseDir) {
|
|
20670
|
+
const owner = await readOwner(fileSystem, leaseDir);
|
|
20671
|
+
if (owner === null || isProcessAlive(owner.pid))
|
|
20672
|
+
return false;
|
|
20673
|
+
if ((await liveChildHolders(fileSystem, leaseDir)).length > 0)
|
|
20674
|
+
return false;
|
|
20675
|
+
const target = staleLeaseDir(leaseDir);
|
|
20676
|
+
try {
|
|
20677
|
+
rename(leaseDir, target);
|
|
20678
|
+
} catch {
|
|
20679
|
+
return false;
|
|
20680
|
+
}
|
|
20681
|
+
const moved = await readOwner(fileSystem, target);
|
|
20682
|
+
if (moved !== null && moved.token !== owner.token) {
|
|
20683
|
+
try {
|
|
20684
|
+
rename(target, leaseDir);
|
|
20685
|
+
} catch {}
|
|
20686
|
+
return false;
|
|
20687
|
+
}
|
|
20688
|
+
return true;
|
|
20689
|
+
}
|
|
20690
|
+
function staleLeaseDir(leaseDir) {
|
|
20691
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "").slice(0, 15);
|
|
20692
|
+
return `${leaseDir}.stale-${stamp}-${process.pid}-${randomBytes(3).toString("hex")}`;
|
|
20693
|
+
}
|
|
20662
20694
|
async function holderResidue(fileSystem, leaseDir) {
|
|
20663
20695
|
try {
|
|
20664
20696
|
const entries = await fileSystem.readDir(leaseDir);
|
|
@@ -20782,7 +20814,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20782
20814
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20783
20815
|
if (lstat(syncData) === null)
|
|
20784
20816
|
return false;
|
|
20785
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20817
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20786
20818
|
}
|
|
20787
20819
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20788
20820
|
return {
|
|
@@ -19947,7 +19947,12 @@ async function acquireProfileLease(profileDir, options = {}) {
|
|
|
19947
19947
|
const leaseDir = join2(leaseRoot, id);
|
|
19948
19948
|
await fileSystem.ensureDir(leaseRoot);
|
|
19949
19949
|
if (!mkdirExclusive(leaseDir, 448)) {
|
|
19950
|
-
|
|
19950
|
+
if (!await reclaimDeadOwnerLease(fileSystem, leaseDir)) {
|
|
19951
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
19952
|
+
}
|
|
19953
|
+
if (!mkdirExclusive(leaseDir, 448)) {
|
|
19954
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
19955
|
+
}
|
|
19951
19956
|
}
|
|
19952
19957
|
const token = randomBytes(16).toString("hex");
|
|
19953
19958
|
const owner = {
|
|
@@ -20063,9 +20068,35 @@ async function busyGuidance(fileSystem, leaseDir) {
|
|
|
20063
20068
|
}
|
|
20064
20069
|
return `browser lease ${leaseDir} already exists with no owner record \u2014 a previous run may have crashed mid-acquire; confirm no kk browser still uses this profile, then remove ${leaseDir} manually`;
|
|
20065
20070
|
}
|
|
20066
|
-
const
|
|
20071
|
+
const live = isProcessAlive(owner.pid) ? [] : await liveChildHolders(fileSystem, leaseDir);
|
|
20072
|
+
const suffix = live.length > 0 ? `pid ${owner.pid} is gone but child holders ${live.join(", ")} are still running \u2014 stop those processes before retrying` : isProcessAlive(owner.pid) ? "confirm that process and any browser for this profile have stopped; stale ownership is never auto-removed" : `pid ${owner.pid} is no longer running and the lease could not be reclassified \u2014 confirm no browser for this profile is open, then remove the stale lease with: rm -rf ${leaseDir}`;
|
|
20067
20073
|
return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
|
|
20068
20074
|
}
|
|
20075
|
+
async function reclaimDeadOwnerLease(fileSystem, leaseDir) {
|
|
20076
|
+
const owner = await readOwner(fileSystem, leaseDir);
|
|
20077
|
+
if (owner === null || isProcessAlive(owner.pid))
|
|
20078
|
+
return false;
|
|
20079
|
+
if ((await liveChildHolders(fileSystem, leaseDir)).length > 0)
|
|
20080
|
+
return false;
|
|
20081
|
+
const target = staleLeaseDir(leaseDir);
|
|
20082
|
+
try {
|
|
20083
|
+
rename(leaseDir, target);
|
|
20084
|
+
} catch {
|
|
20085
|
+
return false;
|
|
20086
|
+
}
|
|
20087
|
+
const moved = await readOwner(fileSystem, target);
|
|
20088
|
+
if (moved !== null && moved.token !== owner.token) {
|
|
20089
|
+
try {
|
|
20090
|
+
rename(target, leaseDir);
|
|
20091
|
+
} catch {}
|
|
20092
|
+
return false;
|
|
20093
|
+
}
|
|
20094
|
+
return true;
|
|
20095
|
+
}
|
|
20096
|
+
function staleLeaseDir(leaseDir) {
|
|
20097
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "").slice(0, 15);
|
|
20098
|
+
return `${leaseDir}.stale-${stamp}-${process.pid}-${randomBytes(3).toString("hex")}`;
|
|
20099
|
+
}
|
|
20069
20100
|
async function holderResidue(fileSystem, leaseDir) {
|
|
20070
20101
|
try {
|
|
20071
20102
|
const entries = await fileSystem.readDir(leaseDir);
|
|
@@ -20213,7 +20244,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20213
20244
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20214
20245
|
if (lstat(syncData) === null)
|
|
20215
20246
|
return false;
|
|
20216
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20247
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20217
20248
|
}
|
|
20218
20249
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20219
20250
|
return {
|