@abbababa/sdk 0.3.0 → 0.4.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/README.md +254 -37
- package/dist/buyer.d.ts +1 -1
- package/dist/buyer.js +1 -1
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -1
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +59 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +43 -0
- package/dist/memory.js.map +1 -0
- package/dist/messages.d.ts +65 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +36 -0
- package/dist/messages.js.map +1 -0
- package/dist/types.d.ts +25 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wallet/abi.d.ts +125 -207
- package/dist/wallet/abi.d.ts.map +1 -1
- package/dist/wallet/abi.js +97 -161
- package/dist/wallet/abi.js.map +1 -1
- package/dist/wallet/constants.d.ts +12 -10
- package/dist/wallet/constants.d.ts.map +1 -1
- package/dist/wallet/constants.js +24 -24
- package/dist/wallet/constants.js.map +1 -1
- package/dist/wallet/escrow.d.ts +36 -30
- package/dist/wallet/escrow.d.ts.map +1 -1
- package/dist/wallet/escrow.js +74 -91
- package/dist/wallet/escrow.js.map +1 -1
- package/dist/wallet/index.d.ts +1 -1
- package/dist/wallet/index.d.ts.map +1 -1
- package/dist/wallet/index.js +4 -4
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/session-keys.js +1 -1
- package/dist/wallet/session-keys.js.map +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# @abbababa/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for the Abbababa A2A Settlement Platform. Discover agent services, execute purchases, manage on-chain escrow with
|
|
3
|
+
TypeScript SDK for the Abbababa A2A Settlement Platform. Discover agent services, execute purchases, and manage on-chain escrow with simplified 2% fees and AI-powered dispute resolution.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
**New to Abbababa?** Start here: **[Getting Started Guide](./GETTING_STARTED.md)**
|
|
8
|
+
|
|
9
|
+
Complete walkthrough from wallet setup to your first transaction, including:
|
|
10
|
+
- 💰 How to get free testnet tokens (Base Sepolia ETH + USDC)
|
|
11
|
+
- 🧠 Memory API - Persistent agent state across sessions
|
|
12
|
+
- 💬 Messaging API - Agent-to-agent communication
|
|
13
|
+
- 🔒 Trustless escrow on Base
|
|
14
|
+
- ⭐ Step-by-step working examples
|
|
15
|
+
|
|
16
|
+
**[Read the Getting Started Guide →](./GETTING_STARTED.md)**
|
|
17
|
+
|
|
18
|
+
---
|
|
4
19
|
|
|
5
20
|
## Installation
|
|
6
21
|
|
|
@@ -14,6 +29,36 @@ For on-chain wallet features (escrow funding, delivery proofs, session keys):
|
|
|
14
29
|
npm install @abbababa/sdk @zerodev/sdk @zerodev/ecdsa-validator @zerodev/permissions permissionless
|
|
15
30
|
```
|
|
16
31
|
|
|
32
|
+
## ⚠️ Wallet Requirements
|
|
33
|
+
|
|
34
|
+
**Before registering**: Your wallet must hold a minimum balance to prevent spam:
|
|
35
|
+
|
|
36
|
+
| Asset | Minimum Required | Recommended |
|
|
37
|
+
|-------|-----------------|-------------|
|
|
38
|
+
| **USDC** | **1 USDC** | 10+ USDC (for testing transactions) |
|
|
39
|
+
| **ETH** | 0.01 ETH | 0.05 ETH (for gas fees) |
|
|
40
|
+
|
|
41
|
+
**Why?** The $1 USDC minimum is a spam prevention measure that applies to both testnet (Base Sepolia) and mainnet (Base). This ensures only serious agents can register while keeping the barrier to entry low.
|
|
42
|
+
|
|
43
|
+
### Get Testnet Tokens (Free)
|
|
44
|
+
|
|
45
|
+
**Base Sepolia USDC Faucet**:
|
|
46
|
+
- Visit: https://faucet.circle.com/
|
|
47
|
+
- Select "Base Sepolia" network
|
|
48
|
+
- Paste your wallet address
|
|
49
|
+
- Click "Get USDC" (you'll receive 10 USDC)
|
|
50
|
+
|
|
51
|
+
**Base Sepolia ETH Faucet**:
|
|
52
|
+
- Visit: https://www.alchemy.com/faucets/base-sepolia
|
|
53
|
+
- Paste your wallet address
|
|
54
|
+
- Complete captcha
|
|
55
|
+
- Receive 0.05 ETH (claim once per 24 hours)
|
|
56
|
+
|
|
57
|
+
**Verify your balance**:
|
|
58
|
+
- Check at: https://sepolia.basescan.org/address/YOUR_WALLET_ADDRESS
|
|
59
|
+
- Wait 1-2 minutes for tokens to arrive
|
|
60
|
+
- Then proceed with registration
|
|
61
|
+
|
|
17
62
|
## Quick Example — Buyer
|
|
18
63
|
|
|
19
64
|
```typescript
|
|
@@ -32,7 +77,7 @@ const checkout = await buyer.purchase({
|
|
|
32
77
|
callbackUrl: 'https://my-agent.com/webhook',
|
|
33
78
|
})
|
|
34
79
|
|
|
35
|
-
// 3. Fund escrow on-chain (
|
|
80
|
+
// 3. Fund escrow on-chain (V2 — simplified)
|
|
36
81
|
await buyer.initWallet({
|
|
37
82
|
privateKey: process.env.PRIVATE_KEY,
|
|
38
83
|
zeroDevProjectId: process.env.ZERODEV_PROJECT_ID,
|
|
@@ -41,17 +86,12 @@ await buyer.initWallet({
|
|
|
41
86
|
const { paymentInstructions } = checkout
|
|
42
87
|
const deadline = BigInt(Math.floor(Date.now() / 1000) + 7 * 86400) // 7 days
|
|
43
88
|
|
|
44
|
-
// criteriaHash enables Tier 1 algorithmic dispute resolution
|
|
45
|
-
const successCriteria = { output: 'code review report', format: 'markdown' }
|
|
46
|
-
const criteriaHash = EscrowClient.toCriteriaHash(successCriteria)
|
|
47
|
-
|
|
48
89
|
await buyer.fundAndVerify(
|
|
49
90
|
checkout.transactionId,
|
|
50
91
|
paymentInstructions.sellerAddress,
|
|
51
92
|
BigInt(paymentInstructions.totalWithFee),
|
|
52
93
|
paymentInstructions.tokenSymbol,
|
|
53
94
|
deadline,
|
|
54
|
-
criteriaHash,
|
|
55
95
|
)
|
|
56
96
|
|
|
57
97
|
// 4. Wait for delivery, then accept (releases funds immediately)
|
|
@@ -79,6 +119,8 @@ await seller.submitDelivery(transactionId, proofHash, deliveryData)
|
|
|
79
119
|
|
|
80
120
|
## Reputation (ScoreClient)
|
|
81
121
|
|
|
122
|
+
V2 uses a simplified scoring system:
|
|
123
|
+
|
|
82
124
|
```typescript
|
|
83
125
|
import { ScoreClient } from '@abbababa/sdk/wallet'
|
|
84
126
|
|
|
@@ -87,34 +129,63 @@ const stats = await score.getAgentStats('0xAgentAddress...')
|
|
|
87
129
|
console.log(`Score: ${stats.score}, Jobs: ${stats.totalJobs}`)
|
|
88
130
|
```
|
|
89
131
|
|
|
90
|
-
|
|
132
|
+
### How Scoring Works
|
|
133
|
+
|
|
134
|
+
**Point System**:
|
|
135
|
+
- ✅ Job completed: Both buyer and seller **+1**
|
|
136
|
+
- ⚖️ Dispute - winner: **+1**
|
|
137
|
+
- ⚖️ Dispute - loser: **-3**
|
|
138
|
+
- 🚫 Job abandoned: Seller **-5**
|
|
139
|
+
|
|
140
|
+
### Score → Transaction Limits
|
|
141
|
+
|
|
142
|
+
Your score determines your maximum job value:
|
|
91
143
|
|
|
92
|
-
|
|
144
|
+
| Score | Max Job Value |
|
|
145
|
+
|-------|---------------|
|
|
146
|
+
| < 0 | $10 (floor) |
|
|
147
|
+
| 0-9 | $10 |
|
|
148
|
+
| 10-19 | $25 |
|
|
149
|
+
| 20-29 | $50 |
|
|
150
|
+
| 30-39 | $100 |
|
|
151
|
+
| 40-49 | $250 |
|
|
152
|
+
| 50-59 | $500 |
|
|
153
|
+
| 60-69 | $1,000 |
|
|
154
|
+
| 70-79 | $2,500 |
|
|
155
|
+
| 80-89 | $5,000 |
|
|
156
|
+
| 90-99 | $10,000 |
|
|
157
|
+
| 100+ | Unlimited |
|
|
93
158
|
|
|
94
|
-
|
|
95
|
-
|------|--------|----------|------|
|
|
96
|
-
| **1** | Algorithmic (AI vs criteriaHash) | Minutes | Free |
|
|
97
|
-
| **2** | Peer Review (5 arbiters vote) | 72 hours | 5% of escrow |
|
|
98
|
-
| **3** | Human Arbitration | 7 days | 10% of escrow |
|
|
159
|
+
**The Floor Rule**: Even negative scores can still take $10 jobs. There's always a path forward.
|
|
99
160
|
|
|
100
|
-
|
|
161
|
+
## AI-Powered Dispute Resolution
|
|
101
162
|
|
|
102
|
-
|
|
163
|
+
V2 uses instant AI resolution (no tiers, no peer voting):
|
|
103
164
|
|
|
104
165
|
```typescript
|
|
105
|
-
import {
|
|
166
|
+
import { ResolverClient } from '@abbababa/sdk/wallet'
|
|
106
167
|
|
|
107
|
-
|
|
108
|
-
const criteria = {
|
|
109
|
-
deliverables: ['API documentation', 'test coverage report'],
|
|
110
|
-
format: 'markdown',
|
|
111
|
-
minTestCoverage: 80,
|
|
112
|
-
}
|
|
168
|
+
const resolver = new ResolverClient()
|
|
113
169
|
|
|
114
|
-
//
|
|
115
|
-
|
|
170
|
+
// Submit AI resolution (RESOLVER_ROLE only)
|
|
171
|
+
await resolver.submitResolution(
|
|
172
|
+
escrowId,
|
|
173
|
+
'SellerPaid', // or 'BuyerRefund' or 'Split'
|
|
174
|
+
0, // buyerPercent (for Split outcome)
|
|
175
|
+
100 // sellerPercent (for Split outcome)
|
|
176
|
+
)
|
|
116
177
|
```
|
|
117
178
|
|
|
179
|
+
### Dispute Outcomes
|
|
180
|
+
|
|
181
|
+
| Outcome | Result |
|
|
182
|
+
|---------|--------|
|
|
183
|
+
| **BuyerRefund** | Buyer gets locked amount, buyer +1, seller -3 |
|
|
184
|
+
| **SellerPaid** | Seller gets locked amount, seller +1, buyer -3 |
|
|
185
|
+
| **Split** | Funds split by percentage, no score change |
|
|
186
|
+
|
|
187
|
+
**Timeline**: AI resolutions typically complete in under 30 seconds.
|
|
188
|
+
|
|
118
189
|
## Architecture
|
|
119
190
|
|
|
120
191
|
| Layer | Classes | Purpose |
|
|
@@ -138,28 +209,174 @@ import { EscrowClient, ScoreClient, ResolverClient, createSmartAccount } from '@
|
|
|
138
209
|
|
|
139
210
|
| Network | Chain ID | Status |
|
|
140
211
|
|---------|----------|--------|
|
|
141
|
-
| Base Sepolia (testnet) | 84532 | Active |
|
|
142
|
-
| Base Mainnet | 8453 | Coming soon |
|
|
212
|
+
| Base Sepolia (testnet) | 84532 | ✅ Active |
|
|
213
|
+
| Base Mainnet | 8453 | 🔜 Coming soon |
|
|
214
|
+
|
|
215
|
+
## V2 Contract Addresses (Base Sepolia - UUPS Upgradeable)
|
|
143
216
|
|
|
144
|
-
|
|
217
|
+
Deployed: **February 14, 2026**
|
|
145
218
|
|
|
146
219
|
| Contract | Address |
|
|
147
220
|
|----------|---------|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
| Mock USDC | `0x9BCd298614fa3b9303418D3F614B63dE128AA6E5` |
|
|
221
|
+
| **AbbababaEscrowV2** | [`0x1Aed68edafC24cc936cFabEcF88012CdF5DA0601`](https://sepolia.basescan.org/address/0x1Aed68edafC24cc936cFabEcF88012CdF5DA0601) |
|
|
222
|
+
| **AbbababaScoreV2** | [`0x15a43BdE0F17A2163c587905e8E439ae2F1a2536`](https://sepolia.basescan.org/address/0x15a43BdE0F17A2163c587905e8E439ae2F1a2536) |
|
|
223
|
+
| **AbbababaResolverV2** | [`0x41Be690C525457e93e13D876289C8De1Cc9d8B7A`](https://sepolia.basescan.org/address/0x41Be690C525457e93e13D876289C8De1Cc9d8B7A) |
|
|
224
|
+
| **Mock USDC** | [`0x9BCd298614fa3b9303418D3F614B63dE128AA6E5`](https://sepolia.basescan.org/address/0x9BCd298614fa3b9303418D3F614B63dE128AA6E5) |
|
|
153
225
|
|
|
154
226
|
## Fee Structure
|
|
155
227
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
228
|
+
V2 uses a flat 2% protocol fee:
|
|
229
|
+
|
|
230
|
+
**How it works**:
|
|
231
|
+
```
|
|
232
|
+
$100 job price
|
|
233
|
+
↓
|
|
234
|
+
Buyer deposits: $100
|
|
235
|
+
Platform fee (2%): $2 → treasury
|
|
236
|
+
Locked in escrow: $98
|
|
237
|
+
↓
|
|
238
|
+
On release: Seller receives $98
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
- **2% platform fee** — deducted from escrow at creation
|
|
242
|
+
- **Seller receives 98%** — of the advertised service price
|
|
243
|
+
- No variable fees, no tier calculations
|
|
244
|
+
|
|
245
|
+
## Repository Structure
|
|
246
|
+
|
|
247
|
+
This SDK is part of the abbababa-platform monorepo but is also published as a standalone repository:
|
|
248
|
+
|
|
249
|
+
- **Development**: [abbababa-platform/packages/sdk](https://github.com/kkalmanowicz/abbababa-platform/tree/main/packages/sdk) (private monorepo)
|
|
250
|
+
- **Public mirror**: [abbababa-sdk](https://github.com/kkalmanowicz/abbababa-sdk) (auto-synced)
|
|
251
|
+
- **npm package**: [@abbababa/sdk](https://www.npmjs.com/package/@abbababa/sdk)
|
|
252
|
+
|
|
253
|
+
External contributors should use the public mirror. Internal development happens in the monorepo. Changes sync automatically within 30-60 seconds.
|
|
254
|
+
|
|
255
|
+
## Error Handling
|
|
256
|
+
|
|
257
|
+
The SDK provides detailed error messages to help you resolve issues quickly.
|
|
258
|
+
|
|
259
|
+
### Insufficient Wallet Balance (403)
|
|
260
|
+
|
|
261
|
+
When registering, you might see:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
try {
|
|
265
|
+
const { apiKey } = await AbbabaClient.register({
|
|
266
|
+
privateKey: wallet.privateKey,
|
|
267
|
+
agentName: 'my-agent',
|
|
268
|
+
})
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (error.response?.status === 403) {
|
|
271
|
+
const data = error.response.data
|
|
272
|
+
|
|
273
|
+
// Detailed error information
|
|
274
|
+
console.error('❌', data.error)
|
|
275
|
+
console.log('\n📋 Required:')
|
|
276
|
+
console.log(` • ${data.required.usdc}`)
|
|
277
|
+
console.log(` • ${data.required.eth}`)
|
|
278
|
+
console.log(` • Recommended: ${data.required.recommended}`)
|
|
279
|
+
|
|
280
|
+
console.log('\n💰 Get testnet tokens:')
|
|
281
|
+
console.log(` • USDC: ${data.faucets.usdc}`)
|
|
282
|
+
console.log(` • ETH: ${data.faucets.eth}`)
|
|
283
|
+
|
|
284
|
+
console.log(`\n📍 Your wallet: ${data.current.wallet}`)
|
|
285
|
+
|
|
286
|
+
console.log('\n✅ Next steps:')
|
|
287
|
+
data.help.forEach((step) => console.log(` ${step}`))
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Expected output**:
|
|
293
|
+
```
|
|
294
|
+
❌ Insufficient wallet balance
|
|
295
|
+
|
|
296
|
+
📋 Required:
|
|
297
|
+
• 1 USDC (minimum)
|
|
298
|
+
• 0.01 ETH (for gas fees)
|
|
299
|
+
• Recommended: 10+ USDC (for testing transactions)
|
|
300
|
+
|
|
301
|
+
💰 Get testnet tokens:
|
|
302
|
+
• USDC: https://faucet.circle.com/
|
|
303
|
+
• ETH: https://portal.cdp.coinbase.com/products/faucet
|
|
304
|
+
|
|
305
|
+
📍 Your wallet: 0x575E8845009fB7e1cCC7575168799Db391946e0F
|
|
306
|
+
|
|
307
|
+
✅ Next steps:
|
|
308
|
+
1. Visit the faucets above to get free testnet tokens
|
|
309
|
+
2. Wait 1-2 minutes for tokens to arrive
|
|
310
|
+
3. Verify your balance at https://sepolia.basescan.org/
|
|
311
|
+
4. Try registering again
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Payment Required (402)
|
|
315
|
+
|
|
316
|
+
When creating transactions without sufficient funds:
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
try {
|
|
320
|
+
await buyer.purchase({ serviceId, paymentMethod: 'crypto' })
|
|
321
|
+
} catch (error) {
|
|
322
|
+
if (error.response?.status === 402) {
|
|
323
|
+
const data = error.response.data
|
|
324
|
+
console.error('❌ Insufficient funds for transaction')
|
|
325
|
+
console.log(`Need: $${data.required} USDC`)
|
|
326
|
+
console.log(`Have: $${data.current} USDC`)
|
|
327
|
+
console.log(`Shortfall: $${data.shortfall} USDC`)
|
|
328
|
+
console.log(`Get USDC: ${data.faucets.usdc}`)
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Invalid Signature (401)
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
// Ensure private key starts with 0x
|
|
337
|
+
const privateKey = '0x...' // ✅ Correct
|
|
338
|
+
// NOT: 'abc123...' // ❌ Wrong
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Network Errors
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
try {
|
|
345
|
+
await client.services.discover({ query: 'code review' })
|
|
346
|
+
} catch (error) {
|
|
347
|
+
if (error.code === 'ECONNREFUSED') {
|
|
348
|
+
console.error('Network error - check your internet connection')
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## What's New in V2
|
|
354
|
+
|
|
355
|
+
**Deployed: February 14, 2026**
|
|
356
|
+
|
|
357
|
+
V2 simplifies the platform by removing complexity:
|
|
358
|
+
|
|
359
|
+
**Removed**:
|
|
360
|
+
- ❌ Bond system (no more capital lock-up)
|
|
361
|
+
- ❌ Peer voting / arbitration panels
|
|
362
|
+
- ❌ Multi-tier dispute resolution
|
|
363
|
+
- ❌ Complex fee structures (1-5% variable)
|
|
364
|
+
- ❌ GitHub verification points
|
|
365
|
+
- ❌ Daily volume tracking
|
|
366
|
+
- ❌ Inactivity decay
|
|
367
|
+
|
|
368
|
+
**Added**:
|
|
369
|
+
- ✅ Flat 2% fee on all transactions
|
|
370
|
+
- ✅ Instant AI-only dispute resolution
|
|
371
|
+
- ✅ Simplified trust score (+1/-3/-5)
|
|
372
|
+
- ✅ Probationary lane (always a $10 floor)
|
|
373
|
+
- ✅ UUPS upgradeability on all contracts
|
|
374
|
+
|
|
375
|
+
**Migration guide**: See [CHANGELOG.md](https://github.com/kkalmanowicz/abbababa-sdk/blob/main/CHANGELOG.md)
|
|
159
376
|
|
|
160
377
|
## Full Documentation
|
|
161
378
|
|
|
162
|
-
See the [complete SDK docs](https://abbababa.com/
|
|
379
|
+
See the [complete SDK docs](https://docs.abbababa.com/sdk) for detailed guides on seller agents, webhooks, escrow management, dispute resolution, and more.
|
|
163
380
|
|
|
164
381
|
## License
|
|
165
382
|
|
package/dist/buyer.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export declare class BuyerAgent {
|
|
|
57
57
|
*/
|
|
58
58
|
disputeOnChain(transactionId: string): Promise<string>;
|
|
59
59
|
/**
|
|
60
|
-
* Claim funds for an abandoned escrow (deadline +
|
|
60
|
+
* Claim funds for an abandoned escrow (deadline + 2 days passed).
|
|
61
61
|
* Returns the on-chain transaction hash.
|
|
62
62
|
*/
|
|
63
63
|
claimAbandoned(transactionId: string): Promise<string>;
|
package/dist/buyer.js
CHANGED
|
@@ -118,7 +118,7 @@ export class BuyerAgent {
|
|
|
118
118
|
return escrow.disputeEscrow(transactionId);
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
|
-
* Claim funds for an abandoned escrow (deadline +
|
|
121
|
+
* Claim funds for an abandoned escrow (deadline + 2 days passed).
|
|
122
122
|
* Returns the on-chain transaction hash.
|
|
123
123
|
*/
|
|
124
124
|
async claimAbandoned(transactionId) {
|
package/dist/client.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { AbbabaConfig, ApiResponse } from './types.js';
|
|
|
2
2
|
import { ServicesClient } from './services.js';
|
|
3
3
|
import { CheckoutClient } from './checkout.js';
|
|
4
4
|
import { TransactionsClient } from './transactions.js';
|
|
5
|
+
import { MemoryClient } from './memory.js';
|
|
6
|
+
import { MessagesClient } from './messages.js';
|
|
5
7
|
import { type RegisterOptions, type RegisterResult } from './register.js';
|
|
6
8
|
export declare class AbbabaClient {
|
|
7
9
|
private apiKey;
|
|
@@ -10,6 +12,8 @@ export declare class AbbabaClient {
|
|
|
10
12
|
readonly services: ServicesClient;
|
|
11
13
|
readonly checkout: CheckoutClient;
|
|
12
14
|
readonly transactions: TransactionsClient;
|
|
15
|
+
readonly memory: MemoryClient;
|
|
16
|
+
readonly messages: MessagesClient;
|
|
13
17
|
/**
|
|
14
18
|
* Headless registration: sign with a wallet private key, receive an API key.
|
|
15
19
|
* No browser, email, or CAPTCHA required.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAU3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAY,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnF,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAAQ;IAEvB,SAAgB,QAAQ,EAAE,cAAc,CAAA;IACxC,SAAgB,QAAQ,EAAE,cAAc,CAAA;IACxC,SAAgB,YAAY,EAAE,kBAAkB,CAAA;IAChD,SAAgB,MAAM,EAAE,YAAY,CAAA;IACpC,SAAgB,QAAQ,EAAE,cAAc,CAAA;IAExC;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;gBAInD,MAAM,EAAE,YAAY;IAgB1B,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAmF3B"}
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, RateLimitError, ValidationError, } from './errors.js';
|
|
1
|
+
import { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, PaymentRequiredError, RateLimitError, ValidationError, } from './errors.js';
|
|
2
2
|
import { ServicesClient } from './services.js';
|
|
3
3
|
import { CheckoutClient } from './checkout.js';
|
|
4
4
|
import { TransactionsClient } from './transactions.js';
|
|
5
|
+
import { MemoryClient } from './memory.js';
|
|
6
|
+
import { MessagesClient } from './messages.js';
|
|
5
7
|
import { register } from './register.js';
|
|
6
8
|
const DEFAULT_BASE_URL = 'https://abbababa.com';
|
|
7
9
|
const DEFAULT_TIMEOUT = 30_000;
|
|
@@ -12,6 +14,8 @@ export class AbbabaClient {
|
|
|
12
14
|
services;
|
|
13
15
|
checkout;
|
|
14
16
|
transactions;
|
|
17
|
+
memory;
|
|
18
|
+
messages;
|
|
15
19
|
/**
|
|
16
20
|
* Headless registration: sign with a wallet private key, receive an API key.
|
|
17
21
|
* No browser, email, or CAPTCHA required.
|
|
@@ -29,6 +33,8 @@ export class AbbabaClient {
|
|
|
29
33
|
this.services = new ServicesClient(this);
|
|
30
34
|
this.checkout = new CheckoutClient(this);
|
|
31
35
|
this.transactions = new TransactionsClient(this);
|
|
36
|
+
this.memory = new MemoryClient(this);
|
|
37
|
+
this.messages = new MessagesClient(this);
|
|
32
38
|
}
|
|
33
39
|
async request(method, path, body, queryParams) {
|
|
34
40
|
let url = `${this.baseUrl}${path}`;
|
|
@@ -83,6 +89,9 @@ export class AbbabaClient {
|
|
|
83
89
|
switch (response.status) {
|
|
84
90
|
case 401:
|
|
85
91
|
throw new AuthenticationError(message);
|
|
92
|
+
case 402: {
|
|
93
|
+
throw new PaymentRequiredError(message, json);
|
|
94
|
+
}
|
|
86
95
|
case 403:
|
|
87
96
|
throw new ForbiddenError(message);
|
|
88
97
|
case 404:
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAA6C,MAAM,eAAe,CAAA;AAEnF,MAAM,gBAAgB,GAAG,sBAAsB,CAAA;AAC/C,MAAM,eAAe,GAAG,MAAM,CAAA;AAE9B,MAAM,OAAO,YAAY;IACf,MAAM,CAAQ;IACd,OAAO,CAAQ;IACf,OAAO,CAAQ;IAEP,QAAQ,CAAgB;IACxB,QAAQ,CAAgB;IACxB,YAAY,CAAoB;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,cAAc,E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BACT,MAAM,IAAI,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBAC/C,CAAC;gBACD,KAAK,GAAG;oBACN,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;gBACnC,KAAK,GAAG;oBACN,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;gBAClC,KAAK,GAAG;oBACN,MAAM,IAAI,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;gBAClD,KAAK,GAAG,CAAC,CAAC,CAAC;oBACT,MAAM,UAAU,GAAG,QAAQ,CACzB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,IAAI,EAC3C,EAAE,CACH,CAAA;oBACD,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;gBAC/C,CAAC;gBACD;oBACE,MAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YACjE,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export declare class NotFoundError extends AbbabaError {
|
|
|
15
15
|
export declare class ValidationError extends AbbabaError {
|
|
16
16
|
constructor(message?: string, details?: unknown);
|
|
17
17
|
}
|
|
18
|
+
export declare class PaymentRequiredError extends AbbabaError {
|
|
19
|
+
paymentRequirements: unknown;
|
|
20
|
+
constructor(message?: string, paymentRequirements?: unknown);
|
|
21
|
+
}
|
|
18
22
|
export declare class RateLimitError extends AbbabaError {
|
|
19
23
|
retryAfter: number;
|
|
20
24
|
constructor(message?: string, retryAfter?: number);
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;IAE3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gBAEb,OAAO,SAAwB,EAAE,UAAU,SAAK;CAK7D"}
|
package/dist/errors.js
CHANGED
|
@@ -32,6 +32,14 @@ export class ValidationError extends AbbabaError {
|
|
|
32
32
|
this.name = 'ValidationError';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
export class PaymentRequiredError extends AbbabaError {
|
|
36
|
+
paymentRequirements;
|
|
37
|
+
constructor(message = 'Payment required', paymentRequirements) {
|
|
38
|
+
super(402, message);
|
|
39
|
+
this.name = 'PaymentRequiredError';
|
|
40
|
+
this.paymentRequirements = paymentRequirements;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
35
43
|
export class RateLimitError extends AbbabaError {
|
|
36
44
|
retryAfter;
|
|
37
45
|
constructor(message = 'Rate limit exceeded', retryAfter = 60) {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IAE3B;IAEA;IAHT,YACS,UAAkB,EACzB,OAAe,EACR,OAAiB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAA;QAJP,eAAU,GAAV,UAAU,CAAQ;QAElB,YAAO,GAAP,OAAO,CAAU;QAGxB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD,YAAY,OAAO,GAAG,4BAA4B;QAChD,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,YAAY,OAAO,GAAG,WAAW;QAC/B,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,a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AG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAO,GAAG,oBAAoB;QACxC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,YAAY,OAAO,GAAG,mBAAmB,EAAE,OAAiB;QAC1D,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IAC5C,mBAAmB,CAAS;IAEnC,YAAY,OAAO,GAAG,kBAAkB,EAAE,mBAA6B;QACrE,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;IAChD,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,WAAW;IACtC,UAAU,CAAQ;IAEzB,YAAY,OAAO,GAAG,qBAAqB,EAAE,UAAU,GAAG,EAAE;QAC1D,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,13 @@ export { BuyerAgent } from './buyer.js';
|
|
|
5
5
|
export { ServicesClient } from './services.js';
|
|
6
6
|
export { CheckoutClient } from './checkout.js';
|
|
7
7
|
export { TransactionsClient } from './transactions.js';
|
|
8
|
+
export { MemoryClient } from './memory.js';
|
|
9
|
+
export { MessagesClient } from './messages.js';
|
|
8
10
|
export { WebhookServer } from './webhook.js';
|
|
9
|
-
export { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, ValidationError, RateLimitError, } from './errors.js';
|
|
10
|
-
export type { AbbabaConfig, ApiResponse, ServiceCategory, PriceUnit, ServiceCurrency, DeliveryType, ServiceStatus, PaymentMethod, PaymentStatus, TransactionStatus, DisputeOutcome, WalletChain, CreateServiceInput, UpdateServiceInput, Service, ServiceSearchParams, ServiceListResult, AgentSummary, CheckoutInput, CheckoutResult, CryptoPaymentInstructions, PaymentInstructions, Transaction, TransactionListParams, TransactionListResult, DeliverInput, DisputeInput, FundInput, FundResult, WebhookEvent, WebhookHandler, GasStrategy, SmartAccountConfig, SmartAccountResult, EscrowDetails, AgentStats, SessionKeyConfig, SessionKeyResult, UseSessionKeyConfig, RevokeSessionKeyConfig, PollOptions, } from './types.js';
|
|
11
|
+
export { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, PaymentRequiredError, ValidationError, RateLimitError, } from './errors.js';
|
|
12
|
+
export type { AbbabaConfig, ApiResponse, ServiceCategory, PriceUnit, ServiceCurrency, DeliveryType, ServiceStatus, PaymentMethod, PaymentStatus, TransactionStatus, DisputeOutcome, WalletChain, CreateServiceInput, UpdateServiceInput, Service, ServiceSearchParams, ServiceListResult, AgentSummary, CheckoutInput, CheckoutResult, CryptoPaymentInstructions, PaymentInstructions, Transaction, TransactionListParams, TransactionListResult, DeliverInput, DisputeInput, FundInput, FundResult, WebhookEvent, WebhookHandler, GasStrategy, SmartAccountConfig, SmartAccountResult, EscrowDetails, AgentStats, SessionKeyConfig, SessionKeyResult, UseSessionKeyConfig, RevokeSessionKeyConfig, PollOptions, X402PaymentRequirements, } from './types.js';
|
|
11
13
|
export { EscrowStatus, OnChainDisputeOutcome } from './types.js';
|
|
12
14
|
export type { RegisterOptions, RegisterResult } from './register.js';
|
|
15
|
+
export type { MemoryWriteInput, MemoryEntry, MemorySearchInput, MemorySearchResult, MemoryHistoryParams, } from './memory.js';
|
|
16
|
+
export type { SendMessageInput, AgentMessage, InboxParams, SubscribeInput, MessageSubscription, } from './messages.js';
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG5C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAA;AAGpB,YAAY,EAEV,YAAY,EACZ,WAAW,EAGX,eAAe,EACf,SAAS,EACT,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,WAAW,EAGX,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EAGZ,aAAa,EACb,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EAGnB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,YAAY,EACZ,cAAc,EAGd,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,UAAU,EAGV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EAGtB,WAAW,EAGX,uBAAuB,GACxB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAGhE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGpE,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAGpB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,10 +9,12 @@ export { BuyerAgent } from './buyer.js';
|
|
|
9
9
|
export { ServicesClient } from './services.js';
|
|
10
10
|
export { CheckoutClient } from './checkout.js';
|
|
11
11
|
export { TransactionsClient } from './transactions.js';
|
|
12
|
+
export { MemoryClient } from './memory.js';
|
|
13
|
+
export { MessagesClient } from './messages.js';
|
|
12
14
|
// Webhook server
|
|
13
15
|
export { WebhookServer } from './webhook.js';
|
|
14
16
|
// Errors
|
|
15
|
-
export { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, ValidationError, RateLimitError, } from './errors.js';
|
|
17
|
+
export { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, PaymentRequiredError, ValidationError, RateLimitError, } from './errors.js';
|
|
16
18
|
// V4 on-chain enums
|
|
17
19
|
export { EscrowStatus, OnChainDisputeOutcome } from './types.js';
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,SAAS;AACT,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAA;AAmEpB,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/memory.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AbbabaClient } from './client.js';
|
|
2
|
+
import type { ApiResponse } from './types.js';
|
|
3
|
+
export interface MemoryWriteInput {
|
|
4
|
+
key: string;
|
|
5
|
+
value: unknown;
|
|
6
|
+
namespace?: string;
|
|
7
|
+
memoryType?: 'permanent' | 'session' | 'cache';
|
|
8
|
+
tags?: string[];
|
|
9
|
+
ttlSeconds?: number;
|
|
10
|
+
source?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MemoryEntry {
|
|
13
|
+
id: string;
|
|
14
|
+
key: string;
|
|
15
|
+
namespace: string;
|
|
16
|
+
value: unknown;
|
|
17
|
+
memoryType: string;
|
|
18
|
+
tags: string[];
|
|
19
|
+
sizeBytes: number;
|
|
20
|
+
accessCount: number;
|
|
21
|
+
source: string | null;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
}
|
|
25
|
+
export interface MemorySearchInput {
|
|
26
|
+
query: string;
|
|
27
|
+
namespace?: string;
|
|
28
|
+
limit?: number;
|
|
29
|
+
threshold?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface MemorySearchResult {
|
|
32
|
+
id: string;
|
|
33
|
+
key: string;
|
|
34
|
+
namespace: string;
|
|
35
|
+
value: unknown;
|
|
36
|
+
similarity: number;
|
|
37
|
+
tags: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface MemoryHistoryParams {
|
|
40
|
+
namespace?: string;
|
|
41
|
+
memoryType?: string;
|
|
42
|
+
tags?: string;
|
|
43
|
+
from?: string;
|
|
44
|
+
to?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
offset?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare class MemoryClient {
|
|
49
|
+
private client;
|
|
50
|
+
constructor(client: AbbabaClient);
|
|
51
|
+
write(input: MemoryWriteInput): Promise<ApiResponse<MemoryEntry>>;
|
|
52
|
+
read(key: string, namespace?: string): Promise<ApiResponse<MemoryEntry>>;
|
|
53
|
+
search(input: MemorySearchInput): Promise<ApiResponse<MemorySearchResult[]>>;
|
|
54
|
+
history(params?: MemoryHistoryParams): Promise<ApiResponse<MemoryEntry[]>>;
|
|
55
|
+
delete(key: string, namespace?: string): Promise<ApiResponse<{
|
|
56
|
+
message: string;
|
|
57
|
+
}>>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAAA;IAC9C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE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