@gobing-ai/knowledge-kit 0.1.29 → 0.1.30

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 (114) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/api.js +8724 -3861
  3. package/dist/board/collect/index.js +69 -1
  4. package/dist/board/daily-voice/index.js +474 -265
  5. package/dist/board/itc/index.js +69 -1
  6. package/dist/board/wiki/index.css +1305 -0
  7. package/dist/board/wiki/index.js +1621 -0
  8. package/dist/index.js +34689 -28532
  9. package/package.json +1 -1
  10. package/plugins/generations/content-gen/dist/index.js +14 -1
  11. package/plugins/generations/core-facts-gen/dist/index.js +14 -1
  12. package/plugins/generations/daily-article-gen/dist/index.js +14 -1
  13. package/plugins/generations/dailynews-gen/dist/index.js +14 -1
  14. package/plugins/generations/episode-plan-gen/dist/index.js +32 -2
  15. package/plugins/generations/episode-plan-gen/src/index.ts +19 -1
  16. package/plugins/generations/gemini-tts/dist/index.js +14 -1
  17. package/plugins/generations/image-gen/dist/index.js +14 -1
  18. package/plugins/generations/music-gen/dist/index.js +15 -2
  19. package/plugins/generations/news-report-gen/dist/index.js +14 -1
  20. package/plugins/generations/vibe-voice-tts/dist/index.js +14 -1
  21. package/plugins/generations/video-gen/README.md +245 -8
  22. package/plugins/generations/video-gen/dist/index.js +22447 -4763
  23. package/plugins/generations/video-gen/package.json +1 -0
  24. package/plugins/generations/video-gen/presets/formats/avatar.yaml +5 -0
  25. package/plugins/generations/video-gen/presets/formats/editorial.yaml +6 -0
  26. package/plugins/generations/video-gen/presets/formats/hybrid-pip.yaml +5 -0
  27. package/plugins/generations/video-gen/presets/styles/daily-ai.yaml +5 -0
  28. package/plugins/generations/video-gen/presets/styles/neutral.yaml +3 -0
  29. package/plugins/generations/video-gen/python/colab_comfyui_h3.py +322 -0
  30. package/plugins/generations/video-gen/python/comfyui-h3-i2v-api.json +47 -0
  31. package/plugins/generations/video-gen/python/comfyui-h3-models.json +32 -0
  32. package/plugins/generations/video-gen/python/comfyui_model_cache.py +388 -0
  33. package/plugins/generations/video-gen/python/drive_client.py +187 -0
  34. package/plugins/generations/video-gen/src/brief-cli.ts +65 -0
  35. package/plugins/generations/video-gen/src/brief.ts +464 -0
  36. package/plugins/generations/video-gen/src/ccu-ledger.ts +206 -3
  37. package/plugins/generations/video-gen/src/colab-runner.ts +346 -35
  38. package/plugins/generations/video-gen/src/index.ts +141 -109
  39. package/plugins/generations/video-gen/src/inputs.ts +162 -4
  40. package/plugins/generations/video-gen/src/layout.ts +33 -0
  41. package/plugins/generations/video-gen/src/props.ts +27 -3
  42. package/plugins/generations/video-gen/src/remotion/AvatarReel.tsx +17 -1
  43. package/plugins/generations/video-gen/src/remotion/EditorialReel.tsx +17 -1
  44. package/plugins/generations/video-gen/src/remotion/Root.tsx +2 -0
  45. package/plugins/generations/video-gen/src/remotion/engine.ts +3 -7
  46. package/plugins/generations/video-gen/src/render.ts +25 -0
  47. package/plugins/generations/video-gen/src/request.ts +150 -20
  48. package/plugins/generations/video-gen/src/visual-provider.ts +116 -3
  49. package/plugins/generations/voice-gen/dist/index.js +14 -1
  50. package/plugins/generations/voxcpm-tts/dist/index.js +14 -1
  51. package/plugins/ingestions/aihot-ingest/dist/index.js +14 -1
  52. package/plugins/ingestions/horizon-ingest/dist/index.js +14 -1
  53. package/plugins/ingestions/last30days-ingest/dist/index.js +14 -1
  54. package/plugins/ingestions/web-search/dist/index.js +14 -1
  55. package/plugins/kk/config.example.yaml +1 -1
  56. package/plugins/kk/mcp-tools.yaml +47 -0
  57. package/plugins/kk/plugin.json +1 -1
  58. package/plugins/kk/publish-presets/itc-surfdash-locales.json +42 -0
  59. package/plugins/kk/scripts/daily-stages.ts +87 -6
  60. package/plugins/kk/scripts/kk-workflow-stages.ts +64 -9
  61. package/plugins/kk/scripts/video-stages.ts +332 -0
  62. package/plugins/kk/scripts/wiki-normalize-audio.ts +354 -0
  63. package/plugins/kk/scripts/wiki-normalize-document.ts +495 -0
  64. package/plugins/kk/scripts/wiki-normalize-stages.ts +96 -0
  65. package/plugins/kk/scripts/wiki-stage-runtime.ts +39 -0
  66. package/plugins/kk/skills/news-editorial/SKILL.md +2 -1
  67. package/plugins/kk/workflows/kk-collect.yaml +10 -0
  68. package/plugins/kk/workflows/kk-news-generate.yaml +70 -8
  69. package/plugins/kk/workflows/kk-smart-seo.yaml +8 -0
  70. package/plugins/kk/workflows/kk-storm-research.yaml +10 -0
  71. package/plugins/kk/workflows/kk-video-generate.yaml +169 -0
  72. package/plugins/kk/workflows/kk-wiki-digest.yaml +49 -0
  73. package/plugins/publishings/bilibili-pub/dist/index.js +281 -268
  74. package/plugins/publishings/bilibili-pub/dist/profile-check.js +202 -0
  75. package/plugins/publishings/cnblogs-pub/dist/index.js +281 -268
  76. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +202 -0
  77. package/plugins/publishings/csdn-pub/dist/index.js +281 -268
  78. package/plugins/publishings/csdn-pub/dist/profile-check.js +216 -1
  79. package/plugins/publishings/emdash-pub/dist/index.js +33 -3
  80. package/plugins/publishings/infoq-pub/dist/index.js +281 -268
  81. package/plugins/publishings/infoq-pub/dist/profile-check.js +216 -1
  82. package/plugins/publishings/jike-pub/dist/index.js +281 -268
  83. package/plugins/publishings/jike-pub/dist/profile-check.js +216 -1
  84. package/plugins/publishings/juejin-pub/dist/index.js +281 -268
  85. package/plugins/publishings/juejin-pub/dist/profile-check.js +216 -1
  86. package/plugins/publishings/linkedin-pub/dist/index.js +281 -268
  87. package/plugins/publishings/linkedin-pub/dist/profile-check.js +216 -1
  88. package/plugins/publishings/medium-pub/dist/index.js +281 -268
  89. package/plugins/publishings/medium-pub/dist/profile-check.js +216 -1
  90. package/plugins/publishings/podcast-pub/dist/index.js +39 -9
  91. package/plugins/publishings/qiita-pub/dist/index.js +33 -3
  92. package/plugins/publishings/shipinhao-pub/dist/index.js +281 -268
  93. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +175 -0
  94. package/plugins/publishings/sspai-pub/dist/index.js +281 -268
  95. package/plugins/publishings/sspai-pub/dist/profile-check.js +202 -0
  96. package/plugins/publishings/substack-pub/dist/index.js +281 -268
  97. package/plugins/publishings/substack-pub/dist/profile-check.js +216 -1
  98. package/plugins/publishings/surfdash-pub/dist/index.js +99 -39
  99. package/plugins/publishings/surfdash-pub/plugin.json +54 -0
  100. package/plugins/publishings/surfdash-pub/src/index.ts +36 -5
  101. package/plugins/publishings/threads-pub/dist/index.js +281 -268
  102. package/plugins/publishings/threads-pub/dist/profile-check.js +216 -1
  103. package/plugins/publishings/wechatmp-pub/dist/index.js +665 -451
  104. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +215 -3
  105. package/plugins/publishings/weibo-pub/dist/index.js +281 -268
  106. package/plugins/publishings/weibo-pub/dist/profile-check.js +189 -1
  107. package/plugins/publishings/x-pub/dist/index.js +281 -268
  108. package/plugins/publishings/x-pub/dist/profile-check.js +216 -1
  109. package/plugins/publishings/xhs-pub/dist/index.js +281 -268
  110. package/plugins/publishings/xhs-pub/dist/profile-check.js +119 -1
  111. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +281 -268
  112. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +202 -0
  113. package/plugins/publishings/youtube-pub/dist/index.js +14 -1
  114. package/plugins/publishings/zenn-pub/dist/index.js +37 -7
