@gobing-ai/knowledge-kit 0.0.22 → 0.0.24
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/index.js +137 -59
- package/package.json +4 -4
- package/plugins/generations/content-gen/dist/index.js +97 -45
- package/plugins/generations/core-facts-gen/dist/index.js +106 -57
- package/plugins/generations/daily-article-gen/dist/index.js +105 -56
- package/plugins/generations/dailynews-gen/dist/index.js +235 -57
- package/plugins/generations/dailynews-gen/src/index.ts +67 -2
- package/plugins/generations/dailynews-gen/src/script-builder.ts +36 -15
- package/plugins/generations/dailynews-gen/src/script-plan.ts +142 -0
- package/plugins/generations/episode-plan-gen/dist/index.js +115 -66
- package/plugins/generations/gemini-tts/README.md +125 -0
- package/plugins/generations/gemini-tts/dist/index.js +23348 -0
- package/plugins/generations/gemini-tts/package.json +16 -0
- package/plugins/generations/gemini-tts/plugin.json +6 -0
- package/plugins/generations/gemini-tts/profiles.json +3 -0
- package/plugins/generations/gemini-tts/src/gemini-client.ts +220 -0
- package/plugins/generations/gemini-tts/src/index.ts +33 -0
- package/plugins/generations/gemini-tts/src/voice-create.ts +180 -0
- package/plugins/generations/gemini-tts/tsconfig.json +8 -0
- package/plugins/generations/image-gen/dist/index.js +338 -117
- package/plugins/generations/image-gen/presets/formats/daily-news-cover.yaml +19 -0
- package/plugins/generations/image-gen/presets/formats/xhs-card.yaml +55 -0
- package/plugins/generations/image-gen/presets/styles/daily-news.yaml +9 -0
- package/plugins/generations/image-gen/presets/styles/xhs-knowledge.yaml +7 -0
- package/plugins/generations/image-gen/src/index.ts +148 -14
- package/plugins/generations/image-gen/src/job.ts +30 -0
- package/plugins/generations/image-gen/src/providers/errors.ts +91 -0
- package/plugins/generations/image-gen/src/providers/types.ts +79 -0
- package/plugins/generations/news-report-gen/dist/index.js +136 -55
- package/plugins/generations/news-report-gen/src/index.ts +57 -1
- package/plugins/generations/voice-gen/dist/index.js +121 -69
- package/plugins/generations/voice-gen/package.json +3 -0
- package/plugins/generations/voice-gen/src/index.ts +2 -1
- package/plugins/generations/voice-gen/src/voicebox-client.ts +2 -1
- package/plugins/ingestions/aihot-ingest/dist/index.js +103 -53
- package/plugins/ingestions/horizon-ingest/dist/index.js +102 -53
- package/plugins/ingestions/karakeep-local/dist/index.js +273 -224
- package/plugins/ingestions/last30days-ingest/dist/index.js +97 -48
- package/plugins/ingestions/web-search/dist/index.js +121 -72
- package/plugins/kk/config.example.yaml +13 -0
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/daily-voice-style.zh.md +52 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +438 -17
- package/plugins/kk/skills/publish/SKILL.md +24 -1
- package/plugins/kk/skills/xhs-images/SKILL.md +89 -0
- package/plugins/kk/skills/xhs-images/references/card-layouts.md +35 -0
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +164 -13
- package/plugins/publishings/emdash-pub/dist/index.js +94 -45
- package/plugins/publishings/infoq-pub/dist/index.js +94 -45
- package/plugins/publishings/juejin-pub/dist/index.js +94 -45
- package/plugins/publishings/medium-pub/dist/index.js +94 -45
- package/plugins/publishings/podcast-pub/dist/index.js +115 -55
- package/plugins/publishings/podcast-pub/src/map.ts +30 -10
- package/plugins/publishings/podcast-pub/src/show-notes.ts +6 -1
- package/plugins/publishings/qiita-pub/dist/index.js +94 -45
- package/plugins/publishings/substack-pub/dist/index.js +94 -45
- package/plugins/publishings/surfdash-pub/dist/index.js +99 -63
- package/plugins/publishings/surfdash-pub/src/index.ts +10 -1
- package/plugins/publishings/wechatmp-pub/dist/index.js +94 -45
- package/plugins/publishings/x-pub/dist/index.js +94 -45
- package/plugins/publishings/xhs-pub/dist/index.js +8908 -229
- package/plugins/publishings/xhs-pub/package.json +1 -0
- package/plugins/publishings/xhs-pub/plugin.json +1 -1
- package/plugins/publishings/xhs-pub/src/automation-guard.ts +128 -0
- package/plugins/publishings/xhs-pub/src/index.ts +753 -24
- package/plugins/publishings/xhs-pub/src/profile-check.ts +133 -0
- package/plugins/publishings/zenn-pub/dist/index.js +94 -45
- package/plugins/sp/lib/env.ts +46 -0
- package/plugins/sp/lib/inline-run.generated.mjs +1489 -0
- package/plugins/sp/scripts/feature-verification-steps.ts +275 -0
- package/plugins/sp/scripts/inline-run-setup.ts +571 -47
- package/plugins/sp/scripts/wrapup-drift-probe.mjs +190 -0
- package/plugins/sp/scripts/wrapup-drift-probe.ts +258 -0
- package/plugins/sp/scripts/wrapup-steps.mjs +77 -6
- package/plugins/sp/scripts/wrapup-steps.ts +91 -5
|
@@ -14642,6 +14642,72 @@ var init_zod = __esm(() => {
|
|
|
14642
14642
|
init_external();
|
|
14643
14643
|
});
|
|
14644
14644
|
|
|
14645
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/node_modules/@gobing-ai/ts-utils/dist/errors.js
|
|
14646
|
+
var ErrorCode;
|
|
14647
|
+
var init_errors3 = __esm(() => {
|
|
14648
|
+
ErrorCode = {
|
|
14649
|
+
NotFound: "NOT_FOUND",
|
|
14650
|
+
Validation: "VALIDATION",
|
|
14651
|
+
Conflict: "CONFLICT",
|
|
14652
|
+
Internal: "INTERNAL"
|
|
14653
|
+
};
|
|
14654
|
+
});
|
|
14655
|
+
|
|
14656
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/node_modules/@gobing-ai/ts-utils/dist/api-response.js
|
|
14657
|
+
var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
|
|
14658
|
+
var init_api_response = __esm(() => {
|
|
14659
|
+
init_errors3();
|
|
14660
|
+
API_ERROR_CODES = {
|
|
14661
|
+
SUCCESS: 0,
|
|
14662
|
+
NOT_FOUND: 404,
|
|
14663
|
+
VALIDATION_ERROR: 422,
|
|
14664
|
+
BAD_REQUEST: 400,
|
|
14665
|
+
UNAUTHORIZED: 401,
|
|
14666
|
+
FORBIDDEN: 403,
|
|
14667
|
+
CONFLICT: 409,
|
|
14668
|
+
INTERNAL_ERROR: 500
|
|
14669
|
+
};
|
|
14670
|
+
ERROR_CODE_TO_HTTP = {
|
|
14671
|
+
[ErrorCode.NotFound]: API_ERROR_CODES.NOT_FOUND,
|
|
14672
|
+
[ErrorCode.Validation]: API_ERROR_CODES.VALIDATION_ERROR,
|
|
14673
|
+
[ErrorCode.Conflict]: API_ERROR_CODES.CONFLICT,
|
|
14674
|
+
[ErrorCode.Internal]: API_ERROR_CODES.INTERNAL_ERROR
|
|
14675
|
+
};
|
|
14676
|
+
CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
|
|
14677
|
+
});
|
|
14678
|
+
|
|
14679
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/node_modules/@gobing-ai/ts-utils/dist/cursor.js
|
|
14680
|
+
var init_cursor = () => {};
|
|
14681
|
+
|
|
14682
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
|
|
14683
|
+
var init_event_severity = () => {};
|
|
14684
|
+
|
|
14685
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
14686
|
+
function processStream(name) {
|
|
14687
|
+
const proc = globalThis.process;
|
|
14688
|
+
const stream = proc?.[name];
|
|
14689
|
+
if (stream === undefined) {
|
|
14690
|
+
throw new Error(`No ${name} target available: set one via setDefaultOutputTargets or pass an explicit target`);
|
|
14691
|
+
}
|
|
14692
|
+
return stream;
|
|
14693
|
+
}
|
|
14694
|
+
function writeLine(message, target) {
|
|
14695
|
+
target.write(`${message}
|
|
14696
|
+
`);
|
|
14697
|
+
}
|
|
14698
|
+
function echoError(message, target = defaultStderrTarget ?? processStream("stderr")) {
|
|
14699
|
+
writeLine(message, target);
|
|
14700
|
+
}
|
|
14701
|
+
var defaultStderrTarget;
|
|
14702
|
+
|
|
14703
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/node_modules/@gobing-ai/ts-utils/dist/index.js
|
|
14704
|
+
var init_dist = __esm(() => {
|
|
14705
|
+
init_api_response();
|
|
14706
|
+
init_cursor();
|
|
14707
|
+
init_errors3();
|
|
14708
|
+
init_event_severity();
|
|
14709
|
+
});
|
|
14710
|
+
|
|
14645
14711
|
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
14646
14712
|
var require_identity = __commonJS((exports) => {
|
|
14647
14713
|
var ALIAS = Symbol.for("yaml.alias");
|
|
@@ -17546,15 +17612,15 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
17546
17612
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
17547
17613
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
17548
17614
|
const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
|
|
17549
|
-
let
|
|
17615
|
+
let date6 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
|
17550
17616
|
const tz = match[8];
|
|
17551
17617
|
if (tz && tz !== "Z") {
|
|
17552
17618
|
let d = parseSexagesimal(tz, false);
|
|
17553
17619
|
if (Math.abs(d) < 30)
|
|
17554
17620
|
d *= 60;
|
|
17555
|
-
|
|
17621
|
+
date6 -= 60000 * d;
|
|
17556
17622
|
}
|
|
17557
|
-
return new Date(
|
|
17623
|
+
return new Date(date6);
|
|
17558
17624
|
},
|
|
17559
17625
|
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
17560
17626
|
};
|
|
@@ -19414,7 +19480,7 @@ var require_composer = __commonJS((exports) => {
|
|
|
19414
19480
|
var node_process = __require("process");
|
|
19415
19481
|
var directives = require_directives();
|
|
19416
19482
|
var Document = require_Document();
|
|
19417
|
-
var
|
|
19483
|
+
var errors4 = require_errors();
|
|
19418
19484
|
var identity = require_identity();
|
|
19419
19485
|
var composeDoc = require_compose_doc();
|
|
19420
19486
|
var resolveEnd = require_resolve_end();
|
|
@@ -19465,9 +19531,9 @@ var require_composer = __commonJS((exports) => {
|
|
|
19465
19531
|
this.onError = (source, code, message, warning) => {
|
|
19466
19532
|
const pos = getErrorPos(source);
|
|
19467
19533
|
if (warning)
|
|
19468
|
-
this.warnings.push(new
|
|
19534
|
+
this.warnings.push(new errors4.YAMLWarning(pos, code, message));
|
|
19469
19535
|
else
|
|
19470
|
-
this.errors.push(new
|
|
19536
|
+
this.errors.push(new errors4.YAMLParseError(pos, code, message));
|
|
19471
19537
|
};
|
|
19472
19538
|
this.directives = new directives.Directives({ version: options.version || "1.2" });
|
|
19473
19539
|
this.options = options;
|
|
@@ -19553,7 +19619,7 @@ ${cb}` : comment;
|
|
|
19553
19619
|
break;
|
|
19554
19620
|
case "error": {
|
|
19555
19621
|
const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message;
|
|
19556
|
-
const error51 = new
|
|
19622
|
+
const error51 = new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
|
|
19557
19623
|
if (this.atDirectives || !this.doc)
|
|
19558
19624
|
this.errors.push(error51);
|
|
19559
19625
|
else
|
|
@@ -19563,7 +19629,7 @@ ${cb}` : comment;
|
|
|
19563
19629
|
case "doc-end": {
|
|
19564
19630
|
if (!this.doc) {
|
|
19565
19631
|
const msg = "Unexpected doc-end without preceding document";
|
|
19566
|
-
this.errors.push(new
|
|
19632
|
+
this.errors.push(new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg));
|
|
19567
19633
|
break;
|
|
19568
19634
|
}
|
|
19569
19635
|
this.doc.directives.docEnd = true;
|
|
@@ -19578,7 +19644,7 @@ ${end.comment}` : end.comment;
|
|
|
19578
19644
|
break;
|
|
19579
19645
|
}
|
|
19580
19646
|
default:
|
|
19581
|
-
this.errors.push(new
|
|
19647
|
+
this.errors.push(new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`));
|
|
19582
19648
|
}
|
|
19583
19649
|
}
|
|
19584
19650
|
*end(forceDoc = false, endOffset = -1) {
|
|
@@ -19604,7 +19670,7 @@ ${end.comment}` : end.comment;
|
|
|
19604
19670
|
var require_cst_scalar = __commonJS((exports) => {
|
|
19605
19671
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
19606
19672
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
19607
|
-
var
|
|
19673
|
+
var errors4 = require_errors();
|
|
19608
19674
|
var stringifyString = require_stringifyString();
|
|
19609
19675
|
function resolveAsScalar(token, strict = true, onError) {
|
|
19610
19676
|
if (token) {
|
|
@@ -19613,7 +19679,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
19613
19679
|
if (onError)
|
|
19614
19680
|
onError(offset, code, message);
|
|
19615
19681
|
else
|
|
19616
|
-
throw new
|
|
19682
|
+
throw new errors4.YAMLParseError([offset, offset + 1], code, message);
|
|
19617
19683
|
};
|
|
19618
19684
|
switch (token.type) {
|
|
19619
19685
|
case "scalar":
|
|
@@ -21493,7 +21559,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
21493
21559
|
var require_public_api = __commonJS((exports) => {
|
|
21494
21560
|
var composer = require_composer();
|
|
21495
21561
|
var Document = require_Document();
|
|
21496
|
-
var
|
|
21562
|
+
var errors4 = require_errors();
|
|
21497
21563
|
var log = require_log();
|
|
21498
21564
|
var identity = require_identity();
|
|
21499
21565
|
var lineCounter = require_line_counter();
|
|
@@ -21510,8 +21576,8 @@ var require_public_api = __commonJS((exports) => {
|
|
|
21510
21576
|
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
21511
21577
|
if (prettyErrors && lineCounter2)
|
|
21512
21578
|
for (const doc2 of docs) {
|
|
21513
|
-
doc2.errors.forEach(
|
|
21514
|
-
doc2.warnings.forEach(
|
|
21579
|
+
doc2.errors.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21580
|
+
doc2.warnings.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21515
21581
|
}
|
|
21516
21582
|
if (docs.length > 0)
|
|
21517
21583
|
return docs;
|
|
@@ -21526,13 +21592,13 @@ var require_public_api = __commonJS((exports) => {
|
|
|
21526
21592
|
if (!doc2)
|
|
21527
21593
|
doc2 = _doc;
|
|
21528
21594
|
else if (doc2.options.logLevel !== "silent") {
|
|
21529
|
-
doc2.errors.push(new
|
|
21595
|
+
doc2.errors.push(new errors4.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
21530
21596
|
break;
|
|
21531
21597
|
}
|
|
21532
21598
|
}
|
|
21533
21599
|
if (prettyErrors && lineCounter2) {
|
|
21534
|
-
doc2.errors.forEach(
|
|
21535
|
-
doc2.warnings.forEach(
|
|
21600
|
+
doc2.errors.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21601
|
+
doc2.warnings.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21536
21602
|
}
|
|
21537
21603
|
return doc2;
|
|
21538
21604
|
}
|
|
@@ -21584,12 +21650,12 @@ var require_public_api = __commonJS((exports) => {
|
|
|
21584
21650
|
});
|
|
21585
21651
|
|
|
21586
21652
|
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js
|
|
21587
|
-
var composer, Document, Schema,
|
|
21588
|
-
var
|
|
21653
|
+
var composer, Document, Schema, errors4, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
|
|
21654
|
+
var init_dist2 = __esm(() => {
|
|
21589
21655
|
composer = require_composer();
|
|
21590
21656
|
Document = require_Document();
|
|
21591
21657
|
Schema = require_Schema();
|
|
21592
|
-
|
|
21658
|
+
errors4 = require_errors();
|
|
21593
21659
|
Alias = require_Alias();
|
|
21594
21660
|
identity = require_identity();
|
|
21595
21661
|
Pair = require_Pair();
|
|
@@ -21605,9 +21671,9 @@ var init_dist = __esm(() => {
|
|
|
21605
21671
|
$Composer = composer.Composer;
|
|
21606
21672
|
$Document = Document.Document;
|
|
21607
21673
|
$Schema = Schema.Schema;
|
|
21608
|
-
$YAMLError =
|
|
21609
|
-
$YAMLParseError =
|
|
21610
|
-
$YAMLWarning =
|
|
21674
|
+
$YAMLError = errors4.YAMLError;
|
|
21675
|
+
$YAMLParseError = errors4.YAMLParseError;
|
|
21676
|
+
$YAMLWarning = errors4.YAMLWarning;
|
|
21611
21677
|
$Alias = Alias.Alias;
|
|
21612
21678
|
$isAlias = identity.isAlias;
|
|
21613
21679
|
$isCollection = identity.isCollection;
|
|
@@ -21632,10 +21698,10 @@ var init_dist = __esm(() => {
|
|
|
21632
21698
|
$visitAsync = visit.visitAsync;
|
|
21633
21699
|
});
|
|
21634
21700
|
|
|
21635
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
21701
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
21636
21702
|
var configSchema;
|
|
21637
21703
|
var init_config = __esm(() => {
|
|
21638
|
-
|
|
21704
|
+
init_dist2();
|
|
21639
21705
|
init_zod();
|
|
21640
21706
|
configSchema = exports_external.object({
|
|
21641
21707
|
app: exports_external.object({
|
|
@@ -21656,7 +21722,7 @@ var init_config = __esm(() => {
|
|
|
21656
21722
|
});
|
|
21657
21723
|
});
|
|
21658
21724
|
|
|
21659
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
21725
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
21660
21726
|
import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
21661
21727
|
import { dirname, resolve as resolvePath } from "path";
|
|
21662
21728
|
function createNodeFileSystem(root, paths) {
|
|
@@ -21834,14 +21900,14 @@ var PluginManifestSchema = exports_external.looseObject({
|
|
|
21834
21900
|
description: exports_external.string().optional(),
|
|
21835
21901
|
operations: exports_external.record(exports_external.string(), PluginOperationSchema).optional()
|
|
21836
21902
|
});
|
|
21837
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
21903
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
21838
21904
|
init_file_system_node();
|
|
21839
21905
|
init_config();
|
|
21840
21906
|
|
|
21841
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
21907
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/fs.js
|
|
21842
21908
|
init_file_system_node();
|
|
21843
21909
|
|
|
21844
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
21910
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
21845
21911
|
function normalizeSeparators(path) {
|
|
21846
21912
|
return path.replaceAll("\\", "/");
|
|
21847
21913
|
}
|
|
@@ -21875,7 +21941,7 @@ function dirnamePath(path) {
|
|
|
21875
21941
|
return normalized.slice(0, index);
|
|
21876
21942
|
}
|
|
21877
21943
|
|
|
21878
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
21944
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/fs.js
|
|
21879
21945
|
async function ensureDirForFile(path, fs = createNodeFileSystem()) {
|
|
21880
21946
|
await fs.ensureDir(dirnamePath(path));
|
|
21881
21947
|
}
|
|
@@ -21903,27 +21969,10 @@ function getProcessPid() {
|
|
|
21903
21969
|
function uniqueToken() {
|
|
21904
21970
|
return `${Date.now()}.${crypto.randomUUID()}`;
|
|
21905
21971
|
}
|
|
21906
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.67/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
21907
|
-
var defaultStderrTarget;
|
|
21908
|
-
function processStream(name) {
|
|
21909
|
-
const proc = globalThis.process;
|
|
21910
|
-
const stream = proc?.[name];
|
|
21911
|
-
if (stream === undefined) {
|
|
21912
|
-
throw new Error(`No ${name} target available: set one via setDefaultOutputTargets or pass an explicit target`);
|
|
21913
|
-
}
|
|
21914
|
-
return stream;
|
|
21915
|
-
}
|
|
21916
|
-
function writeLine(message, target) {
|
|
21917
|
-
target.write(`${message}
|
|
21918
|
-
`);
|
|
21919
|
-
}
|
|
21920
|
-
function echoError(message, target = defaultStderrTarget ?? processStream("stderr")) {
|
|
21921
|
-
writeLine(message, target);
|
|
21922
|
-
}
|
|
21923
|
-
|
|
21924
21972
|
// ../../packages/kk-core/src/render-md.ts
|
|
21925
21973
|
if (false) {}
|
|
21926
21974
|
// ../../plugins/generations/news-report-gen/src/index.ts
|
|
21975
|
+
init_dist();
|
|
21927
21976
|
var QC_DIMENSIONS = ["quality", "importance", "urgency", "impact"];
|
|
21928
21977
|
var QC_MIN_ENVS = {
|
|
21929
21978
|
quality: "QC_MIN_QUALITY",
|
|
@@ -22029,6 +22078,31 @@ async function readQcSummary(path2) {
|
|
|
22029
22078
|
return null;
|
|
22030
22079
|
}
|
|
22031
22080
|
}
|
|
22081
|
+
async function readScriptSource(path2) {
|
|
22082
|
+
if (!path2 || path2.trim() === "")
|
|
22083
|
+
return null;
|
|
22084
|
+
try {
|
|
22085
|
+
const parsed = JSON.parse(await Bun.file(path2).text());
|
|
22086
|
+
const meta3 = parsed?.metadata;
|
|
22087
|
+
if (meta3 === null || typeof meta3 !== "object")
|
|
22088
|
+
return null;
|
|
22089
|
+
const record2 = meta3;
|
|
22090
|
+
if (record2.scriptSource !== "plan" && record2.scriptSource !== "template")
|
|
22091
|
+
return null;
|
|
22092
|
+
if (!Array.isArray(record2.scriptPlanErrors))
|
|
22093
|
+
return null;
|
|
22094
|
+
const errors5 = [];
|
|
22095
|
+
for (const error51 of record2.scriptPlanErrors) {
|
|
22096
|
+
const entry = error51;
|
|
22097
|
+
if (typeof entry?.itemId !== "string" || typeof entry?.rule !== "string")
|
|
22098
|
+
return null;
|
|
22099
|
+
errors5.push({ itemId: entry.itemId, rule: entry.rule });
|
|
22100
|
+
}
|
|
22101
|
+
return { source: record2.scriptSource, errors: errors5 };
|
|
22102
|
+
} catch {
|
|
22103
|
+
return null;
|
|
22104
|
+
}
|
|
22105
|
+
}
|
|
22032
22106
|
async function readTiming(path2) {
|
|
22033
22107
|
if (!path2 || path2.trim() === "")
|
|
22034
22108
|
return [];
|
|
@@ -22062,8 +22136,8 @@ function durationMs(entry) {
|
|
|
22062
22136
|
return null;
|
|
22063
22137
|
return Math.max(0, end - start);
|
|
22064
22138
|
}
|
|
22065
|
-
function renderReportMarkdown(docs,
|
|
22066
|
-
const lines = [`# \u6BCF\u65E5 AI \u8BED\u97F3\u8FD0\u884C\u62A5\u544A \u2014 ${
|
|
22139
|
+
function renderReportMarkdown(docs, date6, options = {}) {
|
|
22140
|
+
const lines = [`# \u6BCF\u65E5 AI \u8BED\u97F3\u8FD0\u884C\u62A5\u544A \u2014 ${date6}`, ""];
|
|
22067
22141
|
lines.push("## \u9009\u7A3F\u8BC4\u5206\uFF08\u4FDD\u7559\u5019\u9009\uFF09", "");
|
|
22068
22142
|
if (docs.length === 0) {
|
|
22069
22143
|
lines.push("\u672C\u671F\u65E0\u4FDD\u7559\u5019\u9009\u3002", "");
|
|
@@ -22124,6 +22198,11 @@ function renderReportMarkdown(docs, date5, options = {}) {
|
|
|
22124
22198
|
}
|
|
22125
22199
|
lines.push("");
|
|
22126
22200
|
}
|
|
22201
|
+
const scriptSource = options.scriptSource ?? null;
|
|
22202
|
+
if (scriptSource !== null) {
|
|
22203
|
+
const detail = scriptSource.source === "template" && scriptSource.errors.length > 0 ? `\uFF08${scriptSource.errors.map((error51) => `${error51.itemId}:${error51.rule}`).join(", ")}\uFF09` : "";
|
|
22204
|
+
lines.push(`**\u811A\u672C\u6765\u6E90**: ${scriptSource.source}${detail}`, "");
|
|
22205
|
+
}
|
|
22127
22206
|
const qc = options.qc ?? null;
|
|
22128
22207
|
if (qc !== null) {
|
|
22129
22208
|
lines.push("## \u97F3\u9891 QC", "");
|
|
@@ -22206,12 +22285,12 @@ function corpusComposition(docs) {
|
|
|
22206
22285
|
categories: tally((d) => d.metadata?.category ?? d.category)
|
|
22207
22286
|
};
|
|
22208
22287
|
}
|
|
22209
|
-
function docsToContent(docs,
|
|
22288
|
+
function docsToContent(docs, date6, options) {
|
|
22210
22289
|
return ContentSchema.parse({
|
|
22211
|
-
title: `\u6BCF\u65E5 AI \u8BED\u97F3\u8FD0\u884C\u62A5\u544A \u2014 ${
|
|
22212
|
-
body: renderReportMarkdown(docs,
|
|
22290
|
+
title: `\u6BCF\u65E5 AI \u8BED\u97F3\u8FD0\u884C\u62A5\u544A \u2014 ${date6}`,
|
|
22291
|
+
body: renderReportMarkdown(docs, date6, options),
|
|
22213
22292
|
format: "markdown",
|
|
22214
|
-
metadata: { generator: "kk:news-report", date:
|
|
22293
|
+
metadata: { generator: "kk:news-report", date: date6, doc_count: docs.length }
|
|
22215
22294
|
});
|
|
22216
22295
|
}
|
|
22217
22296
|
function dateFromEnv() {
|
|
@@ -22223,9 +22302,10 @@ async function processGeneratorIO(inputPath, outputPath) {
|
|
|
22223
22302
|
const rejected = await readRejectedAudit(process.env.NEWS_REPORT_REJECTED_FILE);
|
|
22224
22303
|
const timing = await readTiming(process.env.NEWS_REPORT_TIMING_FILE);
|
|
22225
22304
|
const qc = await readQcSummary(process.env.NEWS_REPORT_QC_FILE);
|
|
22305
|
+
const scriptSource = await readScriptSource(process.env.NEWS_REPORT_SCRIPT_FILE);
|
|
22226
22306
|
const planAudit = await readPlanAudit(process.env.NEWS_REPORT_PLAN_AUDIT_FILE);
|
|
22227
22307
|
const blended = await readBlendedCorpus(process.env.NEWS_REPORT_BLENDED_FILE);
|
|
22228
|
-
const content = docsToContent(docs, dateFromEnv(), { rejected, timing, qc, planAudit, blended });
|
|
22308
|
+
const content = docsToContent(docs, dateFromEnv(), { rejected, timing, qc, scriptSource, planAudit, blended });
|
|
22229
22309
|
const fs = createNodeFileSystem();
|
|
22230
22310
|
const outDir = dirname2(outputPath);
|
|
22231
22311
|
if (outDir && outDir !== ".")
|
|
@@ -22262,6 +22342,7 @@ export {
|
|
|
22262
22342
|
renderReportMarkdown,
|
|
22263
22343
|
rejectedCounts,
|
|
22264
22344
|
readTiming,
|
|
22345
|
+
readScriptSource,
|
|
22265
22346
|
readRejectedAudit,
|
|
22266
22347
|
readQcSummary,
|
|
22267
22348
|
readPlanAudit,
|
|
@@ -24,6 +24,9 @@ import { echoError } from '@gobing-ai/ts-utils';
|
|
|
24
24
|
* - `NEWS_REPORT_QC_FILE` — the generate stage's QC audit path
|
|
25
25
|
* (`3-audio/<date>_11_generate_content.json`); absent -> the 音频 QC block is omitted;
|
|
26
26
|
* absent or unreadable -> reject counts render as 0, never throw.
|
|
27
|
+
* - `NEWS_REPORT_SCRIPT_FILE` — the script stage's Content path
|
|
28
|
+
* (`2-script/<date>_08_script_content.json`, F613 R5); absent or metadata-less -> the
|
|
29
|
+
* 脚本来源 line is omitted, never throw.
|
|
27
30
|
* - `NEWS_REPORT_TIMING_FILE` — `<work_dir>/step-timing.json` JSONL of
|
|
28
31
|
* {step, startedAt, endedAt} appended by the workflow shell steps; missing
|
|
29
32
|
* or unreadable -> the timing section is omitted, never throw.
|
|
@@ -194,6 +197,44 @@ export async function readQcSummary(path: string | undefined): Promise<QcSummary
|
|
|
194
197
|
}
|
|
195
198
|
}
|
|
196
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Script-source verdict from the script stage's Content metadata (F613 R5): which path built the
|
|
202
|
+
* VoiceScript, and — when the plan fell back to templates — the builder's per-item rejection rules.
|
|
203
|
+
*/
|
|
204
|
+
export interface ScriptSource {
|
|
205
|
+
source: 'plan' | 'template';
|
|
206
|
+
errors: { itemId: string; rule: string }[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Read the script stage's Content (`<run_date>_08_script_content.json`) for the 脚本来源 verdict
|
|
211
|
+
* (F613 R5).
|
|
212
|
+
*
|
|
213
|
+
* Best-effort by contract: an absent, unreadable, or malformed file — or Content whose metadata
|
|
214
|
+
* carries no `scriptSource`/`scriptPlanErrors` pair (pre-F613 artifacts) — returns `null` and the
|
|
215
|
+
* report omits the line. A run report must never fail a run.
|
|
216
|
+
*/
|
|
217
|
+
export async function readScriptSource(path: string | undefined): Promise<ScriptSource | null> {
|
|
218
|
+
if (!path || path.trim() === '') return null;
|
|
219
|
+
try {
|
|
220
|
+
const parsed = JSON.parse(await Bun.file(path).text()) as { metadata?: unknown } | null;
|
|
221
|
+
const meta = parsed?.metadata;
|
|
222
|
+
if (meta === null || typeof meta !== 'object') return null;
|
|
223
|
+
const record = meta as { scriptSource?: unknown; scriptPlanErrors?: unknown };
|
|
224
|
+
if (record.scriptSource !== 'plan' && record.scriptSource !== 'template') return null;
|
|
225
|
+
if (!Array.isArray(record.scriptPlanErrors)) return null;
|
|
226
|
+
const errors: { itemId: string; rule: string }[] = [];
|
|
227
|
+
for (const error of record.scriptPlanErrors) {
|
|
228
|
+
const entry = error as { itemId?: unknown; rule?: unknown } | null;
|
|
229
|
+
if (typeof entry?.itemId !== 'string' || typeof entry?.rule !== 'string') return null;
|
|
230
|
+
errors.push({ itemId: entry.itemId, rule: entry.rule });
|
|
231
|
+
}
|
|
232
|
+
return { source: record.scriptSource, errors };
|
|
233
|
+
} catch {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
197
238
|
/** Parse the timing JSONL; unreadable/missing -> [] (never throw). Last entry per step wins. */
|
|
198
239
|
export async function readTiming(path: string | undefined): Promise<TimingEntry[]> {
|
|
199
240
|
if (!path || path.trim() === '') return [];
|
|
@@ -234,6 +275,7 @@ export function renderReportMarkdown(
|
|
|
234
275
|
rejected?: { doc: Doc; reasons: string[] }[];
|
|
235
276
|
timing?: TimingEntry[];
|
|
236
277
|
qc?: QcSummary | null;
|
|
278
|
+
scriptSource?: ScriptSource | null;
|
|
237
279
|
planAudit?: PlanAuditRow[] | null;
|
|
238
280
|
blended?: BlendedDoc[] | null;
|
|
239
281
|
} = {},
|
|
@@ -311,6 +353,17 @@ export function renderReportMarkdown(
|
|
|
311
353
|
lines.push('');
|
|
312
354
|
}
|
|
313
355
|
|
|
356
|
+
const scriptSource = options.scriptSource ?? null;
|
|
357
|
+
if (scriptSource !== null) {
|
|
358
|
+
// F613 R5: plan-versus-template is otherwise invisible once the VoiceScript is rendered —
|
|
359
|
+
// one line names the path, and a template fallback lists every itemId:rule rejection.
|
|
360
|
+
const detail =
|
|
361
|
+
scriptSource.source === 'template' && scriptSource.errors.length > 0
|
|
362
|
+
? `(${scriptSource.errors.map((error) => `${error.itemId}:${error.rule}`).join(', ')})`
|
|
363
|
+
: '';
|
|
364
|
+
lines.push(`**脚本来源**: ${scriptSource.source}${detail}`, '');
|
|
365
|
+
}
|
|
366
|
+
|
|
314
367
|
const qc = options.qc ?? null;
|
|
315
368
|
if (qc !== null) {
|
|
316
369
|
// 0139 R5b: the audio QC verdict is otherwise invisible in the report — this run published
|
|
@@ -442,6 +495,7 @@ export function docsToContent(
|
|
|
442
495
|
rejected?: { doc: Doc; reasons: string[] }[];
|
|
443
496
|
timing?: TimingEntry[];
|
|
444
497
|
qc?: QcSummary | null;
|
|
498
|
+
scriptSource?: ScriptSource | null;
|
|
445
499
|
planAudit?: PlanAuditRow[] | null;
|
|
446
500
|
blended?: BlendedDoc[] | null;
|
|
447
501
|
},
|
|
@@ -464,9 +518,11 @@ export async function processGeneratorIO(inputPath: string, outputPath: string):
|
|
|
464
518
|
const rejected = await readRejectedAudit(process.env.NEWS_REPORT_REJECTED_FILE);
|
|
465
519
|
const timing = await readTiming(process.env.NEWS_REPORT_TIMING_FILE);
|
|
466
520
|
const qc = await readQcSummary(process.env.NEWS_REPORT_QC_FILE);
|
|
521
|
+
// F613 R5: the script stage's Content, read best-effort (absent/metadata-less -> line omitted).
|
|
522
|
+
const scriptSource = await readScriptSource(process.env.NEWS_REPORT_SCRIPT_FILE);
|
|
467
523
|
const planAudit = await readPlanAudit(process.env.NEWS_REPORT_PLAN_AUDIT_FILE);
|
|
468
524
|
const blended = await readBlendedCorpus(process.env.NEWS_REPORT_BLENDED_FILE);
|
|
469
|
-
const content = docsToContent(docs, dateFromEnv(), { rejected, timing, qc, planAudit, blended });
|
|
525
|
+
const content = docsToContent(docs, dateFromEnv(), { rejected, timing, qc, scriptSource, planAudit, blended });
|
|
470
526
|
const fs = createNodeFileSystem();
|
|
471
527
|
const outDir = dirname(outputPath);
|
|
472
528
|
if (outDir && outDir !== '.') await fs.ensureDir(outDir);
|