@sly_ai/sdk 0.1.0
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 +346 -0
- package/dist/a2a.d.mts +108 -0
- package/dist/a2a.d.ts +108 -0
- package/dist/a2a.js +173 -0
- package/dist/a2a.js.map +1 -0
- package/dist/a2a.mjs +171 -0
- package/dist/a2a.mjs.map +1 -0
- package/dist/acp.d.mts +201 -0
- package/dist/acp.d.ts +201 -0
- package/dist/acp.js +143 -0
- package/dist/acp.js.map +1 -0
- package/dist/acp.mjs +141 -0
- package/dist/acp.mjs.map +1 -0
- package/dist/ap2.d.mts +188 -0
- package/dist/ap2.d.ts +188 -0
- package/dist/ap2.js +135 -0
- package/dist/ap2.js.map +1 -0
- package/dist/ap2.mjs +133 -0
- package/dist/ap2.mjs.map +1 -0
- package/dist/cards.d.mts +750 -0
- package/dist/cards.d.ts +750 -0
- package/dist/cards.js +373 -0
- package/dist/cards.js.map +1 -0
- package/dist/cards.mjs +369 -0
- package/dist/cards.mjs.map +1 -0
- package/dist/client-Cwe2CLU7.d.mts +41 -0
- package/dist/client-CyJe3uWO.d.ts +41 -0
- package/dist/index.d.mts +662 -0
- package/dist/index.d.ts +662 -0
- package/dist/index.js +2709 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2700 -0
- package/dist/index.mjs.map +1 -0
- package/dist/langchain.d.mts +11 -0
- package/dist/langchain.d.ts +11 -0
- package/dist/langchain.js +25 -0
- package/dist/langchain.js.map +1 -0
- package/dist/langchain.mjs +23 -0
- package/dist/langchain.mjs.map +1 -0
- package/dist/types-df1EICn_.d.mts +165 -0
- package/dist/types-df1EICn_.d.ts +165 -0
- package/dist/ucp.d.mts +844 -0
- package/dist/ucp.d.ts +844 -0
- package/dist/ucp.js +616 -0
- package/dist/ucp.js.map +1 -0
- package/dist/ucp.mjs +614 -0
- package/dist/ucp.mjs.map +1 -0
- package/dist/vercel.d.mts +178 -0
- package/dist/vercel.d.ts +178 -0
- package/dist/vercel.js +143 -0
- package/dist/vercel.js.map +1 -0
- package/dist/vercel.mjs +138 -0
- package/dist/vercel.mjs.map +1 -0
- package/dist/x402.d.mts +209 -0
- package/dist/x402.d.ts +209 -0
- package/dist/x402.js +476 -0
- package/dist/x402.js.map +1 -0
- package/dist/x402.mjs +471 -0
- package/dist/x402.mjs.map +1 -0
- package/package.json +118 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
import { f as CapabilitiesResponse, h as Capability, P as PayOSEnvironment, E as EnvironmentConfig, b as SlyConfig } from './types-df1EICn_.mjs';
|
|
2
|
+
export { e as ComplianceCheckRequest, C as ComplianceCheckResponse, d as CreateSettlementRequest, l as Currency, i as PayOSConfig, j as PaymentProtocol, a as Settlement, S as SettlementQuote, c as SettlementQuoteRequest, k as SettlementRail, m as SettlementStatus, g as SlyEnvironment } from './types-df1EICn_.mjs';
|
|
3
|
+
import { S as SlyClient } from './client-Cwe2CLU7.mjs';
|
|
4
|
+
import { PayOSX402Client as SlyX402Client, PayOSX402Provider as SlyX402Provider } from './x402.mjs';
|
|
5
|
+
import { AP2Client } from './ap2.mjs';
|
|
6
|
+
import { ACPClient } from './acp.mjs';
|
|
7
|
+
import { UCPClient } from './ucp.mjs';
|
|
8
|
+
import { CardsClient } from './cards.mjs';
|
|
9
|
+
import { A2AClient } from './a2a.mjs';
|
|
10
|
+
import 'express';
|
|
11
|
+
import '@sly/types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Formatters for converting PayOS capabilities to AI agent tool formats
|
|
15
|
+
* - OpenAI function-calling format
|
|
16
|
+
* - Claude tool format
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* OpenAI function-calling schema
|
|
21
|
+
* https://platform.openai.com/docs/guides/function-calling
|
|
22
|
+
*/
|
|
23
|
+
interface OpenAIFunction {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
parameters: {
|
|
27
|
+
type: 'object';
|
|
28
|
+
properties: Record<string, {
|
|
29
|
+
type: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
enum?: string[];
|
|
32
|
+
}>;
|
|
33
|
+
required: string[];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Claude tool schema (Anthropic Messages API)
|
|
38
|
+
* https://docs.anthropic.com/claude/docs/tool-use
|
|
39
|
+
*/
|
|
40
|
+
interface ClaudeTool {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
input_schema: {
|
|
44
|
+
type: 'object';
|
|
45
|
+
properties: Record<string, {
|
|
46
|
+
type: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
enum?: string[];
|
|
49
|
+
}>;
|
|
50
|
+
required: string[];
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Types for PayOS Capabilities API
|
|
56
|
+
* Re-exports from main types + additional client-specific types
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
interface CapabilitiesFilter {
|
|
60
|
+
category?: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class CapabilitiesClient {
|
|
65
|
+
private client;
|
|
66
|
+
private cachedCapabilities;
|
|
67
|
+
private cacheTimestamp;
|
|
68
|
+
private cacheTTL;
|
|
69
|
+
constructor(client: SlyClient);
|
|
70
|
+
/**
|
|
71
|
+
* Get all PayOS capabilities
|
|
72
|
+
* Results are cached for 1 hour by default
|
|
73
|
+
*/
|
|
74
|
+
getAll(forceFresh?: boolean): Promise<CapabilitiesResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Get capabilities filtered by category or name
|
|
77
|
+
*/
|
|
78
|
+
filter(filter: CapabilitiesFilter): Promise<Capability[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Get a single capability by name
|
|
81
|
+
*/
|
|
82
|
+
get(name: string): Promise<Capability | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Get all available categories
|
|
85
|
+
*/
|
|
86
|
+
getCategories(): Promise<string[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Clear the capabilities cache
|
|
89
|
+
*/
|
|
90
|
+
clearCache(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Get capabilities in OpenAI function-calling format
|
|
93
|
+
*/
|
|
94
|
+
toOpenAI(): Promise<{
|
|
95
|
+
functions: OpenAIFunction[];
|
|
96
|
+
systemMessage: string;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Get capabilities in OpenAI function-calling format (alias)
|
|
100
|
+
*/
|
|
101
|
+
toOpenAIFunctions(): Promise<OpenAIFunction[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Get capabilities in Claude tool format
|
|
104
|
+
*/
|
|
105
|
+
toClaude(): Promise<{
|
|
106
|
+
tools: ClaudeTool[];
|
|
107
|
+
systemMessage: string;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Get capabilities in Claude tool format (alias)
|
|
111
|
+
*/
|
|
112
|
+
toClaudeTools(): Promise<ClaudeTool[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Get capabilities in LangChain tool format
|
|
115
|
+
*/
|
|
116
|
+
toLangChain(): Promise<any[]>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* LangChain Tools Wrapper for PayOS SDK
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
declare class LangChainTools {
|
|
124
|
+
private payos;
|
|
125
|
+
constructor(payos: Sly);
|
|
126
|
+
/**
|
|
127
|
+
* Get all PayOS capabilities as LangChain tools
|
|
128
|
+
*/
|
|
129
|
+
getTools(): Promise<any[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Get a specific tool by name
|
|
132
|
+
*/
|
|
133
|
+
getTool(name: string): Promise<any>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Agent Wallets Client
|
|
138
|
+
*
|
|
139
|
+
* Epic 18: Agent Wallets & Contract Policies
|
|
140
|
+
* Story 18.6: SDK Methods
|
|
141
|
+
*
|
|
142
|
+
* Provides:
|
|
143
|
+
* - evaluatePolicy() — dry-run contract policy evaluation
|
|
144
|
+
* - getExposures() — list counterparty exposures
|
|
145
|
+
* - getEvaluations() — audit log of policy decisions
|
|
146
|
+
* - getWallet() — get agent's wallet
|
|
147
|
+
* - freezeWallet() — freeze agent's wallet
|
|
148
|
+
* - unfreezeWallet() — reactivate agent's wallet
|
|
149
|
+
* - setContractPolicy() — set contract policy on agent's wallet
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
interface ContractPolicy {
|
|
153
|
+
counterpartyBlocklist?: string[];
|
|
154
|
+
counterpartyAllowlist?: string[];
|
|
155
|
+
minCounterpartyKyaTier?: number;
|
|
156
|
+
minCounterpartyReputation?: number;
|
|
157
|
+
allowedContractTypes?: string[];
|
|
158
|
+
blockedContractTypes?: string[];
|
|
159
|
+
maxExposure24h?: number;
|
|
160
|
+
maxExposure7d?: number;
|
|
161
|
+
maxExposure30d?: number;
|
|
162
|
+
maxActiveContracts?: number;
|
|
163
|
+
maxActiveEscrows?: number;
|
|
164
|
+
escalateAbove?: number;
|
|
165
|
+
}
|
|
166
|
+
interface SpendingPolicy {
|
|
167
|
+
dailySpendLimit?: number;
|
|
168
|
+
monthlySpendLimit?: number;
|
|
169
|
+
requiresApprovalAbove?: number;
|
|
170
|
+
approvedVendors?: string[];
|
|
171
|
+
approvedCategories?: string[];
|
|
172
|
+
approvedEndpoints?: string[];
|
|
173
|
+
contractPolicy?: ContractPolicy;
|
|
174
|
+
}
|
|
175
|
+
interface PolicyEvaluateRequest {
|
|
176
|
+
amount: number;
|
|
177
|
+
currency?: string;
|
|
178
|
+
actionType: 'payment' | 'escrow_create' | 'escrow_release' | 'contract_sign' | 'negotiation_check' | 'counterparty_check';
|
|
179
|
+
contractType?: string;
|
|
180
|
+
counterpartyAgentId?: string;
|
|
181
|
+
counterpartyAddress?: string;
|
|
182
|
+
protocol?: string;
|
|
183
|
+
}
|
|
184
|
+
interface PolicyCheckDetail {
|
|
185
|
+
check: string;
|
|
186
|
+
result: 'pass' | 'fail' | 'skip';
|
|
187
|
+
detail: string;
|
|
188
|
+
}
|
|
189
|
+
interface PolicyEvaluateResponse {
|
|
190
|
+
decision: 'approve' | 'escalate' | 'deny';
|
|
191
|
+
reasons: string[];
|
|
192
|
+
checks: PolicyCheckDetail[];
|
|
193
|
+
suggestedCounterOffer: {
|
|
194
|
+
maxAmount: number;
|
|
195
|
+
reason: string;
|
|
196
|
+
} | null;
|
|
197
|
+
evaluationMs: number;
|
|
198
|
+
}
|
|
199
|
+
interface CounterpartyExposure {
|
|
200
|
+
id: string;
|
|
201
|
+
walletId: string;
|
|
202
|
+
counterpartyAgentId: string | null;
|
|
203
|
+
counterpartyAddress: string | null;
|
|
204
|
+
exposure24h: number;
|
|
205
|
+
exposure7d: number;
|
|
206
|
+
exposure30d: number;
|
|
207
|
+
activeContracts: number;
|
|
208
|
+
activeEscrows: number;
|
|
209
|
+
totalVolume: number;
|
|
210
|
+
transactionCount: number;
|
|
211
|
+
currency: string;
|
|
212
|
+
}
|
|
213
|
+
interface PolicyEvaluation {
|
|
214
|
+
id: string;
|
|
215
|
+
actionType: string;
|
|
216
|
+
amount: number;
|
|
217
|
+
currency: string;
|
|
218
|
+
contractType: string | null;
|
|
219
|
+
counterpartyAgentId: string | null;
|
|
220
|
+
counterpartyAddress: string | null;
|
|
221
|
+
decision: string;
|
|
222
|
+
decisionReasons: string[];
|
|
223
|
+
suggestedCounterOffer: any;
|
|
224
|
+
checksPerformed: PolicyCheckDetail[];
|
|
225
|
+
evaluationMs: number;
|
|
226
|
+
createdAt: string;
|
|
227
|
+
}
|
|
228
|
+
declare class AgentWalletsClient {
|
|
229
|
+
private client;
|
|
230
|
+
constructor(client: SlyClient);
|
|
231
|
+
/**
|
|
232
|
+
* Evaluate a contract policy in dry-run mode (negotiation guardrails).
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* const result = await sly.agentWallets.evaluatePolicy('agent-uuid', {
|
|
237
|
+
* amount: 150,
|
|
238
|
+
* actionType: 'payment',
|
|
239
|
+
* counterpartyAgentId: 'other-agent-uuid',
|
|
240
|
+
* });
|
|
241
|
+
* console.log(result.decision); // 'approve' | 'escalate' | 'deny'
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
evaluatePolicy(agentId: string, request: PolicyEvaluateRequest): Promise<PolicyEvaluateResponse>;
|
|
245
|
+
/**
|
|
246
|
+
* List counterparty exposures for an agent's wallet.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* const exposures = await sly.agentWallets.getExposures('agent-uuid');
|
|
251
|
+
* for (const exp of exposures) {
|
|
252
|
+
* console.log(`${exp.counterpartyAgentId}: ${exp.exposure24h} (24h)`);
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
getExposures(agentId: string): Promise<CounterpartyExposure[]>;
|
|
257
|
+
/**
|
|
258
|
+
* Get policy evaluation audit log for an agent's wallet.
|
|
259
|
+
*/
|
|
260
|
+
getEvaluations(agentId: string, options?: {
|
|
261
|
+
page?: number;
|
|
262
|
+
limit?: number;
|
|
263
|
+
}): Promise<{
|
|
264
|
+
data: PolicyEvaluation[];
|
|
265
|
+
pagination: any;
|
|
266
|
+
}>;
|
|
267
|
+
/**
|
|
268
|
+
* Get an agent's wallet details.
|
|
269
|
+
*/
|
|
270
|
+
getWallet(agentId: string): Promise<any>;
|
|
271
|
+
/**
|
|
272
|
+
* Freeze an agent's wallet (disables all payments).
|
|
273
|
+
*/
|
|
274
|
+
freezeWallet(agentId: string): Promise<any>;
|
|
275
|
+
/**
|
|
276
|
+
* Unfreeze an agent's wallet (re-enables payments).
|
|
277
|
+
*/
|
|
278
|
+
unfreezeWallet(agentId: string): Promise<any>;
|
|
279
|
+
/**
|
|
280
|
+
* Set or update the contract policy on an agent's wallet.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* await sly.agentWallets.setContractPolicy('agent-uuid', {
|
|
285
|
+
* dailySpendLimit: 500,
|
|
286
|
+
* contractPolicy: {
|
|
287
|
+
* counterpartyBlocklist: ['bad-agent-id'],
|
|
288
|
+
* maxExposure24h: 200,
|
|
289
|
+
* escalateAbove: 100,
|
|
290
|
+
* },
|
|
291
|
+
* });
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
setContractPolicy(agentId: string, policy: SpendingPolicy): Promise<any>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Types for MPP (Machine Payments Protocol)
|
|
299
|
+
*/
|
|
300
|
+
interface MppPayRequest {
|
|
301
|
+
service_url: string;
|
|
302
|
+
amount: number;
|
|
303
|
+
currency?: string;
|
|
304
|
+
intent?: string;
|
|
305
|
+
agent_id: string;
|
|
306
|
+
wallet_id?: string;
|
|
307
|
+
}
|
|
308
|
+
interface MppPayResponse {
|
|
309
|
+
status: 'completed' | 'approval_required';
|
|
310
|
+
transfer_id?: string;
|
|
311
|
+
approval_id?: string;
|
|
312
|
+
message?: string;
|
|
313
|
+
payment?: {
|
|
314
|
+
receipt_id?: string;
|
|
315
|
+
payment_method?: string;
|
|
316
|
+
settlement_network?: string;
|
|
317
|
+
settlement_tx_hash?: string;
|
|
318
|
+
amount_paid?: number;
|
|
319
|
+
currency?: string;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
interface MppOpenSessionRequest {
|
|
323
|
+
service_url: string;
|
|
324
|
+
deposit_amount: number;
|
|
325
|
+
max_budget?: number;
|
|
326
|
+
agent_id: string;
|
|
327
|
+
wallet_id: string;
|
|
328
|
+
currency?: string;
|
|
329
|
+
}
|
|
330
|
+
interface MppSession {
|
|
331
|
+
id: string;
|
|
332
|
+
tenant_id: string;
|
|
333
|
+
agent_id: string;
|
|
334
|
+
wallet_id: string;
|
|
335
|
+
service_url: string;
|
|
336
|
+
status: MppSessionStatus;
|
|
337
|
+
deposit_amount: number;
|
|
338
|
+
spent_amount: number;
|
|
339
|
+
remaining_amount: number;
|
|
340
|
+
max_budget?: number;
|
|
341
|
+
currency: string;
|
|
342
|
+
voucher_count: number;
|
|
343
|
+
created_at: string;
|
|
344
|
+
updated_at: string;
|
|
345
|
+
closed_at?: string;
|
|
346
|
+
}
|
|
347
|
+
type MppSessionStatus = 'active' | 'closed' | 'expired' | 'exhausted';
|
|
348
|
+
interface MppSessionDetail extends MppSession {
|
|
349
|
+
vouchers: any[];
|
|
350
|
+
}
|
|
351
|
+
interface MppListSessionsOptions {
|
|
352
|
+
agent_id?: string;
|
|
353
|
+
status?: MppSessionStatus;
|
|
354
|
+
limit?: number;
|
|
355
|
+
offset?: number;
|
|
356
|
+
}
|
|
357
|
+
interface MppListSessionsResponse {
|
|
358
|
+
data: MppSession[];
|
|
359
|
+
pagination: {
|
|
360
|
+
limit: number;
|
|
361
|
+
offset: number;
|
|
362
|
+
total: number;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
interface MppListTransfersOptions {
|
|
366
|
+
service_url?: string;
|
|
367
|
+
session_id?: string;
|
|
368
|
+
limit?: number;
|
|
369
|
+
offset?: number;
|
|
370
|
+
}
|
|
371
|
+
interface MppListTransfersResponse {
|
|
372
|
+
data: any[];
|
|
373
|
+
pagination?: {
|
|
374
|
+
limit: number;
|
|
375
|
+
offset: number;
|
|
376
|
+
total: number;
|
|
377
|
+
};
|
|
378
|
+
total?: number;
|
|
379
|
+
}
|
|
380
|
+
interface MppReceiptVerification {
|
|
381
|
+
verified: boolean;
|
|
382
|
+
receipt_id: string;
|
|
383
|
+
transfer_id?: string;
|
|
384
|
+
amount?: number;
|
|
385
|
+
currency?: string;
|
|
386
|
+
service_url?: string;
|
|
387
|
+
verified_at?: string;
|
|
388
|
+
}
|
|
389
|
+
interface MppProvisionWalletRequest {
|
|
390
|
+
agent_id: string;
|
|
391
|
+
owner_account_id: string;
|
|
392
|
+
testnet?: boolean;
|
|
393
|
+
initial_balance?: number;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* MPP Client - Machine Payments Protocol
|
|
398
|
+
*
|
|
399
|
+
* Wraps PayOS MPP API endpoints for governed machine payments and sessions.
|
|
400
|
+
*/
|
|
401
|
+
|
|
402
|
+
declare class MPPClient {
|
|
403
|
+
private client;
|
|
404
|
+
constructor(client: SlyClient);
|
|
405
|
+
/**
|
|
406
|
+
* Make a one-shot MPP payment to a service
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* const result = await sly.mpp.pay({
|
|
411
|
+
* service_url: 'https://api.example.com',
|
|
412
|
+
* amount: 0.50,
|
|
413
|
+
* agent_id: 'agent-uuid',
|
|
414
|
+
* });
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
pay(request: MppPayRequest): Promise<MppPayResponse>;
|
|
418
|
+
/**
|
|
419
|
+
* Open a streaming payment session
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const session = await sly.mpp.openSession({
|
|
424
|
+
* service_url: 'https://api.example.com',
|
|
425
|
+
* deposit_amount: 10.00,
|
|
426
|
+
* agent_id: 'agent-uuid',
|
|
427
|
+
* wallet_id: 'wallet-uuid',
|
|
428
|
+
* });
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
openSession(request: MppOpenSessionRequest): Promise<MppSession>;
|
|
432
|
+
/**
|
|
433
|
+
* Get session details with voucher history
|
|
434
|
+
*/
|
|
435
|
+
getSession(sessionId: string): Promise<MppSessionDetail>;
|
|
436
|
+
/**
|
|
437
|
+
* List MPP sessions with optional filtering
|
|
438
|
+
*/
|
|
439
|
+
listSessions(options?: MppListSessionsOptions): Promise<MppListSessionsResponse>;
|
|
440
|
+
/**
|
|
441
|
+
* Close an active session
|
|
442
|
+
*/
|
|
443
|
+
closeSession(sessionId: string): Promise<MppSession>;
|
|
444
|
+
/**
|
|
445
|
+
* List MPP payment transfers
|
|
446
|
+
*/
|
|
447
|
+
listTransfers(options?: MppListTransfersOptions): Promise<MppListTransfersResponse>;
|
|
448
|
+
/**
|
|
449
|
+
* Verify an MPP payment receipt
|
|
450
|
+
*/
|
|
451
|
+
verifyReceipt(receiptId: string): Promise<MppReceiptVerification>;
|
|
452
|
+
/**
|
|
453
|
+
* Provision a wallet for MPP payments
|
|
454
|
+
*/
|
|
455
|
+
provisionWallet(request: MppProvisionWalletRequest): Promise<any>;
|
|
456
|
+
/**
|
|
457
|
+
* Browse the MPP service directory
|
|
458
|
+
*/
|
|
459
|
+
browseServices(options?: {
|
|
460
|
+
category?: string;
|
|
461
|
+
limit?: number;
|
|
462
|
+
}): Promise<any>;
|
|
463
|
+
/**
|
|
464
|
+
* Get pricing info for a service
|
|
465
|
+
*/
|
|
466
|
+
getServicePricing(domain: string): Promise<any>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Environment-specific configuration
|
|
471
|
+
*/
|
|
472
|
+
declare const ENVIRONMENT_CONFIGS: Record<PayOSEnvironment, EnvironmentConfig>;
|
|
473
|
+
/**
|
|
474
|
+
* Infer environment from API key prefix
|
|
475
|
+
* - pk_test_* or pk_sandbox_* → sandbox
|
|
476
|
+
* - pk_live_* → production
|
|
477
|
+
*/
|
|
478
|
+
declare function inferEnvironmentFromKey(apiKey: string): PayOSEnvironment | undefined;
|
|
479
|
+
/**
|
|
480
|
+
* Get configuration for an environment
|
|
481
|
+
*/
|
|
482
|
+
declare function getEnvironmentConfig(environment: PayOSEnvironment): EnvironmentConfig;
|
|
483
|
+
/**
|
|
484
|
+
* Validate environment configuration
|
|
485
|
+
*/
|
|
486
|
+
declare function validateEnvironment(environment: PayOSEnvironment, evmPrivateKey?: string): void;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Authentication helpers for PayOS SDK
|
|
490
|
+
*
|
|
491
|
+
* Supports both API key and username/password authentication
|
|
492
|
+
*/
|
|
493
|
+
interface LoginCredentials {
|
|
494
|
+
email: string;
|
|
495
|
+
password: string;
|
|
496
|
+
}
|
|
497
|
+
interface LoginResponse {
|
|
498
|
+
access_token: string;
|
|
499
|
+
refresh_token: string;
|
|
500
|
+
expires_in: number;
|
|
501
|
+
user: {
|
|
502
|
+
id: string;
|
|
503
|
+
email: string;
|
|
504
|
+
tenant_id: string;
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Authenticate with email and password to get an access token
|
|
509
|
+
*
|
|
510
|
+
* @param credentials - Email and password
|
|
511
|
+
* @param apiUrl - PayOS API URL (default: http://localhost:4000)
|
|
512
|
+
* @returns Login response with access token
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```ts
|
|
516
|
+
* const auth = await loginWithPassword({
|
|
517
|
+
* email: 'user@example.com',
|
|
518
|
+
* password: 'mypassword'
|
|
519
|
+
* });
|
|
520
|
+
*
|
|
521
|
+
* const payos = new PayOS({
|
|
522
|
+
* apiKey: auth.access_token,
|
|
523
|
+
* environment: 'sandbox'
|
|
524
|
+
* });
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
declare function loginWithPassword(credentials: LoginCredentials, apiUrl?: string): Promise<LoginResponse>;
|
|
528
|
+
/**
|
|
529
|
+
* Create a PayOS SDK instance with username/password authentication
|
|
530
|
+
*
|
|
531
|
+
* @param credentials - Email and password
|
|
532
|
+
* @param environment - Environment to connect to
|
|
533
|
+
* @param apiUrl - PayOS API URL (default: http://localhost:4000)
|
|
534
|
+
* @returns PayOS instance authenticated with the user's session
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```ts
|
|
538
|
+
* import { PayOS, createWithPassword } from '@sly/sdk';
|
|
539
|
+
*
|
|
540
|
+
* const payos = await createWithPassword({
|
|
541
|
+
* email: 'user@example.com',
|
|
542
|
+
* password: 'mypassword',
|
|
543
|
+
* }, 'sandbox');
|
|
544
|
+
*
|
|
545
|
+
* // Now use payos normally
|
|
546
|
+
* const mandate = await payos.ap2.createMandate({...});
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
declare function createWithPassword(credentials: LoginCredentials, environment?: 'sandbox' | 'testnet' | 'production', apiUrl?: string): Promise<any>;
|
|
550
|
+
/**
|
|
551
|
+
* Verify if an API key is valid
|
|
552
|
+
*
|
|
553
|
+
* @param apiKey - API key to verify
|
|
554
|
+
* @param apiUrl - PayOS API URL
|
|
555
|
+
* @returns True if valid, false otherwise
|
|
556
|
+
*/
|
|
557
|
+
declare function verifyApiKey(apiKey: string, apiUrl?: string): Promise<boolean>;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* @sly/sdk - Unified SDK for Sly multi-protocol settlement
|
|
561
|
+
*
|
|
562
|
+
* This SDK provides:
|
|
563
|
+
* - x402 micropayments (Coinbase/Cloudflare)
|
|
564
|
+
* - AP2 agent mandates (Google)
|
|
565
|
+
* - ACP checkout (Stripe/OpenAI)
|
|
566
|
+
* - Direct settlement API
|
|
567
|
+
* - Pix/SPEI local rails
|
|
568
|
+
*
|
|
569
|
+
* @example Auto-routing (environment inferred from key prefix)
|
|
570
|
+
* ```ts
|
|
571
|
+
* const sly = new Sly({ apiKey: 'pk_test_...' }); // → sandbox.getsly.ai
|
|
572
|
+
* const sly = new Sly({ apiKey: 'pk_live_...' }); // → api.getsly.ai
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
575
|
+
* @example Explicit environment
|
|
576
|
+
* ```ts
|
|
577
|
+
* const sly = new Sly({
|
|
578
|
+
* apiKey: 'pk_live_...',
|
|
579
|
+
* environment: 'production',
|
|
580
|
+
* evmPrivateKey: '0x...',
|
|
581
|
+
* });
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Main Sly SDK class
|
|
587
|
+
*
|
|
588
|
+
* Provides unified access to all Sly settlement protocols:
|
|
589
|
+
* - x402 (micropayments)
|
|
590
|
+
* - AP2 (agent mandates)
|
|
591
|
+
* - ACP (checkout)
|
|
592
|
+
* - UCP (universal commerce - Google+Shopify)
|
|
593
|
+
* - Direct settlement API
|
|
594
|
+
* - Capabilities discovery for AI agents
|
|
595
|
+
*/
|
|
596
|
+
declare class Sly extends SlyClient {
|
|
597
|
+
/**
|
|
598
|
+
* x402 protocol client
|
|
599
|
+
* Create x402 payments with automatic 402 handling
|
|
600
|
+
*/
|
|
601
|
+
readonly x402: {
|
|
602
|
+
/**
|
|
603
|
+
* Create an x402 client for making payments
|
|
604
|
+
*/
|
|
605
|
+
createClient: (config?: Partial<SlyConfig>) => SlyX402Client;
|
|
606
|
+
/**
|
|
607
|
+
* Create an x402 provider for accepting payments
|
|
608
|
+
*/
|
|
609
|
+
createProvider: (routes: Record<string, {
|
|
610
|
+
price: string;
|
|
611
|
+
description?: string;
|
|
612
|
+
token?: string;
|
|
613
|
+
}>) => SlyX402Provider;
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* AP2 (Agent-to-Agent Protocol) client
|
|
617
|
+
* Google's mandate-based payment protocol
|
|
618
|
+
*/
|
|
619
|
+
readonly ap2: AP2Client;
|
|
620
|
+
/**
|
|
621
|
+
* ACP (Agentic Commerce Protocol) client
|
|
622
|
+
* Stripe/OpenAI's checkout-based payment protocol
|
|
623
|
+
*/
|
|
624
|
+
readonly acp: ACPClient;
|
|
625
|
+
/**
|
|
626
|
+
* UCP (Universal Commerce Protocol) client
|
|
627
|
+
* Google+Shopify's agentic commerce protocol
|
|
628
|
+
*/
|
|
629
|
+
readonly ucp: UCPClient;
|
|
630
|
+
/**
|
|
631
|
+
* Capabilities client for tool discovery
|
|
632
|
+
* Enables AI agents to discover available Sly operations
|
|
633
|
+
*/
|
|
634
|
+
readonly capabilities: CapabilitiesClient;
|
|
635
|
+
/**
|
|
636
|
+
* LangChain tools integration
|
|
637
|
+
*/
|
|
638
|
+
readonly langchain: LangChainTools;
|
|
639
|
+
/**
|
|
640
|
+
* Card network integration (Visa VIC, Mastercard Agent Pay)
|
|
641
|
+
* Accept payments from AI agents using Web Bot Auth
|
|
642
|
+
*/
|
|
643
|
+
readonly cards: CardsClient;
|
|
644
|
+
/**
|
|
645
|
+
* A2A (Agent-to-Agent Protocol) client
|
|
646
|
+
* Google's task-based protocol for inter-agent communication
|
|
647
|
+
*/
|
|
648
|
+
readonly a2a: A2AClient;
|
|
649
|
+
/**
|
|
650
|
+
* Agent Wallets client
|
|
651
|
+
* Contract policy evaluation, exposure tracking, wallet management
|
|
652
|
+
*/
|
|
653
|
+
readonly agentWallets: AgentWalletsClient;
|
|
654
|
+
/**
|
|
655
|
+
* MPP (Machine Payments Protocol) client
|
|
656
|
+
* Governed machine-to-machine payments and streaming sessions
|
|
657
|
+
*/
|
|
658
|
+
readonly mpp: MPPClient;
|
|
659
|
+
constructor(config: SlyConfig);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export { CapabilitiesResponse, Capability, ENVIRONMENT_CONFIGS, EnvironmentConfig, LangChainTools as L, type LoginCredentials, type LoginResponse, Sly as PayOS, SlyClient as PayOSClient, PayOSEnvironment, Sly, SlyClient, SlyConfig, createWithPassword, getEnvironmentConfig, inferEnvironmentFromKey, loginWithPassword, validateEnvironment, verifyApiKey };
|