autokap 1.3.31 → 1.4.2

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.
@@ -70,7 +70,7 @@ export async function generateTtsChunk(config, request) {
70
70
  const format = request.format ?? DEFAULT_RESPONSE_FORMAT;
71
71
  const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
72
72
  const maxRetries = Math.max(0, config.maxRetries ?? DEFAULT_MAX_RETRIES);
73
- const audioBuffer = await fetchAudioWithRetry({
73
+ const { audioBuffer, generationId } = await fetchAudioWithRetry({
74
74
  baseUrl,
75
75
  apiKey: config.apiKey,
76
76
  model,
@@ -89,6 +89,7 @@ export async function generateTtsChunk(config, request) {
89
89
  durationMs,
90
90
  model,
91
91
  voice: request.voice,
92
+ generationId,
92
93
  };
93
94
  }
94
95
  async function fetchAudioWithRetry(params) {
@@ -153,7 +154,10 @@ async function fetchAudio(params) {
153
154
  if (arrayBuffer.byteLength === 0) {
154
155
  throw new TtsError('TTS provider returned empty body');
155
156
  }
156
- return Buffer.from(arrayBuffer);
157
+ return {
158
+ audioBuffer: Buffer.from(arrayBuffer),
159
+ generationId: response.headers.get('x-request-id'),
160
+ };
157
161
  }
158
162
  finally {
159
163
  clearTimeout(timeoutHandle);
package/dist/types.d.ts CHANGED
@@ -583,7 +583,7 @@ export interface ClipOptions {
583
583
  /** Usage metadata from a single OpenRouter API call */
584
584
  export interface StepUsage {
585
585
  stepNumber: number;
586
- stepType: 'agent_iteration' | 'verification' | 'element_capture' | 'video_planning' | 'video_variant_classification' | 'video_step_verification' | 'video_step_fix' | 'assistant_chat' | 'studio_creation' | 'studio_iteration' | 'mock_data_generation' | 'page_identity_classification' | 'capture_verification' | 'alt_text_generation' | 'healer_invocation';
586
+ stepType: 'agent_iteration' | 'verification' | 'element_capture' | 'video_planning' | 'video_variant_classification' | 'video_step_verification' | 'video_step_fix' | 'assistant_chat' | 'studio_creation' | 'studio_iteration' | 'studio_capture_suggestion' | 'mock_data_generation' | 'page_identity_classification' | 'capture_verification' | 'alt_text_generation' | 'healer_invocation' | 'cron_feedback_classification' | 'tts_generation' | 'crm_landing_analysis' | 'crm_mail_generation';
587
587
  generationId: string | null;
588
588
  modelRequested: string;
589
589
  modelUsed: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autokap",
3
- "version": "1.3.31",
3
+ "version": "1.4.2",
4
4
  "description": "AI-powered CLI tool for capturing clean screenshots of websites",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -231,7 +231,8 @@
231
231
  "satori": "^0.26.0",
232
232
  "wawoff2": "^2.0.1",
233
233
  "ws": "^8.20.0",
234
- "zod": "^4.3.6"
234
+ "zod": "^4.3.6",
235
+ "cheerio": "^1.1.2"
235
236
  },
236
237
  "devDependencies": {
237
238
  "@types/node": "^25.3.3",
@@ -1,124 +0,0 @@
1
- import type { SupabaseClient } from '@supabase/supabase-js';
2
- export type BillingPlanId = 'free' | 'maker' | 'team';
3
- export interface BillingPlanEntitlements {
4
- creditsPerMonth: number;
5
- maxProjects: number | null;
6
- maxPresetsPerProject: number | null;
7
- allowFullPageCapture: boolean;
8
- allowElementCapture: boolean;
9
- retentionDays: number;
10
- watermarkScreenshots: boolean;
11
- maxLanguages: number | null;
12
- maxThemes: number | null;
13
- apiAccess: boolean;
14
- captureCompleteWebhook: boolean;
15
- priorityQueue: boolean;
16
- maxParallelCaptures: number;
17
- teamMembers: boolean;
18
- aiDailyCostLimitUsd: number;
19
- apiRateLimitRpm: number;
20
- maxDevLinks: number | null;
21
- maxTeamMembersPerProject: number | null;
22
- }
23
- export interface BillingPlan {
24
- id: BillingPlanId;
25
- nameKey: BillingPlanId;
26
- descriptionKey: 'forEvaluation' | 'forMakers' | 'forTeams';
27
- monthlyPriceEur: number;
28
- yearlyPriceEur: number;
29
- highlighted?: boolean;
30
- previewCurrent?: boolean;
31
- highlights: string[];
32
- entitlements: BillingPlanEntitlements;
33
- }
34
- export interface BillingAccount {
35
- user_id: string;
36
- email: string | null;
37
- admin_override_plan_id: BillingPlanId | null;
38
- stripe_customer_id: string | null;
39
- stripe_subscription_id: string | null;
40
- stripe_plan_id: BillingPlanId | null;
41
- stripe_subscription_status: string | null;
42
- stripe_current_period_start: string | null;
43
- stripe_current_period_end: string | null;
44
- allow_capture_overages: boolean;
45
- capture_overage_limit_cents: number | null;
46
- signup_bonus_credits: number;
47
- created_at: string;
48
- }
49
- export declare class PlanLimitError extends Error {
50
- status: number;
51
- code: string;
52
- constructor(message: string, status?: number, code?: string);
53
- }
54
- export declare const SCREENSHOT_CREDIT_COST = 1;
55
- export declare function getBillingPlan(planId: BillingPlanId): BillingPlan;
56
- export declare function coerceBillingPlanId(value: unknown): BillingPlanId | null;
57
- export declare function getBillingAccountForUser(supabase: SupabaseClient, userId: string): Promise<BillingAccount | null>;
58
- export declare function getProjectOwnerBillingContext(supabase: SupabaseClient, projectId: string): Promise<{
59
- ownerUserId: string;
60
- plan: BillingPlan;
61
- }>;
62
- export declare function shouldUseStripePlan(status: string | null | undefined): boolean;
63
- export declare function isYearlySubscription(account: BillingAccount | null): boolean;
64
- export declare function getStripeOveragePriceIdForPlan(planId: BillingPlanId): string | null;
65
- export declare function recordStripeMeterEvent(params: {
66
- customerId: string;
67
- value: number;
68
- identifier: string;
69
- }): Promise<void>;
70
- export declare function getCaptureConfigLimitViolations(config: {
71
- langs: string[];
72
- themes: string[];
73
- elements?: unknown[];
74
- }, entitlements: BillingPlanEntitlements): string[];
75
- export declare function ensureCaptureConfigAllowed(plan: BillingPlan, config: {
76
- langs: string[];
77
- themes: string[];
78
- elements?: unknown[];
79
- }): void;
80
- export declare function getLockedResourceIds(supabase: SupabaseClient, ownerUserId: string, plan: BillingPlan): Promise<{
81
- lockedProjectIds: Set<string>;
82
- lockedPresetIdsByProject: Map<string, Set<string>>;
83
- }>;
84
- export declare function ensureResourceNotLocked(resourceId: string, lockedIds: Set<string>, resourceType?: 'project' | 'preset'): void;
85
- export declare function getRemainingOverageCredits(params: {
86
- planId: BillingPlanId;
87
- quota: number;
88
- usedCredits: number;
89
- overageLimitCents: number | null;
90
- }): number | null;
91
- export declare function getCaptureOverageState(params: {
92
- planId: BillingPlanId;
93
- quota: number;
94
- usedCredits: number;
95
- allowOverages: boolean;
96
- overageLimitCents: number | null;
97
- hasActiveSubscription: boolean;
98
- hasOveragePrice: boolean;
99
- isYearlySubscription: boolean;
100
- }): {
101
- eligible: boolean;
102
- enabled: boolean;
103
- limitReached: boolean;
104
- spendCents: number;
105
- remainingBudgetCents: number | null;
106
- remainingCredits: number | null;
107
- };
108
- export declare function getSignupBonusCredits(account: {
109
- signup_bonus_credits?: number;
110
- created_at?: string;
111
- } | null, billingPeriodStart: string): number;
112
- export declare function ensureMonthlyCreditsQuota(plan: BillingPlan, usedCredits: number, requestedCredits: number, allowOverage?: boolean, overageLimitCents?: number | null, bonusCredits?: number): void;
113
- export declare function getOwnerBillingUsage(supabase: SupabaseClient, ownerUserId: string, billingPeriodStartOverride?: string): Promise<{
114
- billingPeriodStart: string;
115
- credits: number;
116
- }>;
117
- export declare function getIncrementalOverageCount(params: {
118
- quota: number;
119
- usedBefore: number;
120
- completedCount: number;
121
- }): number;
122
- export declare function cleanupExpiredCapturesForOwner(supabase: SupabaseClient, ownerUserId: string): Promise<{
123
- deletedCaptures: number;
124
- }>;