feat(gateway): add SDK tools.invoke RPC#74786
feat(gateway): add SDK tools.invoke RPC#74786gazeatcode wants to merge 1 commit intoopenclaw:mainfrom
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same SDK-facing So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Retire this draft and finish one canonical additive Do we have a high-confidence way to reproduce the issue? Yes. Current main can be checked directly: Is this the best way to solve the issue? No for this PR as-is. The branch is a draft duplicate with a concrete SDK/security bug, while #74804 tracks the same requested behavior on a non-draft canonical branch with a safer SDK parameter construction pattern. Security review: Security review needs attention: The diff adds a sensitive direct tool invocation RPC, and this branch’s SDK helper allows caller params to override the explicit tool name.
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 027ea5f08bd9. |
fc1d440 to
0efa6ad
Compare
Add Gateway artifact RPCs and SDK helpers for list/get/download, with transcript provenance checks, safer download source handling, task/run/session coverage, generated protocol models, docs, and the refreshed generated config schema baseline. Closes openclaw#74706. Refs openclaw#74898, openclaw#74769, openclaw#74804, openclaw#74786.
Add Gateway artifact RPCs and SDK helpers for list/get/download, with transcript provenance checks, safer download source handling, task/run/session coverage, generated protocol models, docs, and the refreshed generated config schema baseline. Closes openclaw#74706. Refs openclaw#74898, openclaw#74769, openclaw#74804, openclaw#74786.
Summary
@openclaw/sdkexposesoc.tools.invoke()as an unsupported scaffold while the Gateway only supports direct tool invocation through HTTP/tools/invoke.tools.invokeprotocol schemas, method registration/scope, a Gateway handler, shared direct-tool invocation core reused by HTTP, SDK typing/client support, docs, changelog, and targeted tests.gateway.tools.allowpath permits them.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
oc.tools.invoke()placeholder and the existing direct invocation implementation lived only in the HTTP route.Regression Test Plan (if applicable)
packages/sdk/src/index.test.ts,src/gateway/server-methods/tools-invoke.test.ts,src/gateway/protocol/index.test.ts,src/gateway/method-scopes.test.ts,src/gateway/tools-invoke-http.test.ts,src/agents/pi-tools.before-tool-call.e2e.test.tstools.invoke, Gateway validates the params/result contract, method scopes require operator write, direct invoke still uses Gateway allow/deny filtering, and plugin approvals can return typed approval-required state without waiting whenconfirm: trueis omitted./tools/invoke; this PR extends that path through the shared core.User-visible / Behavior Changes
SDK clients can call
oc.tools.invoke("tool-name", { args, sessionKey, agentId, confirm, idempotencyKey }). Withoutconfirm: true, plugin approval requests return a typed{ ok: false, requiresApproval: true, approvalId, error }result instead of waiting for approval and executing.Diagram (if applicable)
Security Impact (required)
Yes/No) YesYes/No) NoYes/No) NoYes/No) YesYes/No) YesYes, explain risk + mitigation: this adds a direct tool invocation RPC, so the handler requiresoperator.write, treats onlyoperator.admincallers as owner for owner-only tools, reuses the same direct-invocation Gateway tool allow/deny filtering as HTTP/tools/invoke, runs the existing before-tool-call/plugin approval pipeline, and returns typed approval-required results when callers omitconfirm: true.Repro + Verification
Environment
Steps
oc.tools.invoke("demo", { args: { input: "hello" } })from the SDK.tools.invokewith{ name, args, sessionKey, agentId, confirm }.confirm: true.Expected
tools.invokeRPC params.requiresApproval: truewithout executing whenconfirm: trueis omitted.Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
tools.invokerequest construction, protocol validation, method scope registration, Gateway handler mapping, shared HTTP direct invoke behavior, plugin approval request-only behavior, formatting, whitespace, and TypeScript checks.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations