@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;
|
|
@@ -20461,85 +20541,6 @@ init_dist();
|
|
|
20461
20541
|
import { homedir as homedir4 } from "os";
|
|
20462
20542
|
import { isAbsolute, join as join4, relative, resolve as resolve4, sep } from "path";
|
|
20463
20543
|
|
|
20464
|
-
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20465
|
-
import {
|
|
20466
|
-
chmodSync,
|
|
20467
|
-
closeSync,
|
|
20468
|
-
copyFileSync,
|
|
20469
|
-
lstatSync,
|
|
20470
|
-
mkdirSync as mkdirSync2,
|
|
20471
|
-
openSync,
|
|
20472
|
-
readdirSync as readdirSync2,
|
|
20473
|
-
readlinkSync,
|
|
20474
|
-
realpathSync as realpathSync2,
|
|
20475
|
-
renameSync as renameSync2,
|
|
20476
|
-
rmdirSync,
|
|
20477
|
-
unlinkSync
|
|
20478
|
-
} from "fs";
|
|
20479
|
-
function lstat(path) {
|
|
20480
|
-
try {
|
|
20481
|
-
return lstatSync(path);
|
|
20482
|
-
} catch (error) {
|
|
20483
|
-
if (error.code === "ENOENT")
|
|
20484
|
-
return null;
|
|
20485
|
-
throw error;
|
|
20486
|
-
}
|
|
20487
|
-
}
|
|
20488
|
-
function realpath(path) {
|
|
20489
|
-
return realpathSync2(path);
|
|
20490
|
-
}
|
|
20491
|
-
function mkdirExclusive(path, mode = 448) {
|
|
20492
|
-
try {
|
|
20493
|
-
mkdirSync2(path, { mode });
|
|
20494
|
-
return true;
|
|
20495
|
-
} catch (error) {
|
|
20496
|
-
if (error.code === "EEXIST")
|
|
20497
|
-
return false;
|
|
20498
|
-
throw error;
|
|
20499
|
-
}
|
|
20500
|
-
}
|
|
20501
|
-
function rmdir(path) {
|
|
20502
|
-
try {
|
|
20503
|
-
rmdirSync(path);
|
|
20504
|
-
return true;
|
|
20505
|
-
} catch (error) {
|
|
20506
|
-
const code = error.code;
|
|
20507
|
-
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20508
|
-
return false;
|
|
20509
|
-
throw error;
|
|
20510
|
-
}
|
|
20511
|
-
}
|
|
20512
|
-
function readlink(path) {
|
|
20513
|
-
try {
|
|
20514
|
-
return readlinkSync(path);
|
|
20515
|
-
} catch {
|
|
20516
|
-
return null;
|
|
20517
|
-
}
|
|
20518
|
-
}
|
|
20519
|
-
function unlink(path) {
|
|
20520
|
-
try {
|
|
20521
|
-
unlinkSync(path);
|
|
20522
|
-
return true;
|
|
20523
|
-
} catch (error) {
|
|
20524
|
-
if (error.code === "ENOENT")
|
|
20525
|
-
return false;
|
|
20526
|
-
throw error;
|
|
20527
|
-
}
|
|
20528
|
-
}
|
|
20529
|
-
function rename(from, to) {
|
|
20530
|
-
try {
|
|
20531
|
-
renameSync2(from, to);
|
|
20532
|
-
return true;
|
|
20533
|
-
} catch (error) {
|
|
20534
|
-
if (error.code === "ENOENT")
|
|
20535
|
-
return false;
|
|
20536
|
-
throw error;
|
|
20537
|
-
}
|
|
20538
|
-
}
|
|
20539
|
-
function chmod(path, mode) {
|
|
20540
|
-
chmodSync(path, mode);
|
|
20541
|
-
}
|
|
20542
|
-
|
|
20543
20544
|
// ../../packages/publish-harness/src/bot-transaction.ts
|
|
20544
20545
|
import { homedir as homedir2 } from "os";
|
|
20545
20546
|
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
@@ -20564,7 +20565,12 @@ async function acquireProfileLease(profileDir, options = {}) {
|
|
|
20564
20565
|
const leaseDir = join3(leaseRoot, id);
|
|
20565
20566
|
await fileSystem.ensureDir(leaseRoot);
|
|
20566
20567
|
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20567
|
-
|
|
20568
|
+
if (!await reclaimDeadOwnerLease(fileSystem, leaseDir)) {
|
|
20569
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20570
|
+
}
|
|
20571
|
+
if (!mkdirExclusive(leaseDir, 448)) {
|
|
20572
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
20573
|
+
}
|
|
20568
20574
|
}
|
|
20569
20575
|
const token = randomBytes(16).toString("hex");
|
|
20570
20576
|
const owner = {
|
|
@@ -20680,9 +20686,35 @@ async function busyGuidance(fileSystem, leaseDir) {
|
|
|
20680
20686
|
}
|
|
20681
20687
|
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`;
|
|
20682
20688
|
}
|
|
20683
|
-
const
|
|
20689
|
+
const live = isProcessAlive(owner.pid) ? [] : await liveChildHolders(fileSystem, leaseDir);
|
|
20690
|
+
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}`;
|
|
20684
20691
|
return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
|
|
20685
20692
|
}
|
|
20693
|
+
async function reclaimDeadOwnerLease(fileSystem, leaseDir) {
|
|
20694
|
+
const owner = await readOwner(fileSystem, leaseDir);
|
|
20695
|
+
if (owner === null || isProcessAlive(owner.pid))
|
|
20696
|
+
return false;
|
|
20697
|
+
if ((await liveChildHolders(fileSystem, leaseDir)).length > 0)
|
|
20698
|
+
return false;
|
|
20699
|
+
const target = staleLeaseDir(leaseDir);
|
|
20700
|
+
try {
|
|
20701
|
+
rename(leaseDir, target);
|
|
20702
|
+
} catch {
|
|
20703
|
+
return false;
|
|
20704
|
+
}
|
|
20705
|
+
const moved = await readOwner(fileSystem, target);
|
|
20706
|
+
if (moved !== null && moved.token !== owner.token) {
|
|
20707
|
+
try {
|
|
20708
|
+
rename(target, leaseDir);
|
|
20709
|
+
} catch {}
|
|
20710
|
+
return false;
|
|
20711
|
+
}
|
|
20712
|
+
return true;
|
|
20713
|
+
}
|
|
20714
|
+
function staleLeaseDir(leaseDir) {
|
|
20715
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "").slice(0, 15);
|
|
20716
|
+
return `${leaseDir}.stale-${stamp}-${process.pid}-${randomBytes(3).toString("hex")}`;
|
|
20717
|
+
}
|
|
20686
20718
|
async function holderResidue(fileSystem, leaseDir) {
|
|
20687
20719
|
try {
|
|
20688
20720
|
const entries = await fileSystem.readDir(leaseDir);
|
|
@@ -20808,7 +20840,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20808
20840
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20809
20841
|
if (lstat(syncData) === null)
|
|
20810
20842
|
return false;
|
|
20811
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20843
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20812
20844
|
}
|
|
20813
20845
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20814
20846
|
return {
|
|
@@ -19947,7 +19947,12 @@ async function acquireProfileLease(profileDir, options = {}) {
|
|
|
19947
19947
|
const leaseDir = join2(leaseRoot, id);
|
|
19948
19948
|
await fileSystem.ensureDir(leaseRoot);
|
|
19949
19949
|
if (!mkdirExclusive(leaseDir, 448)) {
|
|
19950
|
-
|
|
19950
|
+
if (!await reclaimDeadOwnerLease(fileSystem, leaseDir)) {
|
|
19951
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
19952
|
+
}
|
|
19953
|
+
if (!mkdirExclusive(leaseDir, 448)) {
|
|
19954
|
+
throw new BotError("busy", await busyGuidance(fileSystem, leaseDir));
|
|
19955
|
+
}
|
|
19951
19956
|
}
|
|
19952
19957
|
const token = randomBytes(16).toString("hex");
|
|
19953
19958
|
const owner = {
|
|
@@ -20063,9 +20068,35 @@ async function busyGuidance(fileSystem, leaseDir) {
|
|
|
20063
20068
|
}
|
|
20064
20069
|
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`;
|
|
20065
20070
|
}
|
|
20066
|
-
const
|
|
20071
|
+
const live = isProcessAlive(owner.pid) ? [] : await liveChildHolders(fileSystem, leaseDir);
|
|
20072
|
+
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}`;
|
|
20067
20073
|
return `browser lease ${leaseDir} is held by pid ${owner.pid} (logical ${owner.logicalPath}) \u2014 ${suffix}`;
|
|
20068
20074
|
}
|
|
20075
|
+
async function reclaimDeadOwnerLease(fileSystem, leaseDir) {
|
|
20076
|
+
const owner = await readOwner(fileSystem, leaseDir);
|
|
20077
|
+
if (owner === null || isProcessAlive(owner.pid))
|
|
20078
|
+
return false;
|
|
20079
|
+
if ((await liveChildHolders(fileSystem, leaseDir)).length > 0)
|
|
20080
|
+
return false;
|
|
20081
|
+
const target = staleLeaseDir(leaseDir);
|
|
20082
|
+
try {
|
|
20083
|
+
rename(leaseDir, target);
|
|
20084
|
+
} catch {
|
|
20085
|
+
return false;
|
|
20086
|
+
}
|
|
20087
|
+
const moved = await readOwner(fileSystem, target);
|
|
20088
|
+
if (moved !== null && moved.token !== owner.token) {
|
|
20089
|
+
try {
|
|
20090
|
+
rename(target, leaseDir);
|
|
20091
|
+
} catch {}
|
|
20092
|
+
return false;
|
|
20093
|
+
}
|
|
20094
|
+
return true;
|
|
20095
|
+
}
|
|
20096
|
+
function staleLeaseDir(leaseDir) {
|
|
20097
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "").slice(0, 15);
|
|
20098
|
+
return `${leaseDir}.stale-${stamp}-${process.pid}-${randomBytes(3).toString("hex")}`;
|
|
20099
|
+
}
|
|
20069
20100
|
async function holderResidue(fileSystem, leaseDir) {
|
|
20070
20101
|
try {
|
|
20071
20102
|
const entries = await fileSystem.readDir(leaseDir);
|
|
@@ -20234,7 +20265,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20234
20265
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20235
20266
|
if (lstat(syncData) === null)
|
|
20236
20267
|
return false;
|
|
20237
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20268
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20238
20269
|
}
|
|
20239
20270
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20240
20271
|
return {
|