@gobing-ai/knowledge-kit 0.0.35 → 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.
Files changed (122) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +1 -1
  3. package/dist/board/collect/index.css +42 -0
  4. package/dist/board/collect/index.js +787 -0
  5. package/dist/board/daily-voice/index.css +13 -0
  6. package/dist/board/daily-voice/index.js +902 -0
  7. package/dist/board/itc/index.css +14 -0
  8. package/dist/board/itc/index.js +1026 -0
  9. package/dist/index.js +11768 -9249
  10. package/package.json +10 -9
  11. package/plugins/generations/content-gen/dist/index.js +1015 -10814
  12. package/plugins/generations/content-gen/package.json +1 -1
  13. package/plugins/generations/core-facts-gen/dist/index.js +1002 -10801
  14. package/plugins/generations/core-facts-gen/package.json +1 -1
  15. package/plugins/generations/daily-article-gen/dist/index.js +1004 -10803
  16. package/plugins/generations/daily-article-gen/package.json +1 -1
  17. package/plugins/generations/dailynews-gen/dist/index.js +1092 -10891
  18. package/plugins/generations/dailynews-gen/package.json +1 -1
  19. package/plugins/generations/episode-plan-gen/dist/index.js +1124 -10923
  20. package/plugins/generations/episode-plan-gen/package.json +1 -1
  21. package/plugins/generations/gemini-tts/dist/index.js +1104 -10903
  22. package/plugins/generations/gemini-tts/package.json +1 -1
  23. package/plugins/generations/image-gen/dist/index.js +1239 -11035
  24. package/plugins/generations/image-gen/package.json +1 -1
  25. package/plugins/generations/news-report-gen/dist/index.js +1048 -10847
  26. package/plugins/generations/news-report-gen/package.json +1 -1
  27. package/plugins/generations/voice-gen/dist/index.js +1062 -10861
  28. package/plugins/generations/voice-gen/package.json +1 -1
  29. package/plugins/generations/voxcpm-tts/README.md +72 -0
  30. package/plugins/generations/voxcpm-tts/dist/index.js +14006 -0
  31. package/plugins/generations/voxcpm-tts/package.json +16 -0
  32. package/plugins/generations/voxcpm-tts/plugin.json +6 -0
  33. package/plugins/generations/voxcpm-tts/profiles.json +10 -0
  34. package/plugins/generations/voxcpm-tts/pyproject.toml +9 -0
  35. package/plugins/generations/voxcpm-tts/python/worker.py +353 -0
  36. package/plugins/generations/voxcpm-tts/src/index.ts +42 -0
  37. package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +765 -0
  38. package/plugins/generations/voxcpm-tts/tsconfig.json +8 -0
  39. package/plugins/generations/voxcpm-tts/uv.lock +2571 -0
  40. package/plugins/ingestions/aihot-ingest/dist/index.js +1081 -10628
  41. package/plugins/ingestions/aihot-ingest/package.json +1 -1
  42. package/plugins/ingestions/horizon-ingest/dist/index.js +1013 -10812
  43. package/plugins/ingestions/horizon-ingest/package.json +1 -1
  44. package/plugins/ingestions/karakeep-local/dist/index.js +689 -10774
  45. package/plugins/ingestions/karakeep-local/package.json +1 -1
  46. package/plugins/ingestions/last30days-ingest/dist/index.js +1011 -10810
  47. package/plugins/ingestions/last30days-ingest/package.json +1 -1
  48. package/plugins/ingestions/web-search/dist/index.js +1250 -11033
  49. package/plugins/ingestions/web-search/package.json +1 -1
  50. package/plugins/kk/README.md +29 -2
  51. package/plugins/kk/plugin.json +1 -1
  52. package/plugins/kk/schedules/cron.tmpl +9 -1
  53. package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +79 -0
  54. package/plugins/kk/schedules/launchd.plist.tmpl +11 -1
  55. package/plugins/kk/scripts/daily-stages.ts +428 -46
  56. package/plugins/kk/scripts/kk-workflow-stages.ts +76 -146
  57. package/plugins/kk/skills/publish/SKILL.md +8 -4
  58. package/plugins/kk/workflows/feature-verification.yaml +93 -0
  59. package/plugins/kk/workflows/judge-gated-publish-example.yaml +1 -0
  60. package/plugins/kk/workflows/kk-collect.yaml +43 -11
  61. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +4 -2
  62. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +86 -15
  63. package/plugins/kk/workflows/kk-daily-safety.yaml +15 -2
  64. package/plugins/kk/workflows/kk-itc.yaml +8 -1
  65. package/plugins/kk/workflows/kk-solo-podcast.yaml +2 -0
  66. package/plugins/publishings/emdash-pub/dist/index.js +987 -10814
  67. package/plugins/publishings/emdash-pub/package.json +1 -1
  68. package/plugins/publishings/infoq-pub/dist/index.js +1928 -11444
  69. package/plugins/publishings/infoq-pub/dist/profile-check.js +1677 -11199
  70. package/plugins/publishings/infoq-pub/package.json +1 -1
  71. package/plugins/publishings/infoq-pub/plugin.json +5 -1
  72. package/plugins/publishings/juejin-pub/dist/index.js +1940 -11456
  73. package/plugins/publishings/juejin-pub/dist/profile-check.js +1677 -11199
  74. package/plugins/publishings/juejin-pub/package.json +1 -1
  75. package/plugins/publishings/juejin-pub/plugin.json +5 -1
  76. package/plugins/publishings/medium-pub/dist/index.js +978 -10805
  77. package/plugins/publishings/medium-pub/package.json +1 -1
  78. package/plugins/publishings/podcast-pub/dist/index.js +1016 -10843
  79. package/plugins/publishings/podcast-pub/package.json +1 -1
  80. package/plugins/publishings/qiita-pub/dist/index.js +976 -10803
  81. package/plugins/publishings/qiita-pub/package.json +1 -1
  82. package/plugins/publishings/substack-pub/dist/index.js +1932 -11448
  83. package/plugins/publishings/substack-pub/dist/profile-check.js +1698 -11200
  84. package/plugins/publishings/substack-pub/package.json +1 -1
  85. package/plugins/publishings/substack-pub/plugin.json +4 -1
  86. package/plugins/publishings/substack-pub/src/profile-check.ts +36 -3
  87. package/plugins/publishings/surfdash-pub/dist/index.js +1151 -10834
  88. package/plugins/publishings/surfdash-pub/package.json +1 -1
  89. package/plugins/publishings/surfdash-pub/src/index.ts +137 -15
  90. package/plugins/publishings/surfdash-pub/src/patch.ts +144 -0
  91. package/plugins/publishings/threads-pub/dist/index.js +12394 -0
  92. package/plugins/publishings/threads-pub/package.json +17 -0
  93. package/plugins/publishings/threads-pub/plugin.json +7 -0
  94. package/plugins/publishings/threads-pub/src/index.ts +340 -0
  95. package/plugins/publishings/threads-pub/tsconfig.json +4 -0
  96. package/plugins/publishings/wechatmp-pub/dist/index.js +2508 -11695
  97. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +1656 -11188
  98. package/plugins/publishings/wechatmp-pub/package.json +1 -1
  99. package/plugins/publishings/wechatmp-pub/plugin.json +5 -1
  100. package/plugins/publishings/wechatmp-pub/src/enrich.ts +244 -71
  101. package/plugins/publishings/wechatmp-pub/src/flow.ts +412 -96
  102. package/plugins/publishings/wechatmp-pub/src/index.ts +24 -3
  103. package/plugins/publishings/wechatmp-pub/src/page.ts +16 -0
  104. package/plugins/publishings/wechatmp-pub/src/profile-check.ts +40 -4
  105. package/plugins/publishings/weibo-pub/dist/index.js +21345 -0
  106. package/plugins/publishings/weibo-pub/dist/profile-check.js +20817 -0
  107. package/plugins/publishings/weibo-pub/package.json +19 -0
  108. package/plugins/publishings/weibo-pub/plugin.json +12 -0
  109. package/plugins/publishings/weibo-pub/src/index.ts +868 -0
  110. package/plugins/publishings/weibo-pub/src/profile-check.ts +20 -0
  111. package/plugins/publishings/weibo-pub/tsconfig.json +4 -0
  112. package/plugins/publishings/x-pub/dist/index.js +1948 -11440
  113. package/plugins/publishings/x-pub/dist/profile-check.js +1677 -11199
  114. package/plugins/publishings/x-pub/package.json +1 -1
  115. package/plugins/publishings/x-pub/plugin.json +5 -1
  116. package/plugins/publishings/xhs-pub/dist/index.js +1993 -11509
  117. package/plugins/publishings/xhs-pub/dist/profile-check.js +1697 -11212
  118. package/plugins/publishings/xhs-pub/package.json +1 -1
  119. package/plugins/publishings/xhs-pub/plugin.json +5 -1
  120. package/plugins/publishings/xhs-pub/src/profile-check.ts +72 -2
  121. package/plugins/publishings/zenn-pub/dist/index.js +988 -10815
  122. package/plugins/publishings/zenn-pub/package.json +1 -1
@@ -126,8 +126,29 @@ export async function openWechatLogin(opts: { profileDir: string; timeoutMs?: nu
126
126
  }
127
127
  }
128
128
 
129
- /** Launch, inject the saved login cookies, and land on the console. Caller owns closing the context. */
130
- async function openWithState(profileDir: string, headless: boolean): Promise<{ page: Page; context: BrowserContext }> {
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(CONSOLE_URL);
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,
@@ -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. Exit codes:
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 = 'usage: wechatmp profile-check [login|check] [--profile <dir>] [--timeout <ms>] [--headed]';
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 });