@@ -21209,8 +21209,18 @@ function sha256Hex(value) {
21209
21209
  }
21210
21210
 
21211
21211
  // ../../packages/publish-harness/src/bot.ts
21212
+ var BOT_SCHEMA_VERSION = 1;
21213
+ var BOT_METADATA_FILE = "bot.json";
21212
21214
  var DEFAULT_BOT_PROFILE_ROOT = join3(homedir3(), ".config", "kk", "browser-profiles");
21215
+ var ISO_DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
21213
21216
  var MAX_IDENTITY_LENGTH = 128;
21217
+ var CONTROL_CHARACTERS = /\p{Cc}/u;
21218
+ function isSessionFactDate(value) {
21219
+ return typeof value === "string" && ISO_DATE_TIME.test(value) && Number.isFinite(Date.parse(value));
21220
+ }
21221
+ function isSessionFactIdentity(value) {
21222
+ return typeof value === "string" && value.length > 0 && value.length <= MAX_IDENTITY_LENGTH && !CONTROL_CHARACTERS.test(value);
21223
+ }
21214
21224
  function normalizeSessionIdentity(value) {
21215
21225
  if (typeof value !== "string")
21216
21226
  return;
@@ -21227,6 +21237,124 @@ class BotError extends Error {
21227
21237
  this.details = details;
21228
21238
  }
21229
21239
  }
