@teneo-protocol/sdk 2.2.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/config.yml +1 -1
- package/CHANGELOG.md +366 -15
- package/CONCEPTS.md +182 -44
- package/README.md +524 -94
- package/dist/constants.d.ts +3 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -3
- package/dist/constants.js.map +1 -1
- package/dist/core/websocket-client.d.ts.map +1 -1
- package/dist/core/websocket-client.js +9 -5
- package/dist/core/websocket-client.js.map +1 -1
- package/dist/formatters/response-formatter.d.ts +6 -6
- package/dist/handlers/message-handlers/agent-details-response-handler.d.ts +1080 -756
- package/dist/handlers/message-handlers/agent-details-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/agent-details-response-handler.js +2 -2
- package/dist/handlers/message-handlers/agent-details-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/agent-error-handler.d.ts +91 -0
- package/dist/handlers/message-handlers/agent-error-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/agent-error-handler.js +44 -0
- package/dist/handlers/message-handlers/agent-error-handler.js.map +1 -0
- package/dist/handlers/message-handlers/agent-selected-handler.d.ts +6 -0
- package/dist/handlers/message-handlers/agent-selected-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/agent-status-update-handler.d.ts +1080 -756
- package/dist/handlers/message-handlers/agent-status-update-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/agent-status-update-handler.js +2 -7
- package/dist/handlers/message-handlers/agent-status-update-handler.js.map +1 -1
- package/dist/handlers/message-handlers/all-agents-response-handler.d.ts +135 -54
- package/dist/handlers/message-handlers/all-agents-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/all-agents-response-handler.js +2 -2
- package/dist/handlers/message-handlers/all-agents-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/auth-error-handler.d.ts +6 -0
- package/dist/handlers/message-handlers/auth-error-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-message-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-message-handler.js +6 -1
- package/dist/handlers/message-handlers/auth-message-handler.js.map +1 -1
- package/dist/handlers/message-handlers/auth-required-handler.d.ts +6 -0
- package/dist/handlers/message-handlers/auth-required-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-success-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-success-handler.js +6 -1
- package/dist/handlers/message-handlers/auth-success-handler.js.map +1 -1
- package/dist/handlers/message-handlers/base-handler.d.ts +2 -1
- package/dist/handlers/message-handlers/base-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/base-handler.js +24 -4
- package/dist/handlers/message-handlers/base-handler.js.map +1 -1
- package/dist/handlers/message-handlers/challenge-handler.d.ts +6 -0
- package/dist/handlers/message-handlers/challenge-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/error-message-handler.d.ts +6 -0
- package/dist/handlers/message-handlers/error-message-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/index.d.ts +4 -0
- package/dist/handlers/message-handlers/index.d.ts.map +1 -1
- package/dist/handlers/message-handlers/index.js +23 -1
- package/dist/handlers/message-handlers/index.js.map +1 -1
- package/dist/handlers/message-handlers/list-available-agents-handler.d.ts +1116 -756
- package/dist/handlers/message-handlers/list-available-agents-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/list-available-agents-handler.js +23 -10
- package/dist/handlers/message-handlers/list-available-agents-handler.js.map +1 -1
- package/dist/handlers/message-handlers/list-room-agents-handler.d.ts +1080 -756
- package/dist/handlers/message-handlers/list-room-agents-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/list-room-agents-handler.js +2 -6
- package/dist/handlers/message-handlers/list-room-agents-handler.js.map +1 -1
- package/dist/handlers/message-handlers/list-rooms-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/list-rooms-response-handler.js +2 -5
- package/dist/handlers/message-handlers/list-rooms-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/ping-pong-handler.d.ts +52 -4
- package/dist/handlers/message-handlers/ping-pong-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/ping-pong-handler.js +23 -4
- package/dist/handlers/message-handlers/ping-pong-handler.js.map +1 -1
- package/dist/handlers/message-handlers/rate-limit-notification-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/rate-limit-notification-handler.js +3 -2
- package/dist/handlers/message-handlers/rate-limit-notification-handler.js.map +1 -1
- package/dist/handlers/message-handlers/regular-message-handler.d.ts +6 -0
- package/dist/handlers/message-handlers/regular-message-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/subscribe-response-handler.d.ts +12 -6
- package/dist/handlers/message-handlers/subscribe-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/success-handler.d.ts +82 -0
- package/dist/handlers/message-handlers/success-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/success-handler.js +24 -0
- package/dist/handlers/message-handlers/success-handler.js.map +1 -0
- package/dist/handlers/message-handlers/task-confirmed-handler.d.ts +110 -0
- package/dist/handlers/message-handlers/task-confirmed-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/task-confirmed-handler.js +46 -0
- package/dist/handlers/message-handlers/task-confirmed-handler.js.map +1 -0
- package/dist/handlers/message-handlers/trigger-wallet-tx-handler.d.ts +244 -0
- package/dist/handlers/message-handlers/trigger-wallet-tx-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/trigger-wallet-tx-handler.js +58 -0
- package/dist/handlers/message-handlers/trigger-wallet-tx-handler.js.map +1 -0
- package/dist/handlers/message-handlers/unsubscribe-response-handler.d.ts +12 -6
- package/dist/handlers/message-handlers/unsubscribe-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/user-authenticated-handler.js +2 -2
- package/dist/handlers/message-handlers/user-authenticated-handler.js.map +1 -1
- package/dist/handlers/message-handlers/user-count-handler.js +2 -2
- package/dist/handlers/message-handlers/user-count-handler.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/managers/admin-manager.d.ts +3 -1
- package/dist/managers/admin-manager.d.ts.map +1 -1
- package/dist/managers/admin-manager.js +4 -3
- package/dist/managers/admin-manager.js.map +1 -1
- package/dist/managers/agent-room-manager.d.ts +89 -11
- package/dist/managers/agent-room-manager.d.ts.map +1 -1
- package/dist/managers/agent-room-manager.js +99 -35
- package/dist/managers/agent-room-manager.js.map +1 -1
- package/dist/managers/index.d.ts +1 -1
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/message-router.d.ts +45 -5
- package/dist/managers/message-router.d.ts.map +1 -1
- package/dist/managers/message-router.js +96 -24
- package/dist/managers/message-router.js.map +1 -1
- package/dist/managers/room-manager.d.ts +29 -7
- package/dist/managers/room-manager.d.ts.map +1 -1
- package/dist/managers/room-manager.js +37 -11
- package/dist/managers/room-manager.js.map +1 -1
- package/dist/payments/index.d.ts +3 -1
- package/dist/payments/index.d.ts.map +1 -1
- package/dist/payments/index.js +17 -3
- package/dist/payments/index.js.map +1 -1
- package/dist/payments/networks.d.ts +59 -0
- package/dist/payments/networks.d.ts.map +1 -0
- package/dist/payments/networks.js +192 -0
- package/dist/payments/networks.js.map +1 -0
- package/dist/payments/payment-client.d.ts +55 -10
- package/dist/payments/payment-client.d.ts.map +1 -1
- package/dist/payments/payment-client.js +172 -51
- package/dist/payments/payment-client.js.map +1 -1
- package/dist/teneo-sdk.d.ts +215 -41
- package/dist/teneo-sdk.d.ts.map +1 -1
- package/dist/teneo-sdk.js +361 -84
- package/dist/teneo-sdk.js.map +1 -1
- package/dist/types/config.d.ts +334 -25
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +114 -22
- package/dist/types/config.js.map +1 -1
- package/dist/types/events.d.ts +60 -14
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +11 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/messages.d.ts +13110 -7451
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/messages.js +195 -44
- package/dist/types/messages.js.map +1 -1
- package/dist/utils/pricing-resolver.d.ts +1 -1
- package/dist/utils/pricing-resolver.d.ts.map +1 -1
- package/dist/utils/pricing-resolver.js +9 -1
- package/dist/utils/pricing-resolver.js.map +1 -1
- package/examples/agent-room-management-example.ts +5 -5
- package/examples/basic-usage.ts +26 -6
- package/examples/claude-agent-x-follower/index.ts +1 -1
- package/examples/minimal-chat.ts +4 -3
- package/examples/n8n-teneo/index.ts +2 -2
- package/examples/nestjs-dashboard/README.md +1 -1
- package/examples/nestjs-dashboard/src/teneo/agents.controller.ts +3 -3
- package/examples/nestjs-dashboard/src/teneo/rooms.controller.ts +5 -5
- package/examples/nestjs-dashboard/src/teneo/teneo.service.ts +8 -8
- package/examples/openai-teneo/index.ts +1 -1
- package/examples/payment-flow.ts +143 -0
- package/examples/production-dashboard/README.md +6 -8
- package/examples/production-dashboard/server.ts +22 -10
- package/examples/room-management-example.ts +2 -2
- package/examples/usage/01-connect.ts +0 -3
- package/examples/usage/02-list-agents.ts +0 -2
- package/examples/usage/03-pick-agent.ts +3 -4
- package/examples/usage/04-find-by-capability.ts +10 -12
- package/examples/usage/05-webhook-example.ts +2 -4
- package/examples/usage/06-simple-api-server.ts +13 -9
- package/examples/usage/07-event-listener.ts +1 -13
- package/examples/usage/README.md +33 -7
- package/examples/webhook-integration.ts +9 -9
- package/examples/x-influencer-battle-server.ts +1 -1
- package/package.json +1 -1
- package/scripts/diagnose-connection.ts +86 -0
- package/scripts/investigate-payload.ts +163 -0
- package/scripts/list-agents.ts +58 -0
- package/scripts/live-multi-network-test.ts +230 -0
- package/src/constants.ts +5 -3
- package/src/core/websocket-client.ts +10 -9
- package/src/handlers/message-handlers/agent-details-response-handler.ts +2 -2
- package/src/handlers/message-handlers/agent-error-handler.ts +47 -0
- package/src/handlers/message-handlers/agent-status-update-handler.ts +2 -7
- package/src/handlers/message-handlers/all-agents-response-handler.ts +2 -2
- package/src/handlers/message-handlers/auth-message-handler.ts +7 -1
- package/src/handlers/message-handlers/auth-success-handler.ts +7 -1
- package/src/handlers/message-handlers/base-handler.ts +24 -4
- package/src/handlers/message-handlers/index.ts +24 -0
- package/src/handlers/message-handlers/list-available-agents-handler.ts +24 -11
- package/src/handlers/message-handlers/list-room-agents-handler.ts +2 -6
- package/src/handlers/message-handlers/list-rooms-response-handler.ts +2 -5
- package/src/handlers/message-handlers/ping-pong-handler.ts +29 -4
- package/src/handlers/message-handlers/rate-limit-notification-handler.ts +3 -2
- package/src/handlers/message-handlers/success-handler.ts +26 -0
- package/src/handlers/message-handlers/task-confirmed-handler.ts +49 -0
- package/src/handlers/message-handlers/trigger-wallet-tx-handler.ts +62 -0
- package/src/handlers/message-handlers/user-authenticated-handler.ts +2 -2
- package/src/handlers/message-handlers/user-count-handler.ts +2 -2
- package/src/index.ts +12 -4
- package/src/managers/admin-manager.ts +6 -3
- package/src/managers/agent-room-manager.ts +155 -26
- package/src/managers/index.ts +6 -1
- package/src/managers/message-router.ts +122 -27
- package/src/managers/room-manager.ts +39 -11
- package/src/payments/index.ts +20 -5
- package/src/payments/networks.ts +208 -0
- package/src/payments/payment-client.ts +211 -56
- package/src/teneo-sdk.ts +402 -71
- package/src/types/config.test.ts +24 -4
- package/src/types/config.ts +123 -25
- package/src/types/events.ts +36 -2
- package/src/types/index.ts +16 -3
- package/src/types/messages.ts +235 -60
- package/src/utils/pricing-resolver.ts +10 -2
- package/tests/direct-agent-test.ts +1 -1
- package/tests/integration/real-server.test.ts +1 -1
- package/tests/integration/websocket.test.ts +3 -3
- package/tests/multi-network-payment.test.ts +309 -0
- package/tests/multi-network.test.ts +296 -0
- package/tests/payment-flow-test.ts +6 -4
- package/tests/unit/handlers/agent-error-handler.test.ts +388 -0
- package/tests/unit/handlers/agent-room-operation-response-handler.test.ts +9 -6
- package/tests/unit/handlers/agent-status-update-handler.test.ts +11 -16
- package/tests/unit/handlers/list-available-agents-handler.test.ts +11 -14
- package/tests/unit/handlers/list-room-agents-handler.test.ts +11 -15
- package/tests/unit/handlers/room-operation-response-handler.test.ts +9 -6
- package/tests/unit/handlers/trigger-wallet-tx-handler.test.ts +431 -0
- package/tests/unit/managers/admin-manager.test.ts +183 -0
- package/tests/unit/managers/agent-room-manager.test.ts +189 -33
- package/tests/unit/sdk-new-methods.test.ts +221 -0
|
@@ -4,5 +4,5 @@ contact_links:
|
|
|
4
4
|
url: https://discord.com/invite/teneoprotocol
|
|
5
5
|
about: Join our Discord for help and discussions!
|
|
6
6
|
- name: 📚 Documentation
|
|
7
|
-
url: https://teneo-protocol.ai/
|
|
7
|
+
url: https://teneo-protocol.ai/data-access
|
|
8
8
|
about: Find setup guides and learn how to use Teneo SDK
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,349 @@ All notable changes to the Teneo Protocol SDK will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.0.0] - 2026-01-28
|
|
9
|
+
|
|
10
|
+
*Built on top of v2.3.0 multi-network support*
|
|
11
|
+
|
|
12
|
+
## [2.3.0] - 2026-01-28
|
|
13
|
+
|
|
14
|
+
### ✨ Multi-Network Payment Support with Dynamic Configuration
|
|
15
|
+
|
|
16
|
+
The SDK now supports USDC payments across multiple EVM networks with **dynamic configuration fetched from the backend**. Network configurations are no longer hardcoded, enabling the protocol to add new networks without SDK updates.
|
|
17
|
+
|
|
18
|
+
#### 🎯 Per-Request Network Override
|
|
19
|
+
|
|
20
|
+
Send commands to different chains from a single SDK instance using the `network` field:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// Pay on Base for this specific command
|
|
24
|
+
await sdk.sendDirectCommand({
|
|
25
|
+
agent: "x-agent-enterprise-v2",
|
|
26
|
+
command: "user @elonmusk",
|
|
27
|
+
room: roomId,
|
|
28
|
+
network: "base", // Per-request network override
|
|
29
|
+
}, true);
|
|
30
|
+
|
|
31
|
+
// Pay on Avalanche for this one
|
|
32
|
+
await sdk.sendDirectCommand({
|
|
33
|
+
agent: "x-agent-enterprise-v2",
|
|
34
|
+
command: "user @elonmusk",
|
|
35
|
+
room: roomId,
|
|
36
|
+
network: "avalanche",
|
|
37
|
+
}, true);
|
|
38
|
+
|
|
39
|
+
// Also works with sendMessage
|
|
40
|
+
await sdk.sendMessage("@X Platform Agent user @elonmusk", {
|
|
41
|
+
room: roomId,
|
|
42
|
+
network: "peaq",
|
|
43
|
+
waitForResponse: true,
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Accepts network name (`"peaq"`, `"base"`, `"avalanche"`) or chain ID (`3338`, `8453`, `43114`). When omitted, falls back to `.withNetwork()` setting, then `TENEO_NETWORK` env var, then PEAQ default.
|
|
48
|
+
|
|
49
|
+
#### 🔄 Dynamic Network Configuration
|
|
50
|
+
|
|
51
|
+
Networks are now fetched from the backend API during SDK initialization:
|
|
52
|
+
|
|
53
|
+
- **Automatic Initialization**: Networks loaded during `connect()` via backend `/api/networks` endpoint
|
|
54
|
+
- **60-Minute Cache**: Network configs cached locally with automatic refresh
|
|
55
|
+
- **Offline Resilience**: Falls back to cached configs if backend temporarily unavailable
|
|
56
|
+
- **Future-Proof**: New networks can be added server-side without SDK changes
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const sdk = new TeneoSDK({
|
|
60
|
+
wsUrl: "wss://teneo.network/ws",
|
|
61
|
+
privateKey: "0x..."
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Networks automatically initialized during connect
|
|
65
|
+
await sdk.connect();
|
|
66
|
+
|
|
67
|
+
// Now network utilities are ready
|
|
68
|
+
const networks = getSupportedNetworks();
|
|
69
|
+
console.log(networks); // Backend-provided network list
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### 🌐 Supported Networks
|
|
73
|
+
|
|
74
|
+
Current networks include (dynamically configured from backend):
|
|
75
|
+
|
|
76
|
+
- **PEAQ Mainnet** (chainId: 3338) - Original network
|
|
77
|
+
- **Base Mainnet** (chainId: 8453) - Layer 2 scaling solution
|
|
78
|
+
- **Avalanche Mainnet** (chainId: 43114) - High-throughput blockchain
|
|
79
|
+
|
|
80
|
+
Each network includes:
|
|
81
|
+
- Network-specific USDC contract addresses
|
|
82
|
+
- Settlement router contracts for x402 v2.5 payments
|
|
83
|
+
- Transfer hook contracts for payment verification
|
|
84
|
+
- EIP-712 signing parameters
|
|
85
|
+
|
|
86
|
+
#### 📦 New Exports
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import {
|
|
90
|
+
// Network utilities (dynamic, populated after connect)
|
|
91
|
+
NETWORKS,
|
|
92
|
+
CHAIN_ID_TO_NETWORK,
|
|
93
|
+
CAIP2_TO_NETWORK,
|
|
94
|
+
getNetwork,
|
|
95
|
+
getDefaultNetwork,
|
|
96
|
+
createChainDefinition,
|
|
97
|
+
isNetworkSupported,
|
|
98
|
+
getSupportedNetworks,
|
|
99
|
+
type NetworkConfig
|
|
100
|
+
} from "@teneo-protocol/sdk";
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### 🔧 Network Configuration API
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// Get network by name
|
|
107
|
+
const peaq = getNetwork("peaq");
|
|
108
|
+
const base = getNetwork("base");
|
|
109
|
+
const avalanche = getNetwork("avalanche");
|
|
110
|
+
|
|
111
|
+
// Get network by chain ID
|
|
112
|
+
const baseNetwork = getNetwork(8453);
|
|
113
|
+
|
|
114
|
+
// Get network by CAIP-2 identifier
|
|
115
|
+
const avaxNetwork = getNetwork("eip155:43114");
|
|
116
|
+
|
|
117
|
+
// Get default network (prefers PEAQ, falls back to first available)
|
|
118
|
+
const defaultNetwork = getDefaultNetwork();
|
|
119
|
+
|
|
120
|
+
// Check if network is supported
|
|
121
|
+
if (isNetworkSupported("base")) {
|
|
122
|
+
// Create chain definition for viem
|
|
123
|
+
const baseChain = createChainDefinition(base);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Get all supported networks
|
|
127
|
+
const allNetworks = getSupportedNetworks();
|
|
128
|
+
console.log(allNetworks); // e.g., ["peaq", "base", "avalanche"]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### 🔐 Settlement Router Integration (x402 v2.5)
|
|
132
|
+
|
|
133
|
+
Payment quotes now include settlement router fields for enhanced transaction routing:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// Request a quote
|
|
137
|
+
const quote = await sdk.requestQuote("Analyze this data", "room-id");
|
|
138
|
+
|
|
139
|
+
// Quote includes settlement router information
|
|
140
|
+
console.log(quote.data.settlement_router); // Router contract address
|
|
141
|
+
console.log(quote.data.salt); // Unique salt for transaction
|
|
142
|
+
console.log(quote.data.facilitator_fee); // Facilitator fee amount
|
|
143
|
+
console.log(quote.data.hook); // Transfer hook address
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### 💰 Network-Aware Payment Configuration
|
|
147
|
+
|
|
148
|
+
The `PaymentClient` automatically uses the correct network configuration:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { PaymentClient, getNetwork } from "@teneo-protocol/sdk";
|
|
152
|
+
|
|
153
|
+
// Payment client uses dynamically configured networks
|
|
154
|
+
const paymentClient = new PaymentClient({
|
|
155
|
+
privateKey: "0x...",
|
|
156
|
+
wsUrl: "wss://teneo.network/ws"
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Network selection happens automatically based on agent capabilities
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### 🛠️ New Diagnostic Scripts
|
|
163
|
+
|
|
164
|
+
Four new diagnostic scripts added to help debug network and payment issues:
|
|
165
|
+
|
|
166
|
+
- `scripts/diagnose-connection.ts` - Connection health diagnostics
|
|
167
|
+
- `scripts/investigate-payload.ts` - Payment payload inspection
|
|
168
|
+
- `scripts/list-agents.ts` - List all available agents
|
|
169
|
+
- `scripts/live-multi-network-test.ts` - Multi-network payment testing
|
|
170
|
+
|
|
171
|
+
#### ⚠️ Breaking Changes
|
|
172
|
+
|
|
173
|
+
- **Network initialization required**: `NETWORKS` is empty until `connect()` completes
|
|
174
|
+
- **Backend dependency**: SDK requires backend to be reachable during `connect()` (falls back to cache for subsequent reconnects)
|
|
175
|
+
- **Settlement router fields**: TaskQuote messages now have required `settlement_router`, `salt`, `facilitator_fee`, and `hook` fields
|
|
176
|
+
|
|
177
|
+
#### 🔄 Backward Compatibility
|
|
178
|
+
|
|
179
|
+
All existing code continues to work! The SDK defaults to PEAQ network if no network is specified. Legacy exports like `PEAQ_CHAIN_ID` and `USDC_CONTRACT` are maintained for backward compatibility.
|
|
180
|
+
|
|
181
|
+
#### 📚 Migration Notes
|
|
182
|
+
|
|
183
|
+
No code changes required for most users. Networks are initialized automatically during `connect()`. If you were accessing `NETWORKS` directly before `connect()`, ensure you do so after:
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// ❌ Before connect - NETWORKS is empty
|
|
187
|
+
console.log(NETWORKS); // {}
|
|
188
|
+
|
|
189
|
+
await sdk.connect();
|
|
190
|
+
|
|
191
|
+
// ✅ After connect - NETWORKS is populated
|
|
192
|
+
console.log(NETWORKS); // { peaq: {...}, base: {...}, ... }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## [3.0.0] - 2026-01-28
|
|
198
|
+
|
|
199
|
+
### 🎉 Major Release: API Naming Improvements
|
|
200
|
+
|
|
201
|
+
Version 3.0 introduces comprehensive naming improvements to make the SDK API more intuitive and explicit. All renamed methods include deprecated aliases for backward compatibility during migration.
|
|
202
|
+
|
|
203
|
+
### 💥 Breaking Changes
|
|
204
|
+
|
|
205
|
+
#### Room Subscription Clarity
|
|
206
|
+
|
|
207
|
+
**Before:**
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
const sdk = new TeneoSDK({
|
|
211
|
+
autoJoinRooms: ["room-1", "room-2"]
|
|
212
|
+
});
|
|
213
|
+
await sdk.subscribeToRoom("room-id");
|
|
214
|
+
await sdk.unsubscribeFromRoom("room-id");
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**After (v3.0):**
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
const sdk = new TeneoSDK({
|
|
221
|
+
autoJoinPublicRooms: ["room-1", "room-2"] // Explicit: only public rooms
|
|
222
|
+
});
|
|
223
|
+
await sdk.subscribeToPublicRoom("room-id"); // Explicit: only works for public rooms
|
|
224
|
+
await sdk.unsubscribeFromPublicRoom("room-id"); // Private rooms are auto-available
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Why:** These methods only work with public rooms. Private rooms are automatically available after authentication. The new names make this distinction explicit.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
#### Cache-Only Methods Now Explicit
|
|
232
|
+
|
|
233
|
+
**Before:**
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const agents = sdk.getRoomAgents("room-123"); // Unclear: cache or fetch?
|
|
237
|
+
const available = sdk.getAvailableAgents("room-123"); // Unclear: cache or fetch?
|
|
238
|
+
const count = sdk.getRoomAgentCount("room-123"); // Returns undefined if not cached
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**After (v3.0):**
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
const agents = sdk.getCachedRoomAgents("room-123"); // Clear: cache-only
|
|
245
|
+
const available = sdk.getCachedAvailableAgents("room-123"); // Clear: cache-only
|
|
246
|
+
const count = sdk.getCachedRoomAgentCount("room-123"); // Clear: cache-only
|
|
247
|
+
|
|
248
|
+
// Async methods unchanged (still fetch from server):
|
|
249
|
+
await sdk.listRoomAgents("room-123"); // Still async fetch
|
|
250
|
+
await sdk.listAvailableAgents("room-123"); // Still async fetch
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Why:** Method names now clearly indicate sync (cache-only) vs async (server fetch) behavior.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
#### Boolean Method Semantic Clarity
|
|
258
|
+
|
|
259
|
+
**Before:**
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
const result = sdk.isAgentInRoom("room-123", "agent-456");
|
|
263
|
+
// Returns: boolean | undefined (but 'is*' implies boolean-only)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**After (v3.0):**
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
const result = sdk.checkAgentInRoom("room-123", "agent-456");
|
|
270
|
+
// Returns: boolean | undefined (name doesn't mislead about return type)
|
|
271
|
+
// - true: agent IS in room (verified)
|
|
272
|
+
// - false: agent is NOT in room (verified)
|
|
273
|
+
// - undefined: cache unavailable (need to fetch)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Why:** `is*` naming convention implies boolean-only return. `check*` makes it clear the method may return multiple states.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
#### Network-Wide Search Scope Clarity
|
|
281
|
+
|
|
282
|
+
**Before:**
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
const agents = sdk.findAgentsByCapability("weather"); // Unclear: what scope?
|
|
286
|
+
const results = sdk.findAgentsByName("bot"); // All agents? Room agents?
|
|
287
|
+
const online = sdk.findAgentsByStatus("online"); // Which agents?
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**After (v3.0):**
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
const agents = sdk.findAvailableAgentsByCapability("weather"); // Clear: all available agents
|
|
294
|
+
const results = sdk.findAvailableAgentsByName("bot"); // Clear: network-wide search
|
|
295
|
+
const online = sdk.findAvailableAgentsByStatus("online"); // Clear: all available agents
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Why:** These methods search ALL available agents network-wide, not just room-specific agents. The new names make this scope explicit.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
### 🔄 Migration Guide
|
|
303
|
+
|
|
304
|
+
**All old method names are deprecated but still work!** You'll see deprecation warnings in TypeScript/JSDoc. Update at your convenience:
|
|
305
|
+
|
|
306
|
+
1. **Search & Replace** across your codebase:
|
|
307
|
+
- `autoJoinRooms:` → `autoJoinPublicRooms:`
|
|
308
|
+
- `.subscribeToRoom(` → `.subscribeToPublicRoom(`
|
|
309
|
+
- `.unsubscribeFromRoom(` → `.unsubscribeFromPublicRoom(`
|
|
310
|
+
- `.getRoomAgents(` → `.getCachedRoomAgents(`
|
|
311
|
+
- `.getAvailableAgents(` → `.getCachedAvailableAgents(`
|
|
312
|
+
- `.getRoomAgentCount(` → `.getCachedRoomAgentCount(`
|
|
313
|
+
- `.isAgentInRoom(` → `.checkAgentInRoom(`
|
|
314
|
+
- `.findAgentsByCapability(` → `.findAvailableAgentsByCapability(`
|
|
315
|
+
- `.findAgentsByName(` → `.findAvailableAgentsByName(`
|
|
316
|
+
- `.findAgentsByStatus(` → `.findAvailableAgentsByStatus(`
|
|
317
|
+
|
|
318
|
+
2. **Update TypeScript types** if you reference them directly
|
|
319
|
+
|
|
320
|
+
3. **Test thoroughly** - all functionality remains the same, only names changed
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
### ✨ Summary of Changes
|
|
325
|
+
|
|
326
|
+
- **6 major naming improvements** for clarity and consistency
|
|
327
|
+
- **All old names deprecated** with helpful migration messages
|
|
328
|
+
- **Zero functional changes** - only naming improvements
|
|
329
|
+
- **Backward compatible** - old names still work via aliases
|
|
330
|
+
- **All documentation updated** - README, CONCEPTS, examples
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## [2.2.2]
|
|
335
|
+
|
|
336
|
+
### 🐛 Fixed
|
|
337
|
+
|
|
338
|
+
- Added minimal-chat example for quick SDK testing
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## [2.2.1]
|
|
343
|
+
|
|
344
|
+
### 🐛 Fixed Issues
|
|
345
|
+
|
|
346
|
+
- Fixed `getRooms()`/`getRoom()` race condition after connect
|
|
347
|
+
- Fixed `room_list_response` message type to match backend
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
8
351
|
## [2.2.0]
|
|
9
352
|
|
|
10
353
|
### Quote-Approve Payment Flow
|
|
@@ -43,6 +386,14 @@ Payments now use a quote-approve model. Instead of attaching payments blindly, t
|
|
|
43
386
|
- Payment client is set up automatically when `privateKey` is provided
|
|
44
387
|
- `withPayments()` builder no longer has `enabled` option
|
|
45
388
|
|
|
389
|
+
### ⚠️ Breaking Changes
|
|
390
|
+
|
|
391
|
+
- `paymentsEnabled` config option removed — payments are always enabled when `privateKey` is provided
|
|
392
|
+
- `validatePrice()` method removed — price validation now happens in `confirmQuote`
|
|
393
|
+
- `attachPayment()` method removed — payment attachment now happens in `confirmQuote`
|
|
394
|
+
- `setAgentRegistry()` method removed — no longer needed
|
|
395
|
+
- `withPayments()` builder no longer accepts `enabled` option
|
|
396
|
+
|
|
46
397
|
### 🗑️ Removed
|
|
47
398
|
|
|
48
399
|
- `paymentsEnabled` config option (payments always on)
|
|
@@ -60,13 +411,13 @@ Payments now use a quote-approve model. Instead of attaching payments blindly, t
|
|
|
60
411
|
|
|
61
412
|
## [2.1.0] - 2025-12-08
|
|
62
413
|
|
|
63
|
-
### ✨ Added
|
|
414
|
+
### ✨ Added Features
|
|
64
415
|
|
|
65
416
|
#### Automatic X402 Payment Signing
|
|
66
417
|
|
|
67
418
|
- SDK now auto-signs x402 payment headers when confirming tasks
|
|
68
419
|
- Uses PEAQ chain with USDC stablecoin for micropayments
|
|
69
|
-
- No manual payment encoding needed - just call `
|
|
420
|
+
- No manual payment encoding needed - just call `confirmQuote(taskId)`
|
|
70
421
|
|
|
71
422
|
### 📦 Dependencies
|
|
72
423
|
|
|
@@ -80,12 +431,12 @@ Payments now use a quote-approve model. Instead of attaching payments blindly, t
|
|
|
80
431
|
|
|
81
432
|
Version 2.0 introduces comprehensive room management and per-room agent customization capabilities, enabling developers to create context-specific agent experiences.
|
|
82
433
|
|
|
83
|
-
### ✨ Added
|
|
434
|
+
### ✨ Added Feature
|
|
84
435
|
|
|
85
436
|
#### Phase 1: Room Management System
|
|
86
437
|
|
|
87
438
|
- **Room CRUD Operations**
|
|
88
|
-
- `createRoom(name, description?)` - Create new
|
|
439
|
+
- `createRoom({ name, description?, isPublic? })` - Create new rooms with validation
|
|
89
440
|
- `updateRoom(roomId, updates)` - Update room name/description (owner only)
|
|
90
441
|
- `deleteRoom(roomId)` - Delete owned rooms
|
|
91
442
|
|
|
@@ -93,7 +444,7 @@ Version 2.0 introduces comprehensive room management and per-room agent customiz
|
|
|
93
444
|
- `getOwnedRooms()` - Get all rooms you created
|
|
94
445
|
- `getSharedRooms()` - Get rooms you were invited to
|
|
95
446
|
- `getAllRooms()` - Get all rooms (owned + shared) convenience method
|
|
96
|
-
- `
|
|
447
|
+
- `getRoom(roomId)` - Get specific room details
|
|
97
448
|
- `getRoomLimit()` - Check your room creation limit
|
|
98
449
|
- `canCreateRoom()` - Check if you can create more rooms
|
|
99
450
|
- `getOwnedRoomCount()` - Count your owned rooms
|
|
@@ -122,10 +473,10 @@ Version 2.0 introduces comprehensive room management and per-room agent customiz
|
|
|
122
473
|
- `listAvailableAgents(roomId, useCache?)` - List agents available to add
|
|
123
474
|
|
|
124
475
|
- **Agent Room Query Methods (Synchronous)**
|
|
125
|
-
- `
|
|
126
|
-
- `
|
|
127
|
-
- `
|
|
128
|
-
- `
|
|
476
|
+
- `getCachedRoomAgents(roomId)` - Get cached room agents instantly
|
|
477
|
+
- `getCachedAvailableAgents(roomId)` - Get cached available agents instantly
|
|
478
|
+
- `checkAgentInRoom(roomId, agentId)` - Check if agent is in room (cached)
|
|
479
|
+
- `getCachedRoomAgentCount(roomId)` - Get agent count from cache
|
|
129
480
|
|
|
130
481
|
- **Cache Management**
|
|
131
482
|
- `invalidateAgentRoomCache(roomId)` - Manually clear cache for specific room
|
|
@@ -171,13 +522,13 @@ Version 2.0 introduces comprehensive room management and per-room agent customiz
|
|
|
171
522
|
- Comprehensive coverage of agent room management
|
|
172
523
|
- All manager and handler tests passing
|
|
173
524
|
|
|
174
|
-
### 🔄 Changed
|
|
525
|
+
### 🔄 Changed Features
|
|
175
526
|
|
|
176
527
|
- Message handlers now use `BaseMessageHandler` pattern
|
|
177
528
|
- Enhanced event system with 14 new event types
|
|
178
529
|
- WebSocketClient now manages room and agent-room managers
|
|
179
530
|
|
|
180
|
-
### 🐛 Fixed
|
|
531
|
+
### 🐛 Fixed Issue
|
|
181
532
|
|
|
182
533
|
- Schema field names now match backend source of truth
|
|
183
534
|
- Proper defensive copying for cache immutability
|
|
@@ -187,7 +538,7 @@ Version 2.0 introduces comprehensive room management and per-room agent customiz
|
|
|
187
538
|
- Room management events now properly forward from WebSocket handlers to SDK instance
|
|
188
539
|
- Room persistence: Private rooms now correctly persist after page refresh via proper initialization of RoomManagementManager from auth state
|
|
189
540
|
|
|
190
|
-
### 📚 Documentation
|
|
541
|
+
### 📚 Documentation Updates
|
|
191
542
|
|
|
192
543
|
- Comprehensive README updates with v2.0 features
|
|
193
544
|
- New "What's New in v2.0" section
|
|
@@ -261,14 +612,14 @@ pnpm install @teneo-protocol/sdk@2.0.0
|
|
|
261
612
|
**Before (v1.x):** Single room subscription
|
|
262
613
|
|
|
263
614
|
```typescript
|
|
264
|
-
await sdk.
|
|
615
|
+
await sdk.subscribeToPublicRoom("room-id");
|
|
265
616
|
```
|
|
266
617
|
|
|
267
618
|
**After (v2.0):** Create and manage multiple rooms
|
|
268
619
|
|
|
269
620
|
```typescript
|
|
270
621
|
// Create your own rooms
|
|
271
|
-
const room = await sdk.createRoom("My Room", "Description");
|
|
622
|
+
const room = await sdk.createRoom({ name: "My Room", description: "Description" });
|
|
272
623
|
|
|
273
624
|
// Get all your rooms
|
|
274
625
|
const ownedRooms = sdk.getOwnedRooms();
|
|
@@ -321,7 +672,7 @@ All v1.x APIs continue to work:
|
|
|
321
672
|
|
|
322
673
|
- ✅ `connect()`, `disconnect()`
|
|
323
674
|
- ✅ `sendMessage()`
|
|
324
|
-
- ✅ `
|
|
675
|
+
- ✅ `subscribeToPublicRoom()`, `unsubscribeFromPublicRoom()`
|
|
325
676
|
- ✅ `getAgents()`, `getAgent()`
|
|
326
677
|
- ✅ All existing events
|
|
327
678
|
|