惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
腾讯CDC
G
Google Developers Blog
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
有赞技术团队
有赞技术团队
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
M
MIT News - Artificial intelligence
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
美团技术团队
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor: add gateway method dispatch contract · openclaw...
steipete · 2026-05-15 · via Recent Commits to openclaw:main

@@ -299,17 +299,20 @@ function mergeGatewayClientInternal(

299299300300

type DispatchGatewayMethodInProcessOptions = {

301301

allowSyntheticModelOverride?: boolean;

302+

disableSyntheticClient?: boolean;

302303

expectFinal?: boolean;

303304

forceSyntheticClient?: boolean;

304305

pluginRuntimeOwnerId?: string;

306+

requireScopedClient?: boolean;

305307

syntheticScopes?: string[];

306308

timeoutMs?: number;

307309

};

308310309-

type GatewayMethodDispatchResponse = {

311+

export type GatewayMethodDispatchResponse = {

310312

ok: boolean;

311313

payload?: unknown;

312314

error?: ErrorShape;

315+

meta?: Record<string, unknown>;

313316

};

314317315318

function unwrapGatewayMethodDispatchResponse(

@@ -322,11 +325,11 @@ function unwrapGatewayMethodDispatchResponse(

322325

return response.payload;

323326

}

324327325-

async function dispatchGatewayMethod<T>(

328+

export async function dispatchGatewayMethodInProcessRaw(

326329

method: string,

327-

params: Record<string, unknown>,

330+

params: unknown,

328331

options?: DispatchGatewayMethodInProcessOptions,

329-

): Promise<T> {

332+

): Promise<GatewayMethodDispatchResponse> {

330333

const scope = getPluginRuntimeGatewayRequestScope();

331334

const context = scope?.context ?? getFallbackGatewayContext();

332335

const isWebchatConnect = scope?.isWebchatConnect ?? (() => false);

@@ -335,6 +338,11 @@ async function dispatchGatewayMethod<T>(

335338

`In-process gateway dispatch requires a gateway request scope (method: ${method}). No scope set and no fallback context available.`,

336339

);

337340

}

341+

if (options?.requireScopedClient === true && !scope?.client) {

342+

throw new Error(

343+

`In-process gateway dispatch requires an authenticated plugin request scope (method: ${method}).`,

344+

);

345+

}

338346339347

let firstResponse: GatewayMethodDispatchResponse | undefined;

340348

let finalResponse: GatewayMethodDispatchResponse | undefined;

@@ -353,6 +361,9 @@ async function dispatchGatewayMethod<T>(

353361

scope?.client,

354362

pluginRuntimeOwnerId ? { pluginRuntimeOwnerId } : undefined,

355363

);

364+

if (options?.disableSyntheticClient === true && !scopedClient) {

365+

throw new Error(`In-process gateway dispatch requires a scoped client (method: ${method}).`);

366+

}

356367

await handleGatewayRequest({

357368

req: {

358369

type: "req",

@@ -361,10 +372,12 @@ async function dispatchGatewayMethod<T>(

361372

params,

362373

},

363374

client:

364-

options?.forceSyntheticClient === true ? syntheticClient : (scopedClient ?? syntheticClient),

375+

options?.forceSyntheticClient === true

376+

? syntheticClient

377+

: (scopedClient ?? (options?.disableSyntheticClient === true ? null : syntheticClient)),

365378

isWebchatConnect,

366-

respond: (ok, payload, error) => {

367-

const response = { ok, payload, error };

379+

respond: (ok, payload, error, meta) => {

380+

const response = { ok, payload, error, ...(meta ? { meta } : {}) };

368381

if (!firstResponse) {

369382

firstResponse = response;

370383

return;

@@ -382,7 +395,7 @@ async function dispatchGatewayMethod<T>(

382395

}

383396

const firstPayload = firstResponse.payload as { status?: unknown } | undefined;

384397

if (options?.expectFinal !== true || firstPayload?.status !== "accepted") {

385-

return unwrapGatewayMethodDispatchResponse(method, firstResponse) as T;

398+

return firstResponse;

386399

}

387400

const final =

388401

finalResponse ??

@@ -412,7 +425,16 @@ async function dispatchGatewayMethod<T>(

412425

resolve(response);

413426

};

414427

}));

415-

return unwrapGatewayMethodDispatchResponse(method, final) as T;

428+

return final;

429+

}

430+431+

async function dispatchGatewayMethod<T>(

432+

method: string,

433+

params: unknown,

434+

options?: DispatchGatewayMethodInProcessOptions,

435+

): Promise<T> {

436+

const response = await dispatchGatewayMethodInProcessRaw(method, params, options);

437+

return unwrapGatewayMethodDispatchResponse(method, response) as T;

416438

}

417439418440

export async function dispatchGatewayMethodInProcess<T>(