dsh-jiuling-remote-mobile 1.0.4 → 1.0.5
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/lib/index.js +11 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -413,8 +413,17 @@ export function apply(ctx) {
|
|
|
413
413
|
const controller = ctx.sessionController;
|
|
414
414
|
if (controller === undefined) return;
|
|
415
415
|
const originalPrompt = controller.prompt.bind(controller);
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
// ⚠️ **签名必须带上第二个参数 `signal`**(`(request, signal)`)。
|
|
417
|
+
//
|
|
418
|
+
// 官方 `dsh-api-session-controller/lib/index.js:3096` 是
|
|
419
|
+
// `prompt(request, signal) { signal.throwIfAborted(); ... }` —— 它**无条件**
|
|
420
|
+
// 对 `signal` 调 `throwIfAborted()`。我们的包装若只声明 `(request)`,
|
|
421
|
+
// 转发给 `originalPrompt(request)` 时 `signal` 就是 `undefined`,
|
|
422
|
+
// 于是发消息必报:
|
|
423
|
+
// `Cannot read properties of undefined (reading 'throwIfAborted')`
|
|
424
|
+
// 症状是**消息根本发不出去**,而报错文案完全看不出是参数漏传。
|
|
425
|
+
controller.prompt = async (request, signal) => {
|
|
426
|
+
if (!remoteSessions.has(request.sessionId)) return originalPrompt(request, signal);
|
|
418
427
|
const text = (request.content ?? [])
|
|
419
428
|
.filter((part) => part.type === 'text')
|
|
420
429
|
.map((part) => part.text)
|