From 31ff17949004f4c593fe943bd940a9d47f5d5e35 Mon Sep 17 00:00:00 2001 From: QQ Date: Tue, 17 Nov 2026 08:48:05 +0800 Subject: [PATCH] Import packages/plugin/src/plugin-route-client.ts --- packages/plugin/src/plugin-route-client.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/plugin/src/plugin-route-client.ts b/packages/plugin/src/plugin-route-client.ts index f69a16a..abf2043 100644 --- a/packages/plugin/src/plugin-route-client.ts +++ b/packages/plugin/src/plugin-route-client.ts @@ -171,6 +171,14 @@ export function createPluginRouteFetch(original: Fetch, baseUrl: string, options throw new PluginRouteFailure('remote-plugin/route-response-invalid', 'The plugin route response is invalid.', { stage: 'response-structure' }) } const statusCode = result.status as number + // DS Bot polls state even when it is absent on the selected Host. + // Absence is an empty roster; mutations must still report the missing route. + // Probe each time so enabling the plugin needs no reconnect or cache reset. + if (statusCode === 404 && body.endpoint === 'state') { + return new Response(JSON.stringify({ ok: true, value: { bots: [], rooms: [], agents: [] } }), { + status: 200, headers: { 'content-type': 'application/json' }, + }) + } if (statusCode === 404) throw new PluginRouteFailure('remote-plugin/bot-not-loaded', 'The Host has no DS Bot route. Enable ds-bot in the same DSH instance/profile as the connected Host.') if (statusCode === 503) throw new PluginRouteFailure('remote-plugin/host-carrier-unavailable', 'The Host plugin route carrier is unavailable. Update and reload Remote on the Host.') if (statusCode >= 200 && statusCode < 300 && options.beforeResponse !== undefined) {