@gobing-ai/knowledge-kit 0.0.19 → 0.0.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.
Files changed (69) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +161 -142
  3. package/package.json +1 -1
  4. package/plugins/generations/content-gen/dist/index.js +20 -3
  5. package/plugins/generations/core-facts-gen/dist/index.js +20 -3
  6. package/plugins/generations/daily-article-gen/dist/index.js +20 -3
  7. package/plugins/generations/dailynews-gen/dist/index.js +29 -4
  8. package/plugins/generations/dailynews-gen/src/script-builder.ts +19 -1
  9. package/plugins/generations/episode-plan-gen/dist/index.js +20 -3
  10. package/plugins/generations/image-gen/dist/index.js +147 -69
  11. package/plugins/generations/image-gen/src/presets.ts +2 -2
  12. package/plugins/generations/image-gen/src/providers/agnes.ts +6 -2
  13. package/plugins/generations/image-gen/src/providers/azure.ts +6 -2
  14. package/plugins/generations/image-gen/src/providers/dashscope.ts +10 -3
  15. package/plugins/generations/image-gen/src/providers/google.ts +70 -29
  16. package/plugins/generations/image-gen/src/providers/huggingface.ts +3 -0
  17. package/plugins/generations/image-gen/src/providers/jimeng.ts +9 -2
  18. package/plugins/generations/image-gen/src/providers/minimax.ts +10 -2
  19. package/plugins/generations/image-gen/src/providers/openai.ts +9 -3
  20. package/plugins/generations/image-gen/src/providers/openrouter.ts +16 -4
  21. package/plugins/generations/image-gen/src/providers/replicate.ts +13 -3
  22. package/plugins/generations/image-gen/src/providers/seedream.ts +4 -1
  23. package/plugins/generations/image-gen/src/providers/timeouts.ts +14 -0
  24. package/plugins/generations/image-gen/src/providers/types.ts +10 -0
  25. package/plugins/generations/image-gen/src/providers/zai.ts +4 -1
  26. package/plugins/generations/news-report-gen/dist/index.js +20 -3
  27. package/plugins/generations/omni-voice-gen/src/omni_voice_gen/pipeline.py +13 -5
  28. package/plugins/generations/omni-voice-gen/src/omni_voice_gen/qc.py +23 -15
  29. package/plugins/generations/voice-gen/dist/index.js +36 -10
  30. package/plugins/generations/voice-gen/src/voicebox-client.ts +18 -4
  31. package/plugins/generations/voice-gen/src/voicebox-server.ts +2 -1
  32. package/plugins/ingestions/aihot-ingest/dist/index.js +26 -6
  33. package/plugins/ingestions/aihot-ingest/plugin.json +1 -1
  34. package/plugins/ingestions/aihot-ingest/src/client.ts +5 -0
  35. package/plugins/ingestions/aihot-ingest/src/rss.ts +12 -2
  36. package/plugins/ingestions/horizon-ingest/dist/index.js +20 -3
  37. package/plugins/ingestions/last30days-ingest/dist/index.js +20 -3
  38. package/plugins/ingestions/web-search/dist/index.js +22 -3
  39. package/plugins/ingestions/web-search/src/index.ts +4 -0
  40. package/plugins/kk/commands/workflow-run.md +20 -6
  41. package/plugins/kk/plugin.json +1 -1
  42. package/plugins/kk/scripts/itc-stages.ts +563 -0
  43. package/plugins/kk/scripts/kk-workflow-stages.ts +125 -18
  44. package/plugins/kk/scripts/render-md.ts +7 -1
  45. package/plugins/kk/skills/article-adapt/SKILL.md +85 -0
  46. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +26 -16
  47. package/plugins/kk/workflows/kk-itc.yaml +461 -12
  48. package/plugins/publishings/emdash-pub/dist/index.js +76 -19
  49. package/plugins/publishings/emdash-pub/src/index.ts +4 -0
  50. package/plugins/publishings/infoq-pub/dist/index.js +74 -21
  51. package/plugins/publishings/juejin-pub/dist/index.js +74 -21
  52. package/plugins/publishings/medium-pub/dist/index.js +77 -19
  53. package/plugins/publishings/medium-pub/src/index.ts +5 -0
  54. package/plugins/publishings/podcast-pub/dist/index.js +130 -34
  55. package/plugins/publishings/podcast-pub/src/index.ts +20 -5
  56. package/plugins/publishings/podcast-pub/src/map.ts +11 -0
  57. package/plugins/publishings/podcast-pub/src/show-notes.ts +66 -13
  58. package/plugins/publishings/qiita-pub/dist/index.js +75 -18
  59. package/plugins/publishings/qiita-pub/src/index.ts +4 -0
  60. package/plugins/publishings/substack-pub/dist/index.js +74 -21
  61. package/plugins/publishings/surfdash-pub/dist/index.js +99 -62
  62. package/plugins/publishings/surfdash-pub/src/index.ts +60 -19
  63. package/plugins/publishings/wechatmp-pub/dist/index.js +79 -22
  64. package/plugins/publishings/wechatmp-pub/src/index.ts +12 -3
  65. package/plugins/publishings/x-pub/dist/index.js +56 -37
  66. package/plugins/publishings/x-pub/src/index.ts +4 -0
  67. package/plugins/publishings/xhs-pub/dist/index.js +74 -21
  68. package/plugins/publishings/zenn-pub/dist/index.js +103 -25
  69. package/plugins/publishings/zenn-pub/src/index.ts +43 -9
