@gobing-ai/knowledge-kit 0.1.22 → 0.1.24

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 (117) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +282 -147
  3. package/package.json +5 -5
  4. package/plugins/generations/content-gen/dist/index.js +9 -9
  5. package/plugins/generations/core-facts-gen/dist/index.js +12 -12
  6. package/plugins/generations/daily-article-gen/dist/index.js +12 -12
  7. package/plugins/generations/dailynews-gen/dist/index.js +11 -11
  8. package/plugins/generations/dailynews-gen/src/script-plan.ts +2 -2
  9. package/plugins/generations/episode-plan-gen/dist/index.js +12 -12
  10. package/plugins/generations/gemini-tts/dist/index.js +56 -16
  11. package/plugins/generations/gemini-tts/src/gemini-client.ts +34 -6
  12. package/plugins/generations/image-gen/dist/index.js +9 -9
  13. package/plugins/generations/music-gen/README.md +2 -2
  14. package/plugins/generations/music-gen/dist/index.js +62 -26
  15. package/plugins/generations/music-gen/presets/formats/song.yaml +6 -1
  16. package/plugins/generations/music-gen/presets/themes/synthwave.yaml +6 -1
  17. package/plugins/generations/music-gen/src/adapter/instance.ts +34 -11
  18. package/plugins/generations/music-gen/src/presets.ts +36 -3
  19. package/plugins/generations/news-report-gen/dist/index.js +12 -12
  20. package/plugins/generations/omni-voice-gen/uv.toml +5 -0
  21. package/plugins/generations/vibe-voice-tts/README.md +64 -0
  22. package/plugins/generations/vibe-voice-tts/dist/index.js +14259 -0
  23. package/plugins/generations/vibe-voice-tts/package.json +16 -0
  24. package/plugins/generations/vibe-voice-tts/plugin.json +6 -0
  25. package/plugins/generations/vibe-voice-tts/profiles.json +10 -0
  26. package/plugins/generations/vibe-voice-tts/pyproject.toml +9 -0
  27. package/plugins/generations/vibe-voice-tts/python/worker.py +566 -0
  28. package/plugins/generations/vibe-voice-tts/src/index.ts +88 -0
  29. package/plugins/generations/vibe-voice-tts/src/vibevoice-client.ts +828 -0
  30. package/plugins/generations/vibe-voice-tts/tsconfig.json +8 -0
  31. package/plugins/generations/vibe-voice-tts/uv.lock +1767 -0
  32. package/plugins/generations/vibe-voice-tts/uv.toml +4 -0
  33. package/plugins/generations/voice-gen/dist/index.js +40 -10
  34. package/plugins/generations/voice-gen/src/voicebox-client.ts +50 -1
  35. package/plugins/generations/voxcpm-tts/dist/index.js +90 -18
  36. package/plugins/generations/voxcpm-tts/python/worker.py +9 -0
  37. package/plugins/generations/voxcpm-tts/src/index.ts +41 -0
  38. package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +32 -11
  39. package/plugins/generations/voxcpm-tts/uv.toml +5 -0
  40. package/plugins/ingestions/aihot-ingest/dist/index.js +12 -12
  41. package/plugins/ingestions/horizon-ingest/dist/index.js +12 -12
  42. package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
  43. package/plugins/ingestions/last30days-ingest/dist/index.js +12 -12
  44. package/plugins/ingestions/web-search/dist/index.js +10 -10
  45. package/plugins/kk/README.md +21 -0
  46. package/plugins/kk/decisions/kk-safety.yaml +5 -2
  47. package/plugins/kk/plugin.json +1 -1
  48. package/plugins/kk/publish-presets/daily-ai-voice.json +16 -16
  49. package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +12 -1
  50. package/plugins/kk/scripts/cover-compositor.ts +104 -26
  51. package/plugins/kk/scripts/daily-stages.ts +481 -63
  52. package/plugins/kk/scripts/kk-workflow-stages.ts +218 -17
  53. package/plugins/kk/scripts/safety-artifact-check.ts +28 -5
  54. package/plugins/kk/scripts/series-names.ts +16 -3
  55. package/plugins/kk/skills/news-editorial/SKILL.md +1 -1
  56. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +3 -3
  57. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +4 -3
  58. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +6 -5
  59. package/plugins/kk/workflows/kk-daily-safety.yaml +12 -10
  60. package/plugins/kk/workflows/kk-music.yaml +20 -16
  61. package/plugins/kk/workflows/kk-news-generate.yaml +26 -3
  62. package/plugins/kk/workflows/kk-publish.yaml +4 -1
  63. package/plugins/publishings/bilibili-pub/dist/index.js +22 -22
  64. package/plugins/publishings/bilibili-pub/dist/profile-check.js +22 -22
  65. package/plugins/publishings/cnblogs-pub/dist/index.js +22 -22
  66. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +22 -22
  67. package/plugins/publishings/csdn-pub/dist/index.js +22 -22
  68. package/plugins/publishings/csdn-pub/dist/profile-check.js +22 -22
  69. package/plugins/publishings/emdash-pub/dist/index.js +9 -9
  70. package/plugins/publishings/infoq-pub/dist/index.js +22 -22
  71. package/plugins/publishings/infoq-pub/dist/profile-check.js +22 -22
  72. package/plugins/publishings/jike-pub/dist/index.js +22 -22
  73. package/plugins/publishings/jike-pub/dist/profile-check.js +22 -22
  74. package/plugins/publishings/juejin-pub/dist/index.js +22 -22
  75. package/plugins/publishings/juejin-pub/dist/profile-check.js +22 -22
  76. package/plugins/publishings/linkedin-pub/dist/index.js +133 -33
  77. package/plugins/publishings/linkedin-pub/dist/profile-check.js +27 -22
  78. package/plugins/publishings/linkedin-pub/src/index.ts +192 -18
  79. package/plugins/publishings/medium-pub/dist/index.js +9 -9
  80. package/plugins/publishings/podcast-pub/dist/index.js +240 -37
  81. package/plugins/publishings/podcast-pub/src/index.ts +154 -3
  82. package/plugins/publishings/podcast-pub/src/seo.ts +25 -8
  83. package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +93 -23
  84. package/plugins/publishings/podcast-pub/src/show-notes.ts +26 -6
  85. package/plugins/publishings/qiita-pub/dist/index.js +9 -9
  86. package/plugins/publishings/shipinhao-pub/dist/index.js +23 -23
  87. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +23 -23
  88. package/plugins/publishings/shipinhao-pub/src/selectors.ts +2 -1
  89. package/plugins/publishings/sspai-pub/dist/index.js +22 -22
  90. package/plugins/publishings/sspai-pub/dist/profile-check.js +22 -22
  91. package/plugins/publishings/substack-pub/dist/index.js +22 -22
  92. package/plugins/publishings/substack-pub/dist/profile-check.js +22 -22
  93. package/plugins/publishings/surfdash-pub/dist/index.js +207 -95
  94. package/plugins/publishings/surfdash-pub/src/digest-check.ts +30 -1
  95. package/plugins/publishings/surfdash-pub/src/index.ts +101 -76
  96. package/plugins/publishings/surfdash-pub/src/media-upload.ts +83 -0
  97. package/plugins/publishings/surfdash-pub/src/patch.ts +49 -26
  98. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +12 -4
  99. package/plugins/publishings/threads-pub/dist/index.js +83 -27
  100. package/plugins/publishings/threads-pub/dist/profile-check.js +34 -23
  101. package/plugins/publishings/threads-pub/src/post-rail.ts +121 -4
  102. package/plugins/publishings/wechatmp-pub/dist/index.js +274 -98
  103. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +27 -23
  104. package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +87 -53
  105. package/plugins/publishings/wechatmp-pub/src/enrich.ts +117 -13
  106. package/plugins/publishings/wechatmp-pub/src/flow.ts +183 -43
  107. package/plugins/publishings/wechatmp-pub/src/modes.ts +30 -12
  108. package/plugins/publishings/weibo-pub/dist/index.js +22 -22
  109. package/plugins/publishings/weibo-pub/dist/profile-check.js +22 -22
  110. package/plugins/publishings/x-pub/dist/index.js +113 -32
  111. package/plugins/publishings/x-pub/dist/profile-check.js +22 -22
  112. package/plugins/publishings/x-pub/src/post-rail.ts +155 -20
  113. package/plugins/publishings/xhs-pub/dist/index.js +22 -22
  114. package/plugins/publishings/xhs-pub/dist/profile-check.js +22 -22
  115. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +22 -22
  116. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +22 -22
  117. package/plugins/publishings/zenn-pub/dist/index.js +9 -9
