Mount IM RPC channels via plugin webServer to fix HTTP 405.

connection.rpc.handle looks up webServer on a Cordis fiber that does not inject it, so channel routes never registered after host restart.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-14 21:32:43 +08:00
parent dd2365407e
commit 6107692418
18 changed files with 666 additions and 330 deletions

View file

@ -1,6 +1,7 @@
import { SET_CONTEXT_ENHANCEMENT_ENDPOINT, validContextEnhancementPayload } from './context-enhancement-rpc.mjs';
import { SET_ACCESS_POLICY_ENDPOINT, validAccessPolicyPayload } from './access-policy-rpc.mjs';
import { SET_GROUP_SESSION_SCOPE_ENDPOINT, validGroupSessionScopePayload } from './group-session-scope-rpc.mjs';
import { installConnectionRpcChannel } from '../../connection-rpc-mount.mjs';
import { resolveRpcAuthority } from '../../rpc-authority.mjs';
import { publicConnectionTestResult } from '../../../../src/channels/shared/connection-test.mjs';
import {
@ -197,12 +198,10 @@ export function createTokenBotRpcHandler(controller, { channel }) {
}
export function installTokenBotRpc(ctx, controller, { channel, rpcChannel, authority }) {
if (!ctx?.connection?.rpc || typeof ctx.connection.rpc.handle !== 'function') {
throw new TypeError('DSH Host Connection RPC is required');
}
return ctx.connection.rpc.handle(
resolveRpcAuthority(authority);
return installConnectionRpcChannel(
ctx,
rpcChannel,
createTokenBotRpcHandler(controller, { channel }),
{ authority: resolveRpcAuthority(authority) },
);
}