@gobing-ai/knowledge-kit 0.0.11 → 0.0.13

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 (99) hide show
  1. package/dist/index.js +451 -152
  2. package/package.json +1 -1
  3. package/plugins/generations/content-gen/dist/index.js +22167 -0
  4. package/plugins/generations/content-gen/plugin.json +1 -1
  5. package/plugins/generations/content-gen/src/storm.ts +99 -50
  6. package/plugins/generations/core-facts-gen/dist/index.js +22048 -0
  7. package/plugins/generations/core-facts-gen/package.json +17 -0
  8. package/plugins/generations/core-facts-gen/plugin.json +7 -0
  9. package/plugins/generations/core-facts-gen/src/index.ts +116 -0
  10. package/plugins/generations/core-facts-gen/tsconfig.json +4 -0
  11. package/plugins/generations/daily-article-gen/dist/index.js +22022 -0
  12. package/plugins/generations/daily-article-gen/package.json +17 -0
  13. package/plugins/generations/daily-article-gen/plugin.json +7 -0
  14. package/plugins/generations/daily-article-gen/src/index.ts +91 -0
  15. package/plugins/generations/daily-article-gen/tsconfig.json +4 -0
  16. package/plugins/generations/dailynews-gen/dist/index.js +22324 -0
  17. package/plugins/generations/dailynews-gen/plugin.json +1 -1
  18. package/plugins/generations/dailynews-gen/src/index.ts +11 -0
  19. package/plugins/generations/dailynews-gen/src/script-builder.ts +1 -1
  20. package/plugins/generations/episode-plan-gen/dist/index.js +22479 -0
  21. package/plugins/generations/episode-plan-gen/package.json +17 -0
  22. package/plugins/generations/episode-plan-gen/plugin.json +7 -0
  23. package/plugins/generations/episode-plan-gen/src/index.ts +726 -0
  24. package/plugins/generations/episode-plan-gen/tsconfig.json +4 -0
  25. package/plugins/generations/image-gen/config.example.yaml +75 -0
  26. package/plugins/generations/image-gen/dist/index.js +22619 -0
  27. package/plugins/generations/image-gen/package.json +17 -0
  28. package/plugins/generations/image-gen/plugin.json +7 -0
  29. package/plugins/generations/image-gen/presets/formats/cover.yaml +57 -0
  30. package/plugins/generations/image-gen/presets/formats/free.yaml +46 -0
  31. package/plugins/generations/image-gen/presets/formats/illustration.yaml +48 -0
  32. package/plugins/generations/image-gen/presets/styles/clean-webapp-ui.yaml +28 -0
  33. package/plugins/generations/image-gen/presets/styles/cute.yaml +3 -0
  34. package/plugins/generations/image-gen/presets/styles/editorial.yaml +3 -0
  35. package/plugins/generations/image-gen/presets/styles/fresh.yaml +3 -0
  36. package/plugins/generations/image-gen/presets/styles/minimalist.yaml +3 -0
  37. package/plugins/generations/image-gen/presets/styles/photorealistic.yaml +3 -0
  38. package/plugins/generations/image-gen/presets/styles/sketch.yaml +3 -0
  39. package/plugins/generations/image-gen/presets/styles/technical-diagram.yaml +3 -0
  40. package/plugins/generations/image-gen/presets/styles/vibrant.yaml +3 -0
  41. package/plugins/generations/image-gen/presets/styles/warm.yaml +3 -0
  42. package/plugins/generations/image-gen/src/bytes.ts +19 -0
  43. package/plugins/generations/image-gen/src/index.ts +319 -0
  44. package/plugins/generations/image-gen/src/job.ts +143 -0
  45. package/plugins/generations/image-gen/src/paths.ts +31 -0
  46. package/plugins/generations/image-gen/src/presets.ts +344 -0
  47. package/plugins/generations/image-gen/src/providers/seedream.ts +128 -0
  48. package/plugins/generations/image-gen/src/providers/types.ts +285 -0
  49. package/plugins/generations/image-gen/tsconfig.json +8 -0
  50. package/plugins/generations/voice-gen/dist/index.js +23027 -0
  51. package/plugins/generations/voice-gen/plugin.json +1 -1
  52. package/plugins/generations/voice-gen/src/index.ts +102 -11
  53. package/plugins/generations/voice-gen/src/qc.ts +154 -9
  54. package/plugins/ingestions/aihot-ingest/dist/index.js +22358 -0
  55. package/plugins/ingestions/aihot-ingest/plugin.json +2 -2
  56. package/plugins/ingestions/aihot-ingest/src/index.ts +72 -13
  57. package/plugins/ingestions/aihot-ingest/src/mapper.ts +1 -0
  58. package/plugins/ingestions/aihot-ingest/src/rss.ts +151 -0
  59. package/plugins/ingestions/horizon-ingest/dist/index.js +22105 -0
  60. package/plugins/ingestions/horizon-ingest/package.json +17 -0
  61. package/plugins/ingestions/horizon-ingest/plugin.json +7 -0
  62. package/plugins/ingestions/horizon-ingest/src/index.ts +205 -0
  63. package/plugins/ingestions/horizon-ingest/tsconfig.json +4 -0
  64. package/plugins/ingestions/karakeep-local/dist/index.js +24204 -0
  65. package/plugins/ingestions/karakeep-local/plugin.json +1 -1
  66. package/plugins/ingestions/last30days-ingest/dist/index.js +22050 -0
  67. package/plugins/ingestions/last30days-ingest/package.json +17 -0
  68. package/plugins/ingestions/last30days-ingest/plugin.json +7 -0
  69. package/plugins/ingestions/last30days-ingest/src/index.ts +148 -0
  70. package/plugins/ingestions/last30days-ingest/tsconfig.json +4 -0
  71. package/plugins/ingestions/web-search/dist/index.js +24379 -0
  72. package/plugins/ingestions/web-search/plugin.json +1 -1
  73. package/plugins/kk/commands/image-generate.md +15 -0
  74. package/plugins/kk/config.example.yaml +80 -0
  75. package/plugins/kk/skills/image-authoring/SKILL.md +250 -0
  76. package/plugins/kk/skills/image-authoring/references/illustration-positions.md +87 -0
  77. package/plugins/kk/skills/image-authoring/references/migrating-from-wt.md +31 -0
  78. package/plugins/kk/skills/image-authoring/references/providers.md +52 -0
  79. package/plugins/kk/skills/image-authoring/references/style-extraction.md +134 -0
  80. package/plugins/kk/skills/taste-unslop/SKILL.md +12 -6
  81. package/plugins/kk/skills/taste-unslop/references/pattern-guide.md +128 -48
  82. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +432 -19
  83. package/plugins/publishings/emdash-pub/dist/index.js +22243 -0
  84. package/plugins/publishings/emdash-pub/plugin.json +1 -1
  85. package/plugins/publishings/podcast-pub/dist/index.js +22596 -0
  86. package/plugins/publishings/podcast-pub/package.json +17 -0
  87. package/plugins/publishings/podcast-pub/plugin.json +13 -0
  88. package/plugins/publishings/podcast-pub/src/index.ts +538 -0
  89. package/plugins/publishings/podcast-pub/src/map.ts +165 -0
  90. package/plugins/publishings/podcast-pub/src/microfeed-client.ts +196 -0
  91. package/plugins/publishings/podcast-pub/src/show-notes.ts +132 -0
  92. package/plugins/publishings/podcast-pub/tsconfig.json +4 -0
  93. package/plugins/publishings/qiita-pub/dist/index.js +22081 -0
  94. package/plugins/publishings/qiita-pub/plugin.json +1 -1
  95. package/plugins/publishings/surfdash-pub/dist/index.js +22233 -0
  96. package/plugins/publishings/surfdash-pub/plugin.json +1 -1
  97. package/plugins/publishings/surfdash-pub/src/index.ts +328 -62
  98. package/plugins/publishings/zenn-pub/dist/index.js +22122 -0
  99. package/plugins/publishings/zenn-pub/plugin.json +1 -1
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@gobing-ai/last30days-ingest",
3
+ "type": "module",
4
+ "private": true,
5
+ "scripts": {
6
+ "typecheck": "tsc --noEmit"
7
+ },
8
+ "dependencies": {
9
+ "@gobing-ai/kk-core": "workspace:*",
10
+ "@gobing-ai/ts-runtime": "catalog:",
11
+ "@gobing-ai/ts-utils": "catalog:",
12
+ "zod": "4.4.3"
13
+ },
14
+ "devDependencies": {
15
+ "@types/bun": "1.3.14"
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "last30days-ingest",
3
+ "kind": "ingestion",
4
+ "entry": "./dist/index.js",
5
+ "version": "1.0.0",
6
+ "description": "Wraps the last30days skill CLI (agent JSON contract) into Doc[] — one Doc per results[] item"
7
+ }
@@ -0,0 +1,148 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { homedir } from 'node:os';
3
+ import { dirname, join } from 'node:path';
4
+ import { parseArgs } from 'node:util';
5
+ import { type Doc, DocListSchema } from '@gobing-ai/kk-core';
6
+ import { atomicWriteJson, createNodeFileSystem, readJsonFile } from '@gobing-ai/ts-runtime';
7
+ import { echoError } from '@gobing-ai/ts-utils';
8
+ import { z } from 'zod';
9
+
10
+ /**
11
+ * Ingestion adapter over the last30days skill CLI (task 0089 contract).
12
+ * Shells out to `last30days.py --emit=json --json-profile=agent`, captures the
13
+ * agent JSON from `--output`, and maps `results[]` → `Doc[]` (one Doc per item).
14
+ * Without `SETUP_COMPLETE` the tool self-degrades to keyless web search — that
15
+ * degraded `Doc[]` is still valid output (exit 0).
16
+ */
17
+
18
+ const InputConfigSchema = z.object({
19
+ topic: z.string().trim().min(1),
20
+ days: z.number().int().min(1).max(90).optional(),
21
+ web_backend: z.string().trim().min(1).optional(),
22
+ save_dir: z.string().trim().min(1).optional(),
23
+ });
24
+
25
+ export interface Last30DaysRunResult {
26
+ exitCode: number;
27
+ outputPath: string;
28
+ stderr: string;
29
+ }
30
+
31
+ /** Subprocess seam — tests inject a fake that writes a canned agent JSON. */
32
+ export type RunLast30Days = (
33
+ config: z.infer<typeof InputConfigSchema>,
34
+ outputPath: string,
35
+ ) => Promise<Last30DaysRunResult>;
36
+
37
+ export const defaultRunner: RunLast30Days = async (config, outputPath) => {
38
+ const skillDir = process.env.LAST30DAYS_SKILL_DIR ?? join(homedir(), '.agents', 'skills', 'last30days');
39
+ const argv = [
40
+ process.env.LAST30DAYS_PYTHON ?? 'python3',
41
+ join(skillDir, 'scripts', 'last30days.py'),
42
+ config.topic,
43
+ '--emit=json',
44
+ '--json-profile=agent',
45
+ '--output',
46
+ outputPath,
47
+ ];
48
+ if (config.days !== undefined) argv.push('--days', String(config.days));
49
+ if (config.web_backend !== undefined) argv.push('--web-backend', config.web_backend);
50
+ if (config.save_dir !== undefined) argv.push('--save-dir', config.save_dir);
51
+ const proc = Bun.spawnSync(argv, { cwd: skillDir, stdout: 'pipe', stderr: 'pipe' });
52
+ return { exitCode: proc.exitCode ?? 1, outputPath, stderr: proc.stderr.toString() };
53
+ };
54
+
55
+ const AgentJsonSchema = z.object({
56
+ schema_version: z.string().optional(),
57
+ window_days: z.number().optional(),
58
+ query: z.string().optional(),
59
+ results: z.array(z.record(z.string(), z.unknown())),
60
+ });
61
+
62
+ export function mapResultsToDocs(agentJson: unknown, topic: string): Doc[] {
63
+ const parsed = AgentJsonSchema.parse(agentJson);
64
+ const docs: Doc[] = [];
65
+ for (const item of parsed.results) {
66
+ try {
67
+ // Degraded/keyless mode uses the full URL as candidate_id — a 90-char URL id is
68
+ // brittle for downstream STORM citation (outline agents miscite them; dogfood
69
+ // run ff10095b failed assertKnownEvidence with 53 unknown IDs). Hash those.
70
+ const rawId =
71
+ typeof item.candidate_id === 'string' && item.candidate_id ? item.candidate_id : String(item.url ?? '');
72
+ const idSeed = rawId.startsWith('http')
73
+ ? createHash('sha256').update(rawId).digest('hex').slice(0, 16)
74
+ : rawId;
75
+ const doc: Doc = {
76
+ id: `last30days:${idSeed}`,
77
+ body: String(item.summary ?? ''),
78
+ };
79
+ if (typeof item.title === 'string' && item.title) doc.title = item.title;
80
+ if (typeof item.url === 'string' && item.url) doc.sourceUri = item.url;
81
+ doc.mediaType = 'text/markdown';
82
+ doc.metadata = {
83
+ topic,
84
+ window_days: parsed.window_days,
85
+ cluster: item.cluster,
86
+ source: item.source,
87
+ engagement: item.engagement,
88
+ relevance_score: item.relevance_score,
89
+ published_at: item.published_at,
90
+ schema_version: parsed.schema_version,
91
+ };
92
+ docs.push(doc);
93
+ } catch (err: unknown) {
94
+ echoError(
95
+ `last30days-ingest: skipping unparseable item (${err instanceof Error ? err.message : String(err)})`,
96
+ );
97
+ }
98
+ }
99
+ return DocListSchema.parse(docs);
100
+ }
101
+
102
+ export interface IngestionOptions {
103
+ out: string;
104
+ }
105
+
106
+ export async function processIngestionIO(
107
+ options: IngestionOptions,
108
+ config: z.infer<typeof InputConfigSchema>,
109
+ runner: RunLast30Days = defaultRunner,
110
+ ): Promise<{ docs: Doc[] }> {
111
+ const fs = createNodeFileSystem();
112
+ const outDir = dirname(options.out);
113
+ if (outDir && outDir !== '.') await fs.ensureDir(outDir);
114
+ const capturePath = join(outDir || '.', '.last30days-agent.json');
115
+ const run = await runner(config, capturePath);
116
+ if (run.exitCode !== 0) {
117
+ throw new Error(`last30days exited ${run.exitCode}: ${run.stderr.trim() || 'no stderr'}`);
118
+ }
119
+ const docs = mapResultsToDocs(await readJsonFile(capturePath), config.topic);
120
+ await atomicWriteJson(options.out, docs, fs);
121
+ return { docs };
122
+ }
123
+
124
+ export async function main(runner?: RunLast30Days): Promise<number> {
125
+ let values: { in?: string; out?: string };
126
+ try {
127
+ ({ values } = parseArgs({ options: { in: { type: 'string' }, out: { type: 'string' } } }));
128
+ } catch (err: unknown) {
129
+ echoError(`last30days-ingest failed: ${err instanceof Error ? err.message : String(err)}`);
130
+ return 1;
131
+ }
132
+ if (!values.in || !values.out) {
133
+ echoError('last30days-ingest failed: Missing required arguments: --in <config.json> --out <docs.json>');
134
+ return 1;
135
+ }
136
+ try {
137
+ const config = InputConfigSchema.parse(await readJsonFile(values.in));
138
+ await processIngestionIO({ out: values.out }, config, runner);
139
+ return 0;
140
+ } catch (err: unknown) {
141
+ echoError(`last30days-ingest failed: ${err instanceof Error ? err.message : String(err)}`);
142
+ return 1;
143
+ }
144
+ }
145
+
146
+ if (import.meta.main) {
147
+ process.exit(await main());
148
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tooling/typescript/base.json",
3
+ "include": ["src", "tests"]
4
+ }