@@ -26,10 +26,14 @@ export interface CoverCompositorOptions {
26
26
  outputPath: string;
27
27
  width?: number; // default 1344
28
28
  height?: number; // default 576
29
+ /** Raster output format passed to macOS `sips` (default `'png'`). */
30
+ format?: 'png' | 'jpeg';
29
31
  }
30
32
 
31
33
  export const COVER_WIDTH = 1344;
32
34
  export const COVER_HEIGHT = 576;
35
+ export const SOCIAL_COVER_WIDTH = 1200;
36
+ export const SOCIAL_COVER_HEIGHT = 630;
33
37
  /** Max Chinese characters per headline line (news-editorial style contract, 0347). */
34
38
  export const HEADLINE_LINE_CAP = 25;
35
39
  const FONT_STACK = `PingFang SC, Hiragino Sans GB, 'Noto Sans CJK SC', sans-serif`;
@@ -381,6 +385,33 @@ function backgroundDataUri(path: string): string {
381
385
  return `data:${mime};base64,${readFileSync(path).toString('base64')}`;
382
386
  }
383
387
 
388
+ function runSips(
389
+ args: string[],
390
+ outputPath: string,
391
+ messages: { notFound: string; failed: (status: number) => string; missingOutput: string },
392
+ ): void {
393
+ const sips = spawnSync('sips', args, { stdio: 'ignore' });
394
+ // Bun reports a missing binary as `status: undefined` (older versions: `null`) plus an `error` object.
395
+ if (sips.error !== undefined || typeof sips.status !== 'number') {
396
+ throw new Error(messages.notFound);
397
+ }
398
+ if (sips.status !== 0) {
399
+ throw new Error(messages.failed(sips.status));
400
+ }
401
+ // sips exits 0 even when it silently fails to place the output (missing parent dir).
402
+ if (!existsSync(outputPath)) {
403
+ throw new Error(messages.missingOutput);
404
+ }
405
+ }
406
+
407
+ function sipsErrorMessages(noun: string, verb: string, outputPath: string) {
408
+ return {
409
+ notFound: `cover compositor: sips not found; cannot ${noun} (macOS required)`,
410
+ failed: (status: number) => `cover compositor: sips ${verb} failed (status ${status}); ${outputPath} missing`,
411
+ missingOutput: `cover compositor: sips reported success but ${outputPath} is missing`,
412
+ };
413
+ }
414
+
384
415
  export function compositeCover(options: CoverCompositorOptions): string {
385
416
  const svgPath = join(tmpdir(), `cover-composite-${Date.now()}.svg`);
386
417
  writeFileSync(
@@ -388,28 +419,80 @@ export function compositeCover(options: CoverCompositorOptions): string {
388
419
  buildCoverSvg({ ...options, backgroundUri: backgroundDataUri(options.backgroundImagePath) }),
389
420
  'utf-8',
390
421
  );
422
+ const sipsArgs =
423
+ options.format === 'jpeg'
424
+ ? ['-s', 'format', 'jpeg', '-s', 'formatOptions', '88', svgPath, '--out', options.outputPath]
425
+ : ['-s', 'format', 'png', svgPath, '--out', options.outputPath];
391
426
  try {
392
- const sips = spawnSync('sips', ['-s', 'format', 'png', svgPath, '--out', options.outputPath], {
393
- stdio: 'ignore',
427
+ runSips(sipsArgs, options.outputPath, {
428
+ notFound: 'cover compositor: sips not found; cannot render the cover overlay (macOS required)',
429
+ failed: (status) => `cover compositor: sips failed (status ${status}); overlay did not render`,
430
+ missingOutput: `cover compositor: sips reported success but ${options.outputPath} is missing`,
394
431
  });
395
- // Bun reports a missing binary as `status: undefined` plus an `error` object.
396
- if (sips.error !== undefined || typeof sips.status !== 'number') {
397
- throw new Error('cover compositor: sips not found; cannot render the cover overlay (macOS required)');
398
- }
399
- if (sips.status !== 0) {
400
- throw new Error(`cover compositor: sips failed (status ${sips.status}); overlay did not render`);
401
- }
402
- // sips exits 0 even when it silently fails to place the output (missing parent dir) —
403
- // a render that claims success without a file would leave a stale cover downstream.
404
- if (!existsSync(options.outputPath)) {
405
- throw new Error(`cover compositor: sips reported success but ${options.outputPath} is missing`);
406
- }
407
432
  } finally {
408
433
  rmSync(svgPath, { force: true });
409
434
  }
410
435
  return options.outputPath;
411
436
  }
412
437
 
438
+ /**
439
+ * Render the 1200×630 JPEG Open Graph / Twitter social card derivative from the same raw background
440
+ * and frozen Chinese headline so `podcast-pub` populates `_microfeed.seo.social_image`.
441
+ */
442
+ export function compositeSocialCover(options: Omit<CoverCompositorOptions, 'width' | 'height' | 'format'>): string {
443
+ return compositeCover({
444
+ ...options,
445
+ width: SOCIAL_COVER_WIDTH,
446
+ height: SOCIAL_COVER_HEIGHT,
447
+ format: 'jpeg',
448
+ });
449
+ }
450
+
451
+ /**
452
+ * Derive a 1200×630 JPEG social card from an already-rendered raster cover via centered aspect crop
453
+ * + resize (used for backfilling historical episodes without regenerating raw diffusion backgrounds).
454
+ */
455
+ export function deriveSocialCoverFromImage(sourcePath: string, outputPath: string): string {
456
+ const probe = spawnSync('sips', ['-g', 'pixelWidth', '-g', 'pixelHeight', sourcePath], { encoding: 'utf-8' });
457
+ const width = Number(/pixelWidth:\s*(\d+)/.exec(probe.stdout ?? '')?.[1] ?? '0');
458
+ const height = Number(/pixelHeight:\s*(\d+)/.exec(probe.stdout ?? '')?.[1] ?? '0');
459
+ if (
460
+ probe.error !== undefined ||
461
+ typeof probe.status !== 'number' ||
462
+ probe.status !== 0 ||
463
+ width < 1 ||
464
+ height < 1
465
+ ) {
466
+ throw new Error(`cover compositor: cannot probe dimensions of ${sourcePath}`);
467
+ }
468
+ const rect = centerCropRect(width, height, SOCIAL_COVER_WIDTH / SOCIAL_COVER_HEIGHT);
469
+ const croppedPng = join(tmpdir(), `cover-social-crop-${Date.now()}.png`);
470
+ try {
471
+ cropPng(sourcePath, rect, croppedPng);
472
+ runSips(
473
+ [
474
+ '-z',
475
+ String(SOCIAL_COVER_HEIGHT),
476
+ String(SOCIAL_COVER_WIDTH),
477
+ '-s',
478
+ 'format',
479
+ 'jpeg',
480
+ '-s',
481
+ 'formatOptions',
482
+ '88',
483
+ croppedPng,
484
+ '--out',
485
+ outputPath,
486
+ ],
487
+ outputPath,
488
+ sipsErrorMessages('transcode social cover', 'transcode', outputPath),
489
+ );
490
+ } finally {
491
+ rmSync(croppedPng, { force: true });
492
+ }
493
+ return outputPath;
494
+ }
495
+
413
496
  /** One platform crop preview written next to the full cover. */
414
497
  export interface CoverCropPreview {
415
498
  platform: PlatformCrop['platform'];
@@ -451,8 +534,7 @@ export interface CoverPreviewOptions extends CoverCompositorOptions {
451
534
 
452
535
  /** Center-crop a rendered PNG to `rect` via `sips` (macOS-only, same tool as the render itself). */
453
536
  function cropPng(source: string, rect: Rect, outputPath: string): void {
454
- const sips = spawnSync(
455
- 'sips',
537
+ runSips(
456
538
  [
457
539
  '-c',
458
540
  String(rect.height),
@@ -464,17 +546,13 @@ function cropPng(source: string, rect: Rect, outputPath: string): void {
464
546
  '--out',
465
547
  outputPath,
466
548
  ],
467
- { stdio: 'ignore' },
549
+ outputPath,
550
+ {
551
+ notFound: 'cover compositor: sips not found; cannot write the crop previews (macOS required)',
552
+ failed: (status) => `cover compositor: sips crop failed (status ${status}); preview ${outputPath} missing`,
553
+ missingOutput: `cover compositor: sips reported success but crop preview ${outputPath} is missing`,
554
+ },
468
555
  );
469
- if (sips.error !== undefined || typeof sips.status !== 'number') {
470
- throw new Error('cover compositor: sips not found; cannot write the crop previews (macOS required)');
471
- }
472
- if (sips.status !== 0) {
473
- throw new Error(`cover compositor: sips crop failed (status ${sips.status}); preview ${outputPath} missing`);
474
- }
475
- if (!existsSync(outputPath)) {
476
- throw new Error(`cover compositor: sips reported success but crop preview ${outputPath} is missing`);
477
- }
478
556
  }
479
557
 
480
558
  /** The top-right corner window the reference-blend preview zooms into (emblem + its surroundings). */