21240
+ function isStoredDefaultUrl(value, allowQuery) {
21241
+ let url;
21242
+ try {
21243
+ url = new URL(value);
21244
+ } catch {
21245
+ return false;
21246
+ }
21247
+ if (url.protocol !== "http:" && url.protocol !== "https:")
21248
+ return false;
21249
+ if (url.username !== "" || url.password !== "")
21250
+ return false;
21251
+ if (url.hash !== "")
21252
+ return false;
21253
+ if (!allowQuery && url.search !== "")
21254
+ return false;
21255
+ const stored = `${url.origin}${url.pathname}${allowQuery ? url.search : ""}`;
21256
+ return stored === value;
21257
+ }
21258
+ function parseBotMetadata(raw, source = "bot metadata") {
21259
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
21260
+ throw new BotError("persistence", `${source}: expected a JSON object`);
21261
+ }
21262
+ const record = raw;
21263
+ if (record.schemaVersion !== BOT_SCHEMA_VERSION) {
21264
+ throw new BotError("persistence", `${source}: unsupported schemaVersion ${JSON.stringify(record.schemaVersion)}`);
21265
+ }
21266
+ const evidence = record.authenticationEvidence;
21267
+ if (evidence !== "operator-confirmed" && evidence !== "site-verified") {
21268
+ throw new BotError("persistence", `${source}: authenticationEvidence must be operator-confirmed|site-verified`);
21269
+ }
21270
+ let pluginName;
21271
+ if (record.pluginName !== undefined) {
21272
+ if (typeof record.pluginName !== "string" || record.pluginName.length === 0) {
21273
+ throw new BotError("persistence", `${source}: pluginName must be a non-empty string`);
21274
+ }
21275
+ pluginName = record.pluginName;
21276
+ }
21277
+ const allowQuery = pluginName !== undefined;
21278
+ if (typeof record.defaultUrl !== "string" || !isStoredDefaultUrl(record.defaultUrl, allowQuery)) {
21279
+ throw new BotError("persistence", `${source}: defaultUrl must be an http(s) origin+pathname` + (allowQuery ? " with at most a plugin-fixed query" : ""));
21280
+ }
21281
+ const metadata = {
21282
+ schemaVersion: BOT_SCHEMA_VERSION,
21283
+ defaultUrl: record.defaultUrl,
21284
+ authenticationEvidence: evidence
21285
+ };
21286
+ if (pluginName !== undefined) {
21287
+ metadata.pluginName = pluginName;
21288
+ }
21289
+ if (record.lastLoginAt !== undefined) {
21290
+ if (!isSessionFactDate(record.lastLoginAt)) {
21291
+ throw new BotError("persistence", `${source}: lastLoginAt must be an ISO 8601 date-time`);
21292
+ }
21293
+ metadata.lastLoginAt = record.lastLoginAt;
21294
+ }
21295
+ if (record.lastRefreshedAt !== undefined) {
21296
+ if (!isSessionFactDate(record.lastRefreshedAt)) {
21297
+ throw new BotError("persistence", `${source}: lastRefreshedAt must be an ISO 8601 date-time`);
21298
+ }
21299
+ metadata.lastRefreshedAt = record.lastRefreshedAt;
21300
+ }
21301
+ if (record.expiresAt !== undefined) {
21302
+ if (!isSessionFactDate(record.expiresAt)) {
21303
+ throw new BotError("persistence", `${source}: expiresAt must be an ISO 8601 date-time`);
21304
+ }
21305
+ metadata.expiresAt = record.expiresAt;
21306
+ }
21307
+ if (record.identity !== undefined) {
21308
+ if (!isSessionFactIdentity(record.identity)) {
21309
+ throw new BotError("persistence", `${source}: identity must be a non-empty string of at most 128 characters without control characters`);
21310
+ }
21311
+ metadata.identity = record.identity;
21312
+ }
21313
+ return metadata;
21314
+ }
21315
+ async function readBotMetadata(fileSystem, metadataPath) {
21316
+ if (!await fileSystem.exists(metadataPath))
21317
+ return null;
21318
+ let text;
21319
+ try {
21320
+ text = await fileSystem.readFile(metadataPath);
21321
+ } catch (error) {
21322
+ const detail = error instanceof Error ? error.message : String(error);
21323
+ throw new BotError("persistence", `${metadataPath}: cannot read bot metadata: ${detail}`);
21324
+ }
21325
+ let raw;
21326
+ try {
21327
+ raw = JSON.parse(text);
21328
+ } catch {
21329
+ throw new BotError("persistence", `${metadataPath}: corrupt bot metadata (not valid JSON)`);
21330
+ }
21331
+ return parseBotMetadata(raw, metadataPath);
21332
+ }
21333
+
21334
+ // ../../packages/publish-harness/src/session-state.ts
21335
+ import { randomUUID } from "crypto";
21336
+ function channelStorageStatePath(profileDir) {
21337
+ return `${profileDir}/storage-state.json`;
21338
+ }
21339
+ async function persistChannelSessionState(context, profileDir) {
21340
+ const target = channelStorageStatePath(profileDir);
21341
+ const temporary = `${target}.${process.pid}.${randomUUID()}.tmp`;
21342
+ const fs = createNodeFileSystem();
21343
+ let reserved = false;
21344
+ try {
21345
+ createExclusiveFile(temporary);
21346
+ reserved = true;
21347
+ await context.storageState({ path: temporary });
21348
+ chmod(temporary, 384);
21349
+ await fs.rename(temporary, target);
21350
+ } finally {
21351
+ if (reserved) {
21352
+ await Promise.resolve().then(() => fs.deleteFile(temporary)).catch(() => {
21353
+ return;
21354
+ });
21355
+ }
21356
+ }
21357
+ }
21230
21358
  // ../../packages/publish-harness/src/index.ts