@@ -21782,6 +21782,22 @@ var ResultSchema = exports_external.object({
21782
21782
  error: exports_external.string().optional(),
21783
21783
  metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
21784
21784
  });
21785
+ var TargetOutcomeSchema = exports_external.object({
21786
+ target: exports_external.string(),
21787
+ ok: exports_external.boolean(),
21788
+ status: exports_external.enum(["published", "failed", "skipped"]),
21789
+ url: exports_external.string().optional(),
21790
+ id: exports_external.string().optional(),
21791
+ error: exports_external.string().optional(),
21792
+ durationMs: exports_external.number().optional(),
21793
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
21794
+ });
21795
+ var AggregateResultSchema = exports_external.object({
21796
+ ok: exports_external.boolean(),
21797
+ summary: exports_external.object({ total: exports_external.number(), succeeded: exports_external.number(), failed: exports_external.number(), skipped: exports_external.number() }),
21798
+ targets: exports_external.array(TargetOutcomeSchema),
21799
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
21800
+ });
21785
21801
  var DocListSchema = exports_external.array(DocSchema);
21786
21802
  var omniVoiceGenContentSchema = ContentSchema.extend({
21787
21803
  format: exports_external.literal("audio"),
@@ -21810,14 +21826,15 @@ var PluginKindSchema = exports_external.enum(PLUGIN_KINDS);
21810
21826
  // ../../packages/kk-core/src/manifest.ts
21811
21827
  init_zod();
21812
21828
  var OperationIOSchema = exports_external.enum(["doc-list", "markdown"]);
21813
- var PluginManifestSchema = exports_external.object({
21829
+ var PluginOperationSchema = exports_external.object({ input: OperationIOSchema, output: OperationIOSchema });
21830
+ var PluginManifestSchema = exports_external.looseObject({
21814
21831
  name: exports_external.string().min(1),
21815
21832
  kind: PluginKindSchema,
21816
21833
  entry: exports_external.string().min(1),
21817
21834
  version: exports_external.string().optional(),
21818
21835
  description: exports_external.string().optional(),
21819
- operations: exports_external.record(exports_external.string(), exports_external.object({ input: OperationIOSchema, output: OperationIOSchema })).optional()
21820
- }).passthrough();
21836
+ operations: exports_external.record(exports_external.string(), PluginOperationSchema).optional()
21837
+ });
21821
21838
  // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.39/node_modules/@gobing-ai/ts-runtime/dist/index.js
21822
21839
  init_file_system_node();
21823
21840
  init_config();
@@ -21843,42 +21860,81 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
21843
21860
  // ../../packages/kk-core/src/render-md.ts
21844
21861
  if (false) {}
21845
21862
  // ../../packages/publish-harness/src/index.ts
21846
- class FakeFileCliTransport {
21847
- kind = "file-cli";
21848
- callLogs;
21863
+ class FakeTransportCore {
21864
+ callLogs = [];
21849
21865
  nextResult;
21850
- constructor() {
21851
- this.callLogs = [];
21852
- }
21853
21866
  setNextResult(result) {
21854
21867
  this.nextResult = result;
21855
21868
  }
21856
- async publish(payload) {
21869
+ async publish(payload, defaultResult) {
21857
21870
  this.callLogs.push({
21858
21871
  timestamp: new Date().toISOString(),
21859
21872
  payload
21860
21873
  });
21861
- if (this.nextResult) {
21862
- return this.nextResult;
21863
- }
21864
- return {
21874
+ return this.nextResult ?? defaultResult;
21875
+ }
21876
+ getCallLogs() {
21877
+ return this.callLogs;
21878
+ }
21879
+ reset() {
21880
+ this.callLogs = [];
21881
+ this.nextResult = undefined;
21882
+ }
21883
+ }
21884
+
21885
+ class FakeFileCliTransport {
21886
+ kind = "file-cli";
21887
+ core = new FakeTransportCore;
21888
+ setNextResult(result) {
21889
+ this.core.setNextResult(result);
21890
+ }
21891
+ async publish(payload) {
21892
+ return this.core.publish(payload, {
21865
21893
  ok: true,
21866
21894
  target: "fake-file-cli",
21867
21895
  url: "https://example.com/published-post",
21868
21896
  id: "fake-id-123",
21869
21897
  message: "Published offline via FakeFileCliTransport"
21870
- };
21898
+ });
21871
21899
  }
21872
21900
  getCallLogs() {
21873
- return this.callLogs;
21901
+ return this.core.getCallLogs();
21874
21902
  }
21875
21903
  reset() {
21876
- this.callLogs = [];
21877
- this.nextResult = undefined;
21904
+ this.core.reset();
21905
+ }
21906
+ }
21907
+
21908
+ class FakeBrowserTransport {
21909
+ kind = "browser";
21910
+ driver;
21911
+ core = new FakeTransportCore;
21912
+ constructor(driver = "agent") {
21913
+ this.driver = driver;
21914
+ }
21915
+ setNextResult(result) {
21916
+ this.core.setNextResult(result);
21917
+ }
21918
+ async publish(payload) {
21919
+ return this.core.publish(payload, {
21920
+ ok: true,
21921
+ target: "fake-browser",
21922
+ url: "https://example.com/browser-draft",
21923
+ id: "fake-browser-id-123",
21924
+ message: "Published offline via FakeBrowserTransport",
21925
+ metadata: { driver: this.driver }
21926
+ });
21927
+ }
21928
+ getCallLogs() {
21929
+ return this.core.getCallLogs();
21930
+ }
21931
+ reset() {
21932
+ this.core.reset();
21878
21933
  }
21879
21934
  }
21880
21935
 
21881
21936
  // ../../plugins/publishings/zenn-pub/src/index.ts
21937
+ var ZENN_CLI_VERSION = "0.5.4";
21882
21938
  function slugify2(str) {
21883
21939
  return str.toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/[\s_]+/g, "-");
21884
21940
  }
@@ -21969,9 +22025,22 @@ class ZennCliFileCliTransport {
21969
22025
  });
21970
22026
  }
21971
22027
  const repoPath = repo.startsWith("~") ? join(homedir(), repo.slice(2)) : repo;
22028
+ const zennUsername = process.env.ZENN_USERNAME?.trim();
21972
22029
  try {
21973
22030
  await createNodeFileSystem().ensureDir(repoPath);
21974
- const cliArgs = ["--yes", "zenn", "new:article", "--slug", slug, "--title", title, "--type", type];
22031
+ const cliArgs = [
22032
+ "--yes",
22033
+ "--package",
22034
+ `zenn-cli@${ZENN_CLI_VERSION}`,
22035
+ "zenn",
22036
+ "new:article",
22037
+ "--slug",
22038
+ slug,
22039
+ "--title",
22040
+ title,
22041
+ "--type",
22042
+ type
22043
+ ];
21975
22044
  if (emoji3) {
21976
22045
  cliArgs.push("--emoji", emoji3);
21977
22046
  }
@@ -21988,13 +22057,15 @@ class ZennCliFileCliTransport {
21988
22057
  const articlePath = join(articleDir, `${slug}.md`);
21989
22058
  await createNodeFileSystem().writeFile(articlePath, markdown);
21990
22059
  if (published) {
22060
+ const articleRel = `articles/${slug}.md`;
21991
22061
  const gitSteps = [
21992
- ["add", `articles/${slug}.md`],
21993
- ["commit", "-m", `Add article: ${title}`],
21994
- ["push"]
22062
+ ["rev-parse", "--abbrev-ref", "HEAD"],
22063
+ ["add", "--", articleRel],
22064
+ ["commit", "-m", `Add article: ${title}`, "--", articleRel],
22065
+ ["push", "origin", "main"]
21995
22066
  ];
21996
22067
  for (const gitArgs of gitSteps) {
21997
- const [code, , stderr] = await this.runCli("git", gitArgs, repoPath);
22068
+ const [code, stdout, stderr] = await this.runCli("git", gitArgs, repoPath);
21998
22069
  if (code !== 0) {
21999
22070
  return ResultSchema.parse({
22000
22071
  ok: false,
@@ -22002,14 +22073,21 @@ class ZennCliFileCliTransport {
22002
22073
  error: `git ${gitArgs.join(" ")} failed (exit ${code}): ${stderr.trim() || "Unknown error"}`
22003
22074
  });
22004
22075
  }
22076
+ if (gitArgs[0] === "rev-parse" && stdout.trim() !== "main") {
22077
+ return ResultSchema.parse({
22078
+ ok: false,
22079
+ target: "zenn",
22080
+ error: `Zenn repo is on branch '${stdout.trim()}', not 'main' \u2014 Zenn deploys from main; refusing to commit`
22081
+ });
22082
+ }
22005
22083
  }
22006
22084
  }
22007
22085
  return ResultSchema.parse({
22008
22086
  ok: true,
22009
22087
  target: "zenn",
22010
- url: `https://zenn.dev/articles/${slug}`,
22088
+ url: zennUsername ? `https://zenn.dev/${zennUsername}/articles/${slug}` : undefined,
22011
22089
  id: slug,
22012
- message: published ? "Published to Zenn via Zenn CLI (article committed and pushed to GitHub)" : "Zenn draft article created (published: false; commit and push to deploy)"
22090
+ message: `${published ? "Published to Zenn via Zenn CLI (article committed and pushed to GitHub)" : "Zenn draft article created (published: false; commit and push to deploy)"}${zennUsername ? "" : " (set ZENN_USERNAME to report the article URL)"}`
22013
22091
  });
22014
22092
  } catch (err) {
22015
22093
  return ResultSchema.parse({
@@ -6,6 +6,14 @@ import { FakeFileCliTransport, type PublishTransport, type PublishTransportPaylo
6
6
  import { createNodeFileSystem } from '@gobing-ai/ts-runtime';
7
7
  import { echoError } from '@gobing-ai/ts-utils';
8
8
 
9
+ /**
10
+ * Pinned `zenn-cli` version. `npx <name>` resolves the npm package *named* `<name>`, and the
11
+ * package `zenn` was unpublished on 2021-04-20 — so `npx zenn` fails (or worse, runs whatever a
12
+ * future republisher ships, with `--yes` suppressing the prompt). `--package` names the real
13
+ * package explicitly.
14
+ */
15
+ const ZENN_CLI_VERSION = '0.5.4';
16
+
9
17
  /**
10
18
  * Converts a string into a lowercase hyphenated tag (slug) per the publish spec tags convention.
11
19
  */
@@ -161,11 +169,26 @@ export class ZennCliFileCliTransport implements PublishTransport {
161
169
  });
162
170
  }
163
171
  const repoPath = repo.startsWith('~') ? join(homedir(), repo.slice(2)) : repo;
172
+ // Zenn article URLs are `https://zenn.dev/<user>/articles/<slug>`; without the username the
173
+ // path is wrong (it 404s), so omit `url` rather than report a broken link.
174
+ const zennUsername = process.env.ZENN_USERNAME?.trim();
164
175
 
165
176
  try {
166
177
  await createNodeFileSystem().ensureDir(repoPath);
167
178
 
168
- const cliArgs = ['--yes', 'zenn', 'new:article', '--slug', slug, '--title', title, '--type', type];
179
+ const cliArgs = [
180
+ '--yes',
181
+ '--package',
182
+ `zenn-cli@${ZENN_CLI_VERSION}`,
183
+ 'zenn',
184
+ 'new:article',
185
+ '--slug',
186
+ slug,
187
+ '--title',
188
+ title,
189
+ '--type',
190
+ type,
191
+ ];
169
192
  if (emoji) {
170
193
  cliArgs.push('--emoji', emoji);
171
194
  }
@@ -184,13 +207,15 @@ export class ZennCliFileCliTransport implements PublishTransport {
184
207
  await createNodeFileSystem().writeFile(articlePath, markdown);
185
208
 
186
209
  if (published) {
210
+ const articleRel = `articles/${slug}.md`;
187
211
  const gitSteps: string[][] = [
188
- ['add', `articles/${slug}.md`],
189
- ['commit', '-m', `Add article: ${title}`],
190
- ['push'],
212
+ ['rev-parse', '--abbrev-ref', 'HEAD'],
213
+ ['add', '--', articleRel],
214
+ ['commit', '-m', `Add article: ${title}`, '--', articleRel],
215
+ ['push', 'origin', 'main'],
191
216
  ];
192
217
  for (const gitArgs of gitSteps) {
193
- const [code, , stderr] = await this.runCli('git', gitArgs, repoPath);
218
+ const [code, stdout, stderr] = await this.runCli('git', gitArgs, repoPath);
194
219
  if (code !== 0) {
195
220
  return ResultSchema.parse({
196
221
  ok: false,
@@ -198,17 +223,26 @@ export class ZennCliFileCliTransport implements PublishTransport {
198
223
  error: `git ${gitArgs.join(' ')} failed (exit ${code}): ${stderr.trim() || 'Unknown error'}`,
199
224
  });
200
225
  }
226
+ if (gitArgs[0] === 'rev-parse' && stdout.trim() !== 'main') {
227
+ return ResultSchema.parse({
228
+ ok: false,
229
+ target: 'zenn',
230
+ error: `Zenn repo is on branch '${stdout.trim()}', not 'main' — Zenn deploys from main; refusing to commit`,
231
+ });
232
+ }
201
233
  }
202
234
  }
203
235
 
204
236
  return ResultSchema.parse({
205
237
  ok: true,
206
238
  target: 'zenn',
207
- url: `https://zenn.dev/articles/${slug}`,
239
+ url: zennUsername ? `https://zenn.dev/${zennUsername}/articles/${slug}` : undefined,
208
240
  id: slug,
209
- message: published
210
- ? 'Published to Zenn via Zenn CLI (article committed and pushed to GitHub)'
211
- : 'Zenn draft article created (published: false; commit and push to deploy)',
241
+ message: `${
242
+ published
243
+ ? 'Published to Zenn via Zenn CLI (article committed and pushed to GitHub)'
244
+ : 'Zenn draft article created (published: false; commit and push to deploy)'
245
+ }${zennUsername ? '' : ' (set ZENN_USERNAME to report the article URL)'}`,
212
246
  });
213
247
  } catch (err: unknown) {
214
248
  return ResultSchema.parse({