@gobing-ai/knowledge-kit 0.0.31 → 0.0.33
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/index.js +32320 -15021
- package/package.json +4 -4
- package/plugins/generations/content-gen/dist/index.js +10 -9
- package/plugins/generations/core-facts-gen/dist/index.js +13 -12
- package/plugins/generations/daily-article-gen/dist/index.js +14 -13
- package/plugins/generations/daily-article-gen/src/index.ts +1 -1
- package/plugins/generations/dailynews-gen/dist/index.js +10 -9
- package/plugins/generations/episode-plan-gen/dist/index.js +58 -15
- package/plugins/generations/episode-plan-gen/src/index.ts +76 -6
- package/plugins/generations/gemini-tts/README.md +11 -0
- package/plugins/generations/gemini-tts/dist/index.js +10 -9
- package/plugins/generations/image-gen/dist/index.js +154 -151
- package/plugins/generations/image-gen/src/compose/chromium.ts +60 -42
- package/plugins/generations/news-report-gen/dist/index.js +13 -12
- package/plugins/generations/voice-gen/dist/index.js +10 -9
- package/plugins/ingestions/aihot-ingest/dist/index.js +13 -12
- package/plugins/ingestions/horizon-ingest/dist/index.js +13 -12
- package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
- package/plugins/ingestions/last30days-ingest/dist/index.js +13 -12
- package/plugins/ingestions/web-search/dist/index.js +11 -10
- package/plugins/kk/README.md +38 -0
- package/plugins/kk/decisions/extract/ai-news.yaml +21 -0
- package/plugins/kk/decisions/kk-items.yaml +113 -0
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/schedules/cron.tmpl +15 -0
- package/plugins/kk/schedules/launchd.plist.tmpl +77 -0
- package/plugins/kk/scripts/daily-stages.ts +1533 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +268 -1228
- package/plugins/kk/skills/content-judge/SKILL.md +12 -2
- package/plugins/kk/skills/content-judge/references/rubrics.md +8 -2
- package/plugins/kk/skills/content-safety/SKILL.md +60 -18
- package/plugins/kk/skills/web-automation/SKILL.md +100 -0
- package/plugins/kk/skills/web-automation/references/browser-launch.md +86 -0
- package/plugins/kk/workflows/kk-collect.yaml +258 -0
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +74 -11
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +655 -0
- package/plugins/kk/workflows/kk-daily-safety.yaml +170 -0
- package/plugins/publishings/emdash-pub/dist/index.js +10 -9
- package/plugins/publishings/infoq-pub/dist/index.js +8695 -211
- package/plugins/publishings/infoq-pub/package.json +3 -1
- package/plugins/publishings/infoq-pub/plugin.json +2 -1
- package/plugins/publishings/infoq-pub/src/index.ts +358 -29
- package/plugins/publishings/infoq-pub/src/profile-check.ts +21 -0
- package/plugins/publishings/juejin-pub/dist/index.js +8746 -211
- package/plugins/publishings/juejin-pub/package.json +3 -1
- package/plugins/publishings/juejin-pub/plugin.json +2 -1
- package/plugins/publishings/juejin-pub/src/index.ts +345 -29
- package/plugins/publishings/juejin-pub/src/profile-check.ts +19 -0
- package/plugins/publishings/medium-pub/dist/index.js +10 -9
- package/plugins/publishings/podcast-pub/dist/index.js +10 -9
- package/plugins/publishings/qiita-pub/dist/index.js +10 -9
- package/plugins/publishings/substack-pub/dist/index.js +8687 -211
- package/plugins/publishings/substack-pub/package.json +3 -1
- package/plugins/publishings/substack-pub/plugin.json +2 -1
- package/plugins/publishings/substack-pub/src/index.ts +302 -29
- package/plugins/publishings/substack-pub/src/profile-check.ts +76 -0
- package/plugins/publishings/surfdash-pub/dist/index.js +10 -9
- package/plugins/publishings/wechatmp-pub/dist/index.js +1315 -352
- package/plugins/publishings/wechatmp-pub/plugin.json +1 -0
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +229 -0
- package/plugins/publishings/wechatmp-pub/src/flow.ts +896 -0
- package/plugins/publishings/wechatmp-pub/src/index.ts +223 -520
- package/plugins/publishings/wechatmp-pub/src/modes.ts +403 -0
- package/plugins/publishings/wechatmp-pub/src/page.ts +260 -0
- package/plugins/publishings/wechatmp-pub/src/profile-check.ts +84 -38
- package/plugins/publishings/x-pub/dist/index.js +8707 -223
- package/plugins/publishings/x-pub/package.json +3 -1
- package/plugins/publishings/x-pub/plugin.json +2 -1
- package/plugins/publishings/x-pub/src/index.ts +315 -23
- package/plugins/publishings/x-pub/src/profile-check.ts +19 -0
- package/plugins/publishings/xhs-pub/dist/index.js +897 -354
- package/plugins/publishings/xhs-pub/plugin.json +2 -1
- package/plugins/publishings/xhs-pub/src/flow.ts +572 -0
- package/plugins/publishings/xhs-pub/src/index.ts +108 -596
- package/plugins/publishings/xhs-pub/src/modes.ts +300 -0
- package/plugins/publishings/xhs-pub/src/page.ts +254 -0
- package/plugins/publishings/xhs-pub/src/profile-check.ts +29 -17
- package/plugins/publishings/zenn-pub/dist/index.js +10 -9
|
@@ -1,46 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WeChat MP profile-session capability (0216, ADR-032 probe contract).
|
|
3
|
+
*
|
|
4
|
+
* `login` opens the console headed and resolves once the QR scan lands on `/cgi-bin/home`, then
|
|
5
|
+
* captures the durable `storageState` file — mp.weixin.qq.com grant cookies do not survive a
|
|
6
|
+
* Chromium restart, so the saved state (not the profile cookie store) is the session artifact.
|
|
7
|
+
* `check` reopens the profile with that state re-injected and reports `verified` or `refused`
|
|
8
|
+
* as the LAST line on stdout, one JSON object — `kk plugin check` parses it. Exit codes:
|
|
9
|
+
* 0 verified, 1 refused, 2 usage error. No cookie, token or storageState value is ever printed;
|
|
10
|
+
* the profile directory is the only detail that leaves the process.
|
|
11
|
+
*/
|
|
12
|
+
import { parseArgs } from 'node:util';
|
|
13
|
+
import { resolveChannelProfileDir } from '@gobing-ai/publish-harness/browser';
|
|
14
|
+
import { echo, echoError } from '@gobing-ai/ts-utils';
|
|
15
|
+
import { CHANNEL, checkWechatSession, openWechatLogin } from './index';
|
|
5
16
|
|
|
6
|
-
const
|
|
17
|
+
const USAGE = 'usage: wechatmp profile-check [login|check] [--profile <dir>] [--timeout <ms>] [--headed]';
|
|
7
18
|
const LOGIN_TIMEOUT_MS = 180_000;
|
|
8
|
-
const LOGGED_IN_FRAGMENT = '/cgi-bin/home';
|
|
9
19
|
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
interface WechatVerdict {
|
|
21
|
+
status: 'verified' | 'refused';
|
|
22
|
+
profileDir: string;
|
|
23
|
+
detail: string;
|
|
24
|
+
}
|
|
12
25
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
export async function main(argv: string[] = process.argv.slice(2)): Promise<number> {
|
|
27
|
+
let command: string;
|
|
28
|
+
let profileDir: string;
|
|
29
|
+
let timeoutMs: number | undefined;
|
|
30
|
+
let headed = false;
|
|
31
|
+
try {
|
|
32
|
+
const { positionals, values } = parseArgs({
|
|
33
|
+
args: argv,
|
|
34
|
+
allowPositionals: true,
|
|
35
|
+
options: {
|
|
36
|
+
profile: { type: 'string' },
|
|
37
|
+
timeout: { type: 'string' },
|
|
38
|
+
headed: { type: 'boolean' },
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
command = positionals[0] ?? 'check';
|
|
42
|
+
if (command !== 'login' && command !== 'check') {
|
|
43
|
+
throw new Error(`unknown command '${command}'`);
|
|
44
|
+
}
|
|
45
|
+
headed = values.headed === true;
|
|
46
|
+
if (values.timeout !== undefined) {
|
|
47
|
+
timeoutMs = Number(values.timeout);
|
|
48
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
|
|
49
|
+
throw new Error(`--timeout must be a non-negative number of ms, got '${values.timeout}'`);
|
|
26
50
|
}
|
|
27
|
-
await page.waitForTimeout(10_000); // settle: let the console finish its post-auth Set-Cookies
|
|
28
|
-
// The Chromium profile store drops the grant cookies on restart even though they carry
|
|
29
|
-
// multi-day expiries — the durable session artifact is the captured storageState file,
|
|
30
|
-
// which the publish flow re-injects into every launch.
|
|
31
|
-
await context.storageState({ path: storageStatePath(profileDir) });
|
|
32
|
-
echo(`wechatmp login: session saved in ${storageStatePath(profileDir)}`);
|
|
33
|
-
} finally {
|
|
34
|
-
await context.close();
|
|
35
51
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
echo('
|
|
41
|
-
|
|
52
|
+
profileDir = resolveChannelProfileDir(CHANNEL, values.profile);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
55
|
+
echoError(`wechatmp profile-check: ${message} — ${USAGE}`);
|
|
56
|
+
echo(JSON.stringify({ status: 'error', detail: message }));
|
|
57
|
+
return 2;
|
|
42
58
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
|
|
60
|
+
if (command === 'login') {
|
|
61
|
+
try {
|
|
62
|
+
await openWechatLogin({ profileDir, timeoutMs: timeoutMs ?? LOGIN_TIMEOUT_MS });
|
|
63
|
+
echo(`wechatmp profile login verified: ${profileDir}`);
|
|
64
|
+
return 0;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
echoError(`wechatmp profile login failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
67
|
+
return 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let verdict: WechatVerdict;
|
|
72
|
+
try {
|
|
73
|
+
await checkWechatSession(profileDir, { headless: !headed, timeoutMs });
|
|
74
|
+
verdict = {
|
|
75
|
+
status: 'verified',
|
|
76
|
+
profileDir,
|
|
77
|
+
detail: `authenticated wechatmp console session observed ${headed ? 'via a headed pass' : 'headlessly'} via profile ${profileDir} (read-only)`,
|
|
78
|
+
};
|
|
79
|
+
} catch (error) {
|
|
80
|
+
verdict = {
|
|
81
|
+
status: 'refused',
|
|
82
|
+
profileDir,
|
|
83
|
+
detail: `wechatmp readiness refused: ${error instanceof Error ? error.message : String(error)}`,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
echo(JSON.stringify(verdict));
|
|
87
|
+
return verdict.status === 'verified' ? 0 : 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (import.meta.main) {
|
|
91
|
+
process.exit(await main());
|
|
46
92
|
}
|