@gobing-ai/knowledge-kit 0.1.25 → 0.1.28
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 +10 -0
- package/dist/board/daily-voice/index.js +1327 -2168
- package/dist/board/itc/index.js +10 -0
- package/dist/index.js +6043 -4620
- package/package.json +1 -1
- package/plugins/ingestions/aihot-ingest/dist/index.js +4 -1
- package/plugins/ingestions/aihot-ingest/src/rss.ts +22 -11
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/cn-lead-gate.ts +494 -0
- package/plugins/kk/scripts/daily-stages.ts +423 -141
- package/plugins/kk/scripts/kk-workflow-stages.ts +53 -3
- package/plugins/kk/skills/news-editorial/SKILL.md +20 -3
- package/plugins/kk/skills/news-editorial/references/selection.md +42 -0
- package/plugins/kk/workflows/kk-news-generate.yaml +1 -1
- package/plugins/publishings/bilibili-pub/dist/index.js +114 -82
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/cnblogs-pub/dist/index.js +114 -82
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/csdn-pub/dist/index.js +114 -82
- package/plugins/publishings/csdn-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/infoq-pub/dist/index.js +114 -82
- package/plugins/publishings/infoq-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/jike-pub/dist/index.js +114 -82
- package/plugins/publishings/jike-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/juejin-pub/dist/index.js +114 -82
- package/plugins/publishings/juejin-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/linkedin-pub/dist/index.js +165 -93
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +51 -6
- package/plugins/publishings/linkedin-pub/src/index.ts +126 -9
- package/plugins/publishings/medium-pub/dist/index.js +114 -82
- package/plugins/publishings/medium-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/shipinhao-pub/dist/index.js +305 -87
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +145 -5
- package/plugins/publishings/shipinhao-pub/src/cover-crop.ts +60 -0
- package/plugins/publishings/shipinhao-pub/src/flow.ts +15 -2
- package/plugins/publishings/shipinhao-pub/src/profile-check.ts +15 -12
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +22 -1
- package/plugins/publishings/sspai-pub/dist/index.js +114 -82
- package/plugins/publishings/sspai-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/substack-pub/dist/index.js +114 -82
- package/plugins/publishings/substack-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/surfdash-pub/dist/index.js +96 -20
- package/plugins/publishings/surfdash-pub/src/index.ts +31 -4
- package/plugins/publishings/surfdash-pub/src/patch.ts +81 -12
- package/plugins/publishings/threads-pub/dist/index.js +119 -83
- package/plugins/publishings/threads-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/threads-pub/src/index.ts +10 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +149 -86
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +68 -4
- package/plugins/publishings/wechatmp-pub/src/index.ts +64 -1
- package/plugins/publishings/weibo-pub/dist/index.js +273 -91
- package/plugins/publishings/weibo-pub/dist/profile-check.js +178 -11
- package/plugins/publishings/weibo-pub/plugin.json +1 -1
- package/plugins/publishings/weibo-pub/src/index.ts +136 -10
- package/plugins/publishings/weibo-pub/src/profile-check.ts +4 -2
- package/plugins/publishings/x-pub/dist/index.js +114 -82
- package/plugins/publishings/x-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/xhs-pub/dist/index.js +114 -82
- package/plugins/publishings/xhs-pub/dist/profile-check.js +34 -3
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +114 -82
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +34 -3
|
@@ -20171,6 +20171,86 @@ var ATTACHED_CLOSERS = new Set(["\u201D", "\u2019", "\u300D", "\u300F", "\uFF09"
|
|
|
20171
20171
|
import { homedir } from "os";
|
|
20172
20172
|
import { join, resolve } from "path";
|
|
20173
20173
|
|
|
20174
|
+
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20175
|
+
import {
|
|
20176
|
+
chmodSync,
|
|
20177
|
+
closeSync,
|
|
20178
|
+
copyFileSync,
|
|
20179
|
+
lstatSync,
|
|
20180
|
+
mkdirSync as mkdirSync2,
|
|
20181
|
+
openSync,
|
|
20182
|
+
readdirSync as readdirSync2,
|
|
20183
|
+
readlinkSync,
|
|
20184
|
+
realpathSync as realpathSync2,
|
|
20185
|
+
renameSync as renameSync2,
|
|
20186
|
+
rmdirSync,
|
|
20187
|
+
unlinkSync
|
|
20188
|
+
} from "fs";
|
|
20189
|
+
function lstat(path) {
|
|
20190
|
+
try {
|
|
20191
|
+
return lstatSync(path);
|
|
20192
|
+
} catch (error) {
|
|
20193
|
+
if (error.code === "ENOENT")
|
|
20194
|
+
return null;
|
|
20195
|
+
throw error;
|
|
20196
|
+
}
|
|
20197
|
+
}
|
|
20198
|
+
function realpath(path) {
|
|
20199
|
+
return realpathSync2(path);
|
|
20200
|
+
}
|
|
20201
|
+
function mkdirExclusive(path, mode = 448) {
|
|
20202
|
+
try {
|
|
20203
|
+
mkdirSync2(path, { mode });
|
|
20204
|
+
return true;
|
|
20205
|
+
} catch (error) {
|
|
20206
|
+
if (error.code === "EEXIST")
|
|
20207
|
+
return false;
|
|
20208
|
+
throw error;
|
|
20209
|
+
}
|
|
20210
|
+
}
|
|
20211
|
+
function rmdir(path) {
|
|
20212
|
+
try {
|
|
20213
|
+
rmdirSync(path);
|
|
20214
|
+
return true;
|
|
20215
|
+
} catch (error) {
|
|
20216
|
+
const code = error.code;
|
|
20217
|
+
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20218
|
+
return false;
|
|
20219
|
+
throw error;
|
|
20220
|
+
}
|
|
20221
|
+
}
|
|
20222
|
+
function readlink(path) {
|
|
20223
|
+
try {
|
|
20224
|
+
return readlinkSync(path);
|
|
20225
|
+
} catch {
|
|
20226
|
+
return null;
|
|
20227
|
+
}
|
|
20228
|
+
}
|
|
20229
|
+
function unlink(path) {
|
|
20230
|
+
try {
|
|
20231
|
+
unlinkSync(path);
|
|
20232
|
+
return true;
|
|
20233
|
+
} catch (error) {
|
|
20234
|
+
if (error.code === "ENOENT")
|
|
20235
|
+
return false;
|
|
20236
|
+
throw error;
|
|
20237
|
+
}
|
|
20238
|
+
}
|
|
20239
|
+
function rename(from, to) {
|
|
20240
|
+
try {
|
|
20241
|
+
renameSync2(from, to);
|
|
20242
|
+
return true;
|
|
20243
|
+
} catch (error) {
|
|
20244
|
+
if (error.code === "ENOENT")
|
|
20245
|
+
return false;
|
|
20246
|
+
throw error;
|
|
20247
|
+
}
|
|
20248
|
+
}
|
|
20249
|
+
function chmod(path, mode) {
|
|
20250
|
+
chmodSync(path, mode);
|
|
20251
|
+
}
|
|
20252
|
+
|
|
20253
|
+
// ../../packages/publish-harness/src/index.ts
|
|
20174
20254
|
class FakeTransportCore {
|
|
20175
20255
|
callLogs = [];
|
|
20176
20256
|
nextResult;
|
|
@@ -20455,85 +20535,6 @@ init_dist();
|
|
|
20455
20535
|
import { homedir as homedir4 } from "os";
|
|
20456
20536
|
import { isAbsolute, join as join4, relative, resolve as resolve4, sep } from "path";
|
|
20457
20537
|
|
|
20458
|
-
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20459
|
-
import {
|
|
20460
|
-
chmodSync,
|
|
20461
|
-
closeSync,
|
|
20462
|
-
copyFileSync,
|
|
20463
|
-
lstatSync,
|
|
20464
|
-
mkdirSync as mkdirSync2,
|
|
20465
|
-
openSync,
|
|
20466
|
-
readdirSync as readdirSync2,
|
|
20467
|
-
readlinkSync,
|
|
20468
|
-
realpathSync as realpathSync2,
|
|
20469
|
-
renameSync as renameSync2,
|
|
20470
|
-
rmdirSync,
|
|
20471
|
-
unlinkSync
|
|
20472
|
-
} from "fs";
|
|
20473
|
-
function lstat(path) {
|
|
20474
|
-
try {
|
|
20475
|
-
return lstatSync(path);
|
|
20476
|
-
} catch (error) {
|
|
20477
|
-
if (error.code === "ENOENT")
|
|
20478
|
-
return null;
|
|
20479
|
-
throw error;
|
|
20480
|
-
}
|
|
20481
|
-
}
|
|
20482
|
-
function realpath(path) {
|
|
20483
|
-
return realpathSync2(path);
|
|
20484
|
-
}
|
|
20485
|
-
function mkdirExclusive(path, mode = 448) {
|
|
20486
|
-
try {
|
|
20487
|
-
mkdirSync2(path, { mode });
|
|
20488
|
-
return true;
|
|
20489
|
-
} catch (error) {
|
|
20490
|
-
if (error.code === "EEXIST")
|
|
20491
|
-
return false;
|
|
20492
|
-
throw error;
|
|
20493
|
-
}
|
|
20494
|
-
}
|
|
20495
|
-
function rmdir(path) {
|
|
20496
|
-
try {
|
|
20497
|
-
rmdirSync(path);
|
|
20498
|
-
return true;
|
|
20499
|
-
} catch (error) {
|
|
20500
|
-
const code = error.code;
|
|
20501
|
-
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20502
|
-
return false;
|
|
20503
|
-
throw error;
|
|
20504
|
-
}
|
|
20505
|
-
}
|
|
20506
|
-
function readlink(path) {
|
|
20507
|
-
try {
|
|
20508
|
-
return readlinkSync(path);
|
|
20509
|
-
} catch {
|
|
20510
|
-
return null;
|
|
20511
|
-
}
|
|
20512
|
-
}
|
|
20513
|
-
function unlink(path) {
|
|
20514
|
-
try {
|
|
20515
|
-
unlinkSync(path);
|
|
20516
|
-
return true;
|
|
20517
|
-
} catch (error) {
|
|
20518
|
-
if (error.code === "ENOENT")
|
|
20519
|
-
return false;
|
|
20520
|
-
throw error;
|
|
20521
|
-
}
|
|
20522
|
-
}
|
|
20523
|
-
function rename(from, to) {
|
|
20524
|
-
try {
|
|
20525
|
-
renameSync2(from, to);
|
|
20526
|
-
return true;
|
|
20527
|
-
} catch (error) {
|
|
20528
|
-
if (error.code === "ENOENT")
|
|
20529
|
-
return false;
|
|
20530
|
-
throw error;
|
|
20531
|
-
}
|
|
20532
|
-
}
|
|
20533
|
-
function chmod(path, mode) {
|
|
20534
|
-
chmodSync(path, mode);
|
|
20535
|
-
}
|
|
20536
|
-
|
|
20537
20538
|
// ../../packages/publish-harness/src/bot-transaction.ts
|
|
20538
20539
|
import { homedir as homedir2 } from "os";
|
|
20539
20540
|
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
@@ -20558,7 +20559,12 @@ async function acquireProfileLease(profileDir, options = {}) {
|
|
|
20558
20559
|
const leaseDir = join3(leaseRoot, id);
|
|
20559
20560
|
await fileSystem.ensureDir(leaseRoot);
|
|
20560
20561
|
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20561
|
-
|
|
20562
|
+
if (!await reclaimDeadOwnerLease(fileSystem, leaseDir)) {
|
|
20563
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20564
|
+
}
|
|
20565
|
+
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20566
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20567
|
+
}
|
|
20562
20568
|
}
|
|
20563
20569
|
const token = randomBytes(16).toString("hex");
|
|
20564
20570
|
const owner = {
|
|
@@ -20674,9 +20680,35 @@ async function busyGuidance(fileSystem, leaseDir) {
|
|
|
20674
20680
|
}
|
|
20675
20681
|
return `browser lease ${leaseDir} already exists with no owner record \u2014 a previous run may have crashed mid-acquire; confirm no kk browser still uses this profile, then remove ${leaseDir} manually`;
|
|
20676
20682
|
}
|
|
20677
|
-
const
|
|
20683
|
+
const live = isProcessAlive(owner.pid) ? [] : await liveChildHolders(fileSystem, leaseDir);
|
|
20684
|
+
const suffix = live.length > 0 ? `pid ${owner.pid} is gone but child holders ${live.join(", ")} are still running \u2014 stop those processes before retrying` : isProcessAlive(owner.pid) ? "confirm that process and any browser for this profile have stopped; stale ownership is never auto-removed" : `pid ${owner.pid} is no longer running and the lease could not be reclassified \u2014 confirm no browser for this profile is open, then remove the stale lease with: rm -rf ${leaseDir}`;
|
|
20678
20685
|
return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
|
|
20679
20686
|
}
|
|
20687
|
+
async function reclaimDeadOwnerLease(fileSystem, leaseDir) {
|
|
20688
|
+
const owner = await readOwner(fileSystem, leaseDir);
|
|
20689
|
+
if (owner === null || isProcessAlive(owner.pid))
|
|
20690
|
+
return false;
|
|
20691
|
+
if ((await liveChildHolders(fileSystem, leaseDir)).length > 0)
|
|
20692
|
+
return false;
|
|
20693
|
+
const target = staleLeaseDir(leaseDir);
|
|
20694
|
+
try {
|
|
20695
|
+
rename(leaseDir, target);
|
|
20696
|
+
} catch {
|
|
20697
|
+
return false;
|
|
20698
|
+
}
|
|
20699
|
+
const moved = await readOwner(fileSystem, target);
|
|
20700
|
+
if (moved !== null && moved.token !== owner.token) {
|
|
20701
|
+
try {
|
|
20702
|
+
rename(target, leaseDir);
|
|
20703
|
+
} catch {}
|
|
20704
|
+
return false;
|
|
20705
|
+
}
|
|
20706
|
+
return true;
|
|
20707
|
+
}
|
|
20708
|
+
function staleLeaseDir(leaseDir) {
|
|
20709
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "").slice(0, 15);
|
|
20710
|
+
return `${leaseDir}.stale-${stamp}-${process.pid}-${randomBytes(3).toString("hex")}`;
|
|
20711
|
+
}
|
|
20680
20712
|
async function holderResidue(fileSystem, leaseDir) {
|
|
20681
20713
|
try {
|
|
20682
20714
|
const entries = await fileSystem.readDir(leaseDir);
|
|
@@ -20802,7 +20834,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20802
20834
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20803
20835
|
if (lstat(syncData) === null)
|
|
20804
20836
|
return false;
|
|
20805
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20837
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20806
20838
|
}
|
|
20807
20839
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20808
20840
|
return {
|
|
@@ -20219,7 +20219,12 @@ async function acquireProfileLease(profileDir, options = {}) {
|
|
|
20219
20219
|
const leaseDir = join2(leaseRoot, id);
|
|
20220
20220
|
await fileSystem.ensureDir(leaseRoot);
|
|
20221
20221
|
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20222
|
-
|
|
20222
|
+
if (!await reclaimDeadOwnerLease(fileSystem, leaseDir)) {
|
|
20223
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20224
|
+
}
|
|
20225
|
+
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20226
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20227
|
+
}
|
|
20223
20228
|
}
|
|
20224
20229
|
const token = randomBytes(16).toString("hex");
|
|
20225
20230
|
const owner = {
|
|
@@ -20335,9 +20340,35 @@ async function busyGuidance(fileSystem, leaseDir) {
|
|
|
20335
20340
|
}
|
|
20336
20341
|
return `browser lease ${leaseDir} already exists with no owner record \u2014 a previous run may have crashed mid-acquire; confirm no kk browser still uses this profile, then remove ${leaseDir} manually`;
|
|
20337
20342
|
}
|
|
20338
|
-
const
|
|
20343
|
+
const live = isProcessAlive(owner.pid) ? [] : await liveChildHolders(fileSystem, leaseDir);
|
|
20344
|
+
const suffix = live.length > 0 ? `pid ${owner.pid} is gone but child holders ${live.join(", ")} are still running \u2014 stop those processes before retrying` : isProcessAlive(owner.pid) ? "confirm that process and any browser for this profile have stopped; stale ownership is never auto-removed" : `pid ${owner.pid} is no longer running and the lease could not be reclassified \u2014 confirm no browser for this profile is open, then remove the stale lease with: rm -rf ${leaseDir}`;
|
|
20339
20345
|
return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
|
|
20340
20346
|
}
|
|
20347
|
+
async function reclaimDeadOwnerLease(fileSystem, leaseDir) {
|
|
20348
|
+
const owner = await readOwner(fileSystem, leaseDir);
|
|
20349
|
+
if (owner === null || isProcessAlive(owner.pid))
|
|
20350
|
+
return false;
|
|
20351
|
+
if ((await liveChildHolders(fileSystem, leaseDir)).length > 0)
|
|
20352
|
+
return false;
|
|
20353
|
+
const target = staleLeaseDir(leaseDir);
|
|
20354
|
+
try {
|
|
20355
|
+
rename(leaseDir, target);
|
|
20356
|
+
} catch {
|
|
20357
|
+
return false;
|
|
20358
|
+
}
|
|
20359
|
+
const moved = await readOwner(fileSystem, target);
|
|
20360
|
+
if (moved !== null && moved.token !== owner.token) {
|
|
20361
|
+
try {
|
|
20362
|
+
rename(target, leaseDir);
|
|
20363
|
+
} catch {}
|
|
20364
|
+
return false;
|
|
20365
|
+
}
|
|
20366
|
+
return true;
|
|
20367
|
+
}
|
|
20368
|
+
function staleLeaseDir(leaseDir) {
|
|
20369
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "").slice(0, 15);
|
|
20370
|
+
return `${leaseDir}.stale-${stamp}-${process.pid}-${randomBytes(3).toString("hex")}`;
|
|
20371
|
+
}
|
|
20341
20372
|
async function holderResidue(fileSystem, leaseDir) {
|
|
20342
20373
|
try {
|
|
20343
20374
|
const entries = await fileSystem.readDir(leaseDir);
|
|
@@ -20506,7 +20537,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20506
20537
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20507
20538
|
if (lstat(syncData) === null)
|
|
20508
20539
|
return false;
|
|
20509
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20540
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20510
20541
|
}
|
|
20511
20542
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20512
20543
|
return {
|
|
@@ -12017,6 +12017,43 @@ function findProjectRoot(startDir) {
|
|
|
12017
12017
|
}
|
|
12018
12018
|
var init_file_system_node = () => {};
|
|
12019
12019
|
|
|
12020
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
12021
|
+
var init_context = () => {};
|
|
12022
|
+
|
|
12023
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
12024
|
+
var SEP;
|
|
12025
|
+
var init_path = __esm(() => {
|
|
12026
|
+
SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
12027
|
+
});
|
|
12028
|
+
|
|
12029
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
12030
|
+
var REMOTE_SCHEMA_MAX_BYTES;
|
|
12031
|
+
var init_schema_validation = __esm(() => {
|
|
12032
|
+
init_dist2();
|
|
12033
|
+
REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
|
|
12034
|
+
});
|
|
12035
|
+
|
|
12036
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
12037
|
+
var init_types = () => {};
|
|
12038
|
+
|
|
12039
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
12040
|
+
var init_dist3 = __esm(() => {
|
|
12041
|
+
init_file_system_node();
|
|
12042
|
+
init_config();
|
|
12043
|
+
init_context();
|
|
12044
|
+
init_path();
|
|
12045
|
+
init_schema_validation();
|
|
12046
|
+
init_types();
|
|
12047
|
+
});
|
|
12048
|
+
|
|
12049
|
+
// ../../packages/publish-harness/src/bot-fs.ts
|
|
12050
|
+
var init_bot_fs = () => {};
|
|
12051
|
+
|
|
12052
|
+
// ../../packages/publish-harness/src/session-state.ts
|
|
12053
|
+
var init_session_state = __esm(() => {
|
|
12054
|
+
init_bot_fs();
|
|
12055
|
+
});
|
|
12056
|
+
|
|
12020
12057
|
// ../../packages/publish-harness/src/index.ts
|
|
12021
12058
|
var exports_src = {};
|
|
12022
12059
|
__export(exports_src, {
|
|
@@ -12067,7 +12104,9 @@ class FakeFileCliTransport {
|
|
|
12067
12104
|
this.core.reset();
|
|
12068
12105
|
}
|
|
12069
12106
|
}
|
|
12070
|
-
var init_src = () => {
|
|
12107
|
+
var init_src = __esm(() => {
|
|
12108
|
+
init_session_state();
|
|
12109
|
+
});
|
|
12071
12110
|
|
|
12072
12111
|
// ../../plugins/publishings/surfdash-pub/src/index.ts
|
|
12073
12112
|
import { createHash } from "crypto";
|
|
@@ -12340,10 +12379,6 @@ var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx)
|
|
|
12340
12379
|
});
|
|
12341
12380
|
}
|
|
12342
12381
|
});
|
|
12343
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
12344
|
-
init_file_system_node();
|
|
12345
|
-
init_config();
|
|
12346
|
-
|
|
12347
12382
|
// ../../packages/kk-core/src/render-md.ts
|
|
12348
12383
|
if (false) {}
|
|
12349
12384
|
// ../../packages/kk-core/src/sentences.ts
|
|
@@ -12351,9 +12386,11 @@ var CJK_TERMINATORS = new Set(["\u3002", "\uFF01", "\uFF1F"]);
|
|
|
12351
12386
|
var LATIN_TERMINATORS = new Set([".", "!", "?"]);
|
|
12352
12387
|
var ATTACHED_CLOSERS = new Set(["\u201D", "\u2019", "\u300D", "\u300F", "\uFF09", ")", '"', "'"]);
|
|
12353
12388
|
// ../../plugins/publishings/surfdash-pub/src/index.ts
|
|
12389
|
+
init_dist3();
|
|
12354
12390
|
init_dist();
|
|
12355
12391
|
|
|
12356
12392
|
// ../../plugins/publishings/surfdash-pub/src/patch.ts
|
|
12393
|
+
init_dist3();
|
|
12357
12394
|
import { basename, dirname as dirname2, sep } from "path";
|
|
12358
12395
|
var PATCH_LOCALES = ["zh", "en", "ja"];
|
|
12359
12396
|
function localeIndexPath(postPath, locale) {
|
|
@@ -12400,8 +12437,10 @@ async function patchPostFiles(request) {
|
|
|
12400
12437
|
const written = [];
|
|
12401
12438
|
const absent = [];
|
|
12402
12439
|
const images = {};
|
|
12440
|
+
const coverSkipped = [];
|
|
12403
12441
|
let changed = 0;
|
|
12404
12442
|
let uploadedFallbackCover;
|
|
12443
|
+
let uploadError;
|
|
12405
12444
|
for (const locale of PATCH_LOCALES) {
|
|
12406
12445
|
const indexMd = localeIndexPath(request.postPath, locale);
|
|
12407
12446
|
if (indexMd === undefined || !await fs.exists(indexMd)) {
|
|
@@ -12424,18 +12463,29 @@ async function patchPostFiles(request) {
|
|
|
12424
12463
|
md = upsertFrontmatterKey(md, "og_image", existingImage);
|
|
12425
12464
|
images[locale] = existingImage;
|
|
12426
12465
|
} else if (request.uploadLocalCover !== undefined && request.localCover !== "" && await fs.exists(request.localCover)) {
|
|
12427
|
-
if (uploadedFallbackCover === undefined) {
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12466
|
+
if (uploadedFallbackCover === undefined && uploadError === undefined) {
|
|
12467
|
+
let uploaded;
|
|
12468
|
+
try {
|
|
12469
|
+
uploaded = await request.uploadLocalCover(request.localCover);
|
|
12470
|
+
} catch (error) {
|
|
12471
|
+
uploadError = error instanceof Error ? error.message : String(error);
|
|
12472
|
+
}
|
|
12473
|
+
if (uploaded !== undefined) {
|
|
12474
|
+
if (!/^https:\/\//.test(uploaded)) {
|
|
12475
|
+
throw new Error(`uploaded cover must be an absolute https:// URL, got: ${uploaded}`);
|
|
12476
|
+
}
|
|
12477
|
+
uploadedFallbackCover = uploaded;
|
|
12431
12478
|
}
|
|
12432
|
-
uploadedFallbackCover = uploaded;
|
|
12433
12479
|
}
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12480
|
+
if (uploadedFallbackCover === undefined) {
|
|
12481
|
+
coverSkipped.push(locale);
|
|
12482
|
+
} else {
|
|
12483
|
+
md = upsertFrontmatterKey(md, "image", uploadedFallbackCover);
|
|
12484
|
+
md = upsertFrontmatterKey(md, "og_image", uploadedFallbackCover);
|
|
12485
|
+
images[locale] = uploadedFallbackCover;
|
|
12486
|
+
}
|
|
12437
12487
|
} else {
|
|
12438
|
-
|
|
12488
|
+
coverSkipped.push(locale);
|
|
12439
12489
|
}
|
|
12440
12490
|
if (locale === "zh" && (request.episodeTitle ?? "") !== "") {
|
|
12441
12491
|
md = upsertFrontmatterKey(md, "episode_title", request.episodeTitle);
|
|
@@ -12461,7 +12511,22 @@ ${link}
|
|
|
12461
12511
|
changed += 1;
|
|
12462
12512
|
}
|
|
12463
12513
|
}
|
|
12464
|
-
|
|
12514
|
+
const applied = PATCH_LOCALES.filter((locale) => images[locale] !== undefined);
|
|
12515
|
+
return {
|
|
12516
|
+
written,
|
|
12517
|
+
changed,
|
|
12518
|
+
absent,
|
|
12519
|
+
images,
|
|
12520
|
+
slug: basename(dirname2(request.postPath)),
|
|
12521
|
+
coverPatch: {
|
|
12522
|
+
status: coverSkipped.length === 0 ? "applied" : "skipped",
|
|
12523
|
+
applied,
|
|
12524
|
+
skipped: coverSkipped,
|
|
12525
|
+
reason: coverSkipped.length === 0 ? "" : `${coverSkipped.join("/")} post has no remote https:// cover: coverUrl is empty, the frontmatter has no https:// image key and no local cover was uploadable${uploadError === undefined ? "" : ` (local cover upload failed: ${uploadError})`}`,
|
|
12526
|
+
...uploadError === undefined ? {} : { uploadError },
|
|
12527
|
+
pageUrl: request.pageUrl ?? ""
|
|
12528
|
+
}
|
|
12529
|
+
};
|
|
12465
12530
|
}
|
|
12466
12531
|
|
|
12467
12532
|
// ../../plugins/publishings/surfdash-pub/src/digest-check.ts
|
|
@@ -12767,6 +12832,7 @@ async function uploadCoverToMicrofeed(filePath, options = {}) {
|
|
|
12767
12832
|
}
|
|
12768
12833
|
|
|
12769
12834
|
// ../../plugins/publishings/surfdash-pub/src/topic-claims.ts
|
|
12835
|
+
init_dist3();
|
|
12770
12836
|
import { dirname as dirname3 } from "path";
|
|
12771
12837
|
var escapeRe2 = (token) => token.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12772
12838
|
var titleSepFor = (locale) => locale === "en" ? ": " : "\uFF1A";
|
|
@@ -13545,6 +13611,7 @@ async function patchPost(options) {
|
|
|
13545
13611
|
localCover: strOption(options, "localCover"),
|
|
13546
13612
|
dateIso: strOption(options, "dateIso"),
|
|
13547
13613
|
episodeTitle: strOption(options, "episodeTitle"),
|
|
13614
|
+
pageUrl: strOption(options, "pageUrl"),
|
|
13548
13615
|
uploadLocalCover: uploadCoverToMicrofeed
|
|
13549
13616
|
});
|
|
13550
13617
|
} catch (error) {
|
|
@@ -13552,6 +13619,9 @@ async function patchPost(options) {
|
|
|
13552
13619
|
}
|
|
13553
13620
|
if (outcome.changed === 0)
|
|
13554
13621
|
echoError(`patch: no post bytes changed for ${outcome.slug}`);
|
|
13622
|
+
if (outcome.coverPatch.status === "skipped") {
|
|
13623
|
+
echoError(`patch: cover patch skipped for ${outcome.slug} \u2014 ${outcome.coverPatch.reason} (page ${outcome.coverPatch.pageUrl === "" ? "unknown" : outcome.coverPatch.pageUrl})`);
|
|
13624
|
+
}
|
|
13555
13625
|
const synced = await syncPost({ postPath: postPath.postPath });
|
|
13556
13626
|
const commitPaths = new Set(outcome.written.map((path) => relative(surfdashRoot, path)));
|
|
13557
13627
|
if (process.env.SURFDASH_AUTO_PUSH !== "0") {
|
|
@@ -13571,7 +13641,8 @@ async function patchPost(options) {
|
|
|
13571
13641
|
locales: Object.keys(outcome.images),
|
|
13572
13642
|
absentLocales: outcome.absent,
|
|
13573
13643
|
cmsResync: synced.ok ? "ok" : "failed",
|
|
13574
|
-
gitCommit: commit.hash
|
|
13644
|
+
gitCommit: commit.hash,
|
|
13645
|
+
coverPatch: outcome.coverPatch
|
|
13575
13646
|
};
|
|
13576
13647
|
if (!synced.ok) {
|
|
13577
13648
|
return ResultSchema.parse({
|
|
@@ -13584,7 +13655,7 @@ async function patchPost(options) {
|
|
|
13584
13655
|
return ResultSchema.parse({
|
|
13585
13656
|
ok: true,
|
|
13586
13657
|
target: TARGET,
|
|
13587
|
-
message: `patched ${outcome.changed} post(s) for ${outcome.slug}`,
|
|
13658
|
+
message: outcome.coverPatch.status === "skipped" ? `patched ${outcome.changed} post(s) for ${outcome.slug}; cover patch skipped \u2014 ${outcome.coverPatch.reason}` : `patched ${outcome.changed} post(s) for ${outcome.slug}`,
|
|
13588
13659
|
metadata
|
|
13589
13660
|
});
|
|
13590
13661
|
}
|
|
@@ -13858,7 +13929,8 @@ async function preparePost(payload) {
|
|
|
13858
13929
|
filePath,
|
|
13859
13930
|
relPostDir: join("content", "posts", "articles", locale, slug),
|
|
13860
13931
|
relPostDirs: mintedDirs,
|
|
13861
|
-
articleUrl
|
|
13932
|
+
articleUrl,
|
|
13933
|
+
...coverUrl !== undefined ? { coverUrl } : {}
|
|
13862
13934
|
}
|
|
13863
13935
|
};
|
|
13864
13936
|
}
|
|
@@ -13874,13 +13946,15 @@ async function preparePostResult(payload) {
|
|
|
13874
13946
|
postPath: outcome.prepared.filePath,
|
|
13875
13947
|
articleUrl: outcome.prepared.articleUrl,
|
|
13876
13948
|
dateStamp: outcome.prepared.dateStamp,
|
|
13877
|
-
slug: outcome.prepared.slug
|
|
13949
|
+
slug: outcome.prepared.slug,
|
|
13950
|
+
...outcome.prepared.coverUrl !== undefined ? { coverUrl: outcome.prepared.coverUrl } : {}
|
|
13878
13951
|
}
|
|
13879
13952
|
});
|
|
13880
13953
|
}
|
|
13881
13954
|
async function publishPreparedFile(prepared, identity) {
|
|
13882
13955
|
const postsurfingBin = process.env.POSTSURFING_BIN ?? "postsurfing";
|
|
13883
|
-
const { surfdashRoot, locale, dateStamp, filePath, relPostDir, relPostDirs, articleUrl } = prepared;
|
|
13956
|
+
const { surfdashRoot, locale, dateStamp, filePath, relPostDir, relPostDirs, articleUrl, coverUrl } = prepared;
|
|
13957
|
+
const coverMetadata = coverUrl === undefined ? {} : { coverUrl };
|
|
13884
13958
|
const identityMetadata = identity ? {
|
|
13885
13959
|
runDate: identity.runDate,
|
|
13886
13960
|
localeFingerprint: identity.fingerprint,
|
|
@@ -13915,6 +13989,7 @@ async function publishPreparedFile(prepared, identity) {
|
|
|
13915
13989
|
metadata: {
|
|
13916
13990
|
postPath: filePath,
|
|
13917
13991
|
...identityMetadata,
|
|
13992
|
+
...coverMetadata,
|
|
13918
13993
|
refinedTitle: refined?.title,
|
|
13919
13994
|
refinedCanonical: refined?.canonical
|
|
13920
13995
|
}
|
|
@@ -13938,6 +14013,7 @@ async function publishPreparedFile(prepared, identity) {
|
|
|
13938
14013
|
metadata: {
|
|
13939
14014
|
postPath: filePath,
|
|
13940
14015
|
...identityMetadata,
|
|
14016
|
+
...coverMetadata,
|
|
13941
14017
|
gitCommit: pushed.hash,
|
|
13942
14018
|
live,
|
|
13943
14019
|
refinedTitle: refined?.title
|
|
@@ -85,6 +85,8 @@ interface SurfdashPubOptions {
|
|
|
85
85
|
dateIso?: unknown;
|
|
86
86
|
/** `patch`: the episode's frozen identity title (0385 R4); the zh post's `episode_title`. */
|
|
87
87
|
episodeTitle?: unknown;
|
|
88
|
+
/** `patch`: the live page URL, named in the cover-skip warning (0432 R2). */
|
|
89
|
+
pageUrl?: unknown;
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
/**
|
|
@@ -1010,10 +1012,10 @@ async function syncPost(options: SurfdashPubOptions): Promise<Result> {
|
|
|
1010
1012
|
}
|
|
1011
1013
|
}
|
|
1012
1014
|
|
|
1013
|
-
/** `options.<key>` when it is a string, trimmed; else ''. `patch`'s
|
|
1015
|
+
/** `options.<key>` when it is a string, trimmed; else ''. `patch`'s optional fields read this way. */
|
|
1014
1016
|
function strOption(
|
|
1015
1017
|
options: SurfdashPubOptions,
|
|
1016
|
-
key: 'coverUrl' | 'showNotesUrl' | 'localCover' | 'dateIso' | 'episodeTitle',
|
|
1018
|
+
key: 'coverUrl' | 'showNotesUrl' | 'localCover' | 'dateIso' | 'episodeTitle' | 'pageUrl',
|
|
1017
1019
|
): string {
|
|
1018
1020
|
const raw = options[key];
|
|
1019
1021
|
return typeof raw === 'string' ? raw.trim() : '';
|
|
@@ -1050,12 +1052,20 @@ async function patchPost(options: SurfdashPubOptions): Promise<Result> {
|
|
|
1050
1052
|
localCover: strOption(options, 'localCover'),
|
|
1051
1053
|
dateIso: strOption(options, 'dateIso'),
|
|
1052
1054
|
episodeTitle: strOption(options, 'episodeTitle'),
|
|
1055
|
+
pageUrl: strOption(options, 'pageUrl'),
|
|
1053
1056
|
uploadLocalCover: uploadCoverToMicrofeed,
|
|
1054
1057
|
});
|
|
1055
1058
|
} catch (error: unknown) {
|
|
1056
1059
|
return fail(`patch error: ${error instanceof Error ? error.message : String(error)}`);
|
|
1057
1060
|
}
|
|
1058
1061
|
if (outcome.changed === 0) echoError(`patch: no post bytes changed for ${outcome.slug}`);
|
|
1062
|
+
if (outcome.coverPatch.status === 'skipped') {
|
|
1063
|
+
// 0432 R2: a live page whose cover could not be sourced is a warning with its URL, never a
|
|
1064
|
+
// failed target — the CMS row still serves the og:image this patch wanted to write.
|
|
1065
|
+
echoError(
|
|
1066
|
+
`patch: cover patch skipped for ${outcome.slug} — ${outcome.coverPatch.reason} (page ${outcome.coverPatch.pageUrl === '' ? 'unknown' : outcome.coverPatch.pageUrl})`,
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1059
1069
|
const synced = await syncPost({ postPath: postPath.postPath });
|
|
1060
1070
|
const commitPaths = new Set(outcome.written.map((path) => relative(surfdashRoot, path)));
|
|
1061
1071
|
if (process.env.SURFDASH_AUTO_PUSH !== '0') {
|
|
@@ -1078,6 +1088,7 @@ async function patchPost(options: SurfdashPubOptions): Promise<Result> {
|
|
|
1078
1088
|
absentLocales: outcome.absent,
|
|
1079
1089
|
cmsResync: synced.ok ? 'ok' : 'failed',
|
|
1080
1090
|
gitCommit: commit.hash,
|
|
1091
|
+
coverPatch: outcome.coverPatch,
|
|
1081
1092
|
};
|
|
1082
1093
|
if (!synced.ok) {
|
|
1083
1094
|
// The posts are patched and committed; only the CMS rows keep the unservable cover. Reported
|
|
@@ -1093,7 +1104,10 @@ async function patchPost(options: SurfdashPubOptions): Promise<Result> {
|
|
|
1093
1104
|
return ResultSchema.parse({
|
|
1094
1105
|
ok: true,
|
|
1095
1106
|
target: TARGET,
|
|
1096
|
-
message:
|
|
1107
|
+
message:
|
|
1108
|
+
outcome.coverPatch.status === 'skipped'
|
|
1109
|
+
? `patched ${outcome.changed} post(s) for ${outcome.slug}; cover patch skipped — ${outcome.coverPatch.reason}`
|
|
1110
|
+
: `patched ${outcome.changed} post(s) for ${outcome.slug}`,
|
|
1097
1111
|
metadata,
|
|
1098
1112
|
});
|
|
1099
1113
|
}
|
|
@@ -1108,6 +1122,12 @@ interface PreparedPost {
|
|
|
1108
1122
|
/** Prepared daily publishes carry all translated sibling directories into the deploy commit. */
|
|
1109
1123
|
relPostDirs?: string[];
|
|
1110
1124
|
articleUrl: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* The `https://` cover this prepare uploaded for the post (0432 R1). Reported in the publish
|
|
1127
|
+
* result so the post-publish patch can heal `image`/`og_image` from the SURFDASH side when the
|
|
1128
|
+
* podcast row never ran — that row used to be the run's only known cover source.
|
|
1129
|
+
*/
|
|
1130
|
+
coverUrl?: string;
|
|
1111
1131
|
}
|
|
1112
1132
|
|
|
1113
1133
|
interface PreparedLocaleIdentity {
|
|
@@ -1484,6 +1504,7 @@ async function preparePost(payload: PublishTransportPayload): Promise<PrepareOut
|
|
|
1484
1504
|
relPostDir: join('content', 'posts', 'articles', locale, slug),
|
|
1485
1505
|
relPostDirs: mintedDirs,
|
|
1486
1506
|
articleUrl,
|
|
1507
|
+
...(coverUrl !== undefined ? { coverUrl } : {}),
|
|
1487
1508
|
},
|
|
1488
1509
|
};
|
|
1489
1510
|
}
|
|
@@ -1501,6 +1522,7 @@ async function preparePostResult(payload: PublishTransportPayload): Promise<Resu
|
|
|
1501
1522
|
articleUrl: outcome.prepared.articleUrl,
|
|
1502
1523
|
dateStamp: outcome.prepared.dateStamp,
|
|
1503
1524
|
slug: outcome.prepared.slug,
|
|
1525
|
+
...(outcome.prepared.coverUrl !== undefined ? { coverUrl: outcome.prepared.coverUrl } : {}),
|
|
1504
1526
|
},
|
|
1505
1527
|
});
|
|
1506
1528
|
}
|
|
@@ -1511,7 +1533,10 @@ async function publishPreparedFile(
|
|
|
1511
1533
|
identity?: Pick<PreparedLocaleIdentity, 'runDate' | 'fingerprint'> & { postSha256?: string },
|
|
1512
1534
|
): Promise<Result> {
|
|
1513
1535
|
const postsurfingBin = process.env.POSTSURFING_BIN ?? 'postsurfing';
|
|
1514
|
-
const { surfdashRoot, locale, dateStamp, filePath, relPostDir, relPostDirs, articleUrl } = prepared;
|
|
1536
|
+
const { surfdashRoot, locale, dateStamp, filePath, relPostDir, relPostDirs, articleUrl, coverUrl } = prepared;
|
|
1537
|
+
// 0432 R1: the cover this publish hosted is what the patch heals from when the podcast row is
|
|
1538
|
+
// held, so it travels with the receipt instead of being re-derived (and lost) downstream.
|
|
1539
|
+
const coverMetadata = coverUrl === undefined ? {} : { coverUrl };
|
|
1515
1540
|
const identityMetadata = identity
|
|
1516
1541
|
? {
|
|
1517
1542
|
runDate: identity.runDate,
|
|
@@ -1571,6 +1596,7 @@ async function publishPreparedFile(
|
|
|
1571
1596
|
metadata: {
|
|
1572
1597
|
postPath: filePath,
|
|
1573
1598
|
...identityMetadata,
|
|
1599
|
+
...coverMetadata,
|
|
1574
1600
|
refinedTitle: refined?.title,
|
|
1575
1601
|
refinedCanonical: refined?.canonical,
|
|
1576
1602
|
},
|
|
@@ -1601,6 +1627,7 @@ async function publishPreparedFile(
|
|
|
1601
1627
|
metadata: {
|
|
1602
1628
|
postPath: filePath,
|
|
1603
1629
|
...identityMetadata,
|
|
1630
|
+
...coverMetadata,
|
|
1604
1631
|
gitCommit: pushed.hash,
|
|
1605
1632
|
live,
|
|
1606
1633
|
refinedTitle: refined?.title,
|