21231
21359
  import { homedir as homedir4 } from "os";
21232
21360
  import { join as join4, resolve as resolve4 } from "path";
@@ -21265,6 +21393,7 @@ var VERDICT_PRINT_MARGIN_MS = 2000;
21265
21393
  var MIN_PASS_BUDGET_MS = 5000;
21266
21394
  var PASS_LAUNCH_RESERVE_MS = 20000;
21267
21395
  var DEFAULT_POLL_MS = 500;
21396
+ var OPEN_SESSION_SAVE_DEBOUNCE_MS = 1500;
21268
21397
  function isInstantBrowserDeath(message) {
21269
21398
  return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
21270
21399
  }
@@ -21452,9 +21581,17 @@ async function openChannelSession(config, request, deps = {}, stdout = echo) {
21452
21581
  } catch (error) {
21453
21582
  stdout(`${config.channel} profile open navigation failed: ${errorMessage2(error)}`);
21454
21583
  }
21584
+ const capture = createOpenSessionCapture({
21585
+ context,
21586
+ profileDir: request.profileDir,
21587
+ fileSystem: createNodeFileSystem(),
21588
+ persistStorageState: true
21589
+ });
21590
+ capture.attach(page);
21455
21591
  await new Promise((resolveClose) => {
21456
21592
  context.once("close", () => resolveClose());
21457
21593
  });
21594
+ await capture.flush();
21458
21595
  stdout(`${config.channel} profile open closed: ${request.profileDir}`);
21459
21596
  return 0;
21460
21597
  }
@@ -21621,6 +21758,68 @@ async function readIdentityOrUndefined(readIdentity, page) {
21621
21758
  return;
21622
21759
  }
21623
21760
  }
