@gobing-ai/knowledge-kit 0.1.24 → 0.1.25

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 (69) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +302 -59
  3. package/package.json +1 -1
  4. package/plugins/generations/episode-plan-gen/dist/index.js +47 -6
  5. package/plugins/generations/episode-plan-gen/src/index.ts +71 -7
  6. package/plugins/generations/music-gen/dist/index.js +17 -13
  7. package/plugins/generations/music-gen/src/audio/measure.ts +25 -20
  8. package/plugins/kk/decisions/extract/ai-news.yaml +8 -1
  9. package/plugins/kk/plugin.json +1 -1
  10. package/plugins/kk/publish-presets/daily-ai-voice.json +4 -4
  11. package/plugins/kk/publish-presets/itc-main.json +39 -23
  12. package/plugins/kk/scripts/daily-stages.ts +500 -33
  13. package/plugins/kk/scripts/kk-workflow-stages.ts +5 -0
  14. package/plugins/kk/skills/content-safety/references/platforms/apple-podcasts.md +12 -5
  15. package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +8 -0
  16. package/plugins/kk/skills/content-safety/references/platforms/xiaoyuzhou.md +5 -0
  17. package/plugins/kk/skills/daily-news-cover/SKILL.md +96 -0
  18. package/plugins/kk/skills/daily-news-illustrations/SKILL.md +123 -0
  19. package/plugins/kk/skills/news-editorial/SKILL.md +5 -3
  20. package/plugins/kk/skills/news-editorial/references/daily-visual-composition.md +150 -0
  21. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +1 -1
  22. package/plugins/kk/workflows/kk-article-generate.yaml +13 -1
  23. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +6 -3
  24. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +6 -4
  25. package/plugins/kk/workflows/kk-news-generate.yaml +71 -1
  26. package/plugins/publishings/bilibili-pub/dist/index.js +3 -2
  27. package/plugins/publishings/bilibili-pub/dist/profile-check.js +3 -2
  28. package/plugins/publishings/cnblogs-pub/dist/index.js +3 -2
  29. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +3 -2
  30. package/plugins/publishings/csdn-pub/dist/index.js +3 -2
  31. package/plugins/publishings/csdn-pub/dist/profile-check.js +3 -2
  32. package/plugins/publishings/infoq-pub/dist/index.js +3 -2
  33. package/plugins/publishings/infoq-pub/dist/profile-check.js +3 -2
  34. package/plugins/publishings/jike-pub/dist/index.js +3 -2
  35. package/plugins/publishings/jike-pub/dist/profile-check.js +3 -2
  36. package/plugins/publishings/juejin-pub/dist/index.js +3 -2
  37. package/plugins/publishings/juejin-pub/dist/profile-check.js +3 -2
  38. package/plugins/publishings/linkedin-pub/dist/index.js +3 -2
  39. package/plugins/publishings/linkedin-pub/dist/profile-check.js +3 -2
  40. package/plugins/publishings/medium-pub/dist/index.js +9198 -279
  41. package/plugins/publishings/medium-pub/dist/profile-check.js +21174 -0
  42. package/plugins/publishings/medium-pub/package.json +3 -1
  43. package/plugins/publishings/medium-pub/plugin.json +6 -1
  44. package/plugins/publishings/medium-pub/src/browser-rail.ts +280 -0
  45. package/plugins/publishings/medium-pub/src/index.ts +17 -1
  46. package/plugins/publishings/medium-pub/src/profile-check.ts +27 -0
  47. package/plugins/publishings/shipinhao-pub/dist/index.js +6 -3
  48. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +5 -3
  49. package/plugins/publishings/shipinhao-pub/src/flow.ts +5 -0
  50. package/plugins/publishings/shipinhao-pub/src/selectors.ts +11 -4
  51. package/plugins/publishings/sspai-pub/dist/index.js +3 -2
  52. package/plugins/publishings/sspai-pub/dist/profile-check.js +3 -2
  53. package/plugins/publishings/substack-pub/dist/index.js +3 -2
  54. package/plugins/publishings/substack-pub/dist/profile-check.js +3 -2
  55. package/plugins/publishings/threads-pub/dist/index.js +3 -2
  56. package/plugins/publishings/threads-pub/dist/profile-check.js +3 -2
  57. package/plugins/publishings/wechatmp-pub/dist/index.js +262 -42
  58. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +3 -2
  59. package/plugins/publishings/wechatmp-pub/src/flow.ts +447 -53
  60. package/plugins/publishings/wechatmp-pub/src/index.ts +4 -1
  61. package/plugins/publishings/wechatmp-pub/src/page.ts +8 -0
  62. package/plugins/publishings/weibo-pub/dist/index.js +3 -2
  63. package/plugins/publishings/weibo-pub/dist/profile-check.js +3 -2
  64. package/plugins/publishings/x-pub/dist/index.js +3 -2
  65. package/plugins/publishings/x-pub/dist/profile-check.js +3 -2
  66. package/plugins/publishings/xhs-pub/dist/index.js +3 -2
  67. package/plugins/publishings/xhs-pub/dist/profile-check.js +3 -2
  68. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +3 -2
  69. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/knowledge-kit",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "An ingest → create → publish content pipeline CLI (Bun).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12582,6 +12582,11 @@ function cleanBody(body) {
12582
12582
 
12583
12583
  `).trim();
12584
12584
  }
12585
+ var TRACKING_PARAMS = new Set(["ref", "ref_src", "fbclid", "gclid"]);
12586
+ function isTrackingParam(name) {
12587
+ const lower = name.toLowerCase();
12588
+ return lower.startsWith("utm_") || TRACKING_PARAMS.has(lower);
12589
+ }
12585
12590
  function normalizeUrl(raw) {
12586
12591
  if (!raw)
12587
12592
  return null;
@@ -12593,7 +12598,9 @@ function normalizeUrl(raw) {
12593
12598
  }
12594
12599
  const host = url.hostname.replace(/^(www|amp)\./, "");
12595
12600
  const path = url.pathname.replace(/\/+$/, "");
12596
- return `${url.protocol}//${host}${path}`;
12601
+ const kept = [...url.searchParams.entries()].filter(([name]) => !isTrackingParam(name)).sort(([aName, aValue], [bName, bValue]) => aName.localeCompare(bName) || aValue.localeCompare(bValue));
12602
+ const search = kept.length === 0 ? "" : `?${new URLSearchParams(kept).toString()}`;
12603
+ return `${url.protocol}//${host}${path}${search}`;
12597
12604
  }
