@gobing-ai/knowledge-kit 0.1.20 → 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.
Files changed (115) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/collect/index.js +1 -0
  3. package/dist/board/daily-voice/index.js +1279 -261
  4. package/dist/board/itc/index.js +1 -0
  5. package/dist/index.js +13893 -8995
  6. package/package.json +1 -1
  7. package/plugins/generations/dailynews-gen/dist/index.js +285 -16
  8. package/plugins/generations/dailynews-gen/src/editorial-claims.ts +215 -0
  9. package/plugins/generations/dailynews-gen/src/index.ts +23 -4
  10. package/plugins/generations/dailynews-gen/src/script-builder.ts +10 -3
  11. package/plugins/generations/dailynews-gen/src/script-plan.ts +74 -14
  12. package/plugins/generations/music-gen/README.md +277 -0
  13. package/plugins/generations/music-gen/dist/index.js +23544 -0
  14. package/plugins/generations/music-gen/package.json +24 -0
  15. package/plugins/generations/music-gen/plugin.json +23 -0
  16. package/plugins/generations/music-gen/presets/SOURCE.md +39 -0
  17. package/plugins/generations/music-gen/presets/formats/clip.yaml +21 -0
  18. package/plugins/generations/music-gen/presets/formats/jingle.yaml +22 -0
  19. package/plugins/generations/music-gen/presets/formats/loop.yaml +21 -0
  20. package/plugins/generations/music-gen/presets/formats/song.yaml +31 -0
  21. package/plugins/generations/music-gen/presets/formats/underscore.yaml +22 -0
  22. package/plugins/generations/music-gen/presets/themes/ambient-tech.yaml +30 -0
  23. package/plugins/generations/music-gen/presets/themes/cinematic.yaml +30 -0
  24. package/plugins/generations/music-gen/presets/themes/lofi.yaml +30 -0
  25. package/plugins/generations/music-gen/presets/themes/synthwave.yaml +30 -0
  26. package/plugins/generations/music-gen/scripts/gen-preset-index.ts +181 -0
  27. package/plugins/generations/music-gen/scripts/resolve-preset.ts +64 -0
  28. package/plugins/generations/music-gen/src/adapter/index.ts +35 -0
  29. package/plugins/generations/music-gen/src/adapter/instance.ts +904 -0
  30. package/plugins/generations/music-gen/src/adapter/offline.ts +124 -0
  31. package/plugins/generations/music-gen/src/artifact.ts +223 -0
  32. package/plugins/generations/music-gen/src/audio/checks.ts +618 -0
  33. package/plugins/generations/music-gen/src/audio/master.ts +267 -0
  34. package/plugins/generations/music-gen/src/audio/measure.ts +507 -0
  35. package/plugins/generations/music-gen/src/audio/profile.ts +131 -0
  36. package/plugins/generations/music-gen/src/audio.ts +122 -0
  37. package/plugins/generations/music-gen/src/brief.ts +191 -0
  38. package/plugins/generations/music-gen/src/config.ts +451 -0
  39. package/plugins/generations/music-gen/src/content.ts +199 -0
  40. package/plugins/generations/music-gen/src/digest.ts +100 -0
  41. package/plugins/generations/music-gen/src/index.ts +147 -0
  42. package/plugins/generations/music-gen/src/job.ts +131 -0
  43. package/plugins/generations/music-gen/src/plugin.ts +371 -0
  44. package/plugins/generations/music-gen/src/presets.ts +918 -0
  45. package/plugins/generations/music-gen/src/render.ts +87 -0
  46. package/plugins/generations/music-gen/src/request.ts +102 -0
  47. package/plugins/generations/music-gen/src/spend.ts +495 -0
  48. package/plugins/generations/music-gen/tsconfig.json +8 -0
  49. package/plugins/kk/plugin.json +1 -1
  50. package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +2 -1
  51. package/plugins/kk/scripts/cover-compositor.ts +380 -32
  52. package/plugins/kk/scripts/daily-cover-mock.ts +40 -3
  53. package/plugins/kk/scripts/daily-stages.ts +659 -20
  54. package/plugins/kk/scripts/episode-identity.ts +180 -0
  55. package/plugins/kk/scripts/kk-workflow-stages.ts +37 -1
  56. package/plugins/kk/scripts/music-stages.ts +624 -0
  57. package/plugins/kk/scripts/news-editorial-ledger.ts +906 -0
  58. package/plugins/kk/scripts/source-citation.ts +187 -0
  59. package/plugins/kk/scripts/topic-selection-attempts.ts +446 -0
  60. package/plugins/kk/scripts/topic-selection-calibration.ts +161 -0
  61. package/plugins/kk/skills/content-judge/SKILL.md +11 -6
  62. package/plugins/kk/skills/content-judge/references/music-quality-rubric.md +147 -0
  63. package/plugins/kk/skills/content-judge/references/rubrics.md +15 -0
  64. package/plugins/kk/skills/content-safety/SKILL.md +12 -0
  65. package/plugins/kk/skills/music-authoring/SKILL.md +276 -0
  66. package/plugins/kk/skills/music-authoring/references/judge-input.md +117 -0
  67. package/plugins/kk/skills/news-editorial/SKILL.md +102 -15
  68. package/plugins/kk/skills/news-editorial/references/selection.md +4 -0
  69. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +58 -11
  70. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +8 -8
  71. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +7 -7
  72. package/plugins/kk/workflows/kk-music.yaml +328 -0
  73. package/plugins/kk/workflows/kk-news-generate.yaml +58 -3
  74. package/plugins/publishings/bilibili-pub/dist/index.js +11 -1
  75. package/plugins/publishings/bilibili-pub/dist/profile-check.js +11 -1
  76. package/plugins/publishings/cnblogs-pub/dist/index.js +11 -1
  77. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +11 -1
  78. package/plugins/publishings/csdn-pub/dist/index.js +11 -1
  79. package/plugins/publishings/csdn-pub/dist/profile-check.js +11 -1
  80. package/plugins/publishings/infoq-pub/dist/index.js +11 -1
  81. package/plugins/publishings/infoq-pub/dist/profile-check.js +11 -1
  82. package/plugins/publishings/jike-pub/dist/index.js +11 -1
  83. package/plugins/publishings/jike-pub/dist/profile-check.js +11 -1
  84. package/plugins/publishings/juejin-pub/dist/index.js +11 -1
  85. package/plugins/publishings/juejin-pub/dist/profile-check.js +11 -1
  86. package/plugins/publishings/linkedin-pub/dist/index.js +11 -1
  87. package/plugins/publishings/linkedin-pub/dist/profile-check.js +11 -1
  88. package/plugins/publishings/podcast-pub/dist/index.js +586 -20
  89. package/plugins/publishings/podcast-pub/src/corrections.ts +509 -0
  90. package/plugins/publishings/podcast-pub/src/index.ts +257 -5
  91. package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +240 -0
  92. package/plugins/publishings/podcast-pub/src/show-notes.ts +69 -13
  93. package/plugins/publishings/shipinhao-pub/dist/index.js +59 -8
  94. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +11 -1
  95. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +105 -6
  96. package/plugins/publishings/sspai-pub/dist/index.js +11 -1
  97. package/plugins/publishings/sspai-pub/dist/profile-check.js +11 -1
  98. package/plugins/publishings/substack-pub/dist/index.js +11 -1
  99. package/plugins/publishings/substack-pub/dist/profile-check.js +11 -1
  100. package/plugins/publishings/surfdash-pub/dist/index.js +72 -20
  101. package/plugins/publishings/surfdash-pub/src/digest-check.ts +7 -3
  102. package/plugins/publishings/surfdash-pub/src/index.ts +100 -17
  103. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +3 -1
  104. package/plugins/publishings/threads-pub/dist/index.js +11 -1
  105. package/plugins/publishings/threads-pub/dist/profile-check.js +11 -1
  106. package/plugins/publishings/wechatmp-pub/dist/index.js +11 -1
  107. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +11 -1
  108. package/plugins/publishings/weibo-pub/dist/index.js +11 -1
  109. package/plugins/publishings/weibo-pub/dist/profile-check.js +11 -1
  110. package/plugins/publishings/x-pub/dist/index.js +11 -1
  111. package/plugins/publishings/x-pub/dist/profile-check.js +11 -1
  112. package/plugins/publishings/xhs-pub/dist/index.js +11 -1
  113. package/plugins/publishings/xhs-pub/dist/profile-check.js +11 -1
  114. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +11 -1
  115. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +11 -1
