@cloud411716/fancy-webnovel 1.0.0 → 1.0.2
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/commands/bootstrap/index.js +3 -1
- package/events.js +14 -48
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -122,7 +122,9 @@ export function apply(ctx) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// ---------- init (in-process, no subprocess) ----------
|
|
125
|
-
|
|
125
|
+
// Yield to the event loop so DSH's "问卷已答" acknowledgement
|
|
126
|
+
// is flushed to the UI before we append our own messages.
|
|
127
|
+
await Promise.resolve();
|
|
126
128
|
|
|
127
129
|
const result = await initProject(projectRoot);
|
|
128
130
|
|
package/events.js
CHANGED
|
@@ -2,52 +2,18 @@
|
|
|
2
2
|
* events.js — Scan progress event vocabulary
|
|
3
3
|
*
|
|
4
4
|
* These are pure in-memory plugin events emitted via ctx.events.emit().
|
|
5
|
-
* They flow through DSH
|
|
6
|
-
*
|
|
5
|
+
* They flow through the DSH session log and are observable by the agent.
|
|
6
|
+
*
|
|
7
|
+
* Type declarations (for TypeScript users):
|
|
8
|
+
* ```ts
|
|
9
|
+
* // @ts-check
|
|
10
|
+
* declare module '@deepseek-ai/cordis' {
|
|
11
|
+
* interface Events {
|
|
12
|
+
* 'fancy/scan:start'(platform: string, channel: string, type: string, label: string): void
|
|
13
|
+
* 'fancy/scan:book'(platform: string, channel: string, type: string, index: number, total: number, title: string, rank: number): void
|
|
14
|
+
* 'fancy/scan:rank-done'(platform: string, channel: string, type: string, ok: boolean, written: number, failed: number, errorMsg?: string): void
|
|
15
|
+
* 'fancy/scan:done'(platform: string, totalBooks: number, totalFiles: number, ok: boolean): void
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
7
19
|
*/
|
|
8
|
-
|
|
9
|
-
declare module '@deepseek-ai/cordis' {
|
|
10
|
-
interface Events {
|
|
11
|
-
/**
|
|
12
|
-
* Emitted when a rank scan starts.
|
|
13
|
-
* @param platform - platform id (qidian|fanqie|jinjiang|qimao)
|
|
14
|
-
* @param channel - channel id
|
|
15
|
-
* @param type - rank type id
|
|
16
|
-
* @param label - human-readable rank label
|
|
17
|
-
*/
|
|
18
|
-
'fancy/scan:start'(platform: string, channel: string, type: string, label: string): void
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Emitted after each book is successfully scraped.
|
|
22
|
-
* @param platform - platform id
|
|
23
|
-
* @param channel - channel id
|
|
24
|
-
* @param type - rank type id
|
|
25
|
-
* @param index - 0-based index of this book in the rank
|
|
26
|
-
* @param total - total books expected (may be 0 if unknown)
|
|
27
|
-
* @param title - book title
|
|
28
|
-
* @param rank - displayed rank number
|
|
29
|
-
*/
|
|
30
|
-
'fancy/scan:book'(platform: string, channel: string, type: string, index: number, total: number, title: string, rank: number): void
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Emitted when a rank scan finishes (success or failure).
|
|
34
|
-
* @param platform - platform id
|
|
35
|
-
* @param channel - channel id
|
|
36
|
-
* @param type - rank type id
|
|
37
|
-
* @param ok - true on success
|
|
38
|
-
* @param written - number of books written to file
|
|
39
|
-
* @param failed - number of books that failed
|
|
40
|
-
* @param errorMsg - error message if !ok
|
|
41
|
-
*/
|
|
42
|
-
'fancy/scan:rank-done'(platform: string, channel: string, type: string, ok: boolean, written: number, failed: number, errorMsg?: string): void
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Emitted when all scans for a platform finish.
|
|
46
|
-
* @param platform - platform id
|
|
47
|
-
* @param totalBooks - total books collected
|
|
48
|
-
* @param totalFiles - total files written
|
|
49
|
-
* @param ok - true if at least one rank succeeded
|
|
50
|
-
*/
|
|
51
|
-
'fancy/scan:done'(platform: string, totalBooks: number, totalFiles: number, ok: boolean): void
|
|
52
|
-
}
|
|
53
|
-
}
|
package/index.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* specifies). Declare this in the profile's cordis.patch.yml.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import './events.js'; //
|
|
24
|
+
import './events.js'; // documents fancy/scan:* event types (JSDoc, no runtime effect)
|
|
25
25
|
|
|
26
26
|
import { apply as applyBootstrap } from './commands/bootstrap/index.js';
|
|
27
27
|
import { apply as applyScan } from './commands/scan/index.js';
|