@gobing-ai/knowledge-kit 0.1.20 → 0.1.23
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/board/collect/index.js +1 -0
- package/dist/board/daily-voice/index.js +1279 -261
- package/dist/board/itc/index.js +1 -0
- package/dist/index.js +13938 -8966
- package/package.json +1 -1
- package/plugins/generations/dailynews-gen/dist/index.js +285 -16
- package/plugins/generations/dailynews-gen/src/editorial-claims.ts +215 -0
- package/plugins/generations/dailynews-gen/src/index.ts +23 -4
- package/plugins/generations/dailynews-gen/src/script-builder.ts +10 -3
- package/plugins/generations/dailynews-gen/src/script-plan.ts +74 -14
- package/plugins/generations/gemini-tts/dist/index.js +47 -7
- package/plugins/generations/gemini-tts/src/gemini-client.ts +34 -6
- package/plugins/generations/music-gen/README.md +277 -0
- package/plugins/generations/music-gen/dist/index.js +23580 -0
- package/plugins/generations/music-gen/package.json +24 -0
- package/plugins/generations/music-gen/plugin.json +23 -0
- package/plugins/generations/music-gen/presets/SOURCE.md +39 -0
- package/plugins/generations/music-gen/presets/formats/clip.yaml +21 -0
- package/plugins/generations/music-gen/presets/formats/jingle.yaml +22 -0
- package/plugins/generations/music-gen/presets/formats/loop.yaml +21 -0
- package/plugins/generations/music-gen/presets/formats/song.yaml +36 -0
- package/plugins/generations/music-gen/presets/formats/underscore.yaml +22 -0
- package/plugins/generations/music-gen/presets/themes/ambient-tech.yaml +30 -0
- package/plugins/generations/music-gen/presets/themes/cinematic.yaml +30 -0
- package/plugins/generations/music-gen/presets/themes/lofi.yaml +30 -0
- package/plugins/generations/music-gen/presets/themes/synthwave.yaml +35 -0
- package/plugins/generations/music-gen/scripts/gen-preset-index.ts +181 -0
- package/plugins/generations/music-gen/scripts/resolve-preset.ts +64 -0
- package/plugins/generations/music-gen/src/adapter/index.ts +35 -0
- package/plugins/generations/music-gen/src/adapter/instance.ts +927 -0
- package/plugins/generations/music-gen/src/adapter/offline.ts +124 -0
- package/plugins/generations/music-gen/src/artifact.ts +223 -0
- package/plugins/generations/music-gen/src/audio/checks.ts +618 -0
- package/plugins/generations/music-gen/src/audio/master.ts +267 -0
- package/plugins/generations/music-gen/src/audio/measure.ts +507 -0
- package/plugins/generations/music-gen/src/audio/profile.ts +131 -0
- package/plugins/generations/music-gen/src/audio.ts +122 -0
- package/plugins/generations/music-gen/src/brief.ts +191 -0
- package/plugins/generations/music-gen/src/config.ts +451 -0
- package/plugins/generations/music-gen/src/content.ts +199 -0
- package/plugins/generations/music-gen/src/digest.ts +100 -0
- package/plugins/generations/music-gen/src/index.ts +147 -0
- package/plugins/generations/music-gen/src/job.ts +131 -0
- package/plugins/generations/music-gen/src/plugin.ts +371 -0
- package/plugins/generations/music-gen/src/presets.ts +951 -0
- package/plugins/generations/music-gen/src/render.ts +87 -0
- package/plugins/generations/music-gen/src/request.ts +102 -0
- package/plugins/generations/music-gen/src/spend.ts +495 -0
- package/plugins/generations/music-gen/tsconfig.json +8 -0
- package/plugins/generations/omni-voice-gen/uv.toml +5 -0
- package/plugins/generations/vibe-voice-tts/README.md +64 -0
- package/plugins/generations/vibe-voice-tts/dist/index.js +14259 -0
- package/plugins/generations/vibe-voice-tts/package.json +16 -0
- package/plugins/generations/vibe-voice-tts/plugin.json +6 -0
- package/plugins/generations/vibe-voice-tts/profiles.json +10 -0
- package/plugins/generations/vibe-voice-tts/pyproject.toml +9 -0
- package/plugins/generations/vibe-voice-tts/python/worker.py +566 -0
- package/plugins/generations/vibe-voice-tts/src/index.ts +88 -0
- package/plugins/generations/vibe-voice-tts/src/vibevoice-client.ts +828 -0
- package/plugins/generations/vibe-voice-tts/tsconfig.json +8 -0
- package/plugins/generations/vibe-voice-tts/uv.lock +1767 -0
- package/plugins/generations/vibe-voice-tts/uv.toml +4 -0
- package/plugins/generations/voice-gen/dist/index.js +31 -1
- package/plugins/generations/voice-gen/src/voicebox-client.ts +50 -1
- package/plugins/generations/voxcpm-tts/dist/index.js +81 -9
- package/plugins/generations/voxcpm-tts/python/worker.py +9 -0
- package/plugins/generations/voxcpm-tts/src/index.ts +41 -0
- package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +32 -11
- package/plugins/generations/voxcpm-tts/uv.toml +5 -0
- package/plugins/kk/README.md +21 -0
- package/plugins/kk/decisions/kk-safety.yaml +5 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +14 -2
- package/plugins/kk/scripts/cover-compositor.ts +380 -32
- package/plugins/kk/scripts/daily-cover-mock.ts +40 -3
- package/plugins/kk/scripts/daily-stages.ts +933 -60
- package/plugins/kk/scripts/episode-identity.ts +180 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +111 -12
- package/plugins/kk/scripts/music-stages.ts +624 -0
- package/plugins/kk/scripts/news-editorial-ledger.ts +906 -0
- package/plugins/kk/scripts/safety-artifact-check.ts +28 -5
- package/plugins/kk/scripts/source-citation.ts +187 -0
- package/plugins/kk/scripts/topic-selection-attempts.ts +446 -0
- package/plugins/kk/scripts/topic-selection-calibration.ts +161 -0
- package/plugins/kk/skills/content-judge/SKILL.md +11 -6
- package/plugins/kk/skills/content-judge/references/music-quality-rubric.md +147 -0
- package/plugins/kk/skills/content-judge/references/rubrics.md +15 -0
- package/plugins/kk/skills/content-safety/SKILL.md +12 -0
- package/plugins/kk/skills/music-authoring/SKILL.md +276 -0
- package/plugins/kk/skills/music-authoring/references/judge-input.md +117 -0
- package/plugins/kk/skills/news-editorial/SKILL.md +102 -15
- package/plugins/kk/skills/news-editorial/references/selection.md +4 -0
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +58 -11
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +12 -11
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +13 -12
- package/plugins/kk/workflows/kk-daily-safety.yaml +12 -10
- package/plugins/kk/workflows/kk-music.yaml +332 -0
- package/plugins/kk/workflows/kk-news-generate.yaml +81 -6
- package/plugins/kk/workflows/kk-publish.yaml +4 -1
- package/plugins/publishings/bilibili-pub/dist/index.js +11 -1
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/cnblogs-pub/dist/index.js +11 -1
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/csdn-pub/dist/index.js +11 -1
- package/plugins/publishings/csdn-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/infoq-pub/dist/index.js +11 -1
- package/plugins/publishings/infoq-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/jike-pub/dist/index.js +11 -1
- package/plugins/publishings/jike-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/juejin-pub/dist/index.js +11 -1
- package/plugins/publishings/juejin-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/linkedin-pub/dist/index.js +62 -10
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +16 -1
- package/plugins/publishings/linkedin-pub/src/index.ts +99 -12
- package/plugins/publishings/podcast-pub/dist/index.js +586 -20
- package/plugins/publishings/podcast-pub/src/corrections.ts +509 -0
- package/plugins/publishings/podcast-pub/src/index.ts +257 -5
- package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +240 -0
- package/plugins/publishings/podcast-pub/src/show-notes.ts +69 -13
- package/plugins/publishings/shipinhao-pub/dist/index.js +59 -8
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +105 -6
- package/plugins/publishings/sspai-pub/dist/index.js +11 -1
- package/plugins/publishings/sspai-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/substack-pub/dist/index.js +11 -1
- package/plugins/publishings/substack-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/surfdash-pub/dist/index.js +80 -24
- package/plugins/publishings/surfdash-pub/src/digest-check.ts +7 -3
- package/plugins/publishings/surfdash-pub/src/index.ts +107 -18
- package/plugins/publishings/surfdash-pub/src/patch.ts +21 -3
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +3 -1
- package/plugins/publishings/threads-pub/dist/index.js +58 -6
- package/plugins/publishings/threads-pub/dist/profile-check.js +18 -2
- package/plugins/publishings/threads-pub/src/post-rail.ts +101 -4
- package/plugins/publishings/wechatmp-pub/dist/index.js +105 -35
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +87 -53
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +61 -3
- package/plugins/publishings/wechatmp-pub/src/flow.ts +28 -0
- package/plugins/publishings/weibo-pub/dist/index.js +11 -1
- package/plugins/publishings/weibo-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/x-pub/dist/index.js +95 -10
- package/plugins/publishings/x-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/x-pub/src/post-rail.ts +154 -12
- package/plugins/publishings/xhs-pub/dist/index.js +11 -1
- package/plugins/publishings/xhs-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +11 -1
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +11 -1
|
@@ -20,9 +20,10 @@ import {
|
|
|
20
20
|
type TimelineStyle,
|
|
21
21
|
warn,
|
|
22
22
|
} from './seo';
|
|
23
|
+
import { CARDS_STYLE } from './show-notes-brief';
|
|
23
24
|
|
|
24
25
|
/** Escapes text content and attribute values (`&`, `<`, `>`, `"`). */
|
|
25
|
-
function escapeHtml(value: string): string {
|
|
26
|
+
export function escapeHtml(value: string): string {
|
|
26
27
|
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"');
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -49,7 +50,7 @@ function normalizeForMatch(text: string): string {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
/** `m:ss` audio offset, or `--:--` when unknown. */
|
|
52
|
-
function formatOffset(seconds: number): string {
|
|
53
|
+
export function formatOffset(seconds: number): string {
|
|
53
54
|
if (!Number.isFinite(seconds) || seconds < 0) return '--:--';
|
|
54
55
|
const m = Math.floor(seconds / 60);
|
|
55
56
|
const s = Math.round(seconds % 60);
|
|
@@ -172,6 +173,21 @@ ${after}${articleTail}
|
|
|
172
173
|
<!--/kk:timeline-->`;
|
|
173
174
|
}
|
|
174
175
|
|
|
176
|
+
/**
|
|
177
|
+
* 0386 R1 — the card-region counterpart of {@link isGeneratedTimeline}: a `<!--kk:cards-->` block is
|
|
178
|
+
* trusted only if it is markup {@link renderCardsRegion} (show-notes-brief.ts) could have produced.
|
|
179
|
+
* The card region is the only place an `<img>` legitimately appears in show notes, so its grammar is
|
|
180
|
+
* pinned here rather than widening the timeline grammar.
|
|
181
|
+
*/
|
|
182
|
+
const CARDS_TAG =
|
|
183
|
+
/^<\/?(?:div|figure|figcaption|span|p|img)(?:\s+(?:class="kk-cards"|class="kk-card"|class="kk-card-n"|src="https?:\/\/[^"<>\s]*"|alt="[^"<>]*"|loading="lazy"))*\s*\/?>$/;
|
|
184
|
+
|
|
185
|
+
function isGeneratedCards(block: string): boolean {
|
|
186
|
+
const rest = block.replace(CARDS_STYLE, '');
|
|
187
|
+
if (rest.includes('<style') || rest.includes('<!--') || rest.includes('<script')) return false;
|
|
188
|
+
return (rest.match(/<[^>]*>/g) ?? []).every((tag) => CARDS_TAG.test(tag)) && !/<(?![^>]*>)/.test(rest);
|
|
189
|
+
}
|
|
190
|
+
|
|
175
191
|
/**
|
|
176
192
|
* Renders show-notes markdown to sanitized HTML.
|
|
177
193
|
* The leading `# ` heading is dropped: the episode `title` is rendered
|
|
@@ -182,7 +198,9 @@ ${after}${articleTail}
|
|
|
182
198
|
export function renderShowNotesHtml(markdown: string): string {
|
|
183
199
|
const blocks: string[] = [];
|
|
184
200
|
const timeline: string[] = [];
|
|
201
|
+
const cards: string[] = [];
|
|
185
202
|
let inTimeline = false;
|
|
203
|
+
let inCards = false;
|
|
186
204
|
let paragraph: string[] = [];
|
|
187
205
|
|
|
188
206
|
const flush = () => {
|
|
@@ -210,6 +228,31 @@ export function renderShowNotesHtml(markdown: string): string {
|
|
|
210
228
|
inTimeline = true;
|
|
211
229
|
continue;
|
|
212
230
|
}
|
|
231
|
+
if (line === '<!--kk:cards-->') {
|
|
232
|
+
flush();
|
|
233
|
+
inCards = true;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (inCards) {
|
|
237
|
+
if (line === '<!--/kk:cards-->') {
|
|
238
|
+
inCards = false;
|
|
239
|
+
// Same trust rule as the timeline markers: pass a generator-shaped card block
|
|
240
|
+
// through, escape anything else line by line (R2: never widen the HTML surface).
|
|
241
|
+
if (isGeneratedCards(cards.join('\n'))) {
|
|
242
|
+
blocks.push(cards.join('\n'));
|
|
243
|
+
} else {
|
|
244
|
+
for (const l of cards) {
|
|
245
|
+
const t = l.trim();
|
|
246
|
+
if (t.length > 0) paragraph.push(t);
|
|
247
|
+
}
|
|
248
|
+
flush();
|
|
249
|
+
}
|
|
250
|
+
cards.length = 0;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
cards.push(rawLine);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
213
256
|
if (inTimeline) {
|
|
214
257
|
if (line === '<!--/kk:timeline-->') {
|
|
215
258
|
inTimeline = false;
|
|
@@ -248,6 +291,14 @@ export function renderShowNotesHtml(markdown: string): string {
|
|
|
248
291
|
flush();
|
|
249
292
|
// An unclosed marker never reaches the closing branch above — escape whatever it buffered.
|
|
250
293
|
if (timeline.length > 0) escapeBufferedTimeline();
|
|
294
|
+
if (cards.length > 0) {
|
|
295
|
+
for (const l of cards) {
|
|
296
|
+
const t = l.trim();
|
|
297
|
+
if (t.length > 0) paragraph.push(t);
|
|
298
|
+
}
|
|
299
|
+
cards.length = 0;
|
|
300
|
+
flush();
|
|
301
|
+
}
|
|
251
302
|
return blocks.join('\n');
|
|
252
303
|
}
|
|
253
304
|
|
|
@@ -308,7 +359,7 @@ export interface ShowNotesRenderOptions {
|
|
|
308
359
|
}
|
|
309
360
|
|
|
310
361
|
/** Per-item 1–2-sentence briefing: `metadata.brief` first, body sentences as fallback. */
|
|
311
|
-
function itemBrief(d: Doc): string {
|
|
362
|
+
export function itemBrief(d: Doc): string {
|
|
312
363
|
const meta = d.metadata ?? {};
|
|
313
364
|
if (typeof meta.brief === 'string' && meta.brief.trim().length > 0) return meta.brief.trim();
|
|
314
365
|
return splitSentences((d.body ?? '').trim(), { cjkOnly: true })
|
|
@@ -316,6 +367,20 @@ function itemBrief(d: Doc): string {
|
|
|
316
367
|
.join('');
|
|
317
368
|
}
|
|
318
369
|
|
|
370
|
+
/**
|
|
371
|
+
* The 0394/0386 source label of one item: the plan's `metadata.sourceName`, else the URL host,
|
|
372
|
+
* else the bare 「来源」. One convention shared by the timeline and the brief renderer.
|
|
373
|
+
*/
|
|
374
|
+
export function sourceLabelFor(doc: Doc): string {
|
|
375
|
+
const metadata = doc.metadata ?? {};
|
|
376
|
+
if (typeof metadata.sourceName === 'string' && metadata.sourceName.trim()) return metadata.sourceName.trim();
|
|
377
|
+
try {
|
|
378
|
+
return new URL(doc.sourceUri ?? '').hostname.replace(/^www\./, '');
|
|
379
|
+
} catch {
|
|
380
|
+
return '来源';
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
319
384
|
/**
|
|
320
385
|
* Renders the episode show-notes markdown from a plan Doc[] — plugin-owned port
|
|
321
386
|
* of the workflow's inline show-notes bun -e (design L1 R6; the workflow keeps
|
|
@@ -353,15 +418,6 @@ export function renderShowNotesMarkdown(docs: Doc[], opts: ShowNotesRenderOption
|
|
|
353
418
|
warn('brief mode requested but ARTICLE_POST_PATH is empty; using legacy layout', warnings);
|
|
354
419
|
}
|
|
355
420
|
const briefMode = opts.briefMode === true && postSlug.length > 0;
|
|
356
|
-
const sourceLabel = (d: Doc): string => {
|
|
357
|
-
const m = d.metadata ?? {};
|
|
358
|
-
if (typeof m.sourceName === 'string' && m.sourceName.trim()) return m.sourceName.trim();
|
|
359
|
-
try {
|
|
360
|
-
return new URL(d.sourceUri ?? '').hostname.replace(/^www\./, '');
|
|
361
|
-
} catch {
|
|
362
|
-
return '来源';
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
421
|
const offsets = computeAudioOffsets(docs, opts.audioSegments);
|
|
366
422
|
const lines: string[] = [`# ${opts.title}`, ''];
|
|
367
423
|
const summaryOn = opts.summaryParagraph !== false;
|
|
@@ -411,7 +467,7 @@ export function renderShowNotesMarkdown(docs: Doc[], opts: ShowNotesRenderOption
|
|
|
411
467
|
'',
|
|
412
468
|
sentences,
|
|
413
469
|
'',
|
|
414
|
-
`[来源:${
|
|
470
|
+
`[来源:${sourceLabelFor(d)}](${d.sourceUri ?? ''})`,
|
|
415
471
|
'',
|
|
416
472
|
);
|
|
417
473
|
});
|
|
@@ -20758,6 +20758,9 @@ async function ensureProfileDir2(profileDir, headless) {
|
|
|
20758
20758
|
var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
20759
20759
|
// ../../packages/publish-harness/src/browser.ts
|
|
20760
20760
|
var DEFAULT_CHECK_TIMEOUT_MS = 30000;
|
|
20761
|
+
var VERDICT_PRINT_MARGIN_MS = 2000;
|
|
20762
|
+
var MIN_PASS_BUDGET_MS = 5000;
|
|
20763
|
+
var PASS_LAUNCH_RESERVE_MS = 20000;
|
|
20761
20764
|
var DEFAULT_POLL_MS = 500;
|
|
20762
20765
|
function isInstantBrowserDeath(message) {
|
|
20763
20766
|
return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
|
|
@@ -20880,14 +20883,21 @@ async function checkChannelSession(config, opts) {
|
|
|
20880
20883
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
|
|
20881
20884
|
const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
|
|
20882
20885
|
let lastDetail = `${config.channel} readiness was never probed`;
|
|
20886
|
+
const deadline = Date.now() + timeoutMs;
|
|
20887
|
+
const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
|
|
20888
|
+
const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
|
|
20889
|
+
const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
|
|
20883
20890
|
for (const headless of passes) {
|
|
20891
|
+
const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
|
|
20892
|
+
if (remainingMs < minPassMs)
|
|
20893
|
+
break;
|
|
20884
20894
|
try {
|
|
20885
20895
|
await withProfilePage({
|
|
20886
20896
|
profileDir: opts.profileDir,
|
|
20887
20897
|
headless,
|
|
20888
20898
|
url: config.homeUrl,
|
|
20889
20899
|
isAuthenticated: config.isAuthenticated,
|
|
20890
|
-
timeoutMs,
|
|
20900
|
+
timeoutMs: remainingMs,
|
|
20891
20901
|
launcher: opts.launcher ?? kkBrowserLauncher
|
|
20892
20902
|
}, async () => true);
|
|
20893
20903
|
return {
|
|
@@ -21175,20 +21185,55 @@ async function attachAudioCover(page, coverPath, stepTimeoutMs) {
|
|
|
21175
21185
|
if (chooser === null)
|
|
21176
21186
|
return "clicking the \u5C01\u9762 tile opened no file chooser";
|
|
21177
21187
|
await chooser.setFiles(coverPath);
|
|
21178
|
-
const
|
|
21179
|
-
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
|
|
21183
|
-
|
|
21188
|
+
const settled = await expectOutcome2(async () => await coverUploadPending(page) ? null : "cover upload settled", stepTimeoutMs, "\u97F3\u9891 \u5C01\u9762 upload");
|
|
21189
|
+
if (!settled.ok)
|
|
21190
|
+
return `the \u5C01\u9762 file was chosen but its upload never settled: ${settled.error}`;
|
|
21191
|
+
let cropSeen = false;
|
|
21192
|
+
const cropReady = await expectOutcome2(async () => {
|
|
21193
|
+
const dialog = page.locator(CROP_DIALOG).first();
|
|
21194
|
+
const open = await dialog.count() > 0 && await dialog.isVisible().catch(() => false);
|
|
21195
|
+
if (!open)
|
|
21196
|
+
return cropSeen ? "crop dialog closed before it was ready" : null;
|
|
21197
|
+
cropSeen = true;
|
|
21198
|
+
const cropper = page.locator(CROP_IMAGE).first();
|
|
21199
|
+
return await cropper.count() > 0 && await cropper.isVisible().catch(() => false) ? "cropper ready" : null;
|
|
21184
21200
|
}, stepTimeoutMs, "\u7F16\u8F91\u97F3\u9891\u5C01\u9762 crop dialog");
|
|
21201
|
+
if (!cropReady.ok)
|
|
21202
|
+
return `the \u5C01\u9762 crop dialog never appeared or its cropper never mounted: ${cropReady.error}`;
|
|
21203
|
+
const cropped = await expectOutcome2(async () => {
|
|
21204
|
+
const dialog = page.locator(CROP_DIALOG).first();
|
|
21205
|
+
if (await dialog.count() === 0 || !await dialog.isVisible().catch(() => false)) {
|
|
21206
|
+
return "crop dialog closed";
|
|
21207
|
+
}
|
|
21208
|
+
await page.locator(`${CROP_DIALOG} button:text-is("\u786E\u8BA4")`).last().click({ timeout: 4000 }).catch(() => {});
|
|
21209
|
+
return null;
|
|
21210
|
+
}, stepTimeoutMs, "\u7F16\u8F91\u97F3\u9891\u5C01\u9762 crop confirm");
|
|
21185
21211
|
if (!cropped.ok)
|
|
21186
|
-
return `the \u5C01\u9762 crop dialog never
|
|
21212
|
+
return `the \u5C01\u9762 crop dialog never closed: ${cropped.error}`;
|
|
21187
21213
|
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
21214
|
if (!cleared.ok)
|
|
21189
21215
|
return `the \u5C01\u9762 was uploaded but the form still reports \u300C\u8BF7\u4E0A\u4F20\u5C01\u9762\u300D: ${cleared.error}`;
|
|
21190
21216
|
return null;
|
|
21191
21217
|
}
|
|
21218
|
+
var AUDIO_FORM_REFUSALS = ["\u8BF7\u4E0A\u4F20\u5C01\u9762", "\u8BF7\u4E0A\u4F20\u97F3\u9891", "\u8BF7\u586B\u5199\u6807\u9898", "\u8BF7\u586B\u5199\u63CF\u8FF0", "\u8BF7\u9009\u62E9\u5408\u96C6"];
|
|
21219
|
+
async function readSubmitRefusal(page) {
|
|
21220
|
+
for (const text of AUDIO_FORM_REFUSALS) {
|
|
21221
|
+
try {
|
|
21222
|
+
if (await page.locator(`text=${text}`).count() > 0)
|
|
21223
|
+
return text;
|
|
21224
|
+
} catch {}
|
|
21225
|
+
}
|
|
21226
|
+
return null;
|
|
21227
|
+
}
|
|
21228
|
+
var CROP_DIALOG = '.weui-desktop-dialog:has(.cropper-wrap), .weui-desktop-dialog:has-text("\u7F16\u8F91\u97F3\u9891\u5C01\u9762")';
|
|
21229
|
+
var CROP_IMAGE = `${CROP_DIALOG} .cropper-wrap img, ${CROP_DIALOG} .croppie-container img, ${CROP_DIALOG} img`;
|
|
21230
|
+
async function coverUploadPending(page) {
|
|
21231
|
+
try {
|
|
21232
|
+
return await page.locator("text=/\\d{1,3}%/").count() > 0;
|
|
21233
|
+
} catch {
|
|
21234
|
+
return false;
|
|
21235
|
+
}
|
|
21236
|
+
}
|
|
21192
21237
|
async function selectAudioCollection(page, collection, stepTimeoutMs) {
|
|
21193
21238
|
const picker = page.locator('div.display-text:has-text("\u9009\u62E9\u5408\u96C6")').first();
|
|
21194
21239
|
if (await picker.count() === 0)
|
|
@@ -21292,6 +21337,12 @@ async function pendingAudioFlow(input, metadata) {
|
|
|
21292
21337
|
break;
|
|
21293
21338
|
}
|
|
21294
21339
|
}
|
|
21340
|
+
if (page.url().includes(SHP_AUDIO_CREATE_PATH)) {
|
|
21341
|
+
const refusal = await readSubmitRefusal(page);
|
|
21342
|
+
if (refusal !== null) {
|
|
21343
|
+
return stageFail(`shipinhao \u97F3\u9891 submit was refused by the form: \u300C${refusal}\u300D \u2014 nothing was published`, "audio-submit-validation", metadata, `inline validation: ${refusal}`);
|
|
21344
|
+
}
|
|
21345
|
+
}
|
|
21295
21346
|
const receipt = await expectOutcome2(async () => {
|
|
21296
21347
|
if (!page.url().includes(SHP_AUDIO_MANAGER_PATH))
|
|
21297
21348
|
return null;
|
|
@@ -20189,6 +20189,9 @@ var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
|
20189
20189
|
var DEFAULT_LOGIN_TIMEOUT_MS = 180000;
|
|
20190
20190
|
var DEFAULT_OPEN_NAV_TIMEOUT_MS = 30000;
|
|
20191
20191
|
var DEFAULT_CHECK_TIMEOUT_MS = 30000;
|
|
20192
|
+
var VERDICT_PRINT_MARGIN_MS = 2000;
|
|
20193
|
+
var MIN_PASS_BUDGET_MS = 5000;
|
|
20194
|
+
var PASS_LAUNCH_RESERVE_MS = 20000;
|
|
20192
20195
|
var DEFAULT_POLL_MS = 500;
|
|
20193
20196
|
function isInstantBrowserDeath(message) {
|
|
20194
20197
|
return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
|
|
@@ -20311,14 +20314,21 @@ async function checkChannelSession(config, opts) {
|
|
|
20311
20314
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
|
|
20312
20315
|
const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
|
|
20313
20316
|
let lastDetail = `${config.channel} readiness was never probed`;
|
|
20317
|
+
const deadline = Date.now() + timeoutMs;
|
|
20318
|
+
const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
|
|
20319
|
+
const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
|
|
20320
|
+
const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
|
|
20314
20321
|
for (const headless of passes) {
|
|
20322
|
+
const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
|
|
20323
|
+
if (remainingMs < minPassMs)
|
|
20324
|
+
break;
|
|
20315
20325
|
try {
|
|
20316
20326
|
await withProfilePage({
|
|
20317
20327
|
profileDir: opts.profileDir,
|
|
20318
20328
|
headless,
|
|
20319
20329
|
url: config.homeUrl,
|
|
20320
20330
|
isAuthenticated: config.isAuthenticated,
|
|
20321
|
-
timeoutMs,
|
|
20331
|
+
timeoutMs: remainingMs,
|
|
20322
20332
|
launcher: opts.launcher ?? kkBrowserLauncher
|
|
20323
20333
|
}, async () => true);
|
|
20324
20334
|
return {
|
|
@@ -184,17 +184,60 @@ export async function attachAudioCover(page: Page, coverPath: string, stepTimeou
|
|
|
184
184
|
const chooser = await chooserPromise;
|
|
185
185
|
if (chooser === null) return 'clicking the 封面 tile opened no file chooser';
|
|
186
186
|
await chooser.setFiles(coverPath);
|
|
187
|
-
|
|
187
|
+
// 2026-11-18 (the "shipinhao audio never publishes" leaf cause): choosing the file was treated as
|
|
188
|
+
// a committed cover. The tile then shows an upload percentage (25% measured) for as long as the
|
|
189
|
+
// file is in flight, and a submit clicked in that window fails client-side with 「请上传封面」
|
|
190
|
+
// while the page stays on the form — so no works row ever appeared and every run ended
|
|
191
|
+
// `uncertain`. The percentage token is the only pre-submit signal that the cover is NOT committed.
|
|
192
|
+
const settled = await expectOutcome(
|
|
193
|
+
async () => ((await coverUploadPending(page)) ? null : 'cover upload settled'),
|
|
194
|
+
stepTimeoutMs,
|
|
195
|
+
'音频 封面 upload',
|
|
196
|
+
);
|
|
197
|
+
if (!settled.ok) return `the 封面 file was chosen but its upload never settled: ${settled.error}`;
|
|
198
|
+
// 2026-11-18 (measured): the crop dialog renders inside the `WUJIE-APP` shadow root, and it mounts
|
|
199
|
+
// BEFORE its cropper initializes — a single 确认 click fired in that window is swallowed, the
|
|
200
|
+
// dialog stays open, and the form then refuses the submit with 「请上传封面」. So the click is
|
|
201
|
+
// retried while the dialog is still there, and success is the dialog CLOSING, not the click call
|
|
202
|
+
// returning. `page.locator` pierces the open shadow root natively; `document.*` text reads do not
|
|
203
|
+
// (that is why the older probe believed an uncommitted cover had been accepted).
|
|
204
|
+
let cropSeen = false;
|
|
205
|
+
// Open, then wait for the cropper IMAGE: clicking 确认 while the cropper is still mounting closes
|
|
206
|
+
// the dialog without committing the cover (measured 2026-11-18 — the form then refuses the
|
|
207
|
+
// submit with 「请上传封面」 and no works row is ever created).
|
|
208
|
+
const cropReady = await expectOutcome(
|
|
188
209
|
async () => {
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
210
|
+
const dialog = page.locator(CROP_DIALOG).first();
|
|
211
|
+
const open = (await dialog.count()) > 0 && (await dialog.isVisible().catch(() => false));
|
|
212
|
+
if (!open) return cropSeen ? 'crop dialog closed before it was ready' : null;
|
|
213
|
+
cropSeen = true;
|
|
214
|
+
const cropper = page.locator(CROP_IMAGE).first();
|
|
215
|
+
return (await cropper.count()) > 0 && (await cropper.isVisible().catch(() => false))
|
|
216
|
+
? 'cropper ready'
|
|
217
|
+
: null;
|
|
193
218
|
},
|
|
194
219
|
stepTimeoutMs,
|
|
195
220
|
'编辑音频封面 crop dialog',
|
|
196
221
|
);
|
|
197
|
-
if (!
|
|
222
|
+
if (!cropReady.ok) return `the 封面 crop dialog never appeared or its cropper never mounted: ${cropReady.error}`;
|
|
223
|
+
const cropped = await expectOutcome(
|
|
224
|
+
async () => {
|
|
225
|
+
const dialog = page.locator(CROP_DIALOG).first();
|
|
226
|
+
if ((await dialog.count()) === 0 || !(await dialog.isVisible().catch(() => false))) {
|
|
227
|
+
return 'crop dialog closed';
|
|
228
|
+
}
|
|
229
|
+
// The dialog can survive the first click while the cropper settles, so each pass clicks.
|
|
230
|
+
await page
|
|
231
|
+
.locator(`${CROP_DIALOG} button:text-is("确认")`)
|
|
232
|
+
.last()
|
|
233
|
+
.click({ timeout: 4_000 })
|
|
234
|
+
.catch(() => {});
|
|
235
|
+
return null;
|
|
236
|
+
},
|
|
237
|
+
stepTimeoutMs,
|
|
238
|
+
'编辑音频封面 crop confirm',
|
|
239
|
+
);
|
|
240
|
+
if (!cropped.ok) return `the 封面 crop dialog never closed: ${cropped.error}`;
|
|
198
241
|
const cleared = await expectOutcome(
|
|
199
242
|
async () => ((await page.locator('text=请上传封面').count()) === 0 ? 'cover accepted' : null),
|
|
200
243
|
stepTimeoutMs,
|
|
@@ -204,6 +247,46 @@ export async function attachAudioCover(page: Page, coverPath: string, stepTimeou
|
|
|
204
247
|
return null;
|
|
205
248
|
}
|
|
206
249
|
|
|
250
|
+
/**
|
|
251
|
+
* The inline validation lines the 音频 form renders when a submit is refused client-side (measured
|
|
252
|
+
* 2026-11-18). Only these exact lines are read: any other text on the page is content, not a verdict.
|
|
253
|
+
*/
|
|
254
|
+
const AUDIO_FORM_REFUSALS = ['请上传封面', '请上传音频', '请填写标题', '请填写描述', '请选择合集'] as const;
|
|
255
|
+
|
|
256
|
+
/** The form's refusal line after a submit, or null when it rendered none. */
|
|
257
|
+
async function readSubmitRefusal(page: Page): Promise<string | null> {
|
|
258
|
+
for (const text of AUDIO_FORM_REFUSALS) {
|
|
259
|
+
try {
|
|
260
|
+
if ((await page.locator(`text=${text}`).count()) > 0) return text;
|
|
261
|
+
} catch {
|
|
262
|
+
// An unreadable probe is not a refusal.
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The 编辑音频封面 crop dialog. It lives in the `WUJIE-APP` shadow root (measured 2026-11-18), so it is
|
|
270
|
+
* matched by the cropper it contains or by its own title, never by a light-DOM ancestor.
|
|
271
|
+
*/
|
|
272
|
+
const CROP_DIALOG = '.weui-desktop-dialog:has(.cropper-wrap), .weui-desktop-dialog:has-text("编辑音频封面")';
|
|
273
|
+
/** The cropper's own image: present only once the dialog has finished mounting (measured 2026-11-18). */
|
|
274
|
+
const CROP_IMAGE = `${CROP_DIALOG} .cropper-wrap img, ${CROP_DIALOG} .croppie-container img, ${CROP_DIALOG} img`;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Whether the 封面 tile still shows an upload percentage ("25%"), i.e. the file is in flight and the
|
|
278
|
+
* cover is NOT committed yet (measured 2026-11-18). The form's own 「请上传封面」 line is useless as a
|
|
279
|
+
* pre-submit check: it only renders after a refused submit.
|
|
280
|
+
*/
|
|
281
|
+
async function coverUploadPending(page: Page): Promise<boolean> {
|
|
282
|
+
try {
|
|
283
|
+
return (await page.locator('text=/\\d{1,3}%/').count()) > 0;
|
|
284
|
+
} catch {
|
|
285
|
+
// An unreadable probe is not evidence of an upload; the crop/validation checks still run.
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
207
290
|
/** Open the 合集 picker, click the exact collection, and verify the row reads it back. */
|
|
208
291
|
export async function selectAudioCollection(
|
|
209
292
|
page: Page,
|
|
@@ -361,6 +444,22 @@ export async function pendingAudioFlow(input: AudioFlowInput, metadata: Record<s
|
|
|
361
444
|
}
|
|
362
445
|
}
|
|
363
446
|
|
|
447
|
+
// A form that stays on the create route after the submit did not submit: the platform renders its
|
|
448
|
+
// client-side validation inline (measured 2026-11-18: 「请上传封面」 under the cover tile while the
|
|
449
|
+
// page never left /platform/post/createAudio). Reading it turns an opaque `unknown` into the one
|
|
450
|
+
// line that names the fix — the 2026-11-15/17/18 runs all died as "no works row ever observed".
|
|
451
|
+
if (page.url().includes(SHP_AUDIO_CREATE_PATH)) {
|
|
452
|
+
const refusal = await readSubmitRefusal(page);
|
|
453
|
+
if (refusal !== null) {
|
|
454
|
+
return stageFail(
|
|
455
|
+
`shipinhao 音频 submit was refused by the form: 「${refusal}」 — nothing was published`,
|
|
456
|
+
'audio-submit-validation',
|
|
457
|
+
metadata,
|
|
458
|
+
`inline validation: ${refusal}`,
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
364
463
|
// Receipt: the 音频 list row. The site returns to /platform/post/audioManager and renders the
|
|
365
464
|
// new row there; the table is div-based, so the row is found by its title text, never by `tr`.
|
|
366
465
|
const receipt = await expectOutcome(
|
|
@@ -20782,6 +20782,9 @@ async function ensureProfileDir2(profileDir, headless) {
|
|
|
20782
20782
|
var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
20783
20783
|
// ../../packages/publish-harness/src/browser.ts
|
|
20784
20784
|
var DEFAULT_CHECK_TIMEOUT_MS = 30000;
|
|
20785
|
+
var VERDICT_PRINT_MARGIN_MS = 2000;
|
|
20786
|
+
var MIN_PASS_BUDGET_MS = 5000;
|
|
20787
|
+
var PASS_LAUNCH_RESERVE_MS = 20000;
|
|
20785
20788
|
var DEFAULT_STEP_TIMEOUT_MS = 30000;
|
|
20786
20789
|
var DEFAULT_POLL_MS = 500;
|
|
20787
20790
|
var ATTACH_POLL_MS = 100;
|
|
@@ -20906,14 +20909,21 @@ async function checkChannelSession(config, opts) {
|
|
|
20906
20909
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
|
|
20907
20910
|
const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
|
|
20908
20911
|
let lastDetail = `${config.channel} readiness was never probed`;
|
|
20912
|
+
const deadline = Date.now() + timeoutMs;
|
|
20913
|
+
const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
|
|
20914
|
+
const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
|
|
20915
|
+
const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
|
|
20909
20916
|
for (const headless of passes) {
|
|
20917
|
+
const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
|
|
20918
|
+
if (remainingMs < minPassMs)
|
|
20919
|
+
break;
|
|
20910
20920
|
try {
|
|
20911
20921
|
await withProfilePage({
|
|
20912
20922
|
profileDir: opts.profileDir,
|
|
20913
20923
|
headless,
|
|
20914
20924
|
url: config.homeUrl,
|
|
20915
20925
|
isAuthenticated: config.isAuthenticated,
|
|
20916
|
-
timeoutMs,
|
|
20926
|
+
timeoutMs: remainingMs,
|
|
20917
20927
|
launcher: opts.launcher ?? kkBrowserLauncher
|
|
20918
20928
|
}, async () => true);
|
|
20919
20929
|
return {
|
|
@@ -20210,6 +20210,9 @@ var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
|
20210
20210
|
var DEFAULT_LOGIN_TIMEOUT_MS = 180000;
|
|
20211
20211
|
var DEFAULT_OPEN_NAV_TIMEOUT_MS = 30000;
|
|
20212
20212
|
var DEFAULT_CHECK_TIMEOUT_MS = 30000;
|
|
20213
|
+
var VERDICT_PRINT_MARGIN_MS = 2000;
|
|
20214
|
+
var MIN_PASS_BUDGET_MS = 5000;
|
|
20215
|
+
var PASS_LAUNCH_RESERVE_MS = 20000;
|
|
20213
20216
|
var DEFAULT_POLL_MS = 500;
|
|
20214
20217
|
function isInstantBrowserDeath(message) {
|
|
20215
20218
|
return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
|
|
@@ -20332,14 +20335,21 @@ async function checkChannelSession(config, opts) {
|
|
|
20332
20335
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
|
|
20333
20336
|
const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
|
|
20334
20337
|
let lastDetail = `${config.channel} readiness was never probed`;
|
|
20338
|
+
const deadline = Date.now() + timeoutMs;
|
|
20339
|
+
const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
|
|
20340
|
+
const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
|
|
20341
|
+
const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
|
|
20335
20342
|
for (const headless of passes) {
|
|
20343
|
+
const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
|
|
20344
|
+
if (remainingMs < minPassMs)
|
|
20345
|
+
break;
|
|
20336
20346
|
try {
|
|
20337
20347
|
await withProfilePage({
|
|
20338
20348
|
profileDir: opts.profileDir,
|
|
20339
20349
|
headless,
|
|
20340
20350
|
url: config.homeUrl,
|
|
20341
20351
|
isAuthenticated: config.isAuthenticated,
|
|
20342
|
-
timeoutMs,
|
|
20352
|
+
timeoutMs: remainingMs,
|
|
20343
20353
|
launcher: opts.launcher ?? kkBrowserLauncher
|
|
20344
20354
|
}, async () => true);
|
|
20345
20355
|
return {
|
|
@@ -20776,6 +20776,9 @@ async function ensureProfileDir2(profileDir, headless) {
|
|
|
20776
20776
|
var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
20777
20777
|
// ../../packages/publish-harness/src/browser.ts
|
|
20778
20778
|
var DEFAULT_CHECK_TIMEOUT_MS = 30000;
|
|
20779
|
+
var VERDICT_PRINT_MARGIN_MS = 2000;
|
|
20780
|
+
var MIN_PASS_BUDGET_MS = 5000;
|
|
20781
|
+
var PASS_LAUNCH_RESERVE_MS = 20000;
|
|
20779
20782
|
var DEFAULT_STEP_TIMEOUT_MS = 30000;
|
|
20780
20783
|
var DEFAULT_POLL_MS = 500;
|
|
20781
20784
|
var ATTACH_POLL_MS = 100;
|
|
@@ -20900,14 +20903,21 @@ async function checkChannelSession(config, opts) {
|
|
|
20900
20903
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
|
|
20901
20904
|
const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
|
|
20902
20905
|
let lastDetail = `${config.channel} readiness was never probed`;
|
|
20906
|
+
const deadline = Date.now() + timeoutMs;
|
|
20907
|
+
const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
|
|
20908
|
+
const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
|
|
20909
|
+
const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
|
|
20903
20910
|
for (const headless of passes) {
|
|
20911
|
+
const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
|
|
20912
|
+
if (remainingMs < minPassMs)
|
|
20913
|
+
break;
|
|
20904
20914
|
try {
|
|
20905
20915
|
await withProfilePage({
|
|
20906
20916
|
profileDir: opts.profileDir,
|
|
20907
20917
|
headless,
|
|
20908
20918
|
url: config.homeUrl,
|
|
20909
20919
|
isAuthenticated: config.isAuthenticated,
|
|
20910
|
-
timeoutMs,
|
|
20920
|
+
timeoutMs: remainingMs,
|
|
20911
20921
|
launcher: opts.launcher ?? kkBrowserLauncher
|
|
20912
20922
|
}, async () => true);
|
|
20913
20923
|
return {
|
|
@@ -20482,6 +20482,9 @@ var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
|
20482
20482
|
var DEFAULT_LOGIN_TIMEOUT_MS = 180000;
|
|
20483
20483
|
var DEFAULT_OPEN_NAV_TIMEOUT_MS = 30000;
|
|
20484
20484
|
var DEFAULT_CHECK_TIMEOUT_MS = 30000;
|
|
20485
|
+
var VERDICT_PRINT_MARGIN_MS = 2000;
|
|
20486
|
+
var MIN_PASS_BUDGET_MS = 5000;
|
|
20487
|
+
var PASS_LAUNCH_RESERVE_MS = 20000;
|
|
20485
20488
|
var DEFAULT_POLL_MS = 500;
|
|
20486
20489
|
function isInstantBrowserDeath(message) {
|
|
20487
20490
|
return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
|
|
@@ -20604,14 +20607,21 @@ async function checkChannelSession(config, opts) {
|
|
|
20604
20607
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
|
|
20605
20608
|
const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
|
|
20606
20609
|
let lastDetail = `${config.channel} readiness was never probed`;
|
|
20610
|
+
const deadline = Date.now() + timeoutMs;
|
|
20611
|
+
const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
|
|
20612
|
+
const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
|
|
20613
|
+
const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
|
|
20607
20614
|
for (const headless of passes) {
|
|
20615
|
+
const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
|
|
20616
|
+
if (remainingMs < minPassMs)
|
|
20617
|
+
break;
|
|
20608
20618
|
try {
|
|
20609
20619
|
await withProfilePage({
|
|
20610
20620
|
profileDir: opts.profileDir,
|
|
20611
20621
|
headless,
|
|
20612
20622
|
url: config.homeUrl,
|
|
20613
20623
|
isAuthenticated: config.isAuthenticated,
|
|
20614
|
-
timeoutMs,
|
|
20624
|
+
timeoutMs: remainingMs,
|
|
20615
20625
|
launcher: opts.launcher ?? kkBrowserLauncher
|
|
20616
20626
|
}, async () => true);
|
|
20617
20627
|
return {
|