@cloud411716/fancy-webnovel 0.1.70 → 0.1.72
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/package.json +1 -1
- package/plugins/fancy-scan/index.js +32 -15
package/package.json
CHANGED
|
@@ -20,22 +20,19 @@ export async function apply(ctx) {
|
|
|
20
20
|
const session = invocation.agent.session;
|
|
21
21
|
const rawInput = invocation.rawInput ? invocation.rawInput.trim() : '';
|
|
22
22
|
|
|
23
|
-
// ─── TEST:
|
|
23
|
+
// ─── TEST: 验证直接用 invocation.agent.session 追加事件 ─────────────────
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
notify(session, '[TEST] 追加了 fake tool/call 事件');
|
|
38
|
-
}
|
|
25
|
+
// invocation.agent.session 就是 Session 对象,直接 append
|
|
26
|
+
const s = invocation.agent.session;
|
|
27
|
+
notify(session, `[TEST] session.id = ${s?.id ?? 'UNDEFINED'}`);
|
|
28
|
+
if (s) {
|
|
29
|
+
// 追加一个 fake tool/call,看 status bar 是否出现进度
|
|
30
|
+
s.append('tool/call', {
|
|
31
|
+
callId: 'test-call-1',
|
|
32
|
+
name: 'fancy-scan/progress',
|
|
33
|
+
arguments: JSON.stringify({ platform: 'test', length: 'test' }),
|
|
34
|
+
});
|
|
35
|
+
notify(session, '[TEST] session.append(tool/call) 成功');
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
// ─── TEST 结束 ───────────────────────────────────────────────────────
|
|
@@ -112,6 +109,26 @@ export async function apply(ctx) {
|
|
|
112
109
|
|
|
113
110
|
notify(session, scan.notify({ type: 'collecting', platform, length }));
|
|
114
111
|
|
|
112
|
+
// ─── TEST: 在采集过程中持续发送 tool/call 事件 ───────────────────────
|
|
113
|
+
{
|
|
114
|
+
const s = invocation.agent.session;
|
|
115
|
+
let count = 0;
|
|
116
|
+
const timers = [];
|
|
117
|
+
for (let i = 0; i < 5; i++) {
|
|
118
|
+
const t = setTimeout(() => {
|
|
119
|
+
count++;
|
|
120
|
+
s.append('tool/call', {
|
|
121
|
+
callId: `progress-${i}`,
|
|
122
|
+
name: 'fancy-scan/progress',
|
|
123
|
+
arguments: JSON.stringify({ platform, length, step: count }),
|
|
124
|
+
});
|
|
125
|
+
notify(session, `[TEST] tool/call #${count} 发送于采集阶段`);
|
|
126
|
+
}, i * 800);
|
|
127
|
+
timers.push(t);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// ─── TEST 结束 ───────────────────────────────────────────────────────
|
|
131
|
+
|
|
115
132
|
const scriptResult = await spawnScript(
|
|
116
133
|
'node',
|
|
117
134
|
[join(SCAN_SCRIPTS_DIR, 'run-scan.js'),
|