@gobing-ai/knowledge-kit 0.1.19 → 0.1.22
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/board/collect/index.js +1 -0
- package/dist/board/daily-voice/index.js +1315 -264
- package/dist/board/itc/index.js +1 -0
- package/dist/index.js +14674 -8775
- package/package.json +1 -1
- package/plugins/generations/dailynews-gen/dist/index.js +285 -16
- package/plugins/generations/dailynews-gen/src/editorial-claims.ts +215 -0
- package/plugins/generations/dailynews-gen/src/index.ts +23 -4
- package/plugins/generations/dailynews-gen/src/script-builder.ts +10 -3
- package/plugins/generations/dailynews-gen/src/script-plan.ts +74 -14
- package/plugins/generations/image-gen/README.md +31 -31
- package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
- package/plugins/generations/image-gen/config.example.yaml +3 -0
- package/plugins/generations/image-gen/dist/index.js +154 -14
- package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
- package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
- package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
- package/plugins/generations/image-gen/src/presets.ts +6 -5
- package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
- package/plugins/generations/image-gen/src/providers/types.ts +11 -1
- package/plugins/generations/music-gen/README.md +277 -0
- package/plugins/generations/music-gen/dist/index.js +23544 -0
- package/plugins/generations/music-gen/package.json +24 -0
- package/plugins/generations/music-gen/plugin.json +23 -0
- package/plugins/generations/music-gen/presets/SOURCE.md +39 -0
- package/plugins/generations/music-gen/presets/formats/clip.yaml +21 -0
- package/plugins/generations/music-gen/presets/formats/jingle.yaml +22 -0
- package/plugins/generations/music-gen/presets/formats/loop.yaml +21 -0
- package/plugins/generations/music-gen/presets/formats/song.yaml +31 -0
- package/plugins/generations/music-gen/presets/formats/underscore.yaml +22 -0
- package/plugins/generations/music-gen/presets/themes/ambient-tech.yaml +30 -0
- package/plugins/generations/music-gen/presets/themes/cinematic.yaml +30 -0
- package/plugins/generations/music-gen/presets/themes/lofi.yaml +30 -0
- package/plugins/generations/music-gen/presets/themes/synthwave.yaml +30 -0
- package/plugins/generations/music-gen/scripts/gen-preset-index.ts +181 -0
- package/plugins/generations/music-gen/scripts/resolve-preset.ts +64 -0
- package/plugins/generations/music-gen/src/adapter/index.ts +35 -0
- package/plugins/generations/music-gen/src/adapter/instance.ts +904 -0
- package/plugins/generations/music-gen/src/adapter/offline.ts +124 -0
- package/plugins/generations/music-gen/src/artifact.ts +223 -0
- package/plugins/generations/music-gen/src/audio/checks.ts +618 -0
- package/plugins/generations/music-gen/src/audio/master.ts +267 -0
- package/plugins/generations/music-gen/src/audio/measure.ts +507 -0
- package/plugins/generations/music-gen/src/audio/profile.ts +131 -0
- package/plugins/generations/music-gen/src/audio.ts +122 -0
- package/plugins/generations/music-gen/src/brief.ts +191 -0
- package/plugins/generations/music-gen/src/config.ts +451 -0
- package/plugins/generations/music-gen/src/content.ts +199 -0
- package/plugins/generations/music-gen/src/digest.ts +100 -0
- package/plugins/generations/music-gen/src/index.ts +147 -0
- package/plugins/generations/music-gen/src/job.ts +131 -0
- package/plugins/generations/music-gen/src/plugin.ts +371 -0
- package/plugins/generations/music-gen/src/presets.ts +918 -0
- package/plugins/generations/music-gen/src/render.ts +87 -0
- package/plugins/generations/music-gen/src/request.ts +102 -0
- package/plugins/generations/music-gen/src/spend.ts +495 -0
- package/plugins/generations/music-gen/tsconfig.json +8 -0
- package/plugins/kk/config.example.yaml +3 -0
- package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice.json +48 -7
- package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +2 -1
- package/plugins/kk/scripts/cover-compositor.ts +380 -32
- package/plugins/kk/scripts/daily-cover-mock.ts +40 -3
- package/plugins/kk/scripts/daily-stages.ts +897 -34
- package/plugins/kk/scripts/episode-identity.ts +180 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +37 -1
- package/plugins/kk/scripts/music-stages.ts +624 -0
- package/plugins/kk/scripts/news-editorial-ledger.ts +906 -0
- package/plugins/kk/scripts/source-citation.ts +187 -0
- package/plugins/kk/scripts/topic-selection-attempts.ts +446 -0
- package/plugins/kk/scripts/topic-selection-calibration.ts +161 -0
- package/plugins/kk/skills/content-judge/SKILL.md +11 -6
- package/plugins/kk/skills/content-judge/references/music-quality-rubric.md +147 -0
- package/plugins/kk/skills/content-judge/references/rubrics.md +15 -0
- package/plugins/kk/skills/content-safety/SKILL.md +12 -0
- package/plugins/kk/skills/image-authoring/SKILL.md +7 -3
- package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
- package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
- package/plugins/kk/skills/music-authoring/SKILL.md +276 -0
- package/plugins/kk/skills/music-authoring/references/judge-input.md +117 -0
- package/plugins/kk/skills/news-editorial/SKILL.md +102 -15
- package/plugins/kk/skills/news-editorial/references/selection.md +4 -0
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +58 -11
- package/plugins/kk/skills/publish/SKILL.md +11 -0
- package/plugins/kk/skills/web-automation/SKILL.md +31 -1
- package/plugins/kk/workflows/kk-collect.yaml +8 -4
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +10 -9
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +11 -9
- package/plugins/kk/workflows/kk-music.yaml +328 -0
- package/plugins/kk/workflows/kk-news-generate.yaml +58 -3
- package/plugins/publishings/bilibili-pub/dist/index.js +11 -1
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/cnblogs-pub/dist/index.js +11 -1
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/csdn-pub/dist/index.js +11 -1
- package/plugins/publishings/csdn-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/infoq-pub/dist/index.js +11 -1
- package/plugins/publishings/infoq-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/jike-pub/dist/index.js +11 -1
- package/plugins/publishings/jike-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/juejin-pub/dist/index.js +11 -1
- package/plugins/publishings/juejin-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/linkedin-pub/dist/index.js +54 -7
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +43 -6
- package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
- package/plugins/publishings/podcast-pub/dist/index.js +586 -20
- package/plugins/publishings/podcast-pub/src/corrections.ts +509 -0
- package/plugins/publishings/podcast-pub/src/index.ts +257 -5
- package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +240 -0
- package/plugins/publishings/podcast-pub/src/show-notes.ts +69 -13
- package/plugins/publishings/shipinhao-pub/dist/index.js +437 -32
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +14 -2
- package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
- package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +492 -0
- package/plugins/publishings/shipinhao-pub/src/flow.ts +227 -12
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
- package/plugins/publishings/sspai-pub/dist/index.js +11 -1
- package/plugins/publishings/sspai-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/substack-pub/dist/index.js +11 -1
- package/plugins/publishings/substack-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/surfdash-pub/dist/index.js +122 -28
- package/plugins/publishings/surfdash-pub/src/digest-check.ts +7 -3
- package/plugins/publishings/surfdash-pub/src/index.ts +159 -25
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +37 -4
- package/plugins/publishings/threads-pub/dist/index.js +9206 -296
- package/plugins/publishings/threads-pub/dist/profile-check.js +21149 -0
- package/plugins/publishings/threads-pub/package.json +3 -1
- package/plugins/publishings/threads-pub/plugin.json +6 -1
- package/plugins/publishings/threads-pub/src/index.ts +8 -1
- package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
- package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +18 -1
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/wechatmp-pub/src/flow.ts +13 -0
- package/plugins/publishings/weibo-pub/dist/index.js +57 -3
- package/plugins/publishings/weibo-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/weibo-pub/src/index.ts +74 -2
- package/plugins/publishings/x-pub/dist/index.js +274 -44
- package/plugins/publishings/x-pub/dist/profile-check.js +14 -2
- package/plugins/publishings/x-pub/src/index.ts +15 -1
- package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
- package/plugins/publishings/xhs-pub/dist/index.js +11 -1
- package/plugins/publishings/xhs-pub/dist/profile-check.js +11 -1
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +11 -1
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +11 -1
|
@@ -20,9 +20,10 @@ import {
|
|
|
20
20
|
type TimelineStyle,
|
|
21
21
|
warn,
|
|
22
22
|
} from './seo';
|
|
23
|
+
import { CARDS_STYLE } from './show-notes-brief';
|
|
23
24
|
|
|
24
25
|
/** Escapes text content and attribute values (`&`, `<`, `>`, `"`). */
|
|
25
|
-
function escapeHtml(value: string): string {
|
|
26
|
+
export function escapeHtml(value: string): string {
|
|
26
27
|
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"');
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -49,7 +50,7 @@ function normalizeForMatch(text: string): string {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
/** `m:ss` audio offset, or `--:--` when unknown. */
|
|
52
|
-
function formatOffset(seconds: number): string {
|
|
53
|
+
export function formatOffset(seconds: number): string {
|
|
53
54
|
if (!Number.isFinite(seconds) || seconds < 0) return '--:--';
|
|
54
55
|
const m = Math.floor(seconds / 60);
|
|
55
56
|
const s = Math.round(seconds % 60);
|
|
@@ -172,6 +173,21 @@ ${after}${articleTail}
|
|
|
172
173
|
<!--/kk:timeline-->`;
|
|
173
174
|
}
|
|
174
175
|
|
|
176
|
+
/**
|
|
177
|
+
* 0386 R1 — the card-region counterpart of {@link isGeneratedTimeline}: a `<!--kk:cards-->` block is
|
|
178
|
+
* trusted only if it is markup {@link renderCardsRegion} (show-notes-brief.ts) could have produced.
|
|
179
|
+
* The card region is the only place an `<img>` legitimately appears in show notes, so its grammar is
|
|
180
|
+
* pinned here rather than widening the timeline grammar.
|
|
181
|
+
*/
|
|
182
|
+
const CARDS_TAG =
|
|
183
|
+
/^<\/?(?:div|figure|figcaption|span|p|img)(?:\s+(?:class="kk-cards"|class="kk-card"|class="kk-card-n"|src="https?:\/\/[^"<>\s]*"|alt="[^"<>]*"|loading="lazy"))*\s*\/?>$/;
|
|
184
|
+
|
|
185
|
+
function isGeneratedCards(block: string): boolean {
|
|
186
|
+
const rest = block.replace(CARDS_STYLE, '');
|
|
187
|
+
if (rest.includes('<style') || rest.includes('<!--') || rest.includes('<script')) return false;
|
|
188
|
+
return (rest.match(/<[^>]*>/g) ?? []).every((tag) => CARDS_TAG.test(tag)) && !/<(?![^>]*>)/.test(rest);
|
|
189
|
+
}
|
|
190
|
+
|
|
175
191
|
/**
|
|
176
192
|
* Renders show-notes markdown to sanitized HTML.
|
|
177
193
|
* The leading `# ` heading is dropped: the episode `title` is rendered
|
|
@@ -182,7 +198,9 @@ ${after}${articleTail}
|
|
|
182
198
|
export function renderShowNotesHtml(markdown: string): string {
|
|
183
199
|
const blocks: string[] = [];
|
|
184
200
|
const timeline: string[] = [];
|
|
201
|
+
const cards: string[] = [];
|
|
185
202
|
let inTimeline = false;
|
|
203
|
+
let inCards = false;
|
|
186
204
|
let paragraph: string[] = [];
|
|
187
205
|
|
|
188
206
|
const flush = () => {
|
|
@@ -210,6 +228,31 @@ export function renderShowNotesHtml(markdown: string): string {
|
|
|
210
228
|
inTimeline = true;
|
|
211
229
|
continue;
|
|
212
230
|
}
|
|
231
|
+
if (line === '<!--kk:cards-->') {
|
|
232
|
+
flush();
|
|
233
|
+
inCards = true;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (inCards) {
|
|
237
|
+
if (line === '<!--/kk:cards-->') {
|
|
238
|
+
inCards = false;
|
|
239
|
+
// Same trust rule as the timeline markers: pass a generator-shaped card block
|
|
240
|
+
// through, escape anything else line by line (R2: never widen the HTML surface).
|
|
241
|
+
if (isGeneratedCards(cards.join('\n'))) {
|
|
242
|
+
blocks.push(cards.join('\n'));
|
|
243
|
+
} else {
|
|
244
|
+
for (const l of cards) {
|
|
245
|
+
const t = l.trim();
|
|
246
|
+
if (t.length > 0) paragraph.push(t);
|
|
247
|
+
}
|
|
248
|
+
flush();
|
|
249
|
+
}
|
|
250
|
+
cards.length = 0;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
cards.push(rawLine);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
213
256
|
if (inTimeline) {
|
|
214
257
|
if (line === '<!--/kk:timeline-->') {
|
|
215
258
|
inTimeline = false;
|
|
@@ -248,6 +291,14 @@ export function renderShowNotesHtml(markdown: string): string {
|
|
|
248
291
|
flush();
|
|
249
292
|
// An unclosed marker never reaches the closing branch above — escape whatever it buffered.
|
|
250
293
|
if (timeline.length > 0) escapeBufferedTimeline();
|
|
294
|
+
if (cards.length > 0) {
|
|
295
|
+
for (const l of cards) {
|
|
296
|
+
const t = l.trim();
|
|
297
|
+
if (t.length > 0) paragraph.push(t);
|
|
298
|
+
}
|
|
299
|
+
cards.length = 0;
|
|
300
|
+
flush();
|
|
301
|
+
}
|
|
251
302
|
return blocks.join('\n');
|
|
252
303
|
}
|
|
253
304
|
|
|
@@ -308,7 +359,7 @@ export interface ShowNotesRenderOptions {
|
|
|
308
359
|
}
|
|
309
360
|
|
|
310
361
|
/** Per-item 1–2-sentence briefing: `metadata.brief` first, body sentences as fallback. */
|
|
311
|
-
function itemBrief(d: Doc): string {
|
|
362
|
+
export function itemBrief(d: Doc): string {
|
|
312
363
|
const meta = d.metadata ?? {};
|
|
313
364
|
if (typeof meta.brief === 'string' && meta.brief.trim().length > 0) return meta.brief.trim();
|
|
314
365
|
return splitSentences((d.body ?? '').trim(), { cjkOnly: true })
|
|
@@ -316,6 +367,20 @@ function itemBrief(d: Doc): string {
|
|
|
316
367
|
.join('');
|
|
317
368
|
}
|
|
318
369
|
|
|
370
|
+
/**
|
|
371
|
+
* The 0394/0386 source label of one item: the plan's `metadata.sourceName`, else the URL host,
|
|
372
|
+
* else the bare 「来源」. One convention shared by the timeline and the brief renderer.
|
|
373
|
+
*/
|
|
374
|
+
export function sourceLabelFor(doc: Doc): string {
|
|
375
|
+
const metadata = doc.metadata ?? {};
|
|
376
|
+
if (typeof metadata.sourceName === 'string' && metadata.sourceName.trim()) return metadata.sourceName.trim();
|
|
377
|
+
try {
|
|
378
|
+
return new URL(doc.sourceUri ?? '').hostname.replace(/^www\./, '');
|
|
379
|
+
} catch {
|
|
380
|
+
return '来源';
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
319
384
|
/**
|
|
320
385
|
* Renders the episode show-notes markdown from a plan Doc[] — plugin-owned port
|
|
321
386
|
* of the workflow's inline show-notes bun -e (design L1 R6; the workflow keeps
|
|
@@ -353,15 +418,6 @@ export function renderShowNotesMarkdown(docs: Doc[], opts: ShowNotesRenderOption
|
|
|
353
418
|
warn('brief mode requested but ARTICLE_POST_PATH is empty; using legacy layout', warnings);
|
|
354
419
|
}
|
|
355
420
|
const briefMode = opts.briefMode === true && postSlug.length > 0;
|
|
356
|
-
const sourceLabel = (d: Doc): string => {
|
|
357
|
-
const m = d.metadata ?? {};
|
|
358
|
-
if (typeof m.sourceName === 'string' && m.sourceName.trim()) return m.sourceName.trim();
|
|
359
|
-
try {
|
|
360
|
-
return new URL(d.sourceUri ?? '').hostname.replace(/^www\./, '');
|
|
361
|
-
} catch {
|
|
362
|
-
return '来源';
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
421
|
const offsets = computeAudioOffsets(docs, opts.audioSegments);
|
|
366
422
|
const lines: string[] = [`# ${opts.title}`, ''];
|
|
367
423
|
const summaryOn = opts.summaryParagraph !== false;
|
|
@@ -411,7 +467,7 @@ export function renderShowNotesMarkdown(docs: Doc[], opts: ShowNotesRenderOption
|
|
|
411
467
|
'',
|
|
412
468
|
sentences,
|
|
413
469
|
'',
|
|
414
|
-
`[来源:${
|
|
470
|
+
`[来源:${sourceLabelFor(d)}](${d.sourceUri ?? ''})`,
|
|
415
471
|
'',
|
|
416
472
|
);
|
|
417
473
|
});
|