@gobing-ai/knowledge-kit 0.1.14 → 0.1.16
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/index.js +2399 -177
- package/package.json +1 -1
- package/plugins/generations/content-gen/dist/index.js +60 -54
- package/plugins/generations/content-gen/src/storm.ts +94 -61
- package/plugins/generations/core-facts-gen/dist/index.js +3 -3
- package/plugins/generations/daily-article-gen/dist/index.js +3 -3
- package/plugins/generations/dailynews-gen/dist/index.js +73 -10
- package/plugins/generations/dailynews-gen/src/index.ts +23 -1
- package/plugins/generations/dailynews-gen/src/script-plan.ts +103 -5
- package/plugins/generations/episode-plan-gen/dist/index.js +3 -3
- package/plugins/generations/gemini-tts/dist/index.js +3 -3
- package/plugins/generations/image-gen/README.md +31 -10
- package/plugins/generations/image-gen/assets/sample/cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__clean-webapp-ui.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__cute.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__daily-news.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__editorial.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__fresh.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__minimalist.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__photorealistic.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__sketch.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__technical-diagram.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__vibrant.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__warm.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__xhs-knowledge.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/free__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/illustration__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/xhs-card__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/dist/index.js +3 -3
- package/plugins/generations/image-gen/presets/formats/daily-news-podcast-cover.yaml +18 -0
- package/plugins/generations/image-gen/presets/styles/quasi-news-podcast.yaml +9 -0
- package/plugins/generations/news-report-gen/dist/index.js +3 -3
- package/plugins/generations/voice-gen/dist/index.js +3 -3
- package/plugins/generations/voxcpm-tts/dist/index.js +3 -3
- package/plugins/ingestions/aihot-ingest/dist/index.js +3 -3
- package/plugins/ingestions/horizon-ingest/dist/index.js +3 -3
- package/plugins/ingestions/last30days-ingest/dist/index.js +3 -3
- package/plugins/ingestions/web-search/dist/index.js +3 -3
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice-migration.json +12 -3
- package/plugins/kk/publish-presets/daily-ai-voice.json +11 -3
- package/plugins/kk/scripts/cover-compositor.ts +152 -0
- package/plugins/kk/scripts/daily-cover-mock.ts +164 -0
- package/plugins/kk/scripts/daily-scheduled-run.ts +192 -3
- package/plugins/kk/scripts/daily-stages.ts +599 -27
- package/plugins/kk/scripts/daily-triage-core.ts +451 -0
- package/plugins/kk/scripts/daily-triage.ts +74 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +51 -6
- package/plugins/kk/skills/content-judge/SKILL.md +5 -4
- package/plugins/kk/skills/content-judge/references/rubrics.md +14 -0
- package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +16 -10
- package/plugins/kk/skills/news-editorial/SKILL.md +122 -0
- package/plugins/kk/skills/news-editorial/references/selection.md +47 -0
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +100 -0
- package/plugins/kk/skills/publish/SKILL.md +4 -4
- package/plugins/kk/skills/web-automation/SKILL.md +229 -77
- package/plugins/kk/skills/web-automation/references/browser-launch.md +127 -36
- package/plugins/kk/skills/wiki-authoring/SKILL.md +53 -0
- package/plugins/kk/skills/wiki-authoring/references/page-shapes.md +44 -0
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -6
- package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +185 -224
- package/plugins/kk/workflows/kk-daily-publish3.yaml +16 -8
- package/plugins/kk/workflows/kk-daily-safety.yaml +32 -7
- package/plugins/publishings/bilibili-pub/dist/index.js +6 -4
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/cnblogs-pub/dist/index.js +6 -4
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/csdn-pub/dist/index.js +6 -4
- package/plugins/publishings/csdn-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/emdash-pub/dist/index.js +3 -3
- package/plugins/publishings/infoq-pub/dist/index.js +6 -4
- package/plugins/publishings/infoq-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/jike-pub/dist/index.js +6 -4
- package/plugins/publishings/jike-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/juejin-pub/dist/index.js +6 -4
- package/plugins/publishings/juejin-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/linkedin-pub/dist/index.js +6 -4
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/medium-pub/dist/index.js +3 -3
- package/plugins/publishings/podcast-pub/dist/index.js +148 -5
- package/plugins/publishings/podcast-pub/src/index.ts +71 -2
- package/plugins/publishings/podcast-pub/src/map.ts +3 -0
- package/plugins/publishings/podcast-pub/src/transcript.ts +195 -0
- package/plugins/publishings/qiita-pub/dist/index.js +3 -3
- package/plugins/publishings/shipinhao-pub/dist/index.js +227 -53
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +51 -2
- package/plugins/publishings/shipinhao-pub/plugin.json +2 -2
- package/plugins/publishings/shipinhao-pub/src/flow.ts +335 -79
- package/plugins/publishings/shipinhao-pub/src/index.ts +16 -8
- package/plugins/publishings/shipinhao-pub/src/profile-check.ts +1 -1
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +103 -5
- package/plugins/publishings/sspai-pub/dist/index.js +6 -4
- package/plugins/publishings/sspai-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/substack-pub/dist/index.js +6 -4
- package/plugins/publishings/substack-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/surfdash-pub/dist/index.js +237 -14
- package/plugins/publishings/surfdash-pub/src/index.ts +127 -6
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +189 -0
- package/plugins/publishings/threads-pub/dist/index.js +3 -3
- package/plugins/publishings/wechatmp-pub/dist/index.js +62 -40
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +10 -3
- package/plugins/publishings/wechatmp-pub/src/flow.ts +73 -37
- package/plugins/publishings/wechatmp-pub/src/page.ts +14 -0
- package/plugins/publishings/weibo-pub/dist/index.js +6 -4
- package/plugins/publishings/weibo-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/x-pub/dist/index.js +6 -4
- package/plugins/publishings/x-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/xhs-pub/dist/index.js +562 -34
- package/plugins/publishings/xhs-pub/dist/profile-check.js +25 -4
- package/plugins/publishings/xhs-pub/src/errors.ts +45 -0
- package/plugins/publishings/xhs-pub/src/flow.ts +773 -45
- package/plugins/publishings/xhs-pub/src/page.ts +33 -0
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +6 -4
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/zenn-pub/dist/index.js +3 -3
- package/plugins/kk/scripts/daily-voice-style.zh.md +0 -70
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic daily-topics.json upsert for digest posts (zh/en/ja).
|
|
3
|
+
*
|
|
4
|
+
* Headlines, descriptions, and claims are copied from existing post frontmatter —
|
|
5
|
+
* never invented. `claim_basis` is left unset so `sd seo retitle --write --stamp-claims`
|
|
6
|
+
* can stamp it. Upsert is idempotent and always writes a given slug key once, so a
|
|
7
|
+
* file that already had a duplicated key (the surfdash #30 merge failure) is collapsed
|
|
8
|
+
* on rewrite.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { dirname } from 'node:path';
|
|
12
|
+
import { createNodeFileSystem, type FileSystem } from '@gobing-ai/ts-runtime';
|
|
13
|
+
import { DIGEST_TAG, parseFrontmatterScalars } from './digest-check';
|
|
14
|
+
import { PATCH_LOCALES, type PatchLocale, SERIES_NAMES } from './patch';
|
|
15
|
+
|
|
16
|
+
/** One locale's topic-map fields. `claim_basis` is stamped later by retitle. */
|
|
17
|
+
export interface DailyTopicsLocaleEntry {
|
|
18
|
+
headlines: string[];
|
|
19
|
+
description: string;
|
|
20
|
+
key_points: string[];
|
|
21
|
+
claims: string[];
|
|
22
|
+
short_claims: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The three-locale value stored under a day's slug in daily-topics.json. */
|
|
26
|
+
export type DailyTopicsEntry = Record<PatchLocale, DailyTopicsLocaleEntry>;
|
|
27
|
+
|
|
28
|
+
export type BuildDailyTopicsResult = { ok: true; entry: DailyTopicsEntry } | { ok: false; error: string };
|
|
29
|
+
|
|
30
|
+
const escapeRe = (token: string): string => token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
31
|
+
|
|
32
|
+
const titleSepFor = (locale: PatchLocale): string => (locale === 'en' ? ': ' : ':');
|
|
33
|
+
const listSepFor = (locale: PatchLocale): string => (locale === 'en' ? ', ' : '、');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Slug folder (`20261108-ai-2026-11-08`) from a locale `index.md` (or its directory)
|
|
37
|
+
* under `content/posts/articles/<locale>/`. The slug is not reconstructed from the title:
|
|
38
|
+
* historical map keys are not always `${YYYYMMDD}-ai-${YYYY-MM-DD}`.
|
|
39
|
+
*/
|
|
40
|
+
export function slugFromPostPath(postPath: string): string | undefined {
|
|
41
|
+
const normalized = postPath.replaceAll('\\', '/');
|
|
42
|
+
const match = normalized.match(/(?:^|\/)posts\/articles\/(?:zh|en|ja)\/([^/]+)/);
|
|
43
|
+
return match?.[1];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function tagList(frontmatter: Map<string, string | string[]>): string[] {
|
|
47
|
+
const tags = frontmatter.get('tags');
|
|
48
|
+
if (Array.isArray(tags)) return tags;
|
|
49
|
+
if (typeof tags === 'string' && tags !== '') return [tags];
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** True when the post carries the daily-digest tag. */
|
|
54
|
+
export function isDigestMarkdown(markdown: string): boolean {
|
|
55
|
+
return tagList(parseFrontmatterScalars(markdown)).some((tag) => tag.includes(DIGEST_TAG));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function scalar(frontmatter: Map<string, string | string[]>, key: string): string | undefined {
|
|
59
|
+
const value = frontmatter.get(key);
|
|
60
|
+
if (value === undefined) return undefined;
|
|
61
|
+
return Array.isArray(value) ? value.join(' ') : value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseTitleHeadlines(title: string, locale: PatchLocale): string[] | undefined {
|
|
65
|
+
const series = SERIES_NAMES[locale];
|
|
66
|
+
const titleSep = titleSepFor(locale);
|
|
67
|
+
const listSep = listSepFor(locale);
|
|
68
|
+
const match = title.match(new RegExp(`^${escapeRe(series)} · (\\d{4}-\\d{2}-\\d{2})${escapeRe(titleSep)}(.+)$`));
|
|
69
|
+
if (!match?.[2]) return undefined;
|
|
70
|
+
const heads = match[2].split(listSep).map((head) => head.trim());
|
|
71
|
+
if (heads.length < 2 || heads.some((head) => head === '')) return undefined;
|
|
72
|
+
return heads;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function parseKeyPointParts(points: string[]): { labels: string[]; sentences: string[] } | undefined {
|
|
76
|
+
const labels: string[] = [];
|
|
77
|
+
const sentences: string[] = [];
|
|
78
|
+
for (const point of points) {
|
|
79
|
+
const sep = point.indexOf(' — ');
|
|
80
|
+
if (sep < 0) return undefined;
|
|
81
|
+
const label = point.slice(0, sep).trim();
|
|
82
|
+
const sentence = point.slice(sep + 3).trim();
|
|
83
|
+
if (label === '' || sentence === '') return undefined;
|
|
84
|
+
labels.push(label);
|
|
85
|
+
sentences.push(sentence);
|
|
86
|
+
}
|
|
87
|
+
return { labels, sentences };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function splitDescriptionParts(description: string, count: number): string[] | undefined {
|
|
91
|
+
for (const pattern of [/;|; /, /;|;/]) {
|
|
92
|
+
const parts = description
|
|
93
|
+
.split(pattern)
|
|
94
|
+
.map((part) => part.trim())
|
|
95
|
+
.filter((part) => part !== '');
|
|
96
|
+
if (parts.length === count) return parts;
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function buildLocaleEntry(markdown: string, locale: PatchLocale): DailyTopicsLocaleEntry | string {
|
|
102
|
+
if (!isDigestMarkdown(markdown)) {
|
|
103
|
+
return `${locale}: missing ${DIGEST_TAG} tag`;
|
|
104
|
+
}
|
|
105
|
+
const frontmatter = parseFrontmatterScalars(markdown);
|
|
106
|
+
const title = scalar(frontmatter, 'title') ?? '';
|
|
107
|
+
const headlines = parseTitleHeadlines(title, locale);
|
|
108
|
+
if (!headlines) {
|
|
109
|
+
return `${locale}: title is not "<series> · YYYY-MM-DD${titleSepFor(locale)}h1${listSepFor(locale)}h2"`;
|
|
110
|
+
}
|
|
111
|
+
const description = (scalar(frontmatter, 'description') ?? scalar(frontmatter, 'seo_description') ?? '').trim();
|
|
112
|
+
if (description === '') {
|
|
113
|
+
return `${locale}: description is empty`;
|
|
114
|
+
}
|
|
115
|
+
const rawPoints = frontmatter.get('key_points');
|
|
116
|
+
if (!Array.isArray(rawPoints) || rawPoints.length === 0) {
|
|
117
|
+
return `${locale}: key_points is missing`;
|
|
118
|
+
}
|
|
119
|
+
const parts = parseKeyPointParts(rawPoints);
|
|
120
|
+
if (!parts) {
|
|
121
|
+
return `${locale}: key_points must be "label — sentence"`;
|
|
122
|
+
}
|
|
123
|
+
if (parts.labels.length !== headlines.length || parts.labels.some((label, i) => label !== headlines[i])) {
|
|
124
|
+
return `${locale}: title headlines do not match key_points labels`;
|
|
125
|
+
}
|
|
126
|
+
const claims = parts.sentences;
|
|
127
|
+
const shortClaims = splitDescriptionParts(description, headlines.length) ?? claims;
|
|
128
|
+
return {
|
|
129
|
+
headlines,
|
|
130
|
+
description,
|
|
131
|
+
key_points: headlines,
|
|
132
|
+
claims,
|
|
133
|
+
short_claims: shortClaims,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Build one day's topic-map entry from the three locale post bodies. Fails rather than
|
|
139
|
+
* invent wording when a title, description, or key_points label cannot be parsed confidently.
|
|
140
|
+
*/
|
|
141
|
+
export function buildDailyTopicsEntry(posts: Record<PatchLocale, string>): BuildDailyTopicsResult {
|
|
142
|
+
const entry = {} as DailyTopicsEntry;
|
|
143
|
+
for (const locale of PATCH_LOCALES) {
|
|
144
|
+
const markdown = posts[locale];
|
|
145
|
+
if (typeof markdown !== 'string' || markdown.trim() === '') {
|
|
146
|
+
return { ok: false, error: `${locale}: post markdown is empty` };
|
|
147
|
+
}
|
|
148
|
+
const built = buildLocaleEntry(markdown, locale);
|
|
149
|
+
if (typeof built === 'string') return { ok: false, error: built };
|
|
150
|
+
entry[locale] = built;
|
|
151
|
+
}
|
|
152
|
+
return { ok: true, entry };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Insert or replace `obj[slug] = entry` and write pretty tab-indented JSON. Parse+serialize
|
|
157
|
+
* collapses a raw file that already contained the same key twice. Never appends a second key.
|
|
158
|
+
* Rejects on unreadable / non-object JSON so the caller can fail closed. Text IO routes
|
|
159
|
+
* through the ts-runtime FileSystem seam (runtime-boundaries no-direct-fs-io).
|
|
160
|
+
*/
|
|
161
|
+
export async function upsertDailyTopicsEntry(
|
|
162
|
+
mapPath: string,
|
|
163
|
+
slug: string,
|
|
164
|
+
entry: DailyTopicsEntry,
|
|
165
|
+
fileSystem: FileSystem = createNodeFileSystem(),
|
|
166
|
+
): Promise<void> {
|
|
167
|
+
if (slug.trim() === '') throw new Error('daily-topics upsert: empty slug');
|
|
168
|
+
let existing: Record<string, unknown> = {};
|
|
169
|
+
if (await fileSystem.exists(mapPath)) {
|
|
170
|
+
const raw = (await fileSystem.readFile(mapPath)).trim();
|
|
171
|
+
if (raw !== '') {
|
|
172
|
+
let parsed: unknown;
|
|
173
|
+
try {
|
|
174
|
+
parsed = JSON.parse(raw);
|
|
175
|
+
} catch (error: unknown) {
|
|
176
|
+
throw new Error(
|
|
177
|
+
`daily-topics upsert: invalid JSON in ${mapPath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
181
|
+
throw new Error(`daily-topics upsert: ${mapPath} is not a JSON object`);
|
|
182
|
+
}
|
|
183
|
+
existing = parsed as Record<string, unknown>;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
existing[slug] = entry;
|
|
187
|
+
await fileSystem.ensureDir(dirname(mapPath));
|
|
188
|
+
await fileSystem.writeFile(mapPath, `${JSON.stringify(existing, null, '\t')}\n`);
|
|
189
|
+
}
|
|
@@ -12057,7 +12057,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
12057
12057
|
shortVideo: Object.freeze({
|
|
12058
12058
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
12059
12059
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
12060
|
-
shipinhao: Object.freeze({ max:
|
|
12060
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
12061
12061
|
})
|
|
12062
12062
|
})
|
|
12063
12063
|
});
|
|
@@ -12225,11 +12225,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
12225
12225
|
});
|
|
12226
12226
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
12227
12227
|
if (manifest.browserSession !== undefined) {
|
|
12228
|
-
if (manifest.kind !== "publish") {
|
|
12228
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
12229
12229
|
ctx.addIssue({
|
|
12230
12230
|
code: "custom",
|
|
12231
12231
|
path: ["browserSession"],
|
|
12232
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
12232
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
12233
12233
|
});
|
|
12234
12234
|
}
|
|
12235
12235
|
if (manifest.check === undefined) {
|
|
@@ -19905,7 +19905,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
19905
19905
|
shortVideo: Object.freeze({
|
|
19906
19906
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
19907
19907
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
19908
|
-
shipinhao: Object.freeze({ max:
|
|
19908
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
19909
19909
|
})
|
|
19910
19910
|
})
|
|
19911
19911
|
});
|
|
@@ -20073,11 +20073,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
20073
20073
|
});
|
|
20074
20074
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
20075
20075
|
if (manifest.browserSession !== undefined) {
|
|
20076
|
-
if (manifest.kind !== "publish") {
|
|
20076
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
20077
20077
|
ctx.addIssue({
|
|
20078
20078
|
code: "custom",
|
|
20079
20079
|
path: ["browserSession"],
|
|
20080
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
20080
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
20081
20081
|
});
|
|
20082
20082
|
}
|
|
20083
20083
|
if (manifest.check === undefined) {
|
|
@@ -20620,10 +20620,12 @@ function sha256Hex(value) {
|
|
|
20620
20620
|
var DEFAULT_BOT_PROFILE_ROOT = join4(homedir4(), ".config", "kk", "browser-profiles");
|
|
20621
20621
|
class BotError extends Error {
|
|
20622
20622
|
code;
|
|
20623
|
-
|
|
20623
|
+
details;
|
|
20624
|
+
constructor(code, message, details = {}) {
|
|
20624
20625
|
super(message);
|
|
20625
20626
|
this.name = "BotError";
|
|
20626
20627
|
this.code = code;
|
|
20628
|
+
this.details = details;
|
|
20627
20629
|
}
|
|
20628
20630
|
}
|
|
20629
20631
|
// ../../packages/publish-harness/src/profile-dir.ts
|
|
@@ -22060,6 +22062,12 @@ async function modalState(page) {
|
|
|
22060
22062
|
return "unknown";
|
|
22061
22063
|
}
|
|
22062
22064
|
}
|
|
22065
|
+
async function bestEffortPress(page, key, settleMs = 400) {
|
|
22066
|
+
try {
|
|
22067
|
+
await page.press?.(key);
|
|
22068
|
+
await page.waitForTimeout?.(settleMs);
|
|
22069
|
+
} catch {}
|
|
22070
|
+
}
|
|
22063
22071
|
async function tryFindAttachedSelector(page, selectors, timeoutMs = STEP_TIMEOUT_MS) {
|
|
22064
22072
|
let found;
|
|
22065
22073
|
await waitUntil(async () => {
|
|
@@ -22343,8 +22351,7 @@ async function enrichArticle(page, meta) {
|
|
|
22343
22351
|
await page.locator(cancel.selector ?? "").first().click({ timeout: 2000 });
|
|
22344
22352
|
} catch {}
|
|
22345
22353
|
}
|
|
22346
|
-
await page
|
|
22347
|
-
await page.waitForTimeout?.(SWEEP_SETTLE_MS);
|
|
22354
|
+
await bestEffortPress(page, "Escape", SWEEP_SETTLE_MS);
|
|
22348
22355
|
const state = await modalState(page);
|
|
22349
22356
|
if (state === "open") {
|
|
22350
22357
|
for (const close of [".weui-desktop-dialog__close-btn", ".weui-desktop-dialog__close"]) {
|
|
@@ -22593,8 +22600,7 @@ async function dismissOpenDialog(page) {
|
|
|
22593
22600
|
} catch {}
|
|
22594
22601
|
break;
|
|
22595
22602
|
}
|
|
22596
|
-
await page
|
|
22597
|
-
await page.waitForTimeout?.(400);
|
|
22603
|
+
await bestEffortPress(page, "Escape");
|
|
22598
22604
|
}
|
|
22599
22605
|
var DIALOG_CLOSE = [
|
|
22600
22606
|
".weui-desktop-dialog__wrp .weui-desktop-dialog__close",
|
|
@@ -22617,8 +22623,7 @@ async function closeOpenDialogs(page) {
|
|
|
22617
22623
|
} catch {}
|
|
22618
22624
|
break;
|
|
22619
22625
|
}
|
|
22620
|
-
await page
|
|
22621
|
-
await page.waitForTimeout?.(400);
|
|
22626
|
+
await bestEffortPress(page, "Escape");
|
|
22622
22627
|
}
|
|
22623
22628
|
return await modalState(page) === "closed" ? "closed" : "residual";
|
|
22624
22629
|
}
|
|
@@ -23237,17 +23242,19 @@ async function enrichArticleDraft(page, content, stepTimeoutMs) {
|
|
|
23237
23242
|
const enrichWarnings = await enrichArticle(page, meta);
|
|
23238
23243
|
const audio = audioBlockOf(content);
|
|
23239
23244
|
let audioFailed = false;
|
|
23245
|
+
let coverSeeded = false;
|
|
23240
23246
|
if (audio !== null) {
|
|
23241
|
-
const
|
|
23242
|
-
|
|
23243
|
-
|
|
23247
|
+
const audioResult = await insertAudioMaterial(page, audio);
|
|
23248
|
+
coverSeeded = audioResult.coverSeeded;
|
|
23249
|
+
if (audioResult.warning !== "") {
|
|
23250
|
+
enrichWarnings.push(audioResult.warning);
|
|
23244
23251
|
audioFailed = true;
|
|
23245
23252
|
}
|
|
23246
23253
|
}
|
|
23247
23254
|
const coverWarnings = [];
|
|
23248
23255
|
if (coverSourceOf(content) === "library" && audio !== null) {
|
|
23249
|
-
if (audioFailed) {
|
|
23250
|
-
coverWarnings.push("cover: \u97F3\u9891\u4E0A\u4F20\u672A\u6210\u529F\
|
|
23256
|
+
if (audioFailed && !coverSeeded) {
|
|
23257
|
+
coverWarnings.push("cover: \u97F3\u9891\u4E0A\u4F20\u672A\u6210\u529F\u4E14\u56FE\u7247\u5E93\u5C1A\u65E0\u8BF7\u6C42\u5C01\u9762\uFF0C\u5DF2\u8DF3\u8FC7\u56FE\u7247\u5E93\u5C01\u9762");
|
|
23251
23258
|
} else {
|
|
23252
23259
|
const cover = await setCover(page, "library", { stepTimeoutMs: Math.min(stepTimeoutMs, 8000) }, { binding: audio.coverPath === "" ? undefined : await coverLibraryName(audio.coverPath) });
|
|
23253
23260
|
if (cover !== null)
|
|
@@ -24142,6 +24149,11 @@ function escapeHtml(text) {
|
|
|
24142
24149
|
}
|
|
24143
24150
|
async function insertAudioMaterial(page, input) {
|
|
24144
24151
|
const { title, audioPath, coverPath } = input;
|
|
24152
|
+
let libraryHasCover = false;
|
|
24153
|
+
const result = (warning) => ({
|
|
24154
|
+
warning,
|
|
24155
|
+
coverSeeded: libraryHasCover
|
|
24156
|
+
});
|
|
24145
24157
|
const CARET = `(async () => {
|
|
24146
24158
|
const pm = [...document.querySelectorAll('.ProseMirror')].find((e) => !(e.getAttribute('data-placeholder') ?? '').includes('\u6807\u9898'));
|
|
24147
24159
|
if (!pm || !pm.firstChild) return;
|
|
@@ -24211,11 +24223,11 @@ async function insertAudioMaterial(page, input) {
|
|
|
24211
24223
|
const upload = async () => {
|
|
24212
24224
|
const uploadControl = await trySelectors(page, UPLOAD_AUDIO);
|
|
24213
24225
|
if (!uploadControl.found)
|
|
24214
|
-
return "\u97F3\u9891: \u4E0A\u4F20\u97F3\u9891 control not found in the audio dialog";
|
|
24226
|
+
return result("\u97F3\u9891: \u4E0A\u4F20\u97F3\u9891 control not found in the audio dialog");
|
|
24215
24227
|
await clickSelector(page, uploadControl.selector ?? UPLOAD_AUDIO[0] ?? "text=\u4E0A\u4F20\u97F3\u9891", 8000);
|
|
24216
24228
|
const audioInput = await trySelectors(page, AUDIO_UPLOAD_INPUT, { visible: false });
|
|
24217
24229
|
if (!audioInput.found)
|
|
24218
|
-
return "\u97F3\u9891: no audio file input appeared";
|
|
24230
|
+
return result("\u97F3\u9891: no audio file input appeared");
|
|
24219
24231
|
await uploadFile(asPlaywrightPage(page), audioInput.selector ?? AUDIO_UPLOAD_INPUT.join(", "), audioPath, {
|
|
24220
24232
|
timeoutMs: 60000
|
|
24221
24233
|
});
|
|
@@ -24231,10 +24243,10 @@ async function insertAudioMaterial(page, input) {
|
|
|
24231
24243
|
if (hasChooser) {
|
|
24232
24244
|
const libraryReady = await waitUntil(async () => Boolean(await page.evaluate(`!document.querySelector('#js_image_dialog_list_wrp .weui-desktop-loading')`)), 5000);
|
|
24233
24245
|
if (!libraryReady)
|
|
24234
|
-
return "\u97F3\u9891: \u5C01\u9762\u7D20\u6750\u5E93\u52A0\u8F7D\u672A\u5B8C\u6210\uFF0C\u672A\u4E0A\u4F20\u91CD\u590D\u5C01\u9762";
|
|
24246
|
+
return result("\u97F3\u9891: \u5C01\u9762\u7D20\u6750\u5E93\u52A0\u8F7D\u672A\u5B8C\u6210\uFF0C\u672A\u4E0A\u4F20\u91CD\u590D\u5C01\u9762");
|
|
24235
24247
|
existing = Number(await page.evaluate(`([...document.querySelectorAll('.weui-desktop-img-picker__item')].filter(row => row.offsetWidth > 0 && row.querySelector('.weui-desktop-img-picker__img-title')?.textContent?.trim() === ${JSON.stringify(coverName)})).length`));
|
|
24236
24248
|
if (existing > 1)
|
|
24237
|
-
return "\u97F3\u9891: \u5185\u5BB9\u7ED1\u5B9A\u5C01\u9762\u5B58\u5728\u591A\u4E2A\u540C\u540D\u7D20\u6750\uFF0C\u672A\u731C\u6D4B\u9009\u62E9";
|
|
24249
|
+
return result("\u97F3\u9891: \u5185\u5BB9\u7ED1\u5B9A\u5C01\u9762\u5B58\u5728\u591A\u4E2A\u540C\u540D\u7D20\u6750\uFF0C\u672A\u731C\u6D4B\u9009\u62E9");
|
|
24238
24250
|
}
|
|
24239
24251
|
let uploadPath = coverPath;
|
|
24240
24252
|
let temporaryDir;
|
|
@@ -24263,14 +24275,24 @@ async function insertAudioMaterial(page, input) {
|
|
|
24263
24275
|
return row.classList.contains('selected');
|
|
24264
24276
|
})()`)), 30000);
|
|
24265
24277
|
if (!selected)
|
|
24266
|
-
return "\u97F3\u9891: \u4E0A\u4F20\u5C01\u9762\u672A\u51FA\u73B0\u552F\u4E00\u5DF2\u9009\u4E2D\u7684\u540C\u540D\u56FE\u7247\uFF0C\u672A\u63D0\u4EA4\u5C01\u9762";
|
|
24278
|
+
return result("\u97F3\u9891: \u4E0A\u4F20\u5C01\u9762\u672A\u51FA\u73B0\u552F\u4E00\u5DF2\u9009\u4E2D\u7684\u540C\u540D\u56FE\u7247\uFF0C\u672A\u63D0\u4EA4\u5C01\u9762");
|
|
24279
|
+
libraryHasCover = true;
|
|
24267
24280
|
const next = await findSelector(page, [`${chooser} button:has-text("\u4E0B\u4E00\u6B65"):not(.weui-desktop-btn_disabled)`], "\u97F3\u9891\u5C01\u9762 \u4E0B\u4E00\u6B65", 30000);
|
|
24268
24281
|
await clickSelector(page, next, 8000);
|
|
24269
24282
|
const finish = await findSelector(page, [`${chooser} button:has-text("\u5B8C\u6210"):not(.weui-desktop-btn_disabled)`], "\u97F3\u9891\u5C01\u9762 \u5B8C\u6210", 30000);
|
|
24270
24283
|
await clickSelector(page, finish, 8000);
|
|
24271
|
-
|
|
24272
|
-
if (!closed)
|
|
24273
|
-
|
|
24284
|
+
let closed = await waitUntil(async () => !await page.locator(chooser).first().isVisible(), 25000);
|
|
24285
|
+
if (!closed) {
|
|
24286
|
+
const confirm = await tryFindSelector(page, [`${chooser} button:has-text("\u786E\u5B9A")`], 5000);
|
|
24287
|
+
if (confirm !== undefined) {
|
|
24288
|
+
await clickSelector(page, confirm, 8000);
|
|
24289
|
+
closed = await waitUntil(async () => !await page.locator(chooser).first().isVisible(), 1e4);
|
|
24290
|
+
}
|
|
24291
|
+
}
|
|
24292
|
+
if (!closed) {
|
|
24293
|
+
const inventory = await openDialogInventory(page);
|
|
24294
|
+
return result(`\u97F3\u9891: \u5C01\u9762\u9009\u62E9\u5668\u5B8C\u6210\u540E\u672A\u5173\u95ED\uFF0C\u672A\u4FDD\u5B58\u97F3\u9891${inventory ? ` (dialogs: ${inventory})` : ""}`);
|
|
24295
|
+
}
|
|
24274
24296
|
}
|
|
24275
24297
|
} finally {
|
|
24276
24298
|
if (temporaryDir !== undefined) {
|
|
@@ -24285,10 +24307,10 @@ async function insertAudioMaterial(page, input) {
|
|
|
24285
24307
|
await fillSelector(page, titleInput.selector ?? AUDIO_TITLE_INPUT.join(", "), title);
|
|
24286
24308
|
const agreed = String(await page.evaluate(AGREE));
|
|
24287
24309
|
if (agreed !== "checked")
|
|
24288
|
-
return `\u97F3\u9891: \u670D\u52A1\u89C4\u5219\u52FE\u9009\u5931\u8D25 (${agreed})
|
|
24310
|
+
return result(`\u97F3\u9891: \u670D\u52A1\u89C4\u5219\u52FE\u9009\u5931\u8D25 (${agreed})`);
|
|
24289
24311
|
const save = await findSelector(page, UPLOAD_SAVE.map((selector) => `${selector}:not(.weui-desktop-btn_disabled):not([disabled])`), "\u97F3\u9891\u4E0A\u4F20\u5B8C\u6210\u4E14\u5C01\u9762\u5DF2\u63D0\u4EA4\u540E\u7684\u4FDD\u5B58\u6309\u94AE", 90000);
|
|
24290
24312
|
await clickSelector(page, save, 8000);
|
|
24291
|
-
return
|
|
24313
|
+
return result("");
|
|
24292
24314
|
};
|
|
24293
24315
|
const matchOnce = async () => {
|
|
24294
24316
|
try {
|
|
@@ -24314,57 +24336,57 @@ async function insertAudioMaterial(page, input) {
|
|
|
24314
24336
|
await waitForVisible(page, AUDIO_DIALOG, AUDIO_DIALOG_TIMEOUT_MS);
|
|
24315
24337
|
let match = await awaitMatch();
|
|
24316
24338
|
if (match === "missing") {
|
|
24317
|
-
const
|
|
24318
|
-
if (
|
|
24339
|
+
const uploadResult = await upload();
|
|
24340
|
+
if (uploadResult.warning !== "") {
|
|
24319
24341
|
await page.evaluate(CANCEL);
|
|
24320
|
-
return
|
|
24342
|
+
return result(uploadResult.warning);
|
|
24321
24343
|
}
|
|
24322
24344
|
await waitForVisible(page, AUDIO_DIALOG, AUDIO_DIALOG_TIMEOUT_MS);
|
|
24323
24345
|
match = await awaitMatch();
|
|
24324
24346
|
if (match === "missing") {
|
|
24325
24347
|
await page.evaluate(CANCEL);
|
|
24326
|
-
return `\u97F3\u9891: \u4FDD\u5B58\u540E\u7D20\u6750\u5217\u8868\u672A\u51FA\u73B0\u300C${title}\u300D\uFF0C\u672A\u63D2\u5165\u97F3\u9891
|
|
24348
|
+
return result(`\u97F3\u9891: \u4FDD\u5B58\u540E\u7D20\u6750\u5217\u8868\u672A\u51FA\u73B0\u300C${title}\u300D\uFF0C\u672A\u63D2\u5165\u97F3\u9891`);
|
|
24327
24349
|
}
|
|
24328
24350
|
if (match === "error") {
|
|
24329
24351
|
await page.evaluate(CANCEL);
|
|
24330
|
-
return "\u97F3\u9891: \u4FDD\u5B58\u540E\u7D20\u6750\u5339\u914D\u63A2\u6D4B\u5931\u8D25\uFF0C\u672A\u63D2\u5165\u97F3\u9891";
|
|
24352
|
+
return result("\u97F3\u9891: \u4FDD\u5B58\u540E\u7D20\u6750\u5339\u914D\u63A2\u6D4B\u5931\u8D25\uFF0C\u672A\u63D2\u5165\u97F3\u9891");
|
|
24331
24353
|
}
|
|
24332
24354
|
} else if (match === "error") {
|
|
24333
24355
|
await page.evaluate(CANCEL);
|
|
24334
|
-
return "\u97F3\u9891: \u7D20\u6750\u5339\u914D\u63A2\u6D4B\u5931\u8D25\uFF0C\u672A\u63D2\u5165\u97F3\u9891";
|
|
24356
|
+
return result("\u97F3\u9891: \u7D20\u6750\u5339\u914D\u63A2\u6D4B\u5931\u8D25\uFF0C\u672A\u63D2\u5165\u97F3\u9891");
|
|
24335
24357
|
}
|
|
24336
24358
|
let identity = "";
|
|
24337
24359
|
try {
|
|
24338
24360
|
const parsed = JSON.parse(match);
|
|
24339
24361
|
if (parsed.state !== "checked") {
|
|
24340
24362
|
await page.evaluate(CANCEL);
|
|
24341
|
-
return `\u97F3\u9891: \u7D20\u6750\u300C${title}\u300D${parsed.state === "ambiguous" ? "\u5217\u8868\u5339\u914D\u5230\u591A\u4E2A\u540C\u540D\u6761\u76EE\uFF0C\u8EAB\u4EFD\u4E0D\u552F\u4E00" : parsed.state === "nobox" ? "\u884C\u6CA1\u6709\u52FE\u9009\u6846" : "\u672A\u9009\u4E2D"}\uFF0C\u672A\u63D2\u5165\u97F3\u9891
|
|
24363
|
+
return result(`\u97F3\u9891: \u7D20\u6750\u300C${title}\u300D${parsed.state === "ambiguous" ? "\u5217\u8868\u5339\u914D\u5230\u591A\u4E2A\u540C\u540D\u6761\u76EE\uFF0C\u8EAB\u4EFD\u4E0D\u552F\u4E00" : parsed.state === "nobox" ? "\u884C\u6CA1\u6709\u52FE\u9009\u6846" : "\u672A\u9009\u4E2D"}\uFF0C\u672A\u63D2\u5165\u97F3\u9891`);
|
|
24342
24364
|
}
|
|
24343
24365
|
identity = parsed.identity ?? "";
|
|
24344
24366
|
} catch {
|
|
24345
24367
|
await page.evaluate(CANCEL);
|
|
24346
|
-
return "\u97F3\u9891: \u7D20\u6750\u5339\u914D\u63A2\u6D4B\u8FD4\u56DE\u672A\u77E5\u7ED3\u679C\uFF0C\u672A\u63D2\u5165\u97F3\u9891";
|
|
24368
|
+
return result("\u97F3\u9891: \u7D20\u6750\u5339\u914D\u63A2\u6D4B\u8FD4\u56DE\u672A\u77E5\u7ED3\u679C\uFF0C\u672A\u63D2\u5165\u97F3\u9891");
|
|
24347
24369
|
}
|
|
24348
24370
|
if (await page.evaluate(INSERT) !== true) {
|
|
24349
24371
|
await page.evaluate(CANCEL);
|
|
24350
|
-
return "\u97F3\u9891: \u63D2\u5165\u6309\u94AE\u672A\u627E\u5230\uFF0C\u8BF7\u624B\u52A8\u63D2\u5165";
|
|
24372
|
+
return result("\u97F3\u9891: \u63D2\u5165\u6309\u94AE\u672A\u627E\u5230\uFF0C\u8BF7\u624B\u52A8\u63D2\u5165");
|
|
24351
24373
|
}
|
|
24352
24374
|
await page.waitForTimeout?.(2000);
|
|
24353
24375
|
let verdict;
|
|
24354
24376
|
try {
|
|
24355
24377
|
verdict = JSON.parse(String(await page.evaluate(VERIFY)));
|
|
24356
24378
|
} catch {
|
|
24357
|
-
return "\u97F3\u9891: \u5DF2\u63D2\u5165\u4F46\u65E0\u6CD5\u8BFB\u53D6\u6B63\u6587\u72B6\u6001\uFF0C\u8BF7\u624B\u52A8\u68C0\u67E5";
|
|
24379
|
+
return result("\u97F3\u9891: \u5DF2\u63D2\u5165\u4F46\u65E0\u6CD5\u8BFB\u53D6\u6B63\u6587\u72B6\u6001\uFF0C\u8BF7\u624B\u52A8\u68C0\u67E5");
|
|
24358
24380
|
}
|
|
24359
24381
|
if (verdict.state === "absent" || verdict.state === "noeditor")
|
|
24360
|
-
return "\u97F3\u9891: \u63D2\u5165\u672A\u751F\u6548\uFF0C\u8BF7\u624B\u52A8\u68C0\u67E5";
|
|
24382
|
+
return result("\u97F3\u9891: \u63D2\u5165\u672A\u751F\u6548\uFF0C\u8BF7\u624B\u52A8\u68C0\u67E5");
|
|
24361
24383
|
if (verdict.state !== "top")
|
|
24362
|
-
return "\u97F3\u9891: \u5DF2\u63D2\u5165\u4F46\u672A\u5728\u6587\u9996\uFF0C\u8BF7\u624B\u52A8\u8C03\u6574\u4F4D\u7F6E";
|
|
24384
|
+
return result("\u97F3\u9891: \u5DF2\u63D2\u5165\u4F46\u672A\u5728\u6587\u9996\uFF0C\u8BF7\u624B\u52A8\u8C03\u6574\u4F4D\u7F6E");
|
|
24363
24385
|
if (identity === "" || (verdict.identity ?? "") === "" || verdict.identity !== identity)
|
|
24364
|
-
return `\u97F3\u9891: \u5DF2\u63D2\u5165\u6587\u9996\u4F46\u65E0\u6CD5\u6838\u5BF9\u7D20\u6750\u8EAB\u4EFD\uFF08selected=${identity || "\u672A\u8BFB\u5230"} node=${(verdict.identity ?? "").slice(0, 60) || "\u672A\u8BFB\u5230"}\uFF09\uFF0C\u8BF7\u624B\u52A8\u6838\u5BF9
|
|
24365
|
-
return "";
|
|
24386
|
+
return result(`\u97F3\u9891: \u5DF2\u63D2\u5165\u6587\u9996\u4F46\u65E0\u6CD5\u6838\u5BF9\u7D20\u6750\u8EAB\u4EFD\uFF08selected=${identity || "\u672A\u8BFB\u5230"} node=${(verdict.identity ?? "").slice(0, 60) || "\u672A\u8BFB\u5230"}\uFF09\uFF0C\u8BF7\u624B\u52A8\u6838\u5BF9`);
|
|
24387
|
+
return result("");
|
|
24366
24388
|
} catch (error) {
|
|
24367
|
-
return `\u97F3\u9891: ${error instanceof Error ? error.message.slice(0, 120) : "\u81EA\u52A8\u63D2\u5165\u5931\u8D25"}\uFF0C\u8BF7\u624B\u52A8\u63D2\u5165
|
|
24389
|
+
return result(`\u97F3\u9891: ${error instanceof Error ? error.message.slice(0, 120) : "\u81EA\u52A8\u63D2\u5165\u5931\u8D25"}\uFF0C\u8BF7\u624B\u52A8\u63D2\u5165`);
|
|
24368
24390
|
}
|
|
24369
24391
|
}
|
|
24370
24392
|
|
|
@@ -20272,10 +20272,12 @@ function sha256Hex(value) {
|
|
|
20272
20272
|
var DEFAULT_BOT_PROFILE_ROOT = join3(homedir3(), ".config", "kk", "browser-profiles");
|
|
20273
20273
|
class BotError extends Error {
|
|
20274
20274
|
code;
|
|
20275
|
-
|
|
20275
|
+
details;
|
|
20276
|
+
constructor(code, message, details = {}) {
|
|
20276
20277
|
super(message);
|
|
20277
20278
|
this.name = "BotError";
|
|
20278
20279
|
this.code = code;
|
|
20280
|
+
this.details = details;
|
|
20279
20281
|
}
|
|
20280
20282
|
}
|
|
20281
20283
|
// ../../packages/publish-harness/src/index.ts
|
|
@@ -20502,7 +20504,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
20502
20504
|
shortVideo: Object.freeze({
|
|
20503
20505
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
20504
20506
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
20505
|
-
shipinhao: Object.freeze({ max:
|
|
20507
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
20506
20508
|
})
|
|
20507
20509
|
})
|
|
20508
20510
|
});
|
|
@@ -20670,11 +20672,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
20670
20672
|
});
|
|
20671
20673
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
20672
20674
|
if (manifest.browserSession !== undefined) {
|
|
20673
|
-
if (manifest.kind !== "publish") {
|
|
20675
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
20674
20676
|
ctx.addIssue({
|
|
20675
20677
|
code: "custom",
|
|
20676
20678
|
path: ["browserSession"],
|
|
20677
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
20679
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
20678
20680
|
});
|
|
20679
20681
|
}
|
|
20680
20682
|
if (manifest.check === undefined) {
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { trySelectors } from '@gobing-ai/publish-harness';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
bestEffortPress,
|
|
4
|
+
clickSelector,
|
|
5
|
+
fillSelector,
|
|
6
|
+
modalState,
|
|
7
|
+
tryFindSelector,
|
|
8
|
+
type WechatPage,
|
|
9
|
+
waitForVisible,
|
|
10
|
+
} from './page';
|
|
3
11
|
|
|
4
12
|
/**
|
|
5
13
|
* The 文章 operation's `metadata.wechatmp` enrichment rail (2026-09-29, ADR-026; committed-value
|
|
@@ -150,8 +158,7 @@ export async function enrichArticle(page: WechatPage, meta: Record<string, unkno
|
|
|
150
158
|
// The dialog may already be gone; the sweep is best-effort.
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
|
-
await page
|
|
154
|
-
await page.waitForTimeout?.(SWEEP_SETTLE_MS);
|
|
161
|
+
await bestEffortPress(page, 'Escape', SWEEP_SETTLE_MS);
|
|
155
162
|
const state = await modalState(page);
|
|
156
163
|
if (state === 'open') {
|
|
157
164
|
// One explicit close-button pass before giving up: some dialogs ignore Escape.
|