12598
12605
  function asciiRatio(text) {
12599
12606
  const chars = [...text].filter((c) => !/\s/.test(c));
@@ -12808,12 +12815,13 @@ function planEpisode(docs, options) {
12808
12815
  }
12809
12816
  }
12810
12817
  const candidates = scored.filter((r) => !absorbed.has(r)).sort((a, b) => b.score - a.score);
12818
+ const perSourceCap = Math.max(1, options.perSourceCap ?? PER_SOURCE_CAP);
12811
12819
  const perSource = new Map;
12812
12820
  const selected = [];
12813
12821
  for (const record of candidates) {
12814
12822
  const source = sourceOf(record.doc);
12815
12823
  const count = perSource.get(source) ?? 0;
12816
- if (count >= PER_SOURCE_CAP) {
12824
+ if (count >= perSourceCap) {
12817
12825
  const row = rows?.get(record.doc);
12818
12826
  if (row)
12819
12827
  row.disposition = "cap";
@@ -12873,7 +12881,12 @@ ${items}
12873
12881
  `;
12874
12882
  }
12875
12883
  function docsToContent(docs, date, audit) {
12876
- const planned = planEpisode(docs, { maxItems: maxItemsFromEnv(), date, audit });
12884
+ const planned = planEpisode(docs, {
12885
+ maxItems: maxItemsFromEnv(),
12886
+ perSourceCap: perSourceCapFromEnv(),
12887
+ date,
12888
+ audit
12889
+ });
12877
12890
  return planContent(planned, date);
12878
12891
  }
12879
12892
  function planContent(docs, date) {
@@ -12896,6 +12909,13 @@ function maxItemsFromEnv() {
12896
12909
  const n = Number.parseInt(raw, 10);
12897
12910
  return Number.isFinite(n) && n > 0 ? n : 20;
12898
12911
  }
12912
+ function perSourceCapFromEnv() {
12913
+ const raw = process.env.EPISODE_PLAN_PER_SOURCE_CAP;
12914
+ if (raw === undefined || raw.trim() === "")
12915
+ return PER_SOURCE_CAP;
12916
+ const n = Number.parseInt(raw, 10);
12917
+ return Number.isFinite(n) && n > 0 ? n : PER_SOURCE_CAP;
12918
+ }
12899
12919
  function resolvePlanDate() {
12900
12920
  const raw = process.env.EPISODE_PLAN_DATE ?? new Date().toISOString().slice(0, 10);
12901
12921
  return raw.length === 8 ? `${raw.slice(0, 4)}-${raw.slice(4, 6)}-${raw.slice(6, 8)}` : raw;
@@ -12950,9 +12970,16 @@ function filterConfigFromEnv(env = process.env) {
12950
12970
  minImportance: parseFilterThreshold(env.QC_MIN_IMPORTANCE, "QC_MIN_IMPORTANCE", DEFAULT_FILTER_CONFIG.minImportance),
12951
12971
  minUrgency: parseFilterThreshold(env.QC_MIN_URGENCY, "QC_MIN_URGENCY", DEFAULT_FILTER_CONFIG.minUrgency),
12952
12972
  minImpact: parseFilterThreshold(env.QC_MIN_IMPACT, "QC_MIN_IMPACT", DEFAULT_FILTER_CONFIG.minImpact),
12953
- minEpisodeItems: parseFloorCount(env.QC_MIN_EPISODE_ITEMS, "QC_MIN_EPISODE_ITEMS", DEFAULT_FILTER_CONFIG.minEpisodeItems)
12973
+ minEpisodeItems: parseFloorCount(env.QC_MIN_EPISODE_ITEMS, "QC_MIN_EPISODE_ITEMS", DEFAULT_FILTER_CONFIG.minEpisodeItems),
12974
+ ...env.QC_MIN_CHARS !== undefined && env.QC_MIN_CHARS.trim() !== "" ? { minChars: parseOptionalNonNegativeInt(env.QC_MIN_CHARS, "QC_MIN_CHARS") } : {}
12954
12975
  };
12955
12976
  }
12977
+ function parseOptionalNonNegativeInt(raw, name) {
12978
+ const value = raw.trim();
12979
+ if (!/^\d+$/.test(value))
12980
+ throw new Error(`${name}='${raw}' is not a non-negative integer`);
12981
+ return Number.parseInt(value, 10);
12982
+ }
12956
12983
  function requireAnnotation(doc) {
12957
12984
  const meta = asRecord(doc.metadata);
12958
12985
  const category = meta.category;
@@ -13003,9 +13030,15 @@ function planScoreOf(doc) {
13003
13030
  const value = asRecord(doc.metadata).planScore;
13004
13031
  return typeof value === "number" ? value : 0;
13005
13032
  }
13033
+ function docChars(doc) {
13034
+ return (doc.title ?? "").length + (doc.body ?? "").length;
13035
+ }
13006
13036
  function backfillToFloor(kept, rejected, config) {
13007
- if (kept.length >= config.minEpisodeItems)
13037
+ const minChars = config.minChars ?? 0;
13038
+ let currentChars = kept.reduce((sum, doc) => sum + docChars(doc), 0);
13039
+ if (kept.length >= config.minEpisodeItems && (minChars <= 0 || currentChars >= minChars)) {
13008
13040
  return { kept, rejected, admitted: [] };
13041
+ }
13009
13042
  const eligible = rejected.map((entry, index) => ({ entry, index })).filter(({ entry }) => entry.reasons.length > 0 && entry.reasons.every((r) => r.startsWith("importance:")));
13010
13043
  eligible.sort((a, b) => {
13011
13044
  const byImportance = importanceOf(b.entry.doc) - importanceOf(a.entry.doc);
@@ -13016,7 +13049,15 @@ function backfillToFloor(kept, rejected, config) {
13016
13049
  return byPlanScore;
13017
13050
  return a.index - b.index;
13018
13051
  });
13019
- const taken = eligible.slice(0, config.minEpisodeItems - kept.length);
13052
+ const taken = [];
13053
+ for (const item of eligible) {
13054
+ const countMet = kept.length + taken.length >= config.minEpisodeItems;
13055
+ const charsMet = minChars <= 0 || currentChars >= minChars;
13056
+ if (countMet && charsMet)
13057
+ break;
13058
+ taken.push(item);
13059
+ currentChars += docChars(item.entry.doc);
13060
+ }
13020
13061
  const takenIds = new Set(taken.map(({ entry }) => entry.doc.id));
13021
13062
  const admitted = taken.map(({ entry }) => ({
13022
13063
  ...entry.doc,
@@ -187,6 +187,8 @@ const DEFAULT_IMPORTANCE = 2;
187
187
  export interface PlanOptions {
188
188
  maxItems: number;
189
189
  date?: string; // episode date (YYYY-MM-DD); freshness is judged against it, default today
190
+ /** Per-source slot cap (default PER_SOURCE_CAP = 5). */
191
+ perSourceCap?: number;
190
192
  /** Out-collector: when provided, receives one audit row per input doc (input order via rowsOf). */
191
193
  audit?: PlanAuditRow[];
192
194
  }
@@ -281,7 +283,26 @@ export function cleanBody(body: string): string {
281
283
  .trim();
282
284
  }
283
285
 
284
- /** Canonical URL key: drop query, fragment, trailing slash, `www.`/`amp.` prefixes. */
286
+ /**
287
+ * Campaign/click parameters that never carry content identity. Mirrors the store's
288
+ * `canonicalUrl` rule (`packages/kk-store/src/canonical-url.ts`) so a Doc dedups the same way
289
+ * before and after ingest.
290
+ */
291
+ const TRACKING_PARAMS = new Set(['ref', 'ref_src', 'fbclid', 'gclid']);
292
+
293
+ function isTrackingParam(name: string): boolean {
294
+ const lower = name.toLowerCase();
295
+ return lower.startsWith('utm_') || TRACKING_PARAMS.has(lower);
296
+ }
297
+
298
+ /**
299
+ * Canonical URL key: drop the fragment, tracking params, trailing slash and `www.`/`amp.` prefixes.
300
+ *
301
+ * The query is KEPT (minus tracking) because for a large share of sources it IS the identity:
302
+ * `youtube.com/watch?v=<id>` and `news.ycombinator.com/item?id=<id>` carry no path at all. Dropping
303
+ * it collapsed 60 distinct videos and every hackernews post into one key, so `planEpisode`'s URL
304
+ * dedup merged them away — 2026-11-23: a 40-doc pool reached the plan as 15 docs, 25 `url-merge`.
305
+ */
285
306
  export function normalizeUrl(raw: string | undefined): string | null {
286
307
  if (!raw) return null;
287
308
  let url: URL;
@@ -292,7 +313,11 @@ export function normalizeUrl(raw: string | undefined): string | null {
292
313
  }
293
314
  const host = url.hostname.replace(/^(www|amp)\./, '');
294
315
  const path = url.pathname.replace(/\/+$/, '');
295
- return `${url.protocol}//${host}${path}`;
316
+ const kept = [...url.searchParams.entries()]
317
+ .filter(([name]) => !isTrackingParam(name))
318
+ .sort(([aName, aValue], [bName, bValue]) => aName.localeCompare(bName) || aValue.localeCompare(bValue));
319
+ const search = kept.length === 0 ? '' : `?${new URLSearchParams(kept).toString()}`;
320
+ return `${url.protocol}//${host}${path}${search}`;
296
321
  }
297
322
 
298
323
  /** ASCII ratio of a string; > 0.5 on the title marks an English item. */
@@ -572,13 +597,14 @@ export function planEpisode(docs: Doc[], options: PlanOptions): Doc[] {
572
597
  }
573
598
 
574
599
  const candidates = scored.filter((r) => !absorbed.has(r)).sort((a, b) => b.score - a.score);
575
- // Per-source cap, applied in score order: one feed's flood stops at PER_SOURCE_CAP.
600
+ // Per-source cap, applied in score order: one feed's flood stops at perSourceCap.
601
+ const perSourceCap = Math.max(1, options.perSourceCap ?? PER_SOURCE_CAP);
576
602
  const perSource = new Map<string, number>();
577
603
  const selected: ScoredDoc[] = [];
578
604
  for (const record of candidates) {
579
605
  const source = sourceOf(record.doc);
580
606
  const count = perSource.get(source) ?? 0;
581
- if (count >= PER_SOURCE_CAP) {
607
+ if (count >= perSourceCap) {
582
608
  const row = rows?.get(record.doc);
583
609
  if (row) row.disposition = 'cap';
584
610
  continue;
@@ -637,7 +663,12 @@ export function renderPlanMarkdown(docs: Doc[], date: string): string {
637
663
 
638
664
  /** Build the plan Content; `metadata.docs` is the contract with the workflow. */
639
665
  export function docsToContent(docs: Doc[], date: string, audit?: PlanAuditRow[]): Content {
640
- const planned = planEpisode(docs, { maxItems: maxItemsFromEnv(), date, audit });
666
+ const planned = planEpisode(docs, {
667
+ maxItems: maxItemsFromEnv(),
668
+ perSourceCap: perSourceCapFromEnv(),
669
+ date,
670
+ audit,
671
+ });
641
672
  return planContent(planned, date);
642
673
  }
643
674
 
@@ -663,6 +694,13 @@ function maxItemsFromEnv(): number {
663
694
  return Number.isFinite(n) && n > 0 ? n : 20;
664
695
  }
665
696
 
697
+ function perSourceCapFromEnv(): number {
698
+ const raw = process.env.EPISODE_PLAN_PER_SOURCE_CAP;
699
+ if (raw === undefined || raw.trim() === '') return PER_SOURCE_CAP;
700
+ const n = Number.parseInt(raw, 10);
701
+ return Number.isFinite(n) && n > 0 ? n : PER_SOURCE_CAP;
702
+ }
703
+
666
704
  /** Plan date shared by both modes: `EPISODE_PLAN_DATE` (YYYYMMDD or ISO) else today UTC. */
667
705
  function resolvePlanDate(): string {
668
706
  const raw = process.env.EPISODE_PLAN_DATE ?? new Date().toISOString().slice(0, 10);
@@ -694,6 +732,8 @@ export interface FilterConfig {
694
732
  minImpact: number;
695
733
  /** Episode floor: when fewer docs survive, importance-only rejects backfill up to this count. */
696
734
  minEpisodeItems: number;
735
+ /** Optional spoken-duration character floor: backfill importance-only rejects until kept chars reach this. */
736
+ minChars?: number;
697
737
  }
698
738
 
699
739
  /** A doc the filter dropped, with every failed check (`category:not-in-allowlist`, `quality:2<3`, …). */
@@ -779,9 +819,18 @@ export function filterConfigFromEnv(env: Record<string, string | undefined> = pr
779
819
  'QC_MIN_EPISODE_ITEMS',
780
820
  DEFAULT_FILTER_CONFIG.minEpisodeItems,
781
821
  ),
822
+ ...(env.QC_MIN_CHARS !== undefined && env.QC_MIN_CHARS.trim() !== ''
823
+ ? { minChars: parseOptionalNonNegativeInt(env.QC_MIN_CHARS, 'QC_MIN_CHARS') }
824
+ : {}),
782
825
  };
783
826
  }
784
827
 
828
+ function parseOptionalNonNegativeInt(raw: string, name: string): number {
829
+ const value = raw.trim();
830
+ if (!/^\d+$/.test(value)) throw new Error(`${name}='${raw}' is not a non-negative integer`);
831
+ return Number.parseInt(value, 10);
832
+ }
833
+
785
834
  /** Read 0093's annotations off a filter input doc; fail loud naming the doc id — never silently pass unannotated docs. */
786
835
  function requireAnnotation(doc: Doc): { category: Category; scores: Record<QCDimension, number> } {
787
836
  const meta = asRecord(doc.metadata);
@@ -849,12 +898,20 @@ function planScoreOf(doc: Doc): number {
849
898
  * plan order. Admitted docs are stamped `metadata.backfilled: true` and leave the rejected
850
899
  * audit (they are spoken, not dropped). Pure: input docs are never mutated.
851
900
  */
901
+ function docChars(doc: Doc): number {
902
+ return (doc.title ?? '').length + (doc.body ?? '').length;
903
+ }
904
+
852
905
  export function backfillToFloor(
853
906
  kept: Doc[],
854
907
  rejected: RejectedDoc[],
855
908
  config: FilterConfig,
856
909
  ): { kept: Doc[]; rejected: RejectedDoc[]; admitted: Doc[] } {
857
- if (kept.length >= config.minEpisodeItems) return { kept, rejected, admitted: [] };
910
+ const minChars = config.minChars ?? 0;
911
+ let currentChars = kept.reduce((sum, doc) => sum + docChars(doc), 0);
912
+ if (kept.length >= config.minEpisodeItems && (minChars <= 0 || currentChars >= minChars)) {
913
+ return { kept, rejected, admitted: [] };
914
+ }
858
915
  const eligible = rejected
859
916
  .map((entry, index) => ({ entry, index }))
860
917
  .filter(({ entry }) => entry.reasons.length > 0 && entry.reasons.every((r) => r.startsWith('importance:')));
@@ -865,7 +922,14 @@ export function backfillToFloor(
865
922
  if (byPlanScore !== 0) return byPlanScore;
866
923
  return a.index - b.index;
867
924
  });
868
- const taken = eligible.slice(0, config.minEpisodeItems - kept.length);
925
+ const taken: Array<{ entry: RejectedDoc; index: number }> = [];
926
+ for (const item of eligible) {
927
+ const countMet = kept.length + taken.length >= config.minEpisodeItems;
928
+ const charsMet = minChars <= 0 || currentChars >= minChars;
929
+ if (countMet && charsMet) break;
930
+ taken.push(item);
931
+ currentChars += docChars(item.entry.doc);
932
+ }
869
933
  const takenIds = new Set(taken.map(({ entry }) => entry.doc.id));
870
934
  const admitted = taken.map(({ entry }) => ({
871
935
  ...entry.doc,
@@ -22607,19 +22607,22 @@ var SILENCE_EDGE_TOLERANCE_SECONDS = 0.05;
22607
22607
  var DEFAULT_SILENCE_NOISE_DB = -50;
22608
22608
  var DEFAULT_SILENCE_MIN_SECONDS = 0.5;
22609
22609
  var processExecutor = new NodeProcessExecutor;
22610
- var spawnRunner = async (argv) => {
22611
- const [bin, ...args] = argv;
22612
- if (bin === undefined) {
22613
- throw new AudioToolError("ffmpeg", "spawn", "no binary was given to the audio runner", "");
22614
- }
22615
- const result = await processExecutor.run({ command: bin, args, label: `audio ${bin}` });
22616
- if (result.exitCode === null) {
22617
- const detail = result.stderr.trim();
22618
- const killed = result.signal === undefined ? "" : ` (killed by ${result.signal})`;
22619
- throw new AudioToolError(bin, "spawn", `could not be executed${detail === "" ? "" : ` (${detail})`}${killed} \u2014 install ffmpeg or point ffmpegBin/ffprobeBin at it`, "");
22620
- }
22621
- return { exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr };
22622
- };
22610
+ function createSpawnRunner(executor = processExecutor) {
22611
+ return async (argv) => {
22612
+ const [bin, ...args] = argv;
22613
+ if (bin === undefined) {
22614
+ throw new AudioToolError("ffmpeg", "spawn", "no binary was given to the audio runner", "");
22615
+ }
22616
+ const result = await executor.run({ command: bin, args, label: `audio ${bin}` });
22617
+ if (result.exitCode === null) {
22618
+ const detail = result.stderr.trim();
22619
+ const killed = result.signal === undefined ? "" : ` (killed by ${result.signal})`;
22620
+ throw new AudioToolError(bin, "spawn", `could not be executed${detail === "" ? "" : ` (${detail})`}${killed} \u2014 install ffmpeg or point ffmpegBin/ffprobeBin at it`, "");
22621
+ }
22622
+ return { exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr };
22623
+ };
22624
+ }
22625
+ var spawnRunner = createSpawnRunner();
22623
22626
  function ffprobeArgs(path, bin = DEFAULT_FFPROBE_BIN) {
22624
22627
  return [bin, "-v", "error", "-print_format", "json", "-show_format", "-show_streams", path];
22625
22628
  }
@@ -23495,6 +23498,7 @@ export {
23495
23498
  createInstanceClient,
23496
23499
  createMusicInstance,
23497
23500
  createOfflineInstance,
23501
+ createSpawnRunner,
23498
23502
  definedDeliveryProfiles,
23499
23503
  detectAudioFormat,
23500
23504
  digestInput,
@@ -19,7 +19,7 @@
19
19
  * "measurement clean".
20
20
  */
21
21
 
22
- import { NodeProcessExecutor } from '@gobing-ai/ts-runtime';
22
+ import { NodeProcessExecutor, type ProcessExecutor } from '@gobing-ai/ts-runtime';
23
23
 
24
24
  /** One tool invocation's captured result. */
25
25
  export interface ToolOutput {
@@ -93,7 +93,7 @@ export const DEFAULT_SILENCE_MIN_SECONDS = 0.5;
93
93
  const processExecutor = new NodeProcessExecutor();
94
94
 
95
95
  /**
96
- * The default runner: the ts-runtime {@link ProcessExecutor} seam, buffered.
96
+ * Build an {@link AudioToolRunner} over any ts-runtime {@link ProcessExecutor}.
97
97
  *
98
98
  * `ProcessResult` reports `exitCode: number | null` and does not throw for a tool
99
99
  * it could not start, so this adapter keeps the {@link ToolOutput} shape the
@@ -101,24 +101,29 @@ const processExecutor = new NodeProcessExecutor();
101
101
  * a signal kill, both surfaced as {@link AudioToolError} kind `spawn` with the
102
102
  * install hint) and every real exit code passes through untouched.
103
103
  */
104
- export const spawnRunner: AudioToolRunner = async (argv) => {
105
- const [bin, ...args] = argv;
106
- if (bin === undefined) {
107
- throw new AudioToolError('ffmpeg', 'spawn', 'no binary was given to the audio runner', '');
108
- }
109
- const result = await processExecutor.run({ command: bin, args, label: `audio ${bin}` });
110
- if (result.exitCode === null) {
111
- const detail = result.stderr.trim();
112
- const killed = result.signal === undefined ? '' : ` (killed by ${result.signal})`;
113
- throw new AudioToolError(
114
- bin,
115
- 'spawn',
116
- `could not be executed${detail === '' ? '' : ` (${detail})`}${killed} — install ffmpeg or point ffmpegBin/ffprobeBin at it`,
117
- '',
118
- );
119
- }
120
- return { exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr };
121
- };
104
+ export function createSpawnRunner(executor: ProcessExecutor = processExecutor): AudioToolRunner {
105
+ return async (argv) => {
106
+ const [bin, ...args] = argv;
107
+ if (bin === undefined) {
108
+ throw new AudioToolError('ffmpeg', 'spawn', 'no binary was given to the audio runner', '');
109
+ }
110
+ const result = await executor.run({ command: bin, args, label: `audio ${bin}` });
111
+ if (result.exitCode === null) {
112
+ const detail = result.stderr.trim();
113
+ const killed = result.signal === undefined ? '' : ` (killed by ${result.signal})`;
114
+ throw new AudioToolError(
115
+ bin,
116
+ 'spawn',
117
+ `could not be executed${detail === '' ? '' : ` (${detail})`}${killed} — install ffmpeg or point ffmpegBin/ffprobeBin at it`,
118
+ '',
119
+ );
120
+ }
121
+ return { exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr };
122
+ };
123
+ }
124
+
125
+ /** The default runner: the ts-runtime {@link ProcessExecutor} seam, buffered. */
126
+ export const spawnRunner: AudioToolRunner = createSpawnRunner();
122
127
 
123
128
  /** Where the measurement comes from: binary names plus the injected runner. */
124
129
  export interface MeasureOptions {
@@ -39,4 +39,11 @@ where:
39
39
  # the pool shrinks rather than admitting an unjudged item. Chinese companies/models/industry do
40
40
  # not trip the gate: they score 0.
41
41
  kk-item-china-politics: { lte: 1 }
42
- order: [kk-item-urgency desc, kk-item-impact desc, first_seen_at desc]
42
+ # 2026-11-23: `kk-item-importance` sits between urgency and impact. With only
43
+ # `[urgency, impact]` a same-day tie was broken by raw engagement, so 60 last30days
44
+ # YouTube videos (importance 2, impact 5 from view counts) evicted every rss/hackernews
45
+ # story (importance 3, impact 1) from the capped pool: the day's 40-item pool held 35
46
+ # videos and 5 news items, QC then kept 5, and the episode refused at the 13 min floor.
47
+ # Importance IS the source-tier dimension, so it ranks above engagement; impact stays
48
+ # the tie-breaker inside one tier.
49
+ order: [kk-item-urgency desc, kk-item-importance desc, kk-item-impact desc, first_seen_at desc]
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "kk",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "knowledge-kit Claude Code plugin: skills, commands, subagents, hooks, and rules"
5
5
  }
@@ -95,7 +95,7 @@
95
95
  "operation": "post",
96
96
  "variant": "social:x",
97
97
  "tier": 3,
98
- "window": "overseas-rss",
98
+ "window": "after-generate",
99
99
  "mode": "live"
100
100
  },
101
101
  {
@@ -111,7 +111,7 @@
111
111
  "operation": "post",
112
112
  "variant": "social:threads",
113
113
  "tier": 3,
114
- "window": "overseas-rss",
114
+ "window": "after-generate",
115
115
  "mode": "live"
116
116
  },
117
117
  {
@@ -119,7 +119,7 @@
119
119
  "operation": "post",
120
120
  "variant": "social:linkedin",
121
121
  "tier": 3,
122
- "window": "overseas-rss",
122
+ "window": "after-generate",
123
123
  "mode": "live"
124
124
  },
125
125
  {
@@ -143,7 +143,7 @@
143
143
  "operation": "post",
144
144
  "variant": "social:jike",
145
145
  "tier": 3,
146
- "window": "overseas-rss",
146
+ "window": "after-generate",
147
147
  "mode": "live"
148
148
  }
149
149
  ],
@@ -12,58 +12,74 @@
12
12
  {
13
13
  "plugin": "infoq-pub",
14
14
  "profile": "article",
15
- "variant": "article",
16
- "tier": 0,
17
- "required": true
15
+ "variant": "zh-article",
16
+ "tier": 2,
17
+ "required": false,
18
+ "transport": "browser"
18
19
  },
19
20
  {
20
21
  "plugin": "juejin-pub",
21
22
  "profile": "article",
22
- "variant": "article",
23
- "tier": 0,
24
- "required": true
23
+ "variant": "zh-article",
24
+ "tier": 2,
25
+ "required": false,
26
+ "transport": "browser"
25
27
  },
26
28
  {
27
29
  "plugin": "wechatmp-pub",
28
30
  "profile": "article",
29
- "variant": "article",
30
- "tier": 0,
31
- "required": true
31
+ "operation": "文章",
32
+ "variant": "zh-article",
33
+ "tier": 2,
34
+ "required": false,
35
+ "transport": "browser"
32
36
  },
33
37
  {
34
38
  "plugin": "x-pub",
35
39
  "profile": "article-zh",
40
+ "operation": "article",
36
41
  "variant": "zh-article",
37
- "tier": 0,
38
- "required": true
42
+ "tier": 2,
43
+ "required": false,
44
+ "transport": "browser"
39
45
  },
40
46
  {
41
47
  "plugin": "zenn-pub",
42
48
  "profile": "article",
43
- "variant": "article",
44
- "tier": 0,
45
- "required": true
49
+ "variant": "ja-article",
50
+ "tier": 2,
51
+ "required": false
46
52
  },
47
53
  {
48
54
  "plugin": "qiita-pub",
49
55
  "profile": "article",
50
- "variant": "article",
51
- "tier": 0,
52
- "required": true
56
+ "variant": "ja-article",
57
+ "tier": 2,
58
+ "required": false
53
59
  },
54
60
  {
55
61
  "plugin": "medium-pub",
56
62
  "profile": "article",
57
- "variant": "article",
58
- "tier": 0,
59
- "required": true
63
+ "variant": "en-article",
64
+ "tier": 2,
65
+ "required": false
60
66
  },
61
67
  {
62
68
  "plugin": "substack-pub",
63
69
  "profile": "article",
64
- "variant": "article",
65
- "tier": 0,
66
- "required": true
70
+ "variant": "en-article",
71
+ "tier": 2,
72
+ "required": false,
73
+ "transport": "browser"
74
+ },
75
+ {
76
+ "plugin": "weibo-pub",
77
+ "profile": "article",
78
+ "operation": "article",
79
+ "variant": "zh-article",
80
+ "tier": 2,
81
+ "required": false,
82
+ "transport": "browser"
67
83
  }
68
84
  ]
69
85
  }