@cloud411716/fancy-webnovel 0.1.68 → 0.1.69
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/infra.js +0 -26
- package/package.json +1 -1
- package/plugins/fancy-scan/index.js +7 -21
package/infra.js
CHANGED
|
@@ -23,32 +23,6 @@ export function notify(session, text) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// --------------------------------------------------------------------------
|
|
27
|
-
// notifyReplaceable — 同步追加消息,返回 SessionEvent(用于后续原地 replace)
|
|
28
|
-
// --------------------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
export function notifyReplaceable(session, text) {
|
|
31
|
-
const ev = session.append(
|
|
32
|
-
'user/message',
|
|
33
|
-
{ content: [{ type: 'text', text: String(text) }], source: { kind: 'user' } },
|
|
34
|
-
{ surfaceOp: 'append' }
|
|
35
|
-
);
|
|
36
|
-
console.error('[notifyReplaceable] seq=', ev.seq, 'type=', ev.type);
|
|
37
|
-
return ev;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// --------------------------------------------------------------------------
|
|
41
|
-
// replaceMessage — 原地替换指定 seq 的消息内容
|
|
42
|
-
// --------------------------------------------------------------------------
|
|
43
|
-
|
|
44
|
-
export function replaceMessage(session, seq, text) {
|
|
45
|
-
session.append(
|
|
46
|
-
'user/message',
|
|
47
|
-
{ content: [{ type: 'text', text: String(text) }], source: { kind: 'user' } },
|
|
48
|
-
{ surfaceOp: { op: 'replace', start: seq, end: seq }, sourceEventSeqs: [seq] }
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
26
|
// --------------------------------------------------------------------------
|
|
53
27
|
// llmFollowup
|
|
54
28
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { dirname, join } from 'path';
|
|
6
6
|
import { existsSync } from 'fs';
|
|
7
|
-
import { notify, llmFollowup, spawnScript
|
|
7
|
+
import { notify, llmFollowup, spawnScript } from '../../infra.js';
|
|
8
8
|
import { scan, PLATFORM_TABLE, platformLabel } from './templates.js';
|
|
9
9
|
|
|
10
10
|
export const inject = ['commands', 'userQuestions'];
|
|
@@ -92,26 +92,12 @@ export async function apply(ctx) {
|
|
|
92
92
|
|
|
93
93
|
notify(session, scan.notify({ type: 'collecting', platform, length }));
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const scriptResult = await new Promise(async (resolve) => {
|
|
102
|
-
const ticker = setInterval(() => {
|
|
103
|
-
frame++;
|
|
104
|
-
replaceMessage(session, spinnerSeq, `⏳ ${FRAMES[frame % FRAMES.length]} 采集中...`);
|
|
105
|
-
}, 400);
|
|
106
|
-
|
|
107
|
-
const result = await spawnScript('node',
|
|
108
|
-
[join(SCAN_SCRIPTS_DIR, 'run-scan.js'),
|
|
109
|
-
'--project-root', projectRoot, '--platform', platform, '--length', length],
|
|
110
|
-
{ timeout: 120000 }
|
|
111
|
-
);
|
|
112
|
-
clearInterval(ticker);
|
|
113
|
-
resolve(result);
|
|
114
|
-
});
|
|
95
|
+
const scriptResult = await spawnScript(
|
|
96
|
+
'node',
|
|
97
|
+
[join(SCAN_SCRIPTS_DIR, 'run-scan.js'),
|
|
98
|
+
'--project-root', projectRoot, '--platform', platform, '--length', length],
|
|
99
|
+
{ timeout: 120000 }
|
|
100
|
+
);
|
|
115
101
|
|
|
116
102
|
if (!scriptResult.ok) {
|
|
117
103
|
const err = (typeof scriptResult.error === 'object' && scriptResult.error !== null)
|