Skip to content

fix(agent): validate sdk-agent status and payment tool-call payloads - #252

Merged
truthixify merged 1 commit into
wraith-protocol:developfrom
carelessdept:feat/issue-238-typed-agent-status-parsing
Oct 16, 2026
Merged

truthixify merged 1 commit into
wraith-protocol:developfrom
carelessdept:feat/issue-238-typed-agent-status-parsing

Conversation

@carelessdept

Copy link
Copy Markdown
Contributor

Summary

Replaces untyped getStatus() and scanPayments() response handling in @wraith-protocol/sdk-agent with strict types, runtime payload validation, and typed error reporting:

  • Typed AgentStatus: Defines and exports AgentStatus ({ balance: string; tokens: Record<string, string> }) and updates WraithAgent.getStatus() to return Promise<AgentStatus> instead of Promise<any>.
  • Runtime payload validation: Adds validateAgentStatus(), validatePayment(), parseToolCallPayments(), and chat/tool-call envelope validation so malformed /status payloads, invalid JSON responses, non-array scan_payments tool-call details, or incomplete payment records are rejected deterministically instead of being silently ignored or trusted.
  • Typed server response error: Adds and exports AgentResponseError (WRAITH/NETWORK/AGENT_RESPONSE, extending WraithNetworkError) carrying url, field, and reason context plus describe() guidance.
  • Tests & API docs: Extends packages/sdk-agent/test/client.test.ts and test/errors.test.ts with unit and compile-time type tests covering valid, missing-field, wrong-type, non-JSON, and non-array payloads, and updates etc/sdk.api.md, docs/errors.md, and CHANGELOG.md.

Closes #238

- 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
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Wave 10] Replace untyped sdk-agent status and tool-call parsing

2 participants