readlint.com 0.0.0-stage → 0.5.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,646 @@
1
+ export type ClientOptions = {
2
+ baseUrl: `${string}://${string}` | (string & {});
3
+ };
4
+ /**
5
+ * AgentPermissions
6
+ */
7
+ export type AgentPermissions = {
8
+ /**
9
+ * Agents Can Cancel Plans
10
+ */
11
+ agents_can_cancel_plans: boolean;
12
+ /**
13
+ * Agents Can Confirm Paid Orders
14
+ */
15
+ agents_can_confirm_paid_orders: boolean;
16
+ /**
17
+ * Agents Can Start Trials
18
+ */
19
+ agents_can_start_trials: boolean;
20
+ };
21
+ /**
22
+ * Body_createDeviceCode
23
+ */
24
+ export type BodyCreateDeviceCode = {
25
+ /**
26
+ * Client Id
27
+ */
28
+ client_id: 'readlint-cli';
29
+ /**
30
+ * Hostname
31
+ */
32
+ hostname?: string;
33
+ /**
34
+ * Os
35
+ */
36
+ os?: string;
37
+ };
38
+ /**
39
+ * Body_createDeviceToken
40
+ */
41
+ export type BodyCreateDeviceToken = {
42
+ /**
43
+ * Client Id
44
+ */
45
+ client_id: string;
46
+ /**
47
+ * Device Code
48
+ */
49
+ device_code: string;
50
+ /**
51
+ * Grant Type
52
+ */
53
+ grant_type: string;
54
+ };
55
+ /**
56
+ * CheckResult
57
+ */
58
+ export type CheckResult = {
59
+ /**
60
+ * Check
61
+ */
62
+ check: string;
63
+ /**
64
+ * Group
65
+ */
66
+ group: string;
67
+ /**
68
+ * Problem Probability
69
+ */
70
+ problem_probability: number;
71
+ /**
72
+ * Verdict
73
+ */
74
+ verdict: 'clear' | 'unsure' | 'finding';
75
+ };
76
+ /**
77
+ * DeviceCodeResponse
78
+ */
79
+ export type DeviceCodeResponse = {
80
+ /**
81
+ * Device Code
82
+ */
83
+ device_code: string;
84
+ /**
85
+ * Expires In
86
+ */
87
+ expires_in: number;
88
+ /**
89
+ * Interval
90
+ */
91
+ interval: number;
92
+ /**
93
+ * User Code
94
+ */
95
+ user_code: string;
96
+ /**
97
+ * Verification Uri
98
+ */
99
+ verification_uri: string;
100
+ /**
101
+ * Verification Uri Complete
102
+ */
103
+ verification_uri_complete: string;
104
+ };
105
+ /**
106
+ * DeviceTokenResponse
107
+ */
108
+ export type DeviceTokenResponse = {
109
+ /**
110
+ * Access Token
111
+ */
112
+ access_token: string;
113
+ /**
114
+ * Expires In
115
+ */
116
+ expires_in: number;
117
+ /**
118
+ * Token Type
119
+ */
120
+ token_type?: string;
121
+ };
122
+ /**
123
+ * ErrorDetail
124
+ */
125
+ export type ErrorDetail = {
126
+ /**
127
+ * Code
128
+ */
129
+ code: string;
130
+ };
131
+ /**
132
+ * ErrorResponse
133
+ */
134
+ export type ErrorResponse = {
135
+ detail: ErrorDetail;
136
+ };
137
+ /**
138
+ * EvaluationPage
139
+ */
140
+ export type EvaluationPage = {
141
+ /**
142
+ * Items
143
+ */
144
+ items: Array<EvaluationSummary>;
145
+ /**
146
+ * Next Offset
147
+ */
148
+ next_offset: number | null;
149
+ };
150
+ /**
151
+ * EvaluationReport
152
+ */
153
+ export type EvaluationReport = {
154
+ /**
155
+ * Article Checks
156
+ */
157
+ article_checks: Array<CheckResult>;
158
+ /**
159
+ * Banned Phrases
160
+ */
161
+ banned_phrases: Array<PhraseResult>;
162
+ /**
163
+ * Description
164
+ */
165
+ description: string;
166
+ /**
167
+ * Expires At
168
+ */
169
+ expires_at: string;
170
+ /**
171
+ * Input Tokens
172
+ */
173
+ input_tokens: number;
174
+ /**
175
+ * Model
176
+ */
177
+ model: string;
178
+ /**
179
+ * Omitted Computed Jsx
180
+ */
181
+ omitted_computed_jsx: Array<string>;
182
+ /**
183
+ * Prose Blocks
184
+ */
185
+ prose_blocks: Array<ProseResult>;
186
+ /**
187
+ * Title
188
+ */
189
+ title: string;
190
+ };
191
+ /**
192
+ * EvaluationRequest
193
+ */
194
+ export type EvaluationRequest = {
195
+ /**
196
+ * Article
197
+ *
198
+ * Markdown or MDX source
199
+ */
200
+ article: string;
201
+ /**
202
+ * Description
203
+ */
204
+ description?: string;
205
+ /**
206
+ * Title
207
+ */
208
+ title?: string | null;
209
+ };
210
+ /**
211
+ * EvaluationResult
212
+ */
213
+ export type EvaluationResult = {
214
+ /**
215
+ * Created At
216
+ */
217
+ created_at: string;
218
+ /**
219
+ * Error Code
220
+ */
221
+ error_code: string | null;
222
+ /**
223
+ * Expires At
224
+ */
225
+ expires_at: string;
226
+ /**
227
+ * Id
228
+ */
229
+ id: string;
230
+ report: EvaluationReport | null;
231
+ /**
232
+ * Status
233
+ */
234
+ status: 'running' | 'complete' | 'failed';
235
+ /**
236
+ * Title
237
+ */
238
+ title: string;
239
+ };
240
+ /**
241
+ * EvaluationSummary
242
+ */
243
+ export type EvaluationSummary = {
244
+ /**
245
+ * Created At
246
+ */
247
+ created_at: string;
248
+ /**
249
+ * Error Code
250
+ */
251
+ error_code: string | null;
252
+ /**
253
+ * Expires At
254
+ */
255
+ expires_at: string;
256
+ /**
257
+ * Id
258
+ */
259
+ id: string;
260
+ /**
261
+ * Status
262
+ */
263
+ status: 'running' | 'complete' | 'failed';
264
+ /**
265
+ * Title
266
+ */
267
+ title: string;
268
+ };
269
+ /**
270
+ * HTTPValidationError
271
+ */
272
+ export type HttpValidationError = {
273
+ /**
274
+ * Detail
275
+ */
276
+ detail?: Array<ValidationError>;
277
+ };
278
+ /**
279
+ * InvalidField
280
+ */
281
+ export type InvalidField = {
282
+ /**
283
+ * Location
284
+ */
285
+ location: Array<string | number>;
286
+ /**
287
+ * Type
288
+ */
289
+ type: string;
290
+ };
291
+ /**
292
+ * OAuthError
293
+ */
294
+ export type OAuthError = {
295
+ /**
296
+ * Error
297
+ */
298
+ error: string;
299
+ };
300
+ /**
301
+ * PhraseResult
302
+ */
303
+ export type PhraseResult = {
304
+ /**
305
+ * Block
306
+ */
307
+ block: number | null;
308
+ /**
309
+ * Phrase
310
+ */
311
+ phrase: string;
312
+ /**
313
+ * Where
314
+ */
315
+ where: string;
316
+ };
317
+ /**
318
+ * ProseResult
319
+ */
320
+ export type ProseResult = {
321
+ /**
322
+ * Findings
323
+ */
324
+ findings: Array<CheckResult>;
325
+ /**
326
+ * Index
327
+ */
328
+ index: number;
329
+ /**
330
+ * Kind
331
+ */
332
+ kind: 'paragraph' | 'list';
333
+ /**
334
+ * Role
335
+ */
336
+ role: string;
337
+ /**
338
+ * Section
339
+ */
340
+ section: string;
341
+ /**
342
+ * Text
343
+ */
344
+ text: string;
345
+ /**
346
+ * Unsure
347
+ */
348
+ unsure: Array<CheckResult>;
349
+ };
350
+ /**
351
+ * ValidationDetail
352
+ */
353
+ export type ValidationDetail = {
354
+ /**
355
+ * Code
356
+ */
357
+ code: string;
358
+ /**
359
+ * Fields
360
+ */
361
+ fields?: Array<InvalidField> | null;
362
+ };
363
+ /**
364
+ * ValidationError
365
+ */
366
+ export type ValidationError = {
367
+ /**
368
+ * Context
369
+ */
370
+ ctx?: {
371
+ [key: string]: unknown;
372
+ };
373
+ /**
374
+ * Input
375
+ */
376
+ input?: unknown;
377
+ /**
378
+ * Location
379
+ */
380
+ loc: Array<string | number>;
381
+ /**
382
+ * Message
383
+ */
384
+ msg: string;
385
+ /**
386
+ * Error Type
387
+ */
388
+ type: string;
389
+ };
390
+ /**
391
+ * ValidationResponse
392
+ */
393
+ export type ValidationResponse = {
394
+ detail: ValidationDetail;
395
+ };
396
+ export type CreateDeviceCodeData = {
397
+ body: BodyCreateDeviceCode;
398
+ path?: never;
399
+ query?: never;
400
+ url: '/auth/device/code';
401
+ };
402
+ export type CreateDeviceCodeErrors = {
403
+ /**
404
+ * Bad Request
405
+ */
406
+ 400: OAuthError;
407
+ };
408
+ export type CreateDeviceCodeError = CreateDeviceCodeErrors[keyof CreateDeviceCodeErrors];
409
+ export type CreateDeviceCodeResponses = {
410
+ /**
411
+ * Successful Response
412
+ */
413
+ 200: DeviceCodeResponse;
414
+ };
415
+ export type CreateDeviceCodeResponse = CreateDeviceCodeResponses[keyof CreateDeviceCodeResponses];
416
+ export type CreateDeviceTokenData = {
417
+ body: BodyCreateDeviceToken;
418
+ path?: never;
419
+ query?: never;
420
+ url: '/auth/device/token';
421
+ };
422
+ export type CreateDeviceTokenErrors = {
423
+ /**
424
+ * Bad Request
425
+ */
426
+ 400: OAuthError;
427
+ };
428
+ export type CreateDeviceTokenError = CreateDeviceTokenErrors[keyof CreateDeviceTokenErrors];
429
+ export type CreateDeviceTokenResponses = {
430
+ /**
431
+ * Successful Response
432
+ */
433
+ 200: DeviceTokenResponse;
434
+ };
435
+ export type CreateDeviceTokenResponse = CreateDeviceTokenResponses[keyof CreateDeviceTokenResponses];
436
+ export type GetAgentPermissionsData = {
437
+ body?: never;
438
+ path?: never;
439
+ query?: never;
440
+ url: '/v1/agent-permissions';
441
+ };
442
+ export type GetAgentPermissionsErrors = {
443
+ /**
444
+ * Unauthorized
445
+ */
446
+ 401: ErrorResponse;
447
+ /**
448
+ * Service Unavailable
449
+ */
450
+ 503: ErrorResponse;
451
+ };
452
+ export type GetAgentPermissionsError = GetAgentPermissionsErrors[keyof GetAgentPermissionsErrors];
453
+ export type GetAgentPermissionsResponses = {
454
+ /**
455
+ * Successful Response
456
+ */
457
+ 200: AgentPermissions;
458
+ };
459
+ export type GetAgentPermissionsResponse = GetAgentPermissionsResponses[keyof GetAgentPermissionsResponses];
460
+ export type ListEvaluationsV1EvaluationsGetData = {
461
+ body?: never;
462
+ path?: never;
463
+ query?: {
464
+ /**
465
+ * Limit
466
+ */
467
+ limit?: number | null;
468
+ /**
469
+ * Offset
470
+ */
471
+ offset?: number;
472
+ };
473
+ url: '/v1/evaluations';
474
+ };
475
+ export type ListEvaluationsV1EvaluationsGetErrors = {
476
+ /**
477
+ * Account authentication required
478
+ */
479
+ 401: ErrorResponse;
480
+ /**
481
+ * Invalid request
482
+ */
483
+ 422: ValidationResponse;
484
+ /**
485
+ * Unexpected server failure
486
+ */
487
+ 500: ErrorResponse;
488
+ /**
489
+ * Service unavailable
490
+ */
491
+ 503: ErrorResponse;
492
+ };
493
+ export type ListEvaluationsV1EvaluationsGetError = ListEvaluationsV1EvaluationsGetErrors[keyof ListEvaluationsV1EvaluationsGetErrors];
494
+ export type ListEvaluationsV1EvaluationsGetResponses = {
495
+ /**
496
+ * Successful Response
497
+ */
498
+ 200: EvaluationPage;
499
+ };
500
+ export type ListEvaluationsV1EvaluationsGetResponse = ListEvaluationsV1EvaluationsGetResponses[keyof ListEvaluationsV1EvaluationsGetResponses];
501
+ export type CreateEvaluationV1EvaluationsPostData = {
502
+ body: EvaluationRequest;
503
+ headers: {
504
+ /**
505
+ * Idempotency-Key
506
+ */
507
+ 'idempotency-key': string;
508
+ };
509
+ path?: never;
510
+ query?: never;
511
+ url: '/v1/evaluations';
512
+ };
513
+ export type CreateEvaluationV1EvaluationsPostErrors = {
514
+ /**
515
+ * Account authentication required
516
+ */
517
+ 401: ErrorResponse;
518
+ /**
519
+ * Evaluation credit exhausted
520
+ */
521
+ 402: ErrorResponse;
522
+ /**
523
+ * Evaluation access denied
524
+ */
525
+ 403: ErrorResponse;
526
+ /**
527
+ * Idempotency key reused
528
+ */
529
+ 409: ErrorResponse;
530
+ /**
531
+ * Article exceeds model context
532
+ */
533
+ 413: ErrorResponse;
534
+ /**
535
+ * Invalid request
536
+ */
537
+ 422: ValidationResponse;
538
+ /**
539
+ * Response 500 Create Evaluation V1 Evaluations Post
540
+ *
541
+ * Unexpected evaluation failure
542
+ */
543
+ 500: EvaluationResult | ErrorResponse;
544
+ /**
545
+ * Provider send failed
546
+ */
547
+ 502: EvaluationResult;
548
+ /**
549
+ * Service unavailable
550
+ */
551
+ 503: ErrorResponse;
552
+ };
553
+ export type CreateEvaluationV1EvaluationsPostError = CreateEvaluationV1EvaluationsPostErrors[keyof CreateEvaluationV1EvaluationsPostErrors];
554
+ export type CreateEvaluationV1EvaluationsPostResponses = {
555
+ /**
556
+ * Successful Response
557
+ */
558
+ 200: EvaluationResult;
559
+ /**
560
+ * Evaluation in progress
561
+ */
562
+ 202: EvaluationResult;
563
+ };
564
+ export type CreateEvaluationV1EvaluationsPostResponse = CreateEvaluationV1EvaluationsPostResponses[keyof CreateEvaluationV1EvaluationsPostResponses];
565
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteData = {
566
+ body?: never;
567
+ path: {
568
+ /**
569
+ * Evaluation Id
570
+ */
571
+ evaluation_id: string;
572
+ };
573
+ query?: never;
574
+ url: '/v1/evaluations/{evaluation_id}';
575
+ };
576
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteErrors = {
577
+ /**
578
+ * Account authentication required
579
+ */
580
+ 401: ErrorResponse;
581
+ /**
582
+ * Evaluation not found
583
+ */
584
+ 404: ErrorResponse;
585
+ /**
586
+ * Invalid request
587
+ */
588
+ 422: ValidationResponse;
589
+ /**
590
+ * Unexpected server failure
591
+ */
592
+ 500: ErrorResponse;
593
+ /**
594
+ * Service unavailable
595
+ */
596
+ 503: ErrorResponse;
597
+ };
598
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteError = RemoveEvaluationV1EvaluationsEvaluationIdDeleteErrors[keyof RemoveEvaluationV1EvaluationsEvaluationIdDeleteErrors];
599
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponses = {
600
+ /**
601
+ * Successful Response
602
+ */
603
+ 204: void;
604
+ };
605
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponse = RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponses[keyof RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponses];
606
+ export type GetEvaluationV1EvaluationsEvaluationIdGetData = {
607
+ body?: never;
608
+ path: {
609
+ /**
610
+ * Evaluation Id
611
+ */
612
+ evaluation_id: string;
613
+ };
614
+ query?: never;
615
+ url: '/v1/evaluations/{evaluation_id}';
616
+ };
617
+ export type GetEvaluationV1EvaluationsEvaluationIdGetErrors = {
618
+ /**
619
+ * Account authentication required
620
+ */
621
+ 401: ErrorResponse;
622
+ /**
623
+ * Evaluation not found
624
+ */
625
+ 404: ErrorResponse;
626
+ /**
627
+ * Invalid request
628
+ */
629
+ 422: ValidationResponse;
630
+ /**
631
+ * Unexpected server failure
632
+ */
633
+ 500: ErrorResponse;
634
+ /**
635
+ * Service unavailable
636
+ */
637
+ 503: ErrorResponse;
638
+ };
639
+ export type GetEvaluationV1EvaluationsEvaluationIdGetError = GetEvaluationV1EvaluationsEvaluationIdGetErrors[keyof GetEvaluationV1EvaluationsEvaluationIdGetErrors];
640
+ export type GetEvaluationV1EvaluationsEvaluationIdGetResponses = {
641
+ /**
642
+ * Successful Response
643
+ */
644
+ 200: EvaluationResult;
645
+ };
646
+ export type GetEvaluationV1EvaluationsEvaluationIdGetResponse = GetEvaluationV1EvaluationsEvaluationIdGetResponses[keyof GetEvaluationV1EvaluationsEvaluationIdGetResponses];
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { EvaluationResult, EvaluationPage, DeviceCodeResponse, DeviceTokenResponse, AgentPermissions } from "./gen/types.gen.js";
2
+ export type { EvaluationResult as Evaluation, EvaluationPage, EvaluationReport, EvaluationSummary, CheckResult, ProseResult, PhraseResult, DeviceCodeResponse, DeviceTokenResponse, AgentPermissions, } from "./gen/types.gen.js";
3
+ /** Sanitized failure. status is null when no reliable HTTP answer arrived. */
4
+ export declare class ReadlintError extends Error {
5
+ readonly code: string;
6
+ readonly status: number | null;
7
+ readonly evaluationId: string | null;
8
+ readonly name = "ReadlintError";
9
+ constructor(code: string, message: string, status?: number | null, evaluationId?: string | null);
10
+ }
11
+ export interface ReadlintOptions {
12
+ apiKey?: string;
13
+ /** HTTPS origin; HTTP is allowed only on loopback for development. */
14
+ baseUrl?: string;
15
+ /** Deadline per attempt, including reading the body. Default: 120000 ms. */
16
+ timeoutMs?: number;
17
+ /** Retries for reads and idempotent submissions only. Default: 2. */
18
+ maxRetries?: number;
19
+ fetch?: typeof globalThis.fetch;
20
+ }
21
+ export interface EvaluateOptions {
22
+ /** Required: retain this key and identical article/options after a lost response. */
23
+ idempotencyKey: string;
24
+ title?: string | null;
25
+ description?: string;
26
+ }
27
+ /** Typed evaluation API and low-level device flow. The SDK transport uses native fetch. */
28
+ export declare class Readlint {
29
+ #private;
30
+ readonly baseUrl: string;
31
+ constructor(options?: ReadlintOptions);
32
+ /** Read account-wide policy. Changes require the owner's browser session. */
33
+ getAgentPermissions(): Promise<AgentPermissions>;
34
+ evaluate(article: string, options: EvaluateOptions): Promise<EvaluationResult>;
35
+ listEvaluations(options?: {
36
+ limit?: number;
37
+ offset?: number;
38
+ }): Promise<EvaluationPage>;
39
+ getEvaluation(evaluationId: string): Promise<EvaluationResult>;
40
+ deleteEvaluation(evaluationId: string): Promise<void>;
41
+ /** Display verification_uri_complete, then poll no faster than interval. */
42
+ createDeviceCode(options?: {
43
+ hostname?: string;
44
+ os?: string;
45
+ }): Promise<DeviceCodeResponse>;
46
+ /** One poll only. Handle authorization_pending and slow_down explicitly. Never persisted by the SDK. */
47
+ createDeviceToken(deviceCode: string): Promise<DeviceTokenResponse>;
48
+ }