@kepler-insights/sdk 1.0.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,351 @@
1
+ /**
2
+ * Response type definitions matching Ki_dev/docs/openapi.yaml.
3
+ *
4
+ * Hand-written for clarity. Every type uses non-readonly fields so callers
5
+ * can spread or modify freely. Unknown server-added fields pass through
6
+ * unmolested — we don't validate at runtime (the API contract is enforced
7
+ * server-side; clients trust it).
8
+ */
9
+ interface Buckets {
10
+ team_structure: number;
11
+ market_position: number;
12
+ momentum_tailwinds: number;
13
+ financial_health: number;
14
+ }
15
+ interface Rank {
16
+ percentile: number;
17
+ cohort_size: number;
18
+ }
19
+ type CacheStatus = "cached" | "cold";
20
+ interface XKeplerMeta {
21
+ tier: string;
22
+ cache_status: CacheStatus;
23
+ freshness_window_hours: number;
24
+ }
25
+ interface Score {
26
+ mode?: string;
27
+ domain: string;
28
+ scored_at: string;
29
+ ki_rating: string;
30
+ composite_score: number;
31
+ scale_premium: number;
32
+ buckets: Buckets;
33
+ rank?: Rank;
34
+ x_kepler?: XKeplerMeta;
35
+ }
36
+ interface HistoryRecord {
37
+ scored_at: string;
38
+ composite_score: number;
39
+ scale_premium: number;
40
+ ki_rating: string;
41
+ momentum_index?: number;
42
+ buckets: Buckets;
43
+ data_completeness_pct?: number;
44
+ }
45
+ interface HistoryPage {
46
+ mode?: string;
47
+ domain: string;
48
+ records: HistoryRecord[];
49
+ next_cursor?: string;
50
+ }
51
+ interface CohortContext {
52
+ sector?: string;
53
+ geo_scope?: string;
54
+ }
55
+ interface CohortTarget {
56
+ domain: string;
57
+ company_name?: string;
58
+ composite_score: number;
59
+ ki_rating: string;
60
+ business_profile?: string;
61
+ context?: CohortContext;
62
+ }
63
+ interface CohortStats {
64
+ count: number;
65
+ mean: number;
66
+ p50: number;
67
+ p90: number;
68
+ stddev: number;
69
+ min: number;
70
+ max: number;
71
+ rank: number;
72
+ percentile: number;
73
+ }
74
+ interface BucketDelta {
75
+ target: number;
76
+ cohort: number;
77
+ delta: number;
78
+ }
79
+ interface CohortMember {
80
+ domain: string;
81
+ company_name?: string;
82
+ composite_score: number;
83
+ ki_rating: string;
84
+ business_profile?: string;
85
+ }
86
+ interface Cohort {
87
+ mode?: string;
88
+ target: CohortTarget;
89
+ cohort: CohortStats;
90
+ bucket_means: Record<string, BucketDelta>;
91
+ members: CohortMember[];
92
+ }
93
+ type ConfidenceBand = "high" | "medium" | "directional";
94
+ interface Confidence {
95
+ mode?: string;
96
+ domain: string;
97
+ scored_at: string;
98
+ band: ConfidenceBand;
99
+ completeness_pct: number;
100
+ failed_fetchers: string[];
101
+ data_warnings: string[];
102
+ missing_signals: string[];
103
+ }
104
+ interface HistBin {
105
+ range: string;
106
+ count: number;
107
+ }
108
+ interface Universe {
109
+ count: number;
110
+ mean: number;
111
+ p50: number;
112
+ p90: number;
113
+ stddev: number;
114
+ min: number;
115
+ max: number;
116
+ composite_hist: HistBin[];
117
+ scale_premium_hist: HistBin[];
118
+ rating_dist: Record<string, number>;
119
+ profile_split: Record<string, number>;
120
+ }
121
+ interface Distribution {
122
+ mode?: string;
123
+ pipeline_version: string;
124
+ universe: Universe;
125
+ }
126
+ type Window = "7d" | "30d" | "90d";
127
+ interface MoverRow {
128
+ domain: string;
129
+ company_name?: string;
130
+ composite_now: number;
131
+ composite_then: number;
132
+ delta: number;
133
+ ki_rating_now: string;
134
+ ki_rating_then: string;
135
+ }
136
+ interface Movers {
137
+ mode?: string;
138
+ window: Window;
139
+ window_start: string;
140
+ window_end: string;
141
+ gainers: MoverRow[];
142
+ decliners: MoverRow[];
143
+ }
144
+ type Actionability = "actionable" | "slow_actionable" | "immutable";
145
+ interface Signal {
146
+ key: string;
147
+ label: string;
148
+ bucket: string;
149
+ category: string;
150
+ weight: number;
151
+ actionability: Actionability;
152
+ description: string;
153
+ }
154
+ interface SignalsManifest {
155
+ version: string;
156
+ signals: Signal[];
157
+ }
158
+ interface TierLimits {
159
+ cached_calls_included: number | null;
160
+ cold_calls_included: number | null;
161
+ freshness_window_hours: number;
162
+ }
163
+ interface Usage {
164
+ mode?: string;
165
+ user_id: string;
166
+ period: string;
167
+ tier: string;
168
+ total_calls: number;
169
+ cold_calls: number;
170
+ cached_calls: number;
171
+ last_reset: string;
172
+ next_reset: string;
173
+ tier_limits: TierLimits;
174
+ }
175
+ type JobStatus = "pending" | "complete" | "failed";
176
+ interface JobResultRef {
177
+ domain: string;
178
+ scored_at: string;
179
+ }
180
+ interface JobResponse {
181
+ mode?: string;
182
+ job_id: string;
183
+ status: JobStatus;
184
+ domain: string;
185
+ created_at?: string;
186
+ completed_at?: string | null;
187
+ result_ref?: JobResultRef | null;
188
+ score_url?: string | null;
189
+ failure_reason?: string | null;
190
+ }
191
+
192
+ /**
193
+ * High-level Kepler Insights API client.
194
+ *
195
+ * Usage
196
+ * -----
197
+ *
198
+ * import { Kepler } from "@kepler-insights/sdk";
199
+ * const client = new Kepler({ apiKey: "ki_live_..." });
200
+ * const score = await client.score("stripe.com");
201
+ * console.log(score.ki_rating, score.composite_score);
202
+ *
203
+ * Async cold scoring
204
+ * ------------------
205
+ *
206
+ * const job = await client.startScore("stripe.com");
207
+ * const score = await job.wait({ timeoutMs: 180_000 });
208
+ */
209
+
210
+ interface KeplerOptions {
211
+ apiKey: string;
212
+ baseUrl?: string;
213
+ timeoutMs?: number;
214
+ retries?: number;
215
+ /** Inject a custom fetch (e.g. for proxies, custom TLS). Defaults to globalThis.fetch. */
216
+ fetchImpl?: typeof fetch;
217
+ }
218
+ interface JobWaitOptions {
219
+ /** Total wait budget in milliseconds. Default 180_000 (3 min). */
220
+ timeoutMs?: number;
221
+ /** Poll interval in milliseconds. Default 5_000. */
222
+ intervalMs?: number;
223
+ }
224
+ declare class Kepler {
225
+ private readonly transport;
226
+ constructor(opts: KeplerOptions);
227
+ /**
228
+ * Score a company. Blocks up to ~70s on cold scoring.
229
+ * Returns a cached record if one exists within the tier's freshness window.
230
+ */
231
+ score(domain: string, opts?: {
232
+ forceFresh?: boolean;
233
+ }): Promise<Score>;
234
+ /**
235
+ * Read the latest cached score. Never triggers a cold run.
236
+ * Throws {@link NotFound} if the domain has never been scored.
237
+ */
238
+ getScore(domain: string): Promise<Score>;
239
+ /**
240
+ * Start an async cold-scoring job (Growth+ tiers). Returns a Job handle.
241
+ * Use {@link Job.wait} to block until completion.
242
+ */
243
+ startScore(domain: string, opts?: {
244
+ forceFresh?: boolean;
245
+ }): Promise<Job>;
246
+ /** Single poll of an async scoring job. */
247
+ getJob(jobId: string): Promise<JobResponse>;
248
+ history(domain: string, opts?: {
249
+ limit?: number;
250
+ cursor?: string;
251
+ }): Promise<HistoryPage>;
252
+ /** Auto-paginating async iterator over every history record. */
253
+ iterHistory(domain: string, opts?: {
254
+ pageSize?: number;
255
+ maxRecords?: number;
256
+ }): AsyncIterable<HistoryRecord>;
257
+ cohort(domain: string): Promise<Cohort>;
258
+ confidence(domain: string): Promise<Confidence>;
259
+ distribution(): Promise<Distribution>;
260
+ movers(window?: Window): Promise<Movers>;
261
+ signals(): Promise<SignalsManifest>;
262
+ usage(): Promise<Usage>;
263
+ }
264
+ /** Handle to an async scoring job started via {@link Kepler.startScore}. */
265
+ declare class Job {
266
+ private response;
267
+ private readonly client;
268
+ /** Set when the API short-circuits to a sync 200 (no cold work needed). */
269
+ private cachedScore;
270
+ constructor(client: Kepler, response: JobResponse);
271
+ /** Internal: wrap a sync-200 cached score response as a Job in `complete` state. */
272
+ static _fromCachedScore(client: Kepler, score: Score): Job;
273
+ get id(): string;
274
+ get status(): string;
275
+ get domain(): string;
276
+ get raw(): JobResponse;
277
+ /** One-shot poll. Updates the cached `raw` in place. */
278
+ refresh(): Promise<JobResponse>;
279
+ /**
280
+ * Poll until the job settles, then return the resulting {@link Score}.
281
+ * Throws {@link JobFailed} on a `failed` status, or {@link JobTimeout}
282
+ * if the job is still `pending` after `timeoutMs`.
283
+ */
284
+ wait(opts?: JobWaitOptions): Promise<Score>;
285
+ }
286
+
287
+ /**
288
+ * Exception hierarchy for the Kepler Insights SDK.
289
+ *
290
+ * Branch with `instanceof` or on the stable `code` string. Error messages
291
+ * may be tightened over time; the codes are stable.
292
+ *
293
+ * try {
294
+ * const score = await client.score("stripe.com");
295
+ * } catch (err) {
296
+ * if (err instanceof FreeTierSandboxOnly) { ... }
297
+ * if (err instanceof ColdBudgetExhausted) { ... }
298
+ * }
299
+ */
300
+ interface KeplerErrorOptions {
301
+ statusCode?: number;
302
+ response?: unknown;
303
+ }
304
+ /** Base class for every error raised by the SDK. */
305
+ declare class KeplerError extends Error {
306
+ readonly code: string;
307
+ readonly statusCode?: number;
308
+ readonly response?: unknown;
309
+ constructor(code: string, message?: string, opts?: KeplerErrorOptions);
310
+ }
311
+ /** 401: missing, invalid, or revoked API key. */
312
+ declare class AuthError extends KeplerError {
313
+ }
314
+ /** 403: live key on Free tier attempted a real-domain score. */
315
+ declare class FreeTierSandboxOnly extends KeplerError {
316
+ }
317
+ /** 403: catch-all forbidden (e.g. polling someone else's job_id). */
318
+ declare class Forbidden extends KeplerError {
319
+ }
320
+ /** 404: domain has no score on file, or job_id expired/unknown. */
321
+ declare class NotFound extends KeplerError {
322
+ }
323
+ /** 400: malformed request (bad domain, unsupported window, etc.). */
324
+ declare class ValidationError extends KeplerError {
325
+ }
326
+ /** 429: rate-limited. `retryAfter` carries the Retry-After header in seconds. */
327
+ declare class RateLimitError extends KeplerError {
328
+ readonly retryAfter?: number;
329
+ constructor(code: string, message?: string, opts?: KeplerErrorOptions & {
330
+ retryAfter?: number;
331
+ });
332
+ }
333
+ /** 429 cold_budget_exhausted: monthly cold-call cap hit. `retryAfter` points at the next monthly reset (UTC). */
334
+ declare class ColdBudgetExhausted extends RateLimitError {
335
+ }
336
+ /** 5xx: server-side error. Retry once; if persistent, contact support. */
337
+ declare class ServerError extends KeplerError {
338
+ }
339
+ /** 504: cold scoring exceeded sync budget. Poll GET /v1/score/{domain} in ~30s, or use startScore for async. */
340
+ declare class ScoringTimeout extends ServerError {
341
+ }
342
+ /** `Job.wait()` exceeded the caller's timeout while the job was still pending. */
343
+ declare class JobTimeout extends KeplerError {
344
+ }
345
+ /** Async scoring job ended in `failed`. `code` carries the failure_reason. */
346
+ declare class JobFailed extends KeplerError {
347
+ }
348
+
349
+ declare const VERSION = "1.0.0";
350
+
351
+ export { type Actionability, AuthError, type BucketDelta, type Buckets, type CacheStatus, type Cohort, type CohortMember, type CohortStats, type CohortTarget, ColdBudgetExhausted, type Confidence, type ConfidenceBand, type Distribution, Forbidden, FreeTierSandboxOnly, type HistBin, type HistoryPage, type HistoryRecord, Job, JobFailed, type JobResponse, type JobResultRef, type JobStatus, JobTimeout, type JobWaitOptions, Kepler, KeplerError, type KeplerOptions, type MoverRow, type Movers, NotFound, type Rank, RateLimitError, type Score, ScoringTimeout, ServerError, type Signal, type SignalsManifest, type TierLimits, type Universe, type Usage, VERSION, ValidationError, type Window, type XKeplerMeta };
@@ -0,0 +1,351 @@
1
+ /**
2
+ * Response type definitions matching Ki_dev/docs/openapi.yaml.
3
+ *
4
+ * Hand-written for clarity. Every type uses non-readonly fields so callers
5
+ * can spread or modify freely. Unknown server-added fields pass through
6
+ * unmolested — we don't validate at runtime (the API contract is enforced
7
+ * server-side; clients trust it).
8
+ */
9
+ interface Buckets {
10
+ team_structure: number;
11
+ market_position: number;
12
+ momentum_tailwinds: number;
13
+ financial_health: number;
14
+ }
15
+ interface Rank {
16
+ percentile: number;
17
+ cohort_size: number;
18
+ }
19
+ type CacheStatus = "cached" | "cold";
20
+ interface XKeplerMeta {
21
+ tier: string;
22
+ cache_status: CacheStatus;
23
+ freshness_window_hours: number;
24
+ }
25
+ interface Score {
26
+ mode?: string;
27
+ domain: string;
28
+ scored_at: string;
29
+ ki_rating: string;
30
+ composite_score: number;
31
+ scale_premium: number;
32
+ buckets: Buckets;
33
+ rank?: Rank;
34
+ x_kepler?: XKeplerMeta;
35
+ }
36
+ interface HistoryRecord {
37
+ scored_at: string;
38
+ composite_score: number;
39
+ scale_premium: number;
40
+ ki_rating: string;
41
+ momentum_index?: number;
42
+ buckets: Buckets;
43
+ data_completeness_pct?: number;
44
+ }
45
+ interface HistoryPage {
46
+ mode?: string;
47
+ domain: string;
48
+ records: HistoryRecord[];
49
+ next_cursor?: string;
50
+ }
51
+ interface CohortContext {
52
+ sector?: string;
53
+ geo_scope?: string;
54
+ }
55
+ interface CohortTarget {
56
+ domain: string;
57
+ company_name?: string;
58
+ composite_score: number;
59
+ ki_rating: string;
60
+ business_profile?: string;
61
+ context?: CohortContext;
62
+ }
63
+ interface CohortStats {
64
+ count: number;
65
+ mean: number;
66
+ p50: number;
67
+ p90: number;
68
+ stddev: number;
69
+ min: number;
70
+ max: number;
71
+ rank: number;
72
+ percentile: number;
73
+ }
74
+ interface BucketDelta {
75
+ target: number;
76
+ cohort: number;
77
+ delta: number;
78
+ }
79
+ interface CohortMember {
80
+ domain: string;
81
+ company_name?: string;
82
+ composite_score: number;
83
+ ki_rating: string;
84
+ business_profile?: string;
85
+ }
86
+ interface Cohort {
87
+ mode?: string;
88
+ target: CohortTarget;
89
+ cohort: CohortStats;
90
+ bucket_means: Record<string, BucketDelta>;
91
+ members: CohortMember[];
92
+ }
93
+ type ConfidenceBand = "high" | "medium" | "directional";
94
+ interface Confidence {
95
+ mode?: string;
96
+ domain: string;
97
+ scored_at: string;
98
+ band: ConfidenceBand;
99
+ completeness_pct: number;
100
+ failed_fetchers: string[];
101
+ data_warnings: string[];
102
+ missing_signals: string[];
103
+ }
104
+ interface HistBin {
105
+ range: string;
106
+ count: number;
107
+ }
108
+ interface Universe {
109
+ count: number;
110
+ mean: number;
111
+ p50: number;
112
+ p90: number;
113
+ stddev: number;
114
+ min: number;
115
+ max: number;
116
+ composite_hist: HistBin[];
117
+ scale_premium_hist: HistBin[];
118
+ rating_dist: Record<string, number>;
119
+ profile_split: Record<string, number>;
120
+ }
121
+ interface Distribution {
122
+ mode?: string;
123
+ pipeline_version: string;
124
+ universe: Universe;
125
+ }
126
+ type Window = "7d" | "30d" | "90d";
127
+ interface MoverRow {
128
+ domain: string;
129
+ company_name?: string;
130
+ composite_now: number;
131
+ composite_then: number;
132
+ delta: number;
133
+ ki_rating_now: string;
134
+ ki_rating_then: string;
135
+ }
136
+ interface Movers {
137
+ mode?: string;
138
+ window: Window;
139
+ window_start: string;
140
+ window_end: string;
141
+ gainers: MoverRow[];
142
+ decliners: MoverRow[];
143
+ }
144
+ type Actionability = "actionable" | "slow_actionable" | "immutable";
145
+ interface Signal {
146
+ key: string;
147
+ label: string;
148
+ bucket: string;
149
+ category: string;
150
+ weight: number;
151
+ actionability: Actionability;
152
+ description: string;
153
+ }
154
+ interface SignalsManifest {
155
+ version: string;
156
+ signals: Signal[];
157
+ }
158
+ interface TierLimits {
159
+ cached_calls_included: number | null;
160
+ cold_calls_included: number | null;
161
+ freshness_window_hours: number;
162
+ }
163
+ interface Usage {
164
+ mode?: string;
165
+ user_id: string;
166
+ period: string;
167
+ tier: string;
168
+ total_calls: number;
169
+ cold_calls: number;
170
+ cached_calls: number;
171
+ last_reset: string;
172
+ next_reset: string;
173
+ tier_limits: TierLimits;
174
+ }
175
+ type JobStatus = "pending" | "complete" | "failed";
176
+ interface JobResultRef {
177
+ domain: string;
178
+ scored_at: string;
179
+ }
180
+ interface JobResponse {
181
+ mode?: string;
182
+ job_id: string;
183
+ status: JobStatus;
184
+ domain: string;
185
+ created_at?: string;
186
+ completed_at?: string | null;
187
+ result_ref?: JobResultRef | null;
188
+ score_url?: string | null;
189
+ failure_reason?: string | null;
190
+ }
191
+
192
+ /**
193
+ * High-level Kepler Insights API client.
194
+ *
195
+ * Usage
196
+ * -----
197
+ *
198
+ * import { Kepler } from "@kepler-insights/sdk";
199
+ * const client = new Kepler({ apiKey: "ki_live_..." });
200
+ * const score = await client.score("stripe.com");
201
+ * console.log(score.ki_rating, score.composite_score);
202
+ *
203
+ * Async cold scoring
204
+ * ------------------
205
+ *
206
+ * const job = await client.startScore("stripe.com");
207
+ * const score = await job.wait({ timeoutMs: 180_000 });
208
+ */
209
+
210
+ interface KeplerOptions {
211
+ apiKey: string;
212
+ baseUrl?: string;
213
+ timeoutMs?: number;
214
+ retries?: number;
215
+ /** Inject a custom fetch (e.g. for proxies, custom TLS). Defaults to globalThis.fetch. */
216
+ fetchImpl?: typeof fetch;
217
+ }
218
+ interface JobWaitOptions {
219
+ /** Total wait budget in milliseconds. Default 180_000 (3 min). */
220
+ timeoutMs?: number;
221
+ /** Poll interval in milliseconds. Default 5_000. */
222
+ intervalMs?: number;
223
+ }
224
+ declare class Kepler {
225
+ private readonly transport;
226
+ constructor(opts: KeplerOptions);
227
+ /**
228
+ * Score a company. Blocks up to ~70s on cold scoring.
229
+ * Returns a cached record if one exists within the tier's freshness window.
230
+ */
231
+ score(domain: string, opts?: {
232
+ forceFresh?: boolean;
233
+ }): Promise<Score>;
234
+ /**
235
+ * Read the latest cached score. Never triggers a cold run.
236
+ * Throws {@link NotFound} if the domain has never been scored.
237
+ */
238
+ getScore(domain: string): Promise<Score>;
239
+ /**
240
+ * Start an async cold-scoring job (Growth+ tiers). Returns a Job handle.
241
+ * Use {@link Job.wait} to block until completion.
242
+ */
243
+ startScore(domain: string, opts?: {
244
+ forceFresh?: boolean;
245
+ }): Promise<Job>;
246
+ /** Single poll of an async scoring job. */
247
+ getJob(jobId: string): Promise<JobResponse>;
248
+ history(domain: string, opts?: {
249
+ limit?: number;
250
+ cursor?: string;
251
+ }): Promise<HistoryPage>;
252
+ /** Auto-paginating async iterator over every history record. */
253
+ iterHistory(domain: string, opts?: {
254
+ pageSize?: number;
255
+ maxRecords?: number;
256
+ }): AsyncIterable<HistoryRecord>;
257
+ cohort(domain: string): Promise<Cohort>;
258
+ confidence(domain: string): Promise<Confidence>;
259
+ distribution(): Promise<Distribution>;
260
+ movers(window?: Window): Promise<Movers>;
261
+ signals(): Promise<SignalsManifest>;
262
+ usage(): Promise<Usage>;
263
+ }
264
+ /** Handle to an async scoring job started via {@link Kepler.startScore}. */
265
+ declare class Job {
266
+ private response;
267
+ private readonly client;
268
+ /** Set when the API short-circuits to a sync 200 (no cold work needed). */
269
+ private cachedScore;
270
+ constructor(client: Kepler, response: JobResponse);
271
+ /** Internal: wrap a sync-200 cached score response as a Job in `complete` state. */
272
+ static _fromCachedScore(client: Kepler, score: Score): Job;
273
+ get id(): string;
274
+ get status(): string;
275
+ get domain(): string;
276
+ get raw(): JobResponse;
277
+ /** One-shot poll. Updates the cached `raw` in place. */
278
+ refresh(): Promise<JobResponse>;
279
+ /**
280
+ * Poll until the job settles, then return the resulting {@link Score}.
281
+ * Throws {@link JobFailed} on a `failed` status, or {@link JobTimeout}
282
+ * if the job is still `pending` after `timeoutMs`.
283
+ */
284
+ wait(opts?: JobWaitOptions): Promise<Score>;
285
+ }
286
+
287
+ /**
288
+ * Exception hierarchy for the Kepler Insights SDK.
289
+ *
290
+ * Branch with `instanceof` or on the stable `code` string. Error messages
291
+ * may be tightened over time; the codes are stable.
292
+ *
293
+ * try {
294
+ * const score = await client.score("stripe.com");
295
+ * } catch (err) {
296
+ * if (err instanceof FreeTierSandboxOnly) { ... }
297
+ * if (err instanceof ColdBudgetExhausted) { ... }
298
+ * }
299
+ */
300
+ interface KeplerErrorOptions {
301
+ statusCode?: number;
302
+ response?: unknown;
303
+ }
304
+ /** Base class for every error raised by the SDK. */
305
+ declare class KeplerError extends Error {
306
+ readonly code: string;
307
+ readonly statusCode?: number;
308
+ readonly response?: unknown;
309
+ constructor(code: string, message?: string, opts?: KeplerErrorOptions);
310
+ }
311
+ /** 401: missing, invalid, or revoked API key. */
312
+ declare class AuthError extends KeplerError {
313
+ }
314
+ /** 403: live key on Free tier attempted a real-domain score. */
315
+ declare class FreeTierSandboxOnly extends KeplerError {
316
+ }
317
+ /** 403: catch-all forbidden (e.g. polling someone else's job_id). */
318
+ declare class Forbidden extends KeplerError {
319
+ }
320
+ /** 404: domain has no score on file, or job_id expired/unknown. */
321
+ declare class NotFound extends KeplerError {
322
+ }
323
+ /** 400: malformed request (bad domain, unsupported window, etc.). */
324
+ declare class ValidationError extends KeplerError {
325
+ }
326
+ /** 429: rate-limited. `retryAfter` carries the Retry-After header in seconds. */
327
+ declare class RateLimitError extends KeplerError {
328
+ readonly retryAfter?: number;
329
+ constructor(code: string, message?: string, opts?: KeplerErrorOptions & {
330
+ retryAfter?: number;
331
+ });
332
+ }
333
+ /** 429 cold_budget_exhausted: monthly cold-call cap hit. `retryAfter` points at the next monthly reset (UTC). */
334
+ declare class ColdBudgetExhausted extends RateLimitError {
335
+ }
336
+ /** 5xx: server-side error. Retry once; if persistent, contact support. */
337
+ declare class ServerError extends KeplerError {
338
+ }
339
+ /** 504: cold scoring exceeded sync budget. Poll GET /v1/score/{domain} in ~30s, or use startScore for async. */
340
+ declare class ScoringTimeout extends ServerError {
341
+ }
342
+ /** `Job.wait()` exceeded the caller's timeout while the job was still pending. */
343
+ declare class JobTimeout extends KeplerError {
344
+ }
345
+ /** Async scoring job ended in `failed`. `code` carries the failure_reason. */
346
+ declare class JobFailed extends KeplerError {
347
+ }
348
+
349
+ declare const VERSION = "1.0.0";
350
+
351
+ export { type Actionability, AuthError, type BucketDelta, type Buckets, type CacheStatus, type Cohort, type CohortMember, type CohortStats, type CohortTarget, ColdBudgetExhausted, type Confidence, type ConfidenceBand, type Distribution, Forbidden, FreeTierSandboxOnly, type HistBin, type HistoryPage, type HistoryRecord, Job, JobFailed, type JobResponse, type JobResultRef, type JobStatus, JobTimeout, type JobWaitOptions, Kepler, KeplerError, type KeplerOptions, type MoverRow, type Movers, NotFound, type Rank, RateLimitError, type Score, ScoringTimeout, ServerError, type Signal, type SignalsManifest, type TierLimits, type Universe, type Usage, VERSION, ValidationError, type Window, type XKeplerMeta };