@gobing-ai/knowledge-kit 0.0.34 → 0.0.36
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/README.md +1 -1
- package/dist/board/collect/index.css +42 -0
- package/dist/board/collect/index.js +787 -0
- package/dist/board/daily-voice/index.css +13 -0
- package/dist/board/daily-voice/index.js +902 -0
- package/dist/board/itc/index.css +14 -0
- package/dist/board/itc/index.js +1026 -0
- package/dist/index.js +11769 -9250
- package/package.json +10 -9
- package/plugins/generations/content-gen/dist/index.js +1015 -10814
- package/plugins/generations/content-gen/package.json +1 -1
- package/plugins/generations/core-facts-gen/dist/index.js +1002 -10801
- package/plugins/generations/core-facts-gen/package.json +1 -1
- package/plugins/generations/daily-article-gen/dist/index.js +1019 -10804
- package/plugins/generations/daily-article-gen/package.json +1 -1
- package/plugins/generations/daily-article-gen/src/index.ts +32 -3
- package/plugins/generations/dailynews-gen/dist/index.js +1094 -10892
- package/plugins/generations/dailynews-gen/package.json +1 -1
- package/plugins/generations/dailynews-gen/src/script-builder.ts +6 -1
- package/plugins/generations/episode-plan-gen/dist/index.js +1124 -10923
- package/plugins/generations/episode-plan-gen/package.json +1 -1
- package/plugins/generations/gemini-tts/dist/index.js +1108 -10906
- package/plugins/generations/gemini-tts/package.json +1 -1
- package/plugins/generations/image-gen/dist/index.js +1239 -11035
- package/plugins/generations/image-gen/package.json +1 -1
- package/plugins/generations/news-report-gen/dist/index.js +1048 -10847
- package/plugins/generations/news-report-gen/package.json +1 -1
- package/plugins/generations/omni-voice-gen/plugin.json +1 -1
- package/plugins/generations/voice-gen/dist/index.js +1066 -10864
- package/plugins/generations/voice-gen/package.json +1 -1
- package/plugins/generations/voice-gen/src/index.ts +9 -3
- package/plugins/generations/voxcpm-tts/README.md +72 -0
- package/plugins/generations/voxcpm-tts/dist/index.js +14006 -0
- package/plugins/generations/voxcpm-tts/package.json +16 -0
- package/plugins/generations/voxcpm-tts/plugin.json +6 -0
- package/plugins/generations/voxcpm-tts/profiles.json +10 -0
- package/plugins/generations/voxcpm-tts/pyproject.toml +9 -0
- package/plugins/generations/voxcpm-tts/python/worker.py +353 -0
- package/plugins/generations/voxcpm-tts/src/index.ts +42 -0
- package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +765 -0
- package/plugins/generations/voxcpm-tts/tsconfig.json +8 -0
- package/plugins/generations/voxcpm-tts/uv.lock +2571 -0
- package/plugins/ingestions/aihot-ingest/dist/index.js +1081 -10628
- package/plugins/ingestions/aihot-ingest/package.json +1 -1
- package/plugins/ingestions/horizon-ingest/dist/index.js +1013 -10812
- package/plugins/ingestions/horizon-ingest/package.json +1 -1
- package/plugins/ingestions/karakeep-local/dist/index.js +689 -10774
- package/plugins/ingestions/karakeep-local/package.json +1 -1
- package/plugins/ingestions/last30days-ingest/dist/index.js +1011 -10810
- package/plugins/ingestions/last30days-ingest/package.json +1 -1
- package/plugins/ingestions/web-search/dist/index.js +1250 -11033
- package/plugins/ingestions/web-search/package.json +1 -1
- package/plugins/kk/README.md +29 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/schedules/cron.tmpl +9 -1
- package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +79 -0
- package/plugins/kk/schedules/launchd.plist.tmpl +11 -1
- package/plugins/kk/scripts/daily-stages.ts +702 -63
- package/plugins/kk/scripts/kk-workflow-stages.ts +116 -146
- package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +2 -2
- package/plugins/kk/skills/content-safety/references/platforms/xiaoyuzhou.md +4 -2
- package/plugins/kk/skills/publish/SKILL.md +8 -4
- package/plugins/kk/workflows/feature-verification.yaml +93 -0
- package/plugins/kk/workflows/judge-gated-publish-example.yaml +1 -0
- package/plugins/kk/workflows/kk-collect.yaml +43 -11
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +36 -9
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +92 -18
- package/plugins/kk/workflows/kk-daily-safety.yaml +16 -3
- package/plugins/kk/workflows/kk-itc.yaml +8 -1
- package/plugins/kk/workflows/kk-solo-podcast.yaml +2 -0
- package/plugins/publishings/emdash-pub/dist/index.js +987 -10814
- package/plugins/publishings/emdash-pub/package.json +1 -1
- package/plugins/publishings/infoq-pub/dist/index.js +1928 -11444
- package/plugins/publishings/infoq-pub/dist/profile-check.js +20814 -0
- package/plugins/publishings/infoq-pub/package.json +1 -1
- package/plugins/publishings/infoq-pub/plugin.json +6 -2
- package/plugins/publishings/juejin-pub/dist/index.js +1940 -11456
- package/plugins/publishings/juejin-pub/dist/profile-check.js +20800 -0
- package/plugins/publishings/juejin-pub/package.json +1 -1
- package/plugins/publishings/juejin-pub/plugin.json +6 -2
- package/plugins/publishings/medium-pub/dist/index.js +978 -10805
- package/plugins/publishings/medium-pub/package.json +1 -1
- package/plugins/publishings/podcast-pub/dist/index.js +1016 -10843
- package/plugins/publishings/podcast-pub/package.json +1 -1
- package/plugins/publishings/qiita-pub/dist/index.js +976 -10803
- package/plugins/publishings/qiita-pub/package.json +1 -1
- package/plugins/publishings/substack-pub/dist/index.js +1932 -11448
- package/plugins/publishings/substack-pub/dist/profile-check.js +20890 -0
- package/plugins/publishings/substack-pub/package.json +1 -1
- package/plugins/publishings/substack-pub/plugin.json +5 -2
- package/plugins/publishings/substack-pub/src/profile-check.ts +36 -3
- package/plugins/publishings/surfdash-pub/dist/index.js +1151 -10834
- package/plugins/publishings/surfdash-pub/package.json +1 -1
- package/plugins/publishings/surfdash-pub/src/index.ts +137 -15
- package/plugins/publishings/surfdash-pub/src/patch.ts +144 -0
- package/plugins/publishings/threads-pub/dist/index.js +12394 -0
- package/plugins/publishings/threads-pub/package.json +17 -0
- package/plugins/publishings/threads-pub/plugin.json +7 -0
- package/plugins/publishings/threads-pub/src/index.ts +340 -0
- package/plugins/publishings/threads-pub/tsconfig.json +4 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +2638 -11650
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +20739 -0
- package/plugins/publishings/wechatmp-pub/package.json +1 -1
- package/plugins/publishings/wechatmp-pub/plugin.json +6 -2
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +297 -163
- package/plugins/publishings/wechatmp-pub/src/flow.ts +611 -54
- package/plugins/publishings/wechatmp-pub/src/index.ts +24 -3
- package/plugins/publishings/wechatmp-pub/src/page.ts +36 -0
- package/plugins/publishings/wechatmp-pub/src/profile-check.ts +40 -4
- package/plugins/publishings/weibo-pub/dist/index.js +21345 -0
- package/plugins/publishings/weibo-pub/dist/profile-check.js +20817 -0
- package/plugins/publishings/weibo-pub/package.json +19 -0
- package/plugins/publishings/weibo-pub/plugin.json +12 -0
- package/plugins/publishings/weibo-pub/src/index.ts +868 -0
- package/plugins/publishings/weibo-pub/src/profile-check.ts +20 -0
- package/plugins/publishings/weibo-pub/tsconfig.json +4 -0
- package/plugins/publishings/x-pub/dist/index.js +1948 -11440
- package/plugins/publishings/x-pub/dist/profile-check.js +20806 -0
- package/plugins/publishings/x-pub/package.json +1 -1
- package/plugins/publishings/x-pub/plugin.json +6 -2
- package/plugins/publishings/xhs-pub/dist/index.js +1993 -11509
- package/plugins/publishings/xhs-pub/dist/profile-check.js +21023 -0
- package/plugins/publishings/xhs-pub/package.json +1 -1
- package/plugins/publishings/xhs-pub/plugin.json +6 -2
- package/plugins/publishings/xhs-pub/src/profile-check.ts +72 -2
- package/plugins/publishings/zenn-pub/dist/index.js +988 -10815
- package/plugins/publishings/zenn-pub/package.json +1 -1
- package/plugins/generations/omni-voice-gen/dist/omni-voice-gen-prr8skpb. +0 -2
- package/plugins/generations/omni-voice-gen/dist/omni-voice-gen.js +0 -6
|
@@ -126,8 +126,29 @@ export async function openWechatLogin(opts: { profileDir: string; timeoutMs?: nu
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
/**
|
|
130
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Bot-mode open (0277): restore the durable storage state, land on the console (or `url`), and
|
|
131
|
+
* resolve once the operator closes the browser — no auth assertion, the `check` verb owns that.
|
|
132
|
+
*/
|
|
133
|
+
export async function openWechatSession(
|
|
134
|
+
profileDir: string,
|
|
135
|
+
opts: { headless?: boolean; url?: string } = {},
|
|
136
|
+
): Promise<void> {
|
|
137
|
+
const { context } = await openWithState(profileDir, opts.headless ?? false, opts.url ?? CONSOLE_URL);
|
|
138
|
+
// Structural cast (this plugin's tsconfig resolves a playwright build whose context event map
|
|
139
|
+
// omits 'close'); the runtime context always emits it.
|
|
140
|
+
const closable = context as unknown as { once(event: 'close', listener: () => void): unknown };
|
|
141
|
+
await new Promise<void>((resolveClose) => {
|
|
142
|
+
closable.once('close', resolveClose);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Launch, inject the saved login cookies, and land on the console (or `url`). Caller owns closing the context. */
|
|
147
|
+
async function openWithState(
|
|
148
|
+
profileDir: string,
|
|
149
|
+
headless: boolean,
|
|
150
|
+
url: string = CONSOLE_URL,
|
|
151
|
+
): Promise<{ page: Page; context: BrowserContext }> {
|
|
131
152
|
const context = await openPersistentBrowser({ profileDir, headless, launcher: kkBrowserLauncher });
|
|
132
153
|
try {
|
|
133
154
|
const stateFile = storageStatePath(profileDir);
|
|
@@ -164,7 +185,7 @@ async function openWithState(profileDir: string, headless: boolean): Promise<{ p
|
|
|
164
185
|
)
|
|
165
186
|
.catch(() => undefined);
|
|
166
187
|
}
|
|
167
|
-
await page.goto(
|
|
188
|
+
await page.goto(url);
|
|
168
189
|
return { page, context };
|
|
169
190
|
} catch (error: unknown) {
|
|
170
191
|
await context.close();
|
|
@@ -68,6 +68,22 @@ export interface OpenedConsole {
|
|
|
68
68
|
|
|
69
69
|
export type OpenConsole = (profileDir: string) => Promise<OpenedConsole>;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Modal state measured from the live DOM. A throwing or non-boolean probe is `unknown` — never
|
|
73
|
+
* `closed` (task 0260 R3: an unreadable overlay must not be treated as cleaned up, or a later step
|
|
74
|
+
* clicks through a footer it cannot see).
|
|
75
|
+
*/
|
|
76
|
+
export async function modalState(page: WechatPage): Promise<'closed' | 'open' | 'unknown'> {
|
|
77
|
+
try {
|
|
78
|
+
const raw = await page.evaluate(
|
|
79
|
+
`[...document.querySelectorAll('.weui-desktop-dialog__wrp, .weui-desktop-dialog')].some((d) => d.offsetWidth)`,
|
|
80
|
+
);
|
|
81
|
+
return raw === true ? 'open' : raw === false ? 'closed' : 'unknown';
|
|
82
|
+
} catch {
|
|
83
|
+
return 'unknown';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
/** A selector with an ATTACHED match (hidden inputs included), or `undefined` at the deadline. */
|
|
72
88
|
async function tryFindAttachedSelector(
|
|
73
89
|
page: WechatPage,
|
|
@@ -258,3 +274,23 @@ export function wrapPlaywrightContext(raw: unknown, entryPage: unknown): OpenedC
|
|
|
258
274
|
close: () => context.close(),
|
|
259
275
|
};
|
|
260
276
|
}
|
|
277
|
+
|
|
278
|
+
/** Polls a selector list for visibility; optionally returns `undefined` instead of throwing. */
|
|
279
|
+
export async function waitForVisible(
|
|
280
|
+
page: WechatPage,
|
|
281
|
+
selector: string,
|
|
282
|
+
timeoutMs: number,
|
|
283
|
+
opts: { required?: boolean } = {},
|
|
284
|
+
): Promise<string | undefined> {
|
|
285
|
+
const visible = await waitUntil(
|
|
286
|
+
async () => {
|
|
287
|
+
const found = await trySelectors(page, [selector]).catch(() => ({ found: false, selector: null }));
|
|
288
|
+
return found.found;
|
|
289
|
+
},
|
|
290
|
+
timeoutMs,
|
|
291
|
+
POLL_MS,
|
|
292
|
+
);
|
|
293
|
+
if (visible) return selector;
|
|
294
|
+
if (opts.required === false) return undefined;
|
|
295
|
+
throw new Error(`${selector}: not visible within ${timeoutMs}ms`);
|
|
296
|
+
}
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* captures the durable `storageState` file — mp.weixin.qq.com grant cookies do not survive a
|
|
6
6
|
* Chromium restart, so the saved state (not the profile cookie store) is the session artifact.
|
|
7
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.
|
|
8
|
+
* as the LAST line on stdout, one JSON object — `kk plugin check` parses it. In bot mode (the
|
|
9
|
+
* `kk bot login` parent supplies `--url`) `login` emits the same shape plus the plugin-owned
|
|
10
|
+
* canonical `defaultUrl`, which is the only thing the parent persists. Exit codes:
|
|
9
11
|
* 0 verified, 1 refused, 2 usage error. No cookie, token or storageState value is ever printed;
|
|
10
12
|
* the profile directory is the only detail that leaves the process.
|
|
11
13
|
*/
|
|
12
14
|
import { parseArgs } from 'node:util';
|
|
13
15
|
import { resolveChannelProfileDir } from '@gobing-ai/publish-harness/browser';
|
|
14
16
|
import { echo, echoError } from '@gobing-ai/ts-utils';
|
|
15
|
-
import { CHANNEL, checkWechatSession, openWechatLogin } from './index';
|
|
17
|
+
import { CHANNEL, CONSOLE_URL, checkWechatSession, openWechatLogin, openWechatSession } from './index';
|
|
16
18
|
|
|
17
|
-
const USAGE =
|
|
19
|
+
const USAGE =
|
|
20
|
+
'usage: wechatmp profile-check [login|check|open] [--profile <dir>] [--url <url>] [--timeout <ms>] [--headed]';
|
|
18
21
|
const LOGIN_TIMEOUT_MS = 180_000;
|
|
19
22
|
|
|
20
23
|
interface WechatVerdict {
|
|
@@ -28,6 +31,7 @@ export async function main(argv: string[] = process.argv.slice(2)): Promise<numb
|
|
|
28
31
|
let profileDir: string;
|
|
29
32
|
let timeoutMs: number | undefined;
|
|
30
33
|
let headed = false;
|
|
34
|
+
let sessionUrl: string | undefined;
|
|
31
35
|
try {
|
|
32
36
|
const { positionals, values } = parseArgs({
|
|
33
37
|
args: argv,
|
|
@@ -36,12 +40,17 @@ export async function main(argv: string[] = process.argv.slice(2)): Promise<numb
|
|
|
36
40
|
profile: { type: 'string' },
|
|
37
41
|
timeout: { type: 'string' },
|
|
38
42
|
headed: { type: 'boolean' },
|
|
43
|
+
url: { type: 'string' },
|
|
39
44
|
},
|
|
40
45
|
});
|
|
41
46
|
command = positionals[0] ?? 'check';
|
|
42
|
-
if (command !== 'login' && command !== 'check') {
|
|
47
|
+
if (command !== 'login' && command !== 'check' && command !== 'open') {
|
|
43
48
|
throw new Error(`unknown command '${command}'`);
|
|
44
49
|
}
|
|
50
|
+
if (command === 'open' && (values.profile === undefined || values.url === undefined)) {
|
|
51
|
+
throw new Error('open requires an explicit --profile <dir> and --url <url>');
|
|
52
|
+
}
|
|
53
|
+
sessionUrl = values.url;
|
|
45
54
|
headed = values.headed === true;
|
|
46
55
|
if (values.timeout !== undefined) {
|
|
47
56
|
timeoutMs = Number(values.timeout);
|
|
@@ -61,6 +70,12 @@ export async function main(argv: string[] = process.argv.slice(2)): Promise<numb
|
|
|
61
70
|
try {
|
|
62
71
|
await openWechatLogin({ profileDir, timeoutMs: timeoutMs ?? LOGIN_TIMEOUT_MS });
|
|
63
72
|
echo(`wechatmp profile login verified: ${profileDir}`);
|
|
73
|
+
// Bot mode (`kk bot login` supplies --url): the parent persists a default URL only from
|
|
74
|
+
// this LAST-line verdict, and only the plugin-owned console home is canonical — never the
|
|
75
|
+
// operator's URL. Without --url the operator-mode output stands unchanged.
|
|
76
|
+
if (sessionUrl !== undefined) {
|
|
77
|
+
echo(JSON.stringify({ status: 'verified', profileDir, defaultUrl: CONSOLE_URL }));
|
|
78
|
+
}
|
|
64
79
|
return 0;
|
|
65
80
|
} catch (error) {
|
|
66
81
|
echoError(`wechatmp profile login failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -68,6 +83,27 @@ export async function main(argv: string[] = process.argv.slice(2)): Promise<numb
|
|
|
68
83
|
}
|
|
69
84
|
}
|
|
70
85
|
|
|
86
|
+
if (command === 'open') {
|
|
87
|
+
// Bot-mode open (0277): restore the durable state and wait for the operator to close the
|
|
88
|
+
// browser — no readiness assertion. A missing state file refuses (nothing is fabricated).
|
|
89
|
+
try {
|
|
90
|
+
await openWechatSession(profileDir, { url: sessionUrl });
|
|
91
|
+
echo(
|
|
92
|
+
JSON.stringify({
|
|
93
|
+
status: 'verified',
|
|
94
|
+
profileDir,
|
|
95
|
+
detail: `wechatmp profile session closed by the operator: ${profileDir}`,
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
return 0;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
const detail = `wechatmp profile open refused: ${error instanceof Error ? error.message : String(error)}`;
|
|
101
|
+
echoError(detail);
|
|
102
|
+
echo(JSON.stringify({ status: 'refused', profileDir, detail }));
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
71
107
|
let verdict: WechatVerdict;
|
|
72
108
|
try {
|
|
73
109
|
await checkWechatSession(profileDir, { headless: !headed, timeoutMs });
|