@gobing-ai/knowledge-kit 0.1.17 → 0.1.20
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/daily-voice/index.js +40 -7
- package/dist/index.js +8428 -4448
- package/package.json +1 -1
- 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/kk/config.example.yaml +7 -2
- package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/chinese-article.json +8 -2
- package/plugins/kk/publish-presets/daily-ai-voice-migration.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice.json +57 -16
- package/plugins/kk/publish-presets/itc-main.json +36 -9
- package/plugins/kk/publish-presets/technical-article.json +8 -2
- package/plugins/kk/schedules/kk-daily-ai-voice3.cron.tmpl +8 -9
- package/plugins/kk/schedules/kk-daily-publish3-cn-peak.cron.tmpl +13 -19
- package/plugins/kk/schedules/kk-daily-publish3-overseas.cron.tmpl +11 -9
- package/plugins/kk/scripts/daily-stages.ts +238 -14
- package/plugins/kk/scripts/daily-triage-core.ts +43 -25
- package/plugins/kk/scripts/daily-triage.ts +1 -1
- 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/publish/SKILL.md +15 -2
- package/plugins/kk/skills/web-automation/SKILL.md +31 -1
- package/plugins/kk/workflows/kk-article-generate.yaml +485 -0
- package/plugins/kk/workflows/kk-collect.yaml +8 -4
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +2 -1
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -2
- package/plugins/kk/workflows/kk-daily-safety.yaml +5 -7
- package/plugins/kk/workflows/kk-news-generate.yaml +410 -0
- package/plugins/kk/workflows/kk-publish.yaml +236 -0
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +49 -10
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/csdn-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/infoq-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/jike-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/juejin-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/linkedin-pub/dist/index.js +43 -6
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +92 -15
- package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
- package/plugins/publishings/shipinhao-pub/dist/index.js +391 -32
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +52 -11
- package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
- package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +393 -0
- package/plugins/publishings/shipinhao-pub/src/flow.ts +243 -14
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
- package/plugins/publishings/sspai-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/substack-pub/dist/profile-check.js +60 -10
- package/plugins/publishings/surfdash-pub/dist/index.js +50 -8
- package/plugins/publishings/surfdash-pub/src/index.ts +59 -8
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +34 -3
- package/plugins/publishings/threads-pub/dist/index.js +9196 -296
- package/plugins/publishings/threads-pub/dist/profile-check.js +21139 -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 +454 -81
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +401 -102
- package/plugins/publishings/wechatmp-pub/src/flow.ts +42 -4
- package/plugins/publishings/wechatmp-pub/src/index.ts +142 -102
- package/plugins/publishings/wechatmp-pub/src/profile-check.ts +36 -58
- package/plugins/publishings/weibo-pub/dist/index.js +136 -22
- package/plugins/publishings/weibo-pub/dist/profile-check.js +61 -11
- package/plugins/publishings/weibo-pub/src/index.ts +208 -22
- package/plugins/publishings/x-pub/dist/index.js +263 -43
- package/plugins/publishings/x-pub/dist/profile-check.js +63 -11
- 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 +193 -201
- package/plugins/publishings/xhs-pub/dist/profile-check.js +380 -85
- package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -3
- package/plugins/publishings/xhs-pub/src/flow.ts +177 -205
- package/plugins/publishings/xhs-pub/src/index.ts +65 -59
- package/plugins/publishings/xhs-pub/src/modes.ts +1 -1
- package/plugins/publishings/xhs-pub/src/page.ts +2 -2
- package/plugins/publishings/xhs-pub/src/profile-check.ts +86 -150
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +60 -10
- package/plugins/kk/scripts/daily-scheduled-run.ts +0 -581
- package/plugins/kk/scripts/voice3-publish-window.ts +0 -206
- package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +0 -903
- package/plugins/kk/workflows/kk-daily-publish3.yaml +0 -353
- package/plugins/kk/workflows/kk-itc-author.yaml +0 -484
- package/plugins/kk/workflows/kk-itc-publish-tail.yaml +0 -112
- package/plugins/kk/workflows/kk-itc.yaml +0 -291
|
@@ -20210,6 +20210,7 @@ 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 DEFAULT_POLL_MS = 500;
|
|
20213
20214
|
function isInstantBrowserDeath(message) {
|
|
20214
20215
|
return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
|
|
20215
20216
|
}
|
|
@@ -20375,6 +20376,16 @@ async function openChannelSession(config, request, deps = {}, stdout = echo) {
|
|
|
20375
20376
|
return 1;
|
|
20376
20377
|
}
|
|
20377
20378
|
const page = context.pages()[0] ?? await context.newPage();
|
|
20379
|
+
const onOpen = config.sessionState?.onOpen;
|
|
20380
|
+
if (onOpen !== undefined) {
|
|
20381
|
+
try {
|
|
20382
|
+
await onOpen({ context, page, profileDir: request.profileDir });
|
|
20383
|
+
} catch (error) {
|
|
20384
|
+
await context.close().catch(() => {});
|
|
20385
|
+
stdout(`${config.channel} profile open failed: ${errorMessage2(error)}`);
|
|
20386
|
+
return 1;
|
|
20387
|
+
}
|
|
20388
|
+
}
|
|
20378
20389
|
try {
|
|
20379
20390
|
await page.goto(request.url, { waitUntil: "commit", timeout: DEFAULT_OPEN_NAV_TIMEOUT_MS });
|
|
20380
20391
|
} catch (error) {
|
|
@@ -20386,6 +20397,36 @@ async function openChannelSession(config, request, deps = {}, stdout = echo) {
|
|
|
20386
20397
|
stdout(`${config.channel} profile open closed: ${request.profileDir}`);
|
|
20387
20398
|
return 0;
|
|
20388
20399
|
}
|
|
20400
|
+
async function loginWithAuthenticatedPage(config, opts) {
|
|
20401
|
+
const context = await opts.launcher.launch({ profileDir: opts.profileDir, headless: false });
|
|
20402
|
+
const sessionCaptured = config.sessionState?.onAuthenticated !== undefined;
|
|
20403
|
+
let captured = false;
|
|
20404
|
+
let facts = {};
|
|
20405
|
+
try {
|
|
20406
|
+
const page = context.pages()[0] ?? await context.newPage();
|
|
20407
|
+
await page.goto(opts.url);
|
|
20408
|
+
if (!await waitUntil(() => Promise.resolve(config.isAuthenticated(page)), opts.timeoutMs)) {
|
|
20409
|
+
throw new Error(`Authentication was not confirmed within ${opts.timeoutMs}ms \u2014 the profile's site session has likely ` + "expired or the sign-in was not completed: run the login command again to sign in again.");
|
|
20410
|
+
}
|
|
20411
|
+
await config.sessionState?.onAuthenticated?.({ context, page, profileDir: opts.profileDir });
|
|
20412
|
+
captured = sessionCaptured;
|
|
20413
|
+
if (opts.captureFacts) {
|
|
20414
|
+
facts = {
|
|
20415
|
+
...await captureSessionFacts(context, config.homeUrl),
|
|
20416
|
+
...config.readIdentity === undefined ? {} : { identity: await readIdentityOrUndefined(config.readIdentity, page) }
|
|
20417
|
+
};
|
|
20418
|
+
}
|
|
20419
|
+
} finally {
|
|
20420
|
+
try {
|
|
20421
|
+
await context.close();
|
|
20422
|
+
} catch {
|
|
20423
|
+
if (captured) {
|
|
20424
|
+
echoError(`${config.channel} browser context close failed after the authenticated session capture; saved state preserved`);
|
|
20425
|
+
}
|
|
20426
|
+
}
|
|
20427
|
+
}
|
|
20428
|
+
return facts;
|
|
20429
|
+
}
|
|
20389
20430
|
async function runProfileCli(config, argv = process.argv.slice(2), deps = {}) {
|
|
20390
20431
|
const stdout = deps.stdout ?? ((line) => {
|
|
20391
20432
|
echo(line);
|
|
@@ -20436,7 +20477,8 @@ async function runProfileCli(config, argv = process.argv.slice(2), deps = {}) {
|
|
|
20436
20477
|
const launcher = deps.launcher ?? kkBrowserLauncher;
|
|
20437
20478
|
stdout(`${config.channel} profile login: a browser window is opening \u2014 sign in there; waiting up to ${Math.round(loginTimeoutMs / 1000)}s for the signed-in state`);
|
|
20438
20479
|
try {
|
|
20439
|
-
|
|
20480
|
+
const captureFacts = url !== undefined;
|
|
20481
|
+
if (!captureFacts && config.sessionState?.onAuthenticated === undefined) {
|
|
20440
20482
|
await loginWithProfile({
|
|
20441
20483
|
profileDir,
|
|
20442
20484
|
url: config.homeUrl,
|
|
@@ -20447,18 +20489,16 @@ async function runProfileCli(config, argv = process.argv.slice(2), deps = {}) {
|
|
|
20447
20489
|
stdout(`${config.channel} profile login verified: ${profileDir}`);
|
|
20448
20490
|
return 0;
|
|
20449
20491
|
}
|
|
20450
|
-
const facts = await
|
|
20492
|
+
const facts = await loginWithAuthenticatedPage(config, {
|
|
20451
20493
|
profileDir,
|
|
20452
|
-
|
|
20453
|
-
url,
|
|
20454
|
-
isAuthenticated: config.isAuthenticated,
|
|
20494
|
+
url: url ?? config.homeUrl,
|
|
20455
20495
|
timeoutMs: loginTimeoutMs,
|
|
20456
|
-
launcher
|
|
20457
|
-
|
|
20458
|
-
|
|
20459
|
-
...config.readIdentity === undefined ? {} : { identity: await readIdentityOrUndefined(config.readIdentity, page) }
|
|
20460
|
-
}));
|
|
20496
|
+
launcher,
|
|
20497
|
+
captureFacts
|
|
20498
|
+
});
|
|
20461
20499
|
stdout(`${config.channel} profile login verified: ${profileDir}`);
|
|
20500
|
+
if (url === undefined)
|
|
20501
|
+
return 0;
|
|
20462
20502
|
stdout(JSON.stringify({
|
|
20463
20503
|
status: "verified",
|
|
20464
20504
|
profileDir,
|
|
@@ -20481,6 +20521,16 @@ async function runProfileCli(config, argv = process.argv.slice(2), deps = {}) {
|
|
|
20481
20521
|
stdout(JSON.stringify(result));
|
|
20482
20522
|
return result.status === "verified" ? 0 : 1;
|
|
20483
20523
|
}
|
|
20524
|
+
async function waitUntil(predicate, timeoutMs, pollMs = DEFAULT_POLL_MS) {
|
|
20525
|
+
const deadline = Date.now() + timeoutMs;
|
|
20526
|
+
while (Date.now() < deadline) {
|
|
20527
|
+
if (await predicate()) {
|
|
20528
|
+
return true;
|
|
20529
|
+
}
|
|
20530
|
+
await new Promise((resolve) => setTimeout(resolve, pollMs));
|
|
20531
|
+
}
|
|
20532
|
+
return predicate();
|
|
20533
|
+
}
|
|
20484
20534
|
async function captureSessionFacts(context, url) {
|
|
20485
20535
|
let cookies;
|
|
20486
20536
|
try {
|