Repository navigation
fix(agent): validate sdk-agent status and payment tool-call payloads - #252
Merged
truthixify merged 1 commit intoOct 16, 2026
Conversation
- define and export AgentStatus from @wraith-protocol/sdk-agent - validate /status, /chat, and scan_payments tool-call JSON payloads at runtime - add and export AgentResponseError (WRAITH/NETWORK/AGENT_RESPONSE) for invalid server responses - add unit and compile-time type tests for status and payment payload validation Closes wraith-protocol#238
|
@carelessdept Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
truthixify
approved these changes
Oct 16, 2026
truthixify
left a comment
Contributor
There was a problem hiding this comment.
The new runtime validators reject malformed status, chat, tool-call, and payment payloads with typed errors. After building the workspace SDK dependency, sdk-agent passes 32/32 tests and its package build succeeds.
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces untyped
getStatus()andscanPayments()response handling in@wraith-protocol/sdk-agentwith strict types, runtime payload validation, and typed error reporting:AgentStatus: Defines and exportsAgentStatus({ balance: string; tokens: Record<string, string> }) and updatesWraithAgent.getStatus()to returnPromise<AgentStatus>instead ofPromise<any>.validateAgentStatus(),validatePayment(),parseToolCallPayments(), and chat/tool-call envelope validation so malformed/statuspayloads, invalid JSON responses, non-arrayscan_paymentstool-call details, or incomplete payment records are rejected deterministically instead of being silently ignored or trusted.AgentResponseError(WRAITH/NETWORK/AGENT_RESPONSE, extendingWraithNetworkError) carryingurl,field, andreasoncontext plusdescribe()guidance.packages/sdk-agent/test/client.test.tsandtest/errors.test.tswith unit and compile-time type tests covering valid, missing-field, wrong-type, non-JSON, and non-array payloads, and updatesetc/sdk.api.md,docs/errors.md, andCHANGELOG.md.Closes #238