@gobing-ai/knowledge-kit 0.1.19 → 0.1.22
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 +1315 -264
- package/dist/board/itc/index.js +1 -0
- package/dist/index.js +14674 -8775
- 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/image-gen/README.md +31 -31
- package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
- package/plugins/generations/image-gen/config.example.yaml +3 -0
- package/plugins/generations/image-gen/dist/index.js +154 -14
- package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
- package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
- package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
- package/plugins/generations/image-gen/src/presets.ts +6 -5
- package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
- package/plugins/generations/image-gen/src/providers/types.ts +11 -1
- package/plugins/generations/music-gen/README.md +277 -0
- package/plugins/generations/music-gen/dist/index.js +23544 -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 +31 -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 +30 -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 +904 -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 +918 -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/kk/config.example.yaml +3 -0
- package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice.json +48 -7
- package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +2 -1
- 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 +897 -34
- package/plugins/kk/scripts/episode-identity.ts +180 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +37 -1
- package/plugins/kk/scripts/music-stages.ts +624 -0
- package/plugins/kk/scripts/news-editorial-ledger.ts +906 -0
- 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/image-authoring/SKILL.md +7 -3
- package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
- package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
- 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/skills/publish/SKILL.md +11 -0
- package/plugins/kk/skills/web-automation/SKILL.md +31 -1
- package/plugins/kk/workflows/kk-collect.yaml +8 -4
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +10 -9
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +11 -9
- package/plugins/kk/workflows/kk-music.yaml +328 -0
- package/plugins/kk/workflows/kk-news-generate.yaml +58 -3
- 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 +54 -7
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +43 -6
- package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
- 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 +437 -32
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +14 -2
- package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
- package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +492 -0
- package/plugins/publishings/shipinhao-pub/src/flow.ts +227 -12
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
- 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 +122 -28
- package/plugins/publishings/surfdash-pub/src/digest-check.ts +7 -3
- package/plugins/publishings/surfdash-pub/src/index.ts +159 -25
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +37 -4
- package/plugins/publishings/threads-pub/dist/index.js +9206 -296
- package/plugins/publishings/threads-pub/dist/profile-check.js +21149 -0
- package/plugins/publishings/threads-pub/package.json +3 -1
- package/plugins/publishings/threads-pub/plugin.json +6 -1
- package/plugins/publishings/threads-pub/src/index.ts +8 -1
- package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
- package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +18 -1
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/wechatmp-pub/src/flow.ts +13 -0
- package/plugins/publishings/weibo-pub/dist/index.js +57 -3
- package/plugins/publishings/weibo-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/weibo-pub/src/index.ts +74 -2
- package/plugins/publishings/x-pub/dist/index.js +274 -44
- package/plugins/publishings/x-pub/dist/profile-check.js +14 -2
- package/plugins/publishings/x-pub/src/index.ts +15 -1
- package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
- 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
|
@@ -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 {
|
|
@@ -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 {
|
|
@@ -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 {
|
|
@@ -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 {
|
|
@@ -20997,10 +21007,30 @@ var MAX_TEXT_CHARS = 3000;
|
|
|
20997
21007
|
var MAX_IMAGES = 1;
|
|
20998
21008
|
var IMAGE_EXTS = new Set([".png", ".jpg", ".jpeg", ".webp", ".gif"]);
|
|
20999
21009
|
var LINKEDIN_POST_SELECTORS = {
|
|
21000
|
-
shareTrigger: [
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21010
|
+
shareTrigger: [
|
|
21011
|
+
'text="Start a post"',
|
|
21012
|
+
"button.share-box-feed-entry__trigger",
|
|
21013
|
+
'button[aria-label*="Start a post" i]'
|
|
21014
|
+
],
|
|
21015
|
+
composer: [
|
|
21016
|
+
'.tiptap.ProseMirror div[role="textbox"]',
|
|
21017
|
+
'div[role="textbox"].tiptap',
|
|
21018
|
+
".tiptap.ProseMirror",
|
|
21019
|
+
'[role="dialog"] div[role="textbox"]',
|
|
21020
|
+
'div.editor-content[contenteditable="true"]',
|
|
21021
|
+
'div[role="textbox"][contenteditable="true"]'
|
|
21022
|
+
],
|
|
21023
|
+
mediaButton: [
|
|
21024
|
+
'button[aria-label="Media"]',
|
|
21025
|
+
'button[aria-label*="Media" i]',
|
|
21026
|
+
'[role="dialog"] button[aria-label*="Media" i]'
|
|
21027
|
+
],
|
|
21028
|
+
fileInput: ['input[type="file"][accept*="image"]', 'input[type="file"]', '[role="dialog"] input[type="file"]'],
|
|
21029
|
+
send: [
|
|
21030
|
+
'button:text-is("Post")',
|
|
21031
|
+
'[role="dialog"] button:text-is("Post")',
|
|
21032
|
+
'[role="dialog"] button.share-actions__primary-action'
|
|
21033
|
+
]
|
|
21004
21034
|
};
|
|
21005
21035
|
var FAILURE_TOAST_RE = /post failed|couldn't post|something went wrong/i;
|
|
21006
21036
|
var SUCCESS_TOAST_RE = /post successful/i;
|
|
@@ -21059,7 +21089,14 @@ function resolveDriver(options) {
|
|
|
21059
21089
|
var isLinkedinAuthenticated = async (page) => {
|
|
21060
21090
|
if (LINKEDIN_LOGIN_URL_RE.test(page.url()))
|
|
21061
21091
|
return false;
|
|
21062
|
-
|
|
21092
|
+
if ((await trySelectors(page, LINKEDIN_POST_SELECTORS.shareTrigger.slice(1), { visible: false })).found) {
|
|
21093
|
+
return true;
|
|
21094
|
+
}
|
|
21095
|
+
try {
|
|
21096
|
+
return await page.getByText("Start a post", { exact: true }).count() > 0;
|
|
21097
|
+
} catch {
|
|
21098
|
+
return false;
|
|
21099
|
+
}
|
|
21063
21100
|
};
|
|
21064
21101
|
var LINKEDIN_CONFIG = {
|
|
21065
21102
|
channel: TARGET,
|
|
@@ -21175,7 +21212,13 @@ class LinkedinBrowserTransport {
|
|
|
21175
21212
|
} catch {
|
|
21176
21213
|
return stageFail(`linkedin composer did not open after the share box (selector drift) \u2014 run: ${LINKEDIN_LOGIN_INSTRUCTION}`, "composer", metadata);
|
|
21177
21214
|
}
|
|
21178
|
-
|
|
21215
|
+
const composer = page.locator(composerSelector).first();
|
|
21216
|
+
if (typeof composer.pressSequentially === "function") {
|
|
21217
|
+
await composer.click();
|
|
21218
|
+
await composer.pressSequentially(text, { delay: 3 });
|
|
21219
|
+
} else {
|
|
21220
|
+
await composer.fill(text);
|
|
21221
|
+
}
|
|
21179
21222
|
const readback = await this.requireReadback(page, composerSelector, text);
|
|
21180
21223
|
if (!readback.ok)
|
|
21181
21224
|
return stageFail(readback.error, "text-readback", metadata);
|
|
@@ -21229,6 +21272,10 @@ class LinkedinBrowserTransport {
|
|
|
21229
21272
|
}
|
|
21230
21273
|
async uploadImage(page, image) {
|
|
21231
21274
|
try {
|
|
21275
|
+
const media = await trySelectors(page, LINKEDIN_POST_SELECTORS.mediaButton);
|
|
21276
|
+
if (media.found) {
|
|
21277
|
+
await page.locator(media.selector ?? LINKEDIN_POST_SELECTORS.mediaButton[0]).first().click();
|
|
21278
|
+
}
|
|
21232
21279
|
const inputSelector = await resolveSelector(page, LINKEDIN_POST_SELECTORS.fileInput, {
|
|
21233
21280
|
timeoutMs: this.stepTimeoutMs,
|
|
21234
21281
|
label: "linkedin file input"
|
|
@@ -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 {
|
|
@@ -21106,16 +21116,43 @@ var LINKEDIN_HOME_URL = "https://www.linkedin.com/feed/";
|
|
|
21106
21116
|
var LINKEDIN_LOGIN_URL_RE = /(\/authwall|\/login|\/checkpoint)/;
|
|
21107
21117
|
var IMAGE_EXTS = new Set([".png", ".jpg", ".jpeg", ".webp", ".gif"]);
|
|
21108
21118
|
var LINKEDIN_POST_SELECTORS = {
|
|
21109
|
-
shareTrigger: [
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21119
|
+
shareTrigger: [
|
|
21120
|
+
'text="Start a post"',
|
|
21121
|
+
"button.share-box-feed-entry__trigger",
|
|
21122
|
+
'button[aria-label*="Start a post" i]'
|
|
21123
|
+
],
|
|
21124
|
+
composer: [
|
|
21125
|
+
'.tiptap.ProseMirror div[role="textbox"]',
|
|
21126
|
+
'div[role="textbox"].tiptap',
|
|
21127
|
+
".tiptap.ProseMirror",
|
|
21128
|
+
'[role="dialog"] div[role="textbox"]',
|
|
21129
|
+
'div.editor-content[contenteditable="true"]',
|
|
21130
|
+
'div[role="textbox"][contenteditable="true"]'
|
|
21131
|
+
],
|
|
21132
|
+
mediaButton: [
|
|
21133
|
+
'button[aria-label="Media"]',
|
|
21134
|
+
'button[aria-label*="Media" i]',
|
|
21135
|
+
'[role="dialog"] button[aria-label*="Media" i]'
|
|
21136
|
+
],
|
|
21137
|
+
fileInput: ['input[type="file"][accept*="image"]', 'input[type="file"]', '[role="dialog"] input[type="file"]'],
|
|
21138
|
+
send: [
|
|
21139
|
+
'button:text-is("Post")',
|
|
21140
|
+
'[role="dialog"] button:text-is("Post")',
|
|
21141
|
+
'[role="dialog"] button.share-actions__primary-action'
|
|
21142
|
+
]
|
|
21113
21143
|
};
|
|
21114
21144
|
var LOGIN_TIMEOUT_MS = 180000;
|
|
21115
21145
|
var isLinkedinAuthenticated = async (page) => {
|
|
21116
21146
|
if (LINKEDIN_LOGIN_URL_RE.test(page.url()))
|
|
21117
21147
|
return false;
|
|
21118
|
-
|
|
21148
|
+
if ((await trySelectors(page, LINKEDIN_POST_SELECTORS.shareTrigger.slice(1), { visible: false })).found) {
|
|
21149
|
+
return true;
|
|
21150
|
+
}
|
|
21151
|
+
try {
|
|
21152
|
+
return await page.getByText("Start a post", { exact: true }).count() > 0;
|
|
21153
|
+
} catch {
|
|
21154
|
+
return false;
|
|
21155
|
+
}
|
|
21119
21156
|
};
|
|
21120
21157
|
var LINKEDIN_CONFIG = {
|
|
21121
21158
|
channel: TARGET,
|
|
@@ -77,10 +77,33 @@ const IMAGE_EXTS = new Set(['.png', '.jpg', '.jpeg', '.webp', '.gif']);
|
|
|
77
77
|
* A drifted selector is a loud typed refusal at its stage, never a silent skip or a text-only post.
|
|
78
78
|
*/
|
|
79
79
|
export const LINKEDIN_POST_SELECTORS = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
// 2026-11-16 live measurement of the redesigned feed: the share trigger is a classless div and the
|
|
81
|
+
// share surface is NOT a `[role="dialog"]`, so controls are page-scoped by text, with the old
|
|
82
|
+
// class-based ladder kept as a fallback for accounts still on the previous UI.
|
|
83
|
+
shareTrigger: [
|
|
84
|
+
'text="Start a post"',
|
|
85
|
+
'button.share-box-feed-entry__trigger',
|
|
86
|
+
'button[aria-label*="Start a post" i]',
|
|
87
|
+
],
|
|
88
|
+
composer: [
|
|
89
|
+
'.tiptap.ProseMirror div[role="textbox"]',
|
|
90
|
+
'div[role="textbox"].tiptap',
|
|
91
|
+
'.tiptap.ProseMirror',
|
|
92
|
+
'[role="dialog"] div[role="textbox"]',
|
|
93
|
+
'div.editor-content[contenteditable="true"]',
|
|
94
|
+
'div[role="textbox"][contenteditable="true"]',
|
|
95
|
+
],
|
|
96
|
+
mediaButton: [
|
|
97
|
+
'button[aria-label="Media"]',
|
|
98
|
+
'button[aria-label*="Media" i]',
|
|
99
|
+
'[role="dialog"] button[aria-label*="Media" i]',
|
|
100
|
+
],
|
|
101
|
+
fileInput: ['input[type="file"][accept*="image"]', 'input[type="file"]', '[role="dialog"] input[type="file"]'],
|
|
102
|
+
send: [
|
|
103
|
+
'button:text-is("Post")',
|
|
104
|
+
'[role="dialog"] button:text-is("Post")',
|
|
105
|
+
'[role="dialog"] button.share-actions__primary-action',
|
|
106
|
+
],
|
|
84
107
|
} as const;
|
|
85
108
|
|
|
86
109
|
/** Failure toast words. **Provisional** (LinkedIn's artdeco toast wording). */
|
|
@@ -181,7 +204,14 @@ function resolveDriver(options?: Record<string, unknown>): BrowserDriver | { err
|
|
|
181
204
|
*/
|
|
182
205
|
export const isLinkedinAuthenticated: IsAuthenticatedPredicate = async (page) => {
|
|
183
206
|
if (LINKEDIN_LOGIN_URL_RE.test(page.url())) return false;
|
|
184
|
-
|
|
207
|
+
if ((await trySelectors(page, LINKEDIN_POST_SELECTORS.shareTrigger.slice(1), { visible: false })).found) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
return (await page.getByText('Start a post', { exact: true }).count()) > 0;
|
|
212
|
+
} catch {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
185
215
|
};
|
|
186
216
|
|
|
187
217
|
/**
|
|
@@ -380,7 +410,16 @@ export class LinkedinBrowserTransport implements PublishTransport {
|
|
|
380
410
|
metadata,
|
|
381
411
|
);
|
|
382
412
|
}
|
|
383
|
-
|
|
413
|
+
const composer = page.locator(composerSelector).first();
|
|
414
|
+
if (typeof composer.pressSequentially === 'function') {
|
|
415
|
+
// tiptap/ProseMirror (measured 2026-11-16): `fill()` writes the DOM without the editor's
|
|
416
|
+
// state, so the footer Post control never renders. Type real key events — the same trap
|
|
417
|
+
// as X's Draft.js. A page stub without pressSequentially keeps the fill path.
|
|
418
|
+
await composer.click();
|
|
419
|
+
await composer.pressSequentially(text, { delay: 3 });
|
|
420
|
+
} else {
|
|
421
|
+
await composer.fill(text);
|
|
422
|
+
}
|
|
384
423
|
|
|
385
424
|
// Readback before anything else: a field the editor dropped must never be submitted.
|
|
386
425
|
const readback = await this.requireReadback(page, composerSelector, text);
|
|
@@ -473,6 +512,13 @@ export class LinkedinBrowserTransport implements PublishTransport {
|
|
|
473
512
|
image: string,
|
|
474
513
|
): Promise<{ ok: true; evidence: string } | { ok: false; error: string }> {
|
|
475
514
|
try {
|
|
515
|
+
const media = await trySelectors(page, LINKEDIN_POST_SELECTORS.mediaButton);
|
|
516
|
+
if (media.found) {
|
|
517
|
+
await page
|
|
518
|
+
.locator(media.selector ?? LINKEDIN_POST_SELECTORS.mediaButton[0])
|
|
519
|
+
.first()
|
|
520
|
+
.click();
|
|
521
|
+
}
|
|
476
522
|
const inputSelector = await resolveSelector(page, LINKEDIN_POST_SELECTORS.fileInput, {
|
|
477
523
|
timeoutMs: this.stepTimeoutMs,
|
|
478
524
|
label: 'linkedin file input',
|