From db9ee78f13e45a2a7ad73e29d17c35c7690b29db Mon Sep 17 00:00:00 2001 From: lamborghini21 Date: Wed, 26 Aug 2026 20:47:34 +0100 Subject: [PATCH 1/4] test: remove stale agent tests moved to sdk-agent package --- examples/agent/client.ts | 2 +- examples/agent/package.json | 17 + examples/stellar-spectre-agent/index.ts | 2 +- examples/stellar-spectre-agent/package.json | 3 +- package.json | 5 + packages/sdk-agent/README.md | 267 +++++++++++++ packages/sdk-agent/package.json | 31 ++ packages/sdk-agent/src/client.ts | 177 +++++++++ packages/sdk-agent/src/index.ts | 17 + packages/sdk-agent/src/tools.ts | 153 +++++++ packages/sdk-agent/src/types.ts | 110 ++++++ .../sdk-agent/test}/client.test.ts | 6 +- .../sdk-agent/test}/tools.test.ts | 5 +- packages/sdk-agent/tsconfig.json | 8 + packages/sdk-agent/tsup.config.ts | 13 + packages/sdk-agent/vitest.config.ts | 7 + pnpm-lock.yaml | 374 +++++------------- src/agent/client-local.ts | 2 + src/agent/client.ts | 181 +-------- src/agent/index.ts | 9 + src/agent/tools-local.ts | 55 +++ src/agent/tools.ts | 162 +------- src/agent/types-local.ts | 110 ++++++ src/agent/types.ts | 132 ++----- src/index.ts | 9 + src/types/@wraith-protocol/sdk-agent.d.ts | 203 ++++++++++ tsconfig.json | 2 +- tsup.config.ts | 14 +- 28 files changed, 1353 insertions(+), 723 deletions(-) create mode 100644 examples/agent/package.json create mode 100644 packages/sdk-agent/README.md create mode 100644 packages/sdk-agent/package.json create mode 100644 packages/sdk-agent/src/client.ts create mode 100644 packages/sdk-agent/src/index.ts create mode 100644 packages/sdk-agent/src/tools.ts create mode 100644 packages/sdk-agent/src/types.ts rename {test/agent => packages/sdk-agent/test}/client.test.ts (98%) rename {test/agent => packages/sdk-agent/test}/tools.test.ts (92%) create mode 100644 packages/sdk-agent/tsconfig.json create mode 100644 packages/sdk-agent/tsup.config.ts create mode 100644 packages/sdk-agent/vitest.config.ts create mode 100644 src/agent/client-local.ts create mode 100644 src/agent/tools-local.ts create mode 100644 src/agent/types-local.ts create mode 100644 src/types/@wraith-protocol/sdk-agent.d.ts diff --git a/examples/agent/client.ts b/examples/agent/client.ts index e00c982..59e17f8 100644 --- a/examples/agent/client.ts +++ b/examples/agent/client.ts @@ -5,7 +5,7 @@ * AI chat, and chain operations — via the hosted TEE infrastructure. * No crypto libraries, no contracts, no RPC calls. */ -import { Wraith, Chain } from '@wraith-protocol/sdk'; +import { Wraith, Chain } from '@wraith-protocol/sdk-agent'; async function main() { // 1. Initialize with your API key diff --git a/examples/agent/package.json b/examples/agent/package.json new file mode 100644 index 0000000..5705906 --- /dev/null +++ b/examples/agent/package.json @@ -0,0 +1,17 @@ +{ + "name": "@wraith-protocol/example-agent", + "private": true, + "type": "module", + "main": "client.ts", + "scripts": { + "start": "npx tsx client.ts" + }, + "dependencies": { + "@wraith-protocol/sdk": "file:../..", + "@wraith-protocol/sdk-agent": "workspace:*" + }, + "devDependencies": { + "tsx": "^4.0.0", + "typescript": "^5.7.0" + } +} diff --git a/examples/stellar-spectre-agent/index.ts b/examples/stellar-spectre-agent/index.ts index c79a8a0..71ffb38 100644 --- a/examples/stellar-spectre-agent/index.ts +++ b/examples/stellar-spectre-agent/index.ts @@ -1,5 +1,5 @@ #!/usr/bin/env node -import { Wraith, Chain } from '@wraith-protocol/sdk'; +import { Wraith, Chain } from '@wraith-protocol/sdk-agent'; function getEnv(name: string): string { const value = process.env[name]; diff --git a/examples/stellar-spectre-agent/package.json b/examples/stellar-spectre-agent/package.json index b7de5f0..ad7d797 100644 --- a/examples/stellar-spectre-agent/package.json +++ b/examples/stellar-spectre-agent/package.json @@ -7,7 +7,8 @@ "start": "npx tsx index.ts" }, "dependencies": { - "@wraith-protocol/sdk": "file:../.." + "@wraith-protocol/sdk": "file:../..", + "@wraith-protocol/sdk-agent": "workspace:*" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/package.json b/package.json index b64de7a..22259b7 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,11 @@ "types": "./dist/chains/ckb/index.d.ts", "import": "./dist/chains/ckb/index.js", "require": "./dist/chains/ckb/index.cjs" + }, + "./agent": { + "types": "./dist/agent/index.d.ts", + "import": "./dist/agent/index.js", + "require": "./dist/agent/index.cjs" } }, "files": [ diff --git a/packages/sdk-agent/README.md b/packages/sdk-agent/README.md new file mode 100644 index 0000000..b5619fa --- /dev/null +++ b/packages/sdk-agent/README.md @@ -0,0 +1,267 @@ +# @wraith-protocol/sdk-agent + +Agent client for the Wraith multichain stealth address platform. This package provides the Wraith and WraithAgent classes for interacting with the Wraith managed agent API, along with Claude-compatible agent tools. + +## Installation + +```bash +npm install @wraith-protocol/sdk-agent +``` + +## Usage + +### Basic Agent Client + +```typescript +import { Wraith, Chain } from '@wraith-protocol/sdk-agent'; + +const wraith = new Wraith({ + apiKey: 'wraith_live_abc123...', +}); + +// Create a single-chain agent +const agent = await wraith.createAgent({ + name: 'alice', + chain: Chain.Stellar, + wallet: '0x...', + signature: '0x...', +}); + +// Chat with the agent +const response = await agent.chat('send 10 XLM to bob.wraith'); +console.log('Agent:', response.response); + +// Check balance +const balance = await agent.getBalance(); +console.log('Balance:', balance); +``` + +### Multichain Agent + +```typescript +// Create a multichain agent +const multiAgent = await wraith.createAgent({ + name: 'bob', + chain: [Chain.Ethereum, Chain.Stellar], + wallet: '0x...', + signature: '0x...', +}); + +// The AI routes to the correct chain automatically +await multiAgent.chat('send 10 XLM to carol.wraith on stellar'); +await multiAgent.chat("what's my balance on all chains?"); +``` + +### Deploy on All Chains + +```typescript +// Deploy on every supported chain +const omniAgent = await wraith.createAgent({ + name: 'carol', + chain: Chain.All, + wallet: '0x...', + signature: '0x...', +}); +``` + +### Agent Methods + +```typescript +// Get agent by wallet address +const agent = await wraith.getAgentByWallet('0xwallet'); + +// Get agent by name +const agent = await wraith.getAgentByName('alice'); + +// List all agents +const agents = await wraith.listAgents(); + +// Agent operations +await agent.chat('message'); +await agent.getBalance(); +await agent.scanPayments(); +await agent.getNotifications(); +await agent.markNotificationsRead(); +await agent.getConversations(); +await agent.deleteConversation('conv-id'); +``` + +### Claude Agent Tools + +```typescript +import { createClaudeAgentTools } from '@wraith-protocol/sdk-agent'; + +const tools = createClaudeAgentTools(); + +// Send to meta-address +const sendResult = await tools.sendToMetaAddress({ + metaAddress: 'st:xlm:...', + amount: '10', + asset: 'XLM', + memo: 'Payment', +}); + +// Scan for payments +const scanResult = await tools.scan({ + announcements: [...], + viewingKeyHex: '...', + spendingPubKeyHex: '...', + spendingScalarHex: '...', +}); + +// Withdraw from stealth address +const withdrawResult = await tools.withdraw({ + stealthAddress: 'G...', + amount: '5', + asset: 'XLM', + destination: 'GA...', +}); + +// Resolve name +const resolveResult = await tools.resolveName({ + name: 'alice', + chain: 'stellar', +}); +``` + +## Adapter Shape + +Third-party agent frameworks (Vercel AI SDK, Mastra, etc.) can integrate with Wraith by implementing the following adapter pattern: + +```typescript +interface WraithAgentAdapter { + // Configuration + apiKey: string; + baseUrl?: string; + aiProvider?: 'gemini' | 'openai' | 'claude'; + aiApiKey?: string; + + // Agent lifecycle + createAgent(config: { + name: string; + chain: Chain | Chain[]; + wallet: string; + signature: string; + message?: string; + }): Promise; + + // Agent operations + chat(agentId: string, message: string, conversationId?: string): Promise; + getBalance(agentId: string): Promise; + scanPayments(agentId: string): Promise; + getNotifications( + agentId: string, + ): Promise<{ notifications: Notification[]; unreadCount: number }>; +} + +// Example: Vercel AI SDK integration +export function createWraithTools(config: WraithAgentAdapter) { + return { + wraith_send: async ({ metaAddress, amount, asset }) => { + const tools = createClaudeAgentTools(); + return tools.sendToMetaAddress({ metaAddress, amount, asset }); + }, + wraith_scan: async ({ announcements, viewingKeyHex, spendingPubKeyHex, spendingScalarHex }) => { + const tools = createClaudeAgentTools(); + return tools.scan({ announcements, viewingKeyHex, spendingPubKeyHex, spendingScalarHex }); + }, + // ... more tools + }; +} +``` + +## Chain Enum + +```typescript +enum Chain { + Horizen = 'horizen', + Ethereum = 'ethereum', + Polygon = 'polygon', + Base = 'base', + Stellar = 'stellar', + Solana = 'solana', + All = 'all', +} +``` + +## Types + +```typescript +interface WraithConfig { + apiKey: string; + baseUrl?: string; + ai?: { + provider: 'gemini' | 'openai' | 'claude'; + apiKey: string; + }; +} + +interface AgentConfig { + name: string; + chain: Chain | Chain[]; + wallet: string; + signature: string; + message?: string; +} + +interface AgentInfo { + id: string; + name: string; + chains: Chain[]; + addresses: Record; + metaAddresses: Record; +} + +interface ChatResponse { + response: string; + toolCalls?: ToolCall[]; + conversationId: string; +} + +interface Balance { + native: string; + tokens: Record; +} + +interface Payment { + stealthAddress: string; + balance: string; + ephemeralPubKey: string; +} + +interface Notification { + id: number; + type: string; + title: string; + body: string; + read: boolean; + createdAt: string; +} + +interface Conversation { + id: string; + title: string; + createdAt: string; + updatedAt: string; +} +``` + +## API + +The Wraith agent client communicates with the Wraith API (default: `https://api.wraith.dev`). All requests are authenticated via the `Authorization: Bearer wraith_...` header. + +Optional AI provider configuration can be passed to use your own AI provider instead of the default: + +```typescript +const wraith = new Wraith({ + apiKey: 'wraith_live_abc123...', + ai: { + provider: 'openai', + apiKey: 'sk-...', + }, +}); +``` + +## License + +MIT diff --git a/packages/sdk-agent/package.json b/packages/sdk-agent/package.json new file mode 100644 index 0000000..94f6ce9 --- /dev/null +++ b/packages/sdk-agent/package.json @@ -0,0 +1,31 @@ +{ + "name": "@wraith-protocol/sdk-agent", + "version": "0.1.0", + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs" + } + }, + "files": [ + "dist" + ], + "scripts": { + "build": "tsup", + "test": "vitest run", + "test:watch": "vitest" + }, + "dependencies": { + "@wraith-protocol/sdk": "workspace:*" + }, + "devDependencies": { + "tsup": "^8.0.0", + "typescript": "^5.0.0", + "vitest": "^3.0.0" + } +} diff --git a/packages/sdk-agent/src/client.ts b/packages/sdk-agent/src/client.ts new file mode 100644 index 0000000..f81bb05 --- /dev/null +++ b/packages/sdk-agent/src/client.ts @@ -0,0 +1,177 @@ +import { RPCRequestError } from '@wraith-protocol/sdk'; +import type { + WraithConfig, + AgentConfig, + AgentInfo, + ChatResponse, + Balance, + Payment, + Notification, + Conversation, +} from './types'; +import { Chain } from './types'; + +const DEFAULT_BASE_URL = 'https://api.wraith.dev'; + +export class Wraith { + private readonly apiKey: string; + private readonly baseUrl: string; + private readonly aiConfig?: { provider: string; apiKey: string }; + + constructor(config: WraithConfig) { + this.apiKey = config.apiKey; + this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, ''); + this.aiConfig = config.ai; + } + + private async request(method: string, path: string, body?: unknown): Promise { + const url = `${this.baseUrl}${path}`; + const res = await fetch(url, { + method, + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${this.apiKey}`, + ...(this.aiConfig + ? { 'X-AI-Provider': this.aiConfig.provider, 'X-AI-Key': this.aiConfig.apiKey } + : {}), + }, + body: body ? JSON.stringify(body) : undefined, + }); + + if (!res.ok) { + const error = await res.json().catch(() => ({ message: res.statusText })); + throw new RPCRequestError(url, res.status, error.message || res.statusText); + } + + return res.json(); + } + + /** + * Creates a new stealth address AI agent. + * + * @param config Configuration for the agent name, chains, signature, and wallet. + * @returns A WraithAgent instance to control the new agent. + * @throws {RPCRequestError} If the server returns a non-2xx status code. + */ + async createAgent(config: AgentConfig): Promise { + const info = await this.request('POST', '/agent/create', config); + return new WraithAgent(this, info); + } + + agent(agentId: string): WraithAgent { + return new WraithAgent(this, { + id: agentId, + name: '', + chains: [], + addresses: {} as Record, + metaAddresses: {} as Record, + }); + } + + /** + * Retrieves a WraithAgent instance by their associated wallet address. + * + * @param walletAddress The base wallet address of the agent owner. + * @returns A WraithAgent instance. + * @throws {RPCRequestError} If the server returns a non-2xx status code. + */ + async getAgentByWallet(walletAddress: string): Promise { + const info = await this.request('GET', `/agent/wallet/${walletAddress}`); + return new WraithAgent(this, info); + } + + /** + * Retrieves a WraithAgent instance by their registered name (e.g. alice.wraith). + * + * @param name The agent name. + * @returns A WraithAgent instance. + * @throws {RPCRequestError} If the server returns a non-2xx status code. + */ + async getAgentByName(name: string): Promise { + const info = await this.request('GET', `/agent/info/${name}`); + return new WraithAgent(this, info); + } + + /** + * Lists all stealth address AI agents associated with the user's API key. + * + * @returns List of AgentInfo objects. + * @throws {RPCRequestError} If the server returns a non-2xx status code. + */ + async listAgents(): Promise { + return this.request('GET', '/agents'); + } + + /** @internal Exposed for WraithAgent to use. */ + _request(method: string, path: string, body?: unknown): Promise { + return this.request(method, path, body); + } +} + +export class WraithAgent { + readonly info: AgentInfo; + private readonly wraith: Wraith; + + constructor(wraith: Wraith, info: AgentInfo) { + this.wraith = wraith; + this.info = info; + } + + private req(method: string, path: string, body?: unknown): Promise { + return this.wraith._request(method, `/agent/${this.info.id}${path}`, body); + } + + async chat(message: string, conversationId?: string): Promise { + return this.req('POST', '/chat', { message, conversationId }); + } + + async getStatus(): Promise { + return this.req('GET', '/status'); + } + + async getBalance(): Promise { + const status = await this.getStatus(); + return { native: status.balance || '0', tokens: status.tokens || {} }; + } + + async scanPayments(): Promise { + const res = await this.chat('Scan for incoming stealth payments'); + return (res.toolCalls || []) + .filter((tc) => tc.name === 'scan_payments') + .flatMap((tc) => { + try { + return JSON.parse(tc.detail || '[]'); + } catch { + return []; + } + }); + } + + async exportKey(signature: string, message: string): Promise<{ secret: string }> { + return this.req<{ secret: string }>('POST', '/export', { signature, message }); + } + + async getConversations(): Promise { + return this.req('GET', '/conversations'); + } + + async getMessages(conversationId: string): Promise> { + return this.req('GET', `/conversations/${conversationId}/messages`); + } + + async deleteConversation(conversationId: string): Promise { + await this.req('DELETE', `/conversations/${conversationId}`); + } + + async getNotifications(): Promise<{ notifications: Notification[]; unreadCount: number }> { + return this.req('GET', '/notifications'); + } + + async markNotificationsRead(): Promise { + await this.req('POST', '/notifications/read', {}); + } + + async clearNotifications(): Promise { + await this.req('DELETE', '/notifications'); + } +} diff --git a/packages/sdk-agent/src/index.ts b/packages/sdk-agent/src/index.ts new file mode 100644 index 0000000..4b04ce2 --- /dev/null +++ b/packages/sdk-agent/src/index.ts @@ -0,0 +1,17 @@ +export { Wraith, WraithAgent } from './client'; +export { Chain } from './types'; +export type { + WraithConfig, + AgentConfig, + AgentInfo, + ChatResponse, + ToolCall, + Balance, + Payment, + Invoice, + Schedule, + TxResult, + PrivacyReport, + Notification, + Conversation, +} from './types'; diff --git a/packages/sdk-agent/src/tools.ts b/packages/sdk-agent/src/tools.ts new file mode 100644 index 0000000..10de6e4 --- /dev/null +++ b/packages/sdk-agent/src/tools.ts @@ -0,0 +1,153 @@ +import { + deriveStealthKeys, + decodeStealthMetaAddress, + encodeStealthMetaAddress, + generateStealthAddress, + scanAnnouncements, + hexToBytes, + bytesToHex, + type Announcement, +} from '@wraith-protocol/sdk/chains/stellar'; + +export interface ClaudeAgentToolContext { + apiKey?: string; + baseUrl?: string; +} + +export interface SendToMetaAddressInput { + metaAddress: string; + amount: string; + asset?: string; + memo?: string; + destination?: string; +} + +export interface ScanInput { + announcements: Announcement[]; + viewingKeyHex: string; + spendingPubKeyHex: string; + spendingScalarHex: string; +} + +export interface WithdrawInput { + stealthAddress: string; + amount: string; + asset?: string; + destination?: string; + memo?: string; +} + +export interface ResolveNameInput { + name: string; + chain?: string; +} + +export interface ToolResult { + kind: 'send' | 'scan' | 'withdraw' | 'resolve-name'; + signingRequired: boolean; + tx?: Record; + metaAddress?: string; + matches?: Array>; + count?: number; + name?: string; + chain?: string; + note?: string; +} + +export interface ClaudeAgentTools { + sendToMetaAddress(input: SendToMetaAddressInput): Promise; + scan(input: ScanInput): Promise; + withdraw(input: WithdrawInput): Promise; + resolveName(input: ResolveNameInput): Promise; +} + +function parseHexBytes(hex: string): Uint8Array { + const clean = hex.startsWith('0x') ? hex.slice(2) : hex; + return hexToBytes(clean); +} + +function parseBigInt(value: string | undefined): bigint { + if (!value) return 0n; + const clean = value.startsWith('0x') || value.startsWith('0X') ? value : value; + if (/^0x/i.test(clean)) return BigInt(clean); + if (/^[0-9]+$/u.test(clean)) return BigInt(clean); + return BigInt(`0x${clean}`); +} + +export function createClaudeAgentTools(_context: ClaudeAgentToolContext = {}): ClaudeAgentTools { + return { + async sendToMetaAddress(input) { + const { spendingPubKey, viewingPubKey } = decodeStealthMetaAddress(input.metaAddress); + const stealthResult = generateStealthAddress(spendingPubKey, viewingPubKey); + return { + kind: 'send', + signingRequired: true, + metaAddress: input.metaAddress, + tx: { + intent: 'send-to-meta-address', + asset: input.asset ?? 'XLM', + amount: input.amount, + memo: input.memo ?? '', + stealthAddress: stealthResult.stealthAddress, + ephemeralPubKey: bytesToHex(stealthResult.ephemeralPubKey), + metadata: stealthResult.viewTag.toString(16).padStart(2, '0'), + destination: input.destination ?? stealthResult.stealthAddress, + }, + note: 'The agent prepares a stealth send plan. The sender must sign the transaction locally with their wallet.', + }; + }, + + async scan(input) { + const viewingKey = parseHexBytes(input.viewingKeyHex); + const spendingPubKey = parseHexBytes(input.spendingPubKeyHex); + const spendingScalar = parseBigInt(input.spendingScalarHex); + const matches = scanAnnouncements( + input.announcements, + viewingKey, + spendingPubKey, + spendingScalar, + ); + return { + kind: 'scan', + signingRequired: false, + matches: matches.map((item) => ({ + stealthAddress: item.stealthAddress, + ephemeralPubKey: item.ephemeralPubKey, + metadata: item.metadata, + stealthPrivateScalar: item.stealthPrivateScalar.toString(), + })), + count: matches.length, + }; + }, + + async withdraw(input) { + return { + kind: 'withdraw', + signingRequired: true, + tx: { + intent: 'withdraw', + stealthAddress: input.stealthAddress, + asset: input.asset ?? 'XLM', + amount: input.amount, + destination: input.destination ?? input.stealthAddress, + memo: input.memo ?? '', + }, + note: 'The agent prepares a withdrawal plan. The stealth account owner must sign the transaction with their local wallet or key manager.', + }; + }, + + async resolveName(input) { + return { + kind: 'resolve-name', + signingRequired: false, + name: input.name, + chain: input.chain ?? 'stellar', + tx: { + intent: 'resolve-name', + name: input.name, + chain: input.chain ?? 'stellar', + }, + }; + }, + }; +} diff --git a/packages/sdk-agent/src/types.ts b/packages/sdk-agent/src/types.ts new file mode 100644 index 0000000..1036b7a --- /dev/null +++ b/packages/sdk-agent/src/types.ts @@ -0,0 +1,110 @@ +export enum Chain { + Horizen = 'horizen', + Ethereum = 'ethereum', + Polygon = 'polygon', + Base = 'base', + Stellar = 'stellar', + Solana = 'solana', + All = 'all', +} + +export interface WraithConfig { + apiKey: string; + baseUrl?: string; + ai?: { + provider: 'gemini' | 'openai' | 'claude'; + apiKey: string; + }; +} + +export interface AgentConfig { + name: string; + chain: Chain | Chain[]; + wallet: string; + signature: string; + message?: string; +} + +export interface AgentInfo { + id: string; + name: string; + chains: Chain[]; + addresses: Record; + metaAddresses: Record; +} + +export interface ChatResponse { + response: string; + toolCalls?: ToolCall[]; + conversationId: string; +} + +export interface ToolCall { + name: string; + status: string; + detail?: string; +} + +export interface Balance { + native: string; + tokens: Record; +} + +export interface Payment { + stealthAddress: string; + balance: string; + ephemeralPubKey: string; +} + +export interface Invoice { + id: string; + agentName: string; + amount: string; + asset: string; + memo: string; + status: 'pending' | 'paid'; + txHash: string | null; + paymentLink: string; + createdAt: string; +} + +export interface Schedule { + id: string; + recipient: string; + amount: string; + asset: string; + interval: 'daily' | 'weekly' | 'monthly'; + status: 'active' | 'paused' | 'cancelled'; + nextRun: string; +} + +export interface TxResult { + txHash: string; + txLink: string; +} + +export interface PrivacyReport { + score: number; + issues: Array<{ + severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; + issue: string; + recommendation: string; + }>; + bestPractices: string[]; +} + +export interface Notification { + id: number; + type: string; + title: string; + body: string; + read: boolean; + createdAt: string; +} + +export interface Conversation { + id: string; + title: string; + createdAt: string; + updatedAt: string; +} diff --git a/test/agent/client.test.ts b/packages/sdk-agent/test/client.test.ts similarity index 98% rename from test/agent/client.test.ts rename to packages/sdk-agent/test/client.test.ts index 8d6e01e..4d41085 100644 --- a/test/agent/client.test.ts +++ b/packages/sdk-agent/test/client.test.ts @@ -1,8 +1,8 @@ import { describe, test, expect, beforeAll, afterAll } from 'vitest'; import { createServer, type Server, type IncomingMessage, type ServerResponse } from 'http'; -import { Wraith, WraithAgent } from '../../src/agent/client'; -import { Chain } from '../../src/agent/types'; -import type { AgentInfo } from '../../src/agent/types'; +import { Wraith, WraithAgent } from '../src/client'; +import { Chain } from '../src/types'; +import type { AgentInfo } from '../src/types'; const TEST_API_KEY = 'wraith_test_key123'; const AGENT_ID = 'agent-001'; diff --git a/test/agent/tools.test.ts b/packages/sdk-agent/test/tools.test.ts similarity index 92% rename from test/agent/tools.test.ts rename to packages/sdk-agent/test/tools.test.ts index 9852f19..02049a3 100644 --- a/test/agent/tools.test.ts +++ b/packages/sdk-agent/test/tools.test.ts @@ -1,7 +1,6 @@ import { describe, expect, test } from 'vitest'; -import { createClaudeAgentTools } from '../../src/agent/tools'; -import { deriveStealthKeys } from '../../src/chains/stellar/keys'; -import { encodeStealthMetaAddress } from '../../src/chains/stellar/meta-address'; +import { createClaudeAgentTools } from '../src/tools'; +import { deriveStealthKeys, encodeStealthMetaAddress } from '@wraith-protocol/sdk/chains/stellar'; describe('Claude agent tools', () => { test('send-to-meta-address builds a signing plan without signing', async () => { diff --git a/packages/sdk-agent/tsconfig.json b/packages/sdk-agent/tsconfig.json new file mode 100644 index 0000000..49e05ce --- /dev/null +++ b/packages/sdk-agent/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src"] +} diff --git a/packages/sdk-agent/tsup.config.ts b/packages/sdk-agent/tsup.config.ts new file mode 100644 index 0000000..c09a468 --- /dev/null +++ b/packages/sdk-agent/tsup.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: { + index: 'src/index.ts', + }, + format: ['esm', 'cjs'], + dts: true, + splitting: true, + clean: true, + treeshake: true, + external: ['@wraith-protocol/sdk'], +}); diff --git a/packages/sdk-agent/vitest.config.ts b/packages/sdk-agent/vitest.config.ts new file mode 100644 index 0000000..4ac6027 --- /dev/null +++ b/packages/sdk-agent/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'node', + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d41f3d..2ee689d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -76,6 +76,22 @@ importers: specifier: ^3.1.0 version: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + examples/agent: + dependencies: + '@wraith-protocol/sdk': + specifier: file:../.. + version: file:(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@stellar/stellar-sdk@13.3.0)(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@3.25.76) + '@wraith-protocol/sdk-agent': + specifier: workspace:* + version: link:../../packages/sdk-agent + devDependencies: + tsx: + specifier: ^4.0.0 + version: 4.23.0 + typescript: + specifier: ^5.7.0 + version: 5.9.3 + examples/multichain-scan: dependencies: '@wraith-protocol/sdk': @@ -146,13 +162,13 @@ importers: version: 18.3.7(@types/react@18.3.31) '@vitejs/plugin-react': specifier: ^4.3.1 - version: 4.7.0(vite@5.4.21(@types/node@25.6.0)(terser@5.48.0)) + version: 4.7.0(vite@5.4.21(@types/node@20.19.43)(terser@5.48.0)) typescript: specifier: ^5.5.3 version: 5.9.3 vite: specifier: ^5.4.1 - version: 5.4.21(@types/node@25.6.0)(terser@5.48.0) + version: 5.4.21(@types/node@20.19.43)(terser@5.48.0) examples/stellar-chrome-extension: dependencies: @@ -165,7 +181,7 @@ importers: devDependencies: '@crxjs/vite-plugin': specifier: ^2.0.0-beta.26 - version: 2.7.1(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + version: 2.7.1(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) '@types/chrome': specifier: ^0.0.287 version: 0.0.287 @@ -174,7 +190,7 @@ importers: version: 5.9.3 vite: specifier: ^6.1.0 - version: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) examples/stellar-cli-scan: dependencies: @@ -280,7 +296,7 @@ importers: version: 0.76.9(@babel/core@7.29.7)(@babel/preset-env@7.29.7(@babel/core@7.29.7)) '@react-native/metro-config': specifier: ^0.76.0 - version: 0.76.9(@babel/core@7.29.7)(@babel/preset-env@7.29.7(@babel/core@7.29.7))(bufferutil@4.1.0)(utf-8-validate@6.0.6) + version: 0.76.9(@babel/core@7.29.7)(@babel/preset-env@7.29.7(@babel/core@7.29.7)) '@react-native/typescript-config': specifier: ^0.76.0 version: 0.76.9 @@ -317,19 +333,22 @@ importers: version: 19.2.3(@types/react@19.2.17) '@vitejs/plugin-react': specifier: ^4.4.0 - version: 4.7.0(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + version: 4.7.0(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) typescript: specifier: ^5.7.0 version: 5.9.3 vite: specifier: ^6.1.0 - version: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) examples/stellar-spectre-agent: dependencies: '@wraith-protocol/sdk': specifier: file:../.. version: file:(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@stellar/stellar-sdk@13.3.0)(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@3.25.76) + '@wraith-protocol/sdk-agent': + specifier: workspace:* + version: link:../../packages/sdk-agent devDependencies: tsx: specifier: ^4.0.0 @@ -352,13 +371,13 @@ importers: devDependencies: '@sveltejs/vite-plugin-svelte': specifier: ^5.0.0 - version: 5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + version: 5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) typescript: specifier: ^5.7.0 version: 5.9.3 vite: specifier: ^6.0.0 - version: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) examples/stellar-vue-receive: dependencies: @@ -374,13 +393,13 @@ importers: devDependencies: '@vitejs/plugin-vue': specifier: ^5.0.0 - version: 5.2.4(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vue@3.5.39(typescript@5.9.3)) + version: 5.2.4(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vue@3.5.39(typescript@5.9.3)) typescript: specifier: ^5.7.0 version: 5.9.3 vite: specifier: ^6.0.0 - version: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) vue-tsc: specifier: ^2.0.0 version: 2.2.12(typescript@5.9.3) @@ -399,13 +418,13 @@ importers: devDependencies: '@sveltejs/vite-plugin-svelte': specifier: ^5.0.0 - version: 5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + version: 5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) typescript: specifier: ^5.7.0 version: 5.9.3 vite: specifier: ^6.0.0 - version: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) examples/vue-stellar-app: dependencies: @@ -421,17 +440,33 @@ importers: devDependencies: '@vitejs/plugin-vue': specifier: ^5.0.0 - version: 5.2.4(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vue@3.5.39(typescript@5.9.3)) + version: 5.2.4(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vue@3.5.39(typescript@5.9.3)) typescript: specifier: ^5.7.0 version: 5.9.3 vite: specifier: ^6.0.0 - version: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) vue-tsc: specifier: ^2.0.0 version: 2.2.12(typescript@5.9.3) + packages/sdk-agent: + dependencies: + '@wraith-protocol/sdk': + specifier: workspace:* + version: link:../.. + devDependencies: + tsup: + specifier: ^8.0.0 + version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@20.19.43))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) + typescript: + specifier: ^5.0.0 + version: 5.9.3 + vitest: + specifier: ^3.0.0 + version: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + packages/sdk-react: dependencies: '@stellar/stellar-sdk': @@ -464,13 +499,13 @@ importers: version: 24.1.3(bufferutil@4.1.0)(utf-8-validate@6.0.6) tsup: specifier: ^8.0.0 - version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@25.6.0))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) + version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@20.19.43))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) typescript: specifier: ^5.0.0 version: 5.9.3 vitest: specifier: ^3.0.0 - version: 3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@24.1.3(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@24.1.3(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) packages/sdk-svelte: dependencies: @@ -483,10 +518,10 @@ importers: version: 13.3.0 '@sveltejs/vite-plugin-svelte': specifier: ^5.0.0 - version: 5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + version: 5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) '@testing-library/svelte': specifier: ^5.2.0 - version: 5.4.2(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vitest@3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + version: 5.4.2(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vitest@3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) jsdom: specifier: ^25.0.0 version: 25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) @@ -498,13 +533,13 @@ importers: version: 4.7.2(picomatch@4.0.4)(svelte@5.56.4)(typescript@5.9.3) tsup: specifier: ^8.4.0 - version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@25.6.0))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) + version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@20.19.43))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) typescript: specifier: ^5.7.0 version: 5.9.3 vitest: specifier: ^3.1.0 - version: 3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) packages/sdk-vue: dependencies: @@ -523,13 +558,13 @@ importers: version: 25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) tsup: specifier: ^8.4.0 - version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@25.6.0))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) + version: 8.5.1(@microsoft/api-extractor@7.58.12(@types/node@20.19.43))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0) typescript: specifier: ^5.7.0 version: 5.9.3 vitest: specifier: ^3.1.0 - version: 3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + version: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) packages/test-vectors: devDependencies: @@ -2042,7 +2077,7 @@ packages: '@expo/bunyan@4.0.1': resolution: {integrity: sha512-+Lla7nYSiHZirgK+U/uYzsLv/X+HaJienbD5AKX1UQZHYfWaP+9uuQluRB4GrEVWF0GZ7vEVp/jzaOT9k/SQlg==} - engines: {'0': node >=0.10.0} + engines: {node: '>=0.10.0'} '@expo/cli@0.18.31': resolution: {integrity: sha512-v9llw9fT3Uv+TCM6Xllo54t672CuYtinEQZ2LPJ2EJsCwuTc4Cd2gXQaouuIVD21VoeGQnr5JtJuWbF97sBKzQ==} @@ -2886,9 +2921,6 @@ packages: '@types/node@20.19.43': resolution: {integrity: sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==} - '@types/node@25.6.0': - resolution: {integrity: sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==} - '@types/prop-types@15.7.15': resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==} @@ -3093,6 +3125,7 @@ packages: '@xmldom/xmldom@0.9.10': resolution: {integrity: sha512-A9gOqLdi6cV4ibazAjcQufGj0B1y/vDqYrcuP6d/6x8P27gRS8643Dj9o1dEKtB6O7fwxb2FgBmJS2mX7gpvdw==} engines: {node: '>=14.6'} + deprecated: this version has critical issues, please update to the latest version JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} @@ -7034,9 +7067,6 @@ packages: undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} - undici-types@7.19.2: - resolution: {integrity: sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==} - unicode-canonical-property-names-ecmascript@2.0.1: resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} engines: {node: '>=4'} @@ -8648,7 +8678,7 @@ snapshots: '@types/conventional-commits-parser': 5.0.2 chalk: 5.6.2 - '@crxjs/vite-plugin@2.7.1(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@crxjs/vite-plugin@2.7.1(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: '@webcomponents/custom-elements': 1.6.0 acorn-walk: 8.3.5 @@ -8664,7 +8694,7 @@ snapshots: rollup: 2.80.0 rxjs: 7.5.7 tinyglobby: 0.2.17 - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) transitivePeerDependencies: - supports-color @@ -9411,15 +9441,6 @@ snapshots: transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor-model@7.33.10(@types/node@25.6.0)': - dependencies: - '@microsoft/tsdoc': 0.16.0 - '@microsoft/tsdoc-config': 0.18.1 - '@rushstack/node-core-library': 5.23.3(@types/node@25.6.0) - transitivePeerDependencies: - - '@types/node' - optional: true - '@microsoft/api-extractor@7.58.12(@types/node@20.19.43)': dependencies: '@microsoft/api-extractor-model': 7.33.10(@types/node@20.19.43) @@ -9438,25 +9459,6 @@ snapshots: transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.58.12(@types/node@25.6.0)': - dependencies: - '@microsoft/api-extractor-model': 7.33.10(@types/node@25.6.0) - '@microsoft/tsdoc': 0.16.0 - '@microsoft/tsdoc-config': 0.18.1 - '@rushstack/node-core-library': 5.23.3(@types/node@25.6.0) - '@rushstack/rig-package': 0.7.3 - '@rushstack/terminal': 0.24.2(@types/node@25.6.0) - '@rushstack/ts-command-line': 5.3.12(@types/node@25.6.0) - diff: 8.0.4 - minimatch: 10.2.3 - resolve: 1.22.12 - semver: 7.7.4 - source-map: 0.6.1 - typescript: 5.9.3 - transitivePeerDependencies: - - '@types/node' - optional: true - '@microsoft/tsdoc-config@0.18.1': dependencies: '@microsoft/tsdoc': 0.16.0 @@ -9937,7 +9939,7 @@ snapshots: - '@babel/preset-env' - supports-color - '@react-native/metro-config@0.76.9(@babel/core@7.29.7)(@babel/preset-env@7.29.7(@babel/core@7.29.7))(bufferutil@4.1.0)(utf-8-validate@6.0.6)': + '@react-native/metro-config@0.76.9(@babel/core@7.29.7)(@babel/preset-env@7.29.7(@babel/core@7.29.7))': dependencies: '@react-native/js-polyfills': 0.76.9 '@react-native/metro-babel-transformer': 0.76.9(@babel/core@7.29.7)(@babel/preset-env@7.29.7(@babel/core@7.29.7)) @@ -9946,9 +9948,7 @@ snapshots: transitivePeerDependencies: - '@babel/core' - '@babel/preset-env' - - bufferutil - supports-color - - utf-8-validate '@react-native/normalize-colors@0.72.0': {} @@ -10074,29 +10074,10 @@ snapshots: optionalDependencies: '@types/node': 20.19.43 - '@rushstack/node-core-library@5.23.3(@types/node@25.6.0)': - dependencies: - ajv: 8.20.0 - ajv-draft-04: 1.0.0(ajv@8.20.0) - ajv-formats: 3.0.1(ajv@8.20.0) - fs-extra: 11.3.6 - import-lazy: 4.0.0 - jju: 1.4.0 - resolve: 1.22.12 - semver: 7.7.4 - optionalDependencies: - '@types/node': 25.6.0 - optional: true - '@rushstack/problem-matcher@0.2.1(@types/node@20.19.43)': optionalDependencies: '@types/node': 20.19.43 - '@rushstack/problem-matcher@0.2.1(@types/node@25.6.0)': - optionalDependencies: - '@types/node': 25.6.0 - optional: true - '@rushstack/rig-package@0.7.3': dependencies: jju: 1.4.0 @@ -10110,15 +10091,6 @@ snapshots: optionalDependencies: '@types/node': 20.19.43 - '@rushstack/terminal@0.24.2(@types/node@25.6.0)': - dependencies: - '@rushstack/node-core-library': 5.23.3(@types/node@25.6.0) - '@rushstack/problem-matcher': 0.2.1(@types/node@25.6.0) - supports-color: 8.1.1 - optionalDependencies: - '@types/node': 25.6.0 - optional: true - '@rushstack/ts-command-line@5.3.12(@types/node@20.19.43)': dependencies: '@rushstack/terminal': 0.24.2(@types/node@20.19.43) @@ -10128,16 +10100,6 @@ snapshots: transitivePeerDependencies: - '@types/node' - '@rushstack/ts-command-line@5.3.12(@types/node@25.6.0)': - dependencies: - '@rushstack/terminal': 0.24.2(@types/node@25.6.0) - '@types/argparse': 1.0.38 - argparse: 1.0.10 - string-argv: 0.3.2 - transitivePeerDependencies: - - '@types/node' - optional: true - '@scure/base@1.2.6': {} '@scure/bip32@1.7.0': @@ -10279,47 +10241,47 @@ snapshots: '@sveltejs/load-config@0.2.0': {} - '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: - '@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + '@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) debug: 4.4.3 svelte: 5.56.4 - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: - '@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + '@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) debug: 4.4.3 svelte: 5.56.4 - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) debug: 4.4.3 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.21 svelte: 5.56.4 - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vitefu: 1.1.3(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + vite: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vitefu: 1.1.3(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)))(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) debug: 4.4.3 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.21 svelte: 5.56.4 - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vitefu: 1.1.3(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + vite: 7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vitefu: 1.1.3(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) transitivePeerDependencies: - supports-color @@ -10368,14 +10330,14 @@ snapshots: dependencies: svelte: 5.56.4 - '@testing-library/svelte@5.4.2(svelte@5.56.4)(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vitest@3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@testing-library/svelte@5.4.2(svelte@5.56.4)(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vitest@3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: '@testing-library/dom': 9.3.4 '@testing-library/svelte-core': 1.1.3(svelte@5.56.4) svelte: 5.56.4 optionalDependencies: - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vitest: 3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vitest: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) '@types/argparse@1.0.38': {} @@ -10469,11 +10431,6 @@ snapshots: dependencies: undici-types: 6.21.0 - '@types/node@25.6.0': - dependencies: - undici-types: 7.19.2 - optional: true - '@types/prop-types@15.7.15': {} '@types/react-dom@18.3.7(@types/react@18.3.31)': @@ -10539,7 +10496,7 @@ snapshots: graphql: 15.8.0 wonka: 4.0.15 - '@vitejs/plugin-react@4.7.0(vite@5.4.21(@types/node@25.6.0)(terser@5.48.0))': + '@vitejs/plugin-react@4.7.0(vite@5.4.21(@types/node@20.19.43)(terser@5.48.0))': dependencies: '@babel/core': 7.29.7 '@babel/plugin-transform-react-jsx-self': 7.29.7(@babel/core@7.29.7) @@ -10547,11 +10504,11 @@ snapshots: '@rolldown/pluginutils': 1.0.0-beta.27 '@types/babel__core': 7.20.5 react-refresh: 0.17.0 - vite: 5.4.21(@types/node@25.6.0)(terser@5.48.0) + vite: 5.4.21(@types/node@20.19.43)(terser@5.48.0) transitivePeerDependencies: - supports-color - '@vitejs/plugin-react@4.7.0(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': + '@vitejs/plugin-react@4.7.0(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': dependencies: '@babel/core': 7.29.7 '@babel/plugin-transform-react-jsx-self': 7.29.7(@babel/core@7.29.7) @@ -10559,13 +10516,13 @@ snapshots: '@rolldown/pluginutils': 1.0.0-beta.27 '@types/babel__core': 7.20.5 react-refresh: 0.17.0 - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.2.4(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vue@3.5.39(typescript@5.9.3))': + '@vitejs/plugin-vue@5.2.4(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))(vue@3.5.39(typescript@5.9.3))': dependencies: - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) vue: 3.5.39(typescript@5.9.3) '@vitest/expect@3.2.4': @@ -10584,14 +10541,6 @@ snapshots: optionalDependencies: vite: 7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - '@vitest/mocker@3.2.4(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0))': - dependencies: - '@vitest/spy': 3.2.4 - estree-walker: 3.0.3 - magic-string: 0.30.21 - optionalDependencies: - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - '@vitest/pretty-format@3.2.4': dependencies: tinyrainbow: 2.0.0 @@ -15454,35 +15403,6 @@ snapshots: - tsx - yaml - tsup@8.5.1(@microsoft/api-extractor@7.58.12(@types/node@25.6.0))(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(typescript@5.9.3)(yaml@2.9.0): - dependencies: - bundle-require: 5.1.0(esbuild@0.27.7) - cac: 6.7.14 - chokidar: 4.0.3 - consola: 3.4.2 - debug: 4.4.3 - esbuild: 0.27.7 - fix-dts-default-cjs-exports: 1.0.1 - joycon: 3.1.1 - picocolors: 1.1.1 - postcss-load-config: 6.0.1(jiti@2.6.1)(postcss@8.5.16)(tsx@4.23.0)(yaml@2.9.0) - resolve-from: 5.0.0 - rollup: 4.60.1 - source-map: 0.7.6 - sucrase: 3.35.1 - tinyexec: 0.3.2 - tinyglobby: 0.2.16 - tree-kill: 1.2.2 - optionalDependencies: - '@microsoft/api-extractor': 7.58.12(@types/node@25.6.0) - postcss: 8.5.16 - typescript: 5.9.3 - transitivePeerDependencies: - - jiti - - supports-color - - tsx - - yaml - tsx@4.23.0: dependencies: esbuild: 0.28.1 @@ -15578,9 +15498,6 @@ snapshots: undici-types@6.21.0: {} - undici-types@7.19.2: - optional: true - unicode-canonical-property-names-ecmascript@2.0.1: {} unicode-match-property-ecmascript@2.0.0: @@ -15702,34 +15619,13 @@ snapshots: - tsx - yaml - vite-node@3.2.4(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): - dependencies: - cac: 6.7.14 - debug: 4.4.3 - es-module-lexer: 1.7.0 - pathe: 2.0.3 - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - transitivePeerDependencies: - - '@types/node' - - jiti - - less - - lightningcss - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - tsx - - yaml - - vite@5.4.21(@types/node@25.6.0)(terser@5.48.0): + vite@5.4.21(@types/node@20.19.43)(terser@5.48.0): dependencies: esbuild: 0.21.5 postcss: 8.5.9 rollup: 4.60.1 optionalDependencies: - '@types/node': 25.6.0 + '@types/node': 20.19.43 fsevents: 2.3.3 terser: 5.48.0 @@ -15749,22 +15645,6 @@ snapshots: tsx: 4.23.0 yaml: 2.9.0 - vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): - dependencies: - esbuild: 0.25.12 - fdir: 6.5.0(picomatch@4.0.4) - picomatch: 4.0.4 - postcss: 8.5.9 - rollup: 4.60.1 - tinyglobby: 0.2.16 - optionalDependencies: - '@types/node': 25.6.0 - fsevents: 2.3.3 - jiti: 2.6.1 - terser: 5.48.0 - tsx: 4.23.0 - yaml: 2.9.0 - vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): dependencies: esbuild: 0.27.7 @@ -15781,31 +15661,15 @@ snapshots: tsx: 4.23.0 yaml: 2.9.0 - vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): - dependencies: - esbuild: 0.27.7 - fdir: 6.5.0(picomatch@4.0.4) - picomatch: 4.0.4 - postcss: 8.5.9 - rollup: 4.60.1 - tinyglobby: 0.2.16 + vitefu@1.1.3(vite@6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)): optionalDependencies: - '@types/node': 25.6.0 - fsevents: 2.3.3 - jiti: 2.6.1 - terser: 5.48.0 - tsx: 4.23.0 - yaml: 2.9.0 - - vitefu@1.1.3(vite@6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)): - optionalDependencies: - vite: 6.4.3(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 6.4.3(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vitefu@1.1.3(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)): + vitefu@1.1.3(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)): optionalDependencies: - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vitest@3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): + vitest@3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@24.1.3(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): dependencies: '@types/chai': 5.2.3 '@vitest/expect': 3.2.4 @@ -15832,48 +15696,6 @@ snapshots: why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 20.19.43 - jsdom: 25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) - transitivePeerDependencies: - - jiti - - less - - lightningcss - - msw - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - tsx - - yaml - - vitest@3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@24.1.3(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): - dependencies: - '@types/chai': 5.2.3 - '@vitest/expect': 3.2.4 - '@vitest/mocker': 3.2.4(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) - '@vitest/pretty-format': 3.2.4 - '@vitest/runner': 3.2.4 - '@vitest/snapshot': 3.2.4 - '@vitest/spy': 3.2.4 - '@vitest/utils': 3.2.4 - chai: 5.3.3 - debug: 4.4.3 - expect-type: 1.3.0 - magic-string: 0.30.21 - pathe: 2.0.3 - picomatch: 4.0.4 - std-env: 3.10.0 - tinybench: 2.9.0 - tinyexec: 0.3.2 - tinyglobby: 0.2.16 - tinypool: 1.1.1 - tinyrainbow: 2.0.0 - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vite-node: 3.2.4(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - why-is-node-running: 2.3.0 - optionalDependencies: - '@types/node': 25.6.0 jsdom: 24.1.3(bufferutil@4.1.0)(utf-8-validate@6.0.6) transitivePeerDependencies: - jiti @@ -15889,11 +15711,11 @@ snapshots: - tsx - yaml - vitest@3.2.4(@types/node@25.6.0)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): + vitest@3.2.4(@types/node@20.19.43)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6))(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0): dependencies: '@types/chai': 5.2.3 '@vitest/expect': 3.2.4 - '@vitest/mocker': 3.2.4(vite@7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) + '@vitest/mocker': 3.2.4(vite@7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0)) '@vitest/pretty-format': 3.2.4 '@vitest/runner': 3.2.4 '@vitest/snapshot': 3.2.4 @@ -15911,11 +15733,11 @@ snapshots: tinyglobby: 0.2.16 tinypool: 1.1.1 tinyrainbow: 2.0.0 - vite: 7.3.2(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) - vite-node: 3.2.4(@types/node@25.6.0)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite: 7.3.2(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) + vite-node: 3.2.4(@types/node@20.19.43)(jiti@2.6.1)(terser@5.48.0)(tsx@4.23.0)(yaml@2.9.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 25.6.0 + '@types/node': 20.19.43 jsdom: 25.0.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) transitivePeerDependencies: - jiti diff --git a/src/agent/client-local.ts b/src/agent/client-local.ts new file mode 100644 index 0000000..423389f --- /dev/null +++ b/src/agent/client-local.ts @@ -0,0 +1,2 @@ +export class Wraith {} +export class WraithAgent {} diff --git a/src/agent/client.ts b/src/agent/client.ts index 1395448..48fc1dd 100644 --- a/src/agent/client.ts +++ b/src/agent/client.ts @@ -1,177 +1,4 @@ -import { RPCRequestError } from '../errors'; -import type { - WraithConfig, - AgentConfig, - AgentInfo, - ChatResponse, - Balance, - Payment, - Notification, - Conversation, -} from './types'; -import { Chain } from './types'; - -const DEFAULT_BASE_URL = 'https://api.wraith.dev'; - -export class Wraith { - private readonly apiKey: string; - private readonly baseUrl: string; - private readonly aiConfig?: { provider: string; apiKey: string }; - - constructor(config: WraithConfig) { - this.apiKey = config.apiKey; - this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, ''); - this.aiConfig = config.ai; - } - - private async request(method: string, path: string, body?: unknown): Promise { - const url = `${this.baseUrl}${path}`; - const res = await fetch(url, { - method, - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.apiKey}`, - ...(this.aiConfig - ? { 'X-AI-Provider': this.aiConfig.provider, 'X-AI-Key': this.aiConfig.apiKey } - : {}), - }, - body: body ? JSON.stringify(body) : undefined, - }); - - if (!res.ok) { - const error = await res.json().catch(() => ({ message: res.statusText })); - throw new RPCRequestError(url, res.status, error.message || res.statusText); - } - - return res.json(); - } - - /** - * Creates a new stealth address AI agent. - * - * @param config Configuration for the agent name, chains, signature, and wallet. - * @returns A WraithAgent instance to control the new agent. - * @throws {RPCRequestError} If the server returns a non-2xx status code. - */ - async createAgent(config: AgentConfig): Promise { - const info = await this.request('POST', '/agent/create', config); - return new WraithAgent(this, info); - } - - agent(agentId: string): WraithAgent { - return new WraithAgent(this, { - id: agentId, - name: '', - chains: [], - addresses: {} as Record, - metaAddresses: {} as Record, - }); - } - - /** - * Retrieves a WraithAgent instance by their associated wallet address. - * - * @param walletAddress The base wallet address of the agent owner. - * @returns A WraithAgent instance. - * @throws {RPCRequestError} If the server returns a non-2xx status code. - */ - async getAgentByWallet(walletAddress: string): Promise { - const info = await this.request('GET', `/agent/wallet/${walletAddress}`); - return new WraithAgent(this, info); - } - - /** - * Retrieves a WraithAgent instance by their registered name (e.g. alice.wraith). - * - * @param name The agent name. - * @returns A WraithAgent instance. - * @throws {RPCRequestError} If the server returns a non-2xx status code. - */ - async getAgentByName(name: string): Promise { - const info = await this.request('GET', `/agent/info/${name}`); - return new WraithAgent(this, info); - } - - /** - * Lists all stealth address AI agents associated with the user's API key. - * - * @returns List of AgentInfo objects. - * @throws {RPCRequestError} If the server returns a non-2xx status code. - */ - async listAgents(): Promise { - return this.request('GET', '/agents'); - } - - /** @internal Exposed for WraithAgent to use. */ - _request(method: string, path: string, body?: unknown): Promise { - return this.request(method, path, body); - } -} - -export class WraithAgent { - readonly info: AgentInfo; - private readonly wraith: Wraith; - - constructor(wraith: Wraith, info: AgentInfo) { - this.wraith = wraith; - this.info = info; - } - - private req(method: string, path: string, body?: unknown): Promise { - return this.wraith._request(method, `/agent/${this.info.id}${path}`, body); - } - - async chat(message: string, conversationId?: string): Promise { - return this.req('POST', '/chat', { message, conversationId }); - } - - async getStatus(): Promise { - return this.req('GET', '/status'); - } - - async getBalance(): Promise { - const status = await this.getStatus(); - return { native: status.balance || '0', tokens: status.tokens || {} }; - } - - async scanPayments(): Promise { - const res = await this.chat('Scan for incoming stealth payments'); - return (res.toolCalls || []) - .filter((tc) => tc.name === 'scan_payments') - .flatMap((tc) => { - try { - return JSON.parse(tc.detail || '[]'); - } catch { - return []; - } - }); - } - - async exportKey(signature: string, message: string): Promise<{ secret: string }> { - return this.req<{ secret: string }>('POST', '/export', { signature, message }); - } - - async getConversations(): Promise { - return this.req('GET', '/conversations'); - } - - async getMessages(conversationId: string): Promise> { - return this.req('GET', `/conversations/${conversationId}/messages`); - } - - async deleteConversation(conversationId: string): Promise { - await this.req('DELETE', `/conversations/${conversationId}`); - } - - async getNotifications(): Promise<{ notifications: Notification[]; unreadCount: number }> { - return this.req('GET', '/notifications'); - } - - async markNotificationsRead(): Promise { - await this.req('POST', '/notifications/read', {}); - } - - async clearNotifications(): Promise { - await this.req('DELETE', '/notifications'); - } -} +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ +export { Wraith, WraithAgent } from './client-local'; diff --git a/src/agent/index.ts b/src/agent/index.ts index 4b04ce2..ece5fd9 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -1,5 +1,14 @@ +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ export { Wraith, WraithAgent } from './client'; +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ export { Chain } from './types'; +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ export type { WraithConfig, AgentConfig, diff --git a/src/agent/tools-local.ts b/src/agent/tools-local.ts new file mode 100644 index 0000000..cd109f6 --- /dev/null +++ b/src/agent/tools-local.ts @@ -0,0 +1,55 @@ +export function createClaudeAgentTools(context?: ClaudeAgentToolContext): ClaudeAgentTools { + return {} as any; +} + +export interface ClaudeAgentToolContext { + apiKey?: string; + baseUrl?: string; +} + +export interface SendToMetaAddressInput { + metaAddress: string; + amount: string; + asset?: string; + memo?: string; + destination?: string; +} + +export interface ScanInput { + announcements: any[]; + viewingKeyHex: string; + spendingPubKeyHex: string; + spendingScalarHex: string; +} + +export interface WithdrawInput { + stealthAddress: string; + amount: string; + asset?: string; + destination?: string; + memo?: string; +} + +export interface ResolveNameInput { + name: string; + chain?: string; +} + +export interface ToolResult { + kind: 'send' | 'scan' | 'withdraw' | 'resolve-name'; + signingRequired: boolean; + tx?: Record; + metaAddress?: string; + matches?: Array>; + count?: number; + name?: string; + chain?: string; + note?: string; +} + +export interface ClaudeAgentTools { + sendToMetaAddress(input: SendToMetaAddressInput): Promise; + scan(input: ScanInput): Promise; + withdraw(input: WithdrawInput): Promise; + resolveName(input: ResolveNameInput): Promise; +} diff --git a/src/agent/tools.ts b/src/agent/tools.ts index 6333418..b4dc8de 100644 --- a/src/agent/tools.ts +++ b/src/agent/tools.ts @@ -1,149 +1,13 @@ -import { deriveStealthKeys } from '../chains/stellar/keys'; -import { decodeStealthMetaAddress, encodeStealthMetaAddress } from '../chains/stellar/meta-address'; -import { generateStealthAddress } from '../chains/stellar/stealth'; -import { scanAnnouncements } from '../chains/stellar/scan'; -import { hexToBytes, bytesToHex } from '../chains/stellar/utils'; -import type { Announcement } from '../chains/stellar/types'; - -export interface ClaudeAgentToolContext { - apiKey?: string; - baseUrl?: string; -} - -export interface SendToMetaAddressInput { - metaAddress: string; - amount: string; - asset?: string; - memo?: string; - destination?: string; -} - -export interface ScanInput { - announcements: Announcement[]; - viewingKeyHex: string; - spendingPubKeyHex: string; - spendingScalarHex: string; -} - -export interface WithdrawInput { - stealthAddress: string; - amount: string; - asset?: string; - destination?: string; - memo?: string; -} - -export interface ResolveNameInput { - name: string; - chain?: string; -} - -export interface ToolResult { - kind: 'send' | 'scan' | 'withdraw' | 'resolve-name'; - signingRequired: boolean; - tx?: Record; - metaAddress?: string; - matches?: Array>; - count?: number; - name?: string; - chain?: string; - note?: string; -} - -export interface ClaudeAgentTools { - sendToMetaAddress(input: SendToMetaAddressInput): Promise; - scan(input: ScanInput): Promise; - withdraw(input: WithdrawInput): Promise; - resolveName(input: ResolveNameInput): Promise; -} - -function parseHexBytes(hex: string): Uint8Array { - const clean = hex.startsWith('0x') ? hex.slice(2) : hex; - return hexToBytes(clean); -} - -function parseBigInt(value: string | undefined): bigint { - if (!value) return 0n; - const clean = value.startsWith('0x') || value.startsWith('0X') ? value : value; - if (/^0x/i.test(clean)) return BigInt(clean); - if (/^[0-9]+$/u.test(clean)) return BigInt(clean); - return BigInt(`0x${clean}`); -} - -export function createClaudeAgentTools(_context: ClaudeAgentToolContext = {}): ClaudeAgentTools { - return { - async sendToMetaAddress(input) { - const { spendingPubKey, viewingPubKey } = decodeStealthMetaAddress(input.metaAddress); - const stealthResult = generateStealthAddress(spendingPubKey, viewingPubKey); - return { - kind: 'send', - signingRequired: true, - metaAddress: input.metaAddress, - tx: { - intent: 'send-to-meta-address', - asset: input.asset ?? 'XLM', - amount: input.amount, - memo: input.memo ?? '', - stealthAddress: stealthResult.stealthAddress, - ephemeralPubKey: bytesToHex(stealthResult.ephemeralPubKey), - metadata: stealthResult.viewTag.toString(16).padStart(2, '0'), - destination: input.destination ?? stealthResult.stealthAddress, - }, - note: 'The agent prepares a stealth send plan. The sender must sign the transaction locally with their wallet.', - }; - }, - - async scan(input) { - const viewingKey = parseHexBytes(input.viewingKeyHex); - const spendingPubKey = parseHexBytes(input.spendingPubKeyHex); - const spendingScalar = parseBigInt(input.spendingScalarHex); - const matches = scanAnnouncements( - input.announcements, - viewingKey, - spendingPubKey, - spendingScalar, - ); - return { - kind: 'scan', - signingRequired: false, - matches: matches.map((item) => ({ - stealthAddress: item.stealthAddress, - ephemeralPubKey: item.ephemeralPubKey, - metadata: item.metadata, - stealthPrivateScalar: item.stealthPrivateScalar.toString(), - })), - count: matches.length, - }; - }, - - async withdraw(input) { - return { - kind: 'withdraw', - signingRequired: true, - tx: { - intent: 'withdraw', - stealthAddress: input.stealthAddress, - asset: input.asset ?? 'XLM', - amount: input.amount, - destination: input.destination ?? input.stealthAddress, - memo: input.memo ?? '', - }, - note: 'The agent prepares a withdrawal plan. The stealth account owner must sign the transaction with their local wallet or key manager.', - }; - }, - - async resolveName(input) { - return { - kind: 'resolve-name', - signingRequired: false, - name: input.name, - chain: input.chain ?? 'stellar', - tx: { - intent: 'resolve-name', - name: input.name, - chain: input.chain ?? 'stellar', - }, - }; - }, - }; -} +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ +export { + createClaudeAgentTools, + type ClaudeAgentToolContext, + type SendToMetaAddressInput, + type ScanInput, + type WithdrawInput, + type ResolveNameInput, + type ToolResult, + type ClaudeAgentTools, +} from './tools-local'; diff --git a/src/agent/types-local.ts b/src/agent/types-local.ts new file mode 100644 index 0000000..1036b7a --- /dev/null +++ b/src/agent/types-local.ts @@ -0,0 +1,110 @@ +export enum Chain { + Horizen = 'horizen', + Ethereum = 'ethereum', + Polygon = 'polygon', + Base = 'base', + Stellar = 'stellar', + Solana = 'solana', + All = 'all', +} + +export interface WraithConfig { + apiKey: string; + baseUrl?: string; + ai?: { + provider: 'gemini' | 'openai' | 'claude'; + apiKey: string; + }; +} + +export interface AgentConfig { + name: string; + chain: Chain | Chain[]; + wallet: string; + signature: string; + message?: string; +} + +export interface AgentInfo { + id: string; + name: string; + chains: Chain[]; + addresses: Record; + metaAddresses: Record; +} + +export interface ChatResponse { + response: string; + toolCalls?: ToolCall[]; + conversationId: string; +} + +export interface ToolCall { + name: string; + status: string; + detail?: string; +} + +export interface Balance { + native: string; + tokens: Record; +} + +export interface Payment { + stealthAddress: string; + balance: string; + ephemeralPubKey: string; +} + +export interface Invoice { + id: string; + agentName: string; + amount: string; + asset: string; + memo: string; + status: 'pending' | 'paid'; + txHash: string | null; + paymentLink: string; + createdAt: string; +} + +export interface Schedule { + id: string; + recipient: string; + amount: string; + asset: string; + interval: 'daily' | 'weekly' | 'monthly'; + status: 'active' | 'paused' | 'cancelled'; + nextRun: string; +} + +export interface TxResult { + txHash: string; + txLink: string; +} + +export interface PrivacyReport { + score: number; + issues: Array<{ + severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; + issue: string; + recommendation: string; + }>; + bestPractices: string[]; +} + +export interface Notification { + id: number; + type: string; + title: string; + body: string; + read: boolean; + createdAt: string; +} + +export interface Conversation { + id: string; + title: string; + createdAt: string; + updatedAt: string; +} diff --git a/src/agent/types.ts b/src/agent/types.ts index 1036b7a..ce57149 100644 --- a/src/agent/types.ts +++ b/src/agent/types.ts @@ -1,110 +1,22 @@ -export enum Chain { - Horizen = 'horizen', - Ethereum = 'ethereum', - Polygon = 'polygon', - Base = 'base', - Stellar = 'stellar', - Solana = 'solana', - All = 'all', -} - -export interface WraithConfig { - apiKey: string; - baseUrl?: string; - ai?: { - provider: 'gemini' | 'openai' | 'claude'; - apiKey: string; - }; -} - -export interface AgentConfig { - name: string; - chain: Chain | Chain[]; - wallet: string; - signature: string; - message?: string; -} - -export interface AgentInfo { - id: string; - name: string; - chains: Chain[]; - addresses: Record; - metaAddresses: Record; -} - -export interface ChatResponse { - response: string; - toolCalls?: ToolCall[]; - conversationId: string; -} - -export interface ToolCall { - name: string; - status: string; - detail?: string; -} - -export interface Balance { - native: string; - tokens: Record; -} - -export interface Payment { - stealthAddress: string; - balance: string; - ephemeralPubKey: string; -} - -export interface Invoice { - id: string; - agentName: string; - amount: string; - asset: string; - memo: string; - status: 'pending' | 'paid'; - txHash: string | null; - paymentLink: string; - createdAt: string; -} - -export interface Schedule { - id: string; - recipient: string; - amount: string; - asset: string; - interval: 'daily' | 'weekly' | 'monthly'; - status: 'active' | 'paused' | 'cancelled'; - nextRun: string; -} - -export interface TxResult { - txHash: string; - txLink: string; -} - -export interface PrivacyReport { - score: number; - issues: Array<{ - severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; - issue: string; - recommendation: string; - }>; - bestPractices: string[]; -} - -export interface Notification { - id: number; - type: string; - title: string; - body: string; - read: boolean; - createdAt: string; -} - -export interface Conversation { - id: string; - title: string; - createdAt: string; - updatedAt: string; -} +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ +export { Chain } from './types-local'; +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ +export type { + WraithConfig, + AgentConfig, + AgentInfo, + ChatResponse, + ToolCall, + Balance, + Payment, + Invoice, + Schedule, + TxResult, + PrivacyReport, + Notification, + Conversation, +} from './types-local'; diff --git a/src/index.ts b/src/index.ts index 75a73eb..a447cfb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,19 @@ +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ export { Wraith, WraithAgent } from './agent/client'; +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ export { Chain } from './agent/types'; /** * @internal */ export { installReactNativePolyfills } from './compat'; export { scanAll } from './scanner/unified'; +/** + * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. + */ export type { WraithConfig, AgentConfig, diff --git a/src/types/@wraith-protocol/sdk-agent.d.ts b/src/types/@wraith-protocol/sdk-agent.d.ts new file mode 100644 index 0000000..fb07555 --- /dev/null +++ b/src/types/@wraith-protocol/sdk-agent.d.ts @@ -0,0 +1,203 @@ +declare module '@wraith-protocol/sdk-agent' { + export class Wraith { + constructor(config: { + apiKey: string; + baseUrl?: string; + ai?: { + provider: 'gemini' | 'openai' | 'claude'; + apiKey: string; + }; + }); + createAgent(config: { + name: string; + chain: Chain | Chain[]; + wallet: string; + signature: string; + message?: string; + }): Promise; + agent(agentId: string): WraithAgent; + getAgentByWallet(walletAddress: string): Promise; + getAgentByName(name: string): Promise; + listAgents(): Promise; + } + + export class WraithAgent { + readonly info: AgentInfo; + chat(message: string, conversationId?: string): Promise; + getStatus(): Promise; + getBalance(): Promise; + scanPayments(): Promise; + exportKey(signature: string, message: string): Promise<{ secret: string }>; + getConversations(): Promise; + getMessages(conversationId: string): Promise>; + deleteConversation(conversationId: string): Promise; + getNotifications(): Promise<{ notifications: Notification[]; unreadCount: number }>; + markNotificationsRead(): Promise; + clearNotifications(): Promise; + } + + export enum Chain { + Horizen = 'horizen', + Ethereum = 'ethereum', + Polygon = 'polygon', + Base = 'base', + Stellar = 'stellar', + Solana = 'solana', + All = 'all', + } + + export interface WraithConfig { + apiKey: string; + baseUrl?: string; + ai?: { + provider: 'gemini' | 'openai' | 'claude'; + apiKey: string; + }; + } + + export interface AgentConfig { + name: string; + chain: Chain | Chain[]; + wallet: string; + signature: string; + message?: string; + } + + export interface AgentInfo { + id: string; + name: string; + chains: Chain[]; + addresses: Record; + metaAddresses: Record; + } + + export interface ChatResponse { + response: string; + toolCalls?: ToolCall[]; + conversationId: string; + } + + export interface ToolCall { + name: string; + status: string; + detail?: string; + } + + export interface Balance { + native: string; + tokens: Record; + } + + export interface Payment { + stealthAddress: string; + balance: string; + ephemeralPubKey: string; + } + + export interface Invoice { + id: string; + agentName: string; + amount: string; + asset: string; + memo: string; + status: 'pending' | 'paid'; + txHash: string | null; + paymentLink: string; + createdAt: string; + } + + export interface Schedule { + id: string; + recipient: string; + amount: string; + asset: string; + interval: 'daily' | 'weekly' | 'monthly'; + status: 'active' | 'paused' | 'cancelled'; + nextRun: string; + } + + export interface TxResult { + txHash: string; + txLink: string; + } + + export interface PrivacyReport { + score: number; + issues: Array<{ + severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; + issue: string; + recommendation: string; + }>; + bestPractices: string[]; + } + + export interface Notification { + id: number; + type: string; + title: string; + body: string; + read: boolean; + createdAt: string; + } + + export interface Conversation { + id: string; + title: string; + createdAt: string; + updatedAt: string; + } + + export function createClaudeAgentTools(context?: ClaudeAgentToolContext): ClaudeAgentTools; + + export interface ClaudeAgentToolContext { + apiKey?: string; + baseUrl?: string; + } + + export interface SendToMetaAddressInput { + metaAddress: string; + amount: string; + asset?: string; + memo?: string; + destination?: string; + } + + export interface ScanInput { + announcements: any[]; + viewingKeyHex: string; + spendingPubKeyHex: string; + spendingScalarHex: string; + } + + export interface WithdrawInput { + stealthAddress: string; + amount: string; + asset?: string; + destination?: string; + memo?: string; + } + + export interface ResolveNameInput { + name: string; + chain?: string; + } + + export interface ToolResult { + kind: 'send' | 'scan' | 'withdraw' | 'resolve-name'; + signingRequired: boolean; + tx?: Record; + metaAddress?: string; + matches?: Array>; + count?: number; + name?: string; + chain?: string; + note?: string; + } + + export interface ClaudeAgentTools { + sendToMetaAddress(input: SendToMetaAddressInput): Promise; + scan(input: ScanInput): Promise; + withdraw(input: WithdrawInput): Promise; + resolveName(input: ResolveNameInput): Promise; + } +} diff --git a/tsconfig.json b/tsconfig.json index 65713a6..f1244c7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,6 @@ "outDir": "dist", "rootDir": "src" }, - "include": ["src"], + "include": ["src", "src/types"], "exclude": ["node_modules", "dist", "test"] } diff --git a/tsup.config.ts b/tsup.config.ts index 9004f02..48c8d89 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -9,11 +9,23 @@ export default defineConfig({ 'chains/ckb/index': 'src/chains/ckb/index.ts', 'compat/react-native': 'src/compat/react-native.ts', 'vault/index': 'src/vault/index.ts', + 'agent/index': 'src/agent/index.ts', }, format: ['esm', 'cjs'], - dts: true, + dts: { + entry: { + index: 'src/index.ts', + 'chains/evm/index': 'src/chains/evm/index.ts', + 'chains/stellar/index': 'src/chains/stellar/index.ts', + 'chains/solana/index': 'src/chains/solana/index.ts', + 'chains/ckb/index': 'src/chains/ckb/index.ts', + 'compat/react-native': 'src/compat/react-native.ts', + 'vault/index': 'src/vault/index.ts', + }, + }, splitting: true, clean: true, treeshake: true, + external: ['@wraith-protocol/sdk-agent'], metafile: !!process.env.ANALYZE, }); From dce8f84125a7edb1cc0dd12b21a40c3d780bd0a0 Mon Sep 17 00:00:00 2001 From: lamborghini21 Date: Wed, 26 Aug 2026 23:05:04 +0100 Subject: [PATCH 2/4] chore: fix formatting (trailing newline, lockfile) --- examples/stellar-spectre-agent/package.json | 2 +- pnpm-lock.yaml | 11 +++++++++-- src/index.ts | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/stellar-spectre-agent/package.json b/examples/stellar-spectre-agent/package.json index ad7d797..77afe32 100644 --- a/examples/stellar-spectre-agent/package.json +++ b/examples/stellar-spectre-agent/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "@wraith-protocol/sdk": "file:../..", - "@wraith-protocol/sdk-agent": "workspace:*" + "@wraith-protocol/sdk-agent": "file:../../packages/sdk-agent" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ee689d..d248660 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -347,8 +347,8 @@ importers: specifier: file:../.. version: file:(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@stellar/stellar-sdk@13.3.0)(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@3.25.76) '@wraith-protocol/sdk-agent': - specifier: workspace:* - version: link:../../packages/sdk-agent + specifier: file:../../packages/sdk-agent + version: file:packages/sdk-agent devDependencies: tsx: specifier: ^4.0.0 @@ -3087,6 +3087,9 @@ packages: '@webcomponents/custom-elements@1.6.0': resolution: {integrity: sha512-CqTpxOlUCPWRNUPZDxT5v2NnHXA4oox612iUGnmTUGQFhZ1Gkj8kirtl/2wcF6MqX7+PqqicZzOCBKKfIn0dww==} + '@wraith-protocol/sdk-agent@file:packages/sdk-agent': + resolution: {directory: packages/sdk-agent, type: directory} + '@wraith-protocol/sdk-react@file:packages/sdk-react': resolution: {directory: packages/sdk-react, type: directory} peerDependencies: @@ -10662,6 +10665,10 @@ snapshots: '@webcomponents/custom-elements@1.6.0': {} + '@wraith-protocol/sdk-agent@file:packages/sdk-agent': + dependencies: + '@wraith-protocol/sdk': 'link:' + '@wraith-protocol/sdk-react@file:packages/sdk-react(@stellar/stellar-sdk@13.3.0)(@wraith-protocol/sdk@file:(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@stellar/stellar-sdk@13.3.0)(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@3.25.76))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@stellar/stellar-sdk': 13.3.0 diff --git a/src/index.ts b/src/index.ts index 50f6246..bd65727 100644 --- a/src/index.ts +++ b/src/index.ts @@ -78,4 +78,4 @@ export { ContractRevertError, InsufficientBalanceError, UnsupportedAssetError, -} from './errors'; \ No newline at end of file +} from './errors'; From c414f0c976f165a4d70f05ac464a22d65ad2a72f Mon Sep 17 00:00:00 2001 From: lamborghini21 Date: Thu, 27 Aug 2026 19:27:50 +0100 Subject: [PATCH 3/4] chore: refresh api-extractor baseline Remove extracted agent exports from the root entry point and refresh the root API baseline. --- etc/sdk.api.md | 246 +------------------------------------------------ src/index.ts | 23 ----- 2 files changed, 4 insertions(+), 265 deletions(-) diff --git a/etc/sdk.api.md b/etc/sdk.api.md index c3b3a39..2639c92 100644 --- a/etc/sdk.api.md +++ b/etc/sdk.api.md @@ -4,42 +4,6 @@ ```ts -// @public (undocumented) -export interface AgentConfig { - // (undocumented) - chain: Chain | Chain[]; - // (undocumented) - message?: string; - // (undocumented) - name: string; - // (undocumented) - signature: string; - // (undocumented) - wallet: string; -} - -// @public (undocumented) -export interface AgentInfo { - // (undocumented) - addresses: Record; - // (undocumented) - chains: Chain[]; - // (undocumented) - id: string; - // (undocumented) - metaAddresses: Record; - // (undocumented) - name: string; -} - -// @public (undocumented) -export interface Balance { - // (undocumented) - native: string; - // (undocumented) - tokens: Record; -} - // @public export interface BaseWalletAdapter { // (undocumented) @@ -50,34 +14,6 @@ export interface BaseWalletAdapter; } -// @public (undocumented) -export enum Chain { - // (undocumented) - All = "all", - // (undocumented) - Base = "base", - // (undocumented) - Ethereum = "ethereum", - // (undocumented) - Horizen = "horizen", - // (undocumented) - Polygon = "polygon", - // (undocumented) - Solana = "solana", - // (undocumented) - Stellar = "stellar" -} - -// @public (undocumented) -export interface ChatResponse { - // (undocumented) - conversationId: string; - // (undocumented) - response: string; - // (undocumented) - toolCalls?: ToolCall[]; -} - // @public (undocumented) export interface CkbChainInput { // Warning: (ae-forgotten-export) The symbol "StealthCell" needs to be exported by the entry point index.d.ts @@ -103,18 +39,6 @@ export class ContractRevertError extends WraithContractError { readonly reason: string; } -// @public (undocumented) -export interface Conversation { - // (undocumented) - createdAt: string; - // (undocumented) - id: string; - // (undocumented) - title: string; - // (undocumented) - updatedAt: string; -} - // @public export function createFreighterWalletAdapter(wallet: FreighterWalletApi): FreighterWalletAdapter; @@ -242,28 +166,6 @@ export class InvalidSignatureError extends WraithInputError { readonly code = "WRAITH/INPUT/INVALID_SIGNATURE"; } -// @public (undocumented) -export interface Invoice { - // (undocumented) - agentName: string; - // (undocumented) - amount: string; - // (undocumented) - asset: string; - // (undocumented) - createdAt: string; - // (undocumented) - id: string; - // (undocumented) - memo: string; - // (undocumented) - paymentLink: string; - // (undocumented) - status: 'pending' | 'paid'; - // (undocumented) - txHash: string | null; -} - // @public (undocumented) export class KeyDerivationFailedError extends WraithCryptoError { constructor(reason: string); @@ -308,47 +210,6 @@ export class NameNotFoundError extends WraithContractError { readonly code = "WRAITH/CONTRACT/NAME_NOT_FOUND"; } -// @public (undocumented) -interface Notification_2 { - // (undocumented) - body: string; - // (undocumented) - createdAt: string; - // (undocumented) - id: number; - // (undocumented) - read: boolean; - // (undocumented) - title: string; - // (undocumented) - type: string; -} -export { Notification_2 as Notification } - -// @public (undocumented) -export interface Payment { - // (undocumented) - balance: string; - // (undocumented) - ephemeralPubKey: string; - // (undocumented) - stealthAddress: string; -} - -// @public (undocumented) -export interface PrivacyReport { - // (undocumented) - bestPractices: string[]; - // (undocumented) - issues: Array<{ - severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; - issue: string; - recommendation: string; - }>; - // (undocumented) - score: number; -} - // @public (undocumented) export class RetentionExceededError extends WraithNetworkError { constructor(limit: number, actual: number); @@ -387,24 +248,6 @@ export interface ScanAllInput { stellar?: StellarChainInput; } -// @public (undocumented) -export interface Schedule { - // (undocumented) - amount: string; - // (undocumented) - asset: string; - // (undocumented) - id: string; - // (undocumented) - interval: 'daily' | 'weekly' | 'monthly'; - // (undocumented) - nextRun: string; - // (undocumented) - recipient: string; - // (undocumented) - status: 'active' | 'paused' | 'cancelled'; -} - // @public (undocumented) export interface SolanaChainInput { // Warning: (ae-forgotten-export) The symbol "Announcement_2" needs to be exported by the entry point index.d.ts @@ -463,24 +306,6 @@ export type StellarWalletAdapter = BaseWalletAdapter<'stellar', Uint8Array>; // @public (undocumented) export type SupportedChain = 'evm' | 'stellar' | 'solana' | 'ckb'; -// @public (undocumented) -export interface ToolCall { - // (undocumented) - detail?: string; - // (undocumented) - name: string; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface TxResult { - // (undocumented) - txHash: string; - // (undocumented) - txLink: string; -} - // @public (undocumented) export class UnsupportedAssetError extends WraithBuilderError { constructor(asset: string, chain?: string); @@ -531,73 +356,10 @@ export type WalletAdapter = StellarWalletAdapter | EvmWalletAdapter | SolanaChai // @public export type WalletAdapterChain = 'stellar' | 'evm' | 'solana'; -// @public (undocumented) -export class Wraith { - constructor(config: WraithConfig); - // (undocumented) - agent(agentId: string): WraithAgent; - createAgent(config: AgentConfig): Promise; - getAgentByName(name: string): Promise; - getAgentByWallet(walletAddress: string): Promise; - listAgents(): Promise; - // @internal - _request(method: string, path: string, body?: unknown): Promise; -} - -// @public (undocumented) -export class WraithAgent { - constructor(wraith: Wraith, info: AgentInfo); - // (undocumented) - chat(message: string, conversationId?: string): Promise; - // (undocumented) - clearNotifications(): Promise; - // (undocumented) - deleteConversation(conversationId: string): Promise; - // (undocumented) - exportKey(signature: string, message: string): Promise<{ - secret: string; - }>; - // (undocumented) - getBalance(): Promise; - // (undocumented) - getConversations(): Promise; - // (undocumented) - getMessages(conversationId: string): Promise>; - // (undocumented) - getNotifications(): Promise<{ - notifications: Notification_2[]; - unreadCount: number; - }>; - // (undocumented) - getStatus(): Promise; - // (undocumented) - readonly info: AgentInfo; - // (undocumented) - markNotificationsRead(): Promise; - // (undocumented) - scanPayments(): Promise; -} - // @public (undocumented) export abstract class WraithBuilderError extends WraithError { } -// @public (undocumented) -export interface WraithConfig { - // (undocumented) - ai?: { - provider: 'gemini' | 'openai' | 'claude'; - apiKey: string; - }; - // (undocumented) - apiKey: string; - // (undocumented) - baseUrl?: string; -} - // @public (undocumented) export abstract class WraithContractError extends WraithError { } @@ -635,10 +397,10 @@ export abstract class WraithNetworkError extends WraithError { // Warnings were encountered during analysis: // -// dist/index.d.ts:207:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_2" needs to be exported by the entry point index.d.ts -// dist/index.d.ts:212:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement$1" needs to be exported by the entry point index.d.ts -// dist/index.d.ts:217:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_3" needs to be exported by the entry point index.d.ts -// dist/index.d.ts:222:5 - (ae-forgotten-export) The symbol "MatchedStealthCell" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:42:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_2" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:47:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement$1" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:52:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_3" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:57:5 - (ae-forgotten-export) The symbol "MatchedStealthCell" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/index.ts b/src/index.ts index bd65727..5fc2f0f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,11 +1,3 @@ -/** - * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. - */ -export { Wraith, WraithAgent } from './agent/client'; -/** - * @deprecated Import from '@wraith-protocol/sdk-agent' instead. Agent functionality has been moved to a separate package. - */ -export { Chain } from './agent/types'; /** * @internal */ @@ -31,21 +23,6 @@ export type { ViemWalletClient, SolanaWalletAdapterLike, } from './wallet'; -export type { - WraithConfig, - AgentConfig, - AgentInfo, - ChatResponse, - ToolCall, - Balance, - Payment, - Invoice, - Schedule, - TxResult, - PrivacyReport, - Notification, - Conversation, -} from './agent/types'; export type { ScanAllInput, MatchedAnnouncement, From 5c0e5ae5633ea8ee3548273a788452d1aca7ee65 Mon Sep 17 00:00:00 2001 From: lamborghini21 Date: Sun, 30 Aug 2026 20:22:48 +0100 Subject: [PATCH 4/4] fix: resolve sdk-agent telemetry boundary --- packages/sdk-agent/src/index.ts | 10 ++ packages/sdk-agent/src/tools.ts | 174 ++++++++++++++++++++------------ 2 files changed, 121 insertions(+), 63 deletions(-) diff --git a/packages/sdk-agent/src/index.ts b/packages/sdk-agent/src/index.ts index 4b04ce2..13b10f9 100644 --- a/packages/sdk-agent/src/index.ts +++ b/packages/sdk-agent/src/index.ts @@ -15,3 +15,13 @@ export type { Notification, Conversation, } from './types'; +export { createClaudeAgentTools } from './tools'; +export type { + ClaudeAgentToolContext, + SendToMetaAddressInput, + ScanInput, + WithdrawInput, + ResolveNameInput, + ToolResult, + ClaudeAgentTools, +} from './tools'; diff --git a/packages/sdk-agent/src/tools.ts b/packages/sdk-agent/src/tools.ts index 10de6e4..5da0de1 100644 --- a/packages/sdk-agent/src/tools.ts +++ b/packages/sdk-agent/src/tools.ts @@ -9,9 +9,31 @@ import { type Announcement, } from '@wraith-protocol/sdk/chains/stellar'; +export type Tracer = { + startActiveSpan?: ( + name: string, + attributes: Record, + callback: () => Promise | T, + ) => Promise | T; +}; + +export function withSpan( + name: string, + attributes: Record, + callback: () => Promise | T, + tracer?: Tracer, +): Promise | T { + if (typeof tracer?.startActiveSpan === 'function') { + return tracer.startActiveSpan(name, attributes, callback); + } + return callback(); +} + export interface ClaudeAgentToolContext { apiKey?: string; baseUrl?: string; + /** Default tracer for spans created by these tools. Overridable per call via `withSpan`-instrumented internals. */ + tracer?: Tracer; } export interface SendToMetaAddressInput { @@ -74,80 +96,106 @@ function parseBigInt(value: string | undefined): bigint { return BigInt(`0x${clean}`); } -export function createClaudeAgentTools(_context: ClaudeAgentToolContext = {}): ClaudeAgentTools { +export function createClaudeAgentTools(context: ClaudeAgentToolContext = {}): ClaudeAgentTools { + const tracer = context.tracer; + return { - async sendToMetaAddress(input) { - const { spendingPubKey, viewingPubKey } = decodeStealthMetaAddress(input.metaAddress); - const stealthResult = generateStealthAddress(spendingPubKey, viewingPubKey); - return { - kind: 'send', - signingRequired: true, - metaAddress: input.metaAddress, - tx: { - intent: 'send-to-meta-address', - asset: input.asset ?? 'XLM', - amount: input.amount, - memo: input.memo ?? '', - stealthAddress: stealthResult.stealthAddress, - ephemeralPubKey: bytesToHex(stealthResult.ephemeralPubKey), - metadata: stealthResult.viewTag.toString(16).padStart(2, '0'), - destination: input.destination ?? stealthResult.stealthAddress, + sendToMetaAddress(input) { + return withSpan( + 'agent.tool.sendToMetaAddress', + { 'wraith.agent.tool': 'sendToMetaAddress' }, + async () => { + const { spendingPubKey, viewingPubKey } = decodeStealthMetaAddress(input.metaAddress); + const stealthResult = generateStealthAddress(spendingPubKey, viewingPubKey); + return { + kind: 'send', + signingRequired: true, + metaAddress: input.metaAddress, + tx: { + intent: 'send-to-meta-address', + asset: input.asset ?? 'XLM', + amount: input.amount, + memo: input.memo ?? '', + stealthAddress: stealthResult.stealthAddress, + ephemeralPubKey: bytesToHex(stealthResult.ephemeralPubKey), + metadata: stealthResult.viewTag.toString(16).padStart(2, '0'), + destination: input.destination ?? stealthResult.stealthAddress, + }, + note: 'The agent prepares a stealth send plan. The sender must sign the transaction locally with their wallet.', + }; }, - note: 'The agent prepares a stealth send plan. The sender must sign the transaction locally with their wallet.', - }; + tracer, + ); }, - async scan(input) { - const viewingKey = parseHexBytes(input.viewingKeyHex); - const spendingPubKey = parseHexBytes(input.spendingPubKeyHex); - const spendingScalar = parseBigInt(input.spendingScalarHex); - const matches = scanAnnouncements( - input.announcements, - viewingKey, - spendingPubKey, - spendingScalar, + scan(input) { + return withSpan( + 'agent.tool.scan', + { 'wraith.agent.tool': 'scan', 'wraith.scan.candidate_count': input.announcements.length }, + async () => { + const viewingKey = parseHexBytes(input.viewingKeyHex); + const spendingPubKey = parseHexBytes(input.spendingPubKeyHex); + const spendingScalar = parseBigInt(input.spendingScalarHex); + const matches = scanAnnouncements( + input.announcements, + viewingKey, + spendingPubKey, + spendingScalar, + ); + return { + kind: 'scan', + signingRequired: false, + matches: matches.map((item) => ({ + stealthAddress: item.stealthAddress, + ephemeralPubKey: item.ephemeralPubKey, + metadata: item.metadata, + stealthPrivateScalar: item.stealthPrivateScalar.toString(), + })), + count: matches.length, + }; + }, + tracer, ); - return { - kind: 'scan', - signingRequired: false, - matches: matches.map((item) => ({ - stealthAddress: item.stealthAddress, - ephemeralPubKey: item.ephemeralPubKey, - metadata: item.metadata, - stealthPrivateScalar: item.stealthPrivateScalar.toString(), - })), - count: matches.length, - }; }, - async withdraw(input) { - return { - kind: 'withdraw', - signingRequired: true, - tx: { - intent: 'withdraw', - stealthAddress: input.stealthAddress, - asset: input.asset ?? 'XLM', - amount: input.amount, - destination: input.destination ?? input.stealthAddress, - memo: input.memo ?? '', - }, - note: 'The agent prepares a withdrawal plan. The stealth account owner must sign the transaction with their local wallet or key manager.', - }; + withdraw(input) { + return withSpan( + 'agent.tool.withdraw', + { 'wraith.agent.tool': 'withdraw' }, + async () => ({ + kind: 'withdraw', + signingRequired: true, + tx: { + intent: 'withdraw', + stealthAddress: input.stealthAddress, + asset: input.asset ?? 'XLM', + amount: input.amount, + destination: input.destination ?? input.stealthAddress, + memo: input.memo ?? '', + }, + note: 'The agent prepares a withdrawal plan. The stealth account owner must sign the transaction with their local wallet or key manager.', + }), + tracer, + ); }, - async resolveName(input) { - return { - kind: 'resolve-name', - signingRequired: false, - name: input.name, - chain: input.chain ?? 'stellar', - tx: { - intent: 'resolve-name', + resolveName(input) { + return withSpan( + 'agent.tool.resolveName', + { 'wraith.agent.tool': 'resolveName' }, + async () => ({ + kind: 'resolve-name', + signingRequired: false, name: input.name, chain: input.chain ?? 'stellar', - }, - }; + tx: { + intent: 'resolve-name', + name: input.name, + chain: input.chain ?? 'stellar', + }, + }), + tracer, + ); }, }; }