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

推荐订阅源

IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
L
LangChain Blog
M
MIT News - Artificial intelligence
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
P
Proofpoint News Feed
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
I
InfoQ
月光博客
月光博客
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
D
Docker
B
Blog

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
fix: voice-call CLI gateway delegation path actionable re...
clawsweeper · 2026-05-01 · via Recent Commits to openclaw:main

@@ -1,4 +1,5 @@

11

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

2+

import { ErrorCodes, errorShape } from "openclaw/plugin-sdk/gateway-runtime";

23

import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";

34

import { Type } from "typebox";

45

import {

@@ -19,6 +20,7 @@ import {

1920

type VoiceCallConfig,

2021

} from "./src/config.js";

2122

import type { CoreConfig } from "./src/core-bridge.js";

23+

import { createVoiceCallContinueOperationStore } from "./src/gateway-continue-operation.js";

22242325

const voiceCallConfigSchema = {

2426

parse(value: unknown): VoiceCallConfig {

@@ -203,6 +205,10 @@ export default definePluginEntry({

203205

}

204206205207

const runtimeState = getVoiceCallRuntimeGlobalState();

208+

const continueOperationStore = createVoiceCallContinueOperationStore({

209+

config,

210+

coreConfig: api.config as CoreConfig,

211+

});

206212207213

const ensureRuntime = async (): Promise<VoiceCallRuntime> => {

208214

if (!config.enabled) {

@@ -258,8 +264,16 @@ export default definePluginEntry({

258264

}

259265

};

260266261-

const sendError = (respond: (ok: boolean, payload?: unknown) => void, err: unknown) => {

262-

respond(false, { error: formatErrorMessage(err) });

267+

const respondError = (

268+

respond: GatewayRequestHandlerOptions["respond"],

269+

message: string,

270+

code: (typeof ErrorCodes)[keyof typeof ErrorCodes] = ErrorCodes.UNAVAILABLE,

271+

) => {

272+

respond(false, undefined, errorShape(code, message));

273+

};

274+275+

const sendError = (respond: GatewayRequestHandlerOptions["respond"], err: unknown) => {

276+

respondError(respond, formatErrorMessage(err));

263277

};

264278265279

const resolveCallMessageRequest = async (params: GatewayRequestHandlerOptions["params"]) => {

@@ -271,6 +285,7 @@ export default definePluginEntry({

271285

const rt = await ensureRuntime();

272286

return { rt, callId, message } as const;

273287

};

288+274289

const initiateCallAndRespond = async (params: {

275290

rt: VoiceCallRuntime;

276291

respond: GatewayRequestHandlerOptions["respond"];

@@ -285,7 +300,7 @@ export default definePluginEntry({

285300

dtmfSequence: params.dtmfSequence,

286301

});

287302

if (!result.success) {

288-

params.respond(false, { error: result.error || "initiate failed" });

303+

respondError(params.respond, result.error || "initiate failed");

289304

return;

290305

}

291306

params.respond(true, { callId: result.callId, initiated: true });

@@ -306,12 +321,16 @@ export default definePluginEntry({

306321

}) => {

307322

const request = await resolveCallMessageRequest(params.requestParams);

308323

if ("error" in request) {

309-

params.respond(false, { error: request.error });

324+

respondError(

325+

params.respond,

326+

request.error ?? "callId and message required",

327+

ErrorCodes.INVALID_REQUEST,

328+

);

310329

return;

311330

}

312331

const result = await params.action(request);

313332

if (!result.success) {

314-

params.respond(false, { error: result.error || params.failure });

333+

respondError(params.respond, result.error || params.failure);

315334

return;

316335

}

317336

params.respond(

@@ -328,13 +347,13 @@ export default definePluginEntry({

328347

try {

329348

const message = normalizeOptionalString(params?.message) ?? "";

330349

if (!message) {

331-

respond(false, { error: "message required" });

350+

respondError(respond, "message required", ErrorCodes.INVALID_REQUEST);

332351

return;

333352

}

334353

const rt = await ensureRuntime();

335354

const to = normalizeOptionalString(params?.to) ?? rt.config.toNumber;

336355

if (!to) {

337-

respond(false, { error: "to required" });

356+

respondError(respond, "to required", ErrorCodes.INVALID_REQUEST);

338357

return;

339358

}

340359

const mode =

@@ -369,13 +388,58 @@ export default definePluginEntry({

369388

},

370389

);

371390391+

api.registerGatewayMethod(

392+

"voicecall.continue.start",

393+

async ({ params, respond }: GatewayRequestHandlerOptions) => {

394+

try {

395+

const request = await resolveCallMessageRequest(params);

396+

if ("error" in request) {

397+

respondError(

398+

respond,

399+

request.error ?? "callId and message required",

400+

ErrorCodes.INVALID_REQUEST,

401+

);

402+

return;

403+

}

404+

respond(true, continueOperationStore.start(request));

405+

} catch (err) {

406+

sendError(respond, err);

407+

}

408+

},

409+

);

410+411+

api.registerGatewayMethod(

412+

"voicecall.continue.result",

413+

async ({ params, respond }: GatewayRequestHandlerOptions) => {

414+

try {

415+

const operationId = normalizeOptionalString(params?.operationId) ?? "";

416+

if (!operationId) {

417+

respondError(respond, "operationId required", ErrorCodes.INVALID_REQUEST);

418+

return;

419+

}

420+

const operation = continueOperationStore.read(operationId);

421+

if (!operation.ok) {

422+

respondError(respond, operation.error, ErrorCodes.INVALID_REQUEST);

423+

return;

424+

}

425+

respond(true, operation.payload);

426+

} catch (err) {

427+

sendError(respond, err);

428+

}

429+

},

430+

);

431+372432

api.registerGatewayMethod(

373433

"voicecall.speak",

374434

async ({ params, respond }: GatewayRequestHandlerOptions) => {

375435

try {

376436

const request = await resolveCallMessageRequest(params);

377437

if ("error" in request) {

378-

respond(false, { error: request.error });

438+

respondError(

439+

respond,

440+

request.error ?? "callId and message required",

441+

ErrorCodes.INVALID_REQUEST,

442+

);

379443

return;

380444

}

381445

if (request.rt.config.realtime.enabled) {

@@ -390,7 +454,7 @@ export default definePluginEntry({

390454

}

391455

const result = await request.rt.manager.speak(request.callId, request.message);

392456

if (!result.success) {

393-

respond(false, { error: result.error || "speak failed" });

457+

respondError(respond, result.error || "speak failed");

394458

return;

395459

}

396460

respond(true, { success: true });

@@ -407,13 +471,13 @@ export default definePluginEntry({

407471

const callId = normalizeOptionalString(params?.callId) ?? "";

408472

const digits = normalizeOptionalString(params?.digits) ?? "";

409473

if (!callId || !digits) {

410-

respond(false, { error: "callId and digits required" });

474+

respondError(respond, "callId and digits required", ErrorCodes.INVALID_REQUEST);

411475

return;

412476

}

413477

const rt = await ensureRuntime();

414478

const result = await rt.manager.sendDtmf(callId, digits);

415479

if (!result.success) {

416-

respond(false, { error: result.error || "dtmf failed" });

480+

respondError(respond, result.error || "dtmf failed");

417481

return;

418482

}

419483

respond(true, { success: true });

@@ -429,13 +493,13 @@ export default definePluginEntry({

429493

try {

430494

const callId = normalizeOptionalString(params?.callId) ?? "";

431495

if (!callId) {

432-

respond(false, { error: "callId required" });

496+

respondError(respond, "callId required", ErrorCodes.INVALID_REQUEST);

433497

return;

434498

}

435499

const rt = await ensureRuntime();

436500

const result = await rt.manager.endCall(callId);

437501

if (!result.success) {

438-

respond(false, { error: result.error || "end failed" });

502+

respondError(respond, result.error || "end failed");

439503

return;

440504

}

441505

respond(true, { success: true });

@@ -476,7 +540,7 @@ export default definePluginEntry({

476540

const message = normalizeOptionalString(params?.message) ?? "";

477541

const dtmfSequence = normalizeOptionalString(params?.dtmfSequence);

478542

if (!to) {

479-

respond(false, { error: "to required" });

543+

respondError(respond, "to required", ErrorCodes.INVALID_REQUEST);

480544

return;

481545

}

482546

const rt = await ensureRuntime();