okrapdf 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.
- package/dist/browser.d.ts +9 -0
- package/dist/browser.js +16 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-AG3A2T3B.js +84 -0
- package/dist/chunk-AG3A2T3B.js.map +1 -0
- package/dist/chunk-C6ZT7DKX.js +113 -0
- package/dist/chunk-C6ZT7DKX.js.map +1 -0
- package/dist/chunk-HITG34US.js +626 -0
- package/dist/chunk-HITG34US.js.map +1 -0
- package/dist/chunk-SBT5T6ZK.js +817 -0
- package/dist/chunk-SBT5T6ZK.js.map +1 -0
- package/dist/cli/bin.d.ts +1 -0
- package/dist/cli/bin.js +212 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/index.d.ts +536 -0
- package/dist/cli/index.js +73 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client-aHzx0a5x.d.ts +58 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +197 -0
- package/dist/react/index.js +432 -0
- package/dist/react/index.js.map +1 -0
- package/dist/types-DEYgGUnH.d.ts +329 -0
- package/dist/url.d.ts +48 -0
- package/dist/url.js +7 -0
- package/dist/url.js.map +1 -0
- package/dist/worker.d.ts +44 -0
- package/dist/worker.js +82 -0
- package/dist/worker.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { O as OkraClient } from '../client-aHzx0a5x.js';
|
|
2
|
+
import '../types-DEYgGUnH.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CLI Types for OkraPDF Review Operations
|
|
7
|
+
*
|
|
8
|
+
* These types mirror the review page UI interactions:
|
|
9
|
+
* - Left panel: Document tree (verification status, entity counts)
|
|
10
|
+
* - Middle panel: PDF viewer (entities, overlays)
|
|
11
|
+
* - Right panel: Page content (markdown, versions)
|
|
12
|
+
*/
|
|
13
|
+
type VerificationPageStatus = 'complete' | 'partial' | 'flagged' | 'pending' | 'empty' | 'gap' | 'error';
|
|
14
|
+
interface VerificationTreePage {
|
|
15
|
+
page: number;
|
|
16
|
+
status: VerificationPageStatus;
|
|
17
|
+
total: number;
|
|
18
|
+
verified: number;
|
|
19
|
+
pending: number;
|
|
20
|
+
flagged: number;
|
|
21
|
+
rejected: number;
|
|
22
|
+
avgConfidence: number;
|
|
23
|
+
hasOcr: boolean;
|
|
24
|
+
ocrLineCount: number;
|
|
25
|
+
hasCoverageGaps: boolean;
|
|
26
|
+
uncoveredCount: number;
|
|
27
|
+
resolution: string | null;
|
|
28
|
+
classification: string | null;
|
|
29
|
+
isStale: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface VerificationTreeSummary {
|
|
32
|
+
complete: number;
|
|
33
|
+
partial: number;
|
|
34
|
+
flagged: number;
|
|
35
|
+
pending: number;
|
|
36
|
+
empty: number;
|
|
37
|
+
gap: number;
|
|
38
|
+
resolved?: number;
|
|
39
|
+
stale?: number;
|
|
40
|
+
}
|
|
41
|
+
interface VerificationTree {
|
|
42
|
+
jobId: string;
|
|
43
|
+
documentId: string;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
summary: VerificationTreeSummary;
|
|
46
|
+
pages: VerificationTreePage[];
|
|
47
|
+
}
|
|
48
|
+
type EntityType = 'table' | 'figure' | 'footnote' | 'summary' | 'signature' | 'paragraph';
|
|
49
|
+
interface EntityBBox {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
}
|
|
55
|
+
interface Entity {
|
|
56
|
+
id: string;
|
|
57
|
+
type: EntityType;
|
|
58
|
+
title: string | null;
|
|
59
|
+
page: number;
|
|
60
|
+
schema?: string[];
|
|
61
|
+
isComplete?: boolean;
|
|
62
|
+
bbox?: EntityBBox;
|
|
63
|
+
confidence?: number;
|
|
64
|
+
verificationStatus?: 'pending' | 'verified' | 'flagged' | 'rejected';
|
|
65
|
+
}
|
|
66
|
+
interface EntitiesResponse {
|
|
67
|
+
jobId: string;
|
|
68
|
+
entities: Entity[];
|
|
69
|
+
counts: {
|
|
70
|
+
tables: number;
|
|
71
|
+
figures: number;
|
|
72
|
+
footnotes: number;
|
|
73
|
+
summaries: number;
|
|
74
|
+
signatures?: number;
|
|
75
|
+
};
|
|
76
|
+
extractionStatus?: 'not_started' | 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused';
|
|
77
|
+
totalPages?: number;
|
|
78
|
+
}
|
|
79
|
+
interface TextBlock {
|
|
80
|
+
text: string;
|
|
81
|
+
bbox?: EntityBBox;
|
|
82
|
+
confidence?: number;
|
|
83
|
+
}
|
|
84
|
+
interface PageDimension {
|
|
85
|
+
width: number | null;
|
|
86
|
+
height: number | null;
|
|
87
|
+
}
|
|
88
|
+
interface PageContent {
|
|
89
|
+
page: number;
|
|
90
|
+
content: string;
|
|
91
|
+
version?: number;
|
|
92
|
+
blocks?: TextBlock[];
|
|
93
|
+
dimension?: PageDimension | null;
|
|
94
|
+
}
|
|
95
|
+
interface PageVersionInfo {
|
|
96
|
+
version: number;
|
|
97
|
+
editSource: 'ocr_extraction' | 'user_edit' | 'ai_correction';
|
|
98
|
+
createdAt: string | null;
|
|
99
|
+
preview: string;
|
|
100
|
+
}
|
|
101
|
+
interface PageVersionsResponse {
|
|
102
|
+
page: number;
|
|
103
|
+
currentVersion: number;
|
|
104
|
+
versions: PageVersionInfo[];
|
|
105
|
+
}
|
|
106
|
+
interface Table {
|
|
107
|
+
id: string;
|
|
108
|
+
pageNumber: number;
|
|
109
|
+
markdown: string;
|
|
110
|
+
bbox: {
|
|
111
|
+
xmin: number;
|
|
112
|
+
ymin: number;
|
|
113
|
+
xmax: number;
|
|
114
|
+
ymax: number;
|
|
115
|
+
};
|
|
116
|
+
confidence: number | null;
|
|
117
|
+
verificationStatus: 'pending' | 'verified' | 'flagged' | 'rejected';
|
|
118
|
+
verifiedBy: string | null;
|
|
119
|
+
verifiedAt: string | null;
|
|
120
|
+
wasCorrected?: boolean;
|
|
121
|
+
createdAt: string;
|
|
122
|
+
}
|
|
123
|
+
interface TablesResponse {
|
|
124
|
+
tables: Table[];
|
|
125
|
+
source: 'job_id' | 'document_uuid';
|
|
126
|
+
}
|
|
127
|
+
type MatchSource = 'content' | 'table_title' | 'table_schema' | 'table_row' | 'figure' | 'footnote' | 'summary' | 'signature' | 'paragraph';
|
|
128
|
+
interface SearchResult {
|
|
129
|
+
page: number;
|
|
130
|
+
snippet: string;
|
|
131
|
+
matchCount: number;
|
|
132
|
+
matchSource?: MatchSource;
|
|
133
|
+
}
|
|
134
|
+
interface SearchResponse {
|
|
135
|
+
query: string;
|
|
136
|
+
totalMatches: number;
|
|
137
|
+
results: SearchResult[];
|
|
138
|
+
}
|
|
139
|
+
interface HistoryEntry {
|
|
140
|
+
id: string;
|
|
141
|
+
entityType: string;
|
|
142
|
+
entityId: string;
|
|
143
|
+
state: string;
|
|
144
|
+
previousState: string | null;
|
|
145
|
+
transitionName: string | null;
|
|
146
|
+
triggeredBy: string | null;
|
|
147
|
+
triggeredByName: string | null;
|
|
148
|
+
reason: string | null;
|
|
149
|
+
resolution: string | null;
|
|
150
|
+
classification: string | null;
|
|
151
|
+
pageNum: number | null;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
}
|
|
154
|
+
interface HistoryResponse {
|
|
155
|
+
history: HistoryEntry[];
|
|
156
|
+
}
|
|
157
|
+
type OutputFormat = 'text' | 'json' | 'markdown';
|
|
158
|
+
interface QueryConfig {
|
|
159
|
+
selector: string;
|
|
160
|
+
topK?: number;
|
|
161
|
+
minConfidence?: number;
|
|
162
|
+
pageRange?: [number, number];
|
|
163
|
+
sortBy?: 'confidence' | 'page' | 'type';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Query Engine - jQuery-like entity selector
|
|
168
|
+
*
|
|
169
|
+
* Inspired by okra-jquery from ~/dev/okrapdf/lib/okra-jquery
|
|
170
|
+
* Supports selectors like:
|
|
171
|
+
* - Type: .table, .figure, .footnote
|
|
172
|
+
* - ID: #entity_123
|
|
173
|
+
* - Attributes: [confidence>0.9], [verified=true]
|
|
174
|
+
* - Page: :page(5), :pages(1-10)
|
|
175
|
+
* - Combinators: .table[confidence>0.9], .table, .figure
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
interface SelectorParts {
|
|
179
|
+
types: EntityType[];
|
|
180
|
+
id?: string;
|
|
181
|
+
pageFilter?: {
|
|
182
|
+
type: 'single' | 'range';
|
|
183
|
+
value: number | [number, number];
|
|
184
|
+
};
|
|
185
|
+
confidenceFilter?: {
|
|
186
|
+
op: '>' | '<' | '>=' | '<=';
|
|
187
|
+
value: number;
|
|
188
|
+
};
|
|
189
|
+
verificationFilter?: 'pending' | 'verified' | 'flagged' | 'rejected';
|
|
190
|
+
textContains?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Parse a jQuery-like selector string into parts.
|
|
194
|
+
*
|
|
195
|
+
* Examples:
|
|
196
|
+
* - ".table" -> { types: ['table'] }
|
|
197
|
+
* - ".table, .figure" -> { types: ['table', 'figure'] }
|
|
198
|
+
* - ".table:page(5)" -> { types: ['table'], pageFilter: { type: 'single', value: 5 } }
|
|
199
|
+
* - "[confidence>0.9]" -> { confidenceFilter: { op: '>', value: 0.9 } }
|
|
200
|
+
* - ".table[confidence>=0.8]:page(1-10)" -> complex filter
|
|
201
|
+
*/
|
|
202
|
+
declare function parseSelector(selector: string): SelectorParts;
|
|
203
|
+
/**
|
|
204
|
+
* Filter entities based on parsed selector parts.
|
|
205
|
+
*/
|
|
206
|
+
declare function filterEntities(entities: Entity[], parts: SelectorParts): Entity[];
|
|
207
|
+
interface QueryOptions {
|
|
208
|
+
topK?: number;
|
|
209
|
+
minConfidence?: number;
|
|
210
|
+
pageRange?: [number, number];
|
|
211
|
+
sortBy?: 'confidence' | 'page' | 'type';
|
|
212
|
+
}
|
|
213
|
+
interface QueryStats {
|
|
214
|
+
total: number;
|
|
215
|
+
byType: Record<string, number>;
|
|
216
|
+
byPage: Record<number, number>;
|
|
217
|
+
avgConfidence: number;
|
|
218
|
+
minConfidence: number;
|
|
219
|
+
maxConfidence: number;
|
|
220
|
+
}
|
|
221
|
+
interface QueryResult {
|
|
222
|
+
entities: Entity[];
|
|
223
|
+
total: number;
|
|
224
|
+
stats: QueryStats;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Execute a query against entities.
|
|
228
|
+
*/
|
|
229
|
+
declare function executeQuery(entities: Entity[], selector: string, options?: QueryOptions): QueryResult;
|
|
230
|
+
/**
|
|
231
|
+
* Calculate aggregate statistics for entities.
|
|
232
|
+
*/
|
|
233
|
+
declare function calculateStats(entities: Entity[]): QueryStats;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* okra tree - Document verification tree command
|
|
237
|
+
*
|
|
238
|
+
* Maps to: Left panel of review page
|
|
239
|
+
* Shows page-level verification status and entity counts.
|
|
240
|
+
*
|
|
241
|
+
* Usage:
|
|
242
|
+
* okra tree <jobId>
|
|
243
|
+
* okra tree <jobId> --status pending
|
|
244
|
+
* okra tree <jobId> --entity table
|
|
245
|
+
* okra tree <jobId> --format json
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
interface TreeOptions {
|
|
249
|
+
status?: VerificationPageStatus;
|
|
250
|
+
entity?: EntityType;
|
|
251
|
+
format?: 'text' | 'json' | 'markdown';
|
|
252
|
+
}
|
|
253
|
+
interface TreeResult {
|
|
254
|
+
tree: any;
|
|
255
|
+
filteredPages: number[];
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get the verification tree for a job.
|
|
259
|
+
*/
|
|
260
|
+
declare function tree(client: OkraClient, jobId: string, options?: TreeOptions): Promise<TreeResult>;
|
|
261
|
+
/**
|
|
262
|
+
* Format tree result for output.
|
|
263
|
+
*/
|
|
264
|
+
declare function formatTreeOutput(result: TreeResult, format?: 'text' | 'json' | 'markdown'): string;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* okra find - Entity search with jQuery-like selectors
|
|
268
|
+
*
|
|
269
|
+
* Maps to: Middle panel of review page (entity overlays)
|
|
270
|
+
* Find entities using CSS-like selectors.
|
|
271
|
+
*
|
|
272
|
+
* Usage:
|
|
273
|
+
* okra find <jobId> ".table" # Find all tables
|
|
274
|
+
* okra find <jobId> ".figure:page(5)" # Figures on page 5
|
|
275
|
+
* okra find <jobId> "[confidence>0.9]" # High confidence entities
|
|
276
|
+
* okra find <jobId> ".table, .figure" # Tables OR figures
|
|
277
|
+
* okra find <jobId> "*" --stats # All entities with stats
|
|
278
|
+
* okra find <jobId> ".table" --top-k 10 # Top 10 tables
|
|
279
|
+
*/
|
|
280
|
+
|
|
281
|
+
interface FindOptions extends QueryOptions {
|
|
282
|
+
stats?: boolean;
|
|
283
|
+
format?: 'text' | 'json' | 'entities' | 'ids';
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Find entities matching a selector.
|
|
287
|
+
*/
|
|
288
|
+
declare function find(client: OkraClient, jobId: string, selector: string, options?: FindOptions): Promise<QueryResult>;
|
|
289
|
+
/**
|
|
290
|
+
* Format find result for output.
|
|
291
|
+
*/
|
|
292
|
+
declare function formatFindOutput(result: QueryResult, format?: 'text' | 'json' | 'entities' | 'ids', showStats?: boolean): string;
|
|
293
|
+
/**
|
|
294
|
+
* Format stats only.
|
|
295
|
+
*/
|
|
296
|
+
declare function formatStats(stats: QueryStats): string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* okra page - Page content operations
|
|
300
|
+
*
|
|
301
|
+
* Maps to: Right panel of review page (markdown editor)
|
|
302
|
+
* Get, edit, and resolve page content.
|
|
303
|
+
*
|
|
304
|
+
* Usage:
|
|
305
|
+
* okra page get <jobId> <pageNum> # Get page markdown
|
|
306
|
+
* okra page get <jobId> <pageNum> --version 2 # Get specific version
|
|
307
|
+
* okra page edit <jobId> <pageNum> <content> # Edit page content
|
|
308
|
+
* okra page resolve <jobId> <pageNum> reviewed # Mark as reviewed
|
|
309
|
+
* okra page versions <jobId> <pageNum> # List versions
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
type PageContentResponse = PageContent;
|
|
313
|
+
interface PageGetOptions {
|
|
314
|
+
version?: number;
|
|
315
|
+
format?: 'text' | 'json' | 'markdown';
|
|
316
|
+
}
|
|
317
|
+
interface PageResolveOptions {
|
|
318
|
+
resolution: string;
|
|
319
|
+
classification?: string;
|
|
320
|
+
reason?: string;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Get page content.
|
|
324
|
+
*/
|
|
325
|
+
declare function pageGet(client: OkraClient, jobId: string, pageNum: number, options?: PageGetOptions): Promise<PageContentResponse>;
|
|
326
|
+
/**
|
|
327
|
+
* Edit page content.
|
|
328
|
+
*/
|
|
329
|
+
declare function pageEdit(client: OkraClient, jobId: string, pageNum: number, content: string): Promise<{
|
|
330
|
+
success: boolean;
|
|
331
|
+
version: number;
|
|
332
|
+
}>;
|
|
333
|
+
/**
|
|
334
|
+
* Resolve page verification status.
|
|
335
|
+
*/
|
|
336
|
+
declare function pageResolve(client: OkraClient, jobId: string, pageNum: number, options: PageResolveOptions): Promise<{
|
|
337
|
+
success: boolean;
|
|
338
|
+
}>;
|
|
339
|
+
/**
|
|
340
|
+
* List page versions.
|
|
341
|
+
*/
|
|
342
|
+
declare function pageVersions(client: OkraClient, jobId: string, pageNum: number): Promise<PageVersionsResponse>;
|
|
343
|
+
/**
|
|
344
|
+
* Format page content for output.
|
|
345
|
+
*/
|
|
346
|
+
declare function formatPageOutput(content: PageContentResponse, format?: 'text' | 'json' | 'markdown'): string;
|
|
347
|
+
/**
|
|
348
|
+
* Format versions list for output.
|
|
349
|
+
*/
|
|
350
|
+
declare function formatVersionsOutput(versions: PageVersionsResponse, format?: 'text' | 'json'): string;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* okra search - Full-text search command
|
|
354
|
+
*
|
|
355
|
+
* Search page content across all pages.
|
|
356
|
+
*
|
|
357
|
+
* Usage:
|
|
358
|
+
* okra search <jobId> "revenue"
|
|
359
|
+
* okra search <jobId> "total" --format json
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
interface SearchOptions {
|
|
363
|
+
format?: 'text' | 'json';
|
|
364
|
+
limit?: number;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Search page content.
|
|
368
|
+
*/
|
|
369
|
+
declare function search(client: OkraClient, jobId: string, query: string): Promise<SearchResponse>;
|
|
370
|
+
/**
|
|
371
|
+
* Format search results for output.
|
|
372
|
+
*/
|
|
373
|
+
declare function formatSearchOutput(result: SearchResponse, format?: 'text' | 'json'): string;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* okra tables - List and filter tables
|
|
377
|
+
*
|
|
378
|
+
* Usage:
|
|
379
|
+
* okra tables <jobId>
|
|
380
|
+
* okra tables <jobId> --page 5
|
|
381
|
+
* okra tables <jobId> --status pending
|
|
382
|
+
* okra tables <jobId> --format json
|
|
383
|
+
*/
|
|
384
|
+
|
|
385
|
+
interface TablesOptions {
|
|
386
|
+
page?: number;
|
|
387
|
+
status?: 'pending' | 'verified' | 'flagged' | 'rejected';
|
|
388
|
+
format?: 'text' | 'json' | 'markdown';
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Get tables for a job.
|
|
392
|
+
*/
|
|
393
|
+
declare function tables(client: OkraClient, jobId: string, options?: TablesOptions): Promise<TablesResponse>;
|
|
394
|
+
/**
|
|
395
|
+
* Format tables for output.
|
|
396
|
+
*/
|
|
397
|
+
declare function formatTablesOutput(result: TablesResponse, format?: 'text' | 'json' | 'markdown'): string;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* okra history - Verification audit trail
|
|
401
|
+
*
|
|
402
|
+
* Usage:
|
|
403
|
+
* okra history <jobId>
|
|
404
|
+
* okra history <jobId> --limit 20
|
|
405
|
+
* okra history <jobId> --format json
|
|
406
|
+
*/
|
|
407
|
+
|
|
408
|
+
interface HistoryOptions {
|
|
409
|
+
limit?: number;
|
|
410
|
+
format?: 'text' | 'json';
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Get verification history.
|
|
414
|
+
*/
|
|
415
|
+
declare function history(client: OkraClient, jobId: string, options?: HistoryOptions): Promise<HistoryResponse>;
|
|
416
|
+
/**
|
|
417
|
+
* Format history for output.
|
|
418
|
+
*/
|
|
419
|
+
declare function formatHistoryOutput(result: HistoryResponse, format?: 'text' | 'json'): string;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* okra toc - Extract table of contents from a PDF
|
|
423
|
+
*
|
|
424
|
+
* Usage:
|
|
425
|
+
* okra toc <jobId>
|
|
426
|
+
* okra toc <jobId> --max-depth 3
|
|
427
|
+
* okra toc <jobId> --format json
|
|
428
|
+
* okra toc <jobId> --format markdown
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
interface TocEntry {
|
|
432
|
+
level: number;
|
|
433
|
+
title: string;
|
|
434
|
+
page: number;
|
|
435
|
+
}
|
|
436
|
+
interface TocResult {
|
|
437
|
+
file_name: string;
|
|
438
|
+
strategy: string;
|
|
439
|
+
total_entries: number;
|
|
440
|
+
total_pages: number;
|
|
441
|
+
elapsed_ms: number;
|
|
442
|
+
total_elapsed_ms: number;
|
|
443
|
+
toc: TocEntry[];
|
|
444
|
+
_replay?: {
|
|
445
|
+
sessionId: string;
|
|
446
|
+
replayUrl: string;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
interface TocOptions {
|
|
450
|
+
maxDepth?: number;
|
|
451
|
+
format?: 'text' | 'json' | 'markdown';
|
|
452
|
+
watch?: boolean;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Extract table of contents from a document.
|
|
456
|
+
*/
|
|
457
|
+
declare function toc(client: OkraClient, jobId: string, options?: TocOptions): Promise<TocResult>;
|
|
458
|
+
/**
|
|
459
|
+
* Format TOC for output.
|
|
460
|
+
*/
|
|
461
|
+
declare function formatTocOutput(result: TocResult, format?: 'text' | 'json' | 'markdown'): string;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* okra auth - Manage authentication
|
|
465
|
+
*
|
|
466
|
+
* Usage:
|
|
467
|
+
* okra auth login # Set API key in global config
|
|
468
|
+
* okra auth status # Show current auth status
|
|
469
|
+
* okra auth logout # Remove API key from global config
|
|
470
|
+
*/
|
|
471
|
+
/**
|
|
472
|
+
* Login command - set API key in global config.
|
|
473
|
+
*/
|
|
474
|
+
declare function authLogin(): Promise<void>;
|
|
475
|
+
/**
|
|
476
|
+
* Status command - show current auth status.
|
|
477
|
+
*/
|
|
478
|
+
declare function authStatus(): Promise<void>;
|
|
479
|
+
/**
|
|
480
|
+
* Logout command - remove API key from global config.
|
|
481
|
+
*/
|
|
482
|
+
declare function authLogout(): Promise<void>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Configuration management for okra CLI
|
|
486
|
+
*
|
|
487
|
+
* Priority order (highest to lowest):
|
|
488
|
+
* 1. Environment variable: OKRA_API_KEY
|
|
489
|
+
* 2. Project config: .okrarc or .okra.json in current directory
|
|
490
|
+
* 3. Global config: ~/.okra/config.json
|
|
491
|
+
*/
|
|
492
|
+
interface OkraConfig {
|
|
493
|
+
apiKey?: string;
|
|
494
|
+
baseUrl?: string;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Get the global config directory path.
|
|
498
|
+
* Supports XDG_CONFIG_HOME convention.
|
|
499
|
+
*/
|
|
500
|
+
declare function getGlobalConfigDir(): string;
|
|
501
|
+
/**
|
|
502
|
+
* Get the global config file path.
|
|
503
|
+
*/
|
|
504
|
+
declare function getGlobalConfigPath(): string;
|
|
505
|
+
/**
|
|
506
|
+
* Read global config from ~/.okra/config.json
|
|
507
|
+
*/
|
|
508
|
+
declare function readGlobalConfig(): OkraConfig | null;
|
|
509
|
+
/**
|
|
510
|
+
* Write global config to ~/.okra/config.json
|
|
511
|
+
*/
|
|
512
|
+
declare function writeGlobalConfig(config: OkraConfig): void;
|
|
513
|
+
/**
|
|
514
|
+
* Find and read project config from current directory.
|
|
515
|
+
* Checks for .okrarc and .okra.json
|
|
516
|
+
*/
|
|
517
|
+
declare function readProjectConfig(): OkraConfig | null;
|
|
518
|
+
/**
|
|
519
|
+
* Get API key from all sources with proper priority.
|
|
520
|
+
*
|
|
521
|
+
* Priority order:
|
|
522
|
+
* 1. Environment variable: OKRA_API_KEY
|
|
523
|
+
* 2. Project config: .okrarc or .okra.json
|
|
524
|
+
* 3. Global config: ~/.okra/config.json
|
|
525
|
+
*/
|
|
526
|
+
declare function getApiKey(): string | undefined;
|
|
527
|
+
/**
|
|
528
|
+
* Get base URL from all sources with proper priority.
|
|
529
|
+
*/
|
|
530
|
+
declare function getBaseUrl(): string | undefined;
|
|
531
|
+
/**
|
|
532
|
+
* Get source of API key for debugging.
|
|
533
|
+
*/
|
|
534
|
+
declare function getApiKeySource(): string;
|
|
535
|
+
|
|
536
|
+
export { type EntitiesResponse, type Entity, type EntityBBox, type EntityType, type FindOptions, type HistoryEntry, type HistoryOptions, type HistoryResponse, type MatchSource, type OkraConfig, type OutputFormat, type PageContent, type PageDimension, type PageGetOptions, type PageResolveOptions, type PageVersionInfo, type PageVersionsResponse, type QueryConfig, type QueryOptions, type QueryResult, type QueryStats, type SearchOptions, type SearchResponse, type SearchResult, type SelectorParts, type Table, type TablesOptions, type TablesResponse, type TextBlock, type TocOptions, type TreeOptions, type TreeResult, type VerificationPageStatus, type VerificationTree, type VerificationTreePage, type VerificationTreeSummary, authLogin, authLogout, authStatus, calculateStats, executeQuery, filterEntities, find, formatFindOutput, formatHistoryOutput, formatPageOutput, formatSearchOutput, formatStats, formatTablesOutput, formatTocOutput, formatTreeOutput, formatVersionsOutput, getApiKey, getApiKeySource, getBaseUrl, getGlobalConfigDir, getGlobalConfigPath, history, pageEdit, pageGet, pageResolve, pageVersions, parseSelector, readGlobalConfig, readProjectConfig, search, tables, toc, tree, writeGlobalConfig };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authLogin,
|
|
3
|
+
authLogout,
|
|
4
|
+
authStatus,
|
|
5
|
+
calculateStats,
|
|
6
|
+
executeQuery,
|
|
7
|
+
filterEntities,
|
|
8
|
+
find,
|
|
9
|
+
formatFindOutput,
|
|
10
|
+
formatHistoryOutput,
|
|
11
|
+
formatPageOutput,
|
|
12
|
+
formatSearchOutput,
|
|
13
|
+
formatStats,
|
|
14
|
+
formatTablesOutput,
|
|
15
|
+
formatTocOutput,
|
|
16
|
+
formatTreeOutput,
|
|
17
|
+
formatVersionsOutput,
|
|
18
|
+
getApiKey,
|
|
19
|
+
getApiKeySource,
|
|
20
|
+
getBaseUrl,
|
|
21
|
+
getGlobalConfigDir,
|
|
22
|
+
getGlobalConfigPath,
|
|
23
|
+
history,
|
|
24
|
+
pageEdit,
|
|
25
|
+
pageGet,
|
|
26
|
+
pageResolve,
|
|
27
|
+
pageVersions,
|
|
28
|
+
parseSelector,
|
|
29
|
+
readGlobalConfig,
|
|
30
|
+
readProjectConfig,
|
|
31
|
+
search,
|
|
32
|
+
tables,
|
|
33
|
+
toc,
|
|
34
|
+
tree,
|
|
35
|
+
writeGlobalConfig
|
|
36
|
+
} from "../chunk-SBT5T6ZK.js";
|
|
37
|
+
export {
|
|
38
|
+
authLogin,
|
|
39
|
+
authLogout,
|
|
40
|
+
authStatus,
|
|
41
|
+
calculateStats,
|
|
42
|
+
executeQuery,
|
|
43
|
+
filterEntities,
|
|
44
|
+
find,
|
|
45
|
+
formatFindOutput,
|
|
46
|
+
formatHistoryOutput,
|
|
47
|
+
formatPageOutput,
|
|
48
|
+
formatSearchOutput,
|
|
49
|
+
formatStats,
|
|
50
|
+
formatTablesOutput,
|
|
51
|
+
formatTocOutput,
|
|
52
|
+
formatTreeOutput,
|
|
53
|
+
formatVersionsOutput,
|
|
54
|
+
getApiKey,
|
|
55
|
+
getApiKeySource,
|
|
56
|
+
getBaseUrl,
|
|
57
|
+
getGlobalConfigDir,
|
|
58
|
+
getGlobalConfigPath,
|
|
59
|
+
history,
|
|
60
|
+
pageEdit,
|
|
61
|
+
pageGet,
|
|
62
|
+
pageResolve,
|
|
63
|
+
pageVersions,
|
|
64
|
+
parseSelector,
|
|
65
|
+
readGlobalConfig,
|
|
66
|
+
readProjectConfig,
|
|
67
|
+
search,
|
|
68
|
+
tables,
|
|
69
|
+
toc,
|
|
70
|
+
tree,
|
|
71
|
+
writeGlobalConfig
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { a as UploadInput, S as SessionCreateOptions, O as OkraSession, b as SessionAttachOptions, c as DeploymentCreateOptions, d as DeploymentResult, e as DeploymentStatus, f as DeploymentCompletionOptions, g as DeploymentCompletionResult, h as DeploymentTokenCreateOptions, i as DeploymentToken, j as DeploymentTokenListResult, k as DeploymentTokenRevokeResult, l as OkraClientOptions, m as UploadOptions, n as DocumentStatus, W as WaitOptions, P as Page, E as EntitiesResponse, Q as QueryResult, C as CompletionOptions, o as CompletionEvent, G as GenerateOptions, p as GenerateResult, q as StructuredSchema, r as PublishResult, s as ShareLinkOptions, t as ShareLinkResult } from './types-DEYgGUnH.js';
|
|
2
|
+
|
|
3
|
+
declare class OkraClient {
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
private readonly apiKey?;
|
|
6
|
+
private readonly sharedSecret?;
|
|
7
|
+
private readonly fetchImpl;
|
|
8
|
+
readonly sessions: {
|
|
9
|
+
create: (sourceOrDocId: UploadInput, options?: SessionCreateOptions) => Promise<OkraSession>;
|
|
10
|
+
from: (documentId: string, options?: SessionAttachOptions) => OkraSession;
|
|
11
|
+
};
|
|
12
|
+
readonly deployments: {
|
|
13
|
+
create: (options: DeploymentCreateOptions) => Promise<DeploymentResult>;
|
|
14
|
+
status: (deploymentId: string) => Promise<DeploymentStatus>;
|
|
15
|
+
completion: (deploymentId: string, options: DeploymentCompletionOptions) => Promise<DeploymentCompletionResult>;
|
|
16
|
+
tokens: {
|
|
17
|
+
create: (deploymentId: string, options: DeploymentTokenCreateOptions) => Promise<DeploymentToken>;
|
|
18
|
+
list: (deploymentId: string) => Promise<DeploymentTokenListResult>;
|
|
19
|
+
revoke: (deploymentId: string, tokenHint: string) => Promise<DeploymentTokenRevokeResult>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
constructor(options: OkraClientOptions);
|
|
23
|
+
upload(input: UploadInput, options?: UploadOptions): Promise<OkraSession>;
|
|
24
|
+
status(documentId: string, signal?: AbortSignal): Promise<DocumentStatus>;
|
|
25
|
+
wait(documentId: string, options?: WaitOptions): Promise<DocumentStatus>;
|
|
26
|
+
pages(documentId: string, options?: {
|
|
27
|
+
range?: string;
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}): Promise<Page[]>;
|
|
30
|
+
page(documentId: string, pageNumber: number, signal?: AbortSignal): Promise<Page>;
|
|
31
|
+
downloadUrl(documentId: string): string;
|
|
32
|
+
entities(documentId: string, options?: {
|
|
33
|
+
type?: string;
|
|
34
|
+
limit?: number;
|
|
35
|
+
offset?: number;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}): Promise<EntitiesResponse>;
|
|
38
|
+
query(documentId: string, sql: string, signal?: AbortSignal): Promise<QueryResult>;
|
|
39
|
+
stream(documentId: string, query: string, options?: CompletionOptions): AsyncGenerator<CompletionEvent>;
|
|
40
|
+
generate(documentId: string, query: string, options?: GenerateOptions & {
|
|
41
|
+
schema?: undefined;
|
|
42
|
+
}): Promise<GenerateResult>;
|
|
43
|
+
generate<T>(documentId: string, query: string, options: GenerateOptions & {
|
|
44
|
+
schema: StructuredSchema<T>;
|
|
45
|
+
}): Promise<GenerateResult<T>>;
|
|
46
|
+
private generateStructured;
|
|
47
|
+
modelEndpoint(documentId: string): string;
|
|
48
|
+
publish(documentId: string, signal?: AbortSignal): Promise<PublishResult>;
|
|
49
|
+
shareLink(documentId: string, options?: ShareLinkOptions): Promise<ShareLinkResult>;
|
|
50
|
+
request<T>(path: string, init?: RequestInit): Promise<T>;
|
|
51
|
+
get url(): string;
|
|
52
|
+
private authHeaders;
|
|
53
|
+
private rawRequest;
|
|
54
|
+
private requestJson;
|
|
55
|
+
private parseBody;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { OkraClient as O };
|