@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
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
type WechatmpOperation,
|
|
38
38
|
} from './modes';
|
|
39
39
|
import {
|
|
40
|
+
bestEffortPress,
|
|
40
41
|
clickSelector,
|
|
41
42
|
fillSelector,
|
|
42
43
|
findAttachedSelector,
|
|
@@ -166,8 +167,7 @@ async function dismissOpenDialog(page: WechatPage): Promise<void> {
|
|
|
166
167
|
}
|
|
167
168
|
break;
|
|
168
169
|
}
|
|
169
|
-
await page
|
|
170
|
-
await page.waitForTimeout?.(400);
|
|
170
|
+
await bestEffortPress(page, 'Escape');
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
/** The close controls a console modal exposes, most specific first (the audio picker shows no 取消).
|
|
@@ -204,8 +204,7 @@ async function closeOpenDialogs(page: WechatPage): Promise<'closed' | 'residual'
|
|
|
204
204
|
}
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
|
-
await page
|
|
208
|
-
await page.waitForTimeout?.(400);
|
|
207
|
+
await bestEffortPress(page, 'Escape');
|
|
209
208
|
}
|
|
210
209
|
return (await modalState(page)) === 'closed' ? 'closed' : 'residual';
|
|
211
210
|
}
|
|
@@ -1197,10 +1196,12 @@ export async function enrichArticleDraft(
|
|
|
1197
1196
|
const enrichWarnings = await enrichArticle(page, meta);
|
|
1198
1197
|
const audio = audioBlockOf(content);
|
|
1199
1198
|
let audioFailed = false;
|
|
1199
|
+
let coverSeeded = false;
|
|
1200
1200
|
if (audio !== null) {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
|
|
1201
|
+
const audioResult = await insertAudioMaterial(page, audio);
|
|
1202
|
+
coverSeeded = audioResult.coverSeeded;
|
|
1203
|
+
if (audioResult.warning !== '') {
|
|
1204
|
+
enrichWarnings.push(audioResult.warning);
|
|
1204
1205
|
audioFailed = true;
|
|
1205
1206
|
}
|
|
1206
1207
|
}
|
|
@@ -1209,8 +1210,8 @@ export async function enrichArticleDraft(
|
|
|
1209
1210
|
// leaves the library without the requested cover, so the dependent picker must not run).
|
|
1210
1211
|
const coverWarnings: string[] = [];
|
|
1211
1212
|
if (coverSourceOf(content) === 'library' && audio !== null) {
|
|
1212
|
-
if (audioFailed) {
|
|
1213
|
-
coverWarnings.push('cover:
|
|
1213
|
+
if (audioFailed && !coverSeeded) {
|
|
1214
|
+
coverWarnings.push('cover: 音频上传未成功且图片库尚无请求封面,已跳过图片库封面');
|
|
1214
1215
|
} else {
|
|
1215
1216
|
const cover = await setCover(
|
|
1216
1217
|
page,
|
|
@@ -2581,8 +2582,16 @@ function escapeHtml(text: string): string {
|
|
|
2581
2582
|
export async function insertAudioMaterial(
|
|
2582
2583
|
page: WechatPage,
|
|
2583
2584
|
input: { title: string; audioPath: string; coverPath: string },
|
|
2584
|
-
): Promise<string> {
|
|
2585
|
+
): Promise<{ warning: string; coverSeeded: boolean }> {
|
|
2585
2586
|
const { title, audioPath, coverPath } = input;
|
|
2587
|
+
// The library demonstrably holds the episode cover once the picker verified the unique same-name
|
|
2588
|
+
// row (0260 R1 refined 2026-11-09): failures AFTER that point must not suppress the deferred
|
|
2589
|
+
// library cover — the skip guard is only honest for failures BEFORE the cover committed.
|
|
2590
|
+
let libraryHasCover = false;
|
|
2591
|
+
const result = (warning: string): { warning: string; coverSeeded: boolean } => ({
|
|
2592
|
+
warning,
|
|
2593
|
+
coverSeeded: libraryHasCover,
|
|
2594
|
+
});
|
|
2586
2595
|
const CARET = `(async () => {
|
|
2587
2596
|
const pm = [...document.querySelectorAll('.ProseMirror')].find((e) => !(e.getAttribute('data-placeholder') ?? '').includes('标题'));
|
|
2588
2597
|
if (!pm || !pm.firstChild) return;
|
|
@@ -2655,15 +2664,15 @@ export async function insertAudioMaterial(
|
|
|
2655
2664
|
return JSON.stringify({ state: 'top', identity });
|
|
2656
2665
|
})()`;
|
|
2657
2666
|
|
|
2658
|
-
/** Upload the audio + its cover, acknowledge the rules, and 保存. Returns a
|
|
2659
|
-
const upload = async (): Promise<string
|
|
2667
|
+
/** Upload the audio + its cover, acknowledge the rules, and 保存. Returns a structured outcome. */
|
|
2668
|
+
const upload = async (): Promise<{ warning: string; coverSeeded: boolean }> => {
|
|
2660
2669
|
const uploadControl = await trySelectors(page, UPLOAD_AUDIO);
|
|
2661
|
-
if (!uploadControl.found) return '音频: 上传音频 control not found in the audio dialog';
|
|
2670
|
+
if (!uploadControl.found) return result('音频: 上传音频 control not found in the audio dialog');
|
|
2662
2671
|
// Click the winner, never a joined union: `text=…, css…` mixes selector engines and
|
|
2663
2672
|
// Playwright parses the whole string as CSS — zero matches (DOM fixture 0260).
|
|
2664
2673
|
await clickSelector(page, uploadControl.selector ?? UPLOAD_AUDIO[0] ?? 'text=上传音频', 8_000);
|
|
2665
2674
|
const audioInput = await trySelectors(page, AUDIO_UPLOAD_INPUT, { visible: false });
|
|
2666
|
-
if (!audioInput.found) return '音频: no audio file input appeared';
|
|
2675
|
+
if (!audioInput.found) return result('音频: no audio file input appeared');
|
|
2667
2676
|
await uploadFile(asPlaywrightPage(page), audioInput.selector ?? AUDIO_UPLOAD_INPUT.join(', '), audioPath, {
|
|
2668
2677
|
timeoutMs: 60_000,
|
|
2669
2678
|
});
|
|
@@ -2687,13 +2696,13 @@ export async function insertAudioMaterial(
|
|
|
2687
2696
|
),
|
|
2688
2697
|
5_000,
|
|
2689
2698
|
);
|
|
2690
|
-
if (!libraryReady) return '音频: 封面素材库加载未完成,未上传重复封面';
|
|
2699
|
+
if (!libraryReady) return result('音频: 封面素材库加载未完成,未上传重复封面');
|
|
2691
2700
|
existing = Number(
|
|
2692
2701
|
await page.evaluate(
|
|
2693
2702
|
`([...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`,
|
|
2694
2703
|
),
|
|
2695
2704
|
);
|
|
2696
|
-
if (existing > 1) return '音频: 内容绑定封面存在多个同名素材,未猜测选择';
|
|
2705
|
+
if (existing > 1) return result('音频: 内容绑定封面存在多个同名素材,未猜测选择');
|
|
2697
2706
|
}
|
|
2698
2707
|
let uploadPath = coverPath;
|
|
2699
2708
|
let temporaryDir: string | undefined;
|
|
@@ -2730,7 +2739,10 @@ export async function insertAudioMaterial(
|
|
|
2730
2739
|
),
|
|
2731
2740
|
30_000,
|
|
2732
2741
|
);
|
|
2733
|
-
if (!selected) return '音频: 上传封面未出现唯一已选中的同名图片,未提交封面';
|
|
2742
|
+
if (!selected) return result('音频: 上传封面未出现唯一已选中的同名图片,未提交封面');
|
|
2743
|
+
// The picker just proved the library holds the unique same-name cover; every
|
|
2744
|
+
// failure past this point leaves the cover in the 图片库 (cover rescue valid).
|
|
2745
|
+
libraryHasCover = true;
|
|
2734
2746
|
const next = await findSelector(
|
|
2735
2747
|
page,
|
|
2736
2748
|
[`${chooser} button:has-text("下一步"):not(.weui-desktop-btn_disabled)`],
|
|
@@ -2745,11 +2757,31 @@ export async function insertAudioMaterial(
|
|
|
2745
2757
|
30_000,
|
|
2746
2758
|
);
|
|
2747
2759
|
await clickSelector(page, finish, 8_000);
|
|
2748
|
-
|
|
2760
|
+
// Hardened like the 播客 walk: 完成 may bounce a crop-confirm page; wait long,
|
|
2761
|
+
// retry via 确定, and only then abandon the audio save.
|
|
2762
|
+
let closed = await waitUntil(
|
|
2749
2763
|
async () => !(await page.locator(chooser).first().isVisible()),
|
|
2750
|
-
|
|
2764
|
+
25_000,
|
|
2751
2765
|
);
|
|
2752
|
-
if (!closed)
|
|
2766
|
+
if (!closed) {
|
|
2767
|
+
const confirm = await tryFindSelector(page, [`${chooser} button:has-text("确定")`], 5_000);
|
|
2768
|
+
if (confirm !== undefined) {
|
|
2769
|
+
await clickSelector(page, confirm, 8_000);
|
|
2770
|
+
closed = await waitUntil(
|
|
2771
|
+
async () => !(await page.locator(chooser).first().isVisible()),
|
|
2772
|
+
10_000,
|
|
2773
|
+
);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
if (!closed) {
|
|
2777
|
+
// Live 2026-11-09 this stall is real — capture WHAT is on screen (the
|
|
2778
|
+
// confirm dialog may not nest under the chooser selector, which would
|
|
2779
|
+
// explain the 确定 retry missing it) before giving up on the audio save.
|
|
2780
|
+
const inventory = await openDialogInventory(page);
|
|
2781
|
+
return result(
|
|
2782
|
+
`音频: 封面选择器完成后未关闭,未保存音频${inventory ? ` (dialogs: ${inventory})` : ''}`,
|
|
2783
|
+
);
|
|
2784
|
+
}
|
|
2753
2785
|
}
|
|
2754
2786
|
} finally {
|
|
2755
2787
|
if (temporaryDir !== undefined) {
|
|
@@ -2762,7 +2794,7 @@ export async function insertAudioMaterial(
|
|
|
2762
2794
|
const titleInput = await trySelectors(page, AUDIO_TITLE_INPUT);
|
|
2763
2795
|
if (titleInput.found) await fillSelector(page, titleInput.selector ?? AUDIO_TITLE_INPUT.join(', '), title);
|
|
2764
2796
|
const agreed = String(await page.evaluate(AGREE));
|
|
2765
|
-
if (agreed !== 'checked') return `音频: 服务规则勾选失败 (${agreed})
|
|
2797
|
+
if (agreed !== 'checked') return result(`音频: 服务规则勾选失败 (${agreed})`);
|
|
2766
2798
|
const save = await findSelector(
|
|
2767
2799
|
page,
|
|
2768
2800
|
UPLOAD_SAVE.map((selector) => `${selector}:not(.weui-desktop-btn_disabled):not([disabled])`),
|
|
@@ -2770,7 +2802,7 @@ export async function insertAudioMaterial(
|
|
|
2770
2802
|
90_000,
|
|
2771
2803
|
);
|
|
2772
2804
|
await clickSelector(page, save, 8_000);
|
|
2773
|
-
return
|
|
2805
|
+
return result('');
|
|
2774
2806
|
};
|
|
2775
2807
|
|
|
2776
2808
|
/** One MATCH read; a throwing probe stays 'error' (unknown, never treated as missing). */
|
|
@@ -2804,24 +2836,24 @@ export async function insertAudioMaterial(
|
|
|
2804
2836
|
if (match === 'missing') {
|
|
2805
2837
|
// No reusable material: upload one, then POLL until the new row actually exists — never
|
|
2806
2838
|
// assume the upload auto-selected a default row (task 0260 AC2).
|
|
2807
|
-
const
|
|
2808
|
-
if (
|
|
2839
|
+
const uploadResult = await upload();
|
|
2840
|
+
if (uploadResult.warning !== '') {
|
|
2809
2841
|
await page.evaluate(CANCEL);
|
|
2810
|
-
return
|
|
2842
|
+
return result(uploadResult.warning);
|
|
2811
2843
|
}
|
|
2812
2844
|
await waitForVisible(page, AUDIO_DIALOG, AUDIO_DIALOG_TIMEOUT_MS);
|
|
2813
2845
|
match = await awaitMatch();
|
|
2814
2846
|
if (match === 'missing') {
|
|
2815
2847
|
await page.evaluate(CANCEL);
|
|
2816
|
-
return `音频: 保存后素材列表未出现「${title}
|
|
2848
|
+
return result(`音频: 保存后素材列表未出现「${title}」,未插入音频`);
|
|
2817
2849
|
}
|
|
2818
2850
|
if (match === 'error') {
|
|
2819
2851
|
await page.evaluate(CANCEL);
|
|
2820
|
-
return '音频: 保存后素材匹配探测失败,未插入音频';
|
|
2852
|
+
return result('音频: 保存后素材匹配探测失败,未插入音频');
|
|
2821
2853
|
}
|
|
2822
2854
|
} else if (match === 'error') {
|
|
2823
2855
|
await page.evaluate(CANCEL);
|
|
2824
|
-
return '音频: 素材匹配探测失败,未插入音频';
|
|
2856
|
+
return result('音频: 素材匹配探测失败,未插入音频');
|
|
2825
2857
|
}
|
|
2826
2858
|
// Parse the match; anything but a unique ticked row stays a warning (never first-item).
|
|
2827
2859
|
let identity = '';
|
|
@@ -2829,32 +2861,36 @@ export async function insertAudioMaterial(
|
|
|
2829
2861
|
const parsed = JSON.parse(match) as { state?: string; identity?: string };
|
|
2830
2862
|
if (parsed.state !== 'checked') {
|
|
2831
2863
|
await page.evaluate(CANCEL);
|
|
2832
|
-
return
|
|
2864
|
+
return result(
|
|
2865
|
+
`音频: 素材「${title}」${parsed.state === 'ambiguous' ? '列表匹配到多个同名条目,身份不唯一' : parsed.state === 'nobox' ? '行没有勾选框' : '未选中'},未插入音频`,
|
|
2866
|
+
);
|
|
2833
2867
|
}
|
|
2834
2868
|
identity = parsed.identity ?? '';
|
|
2835
2869
|
} catch {
|
|
2836
2870
|
await page.evaluate(CANCEL);
|
|
2837
|
-
return '音频: 素材匹配探测返回未知结果,未插入音频';
|
|
2871
|
+
return result('音频: 素材匹配探测返回未知结果,未插入音频');
|
|
2838
2872
|
}
|
|
2839
2873
|
if ((await page.evaluate(INSERT)) !== true) {
|
|
2840
2874
|
await page.evaluate(CANCEL);
|
|
2841
|
-
return '音频: 插入按钮未找到,请手动插入';
|
|
2875
|
+
return result('音频: 插入按钮未找到,请手动插入');
|
|
2842
2876
|
}
|
|
2843
2877
|
await page.waitForTimeout?.(2_000);
|
|
2844
2878
|
let verdict: { state?: string; identity?: string };
|
|
2845
2879
|
try {
|
|
2846
2880
|
verdict = JSON.parse(String(await page.evaluate(VERIFY))) as { state?: string; identity?: string };
|
|
2847
2881
|
} catch {
|
|
2848
|
-
return '音频: 已插入但无法读取正文状态,请手动检查';
|
|
2882
|
+
return result('音频: 已插入但无法读取正文状态,请手动检查');
|
|
2849
2883
|
}
|
|
2850
|
-
if (verdict.state === 'absent' || verdict.state === 'noeditor') return '音频: 插入未生效,请手动检查';
|
|
2851
|
-
if (verdict.state !== 'top') return '音频: 已插入但未在文首,请手动调整位置';
|
|
2884
|
+
if (verdict.state === 'absent' || verdict.state === 'noeditor') return result('音频: 插入未生效,请手动检查');
|
|
2885
|
+
if (verdict.state !== 'top') return result('音频: 已插入但未在文首,请手动调整位置');
|
|
2852
2886
|
// Identity readback (0260 R2): success requires the selected identity to reappear on the
|
|
2853
2887
|
// inserted node; an unreadable identity is an unverifiable warning, never a silent pass.
|
|
2854
2888
|
if (identity === '' || (verdict.identity ?? '') === '' || verdict.identity !== identity)
|
|
2855
|
-
return
|
|
2856
|
-
|
|
2889
|
+
return result(
|
|
2890
|
+
`音频: 已插入文首但无法核对素材身份(selected=${identity || '未读到'} node=${(verdict.identity ?? '').slice(0, 60) || '未读到'}),请手动核对`,
|
|
2891
|
+
);
|
|
2892
|
+
return result('');
|
|
2857
2893
|
} catch (error) {
|
|
2858
|
-
return `音频: ${error instanceof Error ? error.message.slice(0, 120) : '自动插入失败'}
|
|
2894
|
+
return result(`音频: ${error instanceof Error ? error.message.slice(0, 120) : '自动插入失败'},请手动插入`);
|
|
2859
2895
|
}
|
|
2860
2896
|
}
|
|
@@ -94,6 +94,20 @@ export async function modalState(page: WechatPage): Promise<'closed' | 'open' |
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/** Best-effort key press + settle wait for the dialog sweeps. A page that died mid-run (browser
|
|
98
|
+
* crash or close) has no UI left to settle, and every sweep sits on a warning contract — the
|
|
99
|
+
* press must degrade to "nothing left to dismiss", never throw through the warning path
|
|
100
|
+
* (measured: the cover-stale-commit fixture run crashed when Chromium died between the
|
|
101
|
+
* committed-preview read and the Escape). */
|
|
102
|
+
export async function bestEffortPress(page: WechatPage, key: string, settleMs = 400): Promise<void> {
|
|
103
|
+
try {
|
|
104
|
+
await page.press?.(key);
|
|
105
|
+
await page.waitForTimeout?.(settleMs);
|
|
106
|
+
} catch {
|
|
107
|
+
// Page/context/browser already gone — nothing left to dismiss or settle.
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
97
111
|
/** A selector with an ATTACHED match (hidden inputs included), or `undefined` at the deadline. */
|
|
98
112
|
async function tryFindAttachedSelector(
|
|
99
113
|
page: WechatPage,
|
|
@@ -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) {
|
|
@@ -20701,10 +20701,12 @@ function sha256Hex(value) {
|
|
|
20701
20701
|
var DEFAULT_BOT_PROFILE_ROOT = join4(homedir4(), ".config", "kk", "browser-profiles");
|
|
20702
20702
|
class BotError extends Error {
|
|
20703
20703
|
code;
|
|
20704
|
-
|
|
20704
|
+
details;
|
|
20705
|
+
constructor(code, message, details = {}) {
|
|
20705
20706
|
super(message);
|
|
20706
20707
|
this.name = "BotError";
|
|
20707
20708
|
this.code = code;
|
|
20709
|
+
this.details = details;
|
|
20708
20710
|
}
|
|
20709
20711
|
}
|
|
20710
20712
|
// ../../packages/publish-harness/src/profile-dir.ts
|
|
@@ -20369,10 +20369,12 @@ function normalizeSessionIdentity(value) {
|
|
|
20369
20369
|
}
|
|
20370
20370
|
class BotError extends Error {
|
|
20371
20371
|
code;
|
|
20372
|
-
|
|
20372
|
+
details;
|
|
20373
|
+
constructor(code, message, details = {}) {
|
|
20373
20374
|
super(message);
|
|
20374
20375
|
this.name = "BotError";
|
|
20375
20376
|
this.code = code;
|
|
20377
|
+
this.details = details;
|
|
20376
20378
|
}
|
|
20377
20379
|
}
|
|
20378
20380
|
// ../../packages/publish-harness/src/index.ts
|
|
@@ -20777,7 +20779,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
20777
20779
|
shortVideo: Object.freeze({
|
|
20778
20780
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
20779
20781
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
20780
|
-
shipinhao: Object.freeze({ max:
|
|
20782
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
20781
20783
|
})
|
|
20782
20784
|
})
|
|
20783
20785
|
});
|
|
@@ -20945,11 +20947,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
20945
20947
|
});
|
|
20946
20948
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
20947
20949
|
if (manifest.browserSession !== undefined) {
|
|
20948
|
-
if (manifest.kind !== "publish") {
|
|
20950
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
20949
20951
|
ctx.addIssue({
|
|
20950
20952
|
code: "custom",
|
|
20951
20953
|
path: ["browserSession"],
|
|
20952
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
20954
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
20953
20955
|
});
|
|
20954
20956
|
}
|
|
20955
20957
|
if (manifest.check === undefined) {
|
|
@@ -19906,7 +19906,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
19906
19906
|
shortVideo: Object.freeze({
|
|
19907
19907
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
19908
19908
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
19909
|
-
shipinhao: Object.freeze({ max:
|
|
19909
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
19910
19910
|
})
|
|
19911
19911
|
})
|
|
19912
19912
|
});
|
|
@@ -20074,11 +20074,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
20074
20074
|
});
|
|
20075
20075
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
20076
20076
|
if (manifest.browserSession !== undefined) {
|
|
20077
|
-
if (manifest.kind !== "publish") {
|
|
20077
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
20078
20078
|
ctx.addIssue({
|
|
20079
20079
|
code: "custom",
|
|
20080
20080
|
path: ["browserSession"],
|
|
20081
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
20081
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
20082
20082
|
});
|
|
20083
20083
|
}
|
|
20084
20084
|
if (manifest.check === undefined) {
|
|
@@ -20726,10 +20726,12 @@ function sha256Hex(value) {
|
|
|
20726
20726
|
var DEFAULT_BOT_PROFILE_ROOT = join4(homedir4(), ".config", "kk", "browser-profiles");
|
|
20727
20727
|
class BotError extends Error {
|
|
20728
20728
|
code;
|
|
20729
|
-
|
|
20729
|
+
details;
|
|
20730
|
+
constructor(code, message, details = {}) {
|
|
20730
20731
|
super(message);
|
|
20731
20732
|
this.name = "BotError";
|
|
20732
20733
|
this.code = code;
|
|
20734
|
+
this.details = details;
|
|
20733
20735
|
}
|
|
20734
20736
|
}
|
|
20735
20737
|
// ../../packages/publish-harness/src/profile-dir.ts
|
|
@@ -20369,10 +20369,12 @@ function normalizeSessionIdentity(value) {
|
|
|
20369
20369
|
}
|
|
20370
20370
|
class BotError extends Error {
|
|
20371
20371
|
code;
|
|
20372
|
-
|
|
20372
|
+
details;
|
|
20373
|
+
constructor(code, message, details = {}) {
|
|
20373
20374
|
super(message);
|
|
20374
20375
|
this.name = "BotError";
|
|
20375
20376
|
this.code = code;
|
|
20377
|
+
this.details = details;
|
|
20376
20378
|
}
|
|
20377
20379
|
}
|
|
20378
20380
|
// ../../packages/publish-harness/src/index.ts
|
|
@@ -20777,7 +20779,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
20777
20779
|
shortVideo: Object.freeze({
|
|
20778
20780
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
20779
20781
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
20780
|
-
shipinhao: Object.freeze({ max:
|
|
20782
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
20781
20783
|
})
|
|
20782
20784
|
})
|
|
20783
20785
|
});
|
|
@@ -20945,11 +20947,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
20945
20947
|
});
|
|
20946
20948
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
20947
20949
|
if (manifest.browserSession !== undefined) {
|
|
20948
|
-
if (manifest.kind !== "publish") {
|
|
20950
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
20949
20951
|
ctx.addIssue({
|
|
20950
20952
|
code: "custom",
|
|
20951
20953
|
path: ["browserSession"],
|
|
20952
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
20954
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
20953
20955
|
});
|
|
20954
20956
|
}
|
|
20955
20957
|
if (manifest.check === undefined) {
|