@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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/index.js +282 -147
- package/package.json +5 -5
- package/plugins/generations/content-gen/dist/index.js +9 -9
- package/plugins/generations/core-facts-gen/dist/index.js +12 -12
- package/plugins/generations/daily-article-gen/dist/index.js +12 -12
- package/plugins/generations/dailynews-gen/dist/index.js +11 -11
- package/plugins/generations/dailynews-gen/src/script-plan.ts +2 -2
- package/plugins/generations/episode-plan-gen/dist/index.js +12 -12
- package/plugins/generations/gemini-tts/dist/index.js +56 -16
- package/plugins/generations/gemini-tts/src/gemini-client.ts +34 -6
- package/plugins/generations/image-gen/dist/index.js +9 -9
- package/plugins/generations/music-gen/README.md +2 -2
- package/plugins/generations/music-gen/dist/index.js +62 -26
- package/plugins/generations/music-gen/presets/formats/song.yaml +6 -1
- package/plugins/generations/music-gen/presets/themes/synthwave.yaml +6 -1
- package/plugins/generations/music-gen/src/adapter/instance.ts +34 -11
- package/plugins/generations/music-gen/src/presets.ts +36 -3
- package/plugins/generations/news-report-gen/dist/index.js +12 -12
- package/plugins/generations/omni-voice-gen/uv.toml +5 -0
- package/plugins/generations/vibe-voice-tts/README.md +64 -0
- package/plugins/generations/vibe-voice-tts/dist/index.js +14259 -0
- package/plugins/generations/vibe-voice-tts/package.json +16 -0
- package/plugins/generations/vibe-voice-tts/plugin.json +6 -0
- package/plugins/generations/vibe-voice-tts/profiles.json +10 -0
- package/plugins/generations/vibe-voice-tts/pyproject.toml +9 -0
- package/plugins/generations/vibe-voice-tts/python/worker.py +566 -0
- package/plugins/generations/vibe-voice-tts/src/index.ts +88 -0
- package/plugins/generations/vibe-voice-tts/src/vibevoice-client.ts +828 -0
- package/plugins/generations/vibe-voice-tts/tsconfig.json +8 -0
- package/plugins/generations/vibe-voice-tts/uv.lock +1767 -0
- package/plugins/generations/vibe-voice-tts/uv.toml +4 -0
- package/plugins/generations/voice-gen/dist/index.js +40 -10
- package/plugins/generations/voice-gen/src/voicebox-client.ts +50 -1
- package/plugins/generations/voxcpm-tts/dist/index.js +90 -18
- package/plugins/generations/voxcpm-tts/python/worker.py +9 -0
- package/plugins/generations/voxcpm-tts/src/index.ts +41 -0
- package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +32 -11
- package/plugins/generations/voxcpm-tts/uv.toml +5 -0
- package/plugins/ingestions/aihot-ingest/dist/index.js +12 -12
- package/plugins/ingestions/horizon-ingest/dist/index.js +12 -12
- package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
- package/plugins/ingestions/last30days-ingest/dist/index.js +12 -12
- package/plugins/ingestions/web-search/dist/index.js +10 -10
- package/plugins/kk/README.md +21 -0
- package/plugins/kk/decisions/kk-safety.yaml +5 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice.json +16 -16
- package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +12 -1
- package/plugins/kk/scripts/cover-compositor.ts +104 -26
- package/plugins/kk/scripts/daily-stages.ts +481 -63
- package/plugins/kk/scripts/kk-workflow-stages.ts +218 -17
- package/plugins/kk/scripts/safety-artifact-check.ts +28 -5
- package/plugins/kk/scripts/series-names.ts +16 -3
- package/plugins/kk/skills/news-editorial/SKILL.md +1 -1
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +3 -3
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +4 -3
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +6 -5
- package/plugins/kk/workflows/kk-daily-safety.yaml +12 -10
- package/plugins/kk/workflows/kk-music.yaml +20 -16
- package/plugins/kk/workflows/kk-news-generate.yaml +26 -3
- package/plugins/kk/workflows/kk-publish.yaml +4 -1
- package/plugins/publishings/bilibili-pub/dist/index.js +22 -22
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/cnblogs-pub/dist/index.js +22 -22
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/csdn-pub/dist/index.js +22 -22
- package/plugins/publishings/csdn-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/emdash-pub/dist/index.js +9 -9
- package/plugins/publishings/infoq-pub/dist/index.js +22 -22
- package/plugins/publishings/infoq-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/jike-pub/dist/index.js +22 -22
- package/plugins/publishings/jike-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/juejin-pub/dist/index.js +22 -22
- package/plugins/publishings/juejin-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/linkedin-pub/dist/index.js +133 -33
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +27 -22
- package/plugins/publishings/linkedin-pub/src/index.ts +192 -18
- package/plugins/publishings/medium-pub/dist/index.js +9 -9
- package/plugins/publishings/podcast-pub/dist/index.js +240 -37
- package/plugins/publishings/podcast-pub/src/index.ts +154 -3
- package/plugins/publishings/podcast-pub/src/seo.ts +25 -8
- package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +93 -23
- package/plugins/publishings/podcast-pub/src/show-notes.ts +26 -6
- package/plugins/publishings/qiita-pub/dist/index.js +9 -9
- package/plugins/publishings/shipinhao-pub/dist/index.js +23 -23
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +23 -23
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +2 -1
- package/plugins/publishings/sspai-pub/dist/index.js +22 -22
- package/plugins/publishings/sspai-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/substack-pub/dist/index.js +22 -22
- package/plugins/publishings/substack-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/surfdash-pub/dist/index.js +207 -95
- package/plugins/publishings/surfdash-pub/src/digest-check.ts +30 -1
- package/plugins/publishings/surfdash-pub/src/index.ts +101 -76
- package/plugins/publishings/surfdash-pub/src/media-upload.ts +83 -0
- package/plugins/publishings/surfdash-pub/src/patch.ts +49 -26
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +12 -4
- package/plugins/publishings/threads-pub/dist/index.js +83 -27
- package/plugins/publishings/threads-pub/dist/profile-check.js +34 -23
- package/plugins/publishings/threads-pub/src/post-rail.ts +121 -4
- package/plugins/publishings/wechatmp-pub/dist/index.js +274 -98
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +27 -23
- package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +87 -53
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +117 -13
- package/plugins/publishings/wechatmp-pub/src/flow.ts +183 -43
- package/plugins/publishings/wechatmp-pub/src/modes.ts +30 -12
- package/plugins/publishings/weibo-pub/dist/index.js +22 -22
- package/plugins/publishings/weibo-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/x-pub/dist/index.js +113 -32
- package/plugins/publishings/x-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/x-pub/src/post-rail.ts +155 -20
- package/plugins/publishings/xhs-pub/dist/index.js +22 -22
- package/plugins/publishings/xhs-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +22 -22
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +22 -22
- 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
|
-
|
|
393
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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). */
|