@gobing-ai/knowledge-kit 0.1.19 → 0.1.20

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 (54) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/daily-voice/index.js +40 -7
  3. package/dist/index.js +1379 -378
  4. package/package.json +1 -1
  5. package/plugins/generations/image-gen/README.md +31 -31
  6. package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
  7. package/plugins/generations/image-gen/config.example.yaml +3 -0
  8. package/plugins/generations/image-gen/dist/index.js +154 -14
  9. package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
  10. package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
  11. package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
  12. package/plugins/generations/image-gen/src/presets.ts +6 -5
  13. package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
  14. package/plugins/generations/image-gen/src/providers/types.ts +11 -1
  15. package/plugins/kk/config.example.yaml +3 -0
  16. package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
  17. package/plugins/kk/plugin.json +1 -1
  18. package/plugins/kk/publish-presets/daily-ai-voice.json +48 -7
  19. package/plugins/kk/scripts/daily-stages.ts +238 -14
  20. package/plugins/kk/skills/image-authoring/SKILL.md +7 -3
  21. package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
  22. package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
  23. package/plugins/kk/skills/publish/SKILL.md +11 -0
  24. package/plugins/kk/skills/web-automation/SKILL.md +31 -1
  25. package/plugins/kk/workflows/kk-collect.yaml +8 -4
  26. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +2 -1
  27. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -2
  28. package/plugins/publishings/linkedin-pub/dist/index.js +43 -6
  29. package/plugins/publishings/linkedin-pub/dist/profile-check.js +32 -5
  30. package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
  31. package/plugins/publishings/shipinhao-pub/dist/index.js +385 -31
  32. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +3 -1
  33. package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
  34. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +393 -0
  35. package/plugins/publishings/shipinhao-pub/src/flow.ts +227 -12
  36. package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
  37. package/plugins/publishings/surfdash-pub/dist/index.js +50 -8
  38. package/plugins/publishings/surfdash-pub/src/index.ts +59 -8
  39. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +34 -3
  40. package/plugins/publishings/threads-pub/dist/index.js +9196 -296
  41. package/plugins/publishings/threads-pub/dist/profile-check.js +21139 -0
  42. package/plugins/publishings/threads-pub/package.json +3 -1
  43. package/plugins/publishings/threads-pub/plugin.json +6 -1
  44. package/plugins/publishings/threads-pub/src/index.ts +8 -1
  45. package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
  46. package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
  47. package/plugins/publishings/wechatmp-pub/dist/index.js +7 -0
  48. package/plugins/publishings/wechatmp-pub/src/flow.ts +13 -0
  49. package/plugins/publishings/weibo-pub/dist/index.js +46 -2
  50. package/plugins/publishings/weibo-pub/src/index.ts +74 -2
  51. package/plugins/publishings/x-pub/dist/index.js +263 -43
  52. package/plugins/publishings/x-pub/dist/profile-check.js +3 -1
  53. package/plugins/publishings/x-pub/src/index.ts +15 -1
  54. package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
@@ -21028,7 +21028,9 @@ var SHP_VIDEO_SELECTORS = {
21028
21028
  originalAgreementCheckbox: 'div.declare-body-wrapper input[type="checkbox"].ant-checkbox-input',
21029
21029
  originalConfirmLabel: "\u58F0\u660E\u539F\u521B",
21030
21030
  saveButton: ['button:text-is("\u4FDD\u5B58\u8349\u7A3F")'],
21031
- publishButton: ['button:text-is("\u53D1\u8868")', '[role="button"]:text-is("\u53D1\u8868")']
21031
+ publishButton: ['button:text-is("\u53D1\u8868")', '[role="button"]:text-is("\u53D1\u8868")'],
21032
+ collectionEntry: ['button:has-text("\u5408\u96C6")', 'div:has-text("\u5408\u96C6")', 'span:has-text("\u5408\u96C6")'],
21033
+ collectionLabel: "\u5408\u96C6"
21032
21034
  };
