@gobing-ai/knowledge-kit 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +418 -114
  3. package/package.json +5 -5
  4. package/plugins/generations/content-gen/dist/index.js +9 -9
  5. package/plugins/generations/core-facts-gen/dist/index.js +12 -12
  6. package/plugins/generations/daily-article-gen/dist/index.js +12 -12
  7. package/plugins/generations/dailynews-gen/dist/index.js +11 -11
  8. package/plugins/generations/dailynews-gen/src/script-plan.ts +2 -2
  9. package/plugins/generations/episode-plan-gen/dist/index.js +59 -18
  10. package/plugins/generations/episode-plan-gen/src/index.ts +71 -7
  11. package/plugins/generations/gemini-tts/dist/index.js +9 -9
  12. package/plugins/generations/image-gen/dist/index.js +9 -9
  13. package/plugins/generations/music-gen/dist/index.js +33 -29
  14. package/plugins/generations/music-gen/src/audio/measure.ts +25 -20
  15. package/plugins/generations/news-report-gen/dist/index.js +12 -12
  16. package/plugins/generations/vibe-voice-tts/dist/index.js +9 -9
  17. package/plugins/generations/voice-gen/dist/index.js +9 -9
  18. package/plugins/generations/voxcpm-tts/dist/index.js +9 -9
  19. package/plugins/ingestions/aihot-ingest/dist/index.js +12 -12
  20. package/plugins/ingestions/horizon-ingest/dist/index.js +12 -12
  21. package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
  22. package/plugins/ingestions/last30days-ingest/dist/index.js +12 -12
  23. package/plugins/ingestions/web-search/dist/index.js +10 -10
  24. package/plugins/kk/decisions/extract/ai-news.yaml +8 -1
  25. package/plugins/kk/plugin.json +1 -1
  26. package/plugins/kk/publish-presets/daily-ai-voice.json +20 -20
  27. package/plugins/kk/publish-presets/itc-main.json +39 -23
  28. package/plugins/kk/scripts/cover-compositor.ts +104 -26
  29. package/plugins/kk/scripts/daily-stages.ts +704 -53
  30. package/plugins/kk/scripts/kk-workflow-stages.ts +149 -6
  31. package/plugins/kk/scripts/series-names.ts +16 -3
  32. package/plugins/kk/skills/content-safety/references/platforms/apple-podcasts.md +12 -5
  33. package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +8 -0
  34. package/plugins/kk/skills/content-safety/references/platforms/xiaoyuzhou.md +5 -0
  35. package/plugins/kk/skills/daily-news-cover/SKILL.md +96 -0
  36. package/plugins/kk/skills/daily-news-illustrations/SKILL.md +123 -0
  37. package/plugins/kk/skills/news-editorial/SKILL.md +5 -3
  38. package/plugins/kk/skills/news-editorial/references/daily-visual-composition.md +150 -0
  39. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +3 -3
  40. package/plugins/kk/workflows/kk-article-generate.yaml +13 -1
  41. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +6 -3
  42. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +6 -4
  43. package/plugins/kk/workflows/kk-news-generate.yaml +74 -1
  44. package/plugins/publishings/bilibili-pub/dist/index.js +25 -24
  45. package/plugins/publishings/bilibili-pub/dist/profile-check.js +25 -24
  46. package/plugins/publishings/cnblogs-pub/dist/index.js +25 -24
  47. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +25 -24
  48. package/plugins/publishings/csdn-pub/dist/index.js +25 -24
  49. package/plugins/publishings/csdn-pub/dist/profile-check.js +25 -24
  50. package/plugins/publishings/emdash-pub/dist/index.js +9 -9
  51. package/plugins/publishings/infoq-pub/dist/index.js +25 -24
  52. package/plugins/publishings/infoq-pub/dist/profile-check.js +25 -24
  53. package/plugins/publishings/jike-pub/dist/index.js +25 -24
  54. package/plugins/publishings/jike-pub/dist/profile-check.js +25 -24
  55. package/plugins/publishings/juejin-pub/dist/index.js +25 -24
  56. package/plugins/publishings/juejin-pub/dist/profile-check.js +25 -24
  57. package/plugins/publishings/linkedin-pub/dist/index.js +85 -26
  58. package/plugins/publishings/linkedin-pub/dist/profile-check.js +25 -24
  59. package/plugins/publishings/linkedin-pub/src/index.ts +93 -6
  60. package/plugins/publishings/medium-pub/dist/index.js +9206 -287
  61. package/plugins/publishings/medium-pub/dist/profile-check.js +21174 -0
  62. package/plugins/publishings/medium-pub/package.json +3 -1
  63. package/plugins/publishings/medium-pub/plugin.json +6 -1
  64. package/plugins/publishings/medium-pub/src/browser-rail.ts +280 -0
  65. package/plugins/publishings/medium-pub/src/index.ts +17 -1
  66. package/plugins/publishings/medium-pub/src/profile-check.ts +27 -0
  67. package/plugins/publishings/podcast-pub/dist/index.js +240 -37
  68. package/plugins/publishings/podcast-pub/src/index.ts +154 -3
  69. package/plugins/publishings/podcast-pub/src/seo.ts +25 -8
  70. package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +93 -23
  71. package/plugins/publishings/podcast-pub/src/show-notes.ts +26 -6
  72. package/plugins/publishings/qiita-pub/dist/index.js +9 -9
  73. package/plugins/publishings/shipinhao-pub/dist/index.js +29 -26
  74. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +28 -26
  75. package/plugins/publishings/shipinhao-pub/src/flow.ts +5 -0
  76. package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -5
  77. package/plugins/publishings/sspai-pub/dist/index.js +25 -24
  78. package/plugins/publishings/sspai-pub/dist/profile-check.js +25 -24
  79. package/plugins/publishings/substack-pub/dist/index.js +25 -24
  80. package/plugins/publishings/substack-pub/dist/profile-check.js +25 -24
  81. package/plugins/publishings/surfdash-pub/dist/index.js +200 -92
  82. package/plugins/publishings/surfdash-pub/src/digest-check.ts +30 -1
  83. package/plugins/publishings/surfdash-pub/src/index.ts +94 -75
  84. package/plugins/publishings/surfdash-pub/src/media-upload.ts +83 -0
  85. package/plugins/publishings/surfdash-pub/src/patch.ts +28 -23
  86. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +12 -4
  87. package/plugins/publishings/threads-pub/dist/index.js +39 -24
  88. package/plugins/publishings/threads-pub/dist/profile-check.js +30 -24
  89. package/plugins/publishings/threads-pub/src/post-rail.ts +20 -0
  90. package/plugins/publishings/wechatmp-pub/dist/index.js +438 -102
  91. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +30 -25
  92. package/plugins/publishings/wechatmp-pub/src/enrich.ts +56 -10
  93. package/plugins/publishings/wechatmp-pub/src/flow.ts +589 -83
  94. package/plugins/publishings/wechatmp-pub/src/index.ts +4 -1
  95. package/plugins/publishings/wechatmp-pub/src/modes.ts +30 -12
  96. package/plugins/publishings/wechatmp-pub/src/page.ts +8 -0
  97. package/plugins/publishings/weibo-pub/dist/index.js +25 -24
  98. package/plugins/publishings/weibo-pub/dist/profile-check.js +25 -24
  99. package/plugins/publishings/x-pub/dist/index.js +54 -47
  100. package/plugins/publishings/x-pub/dist/profile-check.js +25 -24
  101. package/plugins/publishings/x-pub/src/post-rail.ts +40 -47
  102. package/plugins/publishings/xhs-pub/dist/index.js +25 -24
  103. package/plugins/publishings/xhs-pub/dist/profile-check.js +25 -24
  104. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +25 -24
  105. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +25 -24
  106. 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.5.32/node_modules/@gobing-ai/ts-utils/dist/errors.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/api-response.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/cursor.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/env.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/object.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/output.js
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.5.32/node_modules/@gobing-ai/ts-utils/dist/index.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/config.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
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.5.32+0f5f0476d0d466a6/node_modules/@gobing-ai/ts-browser-automation/dist/errors.js
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.5.32+0f5f0476d0d466a6/node_modules/@gobing-ai/ts-browser-automation/dist/launcher.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/index.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/path.js
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.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/index.js
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.5.32+0f5f0476d0d466a6/node_modules/@gobing-ai/ts-browser-automation/dist/profile-dir.js
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.5.32+0f5f0476d0d466a6/node_modules/@gobing-ai/ts-browser-automation/dist/launcher.js
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.5.32+0f5f0476d0d466a6/node_modules/@gobing-ai/ts-browser-automation/dist/operations.js
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;
@@ -20347,7 +20347,8 @@ async function busyGuidance(fileSystem, leaseDir) {
20347
20347
  }
