@gobing-ai/knowledge-kit 0.1.23 → 0.1.24
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 +117 -56
- package/package.json +5 -5
- package/plugins/generations/content-gen/dist/index.js +9 -9
- package/plugins/generations/core-facts-gen/dist/index.js +12 -12
- package/plugins/generations/daily-article-gen/dist/index.js +12 -12
- package/plugins/generations/dailynews-gen/dist/index.js +11 -11
- package/plugins/generations/dailynews-gen/src/script-plan.ts +2 -2
- package/plugins/generations/episode-plan-gen/dist/index.js +12 -12
- package/plugins/generations/gemini-tts/dist/index.js +9 -9
- package/plugins/generations/image-gen/dist/index.js +9 -9
- package/plugins/generations/music-gen/dist/index.js +16 -16
- package/plugins/generations/news-report-gen/dist/index.js +12 -12
- package/plugins/generations/vibe-voice-tts/dist/index.js +9 -9
- package/plugins/generations/voice-gen/dist/index.js +9 -9
- package/plugins/generations/voxcpm-tts/dist/index.js +9 -9
- package/plugins/ingestions/aihot-ingest/dist/index.js +12 -12
- package/plugins/ingestions/horizon-ingest/dist/index.js +12 -12
- package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
- package/plugins/ingestions/last30days-ingest/dist/index.js +12 -12
- package/plugins/ingestions/web-search/dist/index.js +10 -10
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice.json +16 -16
- package/plugins/kk/scripts/cover-compositor.ts +104 -26
- package/plugins/kk/scripts/daily-stages.ts +217 -33
- package/plugins/kk/scripts/kk-workflow-stages.ts +144 -6
- package/plugins/kk/scripts/series-names.ts +16 -3
- package/plugins/kk/skills/news-editorial/SKILL.md +1 -1
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +3 -3
- package/plugins/kk/workflows/kk-news-generate.yaml +3 -0
- package/plugins/publishings/bilibili-pub/dist/index.js +22 -22
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/cnblogs-pub/dist/index.js +22 -22
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/csdn-pub/dist/index.js +22 -22
- package/plugins/publishings/csdn-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/emdash-pub/dist/index.js +9 -9
- package/plugins/publishings/infoq-pub/dist/index.js +22 -22
- package/plugins/publishings/infoq-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/jike-pub/dist/index.js +22 -22
- package/plugins/publishings/jike-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/juejin-pub/dist/index.js +22 -22
- package/plugins/publishings/juejin-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/linkedin-pub/dist/index.js +82 -24
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/linkedin-pub/src/index.ts +93 -6
- package/plugins/publishings/medium-pub/dist/index.js +9 -9
- package/plugins/publishings/podcast-pub/dist/index.js +240 -37
- package/plugins/publishings/podcast-pub/src/index.ts +154 -3
- package/plugins/publishings/podcast-pub/src/seo.ts +25 -8
- package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +93 -23
- package/plugins/publishings/podcast-pub/src/show-notes.ts +26 -6
- package/plugins/publishings/qiita-pub/dist/index.js +9 -9
- package/plugins/publishings/shipinhao-pub/dist/index.js +23 -23
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +23 -23
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +2 -1
- package/plugins/publishings/sspai-pub/dist/index.js +22 -22
- package/plugins/publishings/sspai-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/substack-pub/dist/index.js +22 -22
- package/plugins/publishings/substack-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/surfdash-pub/dist/index.js +200 -92
- package/plugins/publishings/surfdash-pub/src/digest-check.ts +30 -1
- package/plugins/publishings/surfdash-pub/src/index.ts +94 -75
- package/plugins/publishings/surfdash-pub/src/media-upload.ts +83 -0
- package/plugins/publishings/surfdash-pub/src/patch.ts +28 -23
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +12 -4
- package/plugins/publishings/threads-pub/dist/index.js +36 -22
- package/plugins/publishings/threads-pub/dist/profile-check.js +27 -22
- package/plugins/publishings/threads-pub/src/post-rail.ts +20 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +180 -64
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +27 -23
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +56 -10
- package/plugins/publishings/wechatmp-pub/src/flow.ts +155 -43
- package/plugins/publishings/wechatmp-pub/src/modes.ts +30 -12
- package/plugins/publishings/weibo-pub/dist/index.js +22 -22
- package/plugins/publishings/weibo-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/x-pub/dist/index.js +51 -45
- package/plugins/publishings/x-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/x-pub/src/post-rail.ts +40 -47
- package/plugins/publishings/xhs-pub/dist/index.js +22 -22
- package/plugins/publishings/xhs-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +22 -22
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/zenn-pub/dist/index.js +9 -9
|
@@ -45,7 +45,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
45
45
|
};
|
|
46
46
|
var __require = import.meta.require;
|
|
47
47
|
|
|
48
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
48
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/errors.js
|
|
49
49
|
var ErrorCode;
|
|
50
50
|
var init_errors = __esm(() => {
|
|
51
51
|
ErrorCode = {
|
|
@@ -56,7 +56,7 @@ var init_errors = __esm(() => {
|
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
59
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/api-response.js
|
|
60
60
|
var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
|
|
61
61
|
var init_api_response = __esm(() => {
|
|
62
62
|
init_errors();
|
|
@@ -79,10 +79,10 @@ var init_api_response = __esm(() => {
|
|
|
79
79
|
CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
82
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/cursor.js
|
|
83
83
|
var init_cursor = () => {};
|
|
84
84
|
|
|
85
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
85
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/env.js
|
|
86
86
|
function getEnvVar(name, fallback) {
|
|
87
87
|
const raw = process.env[name];
|
|
88
88
|
return raw === undefined ? fallback : raw;
|
|
@@ -91,10 +91,10 @@ function getEnvVars() {
|
|
|
91
91
|
return process.env;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
94
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
|
|
95
95
|
var init_event_severity = () => {};
|
|
96
96
|
|
|
97
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
97
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/object.js
|
|
98
98
|
function isPlainObject(value) {
|
|
99
99
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
100
100
|
}
|
|
@@ -112,7 +112,7 @@ function deepMerge(target, source) {
|
|
|
112
112
|
return result;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
115
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
116
116
|
function processStream(name) {
|
|
117
117
|
const proc = globalThis.process;
|
|
118
118
|
const stream = proc?.[name];
|
|
@@ -133,7 +133,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
|
|
|
133
133
|
}
|
|
134
134
|
var defaultStdoutTarget, defaultStderrTarget;
|
|
135
135
|
|
|
136
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
136
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/index.js
|
|
137
137
|
var init_dist = __esm(() => {
|
|
138
138
|
init_api_response();
|
|
139
139
|
init_cursor();
|
|
@@ -11931,7 +11931,7 @@ var init_zod = __esm(() => {
|
|
|
11931
11931
|
init_external();
|
|
11932
11932
|
});
|
|
11933
11933
|
|
|
11934
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
11934
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
11935
11935
|
function getProcessEnv() {
|
|
11936
11936
|
return getEnvVars();
|
|
11937
11937
|
}
|
|
@@ -12009,7 +12009,7 @@ var init_config = __esm(() => {
|
|
|
12009
12009
|
};
|
|
12010
12010
|
});
|
|
12011
12011
|
|
|
12012
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
12012
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
12013
12013
|
import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
12014
12014
|
import { dirname, resolve as resolvePath } from "path";
|
|
12015
12015
|
function createNodeFileSystem(root, paths) {
|
|
@@ -12096,7 +12096,7 @@ function findProjectRoot(startDir) {
|
|
|
12096
12096
|
}
|
|
12097
12097
|
var init_file_system_node = () => {};
|
|
12098
12098
|
|
|
12099
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
12099
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
|
|
12100
12100
|
var DbModuleNotInstalledError;
|
|
12101
12101
|
var init_db_errors = __esm(() => {
|
|
12102
12102
|
DbModuleNotInstalledError = class DbModuleNotInstalledError extends Error {
|
|
@@ -19307,7 +19307,7 @@ var init_execa = __esm(() => {
|
|
|
19307
19307
|
} = getIpcExport());
|
|
19308
19308
|
});
|
|
19309
19309
|
|
|
19310
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
19310
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
|
|
19311
19311
|
function resolveDeadline(optionTimeout, defaultTimeout) {
|
|
19312
19312
|
if (optionTimeout === null)
|
|
19313
19313
|
return null;
|
|
@@ -19399,7 +19399,7 @@ function ownProcessGroupLifecycle(ownership) {
|
|
|
19399
19399
|
}
|
|
19400
19400
|
var MAX_TIMEOUT_MS = 2147483647, DEFAULT_KILL_GRACE_MS = 5000, GROUP_POLL_INTERVAL_MS = 25, GROUP_KILL_PATIENCE_MS = 2000;
|
|
19401
19401
|
|
|
19402
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
19402
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
|
|
19403
19403
|
import { isatty } from "tty";
|
|
19404
19404
|
function processEventSeverity(reason, exitCode) {
|
|
19405
19405
|
if (reason === "error")
|
|
@@ -19771,7 +19771,7 @@ var init_process_executor = __esm(() => {
|
|
|
19771
19771
|
init_config();
|
|
19772
19772
|
});
|
|
19773
19773
|
|
|
19774
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
19774
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
|
|
19775
19775
|
function getNodeFileSystem() {
|
|
19776
19776
|
if (!_nodeFileSystem)
|
|
19777
19777
|
_nodeFileSystem = createNodeFileSystem();
|
|
@@ -19838,7 +19838,7 @@ import { parseArgs as parseArgs2 } from "util";
|
|
|
19838
19838
|
import { join as join5, resolve as resolve5 } from "path";
|
|
19839
19839
|
import { parseArgs } from "util";
|
|
19840
19840
|
|
|
19841
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
19841
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/errors.js
|
|
19842
19842
|
class BrowserAutomationError extends Error {
|
|
19843
19843
|
constructor(message, options) {
|
|
19844
19844
|
super(message, options);
|
|
@@ -19887,14 +19887,14 @@ class OperationAbortedError extends BrowserAutomationError {
|
|
|
19887
19887
|
this.name = "OperationAbortedError";
|
|
19888
19888
|
}
|
|
19889
19889
|
}
|
|
19890
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
19890
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/launcher.js
|
|
19891
19891
|
import { mkdir } from "fs/promises";
|
|
19892
19892
|
|
|
19893
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
19893
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
19894
19894
|
init_file_system_node();
|
|
19895
19895
|
init_config();
|
|
19896
19896
|
|
|
19897
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
19897
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
19898
19898
|
function normalizeSeparators(path) {
|
|
19899
19899
|
return path.replaceAll("\\", "/");
|
|
19900
19900
|
}
|
|
@@ -19952,10 +19952,10 @@ function getProcessCwd() {
|
|
|
19952
19952
|
return globalThis.process?.cwd?.() ?? "/";
|
|
19953
19953
|
}
|
|
19954
19954
|
|
|
19955
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
19955
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
19956
19956
|
init_runtime_node_bun();
|
|
19957
19957
|
|
|
19958
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
19958
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/profile-dir.js
|
|
19959
19959
|
function resolveProfileDir(profileDir) {
|
|
19960
19960
|
if (profileDir.trim() === "") {
|
|
19961
19961
|
throw new InvalidProfileDirError;
|
|
@@ -19967,7 +19967,7 @@ function resolveProfileDir(profileDir) {
|
|
|
19967
19967
|
return resolved;
|
|
19968
19968
|
}
|
|
19969
19969
|
|
|
19970
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
19970
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/launcher.js
|
|
19971
19971
|
var PROFILE_DIR_MODE = 448;
|
|
19972
19972
|
var BUSY_PROFILE_PATTERN = /singleton|already in use|in use by another/i;
|
|
19973
19973
|
var CHROMIUM_MISSING_PATTERN = /playwright install|executable doesn't exist/i;
|
|
@@ -20018,7 +20018,7 @@ function createPersistentLauncher(options = {}) {
|
|
|
20018
20018
|
};
|
|
20019
20019
|
}
|
|
20020
20020
|
|
|
20021
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
20021
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/operations.js
|
|
20022
20022
|
var DEFAULT_TIMEOUT_MS = 30000;
|
|
20023
20023
|
var POLL_INTERVAL_MS = 250;
|
|
20024
20024
|
var defaultLauncher;
|
|
@@ -21174,7 +21174,11 @@ var URL_INPUT = [`${URL_POPOVER} input.js_url[name="source_url"]`];
|
|
|
21174
21174
|
var URL_CONFIRM = `${URL_POPOVER} a.jsPopoverBt:text-is("\u786E\u5B9A")`;
|
|
21175
21175
|
var URL_CANCEL = `${URL_POPOVER} a.jsPopoverBt:text-is("\u53D6\u6D88")`;
|
|
21176
21176
|
var ORIGINAL_DECLARATION = `${DIALOG} label:has(.js_original_type_radio):has-text("\u6587\u5B57\u539F\u521B")`;
|
|
21177
|
-
var ORIGINAL_AGREEMENT =
|
|
21177
|
+
var ORIGINAL_AGREEMENT = [
|
|
21178
|
+
`${DIALOG} label.original_agreement:has(input[type="checkbox"]:not(:checked))`,
|
|
21179
|
+
`${DIALOG} label:has(input[type="checkbox"]:not(:checked)):has-text("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F") i.weui-desktop-icon-checkbox`,
|
|
21180
|
+
`${DIALOG} label:has(input[type="checkbox"]:not(:checked)):has-text("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F")`
|
|
21181
|
+
];
|
|
21178
21182
|
|
|
21179
21183
|
// ../../plugins/publishings/wechatmp-pub/src/flow.ts
|
|
21180
21184
|
var PUBLIC_SAVE_REFUSAL_CONTAINERS = [
|
|
@@ -72,8 +72,14 @@ const URL_COMMITTED = `(() => {
|
|
|
72
72
|
/** The 原创 dialog's declaration radio (measured 2026-10-13): the platform requires an explicit
|
|
73
73
|
* declaration type + the agreement check before 确定. `无需声明` is the undo choice, never a target. */
|
|
74
74
|
const ORIGINAL_DECLARATION = `${DIALOG} label:has(.js_original_type_radio):has-text("文字原创")`;
|
|
75
|
-
/** Drive the hidden checkbox through its label, preserving a pre-checked agreement (probe 6).
|
|
76
|
-
|
|
75
|
+
/** Drive the hidden checkbox through its label, preserving a pre-checked agreement (probe 6).
|
|
76
|
+
* Live 2026-11 WeChat v2 replaced `.original_agreement` with `.weui-desktop-form__check-label`, so
|
|
77
|
+
* match the legacy class first and fall back to the checkbox label containing the agreement text. */
|
|
78
|
+
const ORIGINAL_AGREEMENT = [
|
|
79
|
+
`${DIALOG} label.original_agreement:has(input[type="checkbox"]:not(:checked))`,
|
|
80
|
+
`${DIALOG} label:has(input[type="checkbox"]:not(:checked)):has-text("我已阅读并同意") i.weui-desktop-icon-checkbox`,
|
|
81
|
+
`${DIALOG} label:has(input[type="checkbox"]:not(:checked)):has-text("我已阅读并同意")`,
|
|
82
|
+
] as const;
|
|
77
83
|
/** The 合集 picker's options load after the dialog opens (the pre-ADR-029 settle, kept). */
|
|
78
84
|
const COLLECTION_SETTLE_MS = 1_200;
|
|
79
85
|
/** The settings panel re-renders after a dialog confirm and can briefly detach rows. */
|
|
@@ -98,9 +104,18 @@ function norm(value: unknown): string {
|
|
|
98
104
|
* Playwright-only syntax (`:visible`, `:has-text`) never enters `querySelector` — it throws there.
|
|
99
105
|
*/
|
|
100
106
|
const COMMITTED = {
|
|
101
|
-
/** Both undeclared and declared templates keep hidden inputs.
|
|
102
|
-
*
|
|
107
|
+
/** Both undeclared and declared templates keep hidden inputs. Live WeChat checks BOTH
|
|
108
|
+
* checkboxes (including the visible `未声明` row) as soon as `#js_original` opens while keeping
|
|
109
|
+
* `#js_original_open` hidden (`rects=0`), so require `#js_original_open` visibility + checked
|
|
110
|
+
* state whenever `#js_original_open` exists in the DOM; fall back to the legacy visible switch
|
|
111
|
+
* when `#js_original_open` is absent. */
|
|
103
112
|
original: `(() => {
|
|
113
|
+
const open = document.querySelector('#js_original_open');
|
|
114
|
+
if (open) {
|
|
115
|
+
if (open.getClientRects().length === 0) return false;
|
|
116
|
+
const sw = open.querySelector('input.weui-desktop-switch__input, input[type="checkbox"]');
|
|
117
|
+
return sw ? sw.checked === true : true;
|
|
118
|
+
}
|
|
104
119
|
const el = [...document.querySelectorAll('#js_original input.weui-desktop-switch__input')]
|
|
105
120
|
.find(input => input.parentElement?.getClientRects().length > 0);
|
|
106
121
|
return el ? el.checked === true : null;
|
|
@@ -180,6 +195,12 @@ async function readChecked(page: WechatPage, expression: string): Promise<boolea
|
|
|
180
195
|
}
|
|
181
196
|
}
|
|
182
197
|
|
|
198
|
+
/** Structured enrichment result separating account capability refusals from real setting failures. */
|
|
199
|
+
export interface EnrichOutcome {
|
|
200
|
+
warnings: string[];
|
|
201
|
+
capabilityWarnings: string[];
|
|
202
|
+
}
|
|
203
|
+
|
|
183
204
|
/**
|
|
184
205
|
* Set the operator's draft metadata (原创/赞赏/合集/原文链接/创作来源) in the v2 editor.
|
|
185
206
|
*
|
|
@@ -188,7 +209,13 @@ async function readChecked(page: WechatPage, expression: string): Promise<boolea
|
|
|
188
209
|
* into warnings and surfaced in the `Result`; the draft still saves.
|
|
189
210
|
*/
|
|
190
211
|
export async function enrichArticle(page: WechatPage, meta: Record<string, unknown>): Promise<string[]> {
|
|
212
|
+
return (await enrichArticleDetailed(page, meta)).warnings;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Same behavior as {@link enrichArticle}, also naming capability refusals separately. */
|
|
216
|
+
export async function enrichArticleDetailed(page: WechatPage, meta: Record<string, unknown>): Promise<EnrichOutcome> {
|
|
191
217
|
const warnings: string[] = [];
|
|
218
|
+
const capabilityWarnings: string[] = [];
|
|
192
219
|
const str = (key: string) => (typeof meta[key] === 'string' ? (meta[key] as string) : '');
|
|
193
220
|
const on = (key: string) => meta[key] === true;
|
|
194
221
|
// Sweep any leaked dialog so the next step (especially 保存为草稿) is never overlay-blocked.
|
|
@@ -247,7 +274,9 @@ export async function enrichArticle(page: WechatPage, meta: Record<string, unkno
|
|
|
247
274
|
return 'ok';
|
|
248
275
|
} catch (error) {
|
|
249
276
|
if (error instanceof CapabilityError) {
|
|
250
|
-
|
|
277
|
+
const msg = `${name}: ${error.message}`;
|
|
278
|
+
warnings.push(msg);
|
|
279
|
+
capabilityWarnings.push(msg);
|
|
251
280
|
return 'capability';
|
|
252
281
|
}
|
|
253
282
|
// retry once below
|
|
@@ -285,11 +314,17 @@ export async function enrichArticle(page: WechatPage, meta: Record<string, unkno
|
|
|
285
314
|
// then 确定. The plain-text probe the old rail used could hit the dialog heading.
|
|
286
315
|
await clickSelector(page, ORIGINAL_DECLARATION, 5_000);
|
|
287
316
|
// trySelectors absorbs its own probe failures (returns found:false) — no .catch here.
|
|
288
|
-
const agreement = await trySelectors(page,
|
|
289
|
-
if (agreement.found) {
|
|
290
|
-
await clickSelector(page,
|
|
317
|
+
const agreement = await trySelectors(page, ORIGINAL_AGREEMENT);
|
|
318
|
+
if (agreement.found && agreement.selector != null) {
|
|
319
|
+
await clickSelector(page, agreement.selector, 3_000);
|
|
291
320
|
}
|
|
292
321
|
await clickSelector(page, ORIGINAL_CONFIRM, 8_000);
|
|
322
|
+
// Allow async confirmation closing without calling page.evaluate (preserves mock FIFO queues).
|
|
323
|
+
await page
|
|
324
|
+
.locator(DIALOG)
|
|
325
|
+
.first()
|
|
326
|
+
.waitFor?.({ state: 'hidden', timeout: 1_500 })
|
|
327
|
+
.catch(() => undefined);
|
|
293
328
|
});
|
|
294
329
|
if (
|
|
295
330
|
outcome !== 'capability' &&
|
|
@@ -389,7 +424,9 @@ export async function enrichArticle(page: WechatPage, meta: Record<string, unkno
|
|
|
389
424
|
const urlRow =
|
|
390
425
|
(await readUrl()) === norm(originalUrl) ? 'committed' : await tryFindSelector(page, ROW_URL, 2_000);
|
|
391
426
|
if (urlRow === undefined) {
|
|
392
|
-
|
|
427
|
+
const msg = `${name}: 行不存在(当前公众号不支持),请手动处理或移除 originalUrl`;
|
|
428
|
+
warnings.push(msg);
|
|
429
|
+
capabilityWarnings.push(msg);
|
|
393
430
|
} else if (urlRow !== 'committed') {
|
|
394
431
|
await step(name, async () => {
|
|
395
432
|
if ((await readUrl()) === norm(originalUrl)) return;
|
|
@@ -444,5 +481,14 @@ export async function enrichArticle(page: WechatPage, meta: Record<string, unkno
|
|
|
444
481
|
}
|
|
445
482
|
|
|
446
483
|
await sweep();
|
|
447
|
-
|
|
484
|
+
// Recheck 原创声明 when subsequent settings ran: live WeChat can clear 原创 if 创作来源/合集
|
|
485
|
+
// resets editor state. Guarded on subsequent steps so single-setting mock queues do not shift.
|
|
486
|
+
const ranAfterOriginal = on('reward') || collection !== '' || originalUrl !== '' || claimSource !== '';
|
|
487
|
+
const hadOriginalWarning = warnings.some((w) => w.startsWith('原创声明:'));
|
|
488
|
+
if (on('original') && ranAfterOriginal && !hadOriginalWarning) {
|
|
489
|
+
if ((await readChecked(page, COMMITTED.original)) === false) {
|
|
490
|
+
warnings.push('原创声明: 后续设置后原创声明被重置,请核对');
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return { warnings, capabilityWarnings };
|
|
448
494
|
}
|