@kivel.io/sdk 0.0.0-stage → 0.8.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.
@@ -0,0 +1,431 @@
1
+ export interface WaitOptions {
2
+ token?: string;
3
+ after?: string;
4
+ timeoutSeconds?: number;
5
+ }
6
+ export interface AgentLogin {
7
+ userCode: string;
8
+ verificationUrl: string;
9
+ deviceCode: string;
10
+ expiresAt: string;
11
+ interval: number;
12
+ instructions: string;
13
+ }
14
+ export type AgentToken = {
15
+ status: 'pending';
16
+ interval: number;
17
+ } | {
18
+ status: 'approved';
19
+ apiKey: string;
20
+ mcp: {
21
+ url: string;
22
+ header: string;
23
+ };
24
+ next: string;
25
+ };
26
+ export interface AgentTrial {
27
+ trialKey: string;
28
+ expiresAt: string;
29
+ limits: string;
30
+ claim: {
31
+ userCode: string;
32
+ claimUrl: string;
33
+ deviceCode: string;
34
+ humanNotified: boolean;
35
+ };
36
+ instructions: string;
37
+ }
38
+ export interface EmailInbox {
39
+ id: string;
40
+ address: string;
41
+ expiresAt: string | null;
42
+ persistent: boolean;
43
+ status?: 'active' | 'paused';
44
+ forwardingUrl?: string | null;
45
+ managementToken?: string;
46
+ messageCount?: number;
47
+ messageLimit?: number;
48
+ }
49
+ export interface EmailInboxSettings {
50
+ activeDays?: number | undefined;
51
+ localPart?: string | undefined;
52
+ }
53
+ export interface SocketEventSource {
54
+ kind: 'webhook' | 'email' | 'approval' | 'job' | 'sms';
55
+ id: string;
56
+ token?: string;
57
+ after?: string;
58
+ }
59
+ export interface SocketEvent {
60
+ kind: SocketEventSource['kind'];
61
+ id: string;
62
+ cursor: string;
63
+ requests?: import('./index.js').CapturedRequest[];
64
+ messages?: EmailMessage[];
65
+ approval?: Approval;
66
+ deliveries?: {
67
+ id: string;
68
+ at: string;
69
+ deliveryId: string;
70
+ attempt: number;
71
+ status: number | null;
72
+ error?: string;
73
+ }[];
74
+ }
75
+ export interface EmailMessage {
76
+ id: string;
77
+ receivedAt: string;
78
+ from: string;
79
+ mailFrom?: string;
80
+ to: string;
81
+ cc?: string[];
82
+ subject: string;
83
+ text: string;
84
+ html?: string;
85
+ codes: string[];
86
+ links: {
87
+ url: string;
88
+ kind: 'verification' | 'other';
89
+ }[];
90
+ attachments: {
91
+ id?: string;
92
+ filename: string;
93
+ mimeType: string;
94
+ size: number;
95
+ }[];
96
+ direction?: 'inbound' | 'outbound';
97
+ deliveryStatus?: 'pending' | 'sent';
98
+ messageId?: string;
99
+ inReplyTo?: string;
100
+ references?: string[];
101
+ }
102
+ export interface EmailContent {
103
+ to: string[];
104
+ cc?: string[];
105
+ subject: string;
106
+ text?: string | undefined;
107
+ html?: string | undefined;
108
+ replyTo?: string | undefined;
109
+ }
110
+ export interface SendEmailInput extends EmailContent {
111
+ idempotencyKey: string;
112
+ }
113
+ export interface EmailThreadSummary {
114
+ id: string;
115
+ inboxId: string;
116
+ subject: string;
117
+ lastAt: string;
118
+ from: string;
119
+ messageCount: number;
120
+ }
121
+ export interface EmailThread extends EmailThreadSummary {
122
+ messages: EmailMessage[];
123
+ }
124
+ export interface EmailThreadsPage {
125
+ threads: EmailThreadSummary[];
126
+ nextCursor: string | null;
127
+ }
128
+ export interface EmailDraft {
129
+ id: string;
130
+ inboxId: string;
131
+ subject: string;
132
+ status: 'draft' | 'awaitingApproval' | 'scheduled' | 'completed' | 'failed' | 'rejected' | 'expired';
133
+ sendAt: string | null;
134
+ expiresAt: string;
135
+ approvalId?: string;
136
+ approvalExpiresAt?: string;
137
+ answerUrl?: string;
138
+ events: {
139
+ id: string;
140
+ at: string;
141
+ attempt: number;
142
+ status: number | null;
143
+ error?: string;
144
+ }[];
145
+ }
146
+ export interface EmailRules {
147
+ requireApproval: boolean;
148
+ inboundAllow: string[];
149
+ inboundBlock: string[];
150
+ outboundAllow: string[];
151
+ outboundBlock: string[];
152
+ }
153
+ export interface MemoryEntry<T = unknown> {
154
+ namespace: string;
155
+ key: string;
156
+ value: T;
157
+ bytes: number;
158
+ expiresAt?: string;
159
+ }
160
+ export interface MonitorInput {
161
+ kind: 'http' | 'ssl' | 'heartbeat' | 'dns';
162
+ name: string;
163
+ target?: string;
164
+ intervalSeconds?: number;
165
+ graceSeconds?: number;
166
+ expectStatus?: number;
167
+ expectText?: string;
168
+ sslDays?: number;
169
+ dnsRecordType?: 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS' | 'CAA';
170
+ alertWebhook?: string;
171
+ }
172
+ export interface Monitor extends MonitorInput {
173
+ id: string;
174
+ status: 'pending' | 'up' | 'down';
175
+ paused: boolean;
176
+ failures: number;
177
+ createdAt: string;
178
+ nextRunAt: string;
179
+ lastCheckAt?: string;
180
+ lastPingAt?: string;
181
+ lastMessage?: string;
182
+ lastDurationMs?: number;
183
+ recentChecks?: {
184
+ at: string;
185
+ status: string;
186
+ durationMs: number;
187
+ }[];
188
+ dnsBaseline?: string[];
189
+ lastDnsAnswers?: string[];
190
+ pingUrl?: string;
191
+ events?: {
192
+ at: string;
193
+ status: string;
194
+ message: string;
195
+ }[];
196
+ }
197
+ export interface ApprovalInput {
198
+ question: string;
199
+ details?: string;
200
+ options?: string[];
201
+ timeoutMinutes?: number;
202
+ }
203
+ export interface Approval {
204
+ id: string;
205
+ agentName: string;
206
+ question: string;
207
+ details?: string;
208
+ options: string[];
209
+ status: 'pending' | 'answered' | 'expired';
210
+ answer?: string;
211
+ note?: string;
212
+ createdAt: string;
213
+ expiresAt: string;
214
+ answeredAt?: string;
215
+ answerUrl: string;
216
+ emailed?: boolean;
217
+ next?: string;
218
+ }
219
+ export interface Authenticator {
220
+ id: string;
221
+ name: string;
222
+ issuer: string;
223
+ accountName: string;
224
+ algorithm: 'SHA1' | 'SHA256' | 'SHA512';
225
+ digits: 6 | 7 | 8;
226
+ period: 30 | 60;
227
+ createdAt: string;
228
+ }
229
+ export interface AuthenticatorInput {
230
+ name: string;
231
+ uri?: string;
232
+ secret?: string;
233
+ imageBase64?: string;
234
+ algorithm?: 'SHA1' | 'SHA256' | 'SHA512';
235
+ digits?: 6 | 7 | 8;
236
+ period?: 30 | 60;
237
+ }
238
+ export interface TotpCode {
239
+ id: string;
240
+ code: string;
241
+ secondsRemaining: number;
242
+ expiresAt: string;
243
+ nextCode?: string;
244
+ }
245
+ export interface EmailAttachmentLink {
246
+ filename: string;
247
+ size: number;
248
+ expiresAt: string;
249
+ downloadUrl: string;
250
+ }
251
+ export type OAuthScenario = 'none' | 'access_denied' | 'invalid_grant' | 'expired_code' | 'wrong_redirect_uri' | 'invalid_pkce_verifier' | 'expired_tokens' | 'slow_token_endpoint' | 'rotated_signing_key';
252
+ export interface OAuthProviderInput {
253
+ name: string;
254
+ redirectUris: string[];
255
+ users: {
256
+ sub: string;
257
+ email: string;
258
+ name: string;
259
+ claims?: Record<string, unknown>;
260
+ }[];
261
+ claims?: Record<string, unknown>;
262
+ headless?: boolean;
263
+ scenario?: OAuthScenario;
264
+ }
265
+ export interface OAuthProvider {
266
+ id: string;
267
+ issuer: string;
268
+ endpointUrl: string;
269
+ discoveryUrl: string;
270
+ client_id: string;
271
+ expiresAt: string;
272
+ oauth: OAuthProviderInput;
273
+ }
274
+ export interface CreatedOAuthProvider extends OAuthProvider {
275
+ client_secret: string;
276
+ }
277
+ export interface Credential {
278
+ id: string;
279
+ name: string;
280
+ url: string;
281
+ username: string;
282
+ agentMayRead: boolean;
283
+ authenticatorId?: string;
284
+ inboxId?: string;
285
+ createdAt: string;
286
+ updatedAt: string;
287
+ }
288
+ export interface CredentialInput {
289
+ name: string;
290
+ url: string;
291
+ username: string;
292
+ password?: string;
293
+ passwordLength?: number;
294
+ notes?: string;
295
+ agentMayRead?: boolean;
296
+ authenticatorId?: string | null;
297
+ inboxId?: string | null;
298
+ }
299
+ export type CredentialReveal = {
300
+ status: 'awaitingApproval';
301
+ approvalId: string;
302
+ answerUrl: string;
303
+ } | {
304
+ status: 'revealed';
305
+ id: string;
306
+ password: string;
307
+ notes: string;
308
+ };
309
+ export type TestPaymentKind = 'wallet' | 'paywall' | 'checkout';
310
+ export type CheckoutOutcome = 'succeeded' | 'declined' | 'insufficient_funds' | 'requires_verification' | 'expired';
311
+ export interface TestTransaction {
312
+ id: string;
313
+ at: string;
314
+ kind: 'payment' | 'topup';
315
+ amount: number;
316
+ payee: string;
317
+ memo: string;
318
+ status: 'awaitingApproval' | 'authorized' | 'succeeded' | 'refused' | 'expired';
319
+ reason?: string;
320
+ approvalId?: string;
321
+ events: {
322
+ at: string;
323
+ status: string;
324
+ reason?: string;
325
+ }[];
326
+ }
327
+ export interface TestPaymentResource {
328
+ id: string;
329
+ kind: TestPaymentKind;
330
+ testMode: true;
331
+ name: string;
332
+ expiresAt: string;
333
+ endpointUrl?: string;
334
+ balance?: number;
335
+ availableBalance?: number;
336
+ reservedBalance?: number;
337
+ perPaymentLimit?: number;
338
+ dailyLimit?: number;
339
+ approvalThreshold?: number;
340
+ amount?: number;
341
+ currency?: string;
342
+ item?: string;
343
+ description?: string;
344
+ modes?: ('wallet' | 'permissive')[];
345
+ response?: {
346
+ status: number;
347
+ body: unknown;
348
+ };
349
+ successUrl?: string;
350
+ cancelUrl?: string;
351
+ webhookUrl?: string;
352
+ attempts?: {
353
+ id: string;
354
+ at: string;
355
+ outcome: CheckoutOutcome;
356
+ last4?: string;
357
+ verified?: boolean;
358
+ }[];
359
+ deliveries?: {
360
+ requestId: string;
361
+ at: string;
362
+ attempts: number;
363
+ status?: number;
364
+ error?: string;
365
+ }[];
366
+ }
367
+ export interface TestWalletInput {
368
+ name: string;
369
+ balance?: number;
370
+ availableBalance?: number;
371
+ reservedBalance?: number;
372
+ ttlSeconds?: number;
373
+ persistent?: boolean;
374
+ /** Only an owner/admin browser session can set spending controls. Agent keys omit them. */
375
+ perPaymentLimit?: number;
376
+ dailyLimit?: number;
377
+ approvalThreshold?: number;
378
+ }
379
+ export interface TestPaywallInput {
380
+ name: string;
381
+ amount: number;
382
+ description?: string;
383
+ modes?: ('wallet' | 'permissive')[];
384
+ response?: {
385
+ status: number;
386
+ body: unknown;
387
+ };
388
+ ttlSeconds?: number;
389
+ persistent?: boolean;
390
+ }
391
+ export interface TestCheckoutInput {
392
+ name: string;
393
+ item: string;
394
+ description?: string;
395
+ amount: number;
396
+ currency?: 'USD' | 'EUR' | 'GBP' | 'CAD' | 'AUD';
397
+ successUrl?: string;
398
+ cancelUrl?: string;
399
+ webhookUrl?: string;
400
+ ttlSeconds?: number;
401
+ persistent?: boolean;
402
+ }
403
+ export interface TestPaymentInput {
404
+ payee: string;
405
+ amount?: number;
406
+ memo?: string;
407
+ idempotencyKey: string;
408
+ authorizeOnly?: boolean;
409
+ }
410
+ export interface TestPaymentResult {
411
+ testMode: true;
412
+ status: 'awaitingApproval' | 'authorized' | 'succeeded';
413
+ transaction?: TestTransaction;
414
+ transactionId?: string;
415
+ approvalId?: string;
416
+ answerUrl?: string;
417
+ paymentHeader?: string;
418
+ headerName?: 'X-PAYMENT';
419
+ expiresAt?: string;
420
+ content?: unknown;
421
+ checkout?: TestCheckoutAttempt;
422
+ }
423
+ export interface TestCheckoutAttempt {
424
+ testMode: true;
425
+ id: string;
426
+ at: string;
427
+ outcome: CheckoutOutcome;
428
+ last4?: string;
429
+ verified?: boolean;
430
+ confirmationToken?: string;
431
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@kivel.io/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.8.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "files": [
12
+ "dist/**/*.js",
13
+ "dist/**/*.d.ts",
14
+ "CHANGELOG.md"
15
+ ],
16
+ "devDependencies": {
17
+ "typescript": "^7.0.2",
18
+ "@types/node": "^26.6.5"
19
+ },
20
+ "description": "TypeScript client for Kivel: agent login, webhooks, email, memory, monitors and approvals.",
21
+ "license": "Apache-2.0",
22
+ "engines": {
23
+ "node": ">=22.13.0"
24
+ },
25
+ "homepage": "https://kivel.io/docs/sdk/",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/TangoBeee/kivel.git",
29
+ "directory": "packages/sdk"
30
+ },
31
+ "bugs": {
32
+ "email": "support@kivel.io"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public",
36
+ "registry": "https://registry.npmjs.org/",
37
+ "tag": "beta"
38
+ },
39
+ "main": "./dist/index.js",
40
+ "types": "./dist/index.d.ts",
41
+ "scripts": {
42
+ "build": "node -e \"require('node:fs').rmSync('dist', {recursive:true,force:true})\" && tsc -p tsconfig.json",
43
+ "typecheck": "tsc -p tsconfig.json --noEmit"
44
+ }
6
45
  }