20348
20348
  return `browser lease ${leaseDir} already exists with no owner record \u2014 a previous run may have crashed mid-acquire; confirm no kk browser still uses this profile, then remove ${leaseDir} manually`;
20349
20349
  }
20350
- return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 confirm that process and any browser for this profile have stopped; stale ownership is never auto-removed`;
20350
+ const suffix = isProcessAlive(owner.pid) ? "confirm that process and any browser for this profile have stopped; stale ownership is never auto-removed" : `pid ${owner.pid} is no longer running \u2014 confirm no browser for this profile is open, then remove the stale lease with: rm -rf ${leaseDir}`;
20351
+ return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
20351
20352
  }
20352
20353
  async function holderResidue(fileSystem, leaseDir) {
20353
20354
  try {
@@ -20595,7 +20596,7 @@ function resolveChannelProfileDir(channel, override) {
20595
20596
  return resolveBrowserProfileDir(channel, chosen);
20596
20597
  }
20597
20598
  async function checkChannelSession(config, opts) {
20598
- const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20599
+ const timeoutMs = opts.timeoutMs ?? config.checkTimeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20599
20600
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20600
20601
  let lastDetail = `${config.channel} readiness was never probed`;
20601
20602
  const deadline = Date.now() + timeoutMs;
@@ -21174,7 +21175,11 @@ var URL_INPUT = [`${URL_POPOVER} input.js_url[name="source_url"]`];
21174
21175
  var URL_CONFIRM = `${URL_POPOVER} a.jsPopoverBt:text-is("\u786E\u5B9A")`;
21175
21176
  var URL_CANCEL = `${URL_POPOVER} a.jsPopoverBt:text-is("\u53D6\u6D88")`;
21176
21177
  var ORIGINAL_DECLARATION = `${DIALOG} label:has(.js_original_type_radio):has-text("\u6587\u5B57\u539F\u521B")`;
21177
- var ORIGINAL_AGREEMENT = `${DIALOG} label.original_agreement:has(input[type="checkbox"]:not(:checked))`;
21178
+ var ORIGINAL_AGREEMENT = [
21179
+ `${DIALOG} label.original_agreement:has(input[type="checkbox"]:not(:checked))`,
21180
+ `${DIALOG} label:has(input[type="checkbox"]:not(:checked)):has-text("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F") i.weui-desktop-icon-checkbox`,
21181
+ `${DIALOG} label:has(input[type="checkbox"]:not(:checked)):has-text("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F")`
21182
+ ];
21178
21183
 
21179
21184
  // ../../plugins/publishings/wechatmp-pub/src/flow.ts
21180
21185
  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
- const ORIGINAL_AGREEMENT = `${DIALOG} label.original_agreement:has(input[type="checkbox"]:not(:checked))`;
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. Read the switch in the visible
102
- * row branch, never the hidden undeclared template or the dialog's matching checkbox. */
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
- warnings.push(`${name}: ${error.message}`);
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, [ORIGINAL_AGREEMENT]);
289
- if (agreement.found) {
290
- await clickSelector(page, ORIGINAL_AGREEMENT, 3_000);
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
- warnings.push(`${name}: 行不存在(当前公众号不支持),请手动处理或移除 originalUrl`);
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
- return warnings;
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
  }