@@ -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 {
@@ -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 {
@@ -20779,6 +20779,9 @@ async function ensureProfileDir2(profileDir, headless) {
20779
20779
  var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
20780
20780
  // ../../packages/publish-harness/src/browser.ts
20781
20781
  var DEFAULT_CHECK_TIMEOUT_MS = 30000;
20782
+ var VERDICT_PRINT_MARGIN_MS = 2000;
20783
+ var MIN_PASS_BUDGET_MS = 5000;
20784
+ var PASS_LAUNCH_RESERVE_MS = 20000;
20782
20785
  var DEFAULT_STEP_TIMEOUT_MS = 30000;
20783
20786
  var DEFAULT_POLL_MS = 500;
20784
20787
  var ATTACH_POLL_MS = 100;
@@ -20903,14 +20906,21 @@ async function checkChannelSession(config, opts) {
20903
20906
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20904
20907
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20905
20908
  let lastDetail = `${config.channel} readiness was never probed`;
20909
+ const deadline = Date.now() + timeoutMs;
20910
+ const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
20911
+ const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
20912
+ const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
20906
20913
  for (const headless of passes) {
20914
+ const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
20915
+ if (remainingMs < minPassMs)
20916
+ break;
20907
20917
  try {
20908
20918
  await withProfilePage({
20909
20919
  profileDir: opts.profileDir,
20910
20920
  headless,
20911
20921
  url: config.homeUrl,
20912
20922
  isAuthenticated: config.isAuthenticated,
20913
- timeoutMs,
20923
+ timeoutMs: remainingMs,
20914
20924
  launcher: opts.launcher ?? kkBrowserLauncher
20915
20925
  }, async () => true);
20916
20926
  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 {
@@ -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 {
@@ -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 {