refactor(plugin-sdk): consolidate tool result helpers#99740
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 7:48 PM ET / 23:48 UTC. Summary PR surface: Source -76, Tests +19, Docs +2, Config +4, Generated 0, Other +4. Total -47 across 24 files. Reproducibility: not applicable. this is an additive SDK/refactor PR rather than a bug report. Source inspection compared current-main helper behavior, the PR helper/facade, and migrated call sites. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land after maintainers explicitly accept the narrow public SDK seam and keep the package export, entrypoint metadata, API budget/baseline, docs, and focused contract tests aligned. Do we have a high-confidence way to reproduce the issue? Not applicable; this is an additive SDK/refactor PR rather than a bug report. Source inspection compared current-main helper behavior, the PR helper/facade, and migrated call sites. Is this the best way to solve the issue? Yes, if maintainers accept the API; the narrow subpath is cleaner than exposing more of the broad agent helper surface. If maintainers do not want a public contract, the safer alternative is keeping the helper internal. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7608d38597c0. Label changesLabel justifications:
Evidence reviewedPR surface: Source -76, Tests +19, Docs +2, Config +4, Generated 0, Other +4. Total -47 across 24 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (7 earlier review cycles)
|
53906ca to
ec9de11
Compare
ec9de11 to
c626a35
Compare
c626a35 to
81ae6fb
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
4cf5883 to
7d1c455
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
7d1c455 to
9dcb2cc
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
7689046 to
6a38d59
Compare
* refactor(plugin-sdk): consolidate tool result helpers * docs(plugin-sdk): tighten tool result guidance * refactor(feishu): use tool results directly
What Problem This Solves
Portable agent tool-result construction was duplicated across multiple plugins. Exact pretty-JSON result builders repeatedly recreated the same contract: one text block containing
JSON.stringify(payload, null, 2)plus the same typed payload indetails.Why This Change Was Made
This adds a narrow
openclaw/plugin-sdk/tool-resultsentrypoint that exposes the canonical typedtextResultandjsonResulthelpers, then migrates only callers with identical contracts. MCP structured/error results, browser sanitization, media/file results, approvals, channel presentation, transport envelopes, and caller-specific failure semantics remain with their existing owners.The consolidation removes local constructors and one duplicate result type while preserving the existing model-facing text and structured details behavior.
User Impact
No intended behavior change. Plugin tools keep returning the same text and
detailspayloads. Plugin authors gain a small supported SDK seam for portable text and pretty-JSON agent results.SDK surface metric and merge risk
323 -> 324)10,425 -> 10,428)5,237 -> 5,239)This is an additive public SDK contract, so the matching package export, API metadata/checksum, docs, and exact surface-budget ceilings are updated together. The merge risk is limited to that additive surface; no existing SDK entrypoint is removed or changed, and migrated runtime shapes are unchanged.
Evidence
node scripts/plugin-sdk-surface-report.mjs --checkpnpm plugin-sdk:api:checkpnpm plugin-sdk:check-exportsblacksmith-testbox, idtbx_01kwq95wx5ftcsx4xprr9kc5ja, Actions run28716970734.