@gobing-ai/knowledge-kit 0.1.27 → 0.1.28
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/board/collect/index.js +10 -0
- package/dist/board/daily-voice/index.js +1327 -2168
- package/dist/board/itc/index.js +10 -0
- package/dist/index.js +5980 -4651
- package/package.json +1 -1
- package/plugins/ingestions/aihot-ingest/dist/index.js +4 -1
- package/plugins/ingestions/aihot-ingest/src/rss.ts +22 -11
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/daily-stages.ts +7 -7
- package/plugins/kk/workflows/kk-news-generate.yaml +1 -1
- package/plugins/publishings/bilibili-pub/dist/index.js +81 -80
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/cnblogs-pub/dist/index.js +81 -80
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/csdn-pub/dist/index.js +81 -80
- package/plugins/publishings/csdn-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/infoq-pub/dist/index.js +81 -80
- package/plugins/publishings/infoq-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/jike-pub/dist/index.js +81 -80
- package/plugins/publishings/jike-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/juejin-pub/dist/index.js +81 -80
- package/plugins/publishings/juejin-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/linkedin-pub/dist/index.js +81 -80
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/medium-pub/dist/index.js +81 -80
- package/plugins/publishings/medium-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/shipinhao-pub/dist/index.js +272 -85
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +112 -3
- package/plugins/publishings/shipinhao-pub/src/cover-crop.ts +60 -0
- package/plugins/publishings/shipinhao-pub/src/flow.ts +15 -2
- package/plugins/publishings/shipinhao-pub/src/profile-check.ts +15 -12
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +22 -1
- package/plugins/publishings/sspai-pub/dist/index.js +81 -80
- package/plugins/publishings/sspai-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/substack-pub/dist/index.js +81 -80
- package/plugins/publishings/substack-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/surfdash-pub/dist/index.js +43 -5
- package/plugins/publishings/threads-pub/dist/index.js +86 -81
- package/plugins/publishings/threads-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/threads-pub/src/index.ts +10 -0
- package/plugins/publishings/wechatmp-pub/dist/index.js +84 -83
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/weibo-pub/dist/index.js +217 -83
- package/plugins/publishings/weibo-pub/dist/profile-check.js +123 -3
- package/plugins/publishings/weibo-pub/src/index.ts +60 -2
- package/plugins/publishings/weibo-pub/src/profile-check.ts +4 -2
- package/plugins/publishings/x-pub/dist/index.js +81 -80
- package/plugins/publishings/x-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/xhs-pub/dist/index.js +81 -80
- package/plugins/publishings/xhs-pub/dist/profile-check.js +1 -1
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +81 -80
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +1 -1
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
kkBrowserLauncher,
|
|
43
43
|
markdownToHtml,
|
|
44
44
|
resolveChannelProfileDir,
|
|
45
|
+
stateRestoringLauncher,
|
|
45
46
|
waitUntil,
|
|
46
47
|
} from '@gobing-ai/publish-harness/browser';
|
|
47
48
|
import {
|
|
@@ -50,8 +51,10 @@ import {
|
|
|
50
51
|
LoginTimeoutError,
|
|
51
52
|
withProfilePage,
|
|
52
53
|
} from '@gobing-ai/ts-browser-automation';
|
|
54
|
+
import { echoError } from '@gobing-ai/ts-utils';
|
|
53
55
|
import type { Locator, Page } from 'playwright';
|
|
54
56
|
import { runAudioPostFlow } from './audio-flow';
|
|
57
|
+
import { centerSquareCover } from './cover-crop';
|
|
55
58
|
import {
|
|
56
59
|
isShipinhaoAuthenticated,
|
|
57
60
|
readRootSnapshot,
|
|
@@ -920,7 +923,10 @@ export class ShipinhaoBrowserTransport implements PublishTransport {
|
|
|
920
923
|
) {
|
|
921
924
|
this.operation = operation;
|
|
922
925
|
this.driver = driver;
|
|
923
|
-
this
|
|
926
|
+
// Every context this transport opens re-injects the captured console session first
|
|
927
|
+
// (2026-11-26): the profile's cookie store does not survive a restart, so one scan is not one
|
|
928
|
+
// publish. A profile without a snapshot is untouched, so a fresh login still works.
|
|
929
|
+
this.launcher = stateRestoringLauncher(deps.launcher ?? kkBrowserLauncher);
|
|
924
930
|
this.stepTimeoutMs = deps.stepTimeoutMs ?? STEP_TIMEOUT_MS;
|
|
925
931
|
this.preflightTimeoutMs = deps.preflightTimeoutMs ?? PREFLIGHT_TIMEOUT_MS;
|
|
926
932
|
}
|
|
@@ -995,7 +1001,14 @@ export class ShipinhaoBrowserTransport implements PublishTransport {
|
|
|
995
1001
|
payload.content.metadata?.coverPath ?? payload.options?.coverPath ?? metadataRecord.coverImage,
|
|
996
1002
|
);
|
|
997
1003
|
if (cover.error !== undefined) return fail(SHP_TARGET, cover.error);
|
|
998
|
-
|
|
1004
|
+
// 2026-11-26: the 音频 form wants a square 封面 and its own crop dialog is what refused
|
|
1005
|
+
// every backfill with 「请上传封面」. Crop the widest centre square ourselves; a host
|
|
1006
|
+
// without `sips` (or an unreadable file) keeps the original and the dialog path.
|
|
1007
|
+
const square = centerSquareCover(cover.path as string);
|
|
1008
|
+
if ('error' in square) {
|
|
1009
|
+
echoError(`shipinhao-pub: square 封面 not derived (${square.error}) — keeping the original`);
|
|
1010
|
+
}
|
|
1011
|
+
coverPath = 'path' in square ? square.path : (cover.path as string);
|
|
999
1012
|
} else {
|
|
1000
1013
|
const images = await resolveImagesPath(metadataRecord.images);
|
|
1001
1014
|
if (images.error !== undefined) return fail(SHP_TARGET, images.error);
|
|
@@ -3,23 +3,26 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `login` opens the Channels dashboard (https://channels.weixin.qq.com/platform,
|
|
5
5
|
* see `src/selectors.ts`) in a headed browser and resolves only once the site readiness predicate
|
|
6
|
-
* passes; `check` reopens the profile (
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* passes; `check` reopens the profile (headedly, via `checkHeadedOnly`) and reports `verified` or
|
|
7
|
+
* `refused`; `open` just brings the window up. Arg parsing, profile precedence
|
|
8
|
+
* (`--profile` > `SHP_PROFILE_DIR` > `KK_BROWSER_PROFILE_DIR` > `~/.config/kk/browser-profiles/shipinhao`)
|
|
9
|
+
* and the exit codes (0 verified, 1 refused, 2 usage error) all live in the shared `runProfileCli`,
|
|
10
|
+
* so the publish preflight and this CLI apply one gate.
|
|
11
|
+
*
|
|
12
|
+
* 2026-11-26: every launch goes through `stateRestoringLauncher`, which replays the session snapshot
|
|
13
|
+
* captured at login (`storage-state.json`, same rail as wechatmp-pub 0371). Without it `check`
|
|
14
|
+
* refused the session the login had just verified — the cookie store does not survive a restart, so
|
|
15
|
+
* the console session has to ride the snapshot.
|
|
12
16
|
*
|
|
13
17
|
* The readiness predicate observes the vendor-grounded creator-form evidence (the unique video
|
|
14
18
|
* `input[type=file]`, shipinhao.js:580-583, and the 添加描述/标题 placeholders, shipinhao.js:516-518,
|
|
15
|
-
* 669-674 — see `src/selectors.ts`); an unsupported-browser page is also not-ready.
|
|
16
|
-
* login-redirect regex is provisional. A selector that never attaches is a refusal
|
|
17
|
-
* (`bun plugins/publishings/shipinhao-pub/src/profile-check.ts login` is the recovery), never
|
|
18
|
-
* silent success.
|
|
19
|
+
* 669-674 — see `src/selectors.ts`); an unsupported-browser page is also not-ready.
|
|
19
20
|
*/
|
|
20
|
-
import { runProfileCli } from '@gobing-ai/publish-harness/browser';
|
|
21
|
+
import { kkBrowserLauncher, runProfileCli, stateRestoringLauncher } from '@gobing-ai/publish-harness/browser';
|
|
21
22
|
import { SHP_CONFIG } from './selectors';
|
|
22
23
|
|
|
23
24
|
if (import.meta.main) {
|
|
24
|
-
process.exit(
|
|
25
|
+
process.exit(
|
|
26
|
+
await runProfileCli(SHP_CONFIG, Bun.argv.slice(2), { launcher: stateRestoringLauncher(kkBrowserLauncher) }),
|
|
27
|
+
);
|
|
25
28
|
}
|
|
@@ -17,7 +17,12 @@
|
|
|
17
17
|
* fallback.
|
|
18
18
|
*/
|
|
19
19
|
import type { ChannelBrowserConfig } from '@gobing-ai/publish-harness/browser';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
DEFAULT_CHANNEL_STATE_SETTLE_MS,
|
|
22
|
+
persistChannelSessionState,
|
|
23
|
+
restoreChannelSessionState,
|
|
24
|
+
waitUntil,
|
|
25
|
+
} from '@gobing-ai/publish-harness/browser';
|
|
21
26
|
import type { IsAuthenticatedPredicate } from '@gobing-ai/ts-browser-automation';
|
|
22
27
|
|
|
23
28
|
/** Site-owned target slug; also the profile channel key (`SHP_PROFILE_DIR`). */
|
|
@@ -357,4 +362,20 @@ export const SHP_CONFIG: ChannelBrowserConfig = {
|
|
|
357
362
|
checkHeadedOnly: true,
|
|
358
363
|
// Headed-only still needs headroom for the hydrate; 180s leaves ~150s for the pass.
|
|
359
364
|
checkTimeoutMs: 180_000,
|
|
365
|
+
// 2026-11-26 (operator decision, mirroring wechatmp-pub 0371): the console session does not
|
|
366
|
+
// survive a restart — capture it right after an authenticated login and replay it into every
|
|
367
|
+
// later context, so one scan is not one publish.
|
|
368
|
+
sessionState: {
|
|
369
|
+
onAuthenticated: async ({ context, page, profileDir }) => {
|
|
370
|
+
// Let the console finish its post-auth Set-Cookie burst before the snapshot.
|
|
371
|
+
await page.waitForTimeout(DEFAULT_CHANNEL_STATE_SETTLE_MS);
|
|
372
|
+
try {
|
|
373
|
+
await persistChannelSessionState(context, profileDir);
|
|
374
|
+
} catch {
|
|
375
|
+
// Storage-state errors can carry cookie values: never relay the exception.
|
|
376
|
+
throw new Error('shipinhao authenticated session snapshot failed');
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
onOpen: ({ context, page, profileDir }) => restoreChannelSessionState(context, page, profileDir).then(),
|
|
380
|
+
},
|
|
360
381
|
};
|
|
@@ -20171,6 +20171,86 @@ var ATTACHED_CLOSERS = new Set(["\u201D", "\u2019", "\u300D", "\u300F", "\uFF09"
|
|
|
20171
20171
|
import { homedir } from "os";
|
|
20172
20172
|
import { join, resolve } from "path";
|
|
20173
20173
|
|
|
20174
|
+
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20175
|
+
import {
|
|
20176
|
+
chmodSync,
|
|
20177
|
+
closeSync,
|
|
20178
|
+
copyFileSync,
|
|
20179
|
+
lstatSync,
|
|
20180
|
+
mkdirSync as mkdirSync2,
|
|
20181
|
+
openSync,
|
|
20182
|
+
readdirSync as readdirSync2,
|
|
20183
|
+
readlinkSync,
|
|
20184
|
+
realpathSync as realpathSync2,
|
|
20185
|
+
renameSync as renameSync2,
|
|
20186
|
+
rmdirSync,
|
|
20187
|
+
unlinkSync
|
|
20188
|
+
} from "fs";
|
|
20189
|
+
function lstat(path) {
|
|
20190
|
+
try {
|
|
20191
|
+
return lstatSync(path);
|
|
20192
|
+
} catch (error) {
|
|
20193
|
+
if (error.code === "ENOENT")
|
|
20194
|
+
return null;
|
|
20195
|
+
throw error;
|
|
20196
|
+
}
|
|
20197
|
+
}
|
|
20198
|
+
function realpath(path) {
|
|
20199
|
+
return realpathSync2(path);
|
|
20200
|
+
}
|
|
20201
|
+
function mkdirExclusive(path, mode = 448) {
|
|
20202
|
+
try {
|
|
20203
|
+
mkdirSync2(path, { mode });
|
|
20204
|
+
return true;
|
|
20205
|
+
} catch (error) {
|
|
20206
|
+
if (error.code === "EEXIST")
|
|
20207
|
+
return false;
|
|
20208
|
+
throw error;
|
|
20209
|
+
}
|
|
20210
|
+
}
|
|
20211
|
+
function rmdir(path) {
|
|
20212
|
+
try {
|
|
20213
|
+
rmdirSync(path);
|
|
20214
|
+
return true;
|
|
20215
|
+
} catch (error) {
|
|
20216
|
+
const code = error.code;
|
|
20217
|
+
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20218
|
+
return false;
|
|
20219
|
+
throw error;
|
|
20220
|
+
}
|
|
20221
|
+
}
|
|
20222
|
+
function readlink(path) {
|
|
20223
|
+
try {
|
|
20224
|
+
return readlinkSync(path);
|
|
20225
|
+
} catch {
|
|
20226
|
+
return null;
|
|
20227
|
+
}
|
|
20228
|
+
}
|
|
20229
|
+
function unlink(path) {
|
|
20230
|
+
try {
|
|
20231
|
+
unlinkSync(path);
|
|
20232
|
+
return true;
|
|
20233
|
+
} catch (error) {
|
|
20234
|
+
if (error.code === "ENOENT")
|
|
20235
|
+
return false;
|
|
20236
|
+
throw error;
|
|
20237
|
+
}
|
|
20238
|
+
}
|
|
20239
|
+
function rename(from, to) {
|
|
20240
|
+
try {
|
|
20241
|
+
renameSync2(from, to);
|
|
20242
|
+
return true;
|
|
20243
|
+
} catch (error) {
|
|
20244
|
+
if (error.code === "ENOENT")
|
|
20245
|
+
return false;
|
|
20246
|
+
throw error;
|
|
20247
|
+
}
|
|
20248
|
+
}
|
|
20249
|
+
function chmod(path, mode) {
|
|
20250
|
+
chmodSync(path, mode);
|
|
20251
|
+
}
|
|
20252
|
+
|
|
20253
|
+
// ../../packages/publish-harness/src/index.ts
|
|
20174
20254
|
class FakeTransportCore {
|
|
20175
20255
|
callLogs = [];
|
|
20176
20256
|
nextResult;
|
|
@@ -20461,85 +20541,6 @@ init_dist();
|
|
|
20461
20541
|
import { homedir as homedir4 } from "os";
|
|
20462
20542
|
import { isAbsolute, join as join4, relative, resolve as resolve4, sep } from "path";
|
|
20463
20543
|
|
|
20464
|
-
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20465
|
-
import {
|
|
20466
|
-
chmodSync,
|
|
20467
|
-
closeSync,
|
|
20468
|
-
copyFileSync,
|
|
20469
|
-
lstatSync,
|
|
20470
|
-
mkdirSync as mkdirSync2,
|
|
20471
|
-
openSync,
|
|
20472
|
-
readdirSync as readdirSync2,
|
|
20473
|
-
readlinkSync,
|
|
20474
|
-
realpathSync as realpathSync2,
|
|
20475
|
-
renameSync as renameSync2,
|
|
20476
|
-
rmdirSync,
|
|
20477
|
-
unlinkSync
|
|
20478
|
-
} from "fs";
|
|
20479
|
-
function lstat(path) {
|
|
20480
|
-
try {
|
|
20481
|
-
return lstatSync(path);
|
|
20482
|
-
} catch (error) {
|
|
20483
|
-
if (error.code === "ENOENT")
|
|
20484
|
-
return null;
|
|
20485
|
-
throw error;
|
|
20486
|
-
}
|
|
20487
|
-
}
|
|
20488
|
-
function realpath(path) {
|
|
20489
|
-
return realpathSync2(path);
|
|
20490
|
-
}
|
|
20491
|
-
function mkdirExclusive(path, mode = 448) {
|
|
20492
|
-
try {
|
|
20493
|
-
mkdirSync2(path, { mode });
|
|
20494
|
-
return true;
|
|
20495
|
-
} catch (error) {
|
|
20496
|
-
if (error.code === "EEXIST")
|
|
20497
|
-
return false;
|
|
20498
|
-
throw error;
|
|
20499
|
-
}
|
|
20500
|
-
}
|
|
20501
|
-
function rmdir(path) {
|
|
20502
|
-
try {
|
|
20503
|
-
rmdirSync(path);
|
|
20504
|
-
return true;
|
|
20505
|
-
} catch (error) {
|
|
20506
|
-
const code = error.code;
|
|
20507
|
-
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20508
|
-
return false;
|
|
20509
|
-
throw error;
|
|
20510
|
-
}
|
|
20511
|
-
}
|
|
20512
|
-
function readlink(path) {
|
|
20513
|
-
try {
|
|
20514
|
-
return readlinkSync(path);
|
|
20515
|
-
} catch {
|
|
20516
|
-
return null;
|
|
20517
|
-
}
|
|
20518
|
-
}
|
|
20519
|
-
function unlink(path) {
|
|
20520
|
-
try {
|
|
20521
|
-
unlinkSync(path);
|
|
20522
|
-
return true;
|
|
20523
|
-
} catch (error) {
|
|
20524
|
-
if (error.code === "ENOENT")
|
|
20525
|
-
return false;
|
|
20526
|
-
throw error;
|
|
20527
|
-
}
|
|
20528
|
-
}
|
|
20529
|
-
function rename(from, to) {
|
|
20530
|
-
try {
|
|
20531
|
-
renameSync2(from, to);
|
|
20532
|
-
return true;
|
|
20533
|
-
} catch (error) {
|
|
20534
|
-
if (error.code === "ENOENT")
|
|
20535
|
-
return false;
|
|
20536
|
-
throw error;
|
|
20537
|
-
}
|
|
20538
|
-
}
|
|
20539
|
-
function chmod(path, mode) {
|
|
20540
|
-
chmodSync(path, mode);
|
|
20541
|
-
}
|
|
20542
|
-
|
|
20543
20544
|
// ../../packages/publish-harness/src/bot-transaction.ts
|
|
20544
20545
|
import { homedir as homedir2 } from "os";
|
|
20545
20546
|
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
@@ -20839,7 +20840,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20839
20840
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20840
20841
|
if (lstat(syncData) === null)
|
|
20841
20842
|
return false;
|
|
20842
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20843
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20843
20844
|
}
|
|
20844
20845
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20845
20846
|
return {
|
|
@@ -20265,7 +20265,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20265
20265
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20266
20266
|
if (lstat(syncData) === null)
|
|
20267
20267
|
return false;
|
|
20268
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20268
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20269
20269
|
}
|
|
20270
20270
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20271
20271
|
return {
|
|
@@ -20171,6 +20171,86 @@ var ATTACHED_CLOSERS = new Set(["\u201D", "\u2019", "\u300D", "\u300F", "\uFF09"
|
|
|
20171
20171
|
import { homedir } from "os";
|
|
20172
20172
|
import { join, resolve } from "path";
|
|
20173
20173
|
|
|
20174
|
+
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20175
|
+
import {
|
|
20176
|
+
chmodSync,
|
|
20177
|
+
closeSync,
|
|
20178
|
+
copyFileSync,
|
|
20179
|
+
lstatSync,
|
|
20180
|
+
mkdirSync as mkdirSync2,
|
|
20181
|
+
openSync,
|
|
20182
|
+
readdirSync as readdirSync2,
|
|
20183
|
+
readlinkSync,
|
|
20184
|
+
realpathSync as realpathSync2,
|
|
20185
|
+
renameSync as renameSync2,
|
|
20186
|
+
rmdirSync,
|
|
20187
|
+
unlinkSync
|
|
20188
|
+
} from "fs";
|
|
20189
|
+
function lstat(path) {
|
|
20190
|
+
try {
|
|
20191
|
+
return lstatSync(path);
|
|
20192
|
+
} catch (error) {
|
|
20193
|
+
if (error.code === "ENOENT")
|
|
20194
|
+
return null;
|
|
20195
|
+
throw error;
|
|
20196
|
+
}
|
|
20197
|
+
}
|
|
20198
|
+
function realpath(path) {
|
|
20199
|
+
return realpathSync2(path);
|
|
20200
|
+
}
|
|
20201
|
+
function mkdirExclusive(path, mode = 448) {
|
|
20202
|
+
try {
|
|
20203
|
+
mkdirSync2(path, { mode });
|
|
20204
|
+
return true;
|
|
20205
|
+
} catch (error) {
|
|
20206
|
+
if (error.code === "EEXIST")
|
|
20207
|
+
return false;
|
|
20208
|
+
throw error;
|
|
20209
|
+
}
|
|
20210
|
+
}
|
|
20211
|
+
function rmdir(path) {
|
|
20212
|
+
try {
|
|
20213
|
+
rmdirSync(path);
|
|
20214
|
+
return true;
|
|
20215
|
+
} catch (error) {
|
|
20216
|
+
const code = error.code;
|
|
20217
|
+
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20218
|
+
return false;
|
|
20219
|
+
throw error;
|
|
20220
|
+
}
|
|
20221
|
+
}
|
|
20222
|
+
function readlink(path) {
|
|
20223
|
+
try {
|
|
20224
|
+
return readlinkSync(path);
|
|
20225
|
+
} catch {
|
|
20226
|
+
return null;
|
|
20227
|
+
}
|
|
20228
|
+
}
|
|
20229
|
+
function unlink(path) {
|
|
20230
|
+
try {
|
|
20231
|
+
unlinkSync(path);
|
|
20232
|
+
return true;
|
|
20233
|
+
} catch (error) {
|
|
20234
|
+
if (error.code === "ENOENT")
|
|
20235
|
+
return false;
|
|
20236
|
+
throw error;
|
|
20237
|
+
}
|
|
20238
|
+
}
|
|
20239
|
+
function rename(from, to) {
|
|
20240
|
+
try {
|
|
20241
|
+
renameSync2(from, to);
|
|
20242
|
+
return true;
|
|
20243
|
+
} catch (error) {
|
|
20244
|
+
if (error.code === "ENOENT")
|
|
20245
|
+
return false;
|
|
20246
|
+
throw error;
|
|
20247
|
+
}
|
|
20248
|
+
}
|
|
20249
|
+
function chmod(path, mode) {
|
|
20250
|
+
chmodSync(path, mode);
|
|
20251
|
+
}
|
|
20252
|
+
|
|
20253
|
+
// ../../packages/publish-harness/src/index.ts
|
|
20174
20254
|
class FakeTransportCore {
|
|
20175
20255
|
callLogs = [];
|
|
20176
20256
|
nextResult;
|
|
@@ -20455,85 +20535,6 @@ init_dist();
|
|
|
20455
20535
|
import { homedir as homedir4 } from "os";
|
|
20456
20536
|
import { isAbsolute, join as join4, relative, resolve as resolve4, sep } from "path";
|
|
20457
20537
|
|
|
20458
|
-
// ../../packages/publish-harness/src/bot-fs.ts
|
|
20459
|
-
import {
|
|
20460
|
-
chmodSync,
|
|
20461
|
-
closeSync,
|
|
20462
|
-
copyFileSync,
|
|
20463
|
-
lstatSync,
|
|
20464
|
-
mkdirSync as mkdirSync2,
|
|
20465
|
-
openSync,
|
|
20466
|
-
readdirSync as readdirSync2,
|
|
20467
|
-
readlinkSync,
|
|
20468
|
-
realpathSync as realpathSync2,
|
|
20469
|
-
renameSync as renameSync2,
|
|
20470
|
-
rmdirSync,
|
|
20471
|
-
unlinkSync
|
|
20472
|
-
} from "fs";
|
|
20473
|
-
function lstat(path) {
|
|
20474
|
-
try {
|
|
20475
|
-
return lstatSync(path);
|
|
20476
|
-
} catch (error) {
|
|
20477
|
-
if (error.code === "ENOENT")
|
|
20478
|
-
return null;
|
|
20479
|
-
throw error;
|
|
20480
|
-
}
|
|
20481
|
-
}
|
|
20482
|
-
function realpath(path) {
|
|
20483
|
-
return realpathSync2(path);
|
|
20484
|
-
}
|
|
20485
|
-
function mkdirExclusive(path, mode = 448) {
|
|
20486
|
-
try {
|
|
20487
|
-
mkdirSync2(path, { mode });
|
|
20488
|
-
return true;
|
|
20489
|
-
} catch (error) {
|
|
20490
|
-
if (error.code === "EEXIST")
|
|
20491
|
-
return false;
|
|
20492
|
-
throw error;
|
|
20493
|
-
}
|
|
20494
|
-
}
|
|
20495
|
-
function rmdir(path) {
|
|
20496
|
-
try {
|
|
20497
|
-
rmdirSync(path);
|
|
20498
|
-
return true;
|
|
20499
|
-
} catch (error) {
|
|
20500
|
-
const code = error.code;
|
|
20501
|
-
if (code === "ENOENT" || code === "ENOTEMPTY" || code === "EEXIST")
|
|
20502
|
-
return false;
|
|
20503
|
-
throw error;
|
|
20504
|
-
}
|
|
20505
|
-
}
|
|
20506
|
-
function readlink(path) {
|
|
20507
|
-
try {
|
|
20508
|
-
return readlinkSync(path);
|
|
20509
|
-
} catch {
|
|
20510
|
-
return null;
|
|
20511
|
-
}
|
|
20512
|
-
}
|
|
20513
|
-
function unlink(path) {
|
|
20514
|
-
try {
|
|
20515
|
-
unlinkSync(path);
|
|
20516
|
-
return true;
|
|
20517
|
-
} catch (error) {
|
|
20518
|
-
if (error.code === "ENOENT")
|
|
20519
|
-
return false;
|
|
20520
|
-
throw error;
|
|
20521
|
-
}
|
|
20522
|
-
}
|
|
20523
|
-
function rename(from, to) {
|
|
20524
|
-
try {
|
|
20525
|
-
renameSync2(from, to);
|
|
20526
|
-
return true;
|
|
20527
|
-
} catch (error) {
|
|
20528
|
-
if (error.code === "ENOENT")
|
|
20529
|
-
return false;
|
|
20530
|
-
throw error;
|
|
20531
|
-
}
|
|
20532
|
-
}
|
|
20533
|
-
function chmod(path, mode) {
|
|
20534
|
-
chmodSync(path, mode);
|
|
20535
|
-
}
|
|
20536
|
-
|
|
20537
20538
|
// ../../packages/publish-harness/src/bot-transaction.ts
|
|
20538
20539
|
import { homedir as homedir2 } from "os";
|
|
20539
20540
|
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
@@ -20833,7 +20834,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20833
20834
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20834
20835
|
if (lstat(syncData) === null)
|
|
20835
20836
|
return false;
|
|
20836
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20837
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20837
20838
|
}
|
|
20838
20839
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20839
20840
|
return {
|
|
@@ -20537,7 +20537,7 @@ function quarantineProfileSyncData(profileDir) {
|
|
|
20537
20537
|
const syncData = join5(profileDir, "Default", "Sync Data");
|
|
20538
20538
|
if (lstat(syncData) === null)
|
|
20539
20539
|
return false;
|
|
20540
|
-
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0,
|
|
20540
|
+
return rename(syncData, `${syncData}.broken-${new Date().toISOString().replace(/[:.]/g, "").slice(0, 17)}`);
|
|
20541
20541
|
}
|
|
20542
20542
|
function createKkBrowserLauncher(loadPlaywright = () => import("playwright"), ownership, leaseOptions = {}) {
|
|
20543
20543
|
return {
|
|
@@ -12017,6 +12017,43 @@ function findProjectRoot(startDir) {
|
|
|
12017
12017
|
}
|
|
12018
12018
|
var init_file_system_node = () => {};
|
|
12019
12019
|
|
|
12020
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
12021
|
+
var init_context = () => {};
|
|
12022
|
+
|
|
12023
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
12024
|
+
var SEP;
|
|
12025
|
+
var init_path = __esm(() => {
|
|
12026
|
+
SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
12027
|
+
});
|
|
12028
|
+
|
|
12029
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
12030
|
+
var REMOTE_SCHEMA_MAX_BYTES;
|
|
12031
|
+
var init_schema_validation = __esm(() => {
|
|
12032
|
+
init_dist2();
|
|
12033
|
+
REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
|
|
12034
|
+
});
|
|
12035
|
+
|
|
12036
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
12037
|
+
var init_types = () => {};
|
|
12038
|
+
|
|
12039
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
12040
|
+
var init_dist3 = __esm(() => {
|
|
12041
|
+
init_file_system_node();
|
|
12042
|
+
init_config();
|
|
12043
|
+
init_context();
|
|
12044
|
+
init_path();
|
|
12045
|
+
init_schema_validation();
|
|
12046
|
+
init_types();
|
|
12047
|
+
});
|
|
12048
|
+
|
|
12049
|
+
// ../../packages/publish-harness/src/bot-fs.ts
|
|
12050
|
+
var init_bot_fs = () => {};
|
|
12051
|
+
|
|
12052
|
+
// ../../packages/publish-harness/src/session-state.ts
|
|
12053
|
+
var init_session_state = __esm(() => {
|
|
12054
|
+
init_bot_fs();
|
|
12055
|
+
});
|
|
12056
|
+
|
|
12020
12057
|
// ../../packages/publish-harness/src/index.ts
|
|
12021
12058
|
var exports_src = {};
|
|
12022
12059
|
__export(exports_src, {
|
|
@@ -12067,7 +12104,9 @@ class FakeFileCliTransport {
|
|
|
12067
12104
|
this.core.reset();
|
|
12068
12105
|
}
|
|
12069
12106
|
}
|
|
12070
|
-
var init_src = () => {
|
|
12107
|
+
var init_src = __esm(() => {
|
|
12108
|
+
init_session_state();
|
|
12109
|
+
});
|
|
12071
12110
|
|
|
12072
12111
|
// ../../plugins/publishings/surfdash-pub/src/index.ts
|
|
12073
12112
|
import { createHash } from "crypto";
|
|
@@ -12340,10 +12379,6 @@ var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx)
|
|
|
12340
12379
|
});
|
|
12341
12380
|
}
|
|
12342
12381
|
});
|
|
12343
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
12344
|
-
init_file_system_node();
|
|
12345
|
-
init_config();
|
|
12346
|
-
|
|
12347
12382
|
// ../../packages/kk-core/src/render-md.ts
|
|
12348
12383
|
if (false) {}
|
|
12349
12384
|
// ../../packages/kk-core/src/sentences.ts
|
|
@@ -12351,9 +12386,11 @@ var CJK_TERMINATORS = new Set(["\u3002", "\uFF01", "\uFF1F"]);
|
|
|
12351
12386
|
var LATIN_TERMINATORS = new Set([".", "!", "?"]);
|
|
12352
12387
|
var ATTACHED_CLOSERS = new Set(["\u201D", "\u2019", "\u300D", "\u300F", "\uFF09", ")", '"', "'"]);
|
|
12353
12388
|
// ../../plugins/publishings/surfdash-pub/src/index.ts
|
|
12389
|
+
init_dist3();
|
|
12354
12390
|
init_dist();
|
|
12355
12391
|
|
|
12356
12392
|
// ../../plugins/publishings/surfdash-pub/src/patch.ts
|
|
12393
|
+
init_dist3();
|
|
12357
12394
|
import { basename, dirname as dirname2, sep } from "path";
|
|
12358
12395
|
var PATCH_LOCALES = ["zh", "en", "ja"];
|
|
12359
12396
|
function localeIndexPath(postPath, locale) {
|
|
@@ -12795,6 +12832,7 @@ async function uploadCoverToMicrofeed(filePath, options = {}) {
|
|
|
12795
12832
|
}
|
|
12796
12833
|
|
|
12797
12834
|
// ../../plugins/publishings/surfdash-pub/src/topic-claims.ts
|
|
12835
|
+
init_dist3();
|
|
12798
12836
|
import { dirname as dirname3 } from "path";
|
|
12799
12837
|
var escapeRe2 = (token) => token.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12800
12838
|
var titleSepFor = (locale) => locale === "en" ? ": " : "\uFF1A";
|