21033
21035
  var SHP_AUDIO_SELECTORS = {
21034
21036
  ...SHP_VIDEO_SELECTORS,
@@ -21071,14 +21073,255 @@ var SHP_CONFIG = {
21071
21073
  checkHeadedOnly: false
21072
21074
  };
21073
21075
 
21076
+ // ../../plugins/publishings/shipinhao-pub/src/audio-flow.ts
21077
+ var SHP_AUDIO_MANAGER_PATH = "/platform/post/audioManager";
21078
+ var SHP_AUDIO_CREATE_PATH = "/platform/post/createAudio";
21079
+ var SHP_AUDIO_TITLE_MAX = 40;
21080
+ var SHP_AUDIO_DESCRIPTION_MAX = 3000;
21081
+ var SHP_AUDIO_RECEIPT_MS = 30000;
21082
+ var receiptBudgetMs = null;
21083
+ function stageFail(message, stage, metadata, evidence) {
21084
+ return ResultSchema.parse({
21085
+ ok: false,
21086
+ target: SHP_TARGET,
21087
+ error: message,
21088
+ effect: "unknown",
21089
+ metadata: { ...metadata, stage, ...evidence === undefined ? {} : { evidence } }
21090
+ });
21091
+ }
21092
+ async function expectOutcome2(probe, timeoutMs, label) {
21093
+ const deadline = Date.now() + timeoutMs;
21094
+ let last = `${label} never observed`;
21095
+ for (;; ) {
21096
+ try {
21097
+ const value = await probe();
21098
+ if (value !== null)
21099
+ return { ok: true, evidence: value };
21100
+ } catch (error) {
21101
+ last = `${label}: ${error instanceof Error ? error.message : String(error)}`;
21102
+ }
21103
+ if (Date.now() >= deadline)
21104
+ return { ok: false, error: last };
21105
+ await new Promise((resolve) => setTimeout(resolve, 500));
21106
+ }
21107
+ }
21108
+ function buildAudioDescription(body, tags) {
21109
+ const topicLine = tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ");
21110
+ const combined = topicLine.length > 0 ? `${body.trim()}
21111
+
21112
+ ${topicLine}` : body.trim();
21113
+ return combined.slice(0, SHP_AUDIO_DESCRIPTION_MAX);
21114
+ }
21115
+ function clipAudioTitle(title) {
21116
+ return Array.from(title.trim()).slice(0, SHP_AUDIO_TITLE_MAX).join("");
21117
+ }
21118
+ async function openAudioCreate(page, stepTimeoutMs) {
21119
+ await page.goto("https://channels.weixin.qq.com/platform", {
21120
+ waitUntil: "domcontentloaded",
21121
+ timeout: stepTimeoutMs
21122
+ });
21123
+ await page.waitForTimeout(8000);
21124
+ const menu = page.locator('a:has-text("\u5185\u5BB9\u7BA1\u7406")').first();
21125
+ await menu.hover({ timeout: stepTimeoutMs });
21126
+ await page.waitForTimeout(2000);
21127
+ const clicked = await page.evaluate(`(() => {
21128
+ const anchor = Array.from(document.querySelectorAll('a')).find((el) => (el.textContent || '').trim() === '\u97F3\u9891');
21129
+ if (!anchor) return false;
21130
+ anchor.click();
21131
+ return true;
21132
+ })()`);
21133
+ if (!clicked)
21134
+ return "\u97F3\u9891 submenu entry not found under \u5185\u5BB9\u7BA1\u7406";
21135
+ const manager = await expectOutcome2(async () => page.url().includes(SHP_AUDIO_MANAGER_PATH) ? page.url() : null, stepTimeoutMs, "\u97F3\u9891\u7BA1\u7406 page");
21136
+ if (!manager.ok)
21137
+ return `\u97F3\u9891\u7BA1\u7406 page never opened: ${manager.error}`;
21138
+ const entry = page.locator('button:has-text("\u53D1\u8868\u97F3\u9891")').first();
21139
+ const ready = await expectOutcome2(async () => await entry.count() > 0 ? "\u53D1\u8868\u97F3\u9891 entry rendered" : null, stepTimeoutMs, "\u97F3\u9891\u7BA1\u7406 \u53D1\u8868\u97F3\u9891 entry");
21140
+ if (!ready.ok)
21141
+ return `\u53D1\u8868\u97F3\u9891 entry never rendered on \u97F3\u9891\u7BA1\u7406: ${ready.error}`;
21142
+ await entry.click({ timeout: stepTimeoutMs });
21143
+ const create = await expectOutcome2(async () => page.url().includes(SHP_AUDIO_CREATE_PATH) ? page.url() : null, stepTimeoutMs, "\u53D1\u8868\u97F3\u9891 form");
21144
+ if (!create.ok)
21145
+ return `\u53D1\u8868\u97F3\u9891 form never opened: ${create.error}`;
21146
+ return null;
21147
+ }
21148
+ async function attachAudio(page, file, stepTimeoutMs) {
21149
+ const zone = page.locator("text=\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20").first();
21150
+ if (await zone.count() === 0)
21151
+ return "audio drop zone (\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20) not found";
21152
+ const chooserPromise = page.waitForEvent("filechooser", { timeout: stepTimeoutMs }).catch(() => null);
21153
+ await zone.click({ timeout: stepTimeoutMs });
21154
+ const chooser = await chooserPromise;
21155
+ if (chooser === null)
21156
+ return "clicking the audio drop zone opened no file chooser";
21157
+ await chooser.setFiles(file);
21158
+ const name = file.split("/").pop() ?? "";
21159
+ const attached = await expectOutcome2(async () => await page.locator(`text=${name.slice(0, 12)}`).count() > 0 ? "file chip rendered" : null, 60000, "audio file chip");
21160
+ if (!attached.ok)
21161
+ return `the file was handed to the form but no file chip appeared: ${attached.error}`;
21162
+ return null;
21163
+ }
21164
+ async function attachAudioCover(page, coverPath, stepTimeoutMs) {
21165
+ const hint = page.locator("text=\u5C01\u9762\u5BBD\u9AD8\u6BD4").first();
21166
+ if (await hint.count() === 0)
21167
+ return "\u97F3\u9891 \u5C01\u9762 hint (\u5C01\u9762\u5BBD\u9AD8\u6BD4) not found";
21168
+ await hint.scrollIntoViewIfNeeded();
21169
+ const box = await hint.boundingBox();
21170
+ if (box === null)
21171
+ return "\u97F3\u9891 \u5C01\u9762 tile has no layout box";
21172
+ const chooserPromise = page.waitForEvent("filechooser", { timeout: stepTimeoutMs }).catch(() => null);
21173
+ await page.mouse.click(box.x + 40, box.y - 70);
21174
+ const chooser = await chooserPromise;
21175
+ if (chooser === null)
21176
+ return "clicking the \u5C01\u9762 tile opened no file chooser";
21177
+ await chooser.setFiles(coverPath);
21178
+ const cropped = await expectOutcome2(async () => {
21179
+ const confirm = page.locator('button:text-is("\u786E\u8BA4")').first();
21180
+ if (await confirm.count() === 0 || !await confirm.isVisible().catch(() => false))
21181
+ return null;
21182
+ await confirm.click({ timeout: 4000 }).catch(() => {});
21183
+ return "crop confirmed";
21184
+ }, stepTimeoutMs, "\u7F16\u8F91\u97F3\u9891\u5C01\u9762 crop dialog");
21185
+ if (!cropped.ok)
21186
+ return `the \u5C01\u9762 crop dialog never appeared: ${cropped.error}`;
21187
+ const cleared = await expectOutcome2(async () => await page.locator("text=\u8BF7\u4E0A\u4F20\u5C01\u9762").count() === 0 ? "cover accepted" : null, stepTimeoutMs, "\u97F3\u9891 \u5C01\u9762 validation");
21188
+ if (!cleared.ok)
21189
+ return `the \u5C01\u9762 was uploaded but the form still reports \u300C\u8BF7\u4E0A\u4F20\u5C01\u9762\u300D: ${cleared.error}`;
21190
+ return null;
21191
+ }
21192
+ async function selectAudioCollection(page, collection, stepTimeoutMs) {
21193
+ const picker = page.locator('div.display-text:has-text("\u9009\u62E9\u5408\u96C6")').first();
21194
+ if (await picker.count() === 0)
21195
+ return "\u5408\u96C6 picker (\u9009\u62E9\u5408\u96C6) not found on the audio form";
21196
+ await picker.scrollIntoViewIfNeeded();
21197
+ const row = await picker.elementHandle();
21198
+ await picker.click({ timeout: stepTimeoutMs });
21199
+ await page.waitForTimeout(2000);
21200
+ const option = page.getByText(collection, { exact: true });
21201
+ if (await option.count() === 0)
21202
+ return `\u5408\u96C6 '${collection}' is not among this account's \u97F3\u9891 collections`;
21203
+ await option.last().click({ timeout: stepTimeoutMs });
21204
+ const readback = await expectOutcome2(async () => {
21205
+ const text = (await row?.textContent() ?? "").trim();
21206
+ return text.includes(collection) ? text : null;
21207
+ }, stepTimeoutMs, "\u5408\u96C6 readback");
21208
+ if (!readback.ok)
21209
+ return `\u5408\u96C6 '${collection}' was clicked but the form does not show it: ${readback.error}`;
21210
+ return null;
21211
+ }
21212
+ async function countAudioRows(page, title) {
21213
+ try {
21214
+ return await page.getByText(title, { exact: false }).count();
21215
+ } catch {
21216
+ return 0;
21217
+ }
21218
+ }
21219
+ async function runAudioPostFlow(input) {
21220
+ const { collection, publishPublic, operation, profileDir } = input;
21221
+ const metadata = {
21222
+ operation,
21223
+ driver: "script",
21224
+ publishStatus: publishPublic ? "public" : "draft",
21225
+ profileDir,
21226
+ ...collection !== undefined ? { collection } : {}
21227
+ };
21228
+ if (!publishPublic) {
21229
+ return stageFail("shipinhao \u97F3\u9891 has no draft rail \u2014 the \u53D1\u8868\u97F3\u9891 form offers only \u53D1\u8868\u97F3\u9891 (no \u4FDD\u5B58\u8349\u7A3F); request publishStatus: public or publish nothing", "draft-unsupported", metadata);
21230
+ }
21231
+ if (input.coverPath === undefined) {
21232
+ return stageFail("shipinhao \u97F3\u9891 requires a cover (\u5C01\u9762) \u2014 the form refuses to submit without one (\u300C\u8BF7\u4E0A\u4F20\u5C01\u9762\u300D); pass coverPath", "audio-cover", metadata);
21233
+ }
21234
+ return pendingAudioFlow(input, metadata);
21235
+ }
21236
+ async function pendingAudioFlow(input, metadata) {
21237
+ const { page, title, body, tags, media, collection, profileDir, stepTimeoutMs } = input;
21238
+ const audio = media[0];
21239
+ if (audio === undefined)
21240
+ return stageFail("shipinhao \u97F3\u9891 requires one audio file", "media", metadata);
21241
+ const opened = await openAudioCreate(page, stepTimeoutMs);
21242
+ if (opened !== null)
21243
+ return stageFail(opened, "audio-open", metadata);
21244
+ const attached = await attachAudio(page, audio, stepTimeoutMs);
21245
+ if (attached !== null)
21246
+ return stageFail(attached, "audio-upload", metadata);
21247
+ const clipped = clipAudioTitle(title);
21248
+ const description = buildAudioDescription(body, tags);
21249
+ const titleInput = page.locator('input[placeholder="\u8BF7\u586B\u5199\u6807\u9898"]').first();
21250
+ if (await titleInput.count() === 0)
21251
+ return stageFail("\u97F3\u9891 \u6807\u9898 input not found", "audio-title", metadata);
21252
+ await titleInput.fill(clipped);
21253
+ const titleOk = await expectOutcome2(async () => await titleInput.inputValue() === clipped ? "title retained" : null, stepTimeoutMs, "\u97F3\u9891 \u6807\u9898 readback");
21254
+ if (!titleOk.ok)
21255
+ return stageFail(`\u97F3\u9891 \u6807\u9898 readback failed: ${titleOk.error}`, "audio-title", metadata);
21256
+ const descriptionBox = page.locator('textarea[placeholder="\u8BF7\u586B\u5199\u63CF\u8FF0"]').first();
21257
+ if (await descriptionBox.count() === 0)
21258
+ return stageFail("\u97F3\u9891 \u63CF\u8FF0 textarea not found", "audio-description", metadata);
21259
+ await descriptionBox.fill(description);
21260
+ const descriptionOk = await expectOutcome2(async () => (await descriptionBox.inputValue()).length > 0 ? "description retained" : null, stepTimeoutMs, "\u97F3\u9891 \u63CF\u8FF0 readback");
21261
+ if (!descriptionOk.ok) {
21262
+ return stageFail(`\u97F3\u9891 \u63CF\u8FF0 readback failed: ${descriptionOk.error}`, "audio-description", metadata);
21263
+ }
21264
+ const coverPath = input.coverPath;
21265
+ if (coverPath !== undefined) {
21266
+ const cover = await attachAudioCover(page, coverPath, stepTimeoutMs);
21267
+ if (cover !== null)
21268
+ return stageFail(cover, "audio-cover", metadata);
21269
+ }
21270
+ if (collection !== undefined) {
21271
+ const selected = await selectAudioCollection(page, collection, stepTimeoutMs);
21272
+ if (selected !== null)
21273
+ return stageFail(selected, "collection-select", metadata);
21274
+ } else {
21275
+ const readback = await page.locator('div.display-text:has-text("\u9009\u62E9\u5408\u96C6")').count();
21276
+ if (readback === 0) {
21277
+ return stageFail("\u5408\u96C6 row missing before submit", "collection-select", metadata);
21278
+ }
21279
+ }
21280
+ const baseline = await countAudioRows(page, clipped);
21281
+ const submit = page.locator('button:has-text("\u53D1\u8868\u97F3\u9891")').first();
21282
+ if (await submit.count() === 0)
21283
+ return stageFail("\u53D1\u8868\u97F3\u9891 submit control not found", "audio-submit", metadata);
21284
+ if (await submit.isDisabled())
21285
+ return stageFail("\u53D1\u8868\u97F3\u9891 submit control is disabled", "audio-submit", metadata);
21286
+ await submit.click({ timeout: stepTimeoutMs });
21287
+ await page.waitForTimeout(3000);
21288
+ for (const label of ["\u786E\u8BA4\u53D1\u8868", "\u786E\u5B9A"]) {
21289
+ const confirm = page.locator(`button:text-is("${label}")`).first();
21290
+ if (await confirm.count() > 0 && await confirm.isVisible().catch(() => false)) {
21291
+ await confirm.click({ timeout: 5000 }).catch(() => {});
21292
+ break;
21293
+ }
21294
+ }
21295
+ const receipt = await expectOutcome2(async () => {
21296
+ if (!page.url().includes(SHP_AUDIO_MANAGER_PATH))
21297
+ return null;
21298
+ const count = await countAudioRows(page, clipped);
21299
+ if (count <= baseline)
21300
+ return null;
21301
+ return { url: page.url(), rows: count };
21302
+ }, receiptBudgetMs ?? SHP_AUDIO_RECEIPT_MS, "\u97F3\u9891 list row");
21303
+ if (!receipt.ok) {
21304
+ return stageFail("shipinhao \u97F3\u9891 publish-receipt not confirmed \u2014 \u53D1\u8868\u97F3\u9891 was clicked but no new row carrying the title appeared in \u97F3\u9891\u7BA1\u7406; a submit without a works row is unknown and is never reported as published", "audio-receipt", metadata, receipt.error);
21305
+ }
21306
+ return ResultSchema.parse({
21307
+ ok: true,
21308
+ target: SHP_TARGET,
21309
+ url: receipt.evidence.url,
21310
+ message: `shipinhao audio published and confirmed in the \u97F3\u9891 list (${profileDir})`,
21311
+ metadata: { ...metadata, confirmedBy: "audio-list-row", rowsWithTitle: receipt.evidence.rows }
21312
+ });
21313
+ }
21314
+
21074
21315
  // ../../plugins/publishings/shipinhao-pub/src/flow.ts
21075
21316
  var STEP_TIMEOUT_MS = 30000;
21317
+ var PREFLIGHT_TIMEOUT_MS = 180000;
21318
+ var COLLECTION_PROBE_MS = 2000;
21076
21319
  var MAX_VIDEO_BYTES = 2 * 1024 * 1024 * 1024;
21077
21320
  var SHP_LOGIN_INSTRUCTION = "bun plugins/publishings/shipinhao-pub/src/profile-check.ts login";
21078
21321
  function fail(target, error) {
21079
21322
  return ResultSchema.parse({ ok: false, target, error: boundedDetail(error) });
21080
21323
  }
21081
- function stageFail(target, error, stage, metadata, evidence, effect = "none") {
21324
+ function stageFail2(target, error, stage, metadata, evidence, effect = "none") {
21082
21325
  return ResultSchema.parse({
21083
21326
  ok: false,
21084
21327
  target,
@@ -21375,12 +21618,20 @@ function resolveOriginal(raw) {
21375
21618
  }
21376
21619
  return { original: raw };
21377
21620
  }
21621
+ function resolveCollection(raw) {
21622
+ if (raw === undefined)
21623
+ return {};
21624
+ if (typeof raw !== "string" || raw.trim().length === 0) {
21625
+ return { error: `collection must be a nonempty string when present, got '${bounded(raw)}'` };
21626
+ }
21627
+ return { collection: raw.trim() };
21628
+ }
21378
21629
  function unsupportedFields(payload, operation) {
21379
21630
  const perOperation = {
21380
- shortVideo: ["images", "categories", "publishTime", "scheduling"],
21631
+ shortVideo: ["images", "categories", "publishTime", "scheduling", "collection"],
21381
21632
  audio: ["videoPath", "images", "categories", "publishTime", "scheduling"],
21382
- music: ["videoPath", "images", "categories", "publishTime", "scheduling"],
21383
- image: ["videoPath", "coverPath", "categories", "publishTime", "scheduling"]
21633
+ music: ["videoPath", "images", "categories", "publishTime", "scheduling", "collection"],
21634
+ image: ["videoPath", "coverPath", "categories", "publishTime", "scheduling", "collection"]
21384
21635
  };
21385
21636
  const refused = [];
21386
21637
  for (const [container, source] of [
@@ -21409,6 +21660,40 @@ function editingFormReadyScript(mode, titleSelector, editorSelector) {
21409
21660
  return JSON.stringify({ ready: title !== null && editor !== null });
21410
21661
  })()`;
21411
21662
  }
21663
+ function collectionScript(mode, action, label, name) {
21664
+ return `${rootScriptPrefix(mode)} // kk-shp-collection
21665
+ const label = ${JSON.stringify(label)};
21666
+ const name = ${JSON.stringify(name)};
21667
+ const action = ${JSON.stringify(action)};
21668
+ const roots = [document, root].filter(Boolean);
21669
+ const ownText = (el) => Array.from(el.childNodes).filter((n) => n.nodeType === 3).map((n) => (n.textContent || '').trim()).join(' ').trim();
21670
+ const rendered = (el) => { const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0; };
21671
+ const all = [];
21672
+ for (const scope of roots) {
21673
+ if (!scope || !scope.querySelectorAll) continue;
21674
+ for (const el of scope.querySelectorAll('*')) all.push(el);
21675
+ }
21676
+ const row = all.find((el) => rendered(el) && ownText(el).startsWith(label));
21677
+ if (action === 'click-entry') {
21678
+ if (!row) return JSON.stringify({ ok: false, reason: 'entry-absent' });
21679
+ const target = row.closest('button, div, li, label') || row;
21680
+ target.click();
21681
+ return JSON.stringify({ ok: true, text: String(row.textContent || '').trim().slice(0, 80) });
21682
+ }
21683
+ if (action === 'click-option') {
21684
+ const exact = all.filter((el) => rendered(el) && ownText(el) === name);
21685
+ if (exact.length > 0) {
21686
+ const option = exact[exact.length - 1];
21687
+ (option.closest('li, div, label, button') || option).click();
21688
+ return JSON.stringify({ ok: true, how: 'text' });
21689
+ }
21690
+ const near = all.filter((el) => rendered(el) && ownText(el).includes(name)).map((el) => ownText(el).slice(0, 40));
21691
+ return JSON.stringify({ ok: false, reason: 'option-absent', seen: [...new Set(near)].slice(0, 8) });
21692
+ }
21693
+ const state = row === undefined ? '' : String(row.textContent || '').trim().slice(0, 120);
21694
+ return JSON.stringify({ ok: state.includes(name), text: state });
21695
+ })()`;
21696
+ }
21412
21697
  function originalEntryScript(mode, action) {
21413
21698
  const ensure = action === "ensure";
21414
21699
  return `${rootScriptPrefix(mode)}
@@ -21548,11 +21833,13 @@ class ShipinhaoBrowserTransport {
21548
21833
  operation;
21549
21834
  launcher;
21550
21835
  stepTimeoutMs;
21836
+ preflightTimeoutMs;
21551
21837
  constructor(operation = "shortVideo", driver = "script", deps = {}) {
21552
21838
  this.operation = operation;
21553
21839
  this.driver = driver;
21554
21840
  this.launcher = deps.launcher ?? kkBrowserLauncher;
21555
21841
  this.stepTimeoutMs = deps.stepTimeoutMs ?? STEP_TIMEOUT_MS;
21842
+ this.preflightTimeoutMs = deps.preflightTimeoutMs ?? PREFLIGHT_TIMEOUT_MS;
21556
21843
  }
21557
21844
  async publish(payload) {
21558
21845
  if (this.driver !== "script") {
@@ -21590,7 +21877,7 @@ class ShipinhaoBrowserTransport {
21590
21877
  if (audio.error !== undefined)
21591
21878
  return fail(SHP_TARGET, audio.error);
21592
21879
  media = [audio.path];
21593
- const cover = await resolveCoverPath(payload.content.metadata?.coverPath ?? payload.options?.coverPath);
21880
+ const cover = await resolveCoverPath(payload.content.metadata?.coverPath ?? payload.options?.coverPath ?? metadataRecord.coverImage);
21594
21881
  if (cover.error !== undefined)
21595
21882
  return fail(SHP_TARGET, cover.error);
21596
21883
  coverPath = cover.path;
@@ -21606,6 +21893,9 @@ class ShipinhaoBrowserTransport {
21606
21893
  const original = resolveOriginal(payload.content.metadata?.original);
21607
21894
  if (original.error !== undefined)
21608
21895
  return fail(SHP_TARGET, original.error);
21896
+ const collection = resolveCollection(payload.options?.collection ?? payload.content.metadata?.collection);
21897
+ if (collection.error !== undefined)
21898
+ return fail(SHP_TARGET, collection.error);
21609
21899
  const unsupported = unsupportedFields(payload, this.operation);
21610
21900
  if (unsupported.length > 0) {
21611
21901
  return fail(SHP_TARGET, `unsupported field(s) ${unsupported.join(", ")} for shipinhao ${this.operation}: implemented fields are title/description/tags/media/cover/original declaration only, and scheduling/publishTime is an unported vendor enhancement (shipinhao.js:7-9)`);
@@ -21615,11 +21905,10 @@ class ShipinhaoBrowserTransport {
21615
21905
  const session = await checkChannelSession(SHP_CONFIG, {
21616
21906
  profileDir,
21617
21907
  launcher: this.launcher,
21618
- headedFallback: false,
21619
- timeoutMs: this.stepTimeoutMs
21908
+ timeoutMs: this.preflightTimeoutMs
21620
21909
  });
21621
21910
  if (session.status !== "verified") {
21622
- return fail(SHP_TARGET, `${SHP_TARGET} session preflight refused \u2014 run: ${SHP_LOGIN_INSTRUCTION} \u2014 detail: ${session.detail}`);
21911
+ return stageFail2(SHP_TARGET, `${SHP_TARGET} session preflight refused \u2014 run: ${SHP_LOGIN_INSTRUCTION} \u2014 detail: ${session.detail}`, "session-preflight", { operation: this.operation, publishStatus: "draft" }, undefined, "none");
21623
21912
  }
21624
21913
  try {
21625
21914
  return await withProfilePage({
@@ -21629,53 +21918,71 @@ class ShipinhaoBrowserTransport {
21629
21918
  headless: payload.options?.headless === true,
21630
21919
  launcher: this.launcher,
21631
21920
  timeoutMs: this.stepTimeoutMs
21632
- }, async ({ page }) => this.runPostFlow(page, POST_FLOW_SPECS[this.operation], title, body, tags.tags, original.original === true, media, coverPath, requested === "public", profileDir));
21921
+ }, async ({ page }) => {
21922
+ if (this.operation === "audio") {
21923
+ return runAudioPostFlow({
21924
+ page,
21925
+ title,
21926
+ body,
21927
+ tags: tags.tags,
21928
+ media,
21929
+ coverPath,
21930
+ collection: collection.collection,
21931
+ publishPublic: requested === "public",
21932
+ operation: this.operation,
21933
+ profileDir,
21934
+ stepTimeoutMs: this.stepTimeoutMs
21935
+ });
21936
+ }
21937
+ return this.runPostFlow(page, POST_FLOW_SPECS[this.operation], title, body, tags.tags, original.original === true, collection.collection, media, coverPath, requested === "public", profileDir);
21938
+ });
21633
21939
  } catch (error) {
21634
21940
  const detail = errorMessage3(error);
21635
21941
  return fail(SHP_TARGET, needsLogin(error) ? `${SHP_TARGET} session failed \u2014 run: ${SHP_LOGIN_INSTRUCTION} \u2014 detail: ${detail}` : detail);
21636
21942
  }
21637
21943
  }
21638
- async runPostFlow(page, spec, title, body, tags, declareOriginal, media, coverPath, publishPublic, profileDir) {
21944
+ async runPostFlow(page, spec, title, body, tags, declareOriginal, collection, media, coverPath, publishPublic, profileDir) {
21639
21945
  const publishStatus = publishPublic ? "public" : "draft";
21640
21946
  const metadata = {
21641
21947
  operation: this.operation,
21642
21948
  driver: this.driver,
21643
21949
  publishStatus,
21644
21950
  profileDir,
21645
- ...declareOriginal ? { original: true } : {}
21951
+ ...declareOriginal ? { original: true } : {},
21952
+ ...collection !== undefined ? { collection } : {}
21646
21953
  };
21647
21954
  const entrySnapshot = await readRootSnapshot(page);
21648
21955
  if (entrySnapshot.shadowFileInputs + entrySnapshot.directFileInputs === 0) {
21649
21956
  const entryRoot = await resolveCreatorRoot(page);
21650
21957
  if (entryRoot.error !== undefined)
21651
- return stageFail(SHP_TARGET, entryRoot.error, "root-resolve", metadata);
21958
+ return stageFail2(SHP_TARGET, entryRoot.error, "root-resolve", metadata);
21652
21959
  try {
21653
21960
  const entry = (await resolveRootLocator(page, entryRoot.mode, spec.selectors.createEntry, "shipinhao create entry", this.stepTimeoutMs)).locator;
21654
21961
  await entry.click();
21655
21962
  } catch (error) {
21656
- return stageFail(SHP_TARGET, `shipinhao create entry click failed \u2014 ${errorMessage3(error)}`, "entry-open", metadata);
21963
+ return stageFail2(SHP_TARGET, `shipinhao create entry click failed \u2014 ${errorMessage3(error)}`, "entry-open", metadata);
21657
21964
  }
21658
21965
  const opened = await expectOutcome(async () => {
21659
21966
  const snapshot = await readRootSnapshot(page);
21660
21967
  return snapshot.shadowFileInputs + snapshot.directFileInputs > 0 ? "create surface open" : null;
21661
21968
  }, { timeoutMs: this.stepTimeoutMs, label: "shipinhao create surface" });
21662
21969
  if (!opened.ok)
21663
- return stageFail(SHP_TARGET, `shipinhao create surface never opened after the entry click \u2014 no media file input appeared in the active root \u2014 ${opened.error}`, "entry-open", metadata);
21970
+ return stageFail2(SHP_TARGET, `shipinhao create surface never opened after the entry click \u2014 no media file input appeared in the active root \u2014 ${opened.error}`, "entry-open", metadata);
21664
21971
  }
21665
21972
  const root = await resolveCreatorRoot(page);
21666
21973
  if (root.error !== undefined)
21667
- return stageFail(SHP_TARGET, root.error, "root-resolve", metadata);
21974
+ return stageFail2(SHP_TARGET, root.error, "root-resolve", metadata);
21668
21975
  const mode = root.mode;
21669
21976
  try {
21670
21977
  const resolved = await resolveRootLocator(page, mode, spec.fileSelectors, `shipinhao ${spec.mediaLabel} file input`, this.stepTimeoutMs);
21671
21978
  if (resolved.selector === 'input[type="file"]' && await resolved.locator.count() !== 1) {
21672
- return stageFail(SHP_TARGET, `shipinhao ${spec.mediaLabel} file input ambiguous: the untyped input[type=file] candidate matched more than one input in the ${mode === "wujie" ? "wujie shadowRoot" : "document"} root \u2014 the vendor resolves a unique untyped input or nothing (shipinhao.js:580-583)`, "root-resolve", metadata);
21979
+ return stageFail2(SHP_TARGET, `shipinhao ${spec.mediaLabel} file input ambiguous: the untyped input[type=file] candidate matched more than one input in the ${mode === "wujie" ? "wujie shadowRoot" : "document"} root \u2014 the vendor resolves a unique untyped input or nothing (shipinhao.js:580-583)`, "root-resolve", metadata);
21673
21980
  }
21674
21981
  await resolved.locator.setInputFiles(media.length === 1 ? media[0] : media, {
21675
21982
  timeout: this.stepTimeoutMs
21676
21983
  });
21677
21984
  } catch (error) {
21678
- return stageFail(SHP_TARGET, `shipinhao ${spec.mediaLabel} file input/attach failed on ${page.url()}: ${errorMessage3(error)}`, "upload-timeout", metadata);
21985
+ return stageFail2(SHP_TARGET, `shipinhao ${spec.mediaLabel} file input/attach failed on ${page.url()}: ${errorMessage3(error)}`, "upload-timeout", metadata);
21679
21986
  }
21680
21987
  let titleSelector;
21681
21988
  let editorSelector;
@@ -21683,23 +21990,23 @@ class ShipinhaoBrowserTransport {
21683
21990
  titleSelector = (await resolveRootLocator(page, mode, spec.selectors.titleInput, "shipinhao title input", this.stepTimeoutMs)).selector;
21684
21991
  editorSelector = (await resolveRootLocator(page, mode, spec.selectors.descriptionEditor, "shipinhao description editor", this.stepTimeoutMs)).selector;
21685
21992
  } catch (error) {
21686
- return stageFail(SHP_TARGET, `shipinhao media processing not confirmed: the file was assigned but the post-upload editing form never appeared \u2014 ${errorMessage3(error)}; refusing to claim an uploaded ${spec.mediaLabel}`, "upload-processing", metadata);
21993
+ return stageFail2(SHP_TARGET, `shipinhao media processing not confirmed: the file was assigned but the post-upload editing form never appeared \u2014 ${errorMessage3(error)}; refusing to claim an uploaded ${spec.mediaLabel}`, "upload-processing", metadata);
21687
21994
  }
21688
21995
  const formReady = await expectOutcome(async () => {
21689
21996
  const raw = String(await page.evaluate(editingFormReadyScript(mode, titleSelector, editorSelector)));
21690
21997
  return JSON.parse(raw).ready === true ? "editing form observed in the active root" : null;
21691
21998
  }, { timeoutMs: SHP_UPLOAD_TIMEOUT_MS, label: "shipinhao media processing" });
21692
21999
  if (!formReady.ok) {
21693
- return stageFail(SHP_TARGET, `shipinhao media processing not confirmed within the ${SHP_UPLOAD_TIMEOUT_MS}ms ceiling \u2014 the file was assigned but no editing form appeared; refusing to claim an uploaded ${spec.mediaLabel}`, "upload-processing", metadata);
22000
+ return stageFail2(SHP_TARGET, `shipinhao media processing not confirmed within the ${SHP_UPLOAD_TIMEOUT_MS}ms ceiling \u2014 the file was assigned but no editing form appeared; refusing to claim an uploaded ${spec.mediaLabel}`, "upload-processing", metadata);
21694
22001
  }
21695
22002
  try {
21696
22003
  const titleInput = (await resolveRootLocator(page, mode, spec.selectors.titleInput, "shipinhao title input", this.stepTimeoutMs)).locator;
21697
22004
  await titleInput.fill(title);
21698
22005
  const readback = await expectOutcome(async () => normalizeText(String(await page.evaluate(titleValueScript(mode, titleSelector)))) === normalizeText(title) ? "title read back" : null, { timeoutMs: this.stepTimeoutMs, label: "shipinhao title readback" });
21699
22006
  if (!readback.ok)
21700
- return stageFail(SHP_TARGET, `shipinhao title readback failed \u2014 the editor did not retain the requested title \u2014 ${readback.error}`, "title-readback", metadata);
22007
+ return stageFail2(SHP_TARGET, `shipinhao title readback failed \u2014 the editor did not retain the requested title \u2014 ${readback.error}`, "title-readback", metadata);
21701
22008
  } catch (error) {
21702
- return stageFail(SHP_TARGET, `shipinhao title fill failed \u2014 ${errorMessage3(error)}`, "title-readback", metadata);
22009
+ return stageFail2(SHP_TARGET, `shipinhao title fill failed \u2014 ${errorMessage3(error)}`, "title-readback", metadata);
21703
22010
  }
21704
22011
  const { description, html } = buildShipinhaoDescription(body, tags);
21705
22012
  try {
@@ -21710,9 +22017,14 @@ class ShipinhaoBrowserTransport {
21710
22017
  return editorText.length > 0 && normalizeText(editorText).includes(normalizeText(description)) && tags.every((tag) => editorText.includes(`#${tag.replace(/^#/, "")}`)) ? "description and topics read back" : null;
21711
22018
  }, { timeoutMs: this.stepTimeoutMs, label: "shipinhao description paste readback" });
21712
22019
  if (!readback.ok)
21713
- return stageFail(SHP_TARGET, `shipinhao description readback failed \u2014 the editor did not retain the pasted description/topics \u2014 ${readback.error}`, "description-paste-readback", metadata);
22020
+ return stageFail2(SHP_TARGET, `shipinhao description readback failed \u2014 the editor did not retain the pasted description/topics \u2014 ${readback.error}`, "description-paste-readback", metadata);
21714
22021
  } catch (error) {
21715
- return stageFail(SHP_TARGET, `shipinhao description paste failed \u2014 ${errorMessage3(error)}`, "description-paste-readback", metadata);
22022
+ return stageFail2(SHP_TARGET, `shipinhao description paste failed \u2014 ${errorMessage3(error)}`, "description-paste-readback", metadata);
22023
+ }
22024
+ if (collection !== undefined) {
22025
+ const collected = await this.selectCollectionFlow(page, mode, spec, collection, metadata);
22026
+ if (collected !== undefined)
22027
+ return collected;
21716
22028
  }
21717
22029
  if (declareOriginal) {
21718
22030
  const declaration = await this.declareOriginalFlow(page, mode, metadata);
@@ -21731,17 +22043,17 @@ class ShipinhaoBrowserTransport {
21731
22043
  const resolved = await resolveRootLocator(page, mode, submitSelectors, "shipinhao submit control", this.stepTimeoutMs);
21732
22044
  submitLocator = resolved.locator;
21733
22045
  } catch (error) {
21734
- return stageFail(SHP_TARGET, publishPublic ? `shipinhao publish control never attached: ${errorMessage3(error)} (the vendor resolves \u53D1\u8868 by exact text, shipinhao.js:2312-2316)` : `shipinhao draft-save control never attached: ${errorMessage3(error)} \u2014 the vendor never saves a draft, so a missing current control is a typed failure, not a manufactured draft and never a publish click`, stage, metadata);
22046
+ return stageFail2(SHP_TARGET, publishPublic ? `shipinhao publish control never attached: ${errorMessage3(error)} (the vendor resolves \u53D1\u8868 by exact text, shipinhao.js:2312-2316)` : `shipinhao draft-save control never attached: ${errorMessage3(error)} \u2014 the vendor never saves a draft, so a missing current control is a typed failure, not a manufactured draft and never a publish click`, stage, metadata);
21735
22047
  }
21736
22048
  if (!await submitLocator.isVisible().catch(() => false)) {
21737
- return stageFail(SHP_TARGET, "shipinhao submit control attached but not visible; refusing to submit through a hidden control", stage, metadata);
22049
+ return stageFail2(SHP_TARGET, "shipinhao submit control attached but not visible; refusing to submit through a hidden control", stage, metadata);
21738
22050
  }
21739
22051
  const enabled = await expectOutcome(async () => await submitLocator.isEnabled() ? "enabled" : null, {
21740
22052
  timeoutMs: this.stepTimeoutMs,
21741
22053
  label: "shipinhao submit control enabled"
21742
22054
  });
21743
22055
  if (!enabled.ok) {
21744
- return stageFail(SHP_TARGET, `shipinhao submit control never became clickable \u2014 ${enabled.error}`, stage, metadata);
22056
+ return stageFail2(SHP_TARGET, `shipinhao submit control never became clickable \u2014 ${enabled.error}`, stage, metadata);
21745
22057
  }
21746
22058
  const receiptStage = publishPublic ? "publish-receipt" : "draft-receipt";
21747
22059
  const beforeReceipts = new Set(await readReceiptUrls(page));
@@ -21775,10 +22087,10 @@ class ShipinhaoBrowserTransport {
21775
22087
  return url;
21776
22088
  }, { timeoutMs: this.stepTimeoutMs, label: `shipinhao ${receiptStage} confirmation` });
21777
22089
  if (!confirmed.ok) {
21778
- return stageFail(SHP_TARGET, publishPublic ? "shipinhao publish-receipt not confirmed \u2014 no fresh id-bearing works/record receipt with persisted state appeared; a clicked \u53D1\u8868 without a works record is unknown (shipinhao.js:2326) and is never reported as published" : "shipinhao draft-receipt not confirmed \u2014 no fresh id-bearing receipt with persisted title/description state appeared; fill alone is never a saved draft", receiptStage, metadata, `still on ${page.url()}; ${beforeReceipts.size} pre-existing receipt-shaped url(s)`, "unknown");
22090
+ return stageFail2(SHP_TARGET, publishPublic ? "shipinhao publish-receipt not confirmed \u2014 no fresh id-bearing works/record receipt with persisted state appeared; a clicked \u53D1\u8868 without a works record is unknown (shipinhao.js:2326) and is never reported as published" : "shipinhao draft-receipt not confirmed \u2014 no fresh id-bearing receipt with persisted title/description state appeared; fill alone is never a saved draft", receiptStage, metadata, `still on ${page.url()}; ${beforeReceipts.size} pre-existing receipt-shaped url(s)`, "unknown");
21779
22091
  }
21780
22092
  if (confirmed.evidence.startsWith("stale-state: ") || confirmed.evidence.startsWith("ambiguous-receipt: ")) {
21781
- return stageFail(SHP_TARGET, confirmed.evidence.startsWith("stale-state: ") ? "shipinhao receipt appeared but the persisted title/description(/original/cover) state no longer matches the requested content; refusing to claim success" : "shipinhao receipt is ambiguous (no single id-bearing works URL among the fresh receipts); refusing to claim success", receiptStage, metadata, confirmed.evidence, "unknown");
22093
+ return stageFail2(SHP_TARGET, confirmed.evidence.startsWith("stale-state: ") ? "shipinhao receipt appeared but the persisted title/description(/original/cover) state no longer matches the requested content; refusing to claim success" : "shipinhao receipt is ambiguous (no single id-bearing works URL among the fresh receipts); refusing to claim success", receiptStage, metadata, confirmed.evidence, "unknown");
21782
22094
  }
21783
22095
  const url = confirmed.evidence;
21784
22096
  return ResultSchema.parse({
@@ -21790,8 +22102,50 @@ class ShipinhaoBrowserTransport {
21790
22102
  metadata: { ...metadata, confirmedBy: receiptStage }
21791
22103
  });
21792
22104
  }
22105
+ async selectCollectionFlow(page, mode, spec, collection, metadata) {
22106
+ const failCollection = (message, stage, evidence) => stageFail2(SHP_TARGET, message, stage, metadata, evidence);
22107
+ const label = spec.selectors.collectionLabel;
22108
+ const read = (raw) => {
22109
+ try {
22110
+ return JSON.parse(raw);
22111
+ } catch {
22112
+ return { ok: false, reason: "unreadable-probe" };
22113
+ }
22114
+ };
22115
+ const entry = read(String(await page.evaluate(collectionScript(mode, "click-entry", label, collection))));
22116
+ if (!entry.ok) {
22117
+ return failCollection(`shipinhao \u5408\u96C6 (collection) row not found on the ${this.operation} form \u2014 refusing to publish outside the requested \u5408\u96C6 '${collection}'`, "collection-select", entry.reason);
22118
+ }
22119
+ const option = await expectOutcome(async () => {
22120
+ const picked = read(String(await page.evaluate(collectionScript(mode, "click-option", label, collection))));
22121
+ if (picked.ok)
22122
+ return "option clicked";
22123
+ const selects = page.locator("select");
22124
+ const count = await selects.count();
22125
+ for (let i = 0;i < count; i++) {
22126
+ try {
22127
+ await selects.nth(i).selectOption({ label: collection }, { timeout: COLLECTION_PROBE_MS });
22128
+ return "option selected";
22129
+ } catch {}
22130
+ }
22131
+ return null;
22132
+ }, { timeoutMs: this.stepTimeoutMs, label: "shipinhao \u5408\u96C6 option" });
22133
+ if (!option.ok) {
22134
+ const seen = read(String(await page.evaluate(collectionScript(mode, "click-option", label, collection))));
22135
+ return failCollection(`shipinhao \u5408\u96C6 '${collection}' is not among the collections the account offers \u2014 refusing to publish outside it`, "collection-select", `${option.error}; seen: ${(seen.seen ?? []).join(" | ")}`);
22136
+ }
22137
+ const commit = await expectOutcome(async () => {
22138
+ const state = read(String(await page.evaluate(collectionScript(mode, "read", label, collection))));
22139
+ return state.ok ? "collection read back" : null;
22140
+ }, { timeoutMs: this.stepTimeoutMs, label: "shipinhao \u5408\u96C6 readback" });
22141
+ if (!commit.ok) {
22142
+ const state = read(String(await page.evaluate(collectionScript(mode, "read", label, collection))));
22143
+ return failCollection(`shipinhao \u5408\u96C6 '${collection}' was clicked but the form does not show it committed \u2014 refusing to submit`, "collection-readback", `row text: ${state.text ?? "<absent>"} \u2014 ${commit.error}`);
22144
+ }
22145
+ return;
22146
+ }
21793
22147
  async declareOriginalFlow(page, mode, metadata) {
21794
- const failDeclaration = (message, evidence) => stageFail(SHP_TARGET, message, "original-declare", metadata, evidence);
22148
+ const failDeclaration = (message, evidence) => stageFail2(SHP_TARGET, message, "original-declare", metadata, evidence);
21795
22149
  const entry = JSON.parse(String(await page.evaluate(originalEntryScript(mode, "ensure"))));
21796
22150
  if (!entry.ok) {
21797
22151
  return failDeclaration(entry.reason === "ambiguous" ? `shipinhao \u58F0\u660E\u539F\u521B entry checkbox is ambiguous (${entry.count} equally-scored \u539F\u521B candidates, shipinhao.js:2233-2261); refusing the requested declaration rather than guessing` : "shipinhao \u58F0\u660E\u539F\u521B entry checkbox not found \u2014 the requested original declaration cannot be verified on this page; refusing (the vendor skips with a log only because it never treats the claim as operator-asserted, shipinhao.js:2274)");
@@ -21825,7 +22179,7 @@ class ShipinhaoBrowserTransport {
21825
22179
  return;
21826
22180
  }
21827
22181
  async attachCoverFlow(page, mode, coverPath, metadata) {
21828
- const failCover = (message, stage, evidence) => stageFail(SHP_TARGET, message, stage, metadata, evidence);
22182
+ const failCover = (message, stage, evidence) => stageFail2(SHP_TARGET, message, stage, metadata, evidence);
21829
22183
  const before = JSON.parse(String(await page.evaluate(coverSlotEvidenceScript(mode))));
21830
22184
  if (!before.found || before.descriptor === undefined) {
21831
22185
  return failCover("shipinhao vertical cover slot (\u4E2A\u4EBA\u4E3B\u9875\u5361\u7247 3:4, div.cover-preview-wrap) not found \u2014 refusing the requested cover (shipinhao.js:2128-2144)", "cover-open");
@@ -20604,7 +20604,9 @@ var SHP_VIDEO_SELECTORS = {
20604
20604
  originalAgreementCheckbox: 'div.declare-body-wrapper input[type="checkbox"].ant-checkbox-input',
20605
20605
  originalConfirmLabel: "\u58F0\u660E\u539F\u521B",
20606
20606
  saveButton: ['button:text-is("\u4FDD\u5B58\u8349\u7A3F")'],
20607
- publishButton: ['button:text-is("\u53D1\u8868")', '[role="button"]:text-is("\u53D1\u8868")']
20607
+ publishButton: ['button:text-is("\u53D1\u8868")', '[role="button"]:text-is("\u53D1\u8868")'],
20608
+ collectionEntry: ['button:has-text("\u5408\u96C6")', 'div:has-text("\u5408\u96C6")', 'span:has-text("\u5408\u96C6")'],
20609
+ collectionLabel: "\u5408\u96C6"
20608
20610
  };
20609
20611
  var SHP_AUDIO_SELECTORS = {
20610
20612
  ...SHP_VIDEO_SELECTORS,
@@ -4,7 +4,7 @@
4
4
  "entry": "./dist/index.js",
5
5
  "check": "./dist/profile-check.js",
6
6
  "version": "1.0.0",
7
- "description": "shipinhao (channels.weixin.qq.com) publish via a script browser transport with wujie-app shadowRoot traversal; four post kinds (shortVideo 视频, audio 音频, image 图文, music 音乐 — audio is the first deliverable); draft by default, public only on an explicit publishStatus with a fresh works receipt, requested-only 声明原创 declaration",
7
+ "description": "shipinhao (channels.weixin.qq.com) publish via a script browser transport with wujie-app shadowRoot traversal; four post kinds (shortVideo 视频, audio 音频, image 图文, music 音乐 — audio is the first deliverable and rides its own /platform/post/createAudio surface: required 封面, optional 合集, no draft); draft by default for the video rails, public only on an explicit publishStatus with a fresh works receipt, requested-only 声明原创 declaration",
8
8
  "browserSession": {
9
9
  "profileName": "shipinhao",
10
10
  "homeUrl": "https://channels.weixin.qq.com/platform"