@gobing-ai/knowledge-kit 0.0.16 → 0.0.18
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/README.md +74 -0
- package/dist/index.js +46 -100
- package/package.json +19 -1
- package/plugins/generations/content-gen/dist/index.js +42 -94
- package/plugins/generations/core-facts-gen/dist/index.js +51 -100
- package/plugins/generations/daily-article-gen/dist/index.js +98 -100
- package/plugins/generations/daily-article-gen/src/index.ts +80 -6
- package/plugins/generations/dailynews-gen/dist/index.js +144 -130
- package/plugins/generations/dailynews-gen/src/script-builder.ts +141 -33
- package/plugins/generations/episode-plan-gen/dist/index.js +124 -115
- package/plugins/generations/episode-plan-gen/src/index.ts +111 -24
- package/plugins/generations/image-gen/dist/index.js +63 -115
- package/plugins/generations/news-report-gen/dist/index.js +164 -100
- package/plugins/generations/news-report-gen/src/index.ts +199 -7
- package/plugins/generations/omni-voice-gen/src/omni_voice_gen/pipeline.py +17 -1
- package/plugins/generations/omni-voice-gen/src/omni_voice_gen/qc.py +4 -22
- package/plugins/generations/omni-voice-gen/src/omni_voice_gen/voicescript.py +8 -0
- package/plugins/generations/voice-gen/dist/index.js +136 -117
- package/plugins/generations/voice-gen/src/concat.ts +34 -0
- package/plugins/generations/voice-gen/src/index.ts +6 -4
- package/plugins/generations/voice-gen/src/voicescript.ts +61 -0
- package/plugins/ingestions/aihot-ingest/dist/index.js +47 -97
- package/plugins/ingestions/horizon-ingest/dist/index.js +47 -96
- package/plugins/ingestions/karakeep-local/dist/index.js +217 -266
- package/plugins/ingestions/last30days-ingest/dist/index.js +42 -91
- package/plugins/ingestions/web-search/dist/index.js +68 -117
- package/plugins/kk/commands/workflow-run.md +25 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/kk-workflow-stages.ts +522 -163
- package/plugins/kk/scripts/validate-voicescript.ts +55 -0
- package/plugins/kk/skills/publish/SKILL.md +80 -0
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +125 -120
- package/plugins/kk/workflows/leftover-publish-fanout-example.yaml +53 -0
- package/plugins/publishings/emdash-pub/dist/index.js +42 -91
- package/plugins/publishings/infoq-pub/dist/index.js +21994 -0
- package/plugins/publishings/infoq-pub/package.json +17 -0
- package/plugins/publishings/infoq-pub/plugin.json +7 -0
- package/plugins/publishings/infoq-pub/src/index.ts +123 -0
- package/plugins/publishings/infoq-pub/tsconfig.json +4 -0
- package/plugins/publishings/juejin-pub/dist/index.js +21994 -0
- package/plugins/publishings/juejin-pub/package.json +17 -0
- package/plugins/publishings/juejin-pub/plugin.json +7 -0
- package/plugins/publishings/juejin-pub/src/index.ts +123 -0
- package/plugins/publishings/juejin-pub/tsconfig.json +4 -0
- package/plugins/publishings/medium-pub/dist/index.js +22041 -0
- package/plugins/publishings/medium-pub/package.json +17 -0
- package/plugins/publishings/medium-pub/plugin.json +7 -0
- package/plugins/publishings/medium-pub/src/index.ts +215 -0
- package/plugins/publishings/medium-pub/tsconfig.json +4 -0
- package/plugins/publishings/podcast-pub/dist/index.js +183 -123
- package/plugins/publishings/podcast-pub/src/index.ts +47 -3
- package/plugins/publishings/podcast-pub/src/show-notes.ts +153 -34
- package/plugins/publishings/qiita-pub/dist/index.js +42 -91
- package/plugins/publishings/substack-pub/dist/index.js +21994 -0
- package/plugins/publishings/substack-pub/package.json +17 -0
- package/plugins/publishings/substack-pub/plugin.json +7 -0
- package/plugins/publishings/substack-pub/src/index.ts +123 -0
- package/plugins/publishings/substack-pub/tsconfig.json +4 -0
- package/plugins/publishings/surfdash-pub/dist/index.js +172 -103
- package/plugins/publishings/surfdash-pub/src/index.ts +32 -2
- package/plugins/publishings/wechatmp-pub/dist/index.js +22119 -0
- package/plugins/publishings/wechatmp-pub/package.json +17 -0
- package/plugins/publishings/wechatmp-pub/plugin.json +7 -0
- package/plugins/publishings/wechatmp-pub/src/index.ts +304 -0
- package/plugins/publishings/wechatmp-pub/tsconfig.json +4 -0
- package/plugins/publishings/x-pub/dist/index.js +22110 -0
- package/plugins/publishings/x-pub/package.json +17 -0
- package/plugins/publishings/x-pub/plugin.json +7 -0
- package/plugins/publishings/x-pub/src/index.ts +222 -0
- package/plugins/publishings/x-pub/tsconfig.json +4 -0
- package/plugins/publishings/xhs-pub/dist/index.js +21994 -0
- package/plugins/publishings/xhs-pub/package.json +17 -0
- package/plugins/publishings/xhs-pub/plugin.json +7 -0
- package/plugins/publishings/xhs-pub/src/index.ts +123 -0
- package/plugins/publishings/xhs-pub/tsconfig.json +4 -0
- package/plugins/publishings/zenn-pub/dist/index.js +42 -91
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gobing-ai/infoq-pub",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"typecheck": "tsc --noEmit"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@gobing-ai/kk-core": "workspace:*",
|
|
10
|
+
"@gobing-ai/publish-harness": "workspace:*",
|
|
11
|
+
"@gobing-ai/ts-runtime": "catalog:",
|
|
12
|
+
"@gobing-ai/ts-utils": "catalog:"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/bun": "1.3.14"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { type Content, ContentSchema, type Result, ResultSchema } from '@gobing-ai/kk-core';
|
|
4
|
+
import {
|
|
5
|
+
type BrowserDriver,
|
|
6
|
+
FakeBrowserTransport,
|
|
7
|
+
type PublishTransport,
|
|
8
|
+
type PublishTransportPayload,
|
|
9
|
+
resolveBrowserProfileDir,
|
|
10
|
+
} from '@gobing-ai/publish-harness';
|
|
11
|
+
import { createNodeFileSystem } from '@gobing-ai/ts-runtime';
|
|
12
|
+
import { echoError } from '@gobing-ai/ts-utils';
|
|
13
|
+
|
|
14
|
+
const CHANNEL = 'infoq';
|
|
15
|
+
const TARGET = 'infoq';
|
|
16
|
+
|
|
17
|
+
function fail(error: string): Result {
|
|
18
|
+
return ResultSchema.parse({ ok: false, target: TARGET, error });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function draftId(content: Content): string {
|
|
22
|
+
const title = content.title ?? 'untitled';
|
|
23
|
+
return `${CHANNEL}-draft-${title.length}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function draftResult(content: Content, driver: BrowserDriver, profileDir: string): Result {
|
|
27
|
+
return ResultSchema.parse({
|
|
28
|
+
ok: true,
|
|
29
|
+
target: TARGET,
|
|
30
|
+
id: draftId(content),
|
|
31
|
+
message: `${TARGET} draft prepared (unpublished)`,
|
|
32
|
+
metadata: { driver, publishStatus: 'draft', profileDir },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class InfoqBrowserTransport implements PublishTransport {
|
|
37
|
+
public readonly kind = 'browser';
|
|
38
|
+
public readonly driver: BrowserDriver;
|
|
39
|
+
private readonly loginTimeoutMs: number;
|
|
40
|
+
private readonly sessionReady: boolean;
|
|
41
|
+
|
|
42
|
+
constructor(driver: BrowserDriver = 'agent', opts?: { loginTimeoutMs?: number; sessionReady?: boolean }) {
|
|
43
|
+
this.driver = driver;
|
|
44
|
+
this.loginTimeoutMs = opts?.loginTimeoutMs ?? 120_000;
|
|
45
|
+
this.sessionReady = opts?.sessionReady ?? false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public async publish(payload: PublishTransportPayload): Promise<Result> {
|
|
49
|
+
const override =
|
|
50
|
+
typeof payload.options?.profileDir === 'string'
|
|
51
|
+
? payload.options.profileDir
|
|
52
|
+
: (process.env.INFOQ_PROFILE_DIR ?? process.env.KK_BROWSER_PROFILE_DIR);
|
|
53
|
+
const profileDir = resolveBrowserProfileDir(CHANNEL, override);
|
|
54
|
+
if (!this.sessionReady) {
|
|
55
|
+
return fail(
|
|
56
|
+
`login timeout after ${this.loginTimeoutMs}ms: no authenticated ${CHANNEL} session in ${profileDir}`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return draftResult(payload.content, this.driver, profileDir);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function getPublishTransport(driver: BrowserDriver = 'agent'): PublishTransport {
|
|
64
|
+
if (process.env.KNOWLEDGE_KIT_PUBLISH_TRANSPORT === 'fake') {
|
|
65
|
+
return new FakeBrowserTransport(driver);
|
|
66
|
+
}
|
|
67
|
+
return new InfoqBrowserTransport(driver);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function writePublishResult(outputPath: string, result: Result): Promise<void> {
|
|
71
|
+
const outDir = dirname(outputPath);
|
|
72
|
+
if (outDir && outDir !== '.') await createNodeFileSystem().ensureDir(outDir);
|
|
73
|
+
await createNodeFileSystem().writeFile(outputPath, JSON.stringify(result, null, 2));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function processPublishIO(
|
|
77
|
+
inputPath: string,
|
|
78
|
+
outputPath: string,
|
|
79
|
+
transport: PublishTransport = getPublishTransport(),
|
|
80
|
+
): Promise<void> {
|
|
81
|
+
await createNodeFileSystem().deleteFile(outputPath);
|
|
82
|
+
let content: Content;
|
|
83
|
+
let options: Record<string, unknown> | undefined;
|
|
84
|
+
try {
|
|
85
|
+
const raw = JSON.parse(await createNodeFileSystem().readFile(inputPath)) as Record<string, unknown>;
|
|
86
|
+
content = ContentSchema.parse(raw);
|
|
87
|
+
if (raw.options !== undefined && typeof raw.options === 'object' && raw.options !== null) {
|
|
88
|
+
options = raw.options as Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
} catch (error: unknown) {
|
|
91
|
+
const message = `Invalid Content input: ${error instanceof Error ? error.message : String(error)}`;
|
|
92
|
+
await writePublishResult(outputPath, fail(message));
|
|
93
|
+
throw new Error(message);
|
|
94
|
+
}
|
|
95
|
+
const result = ResultSchema.parse(await transport.publish({ content, options }));
|
|
96
|
+
await writePublishResult(outputPath, result);
|
|
97
|
+
if (!result.ok) throw new Error(result.error ?? 'Publish failed');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function main(): Promise<number> {
|
|
101
|
+
let values: { in?: string; out?: string };
|
|
102
|
+
try {
|
|
103
|
+
({ values } = parseArgs({ options: { in: { type: 'string' }, out: { type: 'string' } } }));
|
|
104
|
+
} catch (error: unknown) {
|
|
105
|
+
echoError(`Invalid arguments: ${error instanceof Error ? error.message : String(error)}`);
|
|
106
|
+
return 1;
|
|
107
|
+
}
|
|
108
|
+
if (!values.in || !values.out) {
|
|
109
|
+
echoError('Missing required arguments: --in and --out');
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
await processPublishIO(values.in, values.out);
|
|
114
|
+
return 0;
|
|
115
|
+
} catch (error: unknown) {
|
|
116
|
+
echoError(`infoq-pub failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
117
|
+
return 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (import.meta.main) {
|
|
122
|
+
process.exit(await main());
|
|
123
|
+
}
|