@gobing-ai/knowledge-kit 0.1.22 → 0.1.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 +282 -147
- package/package.json +5 -5
- package/plugins/generations/content-gen/dist/index.js +9 -9
- package/plugins/generations/core-facts-gen/dist/index.js +12 -12
- package/plugins/generations/daily-article-gen/dist/index.js +12 -12
- package/plugins/generations/dailynews-gen/dist/index.js +11 -11
- package/plugins/generations/dailynews-gen/src/script-plan.ts +2 -2
- package/plugins/generations/episode-plan-gen/dist/index.js +12 -12
- package/plugins/generations/gemini-tts/dist/index.js +56 -16
- package/plugins/generations/gemini-tts/src/gemini-client.ts +34 -6
- package/plugins/generations/image-gen/dist/index.js +9 -9
- package/plugins/generations/music-gen/README.md +2 -2
- package/plugins/generations/music-gen/dist/index.js +62 -26
- package/plugins/generations/music-gen/presets/formats/song.yaml +6 -1
- package/plugins/generations/music-gen/presets/themes/synthwave.yaml +6 -1
- package/plugins/generations/music-gen/src/adapter/instance.ts +34 -11
- package/plugins/generations/music-gen/src/presets.ts +36 -3
- package/plugins/generations/news-report-gen/dist/index.js +12 -12
- package/plugins/generations/omni-voice-gen/uv.toml +5 -0
- package/plugins/generations/vibe-voice-tts/README.md +64 -0
- package/plugins/generations/vibe-voice-tts/dist/index.js +14259 -0
- package/plugins/generations/vibe-voice-tts/package.json +16 -0
- package/plugins/generations/vibe-voice-tts/plugin.json +6 -0
- package/plugins/generations/vibe-voice-tts/profiles.json +10 -0
- package/plugins/generations/vibe-voice-tts/pyproject.toml +9 -0
- package/plugins/generations/vibe-voice-tts/python/worker.py +566 -0
- package/plugins/generations/vibe-voice-tts/src/index.ts +88 -0
- package/plugins/generations/vibe-voice-tts/src/vibevoice-client.ts +828 -0
- package/plugins/generations/vibe-voice-tts/tsconfig.json +8 -0
- package/plugins/generations/vibe-voice-tts/uv.lock +1767 -0
- package/plugins/generations/vibe-voice-tts/uv.toml +4 -0
- package/plugins/generations/voice-gen/dist/index.js +40 -10
- package/plugins/generations/voice-gen/src/voicebox-client.ts +50 -1
- package/plugins/generations/voxcpm-tts/dist/index.js +90 -18
- package/plugins/generations/voxcpm-tts/python/worker.py +9 -0
- package/plugins/generations/voxcpm-tts/src/index.ts +41 -0
- package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +32 -11
- package/plugins/generations/voxcpm-tts/uv.toml +5 -0
- package/plugins/ingestions/aihot-ingest/dist/index.js +12 -12
- package/plugins/ingestions/horizon-ingest/dist/index.js +12 -12
- package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
- package/plugins/ingestions/last30days-ingest/dist/index.js +12 -12
- package/plugins/ingestions/web-search/dist/index.js +10 -10
- package/plugins/kk/README.md +21 -0
- package/plugins/kk/decisions/kk-safety.yaml +5 -2
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice.json +16 -16
- package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +12 -1
- package/plugins/kk/scripts/cover-compositor.ts +104 -26
- package/plugins/kk/scripts/daily-stages.ts +481 -63
- package/plugins/kk/scripts/kk-workflow-stages.ts +218 -17
- package/plugins/kk/scripts/safety-artifact-check.ts +28 -5
- package/plugins/kk/scripts/series-names.ts +16 -3
- package/plugins/kk/skills/news-editorial/SKILL.md +1 -1
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +3 -3
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +4 -3
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +6 -5
- package/plugins/kk/workflows/kk-daily-safety.yaml +12 -10
- package/plugins/kk/workflows/kk-music.yaml +20 -16
- package/plugins/kk/workflows/kk-news-generate.yaml +26 -3
- package/plugins/kk/workflows/kk-publish.yaml +4 -1
- package/plugins/publishings/bilibili-pub/dist/index.js +22 -22
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/cnblogs-pub/dist/index.js +22 -22
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/csdn-pub/dist/index.js +22 -22
- package/plugins/publishings/csdn-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/emdash-pub/dist/index.js +9 -9
- package/plugins/publishings/infoq-pub/dist/index.js +22 -22
- package/plugins/publishings/infoq-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/jike-pub/dist/index.js +22 -22
- package/plugins/publishings/jike-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/juejin-pub/dist/index.js +22 -22
- package/plugins/publishings/juejin-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/linkedin-pub/dist/index.js +133 -33
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +27 -22
- package/plugins/publishings/linkedin-pub/src/index.ts +192 -18
- package/plugins/publishings/medium-pub/dist/index.js +9 -9
- package/plugins/publishings/podcast-pub/dist/index.js +240 -37
- package/plugins/publishings/podcast-pub/src/index.ts +154 -3
- package/plugins/publishings/podcast-pub/src/seo.ts +25 -8
- package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +93 -23
- package/plugins/publishings/podcast-pub/src/show-notes.ts +26 -6
- package/plugins/publishings/qiita-pub/dist/index.js +9 -9
- package/plugins/publishings/shipinhao-pub/dist/index.js +23 -23
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +23 -23
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +2 -1
- package/plugins/publishings/sspai-pub/dist/index.js +22 -22
- package/plugins/publishings/sspai-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/substack-pub/dist/index.js +22 -22
- package/plugins/publishings/substack-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/surfdash-pub/dist/index.js +207 -95
- package/plugins/publishings/surfdash-pub/src/digest-check.ts +30 -1
- package/plugins/publishings/surfdash-pub/src/index.ts +101 -76
- package/plugins/publishings/surfdash-pub/src/media-upload.ts +83 -0
- package/plugins/publishings/surfdash-pub/src/patch.ts +49 -26
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +12 -4
- package/plugins/publishings/threads-pub/dist/index.js +83 -27
- package/plugins/publishings/threads-pub/dist/profile-check.js +34 -23
- package/plugins/publishings/threads-pub/src/post-rail.ts +121 -4
- package/plugins/publishings/wechatmp-pub/dist/index.js +274 -98
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +27 -23
- package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +87 -53
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +117 -13
- package/plugins/publishings/wechatmp-pub/src/flow.ts +183 -43
- package/plugins/publishings/wechatmp-pub/src/modes.ts +30 -12
- package/plugins/publishings/weibo-pub/dist/index.js +22 -22
- package/plugins/publishings/weibo-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/x-pub/dist/index.js +113 -32
- package/plugins/publishings/x-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/x-pub/src/post-rail.ts +155 -20
- package/plugins/publishings/xhs-pub/dist/index.js +22 -22
- package/plugins/publishings/xhs-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +22 -22
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +22 -22
- package/plugins/publishings/zenn-pub/dist/index.js +9 -9
package/dist/index.js
CHANGED
|
@@ -2127,7 +2127,7 @@ var init_commander = __esm(() => {
|
|
|
2127
2127
|
program = new Command;
|
|
2128
2128
|
});
|
|
2129
2129
|
|
|
2130
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2130
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/errors.js
|
|
2131
2131
|
var ErrorCode;
|
|
2132
2132
|
var init_errors = __esm(() => {
|
|
2133
2133
|
ErrorCode = {
|
|
@@ -2138,7 +2138,7 @@ var init_errors = __esm(() => {
|
|
|
2138
2138
|
};
|
|
2139
2139
|
});
|
|
2140
2140
|
|
|
2141
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2141
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/api-response.js
|
|
2142
2142
|
var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
|
|
2143
2143
|
var init_api_response = __esm(() => {
|
|
2144
2144
|
init_errors();
|
|
@@ -2161,10 +2161,10 @@ var init_api_response = __esm(() => {
|
|
|
2161
2161
|
CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
|
|
2162
2162
|
});
|
|
2163
2163
|
|
|
2164
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2164
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/cursor.js
|
|
2165
2165
|
var init_cursor = () => {};
|
|
2166
2166
|
|
|
2167
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2167
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/env.js
|
|
2168
2168
|
function getEnvVar(name, fallback) {
|
|
2169
2169
|
const raw = process.env[name];
|
|
2170
2170
|
return raw === undefined ? fallback : raw;
|
|
@@ -2173,10 +2173,10 @@ function getEnvVars() {
|
|
|
2173
2173
|
return process.env;
|
|
2174
2174
|
}
|
|
2175
2175
|
|
|
2176
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2176
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
|
|
2177
2177
|
var init_event_severity = () => {};
|
|
2178
2178
|
|
|
2179
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2179
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/object.js
|
|
2180
2180
|
function isPlainObject(value) {
|
|
2181
2181
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2182
2182
|
}
|
|
@@ -2194,7 +2194,7 @@ function deepMerge(target, source) {
|
|
|
2194
2194
|
return result;
|
|
2195
2195
|
}
|
|
2196
2196
|
|
|
2197
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2197
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
2198
2198
|
function processStream(name) {
|
|
2199
2199
|
const proc = globalThis.process;
|
|
2200
2200
|
const stream = proc?.[name];
|
|
@@ -2227,7 +2227,7 @@ function setDefaultOutputTargets(opts) {
|
|
|
2227
2227
|
}
|
|
2228
2228
|
var defaultStdoutTarget, defaultStderrTarget;
|
|
2229
2229
|
|
|
2230
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.
|
|
2230
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/index.js
|
|
2231
2231
|
var init_dist = __esm(() => {
|
|
2232
2232
|
init_api_response();
|
|
2233
2233
|
init_cursor();
|
|
@@ -23850,7 +23850,7 @@ var init_zod = __esm(() => {
|
|
|
23850
23850
|
init_external();
|
|
23851
23851
|
});
|
|
23852
23852
|
|
|
23853
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
23853
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
23854
23854
|
function getProcessEnv() {
|
|
23855
23855
|
return getEnvVars();
|
|
23856
23856
|
}
|
|
@@ -23928,7 +23928,7 @@ var init_config = __esm(() => {
|
|
|
23928
23928
|
};
|
|
23929
23929
|
});
|
|
23930
23930
|
|
|
23931
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
23931
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
23932
23932
|
import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
23933
23933
|
import { dirname, resolve as resolvePath } from "path";
|
|
23934
23934
|
function createNodeFileSystem(root, paths) {
|
|
@@ -24015,7 +24015,7 @@ function findProjectRoot(startDir) {
|
|
|
24015
24015
|
}
|
|
24016
24016
|
var init_file_system_node = () => {};
|
|
24017
24017
|
|
|
24018
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
24018
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
|
|
24019
24019
|
var DbModuleNotInstalledError;
|
|
24020
24020
|
var init_db_errors = __esm(() => {
|
|
24021
24021
|
DbModuleNotInstalledError = class DbModuleNotInstalledError extends Error {
|
|
@@ -31226,7 +31226,7 @@ var init_execa = __esm(() => {
|
|
|
31226
31226
|
} = getIpcExport());
|
|
31227
31227
|
});
|
|
31228
31228
|
|
|
31229
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31229
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
|
|
31230
31230
|
function resolveDeadline(optionTimeout, defaultTimeout) {
|
|
31231
31231
|
if (optionTimeout === null)
|
|
31232
31232
|
return null;
|
|
@@ -31318,7 +31318,7 @@ function ownProcessGroupLifecycle(ownership) {
|
|
|
31318
31318
|
}
|
|
31319
31319
|
var MAX_TIMEOUT_MS = 2147483647, DEFAULT_KILL_GRACE_MS = 5000, GROUP_POLL_INTERVAL_MS = 25, GROUP_KILL_PATIENCE_MS = 2000;
|
|
31320
31320
|
|
|
31321
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31321
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
|
|
31322
31322
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
31323
31323
|
import { isatty } from "tty";
|
|
31324
31324
|
function processEventSeverity(reason, exitCode) {
|
|
@@ -31720,7 +31720,7 @@ var init_process_executor = __esm(() => {
|
|
|
31720
31720
|
init_config();
|
|
31721
31721
|
});
|
|
31722
31722
|
|
|
31723
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31723
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
|
|
31724
31724
|
function getNodeFileSystem() {
|
|
31725
31725
|
if (!_nodeFileSystem)
|
|
31726
31726
|
_nodeFileSystem = createNodeFileSystem();
|
|
@@ -31780,10 +31780,10 @@ var init_runtime_node_bun = __esm(() => {
|
|
|
31780
31780
|
};
|
|
31781
31781
|
});
|
|
31782
31782
|
|
|
31783
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31783
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
31784
31784
|
var init_context = () => {};
|
|
31785
31785
|
|
|
31786
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31786
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
31787
31787
|
function normalizeSeparators(path) {
|
|
31788
31788
|
return path.replaceAll("\\", "/");
|
|
31789
31789
|
}
|
|
@@ -31844,7 +31844,7 @@ var init_path = __esm(() => {
|
|
|
31844
31844
|
SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
31845
31845
|
});
|
|
31846
31846
|
|
|
31847
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31847
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/fs.js
|
|
31848
31848
|
async function walkDir(path, fs = createNodeFileSystem(), exclude) {
|
|
31849
31849
|
const startReal = fs.realPath?.(path) ?? path;
|
|
31850
31850
|
const visited = new Set([startReal]);
|
|
@@ -31878,17 +31878,17 @@ var init_fs = __esm(() => {
|
|
|
31878
31878
|
init_path();
|
|
31879
31879
|
});
|
|
31880
31880
|
|
|
31881
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31881
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
31882
31882
|
var REMOTE_SCHEMA_MAX_BYTES;
|
|
31883
31883
|
var init_schema_validation = __esm(() => {
|
|
31884
31884
|
init_dist2();
|
|
31885
31885
|
REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
|
|
31886
31886
|
});
|
|
31887
31887
|
|
|
31888
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31888
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
31889
31889
|
var init_types = () => {};
|
|
31890
31890
|
|
|
31891
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31891
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
31892
31892
|
var init_dist3 = __esm(() => {
|
|
31893
31893
|
init_file_system_node();
|
|
31894
31894
|
init_fs();
|
|
@@ -31902,7 +31902,7 @@ var init_dist3 = __esm(() => {
|
|
|
31902
31902
|
init_types();
|
|
31903
31903
|
});
|
|
31904
31904
|
|
|
31905
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31905
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
31906
31906
|
var configSchema2;
|
|
31907
31907
|
var init_config2 = __esm(() => {
|
|
31908
31908
|
init_dist2();
|
|
@@ -31926,7 +31926,7 @@ var init_config2 = __esm(() => {
|
|
|
31926
31926
|
});
|
|
31927
31927
|
});
|
|
31928
31928
|
|
|
31929
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
31929
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
31930
31930
|
import { appendFileSync as appendFileSync3, cpSync as cpSync2, createReadStream as createReadStream3, createWriteStream as createWriteStream3, existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync as readdirSync3, readFileSync as readFileSync6, realpathSync as realpathSync3, renameSync as renameSync2, rmSync as rmSync2, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
31931
31931
|
import { dirname as dirname4, resolve as resolvePath3 } from "path";
|
|
31932
31932
|
function createNodeFileSystem2(root, paths) {
|
|
@@ -32013,10 +32013,10 @@ function findProjectRoot2(startDir) {
|
|
|
32013
32013
|
}
|
|
32014
32014
|
var init_file_system_node2 = () => {};
|
|
32015
32015
|
|
|
32016
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
32016
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
32017
32017
|
var init_context2 = () => {};
|
|
32018
32018
|
|
|
32019
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
32019
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
32020
32020
|
function normalizeSeparators2(path) {
|
|
32021
32021
|
return path.replaceAll("\\", "/");
|
|
32022
32022
|
}
|
|
@@ -32077,17 +32077,17 @@ var init_path2 = __esm(() => {
|
|
|
32077
32077
|
SEP2 = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
32078
32078
|
});
|
|
32079
32079
|
|
|
32080
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
32080
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
32081
32081
|
var REMOTE_SCHEMA_MAX_BYTES2;
|
|
32082
32082
|
var init_schema_validation2 = __esm(() => {
|
|
32083
32083
|
init_dist2();
|
|
32084
32084
|
REMOTE_SCHEMA_MAX_BYTES2 = 5 * 1024 * 1024;
|
|
32085
32085
|
});
|
|
32086
32086
|
|
|
32087
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
32087
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
32088
32088
|
var init_types2 = () => {};
|
|
32089
32089
|
|
|
32090
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
32090
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
32091
32091
|
var init_dist4 = __esm(() => {
|
|
32092
32092
|
init_file_system_node2();
|
|
32093
32093
|
init_config2();
|
|
@@ -32097,7 +32097,7 @@ var init_dist4 = __esm(() => {
|
|
|
32097
32097
|
init_types2();
|
|
32098
32098
|
});
|
|
32099
32099
|
|
|
32100
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.
|
|
32100
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+01334333455a284a/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
|
|
32101
32101
|
import { Database } from "bun:sqlite";
|
|
32102
32102
|
var init_bun_sqlite = () => {};
|
|
32103
32103
|
|
|
@@ -36484,7 +36484,7 @@ var init_bun_sqlite2 = __esm(() => {
|
|
|
36484
36484
|
init_session2();
|
|
36485
36485
|
});
|
|
36486
36486
|
|
|
36487
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36487
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
|
|
36488
36488
|
var inboxMessages;
|
|
36489
36489
|
var init_inbox_messages = __esm(() => {
|
|
36490
36490
|
init_sqlite_core();
|
|
@@ -36504,7 +36504,7 @@ var init_inbox_messages = __esm(() => {
|
|
|
36504
36504
|
}, (table) => [index("idx_inbox_messages_to_status").on(table.toId, table.status)]);
|
|
36505
36505
|
});
|
|
36506
36506
|
|
|
36507
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36507
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/common.js
|
|
36508
36508
|
function nowTimestamp() {
|
|
36509
36509
|
return Date.now();
|
|
36510
36510
|
}
|
|
@@ -36533,7 +36533,7 @@ var init_common2 = __esm(() => {
|
|
|
36533
36533
|
appendOnlyColumns = buildAppendOnlyColumns();
|
|
36534
36534
|
});
|
|
36535
36535
|
|
|
36536
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36536
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
|
|
36537
36537
|
var queueJobs;
|
|
36538
36538
|
var init_queue_jobs = __esm(() => {
|
|
36539
36539
|
init_sqlite_core();
|
|
@@ -36557,7 +36557,7 @@ var init_queue_jobs = __esm(() => {
|
|
|
36557
36557
|
}, (table) => [index("queue_jobs_ready_idx").on(table.status, table.nextRetryAt, table.createdAt)]);
|
|
36558
36558
|
});
|
|
36559
36559
|
|
|
36560
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36560
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
|
|
36561
36561
|
var exports_runtime = {};
|
|
36562
36562
|
__export(exports_runtime, {
|
|
36563
36563
|
inboxMessages: () => inboxMessages,
|
|
@@ -36568,7 +36568,7 @@ var init_runtime = __esm(() => {
|
|
|
36568
36568
|
init_queue_jobs();
|
|
36569
36569
|
});
|
|
36570
36570
|
|
|
36571
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36571
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
|
|
36572
36572
|
class BunSqliteAdapter {
|
|
36573
36573
|
sqlite;
|
|
36574
36574
|
drizzleDb;
|
|
@@ -36874,7 +36874,7 @@ var init_d1 = __esm(() => {
|
|
|
36874
36874
|
init_session3();
|
|
36875
36875
|
});
|
|
36876
36876
|
|
|
36877
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36877
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
|
|
36878
36878
|
class D1Adapter {
|
|
36879
36879
|
binding;
|
|
36880
36880
|
drizzleDb;
|
|
@@ -36933,7 +36933,7 @@ var init_d12 = __esm(() => {
|
|
|
36933
36933
|
init_runtime();
|
|
36934
36934
|
});
|
|
36935
36935
|
|
|
36936
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36936
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/adapter.js
|
|
36937
36937
|
async function createDbAdapter(config) {
|
|
36938
36938
|
switch (config.driver) {
|
|
36939
36939
|
case "bun-sqlite": {
|
|
@@ -36967,7 +36967,7 @@ var init_drizzle_orm = __esm(() => {
|
|
|
36967
36967
|
init_view_common();
|
|
36968
36968
|
});
|
|
36969
36969
|
|
|
36970
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
36970
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/query-spec.js
|
|
36971
36971
|
function compilePredicate(predicate) {
|
|
36972
36972
|
if ("and" in predicate) {
|
|
36973
36973
|
const parts = predicate.and.map(compilePredicate).filter((p) => p !== undefined);
|
|
@@ -37005,7 +37005,7 @@ var init_query_spec = __esm(() => {
|
|
|
37005
37005
|
};
|
|
37006
37006
|
});
|
|
37007
37007
|
|
|
37008
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
37008
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/base-dao.js
|
|
37009
37009
|
function asSelectQuery(query) {
|
|
37010
37010
|
return query;
|
|
37011
37011
|
}
|
|
@@ -37047,7 +37047,7 @@ var init_base_dao = __esm(() => {
|
|
|
37047
37047
|
init_query_spec();
|
|
37048
37048
|
});
|
|
37049
37049
|
|
|
37050
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
37050
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
|
|
37051
37051
|
var EntityDao;
|
|
37052
37052
|
var init_entity_dao = __esm(() => {
|
|
37053
37053
|
init_drizzle_orm();
|
|
@@ -37209,7 +37209,7 @@ var init_entity_dao = __esm(() => {
|
|
|
37209
37209
|
};
|
|
37210
37210
|
});
|
|
37211
37211
|
|
|
37212
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
37212
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/index.js
|
|
37213
37213
|
var init_dist5 = __esm(() => {
|
|
37214
37214
|
init_base_dao();
|
|
37215
37215
|
init_entity_dao();
|
|
@@ -37713,7 +37713,7 @@ var init_ledger2 = __esm(() => {
|
|
|
37713
37713
|
init_output2();
|
|
37714
37714
|
});
|
|
37715
37715
|
|
|
37716
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
37716
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/errors.js
|
|
37717
37717
|
var BrowserAutomationError, InvalidProfileDirError, BrowserProfileMissingError, BrowserProfileBusyError, PlaywrightUnavailableError, LoginTimeoutError, OperationAbortedError;
|
|
37718
37718
|
var init_errors5 = __esm(() => {
|
|
37719
37719
|
BrowserAutomationError = class BrowserAutomationError extends Error {
|
|
@@ -37760,7 +37760,7 @@ var init_errors5 = __esm(() => {
|
|
|
37760
37760
|
};
|
|
37761
37761
|
});
|
|
37762
37762
|
|
|
37763
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
37763
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/profile-dir.js
|
|
37764
37764
|
function resolveProfileDir(profileDir) {
|
|
37765
37765
|
if (profileDir.trim() === "") {
|
|
37766
37766
|
throw new InvalidProfileDirError;
|
|
@@ -37776,7 +37776,7 @@ var init_profile_dir = __esm(() => {
|
|
|
37776
37776
|
init_errors5();
|
|
37777
37777
|
});
|
|
37778
37778
|
|
|
37779
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
37779
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/launcher.js
|
|
37780
37780
|
import { mkdir } from "fs/promises";
|
|
37781
37781
|
async function ensureProfileDir(profileDir, headless, fs) {
|
|
37782
37782
|
const existing = await fs.stat(profileDir);
|
|
@@ -37833,7 +37833,7 @@ var init_launcher = __esm(() => {
|
|
|
37833
37833
|
CHROMIUM_MISSING_PATTERN = /playwright install|executable doesn't exist/i;
|
|
37834
37834
|
});
|
|
37835
37835
|
|
|
37836
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
37836
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/operations.js
|
|
37837
37837
|
function getDefaultLauncher() {
|
|
37838
37838
|
if (defaultLauncher === undefined)
|
|
37839
37839
|
defaultLauncher = createPersistentLauncher();
|
|
@@ -37931,7 +37931,7 @@ var init_operations = __esm(() => {
|
|
|
37931
37931
|
init_profile_dir();
|
|
37932
37932
|
});
|
|
37933
37933
|
|
|
37934
|
-
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.
|
|
37934
|
+
// ../../node_modules/.bun/@gobing-ai+ts-browser-automation@0.8.4+7a0bf9ce62a9b753/node_modules/@gobing-ai/ts-browser-automation/dist/index.js
|
|
37935
37935
|
var init_dist6 = __esm(() => {
|
|
37936
37936
|
init_errors5();
|
|
37937
37937
|
init_operations();
|
|
@@ -43237,7 +43237,7 @@ var ConfigError = class extends Error {
|
|
|
43237
43237
|
}
|
|
43238
43238
|
};
|
|
43239
43239
|
|
|
43240
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.
|
|
43240
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.8.4+5042690a1c1c0ae5/node_modules/@gobing-ai/ts-infra/dist/logger.js
|
|
43241
43241
|
var ROOT_CATEGORY = "app";
|
|
43242
43242
|
function toLogTapeLevel(level) {
|
|
43243
43243
|
return level === "warn" ? "warning" : level;
|
|
@@ -43927,6 +43927,17 @@ function pluginEnvFromConfig(kind, name, configFile = resolveKkConfigPath()) {
|
|
|
43927
43927
|
break;
|
|
43928
43928
|
}
|
|
43929
43929
|
}
|
|
43930
|
+
if (name === "surfdash-pub") {
|
|
43931
|
+
const podcastNode = collectionNode["podcast-pub"];
|
|
43932
|
+
if (isPlainObject5(podcastNode) && isPlainObject5(podcastNode.env)) {
|
|
43933
|
+
for (const key of ["MICROFEED_BASE_URL", "MICROFEED_API_KEY"]) {
|
|
43934
|
+
const inherited = stringifyEnvValue(podcastNode.env[key]);
|
|
43935
|
+
if (inherited !== undefined && inherited !== "") {
|
|
43936
|
+
out[key] = inherited;
|
|
43937
|
+
}
|
|
43938
|
+
}
|
|
43939
|
+
}
|
|
43940
|
+
}
|
|
43930
43941
|
}
|
|
43931
43942
|
const pluginNode = collectionNode[name];
|
|
43932
43943
|
if (!isPlainObject5(pluginNode) || !isPlainObject5(pluginNode.env)) {
|
|
@@ -44290,7 +44301,7 @@ var FAMILY_SETTINGS = {
|
|
|
44290
44301
|
"kk-daily-ai-voice2": {
|
|
44291
44302
|
window: { kind: "duration" },
|
|
44292
44303
|
language: { kind: "choice", values: ["en", "zh", "ja"] },
|
|
44293
|
-
vdriver: { kind: "choice", values: ["voicebox", "ominivoice", "gemini", "voxcpm"] },
|
|
44304
|
+
vdriver: { kind: "choice", values: ["voicebox", "ominivoice", "gemini", "voxcpm", "vibe-voice", "vibevoice"] },
|
|
44294
44305
|
skip_review: { kind: "boolean" },
|
|
44295
44306
|
transcode_mp3: { kind: "boolean" },
|
|
44296
44307
|
cover_enabled: { kind: "boolean" },
|
|
@@ -45514,11 +45525,11 @@ async function resolveStorePath(configFile, explicitPath) {
|
|
|
45514
45525
|
// ../../packages/kk-store/src/dao/collect-runs.ts
|
|
45515
45526
|
init_dist5();
|
|
45516
45527
|
|
|
45517
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
45528
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/index.js
|
|
45518
45529
|
init_sqlite_core();
|
|
45519
45530
|
init_common2();
|
|
45520
45531
|
|
|
45521
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
45532
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
|
|
45522
45533
|
init_sqlite_core();
|
|
45523
45534
|
|
|
45524
45535
|
// ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/index.js
|
|
@@ -45790,10 +45801,10 @@ var createInsertSchema = (entity, refine) => {
|
|
|
45790
45801
|
return handleColumns(columns, refine ?? {}, insertConditions);
|
|
45791
45802
|
};
|
|
45792
45803
|
|
|
45793
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
45804
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
|
|
45794
45805
|
init_sqlite_core();
|
|
45795
45806
|
|
|
45796
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
45807
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
|
|
45797
45808
|
function sqlExpressionToText(value) {
|
|
45798
45809
|
if (typeof value !== "object" || value === null || !("queryChunks" in value)) {
|
|
45799
45810
|
return;
|
|
@@ -45816,7 +45827,7 @@ function getDrizzleTableName(table) {
|
|
|
45816
45827
|
return String(table[nameSym]);
|
|
45817
45828
|
}
|
|
45818
45829
|
|
|
45819
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
45830
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
|
|
45820
45831
|
function quoteIdent(name) {
|
|
45821
45832
|
return `"${name.replace(/"/g, '""')}"`;
|
|
45822
45833
|
}
|
|
@@ -45907,7 +45918,7 @@ function generateCreateTableSql(table) {
|
|
|
45907
45918
|
)`;
|
|
45908
45919
|
}
|
|
45909
45920
|
|
|
45910
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.
|
|
45921
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.8.4+5cdeb656394cd753/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
|
|
45911
45922
|
function defineTable(name, columns) {
|
|
45912
45923
|
const table = sqliteTable(name, columns);
|
|
45913
45924
|
let insert;
|
|
@@ -50882,6 +50893,30 @@ async function readLinkMap(fs, publishDir, plan) {
|
|
|
50882
50893
|
}
|
|
50883
50894
|
return { real, live, all };
|
|
50884
50895
|
}
|
|
50896
|
+
async function readPodcastTier0AssetLinks(fs, receiptsDir, parentRunId, consumerMode) {
|
|
50897
|
+
if (!await fs.exists(receiptsDir))
|
|
50898
|
+
return null;
|
|
50899
|
+
for (const name of (await fs.readDir(receiptsDir)).filter((entry) => entry.endsWith(".json"))) {
|
|
50900
|
+
try {
|
|
50901
|
+
const receipt = JSON.parse(await fs.readFile(join10(receiptsDir, name)));
|
|
50902
|
+
if (receipt.plugin !== "podcast-pub" || receipt.parentRunId !== parentRunId || receipt.status !== "succeeded" || receipt.dummy === true || consumerMode === "live" && receipt.mode !== "live" || receipt.aggregatePath === undefined) {
|
|
50903
|
+
continue;
|
|
50904
|
+
}
|
|
50905
|
+
if (!await fs.exists(receipt.aggregatePath))
|
|
50906
|
+
continue;
|
|
50907
|
+
const aggregate = JSON.parse(await fs.readFile(receipt.aggregatePath));
|
|
50908
|
+
const first = aggregate.targets?.[0];
|
|
50909
|
+
const rawImage = typeof first?.metadata?.imageUrl === "string" ? first.metadata.imageUrl : undefined;
|
|
50910
|
+
const rawUrl = typeof first?.url === "string" ? first.url : receipt.url;
|
|
50911
|
+
const imageUrl = rawImage !== undefined && /^https:\/\//.test(rawImage) ? rawImage : undefined;
|
|
50912
|
+
const podcastUrl = rawUrl !== undefined && /^https:\/\//.test(rawUrl) ? rawUrl : undefined;
|
|
50913
|
+
if (imageUrl !== undefined || podcastUrl !== undefined) {
|
|
50914
|
+
return { ...imageUrl ? { imageUrl } : {}, ...podcastUrl ? { podcastUrl } : {} };
|
|
50915
|
+
}
|
|
50916
|
+
} catch {}
|
|
50917
|
+
}
|
|
50918
|
+
return null;
|
|
50919
|
+
}
|
|
50885
50920
|
async function readOwnerReceipts(fs, publishDir) {
|
|
50886
50921
|
const receiptsDir = join10(publishDir, "receipts");
|
|
50887
50922
|
if (!await fs.exists(receiptsDir))
|
|
@@ -51064,8 +51099,36 @@ async function sendPublishMatrix(args, deps = {}) {
|
|
|
51064
51099
|
...deps.dispatch ? { dispatch: deps.dispatch } : {},
|
|
51065
51100
|
dummyReceipt: (row, context) => writeDummyReceipt(fs, row, { ...context, parentRunId: plan.parentRunId, planDigest }),
|
|
51066
51101
|
preparePayload: async (row) => {
|
|
51067
|
-
if (tier === 0)
|
|
51102
|
+
if (tier === 0) {
|
|
51103
|
+
if (row.plugin === "surfdash-pub" && await fs.exists(row.payloadPath)) {
|
|
51104
|
+
const rawDigest = createHash2("sha256").update(await fs.readFile(row.payloadPath)).digest("hex");
|
|
51105
|
+
const priorReceiptPath = join10(receiptsDir, `${row.key}.json`);
|
|
51106
|
+
if (await fs.exists(priorReceiptPath)) {
|
|
51107
|
+
try {
|
|
51108
|
+
const prior = JSON.parse(await fs.readFile(priorReceiptPath));
|
|
51109
|
+
if (prior.status === "succeeded" && prior.dummy !== true && prior.parentRunId === plan.parentRunId && prior.payloadDigest === rawDigest) {
|
|
51110
|
+
return { payloadPath: row.payloadPath };
|
|
51111
|
+
}
|
|
51112
|
+
} catch {}
|
|
51113
|
+
}
|
|
51114
|
+
const podcastLinks = await readPodcastTier0AssetLinks(fs, receiptsDir, plan.parentRunId, row.mode);
|
|
51115
|
+
if (podcastLinks !== null) {
|
|
51116
|
+
const parsed = JSON.parse(await fs.readFile(row.payloadPath));
|
|
51117
|
+
const nextMetadata = { ...parsed.metadata ?? {} };
|
|
51118
|
+
if (podcastLinks.imageUrl !== undefined) {
|
|
51119
|
+
nextMetadata.coverImage = podcastLinks.imageUrl;
|
|
51120
|
+
}
|
|
51121
|
+
if (podcastLinks.podcastUrl !== undefined) {
|
|
51122
|
+
nextMetadata.podcastUrl = podcastLinks.podcastUrl;
|
|
51123
|
+
}
|
|
51124
|
+
const resolvedPath = join10(workDir, "4-publish", "payloads", `content.${row.key}.resolved.json`);
|
|
51125
|
+
await fs.writeFile(resolvedPath, `${JSON.stringify({ ...parsed, metadata: nextMetadata }, null, 2)}
|
|
51126
|
+
`);
|
|
51127
|
+
return { payloadPath: resolvedPath };
|
|
51128
|
+
}
|
|
51129
|
+
}
|
|
51068
51130
|
return { payloadPath: row.payloadPath };
|
|
51131
|
+
}
|
|
51069
51132
|
const raw = await fs.exists(row.payloadPath) ? await fs.readFile(row.payloadPath) : "";
|
|
51070
51133
|
const links = row.mode === "dummy" ? linkMaps.all : row.mode === "live" ? linkMaps.live : linkMaps.real;
|
|
51071
51134
|
let cardLink;
|
|
@@ -56675,8 +56738,14 @@ async function runArticleBundle(input, fs = createNodeFileSystem()) {
|
|
|
56675
56738
|
init_ledger2();
|
|
56676
56739
|
var PARSE_JSON2 = JSON.parse.bind(JSON);
|
|
56677
56740
|
var NEWS_TOPIC = "ai-news";
|
|
56678
|
-
var VOICE_ENGINES = ["voxcpm", "gemini", "omnivoice"];
|
|
56679
|
-
var ENGINE_DRIVERS = {
|
|
56741
|
+
var VOICE_ENGINES = ["voxcpm", "gemini", "omnivoice", "voicebox", "vibe-voice"];
|
|
56742
|
+
var ENGINE_DRIVERS = {
|
|
56743
|
+
voxcpm: "voxcpm",
|
|
56744
|
+
gemini: "gemini",
|
|
56745
|
+
omnivoice: "ominivoice",
|
|
56746
|
+
voicebox: "voicebox",
|
|
56747
|
+
"vibe-voice": "vibe-voice"
|
|
56748
|
+
};
|
|
56680
56749
|
var NEWS_CHECK_STEPS = ["curate", "script"];
|
|
56681
56750
|
var BUNDLE_STAGES = ["variants", "freeze"];
|
|
56682
56751
|
var STORE_SELECT_TIMEOUT_MS = 120000;
|
|
@@ -56991,7 +57060,8 @@ var ARGS = {
|
|
|
56991
57060
|
NEWS_TOPIC,
|
|
56992
57061
|
ctx.settings.window,
|
|
56993
57062
|
String(ctx.settings.episode_min_minutes),
|
|
56994
|
-
ctx.settings.vdriver
|
|
57063
|
+
ctx.settings.vdriver,
|
|
57064
|
+
String(ctx.settings.plan_max_items)
|
|
56995
57065
|
],
|
|
56996
57066
|
plan: (ctx) => [
|
|
56997
57067
|
ctx.workDir,
|
|
@@ -57271,12 +57341,13 @@ var GENERATE_ROWS = [
|
|
|
57271
57341
|
verb: "generate-voice",
|
|
57272
57342
|
stages: [
|
|
57273
57343
|
STEP.generate(),
|
|
57274
|
-
STEP.
|
|
57275
|
-
STEP.
|
|
57276
|
-
STEP.
|
|
57277
|
-
STEP.
|
|
57278
|
-
STEP.
|
|
57279
|
-
STEP.
|
|
57344
|
+
STEP.poolGate(),
|
|
57345
|
+
{ ...STEP.intro(), when: candidatesNonEmpty },
|
|
57346
|
+
{ ...STEP.voiceAudit(), when: candidatesNonEmpty },
|
|
57347
|
+
{ ...STEP.duration(), when: candidatesNonEmpty },
|
|
57348
|
+
{ ...STEP.qualityReport(), when: candidatesNonEmpty },
|
|
57349
|
+
{ ...STEP.qualityVerdict(), when: candidatesNonEmpty },
|
|
57350
|
+
{ ...STEP.showNotes(), when: candidatesNonEmpty }
|
|
57280
57351
|
],
|
|
57281
57352
|
summary: async (ctx) => {
|
|
57282
57353
|
const metadata = await audioMetadata(ctx);
|
|
@@ -58106,10 +58177,7 @@ function validateLiveTokens(preset, window, tokens, presetName) {
|
|
|
58106
58177
|
fail2(5, "kk.content.publish", `cannot validate --live-channels: preset '${presetName}' was not found`);
|
|
58107
58178
|
}
|
|
58108
58179
|
const inWindow = (preset.targets ?? []).filter((target) => (target.window ?? "after-generate") === window);
|
|
58109
|
-
const refused = tokens.filter((token) =>
|
|
58110
|
-
const row = inWindow.find((target) => target.plugin === token || target.id === token);
|
|
58111
|
-
return row === undefined || (row.mode ?? "draft") === "off";
|
|
58112
|
-
});
|
|
58180
|
+
const refused = tokens.filter((token) => !inWindow.some((target) => (target.plugin === token || target.id === token) && (target.mode ?? "draft") !== "off"));
|
|
58113
58181
|
if (refused.length > 0) {
|
|
58114
58182
|
fail2(5, "kk.content.publish", `live token(s) ${refused.join(", ")} have no active row in window '${window}' of preset '${presetName}'`);
|
|
58115
58183
|
}
|
|
@@ -58626,6 +58694,7 @@ async function settleAction(type, options) {
|
|
|
58626
58694
|
return commandFailure(command, 1, "publish-settle: classification failed");
|
|
58627
58695
|
if (context.window === "after-generate") {
|
|
58628
58696
|
await quietStdout2(() => runStageCancellable(["publish-matrix-patch-surfdash", context.workDir, "--window", context.window]));
|
|
58697
|
+
await quietStdout2(() => runStageCancellable(["publish-matrix-patch-podcast", context.workDir, "--window", context.window]));
|
|
58629
58698
|
}
|
|
58630
58699
|
const statusPath = join32(context.workDir, "4-publish", `publish-status.${context.window}.txt`);
|
|
58631
58700
|
if (await fs.exists(statusPath) && /^(full|partial|none)$/.test((await fs.readFile(statusPath)).trim())) {
|
|
@@ -58692,6 +58761,13 @@ async function reportAction(type, options) {
|
|
|
58692
58761
|
consoleOutput.error(`publish-report: ledger sync warning: ${error instanceof Error ? error.message : String(error)}`);
|
|
58693
58762
|
}
|
|
58694
58763
|
consoleOutput.write(JSON.stringify({ report: reportPath }));
|
|
58764
|
+
try {
|
|
58765
|
+
const pruneCode = await quietStdout2(async () => runStage(["audio-prune", context.workDir]));
|
|
58766
|
+
if (pruneCode !== 0)
|
|
58767
|
+
consoleOutput.error(`publish-report: audio-prune exited ${pruneCode}`);
|
|
58768
|
+
} catch (error) {
|
|
58769
|
+
consoleOutput.error(`publish-report: audio-prune warning: ${error instanceof Error ? error.message : String(error)}`);
|
|
58770
|
+
}
|
|
58695
58771
|
const outcomePath = join32(context.workDir, "4-publish", `outcome.${context.window}.json`);
|
|
58696
58772
|
if (await fs.exists(outcomePath)) {
|
|
58697
58773
|
let rows;
|
|
@@ -59742,6 +59818,7 @@ function silentWav(seconds = SILENT_WAV_SECONDS) {
|
|
|
59742
59818
|
// ../../plugins/generations/music-gen/src/adapter/instance.ts
|
|
59743
59819
|
var GENERATE_PATH = "/api/lyria/generate";
|
|
59744
59820
|
var LIBRARY_PATH = "/api/generations";
|
|
59821
|
+
var STATUS_PATH = "/api/settings/status";
|
|
59745
59822
|
var ANALYZE_PATH = "/api/ai/analyze";
|
|
59746
59823
|
var DEFAULT_CONNECT_ATTEMPTS = 3;
|
|
59747
59824
|
var DEFAULT_RETRY_DELAY_MS = 250;
|
|
@@ -59895,14 +59972,15 @@ class InstanceClient {
|
|
|
59895
59972
|
}
|
|
59896
59973
|
async attempt(method, path, body) {
|
|
59897
59974
|
const controller = new AbortController;
|
|
59898
|
-
|
|
59975
|
+
const enforceConnectTimer = method === "GET";
|
|
59976
|
+
let phase = enforceConnectTimer ? "connect" : "body";
|
|
59899
59977
|
let abortReason;
|
|
59900
|
-
const connectTimer = setTimeout(() => {
|
|
59978
|
+
const connectTimer = enforceConnectTimer ? setTimeout(() => {
|
|
59901
59979
|
if (phase === "connect" && abortReason === undefined) {
|
|
59902
59980
|
abortReason = "connect-timeout";
|
|
59903
59981
|
controller.abort();
|
|
59904
59982
|
}
|
|
59905
|
-
}, this.connectTimeoutMs);
|
|
59983
|
+
}, this.connectTimeoutMs) : undefined;
|
|
59906
59984
|
const totalTimer = setTimeout(() => {
|
|
59907
59985
|
if (abortReason === undefined) {
|
|
59908
59986
|
abortReason = "generate-timeout";
|
|
@@ -59921,7 +59999,9 @@ class InstanceClient {
|
|
|
59921
59999
|
};
|
|
59922
60000
|
const response = await this.fetchImpl(this.url(path), init);
|
|
59923
60001
|
phase = "body";
|
|
59924
|
-
|
|
60002
|
+
if (connectTimer !== undefined) {
|
|
60003
|
+
clearTimeout(connectTimer);
|
|
60004
|
+
}
|
|
59925
60005
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
59926
60006
|
const contentType = response.headers.get("content-type") ?? undefined;
|
|
59927
60007
|
return {
|
|
@@ -59954,7 +60034,9 @@ class InstanceClient {
|
|
|
59954
60034
|
}
|
|
59955
60035
|
return { kind: "ambiguous", reason };
|
|
59956
60036
|
} finally {
|
|
59957
|
-
|
|
60037
|
+
if (connectTimer !== undefined) {
|
|
60038
|
+
clearTimeout(connectTimer);
|
|
60039
|
+
}
|
|
59958
60040
|
clearTimeout(totalTimer);
|
|
59959
60041
|
}
|
|
59960
60042
|
}
|
|
@@ -59989,6 +60071,17 @@ class InstanceClient {
|
|
|
59989
60071
|
let lastReason = "";
|
|
59990
60072
|
for (;; ) {
|
|
59991
60073
|
attempts += 1;
|
|
60074
|
+
if (method === "POST") {
|
|
60075
|
+
const probe = await this.attempt("GET", STATUS_PATH, undefined);
|
|
60076
|
+
if (probe.kind === "connect") {
|
|
60077
|
+
lastReason = probe.reason;
|
|
60078
|
+
if (attempts >= maxAttempts) {
|
|
60079
|
+
return { kind: "connect-exhausted", reason: lastReason, attempts };
|
|
60080
|
+
}
|
|
60081
|
+
await this.sleep(this.retryDelayMs * 2 ** (attempts - 1));
|
|
60082
|
+
continue;
|
|
60083
|
+
}
|
|
60084
|
+
}
|
|
59992
60085
|
const outcome = await this.attempt(method, path, body);
|
|
59993
60086
|
if (outcome.kind === "response") {
|
|
59994
60087
|
return this.classify(outcome.response, attempts);
|
|
@@ -62010,7 +62103,7 @@ init_zod();
|
|
|
62010
62103
|
// ../../plugins/generations/music-gen/src/presets.ts
|
|
62011
62104
|
init_dist3();
|
|
62012
62105
|
init_zod();
|
|
62013
|
-
import { join as join38 } from "path";
|
|
62106
|
+
import { join as join38, resolve as resolve29 } from "path";
|
|
62014
62107
|
var BUILTIN_DEFAULTS = {
|
|
62015
62108
|
model: "pro",
|
|
62016
62109
|
language: "EN",
|
|
@@ -62386,6 +62479,25 @@ class PresetDataError extends Error {
|
|
|
62386
62479
|
}
|
|
62387
62480
|
}
|
|
62388
62481
|
var MUSIC_PRESET_ROOT = join38(import.meta.dir, "..", "presets");
|
|
62482
|
+
function musicPresetRootCandidates(from = import.meta.dir) {
|
|
62483
|
+
const candidates = [];
|
|
62484
|
+
let dir = resolve29(from);
|
|
62485
|
+
for (;; ) {
|
|
62486
|
+
candidates.push(join38(dir, "..", "presets"));
|
|
62487
|
+
candidates.push(join38(dir, "plugins", "generations", "music-gen", "presets"));
|
|
62488
|
+
const parent = resolve29(dir, "..");
|
|
62489
|
+
if (parent === dir)
|
|
62490
|
+
return candidates;
|
|
62491
|
+
dir = parent;
|
|
62492
|
+
}
|
|
62493
|
+
}
|
|
62494
|
+
async function resolveMusicPresetRoot(fs, from) {
|
|
62495
|
+
for (const candidate of musicPresetRootCandidates(from)) {
|
|
62496
|
+
if (await fs.exists(candidate))
|
|
62497
|
+
return candidate;
|
|
62498
|
+
}
|
|
62499
|
+
return MUSIC_PRESET_ROOT;
|
|
62500
|
+
}
|
|
62389
62501
|
async function readPresetFiles(dir, axis, fs, problems) {
|
|
62390
62502
|
if (!await fs.exists(dir)) {
|
|
62391
62503
|
problems.push({ path: dir, field: axis, message: "preset directory is missing" });
|
|
@@ -62462,8 +62574,8 @@ function collectPresets(args) {
|
|
|
62462
62574
|
return byName;
|
|
62463
62575
|
}
|
|
62464
62576
|
async function loadMusicPresets(options = {}) {
|
|
62465
|
-
const root = options.root ?? MUSIC_PRESET_ROOT;
|
|
62466
62577
|
const fs = options.fileSystem ?? createNodeFileSystem();
|
|
62578
|
+
const root = options.root ?? await resolveMusicPresetRoot(fs);
|
|
62467
62579
|
const problems = [];
|
|
62468
62580
|
const formatFiles = await readPresetFiles(join38(root, "formats"), "formats", fs, problems);
|
|
62469
62581
|
const themeFiles = await readPresetFiles(join38(root, "themes"), "themes", fs, problems);
|
|
@@ -62621,7 +62733,7 @@ function parseMusicJob(docs) {
|
|
|
62621
62733
|
return { brief, spec, job: resolveJob(brief, asPresetLayers(spec)) };
|
|
62622
62734
|
}
|
|
62623
62735
|
// ../../plugins/generations/music-gen/src/plugin.ts
|
|
62624
|
-
import { dirname as dirname18, join as join39, resolve as
|
|
62736
|
+
import { dirname as dirname18, join as join39, resolve as resolve30 } from "path";
|
|
62625
62737
|
init_dist3();
|
|
62626
62738
|
init_dist();
|
|
62627
62739
|
|
|
@@ -62873,7 +62985,7 @@ function isVerbose2(command) {
|
|
|
62873
62985
|
}
|
|
62874
62986
|
|
|
62875
62987
|
// src/commands/music/verbs.ts
|
|
62876
|
-
import { dirname as dirname19, join as join40, resolve as
|
|
62988
|
+
import { dirname as dirname19, join as join40, resolve as resolve31 } from "path";
|
|
62877
62989
|
init_output2();
|
|
62878
62990
|
var PAID_VERBS = new Set(["gen", "analyze"]);
|
|
62879
62991
|
function envelope(verb, dryRun) {
|
|
@@ -62945,7 +63057,7 @@ function emitPayload(payload, json, human) {
|
|
|
62945
63057
|
}
|
|
62946
63058
|
}
|
|
62947
63059
|
async function runRender(options, context) {
|
|
62948
|
-
const brief = await readBrief(
|
|
63060
|
+
const brief = await readBrief(resolve31(options.in));
|
|
62949
63061
|
const presets = await loadPresets(options.root);
|
|
62950
63062
|
const workflow = defaultModelLayer(brief, presets, context.config);
|
|
62951
63063
|
const job = resolveNamedJob(brief, presets, workflow === undefined ? {} : { workflow });
|
|
@@ -62954,14 +63066,14 @@ async function runRender(options, context) {
|
|
|
62954
63066
|
const imageHashes = await Promise.all((brief.images ?? []).map(async (path) => sha256Hex3(await readImageBytes(path))));
|
|
62955
63067
|
const digest = takeDigest(job, { imageHashes, takeIndex: 0 });
|
|
62956
63068
|
const explain = explainJob(job);
|
|
62957
|
-
const outPath = options.out === undefined ? null :
|
|
63069
|
+
const outPath = options.out === undefined ? null : resolve31(options.out);
|
|
62958
63070
|
if (outPath !== null) {
|
|
62959
63071
|
await musicSeams.fileSystem.writeFile(outPath, `${prompt}
|
|
62960
63072
|
`);
|
|
62961
63073
|
}
|
|
62962
63074
|
const payload = {
|
|
62963
63075
|
...envelope("render", context.config.dryRun),
|
|
62964
|
-
brief:
|
|
63076
|
+
brief: resolve31(options.in),
|
|
62965
63077
|
prompt,
|
|
62966
63078
|
request,
|
|
62967
63079
|
explain
|
|
@@ -63014,8 +63126,8 @@ async function runLibrary(_options, context) {
|
|
|
63014
63126
|
}
|
|
63015
63127
|
async function runGen(options, context) {
|
|
63016
63128
|
const fs = musicSeams.fileSystem;
|
|
63017
|
-
const inputPath =
|
|
63018
|
-
const outputPath =
|
|
63129
|
+
const inputPath = resolve31(options.in);
|
|
63130
|
+
const outputPath = resolve31(options.out);
|
|
63019
63131
|
const takes = options.takes === undefined ? undefined : Number(options.takes);
|
|
63020
63132
|
if (options.takes !== undefined && (!Number.isInteger(takes) || (takes ?? 0) < 1)) {
|
|
63021
63133
|
throw new Error(`--takes ${options.takes} is not a whole number of takes (1 or more)`);
|
|
@@ -63124,14 +63236,14 @@ function analysisObject(raw) {
|
|
|
63124
63236
|
return typeof nested === "object" && nested !== null ? nested : parsed;
|
|
63125
63237
|
}
|
|
63126
63238
|
async function runCheck(takePath, options, context) {
|
|
63127
|
-
const artifactPath =
|
|
63239
|
+
const artifactPath = resolve31(takePath);
|
|
63128
63240
|
const sidecar = await readSidecar(artifactPath);
|
|
63129
|
-
const brief = options.brief === undefined ? null : await readBrief(
|
|
63241
|
+
const brief = options.brief === undefined ? null : await readBrief(resolve31(options.brief));
|
|
63130
63242
|
const model = takeModel(options.model ?? brief?.model, sidecar);
|
|
63131
63243
|
const durationTarget = options.durationTarget ?? sidecar?.durationTarget ?? brief?.duration_target;
|
|
63132
63244
|
const style = options.style ?? brief?.style;
|
|
63133
63245
|
const sections = options.sections ?? (brief?.structure === undefined ? undefined : String(brief.structure.length));
|
|
63134
|
-
const analysisPath = options.analysis === undefined ? sidecar === null ? undefined :
|
|
63246
|
+
const analysisPath = options.analysis === undefined ? sidecar === null ? undefined : resolve31(join40(dirname19(artifactPath), `analysis-${sidecar.instanceId}.json`)) : resolve31(options.analysis);
|
|
63135
63247
|
const hasAnalysis = analysisPath !== undefined && await musicSeams.fileSystem.exists(analysisPath);
|
|
63136
63248
|
const analysis = hasAnalysis ? analysisObject(await musicSeams.fileSystem.readFile(analysisPath)) : undefined;
|
|
63137
63249
|
const runner = musicSeams.audioRunner;
|
|
@@ -63157,7 +63269,7 @@ async function runCheck(takePath, options, context) {
|
|
|
63157
63269
|
return payload;
|
|
63158
63270
|
}
|
|
63159
63271
|
async function runMaster(takePath, options, context) {
|
|
63160
|
-
const take =
|
|
63272
|
+
const take = resolve31(takePath);
|
|
63161
63273
|
const profileName = options.profile ?? DEFAULT_DELIVERY_PROFILE;
|
|
63162
63274
|
const profile = resolveDeliveryProfile(profileName, context.config.delivery);
|
|
63163
63275
|
const runner = musicSeams.audioRunner;
|
|
@@ -63165,7 +63277,7 @@ async function runMaster(takePath, options, context) {
|
|
|
63165
63277
|
takePath: take,
|
|
63166
63278
|
profileName,
|
|
63167
63279
|
profile,
|
|
63168
|
-
...options.out === undefined ? {} : { outputPath:
|
|
63280
|
+
...options.out === undefined ? {} : { outputPath: resolve31(options.out) },
|
|
63169
63281
|
...runner === undefined ? {} : { runner }
|
|
63170
63282
|
});
|
|
63171
63283
|
const sidecar = await readSidecar(take);
|
|
@@ -63240,7 +63352,7 @@ function registerMusicCommand(program) {
|
|
|
63240
63352
|
|
|
63241
63353
|
// src/commands/plugin.ts
|
|
63242
63354
|
import { existsSync as existsSync6 } from "fs";
|
|
63243
|
-
import { resolve as
|
|
63355
|
+
import { resolve as resolve32 } from "path";
|
|
63244
63356
|
init_dist();
|
|
63245
63357
|
init_commander();
|
|
63246
63358
|
init_output2();
|
|
@@ -63252,7 +63364,7 @@ function buildStatusReport(opts) {
|
|
|
63252
63364
|
const discovery = discoverAllPlugins({ pluginsRoot: opts.pluginsRoot, extraPaths: opts.pluginsPath });
|
|
63253
63365
|
const plugins = discovery.plugins.map((record) => {
|
|
63254
63366
|
const diagnostics = [];
|
|
63255
|
-
const entryPath =
|
|
63367
|
+
const entryPath = resolve32(record.dir, record.entry);
|
|
63256
63368
|
if (!existsSync6(entryPath)) {
|
|
63257
63369
|
diagnostics.push({
|
|
63258
63370
|
code: "missing_entry",
|
|
@@ -63454,11 +63566,12 @@ function registerPluginCommand(program) {
|
|
|
63454
63566
|
init_dist3();
|
|
63455
63567
|
init_commander();
|
|
63456
63568
|
init_output2();
|
|
63569
|
+
import { existsSync as existsSync7, realpathSync as realpathSync6 } from "fs";
|
|
63457
63570
|
import { homedir as homedir13 } from "os";
|
|
63458
|
-
import { resolve as
|
|
63571
|
+
import { dirname as dirname20, join as join41, resolve as resolve33 } from "path";
|
|
63459
63572
|
var SCHEDULE_PLATFORMS = ["launchd", "cron", "grok-bot"];
|
|
63460
63573
|
var SCHEDULES_REL = "plugins/kk/schedules";
|
|
63461
|
-
var CHECKOUT_ROOT2 =
|
|
63574
|
+
var CHECKOUT_ROOT2 = resolve33(import.meta.dir, "../../../..");
|
|
63462
63575
|
var SCHEDULE_TEMPLATES = {
|
|
63463
63576
|
"kk-collect": { launchd: "launchd.plist.tmpl", cron: "cron.tmpl", "grok-bot": "kk-collect.grok-bot.md.tmpl" },
|
|
63464
63577
|
"kk-serve": { launchd: "kk-serve.launchd.plist.tmpl" },
|
|
@@ -63471,6 +63584,28 @@ var DEFAULT_GROK_CRON = "0 4,10,16,22 * * *";
|
|
|
63471
63584
|
var REPO_PLACEHOLDER = "{{repo}}";
|
|
63472
63585
|
var HOME_PLACEHOLDER = "{{home}}";
|
|
63473
63586
|
var TYPESAFE_API_KEY_PLACEHOLDER = "{{typesafe_api_key}}";
|
|
63587
|
+
var SPUR_MODULES_PLACEHOLDER = "{{spur_modules}}";
|
|
63588
|
+
function spurModulesDir() {
|
|
63589
|
+
const conventional = resolve33(homedir13(), ".bun/install/global/node_modules");
|
|
63590
|
+
const binary = Bun.which("spur");
|
|
63591
|
+
if (binary === null)
|
|
63592
|
+
return conventional;
|
|
63593
|
+
let dir;
|
|
63594
|
+
try {
|
|
63595
|
+
dir = dirname20(realpathSync6(binary));
|
|
63596
|
+
} catch {
|
|
63597
|
+
return conventional;
|
|
63598
|
+
}
|
|
63599
|
+
for (;; ) {
|
|
63600
|
+
const modules = join41(dir, "node_modules");
|
|
63601
|
+
if (existsSync7(join41(modules, "@gobing-ai/spur/package.json")))
|
|
63602
|
+
return modules;
|
|
63603
|
+
const parent = dirname20(dir);
|
|
63604
|
+
if (parent === dir)
|
|
63605
|
+
return conventional;
|
|
63606
|
+
dir = parent;
|
|
63607
|
+
}
|
|
63608
|
+
}
|
|
63474
63609
|
function minuteGap(cronExpr) {
|
|
63475
63610
|
const minutes = new Set;
|
|
63476
63611
|
for (const part of (cronExpr.trim().split(/\s+/)[0] ?? "").split(",")) {
|
|
@@ -63508,7 +63643,7 @@ function xmlEscape(value) {
|
|
|
63508
63643
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
63509
63644
|
}
|
|
63510
63645
|
async function readTemplate(fs, repo, file) {
|
|
63511
|
-
const candidates = [
|
|
63646
|
+
const candidates = [resolve33(repo, SCHEDULES_REL, file), resolve33(CHECKOUT_ROOT2, SCHEDULES_REL, file)];
|
|
63512
63647
|
for (const path of candidates) {
|
|
63513
63648
|
if (await fs.exists(path)) {
|
|
63514
63649
|
return await fs.readFile(path);
|
|
@@ -63537,9 +63672,9 @@ async function renderAction(schedule, options) {
|
|
|
63537
63672
|
}
|
|
63538
63673
|
throw new Error(`schedule '${schedule}' has no ${options.platform} template (expected ${Object.keys(templates).join("|")})`);
|
|
63539
63674
|
}
|
|
63540
|
-
const repo =
|
|
63675
|
+
const repo = resolve33(options.repo);
|
|
63541
63676
|
const rendered = isGrok ? await renderGrokBody(options, template) : await readTemplate(createNodeFileSystem(), repo, template);
|
|
63542
|
-
const substitution = isGrok ? rendered.replaceAll("{{bot}}", options.bot ?? "").replaceAll("{{cron}}", options.cron ?? DEFAULT_GROK_CRON).replaceAll("{{tz}}", options.tz || Intl.DateTimeFormat().resolvedOptions().timeZone) : rendered.replaceAll(REPO_PLACEHOLDER, repo).replaceAll(HOME_PLACEHOLDER, homedir13()).replaceAll(TYPESAFE_API_KEY_PLACEHOLDER, xmlEscape(process.env.TYPESAFE_API_KEY ?? ""));
|
|
63677
|
+
const substitution = isGrok ? rendered.replaceAll("{{bot}}", options.bot ?? "").replaceAll("{{cron}}", options.cron ?? DEFAULT_GROK_CRON).replaceAll("{{tz}}", options.tz || Intl.DateTimeFormat().resolvedOptions().timeZone) : rendered.replaceAll(REPO_PLACEHOLDER, repo).replaceAll(HOME_PLACEHOLDER, homedir13()).replaceAll(TYPESAFE_API_KEY_PLACEHOLDER, xmlEscape(process.env.TYPESAFE_API_KEY ?? "")).replaceAll(SPUR_MODULES_PLACEHOLDER, xmlEscape(spurModulesDir()));
|
|
63543
63678
|
if (isGrok && substitution.includes("{{")) {
|
|
63544
63679
|
throw new Error("grok-bot routine left an unsubstituted placeholder \u2014 grok-bot templates may carry only {{bot}}, {{cron}}, {{tz}}");
|
|
63545
63680
|
}
|
|
@@ -63566,7 +63701,7 @@ async function renderGrokBody(options, template) {
|
|
|
63566
63701
|
throw new Error(`--cron '${options.cron}' fires under ${GROK_MIN_INTERVAL_MINUTES} minutes apart \u2014 Grok Bot routines need a ${GROK_MIN_INTERVAL_MINUTES}-minute minimum gap`);
|
|
63567
63702
|
}
|
|
63568
63703
|
}
|
|
63569
|
-
return await readTemplate(createNodeFileSystem(),
|
|
63704
|
+
return await readTemplate(createNodeFileSystem(), resolve33(options.repo), template);
|
|
63570
63705
|
}
|
|
63571
63706
|
function registerScheduleCommand(program) {
|
|
63572
63707
|
const schedule = program.command("schedule").description("Render the operator-installed schedules");
|
|
@@ -63639,7 +63774,7 @@ function registerStageCommand(program) {
|
|
|
63639
63774
|
}
|
|
63640
63775
|
|
|
63641
63776
|
// src/commands/store.ts
|
|
63642
|
-
import { dirname as
|
|
63777
|
+
import { dirname as dirname21, join as join43, resolve as resolve35 } from "path";
|
|
63643
63778
|
init_dist3();
|
|
63644
63779
|
init_commander();
|
|
63645
63780
|
|
|
@@ -63647,16 +63782,16 @@ init_commander();
|
|
|
63647
63782
|
init_dist3();
|
|
63648
63783
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
63649
63784
|
import { tmpdir as tmpdir4 } from "os";
|
|
63650
|
-
import { join as
|
|
63785
|
+
import { join as join42, resolve as resolve34 } from "path";
|
|
63651
63786
|
var STORE_CATALOG_PATH_REL = "plugins/kk/decisions/kk-items.yaml";
|
|
63652
63787
|
var SPUR_CONFIG_PATH_REL = ".spur/config.yaml";
|
|
63653
63788
|
var EVIDENCE_MAX_CHARS = 2000;
|
|
63654
63789
|
var SUBPROCESS_FALLBACK_AFTER = 2;
|
|
63655
63790
|
async function resolveCatalogPath(projectRoot, fs = createNodeFileSystem()) {
|
|
63656
63791
|
const candidates = [
|
|
63657
|
-
|
|
63658
|
-
|
|
63659
|
-
|
|
63792
|
+
resolve34(projectRoot, STORE_CATALOG_PATH_REL),
|
|
63793
|
+
resolve34(import.meta.dir, "../../..", STORE_CATALOG_PATH_REL),
|
|
63794
|
+
resolve34(import.meta.dir, "..", STORE_CATALOG_PATH_REL)
|
|
63660
63795
|
];
|
|
63661
63796
|
for (const candidate of candidates) {
|
|
63662
63797
|
if (await fs.exists(candidate))
|
|
@@ -63676,7 +63811,7 @@ async function loadInjectedHub() {
|
|
|
63676
63811
|
}
|
|
63677
63812
|
async function readDecisionRouting(projectRoot, fs = createNodeFileSystem()) {
|
|
63678
63813
|
const catalogPath = await resolveCatalogPath(projectRoot, fs);
|
|
63679
|
-
const configPath =
|
|
63814
|
+
const configPath = join42(projectRoot, SPUR_CONFIG_PATH_REL);
|
|
63680
63815
|
if (!await fs.exists(configPath))
|
|
63681
63816
|
return { catalogPath, routing: { makers: {} } };
|
|
63682
63817
|
let parsed;
|
|
@@ -63760,8 +63895,8 @@ function createBufferedDecisionFetch(inner = fetch) {
|
|
|
63760
63895
|
var bufferedDecisionFetch = createBufferedDecisionFetch();
|
|
63761
63896
|
function runDecisionSubprocess(decisionId, input, maker, fs = createNodeFileSystem()) {
|
|
63762
63897
|
const command = process.env.KK_SPUR_BIN ?? "spur";
|
|
63763
|
-
const scratch =
|
|
63764
|
-
const evidencePath =
|
|
63898
|
+
const scratch = join42(tmpdir4(), `kk-decision-${randomUUID2()}`);
|
|
63899
|
+
const evidencePath = join42(scratch, "evidence.md");
|
|
63765
63900
|
try {
|
|
63766
63901
|
fs.writeFile(evidencePath, input.body);
|
|
63767
63902
|
const args = [
|
|
@@ -63795,7 +63930,7 @@ var HEURISTIC_MAKER = "heuristic";
|
|
|
63795
63930
|
var LABEL_PLUGIN = "episode-plan-gen";
|
|
63796
63931
|
var LABEL_SCRATCH_DIR = "label";
|
|
63797
63932
|
var PROFILE_DIR_REL = "plugins/kk/decisions/extract";
|
|
63798
|
-
var CHECKOUT_ROOT3 =
|
|
63933
|
+
var CHECKOUT_ROOT3 = resolve35(import.meta.dir, "../../../..");
|
|
63799
63934
|
var CATALOG_PATH_REL = "plugins/kk/decisions/kk-items.yaml";
|
|
63800
63935
|
var TOPIC_SLUG = /^[a-z0-9][a-z0-9-]*$/;
|
|
63801
63936
|
var WINDOW_UNITS2 = { s: 1000, m: 60000, h: 3600000, d: 86400000 };
|
|
@@ -63876,7 +64011,7 @@ function sourceCountsOf3(docs) {
|
|
|
63876
64011
|
return counts;
|
|
63877
64012
|
}
|
|
63878
64013
|
async function writeNewIds(fs, path, ids) {
|
|
63879
|
-
await fs.ensureDir(
|
|
64014
|
+
await fs.ensureDir(dirname21(path));
|
|
63880
64015
|
await fs.writeFile(path, `${JSON.stringify([...new Set(ids)], null, 2)}
|
|
63881
64016
|
`);
|
|
63882
64017
|
}
|
|
@@ -63997,8 +64132,8 @@ async function readAnnotations(fs, outputPath) {
|
|
|
63997
64132
|
async function heuristicAnnotations(fs, scratch, runId, items) {
|
|
63998
64133
|
if (items.length === 0)
|
|
63999
64134
|
return new Map;
|
|
64000
|
-
const inputPath =
|
|
64001
|
-
const outputPath =
|
|
64135
|
+
const inputPath = join43(scratch, "label-input.json");
|
|
64136
|
+
const outputPath = join43(scratch, "label-out.json");
|
|
64002
64137
|
await fs.ensureDir(scratch);
|
|
64003
64138
|
const docs = items.map((item) => ({
|
|
64004
64139
|
id: item.id,
|
|
@@ -64217,7 +64352,7 @@ function parseDecisions(raw) {
|
|
|
64217
64352
|
return ids;
|
|
64218
64353
|
}
|
|
64219
64354
|
async function readCatalogVersion(fs) {
|
|
64220
|
-
const candidates = [
|
|
64355
|
+
const candidates = [resolve35(process.cwd(), CATALOG_PATH_REL), resolve35(CHECKOUT_ROOT3, CATALOG_PATH_REL)];
|
|
64221
64356
|
for (const path of candidates) {
|
|
64222
64357
|
try {
|
|
64223
64358
|
if (!await fs.exists(path))
|
|
@@ -64349,7 +64484,7 @@ async function labelAction(options) {
|
|
|
64349
64484
|
const mode = parseLabelMode(options.mode);
|
|
64350
64485
|
const configPath = resolveKkConfigPath();
|
|
64351
64486
|
const dbPath = await resolveStorePath(configPath, options.db);
|
|
64352
|
-
const scratch =
|
|
64487
|
+
const scratch = join43(dirname21(plan.kind === "new-ids" ? plan.newIds : dbPath), LABEL_SCRATCH_DIR);
|
|
64353
64488
|
const store = await openStore({ path: dbPath });
|
|
64354
64489
|
const catalogVersion = await readCatalogVersion(fs);
|
|
64355
64490
|
const labels = (await readStoreConfig(configPath)).labels;
|
|
@@ -64394,8 +64529,8 @@ async function resolveProfilePath(fs, topic) {
|
|
|
64394
64529
|
throw new Error(`--topic must be a lowercase slug (e.g. ai-news), got '${topic}'`);
|
|
64395
64530
|
}
|
|
64396
64531
|
const candidates = [
|
|
64397
|
-
|
|
64398
|
-
|
|
64532
|
+
resolve35(process.cwd(), PROFILE_DIR_REL, `${topic}.yaml`),
|
|
64533
|
+
resolve35(CHECKOUT_ROOT3, PROFILE_DIR_REL, `${topic}.yaml`)
|
|
64399
64534
|
];
|
|
64400
64535
|
for (const path of candidates) {
|
|
64401
64536
|
if (await fs.exists(path))
|
|
@@ -64432,7 +64567,7 @@ async function extractAction(options) {
|
|
|
64432
64567
|
try {
|
|
64433
64568
|
const policy = (await readStoreConfig(resolveKkConfigPath())).labels;
|
|
64434
64569
|
const docs = (await store.items.selectByProfile(query, policy)).map(toPoolDoc2);
|
|
64435
|
-
await fs.ensureDir(
|
|
64570
|
+
await fs.ensureDir(dirname21(options.out));
|
|
64436
64571
|
await fs.writeFile(options.out, `${JSON.stringify(docs, null, 2)}
|
|
64437
64572
|
`);
|
|
64438
64573
|
consoleOutput.write(JSON.stringify({ count: docs.length }));
|
|
@@ -64656,7 +64791,7 @@ init_commander();
|
|
|
64656
64791
|
init_output2();
|
|
64657
64792
|
|
|
64658
64793
|
// src/wiki/ingest.ts
|
|
64659
|
-
import { extname as extname4, isAbsolute as isAbsolute15, join as
|
|
64794
|
+
import { extname as extname4, isAbsolute as isAbsolute15, join as join50 } from "path";
|
|
64660
64795
|
|
|
64661
64796
|
// ../../packages/kk-wiki/src/compile.ts
|
|
64662
64797
|
function oneLineSummary(body) {
|
|
@@ -64858,11 +64993,11 @@ ${page.body.trim()}
|
|
|
64858
64993
|
`, pages: included.map((page) => page.path) };
|
|
64859
64994
|
}
|
|
64860
64995
|
// ../../packages/kk-wiki/src/gc.ts
|
|
64861
|
-
import { dirname as
|
|
64996
|
+
import { dirname as dirname22, isAbsolute as isAbsolute11, join as join44 } from "path";
|
|
64862
64997
|
async function planGc(index, options) {
|
|
64863
64998
|
const fs = options.fileSystem;
|
|
64864
|
-
const root =
|
|
64865
|
-
const mirrorPaths = (options.mirrors ?? []).map((mirror) => isAbsolute11(mirror) ? mirror :
|
|
64999
|
+
const root = dirname22(options.rawDir);
|
|
65000
|
+
const mirrorPaths = (options.mirrors ?? []).map((mirror) => isAbsolute11(mirror) ? mirror : join44(root, mirror));
|
|
64866
65001
|
const referenced = new Set;
|
|
64867
65002
|
for (const page of index.pages) {
|
|
64868
65003
|
for (const source of page.frontmatter.sources)
|
|
@@ -64870,16 +65005,16 @@ async function planGc(index, options) {
|
|
|
64870
65005
|
}
|
|
64871
65006
|
const candidates = [];
|
|
64872
65007
|
for (const type of ["url", "pdf", "html", "rss"]) {
|
|
64873
|
-
const dir =
|
|
65008
|
+
const dir = join44(options.rawDir, type);
|
|
64874
65009
|
if (!await fs.exists(dir))
|
|
64875
65010
|
continue;
|
|
64876
65011
|
for (const name of await fs.readDir(dir))
|
|
64877
|
-
candidates.push(
|
|
65012
|
+
candidates.push(join44(dir, name));
|
|
64878
65013
|
}
|
|
64879
|
-
const tmpDir =
|
|
65014
|
+
const tmpDir = join44(options.rawDir, "tmp");
|
|
64880
65015
|
if (await fs.exists(tmpDir)) {
|
|
64881
65016
|
for (const name of await fs.readDir(tmpDir))
|
|
64882
|
-
candidates.push(
|
|
65017
|
+
candidates.push(join44(tmpDir, name));
|
|
64883
65018
|
}
|
|
64884
65019
|
const skippedMirrors = (options.mirrors ?? []).filter((_, index) => {
|
|
64885
65020
|
const path = mirrorPaths[index];
|
|
@@ -65015,7 +65150,7 @@ function resolveLink(index, link) {
|
|
|
65015
65150
|
}
|
|
65016
65151
|
// ../../packages/kk-wiki/src/link.ts
|
|
65017
65152
|
init_dist3();
|
|
65018
|
-
import { join as
|
|
65153
|
+
import { join as join45 } from "path";
|
|
65019
65154
|
|
|
65020
65155
|
// ../../packages/kk-wiki/src/write.ts
|
|
65021
65156
|
function guardHeading(date) {
|
|
@@ -65126,7 +65261,7 @@ async function fixLinks(index, options = { date: "" }) {
|
|
|
65126
65261
|
const changed = [];
|
|
65127
65262
|
const refused = [];
|
|
65128
65263
|
for (const [path, pageMentions] of grouped) {
|
|
65129
|
-
const raw = await fs.readFile(
|
|
65264
|
+
const raw = await fs.readFile(join45(contentDir, path));
|
|
65130
65265
|
const page = parsePage(raw, path);
|
|
65131
65266
|
const rewritten = rewriteBody(page.body, pageMentions, parseFrontmatter(raw).bodyStartLine);
|
|
65132
65267
|
const { text, guard } = applyWriteToPage(page, rewritten, {
|
|
@@ -65137,7 +65272,7 @@ async function fixLinks(index, options = { date: "" }) {
|
|
|
65137
65272
|
changed.push(path);
|
|
65138
65273
|
continue;
|
|
65139
65274
|
}
|
|
65140
|
-
await fs.writeFile(
|
|
65275
|
+
await fs.writeFile(join45(contentDir, path), text);
|
|
65141
65276
|
if (guard === "appended")
|
|
65142
65277
|
refused.push(path);
|
|
65143
65278
|
else
|
|
@@ -65188,7 +65323,7 @@ function lintExitCode(findings) {
|
|
|
65188
65323
|
init_dist3();
|
|
65189
65324
|
import { createHash as createHash14 } from "crypto";
|
|
65190
65325
|
import { tmpdir as tmpdir5 } from "os";
|
|
65191
|
-
import { isAbsolute as isAbsolute12, join as
|
|
65326
|
+
import { isAbsolute as isAbsolute12, join as join46 } from "path";
|
|
65192
65327
|
|
|
65193
65328
|
class MissingNormalizerError extends Error {
|
|
65194
65329
|
binary;
|
|
@@ -65217,7 +65352,7 @@ function createMarkitdownRunner(options = {}) {
|
|
|
65217
65352
|
let target = input.target;
|
|
65218
65353
|
if (input.kind === "html") {
|
|
65219
65354
|
const id = createHash14("sha256").update(input.body ?? "").digest("hex").slice(0, 12);
|
|
65220
|
-
tempPath =
|
|
65355
|
+
tempPath = join46(tmpdir5(), `kk-wiki-${id}.html`);
|
|
65221
65356
|
await fs.writeFile(tempPath, input.body ?? "");
|
|
65222
65357
|
target = tempPath;
|
|
65223
65358
|
}
|
|
@@ -65311,23 +65446,23 @@ ${source.body.replace(/^\s+/, "")}`;
|
|
|
65311
65446
|
};
|
|
65312
65447
|
}
|
|
65313
65448
|
// ../../packages/kk-wiki/src/publish.ts
|
|
65314
|
-
import { dirname as
|
|
65449
|
+
import { dirname as dirname23, isAbsolute as isAbsolute13, join as join47, relative as relative6, resolve as resolve36 } from "path";
|
|
65315
65450
|
function isInside(parent, child) {
|
|
65316
65451
|
const rel = relative6(parent, child);
|
|
65317
65452
|
return rel === "" || !rel.startsWith("..") && !isAbsolute13(rel);
|
|
65318
65453
|
}
|
|
65319
65454
|
async function publishVault(index, options) {
|
|
65320
|
-
const targetRoot =
|
|
65321
|
-
if (isInside(
|
|
65455
|
+
const targetRoot = resolve36(options.target);
|
|
65456
|
+
if (isInside(resolve36(index.contentDir), targetRoot))
|
|
65322
65457
|
return { files: [], refused: "target-inside-vault" };
|
|
65323
65458
|
const fs = options.fileSystem;
|
|
65324
65459
|
const files = [];
|
|
65325
65460
|
for (const page of index.pages) {
|
|
65326
|
-
const source =
|
|
65327
|
-
const destination =
|
|
65328
|
-
await fs.ensureDir(
|
|
65461
|
+
const source = join47(index.contentDir, page.path);
|
|
65462
|
+
const destination = join47(targetRoot, "content", page.path);
|
|
65463
|
+
await fs.ensureDir(dirname23(destination));
|
|
65329
65464
|
await fs.writeFile(destination, await fs.readFile(source));
|
|
65330
|
-
files.push(
|
|
65465
|
+
files.push(join47("content", page.path));
|
|
65331
65466
|
}
|
|
65332
65467
|
return { files: files.sort() };
|
|
65333
65468
|
}
|
|
@@ -65379,7 +65514,7 @@ function rankPages(index, prompt, options = {}) {
|
|
|
65379
65514
|
// ../../packages/kk-wiki/src/raw.ts
|
|
65380
65515
|
init_dist3();
|
|
65381
65516
|
import { createHash as createHash15 } from "crypto";
|
|
65382
|
-
import { dirname as
|
|
65517
|
+
import { dirname as dirname24, join as join48 } from "path";
|
|
65383
65518
|
var RAW_SOURCE_TYPES = ["url", "pdf", "html", "rss"];
|
|
65384
65519
|
function rawSnapshotId(sourceUri, body) {
|
|
65385
65520
|
return createHash15("sha256").update(`${sourceUri}
|
|
@@ -65408,13 +65543,13 @@ async function writeRawSnapshot(input, fileSystem = createNodeFileSystem()) {
|
|
|
65408
65543
|
const id = rawSnapshotId(input.sourceUri, input.body);
|
|
65409
65544
|
const snapshot = {
|
|
65410
65545
|
id,
|
|
65411
|
-
path:
|
|
65546
|
+
path: join48(input.dir, input.type, `${id}.md`),
|
|
65412
65547
|
type: input.type,
|
|
65413
65548
|
title: input.title,
|
|
65414
65549
|
sourceUri: input.sourceUri,
|
|
65415
65550
|
ingestedAt
|
|
65416
65551
|
};
|
|
65417
|
-
await fileSystem.ensureDir(
|
|
65552
|
+
await fileSystem.ensureDir(dirname24(snapshot.path));
|
|
65418
65553
|
await fileSystem.writeFile(snapshot.path, renderRawSnapshot(snapshot, input.body));
|
|
65419
65554
|
return snapshot;
|
|
65420
65555
|
}
|
|
@@ -65536,7 +65671,7 @@ function synthesizePage(index, input) {
|
|
|
65536
65671
|
init_dist3();
|
|
65537
65672
|
|
|
65538
65673
|
// src/wiki/config.ts
|
|
65539
|
-
import { isAbsolute as isAbsolute14, join as
|
|
65674
|
+
import { isAbsolute as isAbsolute14, join as join49, resolve as resolve37 } from "path";
|
|
65540
65675
|
init_dist3();
|
|
65541
65676
|
var WIKI_CONFIG_FILE = "kk.config.json";
|
|
65542
65677
|
|
|
@@ -65623,7 +65758,7 @@ function parseBlock(raw) {
|
|
|
65623
65758
|
return block;
|
|
65624
65759
|
}
|
|
65625
65760
|
async function readConfigFile(cwd, fileSystem) {
|
|
65626
|
-
const path =
|
|
65761
|
+
const path = join49(cwd, WIKI_CONFIG_FILE);
|
|
65627
65762
|
if (!await fileSystem.exists(path))
|
|
65628
65763
|
return {};
|
|
65629
65764
|
let text;
|
|
@@ -65662,10 +65797,10 @@ async function resolveWikiConfig(options = {}) {
|
|
|
65662
65797
|
merged[key] = value;
|
|
65663
65798
|
}
|
|
65664
65799
|
Object.assign(merged, Object.fromEntries(Object.entries(options.overrides ?? {}).filter(([, v]) => v !== undefined)));
|
|
65665
|
-
merged.root =
|
|
65800
|
+
merged.root = resolve37(cwd, merged.root);
|
|
65666
65801
|
for (const key of ["raw", "content"]) {
|
|
65667
65802
|
if (!isAbsolute14(merged[key]))
|
|
65668
|
-
merged[key] =
|
|
65803
|
+
merged[key] = join49(merged.root, merged[key]);
|
|
65669
65804
|
}
|
|
65670
65805
|
return merged;
|
|
65671
65806
|
}
|
|
@@ -65716,7 +65851,7 @@ async function runIngest(args, deps = {}) {
|
|
|
65716
65851
|
const fs = deps.fileSystem ?? createNodeFileSystem();
|
|
65717
65852
|
const readStdinFn = deps.readStdin ?? readStdin;
|
|
65718
65853
|
const normalise = deps.markitdown ?? createMarkitdownRunner();
|
|
65719
|
-
const sourcePath = isAbsolute15(args.source) ? args.source :
|
|
65854
|
+
const sourcePath = isAbsolute15(args.source) ? args.source : join50(deps.cwd ?? process.cwd(), args.source);
|
|
65720
65855
|
let sourceText;
|
|
65721
65856
|
try {
|
|
65722
65857
|
if (fromStdin) {
|
|
@@ -65836,7 +65971,7 @@ function printLintOutcome(outcome, json) {
|
|
|
65836
65971
|
}
|
|
65837
65972
|
|
|
65838
65973
|
// src/wiki/maintenance.ts
|
|
65839
|
-
import { join as
|
|
65974
|
+
import { join as join51 } from "path";
|
|
65840
65975
|
init_dist3();
|
|
65841
65976
|
init_output2();
|
|
65842
65977
|
async function withConfig2(options, run) {
|
|
@@ -65858,12 +65993,12 @@ async function runMerge(options) {
|
|
|
65858
65993
|
if (merge.guard === "refused")
|
|
65859
65994
|
return { refused: true, path: merge.written };
|
|
65860
65995
|
const fs = createNodeFileSystem();
|
|
65861
|
-
await fs.writeFile(
|
|
65996
|
+
await fs.writeFile(join51(contentDir, merge.written), merge.targetText);
|
|
65862
65997
|
const sourcePage = index.pages.find((page) => page.slug === merge.sourceSlug);
|
|
65863
65998
|
if (sourcePage !== undefined)
|
|
65864
|
-
await fs.writeFile(
|
|
65999
|
+
await fs.writeFile(join51(contentDir, sourcePage.path), merge.sourceText);
|
|
65865
66000
|
for (const page of merge.rewrittenPages)
|
|
65866
|
-
await fs.writeFile(
|
|
66001
|
+
await fs.writeFile(join51(contentDir, page.path), page.text);
|
|
65867
66002
|
return {
|
|
65868
66003
|
refused: false,
|
|
65869
66004
|
path: merge.written,
|
|
@@ -65891,7 +66026,7 @@ async function runCompile(options) {
|
|
|
65891
66026
|
["index.md", compiled.index],
|
|
65892
66027
|
["MAP.md", compiled.map]
|
|
65893
66028
|
]) {
|
|
65894
|
-
const path =
|
|
66029
|
+
const path = join51(contentDir, name);
|
|
65895
66030
|
const current = await fs.exists(path) ? await fs.readFile(path) : null;
|
|
65896
66031
|
if (!needsWrite(current, rendered))
|
|
65897
66032
|
continue;
|
|
@@ -66031,7 +66166,7 @@ function printRetrievalOutcome(outcome, json) {
|
|
|
66031
66166
|
}
|
|
66032
66167
|
|
|
66033
66168
|
// src/wiki/write-verbs.ts
|
|
66034
|
-
import { isAbsolute as isAbsolute16, join as
|
|
66169
|
+
import { isAbsolute as isAbsolute16, join as join52 } from "path";
|
|
66035
66170
|
init_dist3();
|
|
66036
66171
|
init_output2();
|
|
66037
66172
|
async function readMaterial(options) {
|
|
@@ -66043,7 +66178,7 @@ async function readMaterial(options) {
|
|
|
66043
66178
|
chunks.push(chunk);
|
|
66044
66179
|
return Buffer.concat(chunks).toString("utf8");
|
|
66045
66180
|
}
|
|
66046
|
-
const path = isAbsolute16(options.from) ? options.from :
|
|
66181
|
+
const path = isAbsolute16(options.from) ? options.from : join52(options.cwd ?? process.cwd(), options.from);
|
|
66047
66182
|
return createNodeFileSystem().readFile(path);
|
|
66048
66183
|
}
|
|
66049
66184
|
async function resolveContext(options) {
|
|
@@ -66068,7 +66203,7 @@ async function runSummarize(options) {
|
|
|
66068
66203
|
const material = await readMaterial(options);
|
|
66069
66204
|
const date = options.date ?? new Date().toISOString().slice(0, 10);
|
|
66070
66205
|
const result = summarizePage(context.index, target, material, { date });
|
|
66071
|
-
await createNodeFileSystem().writeFile(
|
|
66206
|
+
await createNodeFileSystem().writeFile(join52(context.contentDir, result.path), result.text);
|
|
66072
66207
|
return { ok: true, code: 0, payload: { ok: true, path: result.path, guard: result.guard, links: result.links } };
|
|
66073
66208
|
}
|
|
66074
66209
|
async function runSynthesize(options) {
|
|
@@ -66079,7 +66214,7 @@ async function runSynthesize(options) {
|
|
|
66079
66214
|
const date = options.date ?? new Date().toISOString().slice(0, 10);
|
|
66080
66215
|
const type = options.type;
|
|
66081
66216
|
const result = synthesizePage(context.index, { target: options.target, material, type, date });
|
|
66082
|
-
await createNodeFileSystem().writeFile(
|
|
66217
|
+
await createNodeFileSystem().writeFile(join52(context.contentDir, result.path), result.text);
|
|
66083
66218
|
return {
|
|
66084
66219
|
ok: true,
|
|
66085
66220
|
code: 0,
|