@tuteliq/sdk 2.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.
Files changed (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1034 -0
  3. package/dist/cjs/client.js +1283 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/constants.js +179 -0
  6. package/dist/cjs/constants.js.map +1 -0
  7. package/dist/cjs/errors.js +129 -0
  8. package/dist/cjs/errors.js.map +1 -0
  9. package/dist/cjs/index.js +37 -0
  10. package/dist/cjs/index.js.map +1 -0
  11. package/dist/cjs/types/account.js +6 -0
  12. package/dist/cjs/types/account.js.map +1 -0
  13. package/dist/cjs/types/analysis.js +6 -0
  14. package/dist/cjs/types/analysis.js.map +1 -0
  15. package/dist/cjs/types/guidance.js +3 -0
  16. package/dist/cjs/types/guidance.js.map +1 -0
  17. package/dist/cjs/types/index.js +28 -0
  18. package/dist/cjs/types/index.js.map +1 -0
  19. package/dist/cjs/types/media.js +6 -0
  20. package/dist/cjs/types/media.js.map +1 -0
  21. package/dist/cjs/types/policy.js +6 -0
  22. package/dist/cjs/types/policy.js.map +1 -0
  23. package/dist/cjs/types/pricing.js +6 -0
  24. package/dist/cjs/types/pricing.js.map +1 -0
  25. package/dist/cjs/types/reports.js +3 -0
  26. package/dist/cjs/types/reports.js.map +1 -0
  27. package/dist/cjs/types/safety.js +7 -0
  28. package/dist/cjs/types/safety.js.map +1 -0
  29. package/dist/cjs/types/voice-stream.js +6 -0
  30. package/dist/cjs/types/voice-stream.js.map +1 -0
  31. package/dist/cjs/types/webhooks.js +6 -0
  32. package/dist/cjs/types/webhooks.js.map +1 -0
  33. package/dist/cjs/utils/retry.js +64 -0
  34. package/dist/cjs/utils/retry.js.map +1 -0
  35. package/dist/cjs/voice-stream.js +184 -0
  36. package/dist/cjs/voice-stream.js.map +1 -0
  37. package/dist/client.d.ts +643 -0
  38. package/dist/client.d.ts.map +1 -0
  39. package/dist/client.js +1280 -0
  40. package/dist/client.js.map +1 -0
  41. package/dist/constants.d.ts +141 -0
  42. package/dist/constants.d.ts.map +1 -0
  43. package/dist/constants.js +176 -0
  44. package/dist/constants.js.map +1 -0
  45. package/dist/errors.d.ts +81 -0
  46. package/dist/errors.d.ts.map +1 -0
  47. package/dist/errors.js +116 -0
  48. package/dist/errors.js.map +1 -0
  49. package/dist/index.d.ts +6 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +9 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/types/account.d.ts +161 -0
  54. package/dist/types/account.d.ts.map +1 -0
  55. package/dist/types/account.js +5 -0
  56. package/dist/types/account.js.map +1 -0
  57. package/dist/types/analysis.d.ts +41 -0
  58. package/dist/types/analysis.d.ts.map +1 -0
  59. package/dist/types/analysis.js +4 -0
  60. package/dist/types/analysis.js.map +1 -0
  61. package/dist/types/guidance.d.ts +35 -0
  62. package/dist/types/guidance.d.ts.map +1 -0
  63. package/dist/types/guidance.js +2 -0
  64. package/dist/types/guidance.js.map +1 -0
  65. package/dist/types/index.d.ts +231 -0
  66. package/dist/types/index.d.ts.map +1 -0
  67. package/dist/types/index.js +12 -0
  68. package/dist/types/index.js.map +1 -0
  69. package/dist/types/media.d.ts +121 -0
  70. package/dist/types/media.d.ts.map +1 -0
  71. package/dist/types/media.js +4 -0
  72. package/dist/types/media.js.map +1 -0
  73. package/dist/types/policy.d.ts +54 -0
  74. package/dist/types/policy.d.ts.map +1 -0
  75. package/dist/types/policy.js +5 -0
  76. package/dist/types/policy.js.map +1 -0
  77. package/dist/types/pricing.d.ts +53 -0
  78. package/dist/types/pricing.d.ts.map +1 -0
  79. package/dist/types/pricing.js +5 -0
  80. package/dist/types/pricing.js.map +1 -0
  81. package/dist/types/reports.d.ts +44 -0
  82. package/dist/types/reports.d.ts.map +1 -0
  83. package/dist/types/reports.js +2 -0
  84. package/dist/types/reports.js.map +1 -0
  85. package/dist/types/safety.d.ts +151 -0
  86. package/dist/types/safety.d.ts.map +1 -0
  87. package/dist/types/safety.js +4 -0
  88. package/dist/types/safety.js.map +1 -0
  89. package/dist/types/voice-stream.d.ts +97 -0
  90. package/dist/types/voice-stream.d.ts.map +1 -0
  91. package/dist/types/voice-stream.js +5 -0
  92. package/dist/types/voice-stream.js.map +1 -0
  93. package/dist/types/webhooks.d.ts +110 -0
  94. package/dist/types/webhooks.d.ts.map +1 -0
  95. package/dist/types/webhooks.js +4 -0
  96. package/dist/types/webhooks.js.map +1 -0
  97. package/dist/utils/retry.d.ts +17 -0
  98. package/dist/utils/retry.d.ts.map +1 -0
  99. package/dist/utils/retry.js +61 -0
  100. package/dist/utils/retry.js.map +1 -0
  101. package/dist/voice-stream.d.ts +16 -0
  102. package/dist/voice-stream.d.ts.map +1 -0
  103. package/dist/voice-stream.js +148 -0
  104. package/dist/voice-stream.js.map +1 -0
  105. package/package.json +81 -0
@@ -0,0 +1,643 @@
1
+ import { TuteliqOptions, Usage, RateLimitInfo, DetectBullyingInput, BullyingResult, DetectGroomingInput, GroomingResult, DetectUnsafeInput, UnsafeResult, AnalyzeInput, AnalyzeResult, ContextInput, AnalyzeEmotionsInput, EmotionsResult, GetActionPlanInput, ActionPlanResult, GenerateReportInput, ReportResult, PolicyConfig, PolicyConfigResponse, UsageSummary, UsageQuota, BatchAnalyzeInput, BatchAnalyzeResult, AccountDeletionResult, AccountExportResult, RecordConsentInput, ConsentStatusResult, ConsentActionResult, ConsentType, RectifyDataInput, RectifyDataResult, AuditLogsResult, GetAuditLogsOptions, LogBreachInput, LogBreachResult, BreachListResult, BreachResult, UpdateBreachInput, GetBreachesOptions, AnalyzeVoiceInput, VoiceAnalysisResult, AnalyzeImageInput, ImageAnalysisResult, WebhookListResult, CreateWebhookInput, CreateWebhookResult, UpdateWebhookInput, UpdateWebhookResult, DeleteWebhookResult, TestWebhookResult, RegenerateSecretResult, PricingResult, PricingDetailsResult, UsageHistoryResult, UsageByToolResult, UsageMonthlyResult, VoiceStreamConfig, VoiceStreamHandlers, VoiceStreamSession } from './types/index.js';
2
+ /**
3
+ * Tuteliq - AI-powered child safety analysis
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { Tuteliq } from '@tuteliq/sdk'
8
+ *
9
+ * const tuteliq = new Tuteliq(process.env.TUTELIQ_API_KEY)
10
+ *
11
+ * // Detect bullying
12
+ * const result = await tuteliq.detectBullying({
13
+ * content: "You're not welcome here",
14
+ * context: 'chat'
15
+ * })
16
+ *
17
+ * if (result.is_bullying) {
18
+ * console.log('Severity:', result.severity)
19
+ * console.log('Rationale:', result.rationale)
20
+ * }
21
+ *
22
+ * // Check usage
23
+ * console.log(tuteliq.usage) // { limit: 10000, used: 5234, remaining: 4766 }
24
+ * ```
25
+ */
26
+ export declare class Tuteliq {
27
+ private readonly apiKey;
28
+ private readonly timeout;
29
+ private readonly retries;
30
+ private readonly retryDelay;
31
+ private _usage;
32
+ private _rateLimit;
33
+ private _lastRequestId;
34
+ private _lastLatencyMs;
35
+ private _usageWarning;
36
+ /**
37
+ * Create a new Tuteliq client
38
+ *
39
+ * @param apiKey - Your Tuteliq API key
40
+ * @param options - Optional configuration
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // Simple usage
45
+ * const tuteliq = new Tuteliq('your-api-key')
46
+ *
47
+ * // With options
48
+ * const tuteliq = new Tuteliq('your-api-key', {
49
+ * timeout: 10000
50
+ * })
51
+ * ```
52
+ */
53
+ constructor(apiKey: string, options?: TuteliqOptions);
54
+ /**
55
+ * Get current monthly usage stats from the last request
56
+ */
57
+ get usage(): Usage | null;
58
+ /**
59
+ * Get rate limit info from the last request (per-minute limits)
60
+ */
61
+ get rateLimit(): RateLimitInfo | null;
62
+ /**
63
+ * Get usage warning message if usage is above 80%
64
+ */
65
+ get usageWarning(): string | null;
66
+ /**
67
+ * Get the request ID from the last request
68
+ */
69
+ get lastRequestId(): string | null;
70
+ /**
71
+ * Get the latency from the last request in milliseconds
72
+ */
73
+ get lastLatencyMs(): number | null;
74
+ /**
75
+ * Validate content length to prevent abuse
76
+ */
77
+ private validateContent;
78
+ /**
79
+ * Validate messages array
80
+ */
81
+ private validateMessages;
82
+ private static readonly SDK_IDENTIFIER;
83
+ /**
84
+ * Resolves the platform string by appending the SDK identifier.
85
+ * - "MyApp" → "MyApp - Node SDK"
86
+ * - undefined → "Node SDK"
87
+ */
88
+ private static resolvePlatform;
89
+ /**
90
+ * Normalize context input to API format
91
+ */
92
+ private normalizeContext;
93
+ /**
94
+ * Make an authenticated request to the API
95
+ */
96
+ private request;
97
+ /**
98
+ * Handle error responses from the API
99
+ */
100
+ private handleErrorResponse;
101
+ /**
102
+ * Make a request with retry logic
103
+ */
104
+ private requestWithRetry;
105
+ /**
106
+ * Make an authenticated multipart request to the API
107
+ */
108
+ private multipartRequest;
109
+ /**
110
+ * Detect bullying in content
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * const result = await tuteliq.detectBullying({
115
+ * content: "Nobody likes you, loser",
116
+ * context: 'chat'
117
+ * })
118
+ *
119
+ * if (result.is_bullying && result.severity === 'high') {
120
+ * console.log('High severity bullying detected')
121
+ * console.log('Rationale:', result.rationale)
122
+ * }
123
+ * ```
124
+ */
125
+ detectBullying(input: DetectBullyingInput): Promise<BullyingResult>;
126
+ /**
127
+ * Detect grooming patterns in a conversation
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * const result = await tuteliq.detectGrooming({
132
+ * messages: [
133
+ * { role: 'adult', content: "Don't tell your parents" },
134
+ * { role: 'child', content: "Ok" }
135
+ * ],
136
+ * childAge: 12
137
+ * })
138
+ *
139
+ * if (result.grooming_risk === 'high') {
140
+ * console.log('Flags:', result.flags)
141
+ * }
142
+ * ```
143
+ */
144
+ detectGrooming(input: DetectGroomingInput): Promise<GroomingResult>;
145
+ /**
146
+ * Detect unsafe content (self-harm, violence, hate speech, etc.)
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const result = await tuteliq.detectUnsafe({
151
+ * content: "I want to hurt myself"
152
+ * })
153
+ *
154
+ * if (result.unsafe && result.categories.includes('self_harm')) {
155
+ * console.log('Show crisis resources')
156
+ * }
157
+ * ```
158
+ */
159
+ detectUnsafe(input: DetectUnsafeInput): Promise<UnsafeResult>;
160
+ /**
161
+ * Quick analysis - runs bullying and unsafe detection, returns combined result
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * const result = await tuteliq.analyze("Some user message")
166
+ *
167
+ * if (result.risk_level !== 'safe') {
168
+ * console.log('Risk:', result.risk_level)
169
+ * console.log('Summary:', result.summary)
170
+ * }
171
+ * ```
172
+ */
173
+ analyze(content: string, context?: ContextInput): Promise<AnalyzeResult>;
174
+ analyze(input: AnalyzeInput): Promise<AnalyzeResult>;
175
+ /**
176
+ * Analyze emotions in content or conversation
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * const result = await tuteliq.analyzeEmotions({
181
+ * content: "I'm so stressed about everything"
182
+ * })
183
+ *
184
+ * console.log('Emotions:', result.dominant_emotions)
185
+ * console.log('Trend:', result.trend)
186
+ * ```
187
+ */
188
+ analyzeEmotions(input: AnalyzeEmotionsInput): Promise<EmotionsResult>;
189
+ /**
190
+ * Get age-appropriate action guidance for a situation
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * const plan = await tuteliq.getActionPlan({
195
+ * situation: 'Someone is spreading rumors about me',
196
+ * childAge: 12,
197
+ * audience: 'child'
198
+ * })
199
+ *
200
+ * console.log('Steps:', plan.steps)
201
+ * ```
202
+ */
203
+ getActionPlan(input: GetActionPlanInput): Promise<ActionPlanResult>;
204
+ /**
205
+ * Generate an incident report from messages
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * const report = await tuteliq.generateReport({
210
+ * messages: [
211
+ * { sender: 'user1', content: 'Harmful message' },
212
+ * { sender: 'child', content: 'Response' }
213
+ * ],
214
+ * childAge: 14
215
+ * })
216
+ *
217
+ * console.log('Summary:', report.summary)
218
+ * console.log('Risk:', report.risk_level)
219
+ * console.log('Next steps:', report.recommended_next_steps)
220
+ * ```
221
+ */
222
+ generateReport(input: GenerateReportInput): Promise<ReportResult>;
223
+ /**
224
+ * Get the current policy configuration
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const policy = await tuteliq.getPolicy()
229
+ * console.log('Bullying enabled:', policy.config?.bullying.enabled)
230
+ * ```
231
+ */
232
+ getPolicy(): Promise<PolicyConfigResponse>;
233
+ /**
234
+ * Update the policy configuration
235
+ *
236
+ * @example
237
+ * ```typescript
238
+ * await tuteliq.setPolicy({
239
+ * bullying: {
240
+ * enabled: true,
241
+ * minRiskScoreToFlag: 0.5
242
+ * }
243
+ * })
244
+ * ```
245
+ */
246
+ setPolicy(config: PolicyConfig): Promise<PolicyConfigResponse>;
247
+ /**
248
+ * Analyze multiple items in a single batch request
249
+ *
250
+ * @example
251
+ * ```typescript
252
+ * const result = await tuteliq.batch({
253
+ * items: [
254
+ * { type: 'bullying', content: 'Message 1' },
255
+ * { type: 'unsafe', content: 'Message 2' },
256
+ * ],
257
+ * parallel: true
258
+ * })
259
+ *
260
+ * console.log('Success:', result.summary.successful)
261
+ * console.log('Failed:', result.summary.failed)
262
+ * ```
263
+ */
264
+ batch(input: BatchAnalyzeInput): Promise<BatchAnalyzeResult>;
265
+ /**
266
+ * Get usage summary for the current billing period
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const summary = await tuteliq.getUsageSummary()
271
+ * console.log('Used:', summary.messages_used)
272
+ * console.log('Limit:', summary.message_limit)
273
+ * console.log('Percent:', summary.usage_percentage)
274
+ * ```
275
+ */
276
+ getUsageSummary(): Promise<UsageSummary>;
277
+ /**
278
+ * Get current rate limit quota status
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const quota = await tuteliq.getQuota()
283
+ * console.log('Rate limit:', quota.rate_limit)
284
+ * console.log('Remaining this minute:', quota.remaining)
285
+ * ```
286
+ */
287
+ getQuota(): Promise<UsageQuota>;
288
+ /**
289
+ * Delete all data associated with your account (GDPR Article 17 — Right to Erasure)
290
+ *
291
+ * This permanently deletes all user data including API keys, usage logs,
292
+ * incidents, emotional records, grooming assessments, and safety goals.
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * const result = await tuteliq.deleteAccountData()
297
+ * console.log(result.message) // "All user data has been deleted"
298
+ * console.log(result.deleted_count) // 42
299
+ * ```
300
+ */
301
+ deleteAccountData(): Promise<AccountDeletionResult>;
302
+ /**
303
+ * Export all data associated with your account (GDPR Article 20 — Right to Data Portability)
304
+ *
305
+ * Returns a JSON export of all stored data grouped by collection.
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * const data = await tuteliq.exportAccountData()
310
+ * console.log(data.userId)
311
+ * console.log(data.exportedAt)
312
+ * console.log(Object.keys(data.data)) // ['api_keys', 'incidents', ...]
313
+ * ```
314
+ */
315
+ exportAccountData(): Promise<AccountExportResult>;
316
+ /**
317
+ * Record user consent (GDPR Article 7)
318
+ *
319
+ * Creates an immutable consent record for audit trail.
320
+ *
321
+ * @example
322
+ * ```typescript
323
+ * const result = await tuteliq.recordConsent({
324
+ * consent_type: 'child_safety_monitoring',
325
+ * version: '1.0'
326
+ * })
327
+ * ```
328
+ */
329
+ recordConsent(input: RecordConsentInput): Promise<ConsentActionResult>;
330
+ /**
331
+ * Get current consent status (GDPR Article 7)
332
+ *
333
+ * Returns the latest consent record per type.
334
+ *
335
+ * @example
336
+ * ```typescript
337
+ * // Get all consent statuses
338
+ * const all = await tuteliq.getConsentStatus()
339
+ *
340
+ * // Get specific consent type
341
+ * const monitoring = await tuteliq.getConsentStatus('child_safety_monitoring')
342
+ * ```
343
+ */
344
+ getConsentStatus(type?: ConsentType): Promise<ConsentStatusResult>;
345
+ /**
346
+ * Withdraw consent (GDPR Article 7.3)
347
+ *
348
+ * Creates a withdrawal record. Does not delete consent history.
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * const result = await tuteliq.withdrawConsent('marketing')
353
+ * ```
354
+ */
355
+ withdrawConsent(type: ConsentType): Promise<ConsentActionResult>;
356
+ /**
357
+ * Rectify user data (GDPR Article 16 — Right to Rectification)
358
+ *
359
+ * Updates allowlisted fields on a specific document.
360
+ *
361
+ * @example
362
+ * ```typescript
363
+ * const result = await tuteliq.rectifyData({
364
+ * collection: 'incidents',
365
+ * document_id: 'abc123',
366
+ * fields: { summary: 'Corrected summary' }
367
+ * })
368
+ * ```
369
+ */
370
+ rectifyData(input: RectifyDataInput): Promise<RectifyDataResult>;
371
+ /**
372
+ * Get audit logs (GDPR Article 15 — Right of Access)
373
+ *
374
+ * Returns the user's audit trail of all data operations.
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * // Get all audit logs
379
+ * const logs = await tuteliq.getAuditLogs()
380
+ *
381
+ * // Filter by action
382
+ * const exports = await tuteliq.getAuditLogs({ action: 'data_export', limit: 10 })
383
+ * ```
384
+ */
385
+ getAuditLogs(options?: GetAuditLogsOptions): Promise<AuditLogsResult>;
386
+ /**
387
+ * Log a new data breach
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * const result = await tuteliq.logBreach({
392
+ * title: 'Unauthorized access to user data',
393
+ * description: 'A third-party service exposed user emails',
394
+ * severity: 'high',
395
+ * affected_user_ids: ['user-1', 'user-2'],
396
+ * data_categories: ['email', 'name'],
397
+ * reported_by: 'security-team'
398
+ * })
399
+ * ```
400
+ */
401
+ logBreach(input: LogBreachInput): Promise<LogBreachResult>;
402
+ /**
403
+ * List data breaches
404
+ *
405
+ * @example
406
+ * ```typescript
407
+ * // List all breaches
408
+ * const all = await tuteliq.listBreaches()
409
+ *
410
+ * // Filter by status
411
+ * const active = await tuteliq.listBreaches({ status: 'investigating', limit: 10 })
412
+ * ```
413
+ */
414
+ listBreaches(options?: GetBreachesOptions): Promise<BreachListResult>;
415
+ /**
416
+ * Get a single breach by ID
417
+ *
418
+ * @example
419
+ * ```typescript
420
+ * const result = await tuteliq.getBreach('breach-123')
421
+ * console.log(result.breach.status)
422
+ * ```
423
+ */
424
+ getBreach(id: string): Promise<BreachResult>;
425
+ /**
426
+ * Update a breach's status and notification status
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * const result = await tuteliq.updateBreachStatus('breach-123', {
431
+ * status: 'contained',
432
+ * notification_status: 'users_notified',
433
+ * notes: 'All affected users have been notified via email'
434
+ * })
435
+ * ```
436
+ */
437
+ updateBreachStatus(id: string, input: UpdateBreachInput): Promise<BreachResult>;
438
+ /**
439
+ * Analyze voice/audio for safety concerns
440
+ *
441
+ * Transcribes the audio via Whisper, then runs safety analysis on the transcript.
442
+ *
443
+ * @example
444
+ * ```typescript
445
+ * import { readFileSync } from 'fs'
446
+ *
447
+ * const result = await tuteliq.analyzeVoice({
448
+ * file: readFileSync('recording.mp3'),
449
+ * filename: 'recording.mp3',
450
+ * analysisType: 'all'
451
+ * })
452
+ *
453
+ * console.log('Transcript:', result.transcription.text)
454
+ * console.log('Risk:', result.overall_severity)
455
+ * ```
456
+ */
457
+ analyzeVoice(input: AnalyzeVoiceInput): Promise<VoiceAnalysisResult>;
458
+ /**
459
+ * Analyze an image for safety concerns
460
+ *
461
+ * Uses vision AI for visual content classification and OCR text extraction,
462
+ * then runs safety analysis on any extracted text.
463
+ *
464
+ * @example
465
+ * ```typescript
466
+ * import { readFileSync } from 'fs'
467
+ *
468
+ * const result = await tuteliq.analyzeImage({
469
+ * file: readFileSync('screenshot.png'),
470
+ * filename: 'screenshot.png',
471
+ * analysisType: 'all'
472
+ * })
473
+ *
474
+ * console.log('Visual:', result.vision.visual_description)
475
+ * console.log('OCR text:', result.vision.extracted_text)
476
+ * console.log('Risk:', result.overall_severity)
477
+ * ```
478
+ */
479
+ analyzeImage(input: AnalyzeImageInput): Promise<ImageAnalysisResult>;
480
+ /**
481
+ * List all webhooks for your account
482
+ *
483
+ * @example
484
+ * ```typescript
485
+ * const { webhooks } = await tuteliq.listWebhooks()
486
+ * webhooks.forEach(w => console.log(w.name, w.is_active))
487
+ * ```
488
+ */
489
+ listWebhooks(): Promise<WebhookListResult>;
490
+ /**
491
+ * Create a new webhook
492
+ *
493
+ * The returned `secret` is only shown once — store it securely for
494
+ * signature verification.
495
+ *
496
+ * @example
497
+ * ```typescript
498
+ * import { WebhookEventType } from '@tuteliq/sdk'
499
+ *
500
+ * const result = await tuteliq.createWebhook({
501
+ * name: 'Safety Alerts',
502
+ * url: 'https://example.com/webhooks/tuteliq',
503
+ * events: [WebhookEventType.INCIDENT_CRITICAL, WebhookEventType.GROOMING_DETECTED]
504
+ * })
505
+ *
506
+ * console.log('Secret:', result.secret) // Store this securely!
507
+ * ```
508
+ */
509
+ createWebhook(input: CreateWebhookInput): Promise<CreateWebhookResult>;
510
+ /**
511
+ * Update an existing webhook
512
+ *
513
+ * @example
514
+ * ```typescript
515
+ * const result = await tuteliq.updateWebhook('webhook-123', {
516
+ * name: 'Updated Name',
517
+ * isActive: false
518
+ * })
519
+ * ```
520
+ */
521
+ updateWebhook(id: string, input: UpdateWebhookInput): Promise<UpdateWebhookResult>;
522
+ /**
523
+ * Delete a webhook
524
+ *
525
+ * @example
526
+ * ```typescript
527
+ * await tuteliq.deleteWebhook('webhook-123')
528
+ * ```
529
+ */
530
+ deleteWebhook(id: string): Promise<DeleteWebhookResult>;
531
+ /**
532
+ * Send a test payload to a webhook
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * const result = await tuteliq.testWebhook('webhook-123')
537
+ * console.log('Success:', result.success)
538
+ * console.log('Latency:', result.latency_ms, 'ms')
539
+ * ```
540
+ */
541
+ testWebhook(id: string): Promise<TestWebhookResult>;
542
+ /**
543
+ * Regenerate a webhook's signing secret
544
+ *
545
+ * The old secret is immediately invalidated.
546
+ *
547
+ * @example
548
+ * ```typescript
549
+ * const { secret } = await tuteliq.regenerateWebhookSecret('webhook-123')
550
+ * // Update your verification logic with the new secret
551
+ * ```
552
+ */
553
+ regenerateWebhookSecret(id: string): Promise<RegenerateSecretResult>;
554
+ /**
555
+ * Get public pricing plans (no authentication required)
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * const { plans } = await tuteliq.getPricing()
560
+ * plans.forEach(p => console.log(p.name, p.price))
561
+ * ```
562
+ */
563
+ getPricing(): Promise<PricingResult>;
564
+ /**
565
+ * Get detailed pricing plans with monthly/yearly prices
566
+ *
567
+ * @example
568
+ * ```typescript
569
+ * const { plans } = await tuteliq.getPricingDetails()
570
+ * plans.forEach(p => console.log(p.name, p.price_monthly, p.api_calls_per_month))
571
+ * ```
572
+ */
573
+ getPricingDetails(): Promise<PricingDetailsResult>;
574
+ /**
575
+ * Get usage history for the past N days
576
+ *
577
+ * @param days - Number of days (1-30, defaults to 7)
578
+ *
579
+ * @example
580
+ * ```typescript
581
+ * const { days } = await tuteliq.getUsageHistory(14)
582
+ * days.forEach(d => console.log(d.date, d.total_requests))
583
+ * ```
584
+ */
585
+ getUsageHistory(days?: number): Promise<UsageHistoryResult>;
586
+ /**
587
+ * Get usage broken down by tool/endpoint
588
+ *
589
+ * @param date - Date in YYYY-MM-DD format (defaults to today)
590
+ *
591
+ * @example
592
+ * ```typescript
593
+ * const result = await tuteliq.getUsageByTool()
594
+ * console.log('Tools:', result.tools)
595
+ * console.log('Endpoints:', result.endpoints)
596
+ * ```
597
+ */
598
+ getUsageByTool(date?: string): Promise<UsageByToolResult>;
599
+ /**
600
+ * Get monthly usage, limits, and upgrade recommendations
601
+ *
602
+ * @example
603
+ * ```typescript
604
+ * const monthly = await tuteliq.getUsageMonthly()
605
+ * console.log('Used:', monthly.usage.used, '/', monthly.usage.limit)
606
+ * console.log('Days left:', monthly.billing.days_remaining)
607
+ *
608
+ * if (monthly.recommendations?.should_upgrade) {
609
+ * console.log('Consider upgrading to', monthly.recommendations.suggested_tier)
610
+ * }
611
+ * ```
612
+ */
613
+ getUsageMonthly(): Promise<UsageMonthlyResult>;
614
+ /**
615
+ * Open a real-time voice streaming session over WebSocket.
616
+ *
617
+ * Requires the `ws` package as an optional peer dependency:
618
+ * ```bash
619
+ * npm install ws
620
+ * ```
621
+ *
622
+ * @example
623
+ * ```typescript
624
+ * const session = client.voiceStream(
625
+ * { intervalSeconds: 10, analysisTypes: ['bullying', 'unsafe'] },
626
+ * {
627
+ * onTranscription: (e) => console.log('Transcript:', e.text),
628
+ * onAlert: (e) => console.log('Alert:', e.category, e.severity),
629
+ * }
630
+ * );
631
+ *
632
+ * // Send audio chunks as they arrive
633
+ * session.sendAudio(audioBuffer);
634
+ *
635
+ * // End session and get summary
636
+ * const summary = await session.end();
637
+ * console.log('Risk:', summary.overall_risk);
638
+ * ```
639
+ */
640
+ voiceStream(config?: VoiceStreamConfig, handlers?: VoiceStreamHandlers): VoiceStreamSession;
641
+ }
642
+ export { Tuteliq as TuteliqClient };
643
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,EACL,aAAa,EAGb,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAEhB,mBAAmB,EACnB,YAAY,EAEZ,YAAY,EACZ,oBAAoB,EAEpB,YAAY,EACZ,UAAU,EAEV,iBAAiB,EACjB,kBAAkB,EAElB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EAEnB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAElB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EAEnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EAEtB,aAAa,EACb,oBAAoB,EAEpB,kBAAkB,EAClB,iBAAiB,EAC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