21761
+ function createOpenSessionCapture(options) {
21762
+ const metadataPath = join5(options.profileDir, BOT_METADATA_FILE);
21763
+ let closing = false;
21764
+ let timer;
21765
+ let chain = Promise.resolve();
21766
+ options.context.once("close", () => {
21767
+ closing = true;
21768
+ });
21769
+ const snapshot = async () => {
21770
+ if (closing)
21771
+ return;
21772
+ try {
21773
+ if (options.persistStorageState) {
21774
+ await persistChannelSessionState(options.context, options.profileDir);
21775
+ }
21776
+ if (lstat(metadataPath) === null)
21777
+ return;
21778
+ const metadata = await readBotMetadata(options.fileSystem, metadataPath);
21779
+ if (metadata === null)
21780
+ return;
21781
+ const facts = await captureSessionFacts(options.context, metadata.defaultUrl);
21782
+ await writeBotMetadata(options.fileSystem, metadataPath, {
21783
+ ...metadata,
21784
+ lastRefreshedAt: new Date().toISOString(),
21785
+ ...facts.expiresAt === undefined ? {} : { expiresAt: facts.expiresAt }
21786
+ });
21787
+ } catch {}
21788
+ };
21789
+ const schedule = () => {
21790
+ if (closing)
21791
+ return;
21792
+ if (timer !== undefined)
21793
+ clearTimeout(timer);
21794
+ timer = setTimeout(() => {
21795
+ timer = undefined;
21796
+ chain = chain.then(snapshot);
21797
+ }, OPEN_SESSION_SAVE_DEBOUNCE_MS);
21798
+ timer.unref?.();
21799
+ };
21800
+ const attachPage = (target) => {
21801
+ target.on?.("load", schedule);
21802
+ };
21803
+ return {
21804
+ attach: (page) => {
21805
+ attachPage(page);
21806
+ options.context.on?.("page", attachPage);
21807
+ },
21808
+ flush: async () => {
21809
+ if (timer !== undefined) {
21810
+ clearTimeout(timer);
21811
+ timer = undefined;
21812
+ }
21813
+ closing = true;
21814
+ await chain;
21815
+ }
21816
+ };
21817
+ }
21818
+ async function writeBotMetadata(fileSystem, path, metadata) {
21819
+ await fileSystem.writeFile(path, `${JSON.stringify(metadata, null, 2)}
21820
+ `);
21821
+ chmod(path, 384);
21822
+ }
21624
21823
  function errorMessage2(error) {
21625
21824
  return error instanceof Error ? error.message : String(error);
21626
21825
  }
@@ -21629,7 +21828,7 @@ function errorMessage2(error) {
21629
21828
  init_dist();
21630
21829
 
21631
21830
  // ../../plugins/publishings/wechatmp-pub/src/index.ts
21632
- import { randomUUID } from "crypto";
21831
+ import { randomUUID as randomUUID2 } from "crypto";
21633
21832
 
21634
21833
  // ../../packages/kk-core/src/content-limits.ts
21635
21834
  var PLATFORM_CONTENT_LIMITS = Object.freeze({
@@ -26329,7 +26528,19 @@ var omniVoiceGenContentSchema = ContentSchema.extend({
26329
26528
  })
26330
26529
  });
26331
26530
  var VideoVisualModeSchema = _enum2(["editorial", "avatar", "hybrid-pip"]);
26332
- var VideoRenderProviderSchema = _enum2(["local-ken-burns", "wan21-i2v", "musetalk", "echomimic-v2"]);
26531
+ var VideoRenderProviderSchema = _enum2([
26532
+ "local-ken-burns",
26533
+ "wan21-i2v",
26534
+ "comfyui-minimax-h3",
26535
+ "musetalk",
26536
+ "echomimic-v2"
26537
+ ]);
26538
+ var RenderProvenanceSchema = object3({
26539
+ cache: _enum2(["drive", "local"]),
26540
+ comfyuiCommit: string4().min(1).optional(),
26541
+ comfyuiRuntimeCommit: string4().min(1).nullable().optional(),
26542
+ modelCache: object3({ verified: boolean4(), restored: number4().int().nonnegative() }).optional()
26543
+ });
26333
26544
  var videoGenContentSchema = ContentSchema.extend({
26334
26545
  format: literal("video"),
26335
26546
  metadata: looseObject({
@@ -26342,6 +26553,7 @@ var videoGenContentSchema = ContentSchema.extend({
26342
26553
  durationSec: number4().positive(),
26343
26554
  visualMode: VideoVisualModeSchema,
26344
26555
  renderProvider: VideoRenderProviderSchema,
26556
+ renderProvenance: RenderProvenanceSchema.optional(),
26345
26557
  fallbackUsed: boolean4().optional(),
26346
26558
  warnings: array2(string4()).optional(),
26347
26559
  ccuEstimated: number4().nonnegative().optional(),
@@ -26560,7 +26772,7 @@ function storageStatePath(profileDir) {
26560
26772
  }
26561
26773
  async function persistWechatSessionState(context, profileDir) {
26562
26774
  const target = storageStatePath(profileDir);
26563
- const temporary = `${target}.${process.pid}.${randomUUID()}.tmp`;
26775
+ const temporary = `${target}.${process.pid}.${randomUUID2()}.tmp`;
26564
26776
  const fs = createNodeFileSystem();
26565
26777
  let reserved = false;
26566
26778
  try {