@probeo/anymodel 0.2.0 → 0.3.1
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/README.md +83 -6
- package/dist/cli.cjs +799 -104
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +777 -104
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +820 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -22
- package/dist/index.d.ts +106 -22
- package/dist/index.js +798 -105
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -281,6 +281,10 @@ interface AnyModelConfig {
|
|
|
281
281
|
concurrencyFallback?: number;
|
|
282
282
|
retentionDays?: number;
|
|
283
283
|
};
|
|
284
|
+
io?: {
|
|
285
|
+
readConcurrency?: number;
|
|
286
|
+
writeConcurrency?: number;
|
|
287
|
+
};
|
|
284
288
|
}
|
|
285
289
|
|
|
286
290
|
interface ProviderAdapter {
|
|
@@ -295,9 +299,25 @@ interface ProviderAdapter {
|
|
|
295
299
|
};
|
|
296
300
|
listModels(): Promise<ModelInfo[]>;
|
|
297
301
|
supportsParameter(param: string): boolean;
|
|
302
|
+
supportsBatch(): boolean;
|
|
298
303
|
sendRequest(request: ChatCompletionRequest): Promise<ChatCompletion>;
|
|
299
304
|
sendStreamingRequest(request: ChatCompletionRequest): Promise<AsyncIterable<ChatCompletionChunk>>;
|
|
300
305
|
}
|
|
306
|
+
interface NativeBatchStatus {
|
|
307
|
+
status: 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
|
|
308
|
+
total: number;
|
|
309
|
+
completed: number;
|
|
310
|
+
failed: number;
|
|
311
|
+
}
|
|
312
|
+
interface BatchAdapter {
|
|
313
|
+
createBatch(model: string, requests: BatchRequestItem[], options?: Record<string, unknown>): Promise<{
|
|
314
|
+
providerBatchId: string;
|
|
315
|
+
metadata?: Record<string, unknown>;
|
|
316
|
+
}>;
|
|
317
|
+
pollBatch(providerBatchId: string): Promise<NativeBatchStatus>;
|
|
318
|
+
getBatchResults(providerBatchId: string): Promise<BatchResultItem[]>;
|
|
319
|
+
cancelBatch(providerBatchId: string): Promise<void>;
|
|
320
|
+
}
|
|
301
321
|
|
|
302
322
|
declare class ProviderRegistry {
|
|
303
323
|
private adapters;
|
|
@@ -382,10 +402,21 @@ declare class BatchManager {
|
|
|
382
402
|
private store;
|
|
383
403
|
private router;
|
|
384
404
|
private concurrencyLimit;
|
|
405
|
+
private defaultPollInterval;
|
|
406
|
+
private batchAdapters;
|
|
385
407
|
constructor(router: Router, options?: {
|
|
386
408
|
dir?: string;
|
|
387
409
|
concurrency?: number;
|
|
410
|
+
pollInterval?: number;
|
|
388
411
|
});
|
|
412
|
+
/**
|
|
413
|
+
* Register a native batch adapter for a provider.
|
|
414
|
+
*/
|
|
415
|
+
registerBatchAdapter(providerName: string, adapter: BatchAdapter): void;
|
|
416
|
+
/**
|
|
417
|
+
* Check if a provider has native batch support.
|
|
418
|
+
*/
|
|
419
|
+
private getNativeBatchAdapter;
|
|
389
420
|
/**
|
|
390
421
|
* Create a batch and return immediately (no polling).
|
|
391
422
|
*/
|
|
@@ -401,23 +432,31 @@ declare class BatchManager {
|
|
|
401
432
|
/**
|
|
402
433
|
* Get the current status of a batch.
|
|
403
434
|
*/
|
|
404
|
-
get(id: string): BatchObject | null
|
|
435
|
+
get(id: string): Promise<BatchObject | null>;
|
|
405
436
|
/**
|
|
406
437
|
* Get results for a completed batch.
|
|
407
438
|
*/
|
|
408
|
-
getResults(id: string): BatchResults
|
|
439
|
+
getResults(id: string): Promise<BatchResults>;
|
|
409
440
|
/**
|
|
410
441
|
* List all batches.
|
|
411
442
|
*/
|
|
412
|
-
list(): BatchObject[]
|
|
443
|
+
list(): Promise<BatchObject[]>;
|
|
413
444
|
/**
|
|
414
445
|
* Cancel a batch.
|
|
415
446
|
*/
|
|
416
|
-
cancel(id: string): BatchObject
|
|
447
|
+
cancel(id: string): Promise<BatchObject>;
|
|
448
|
+
/**
|
|
449
|
+
* Process batch via native provider batch API.
|
|
450
|
+
*/
|
|
451
|
+
private processNativeBatch;
|
|
452
|
+
/**
|
|
453
|
+
* Sync native batch status from provider.
|
|
454
|
+
*/
|
|
455
|
+
private syncNativeBatchStatus;
|
|
417
456
|
/**
|
|
418
|
-
* Process batch requests concurrently.
|
|
457
|
+
* Process batch requests concurrently (fallback path).
|
|
419
458
|
*/
|
|
420
|
-
private
|
|
459
|
+
private processConcurrentBatch;
|
|
421
460
|
}
|
|
422
461
|
|
|
423
462
|
declare class AnyModel {
|
|
@@ -446,13 +485,14 @@ declare class AnyModel {
|
|
|
446
485
|
create: (request: BatchCreateRequest) => Promise<BatchObject>;
|
|
447
486
|
createAndPoll: (request: BatchCreateRequest, options?: BatchPollOptions) => Promise<BatchResults>;
|
|
448
487
|
poll: (id: string, options?: BatchPollOptions) => Promise<BatchResults>;
|
|
449
|
-
get: (id: string) => BatchObject | null
|
|
450
|
-
list: () => BatchObject[]
|
|
451
|
-
cancel: (id: string) => BatchObject
|
|
452
|
-
results: (id: string) => BatchResults
|
|
488
|
+
get: (id: string) => Promise<BatchObject | null>;
|
|
489
|
+
list: () => Promise<BatchObject[]>;
|
|
490
|
+
cancel: (id: string) => Promise<BatchObject>;
|
|
491
|
+
results: (id: string) => Promise<BatchResults>;
|
|
453
492
|
};
|
|
454
493
|
constructor(config?: AnyModelConfig);
|
|
455
494
|
private registerProviders;
|
|
495
|
+
private registerBatchAdapters;
|
|
456
496
|
private applyDefaults;
|
|
457
497
|
private fetchModels;
|
|
458
498
|
getRegistry(): ProviderRegistry;
|
|
@@ -489,52 +529,55 @@ declare class GenerationStatsStore {
|
|
|
489
529
|
|
|
490
530
|
/**
|
|
491
531
|
* Disk-based batch persistence store.
|
|
532
|
+
* Uses queued, concurrency-limited IO for high-volume operations.
|
|
492
533
|
* Structure: {dir}/{batchId}/meta.json, requests.jsonl, results.jsonl, provider.json
|
|
493
534
|
*/
|
|
494
535
|
declare class BatchStore {
|
|
495
536
|
private dir;
|
|
537
|
+
private initialized;
|
|
496
538
|
constructor(dir?: string);
|
|
539
|
+
private init;
|
|
497
540
|
private batchDir;
|
|
498
541
|
/**
|
|
499
542
|
* Create a new batch directory and save initial metadata.
|
|
500
543
|
*/
|
|
501
|
-
create(batch: BatchObject): void
|
|
544
|
+
create(batch: BatchObject): Promise<void>;
|
|
502
545
|
/**
|
|
503
|
-
* Update batch metadata.
|
|
546
|
+
* Update batch metadata (atomic write).
|
|
504
547
|
*/
|
|
505
|
-
updateMeta(batch: BatchObject): void
|
|
548
|
+
updateMeta(batch: BatchObject): Promise<void>;
|
|
506
549
|
/**
|
|
507
550
|
* Save requests as JSONL.
|
|
508
551
|
*/
|
|
509
|
-
saveRequests(id: string, requests: unknown[]): void
|
|
552
|
+
saveRequests(id: string, requests: unknown[]): Promise<void>;
|
|
510
553
|
/**
|
|
511
554
|
* Append a result to results.jsonl.
|
|
512
555
|
*/
|
|
513
|
-
appendResult(id: string, result: BatchResultItem): void
|
|
556
|
+
appendResult(id: string, result: BatchResultItem): Promise<void>;
|
|
514
557
|
/**
|
|
515
558
|
* Save provider-specific state (e.g., provider batch ID).
|
|
516
559
|
*/
|
|
517
|
-
saveProviderState(id: string, state: Record<string, unknown>): void
|
|
560
|
+
saveProviderState(id: string, state: Record<string, unknown>): Promise<void>;
|
|
518
561
|
/**
|
|
519
562
|
* Load provider state.
|
|
520
563
|
*/
|
|
521
|
-
loadProviderState(id: string): Record<string, unknown> | null
|
|
564
|
+
loadProviderState(id: string): Promise<Record<string, unknown> | null>;
|
|
522
565
|
/**
|
|
523
566
|
* Get batch metadata.
|
|
524
567
|
*/
|
|
525
|
-
getMeta(id: string): BatchObject | null
|
|
568
|
+
getMeta(id: string): Promise<BatchObject | null>;
|
|
526
569
|
/**
|
|
527
570
|
* Get all results for a batch.
|
|
528
571
|
*/
|
|
529
|
-
getResults(id: string): BatchResultItem[]
|
|
572
|
+
getResults(id: string): Promise<BatchResultItem[]>;
|
|
530
573
|
/**
|
|
531
574
|
* List all batch IDs.
|
|
532
575
|
*/
|
|
533
|
-
listBatches(): string[]
|
|
576
|
+
listBatches(): Promise<string[]>;
|
|
534
577
|
/**
|
|
535
578
|
* Check if a batch exists.
|
|
536
579
|
*/
|
|
537
|
-
exists(id: string): boolean
|
|
580
|
+
exists(id: string): Promise<boolean>;
|
|
538
581
|
}
|
|
539
582
|
|
|
540
583
|
interface ServerOptions {
|
|
@@ -545,4 +588,45 @@ interface ServerOptions {
|
|
|
545
588
|
declare function createAnyModelServer(options?: ServerOptions): ReturnType<typeof createServer>;
|
|
546
589
|
declare function startServer(options?: ServerOptions): void;
|
|
547
590
|
|
|
548
|
-
|
|
591
|
+
/**
|
|
592
|
+
* Concurrency-limited filesystem helpers for high-volume file operations.
|
|
593
|
+
*
|
|
594
|
+
* Based on probeo-core/common/fs-io. Provides queued reads/writes,
|
|
595
|
+
* atomic durable writes, directory caching, and path memoization.
|
|
596
|
+
*/
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Configure the filesystem IO concurrency limits.
|
|
600
|
+
* Call before any IO operations to adjust defaults.
|
|
601
|
+
*/
|
|
602
|
+
declare function configureFsIO(options: {
|
|
603
|
+
readConcurrency?: number;
|
|
604
|
+
writeConcurrency?: number;
|
|
605
|
+
}): void;
|
|
606
|
+
declare function ensureDir(dir: string): Promise<void>;
|
|
607
|
+
declare function readFileQueued(filePath: string, encoding?: BufferEncoding | null): Promise<string | Buffer>;
|
|
608
|
+
declare function writeFileQueued(filePath: string, data: string | Buffer): Promise<void>;
|
|
609
|
+
declare function appendFileQueued(filePath: string, data: string | Buffer): Promise<void>;
|
|
610
|
+
/**
|
|
611
|
+
* Atomically write a file with fsync to ensure data hits disk.
|
|
612
|
+
* Uses temp file + rename + directory fsync.
|
|
613
|
+
*/
|
|
614
|
+
declare function writeFileFlushedQueued(filePath: string, data: string | Buffer): Promise<void>;
|
|
615
|
+
declare function joinPath(...segments: string[]): string;
|
|
616
|
+
declare function getFsQueueStatus(): {
|
|
617
|
+
read: {
|
|
618
|
+
size: number;
|
|
619
|
+
pending: number;
|
|
620
|
+
};
|
|
621
|
+
write: {
|
|
622
|
+
size: number;
|
|
623
|
+
pending: number;
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
declare function waitForFsQueuesIdle(): Promise<void>;
|
|
627
|
+
|
|
628
|
+
declare function createOpenAIBatchAdapter(apiKey: string): BatchAdapter;
|
|
629
|
+
|
|
630
|
+
declare function createAnthropicBatchAdapter(apiKey: string): BatchAdapter;
|
|
631
|
+
|
|
632
|
+
export { AnyModel, type AnyModelConfig, AnyModelError, type AnyModelErrorMetadata, type BatchAdapter, type BatchCreateRequest, BatchManager, type BatchMode, type BatchObject, type BatchPollOptions, type BatchRequestItem, type BatchResultItem, type BatchResults, type BatchStatus, BatchStore, type BatchUsageSummary, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionRequest, type ChunkChoice, type ChunkDelta, type ContentPart, type CustomProviderConfig, type FinishReason, type GenerationStats, GenerationStatsStore, type Message, type ModelArchitecture, type ModelInfo, type ModelPricing, type ModelTopProvider, type NativeBatchStatus, type ProviderAdapter, type ProviderConfig, type ProviderPreferences, type ResponseFormat, type Role, type ServerOptions, type Tool, type ToolCall, type ToolChoice, type Usage, appendFileQueued, configureFsIO, createAnthropicBatchAdapter, createAnyModelServer, createOpenAIBatchAdapter, ensureDir, getFsQueueStatus, joinPath, readFileQueued, resolveConfig, startServer, waitForFsQueuesIdle, writeFileFlushedQueued, writeFileQueued };
|
package/dist/index.d.ts
CHANGED
|
@@ -281,6 +281,10 @@ interface AnyModelConfig {
|
|
|
281
281
|
concurrencyFallback?: number;
|
|
282
282
|
retentionDays?: number;
|
|
283
283
|
};
|
|
284
|
+
io?: {
|
|
285
|
+
readConcurrency?: number;
|
|
286
|
+
writeConcurrency?: number;
|
|
287
|
+
};
|
|
284
288
|
}
|
|
285
289
|
|
|
286
290
|
interface ProviderAdapter {
|
|
@@ -295,9 +299,25 @@ interface ProviderAdapter {
|
|
|
295
299
|
};
|
|
296
300
|
listModels(): Promise<ModelInfo[]>;
|
|
297
301
|
supportsParameter(param: string): boolean;
|
|
302
|
+
supportsBatch(): boolean;
|
|
298
303
|
sendRequest(request: ChatCompletionRequest): Promise<ChatCompletion>;
|
|
299
304
|
sendStreamingRequest(request: ChatCompletionRequest): Promise<AsyncIterable<ChatCompletionChunk>>;
|
|
300
305
|
}
|
|
306
|
+
interface NativeBatchStatus {
|
|
307
|
+
status: 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
|
|
308
|
+
total: number;
|
|
309
|
+
completed: number;
|
|
310
|
+
failed: number;
|
|
311
|
+
}
|
|
312
|
+
interface BatchAdapter {
|
|
313
|
+
createBatch(model: string, requests: BatchRequestItem[], options?: Record<string, unknown>): Promise<{
|
|
314
|
+
providerBatchId: string;
|
|
315
|
+
metadata?: Record<string, unknown>;
|
|
316
|
+
}>;
|
|
317
|
+
pollBatch(providerBatchId: string): Promise<NativeBatchStatus>;
|
|
318
|
+
getBatchResults(providerBatchId: string): Promise<BatchResultItem[]>;
|
|
319
|
+
cancelBatch(providerBatchId: string): Promise<void>;
|
|
320
|
+
}
|
|
301
321
|
|
|
302
322
|
declare class ProviderRegistry {
|
|
303
323
|
private adapters;
|
|
@@ -382,10 +402,21 @@ declare class BatchManager {
|
|
|
382
402
|
private store;
|
|
383
403
|
private router;
|
|
384
404
|
private concurrencyLimit;
|
|
405
|
+
private defaultPollInterval;
|
|
406
|
+
private batchAdapters;
|
|
385
407
|
constructor(router: Router, options?: {
|
|
386
408
|
dir?: string;
|
|
387
409
|
concurrency?: number;
|
|
410
|
+
pollInterval?: number;
|
|
388
411
|
});
|
|
412
|
+
/**
|
|
413
|
+
* Register a native batch adapter for a provider.
|
|
414
|
+
*/
|
|
415
|
+
registerBatchAdapter(providerName: string, adapter: BatchAdapter): void;
|
|
416
|
+
/**
|
|
417
|
+
* Check if a provider has native batch support.
|
|
418
|
+
*/
|
|
419
|
+
private getNativeBatchAdapter;
|
|
389
420
|
/**
|
|
390
421
|
* Create a batch and return immediately (no polling).
|
|
391
422
|
*/
|
|
@@ -401,23 +432,31 @@ declare class BatchManager {
|
|
|
401
432
|
/**
|
|
402
433
|
* Get the current status of a batch.
|
|
403
434
|
*/
|
|
404
|
-
get(id: string): BatchObject | null
|
|
435
|
+
get(id: string): Promise<BatchObject | null>;
|
|
405
436
|
/**
|
|
406
437
|
* Get results for a completed batch.
|
|
407
438
|
*/
|
|
408
|
-
getResults(id: string): BatchResults
|
|
439
|
+
getResults(id: string): Promise<BatchResults>;
|
|
409
440
|
/**
|
|
410
441
|
* List all batches.
|
|
411
442
|
*/
|
|
412
|
-
list(): BatchObject[]
|
|
443
|
+
list(): Promise<BatchObject[]>;
|
|
413
444
|
/**
|
|
414
445
|
* Cancel a batch.
|
|
415
446
|
*/
|
|
416
|
-
cancel(id: string): BatchObject
|
|
447
|
+
cancel(id: string): Promise<BatchObject>;
|
|
448
|
+
/**
|
|
449
|
+
* Process batch via native provider batch API.
|
|
450
|
+
*/
|
|
451
|
+
private processNativeBatch;
|
|
452
|
+
/**
|
|
453
|
+
* Sync native batch status from provider.
|
|
454
|
+
*/
|
|
455
|
+
private syncNativeBatchStatus;
|
|
417
456
|
/**
|
|
418
|
-
* Process batch requests concurrently.
|
|
457
|
+
* Process batch requests concurrently (fallback path).
|
|
419
458
|
*/
|
|
420
|
-
private
|
|
459
|
+
private processConcurrentBatch;
|
|
421
460
|
}
|
|
422
461
|
|
|
423
462
|
declare class AnyModel {
|
|
@@ -446,13 +485,14 @@ declare class AnyModel {
|
|
|
446
485
|
create: (request: BatchCreateRequest) => Promise<BatchObject>;
|
|
447
486
|
createAndPoll: (request: BatchCreateRequest, options?: BatchPollOptions) => Promise<BatchResults>;
|
|
448
487
|
poll: (id: string, options?: BatchPollOptions) => Promise<BatchResults>;
|
|
449
|
-
get: (id: string) => BatchObject | null
|
|
450
|
-
list: () => BatchObject[]
|
|
451
|
-
cancel: (id: string) => BatchObject
|
|
452
|
-
results: (id: string) => BatchResults
|
|
488
|
+
get: (id: string) => Promise<BatchObject | null>;
|
|
489
|
+
list: () => Promise<BatchObject[]>;
|
|
490
|
+
cancel: (id: string) => Promise<BatchObject>;
|
|
491
|
+
results: (id: string) => Promise<BatchResults>;
|
|
453
492
|
};
|
|
454
493
|
constructor(config?: AnyModelConfig);
|
|
455
494
|
private registerProviders;
|
|
495
|
+
private registerBatchAdapters;
|
|
456
496
|
private applyDefaults;
|
|
457
497
|
private fetchModels;
|
|
458
498
|
getRegistry(): ProviderRegistry;
|
|
@@ -489,52 +529,55 @@ declare class GenerationStatsStore {
|
|
|
489
529
|
|
|
490
530
|
/**
|
|
491
531
|
* Disk-based batch persistence store.
|
|
532
|
+
* Uses queued, concurrency-limited IO for high-volume operations.
|
|
492
533
|
* Structure: {dir}/{batchId}/meta.json, requests.jsonl, results.jsonl, provider.json
|
|
493
534
|
*/
|
|
494
535
|
declare class BatchStore {
|
|
495
536
|
private dir;
|
|
537
|
+
private initialized;
|
|
496
538
|
constructor(dir?: string);
|
|
539
|
+
private init;
|
|
497
540
|
private batchDir;
|
|
498
541
|
/**
|
|
499
542
|
* Create a new batch directory and save initial metadata.
|
|
500
543
|
*/
|
|
501
|
-
create(batch: BatchObject): void
|
|
544
|
+
create(batch: BatchObject): Promise<void>;
|
|
502
545
|
/**
|
|
503
|
-
* Update batch metadata.
|
|
546
|
+
* Update batch metadata (atomic write).
|
|
504
547
|
*/
|
|
505
|
-
updateMeta(batch: BatchObject): void
|
|
548
|
+
updateMeta(batch: BatchObject): Promise<void>;
|
|
506
549
|
/**
|
|
507
550
|
* Save requests as JSONL.
|
|
508
551
|
*/
|
|
509
|
-
saveRequests(id: string, requests: unknown[]): void
|
|
552
|
+
saveRequests(id: string, requests: unknown[]): Promise<void>;
|
|
510
553
|
/**
|
|
511
554
|
* Append a result to results.jsonl.
|
|
512
555
|
*/
|
|
513
|
-
appendResult(id: string, result: BatchResultItem): void
|
|
556
|
+
appendResult(id: string, result: BatchResultItem): Promise<void>;
|
|
514
557
|
/**
|
|
515
558
|
* Save provider-specific state (e.g., provider batch ID).
|
|
516
559
|
*/
|
|
517
|
-
saveProviderState(id: string, state: Record<string, unknown>): void
|
|
560
|
+
saveProviderState(id: string, state: Record<string, unknown>): Promise<void>;
|
|
518
561
|
/**
|
|
519
562
|
* Load provider state.
|
|
520
563
|
*/
|
|
521
|
-
loadProviderState(id: string): Record<string, unknown> | null
|
|
564
|
+
loadProviderState(id: string): Promise<Record<string, unknown> | null>;
|
|
522
565
|
/**
|
|
523
566
|
* Get batch metadata.
|
|
524
567
|
*/
|
|
525
|
-
getMeta(id: string): BatchObject | null
|
|
568
|
+
getMeta(id: string): Promise<BatchObject | null>;
|
|
526
569
|
/**
|
|
527
570
|
* Get all results for a batch.
|
|
528
571
|
*/
|
|
529
|
-
getResults(id: string): BatchResultItem[]
|
|
572
|
+
getResults(id: string): Promise<BatchResultItem[]>;
|
|
530
573
|
/**
|
|
531
574
|
* List all batch IDs.
|
|
532
575
|
*/
|
|
533
|
-
listBatches(): string[]
|
|
576
|
+
listBatches(): Promise<string[]>;
|
|
534
577
|
/**
|
|
535
578
|
* Check if a batch exists.
|
|
536
579
|
*/
|
|
537
|
-
exists(id: string): boolean
|
|
580
|
+
exists(id: string): Promise<boolean>;
|
|
538
581
|
}
|
|
539
582
|
|
|
540
583
|
interface ServerOptions {
|
|
@@ -545,4 +588,45 @@ interface ServerOptions {
|
|
|
545
588
|
declare function createAnyModelServer(options?: ServerOptions): ReturnType<typeof createServer>;
|
|
546
589
|
declare function startServer(options?: ServerOptions): void;
|
|
547
590
|
|
|
548
|
-
|
|
591
|
+
/**
|
|
592
|
+
* Concurrency-limited filesystem helpers for high-volume file operations.
|
|
593
|
+
*
|
|
594
|
+
* Based on probeo-core/common/fs-io. Provides queued reads/writes,
|
|
595
|
+
* atomic durable writes, directory caching, and path memoization.
|
|
596
|
+
*/
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Configure the filesystem IO concurrency limits.
|
|
600
|
+
* Call before any IO operations to adjust defaults.
|
|
601
|
+
*/
|
|
602
|
+
declare function configureFsIO(options: {
|
|
603
|
+
readConcurrency?: number;
|
|
604
|
+
writeConcurrency?: number;
|
|
605
|
+
}): void;
|
|
606
|
+
declare function ensureDir(dir: string): Promise<void>;
|
|
607
|
+
declare function readFileQueued(filePath: string, encoding?: BufferEncoding | null): Promise<string | Buffer>;
|
|
608
|
+
declare function writeFileQueued(filePath: string, data: string | Buffer): Promise<void>;
|
|
609
|
+
declare function appendFileQueued(filePath: string, data: string | Buffer): Promise<void>;
|
|
610
|
+
/**
|
|
611
|
+
* Atomically write a file with fsync to ensure data hits disk.
|
|
612
|
+
* Uses temp file + rename + directory fsync.
|
|
613
|
+
*/
|
|
614
|
+
declare function writeFileFlushedQueued(filePath: string, data: string | Buffer): Promise<void>;
|
|
615
|
+
declare function joinPath(...segments: string[]): string;
|
|
616
|
+
declare function getFsQueueStatus(): {
|
|
617
|
+
read: {
|
|
618
|
+
size: number;
|
|
619
|
+
pending: number;
|
|
620
|
+
};
|
|
621
|
+
write: {
|
|
622
|
+
size: number;
|
|
623
|
+
pending: number;
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
declare function waitForFsQueuesIdle(): Promise<void>;
|
|
627
|
+
|
|
628
|
+
declare function createOpenAIBatchAdapter(apiKey: string): BatchAdapter;
|
|
629
|
+
|
|
630
|
+
declare function createAnthropicBatchAdapter(apiKey: string): BatchAdapter;
|
|
631
|
+
|
|
632
|
+
export { AnyModel, type AnyModelConfig, AnyModelError, type AnyModelErrorMetadata, type BatchAdapter, type BatchCreateRequest, BatchManager, type BatchMode, type BatchObject, type BatchPollOptions, type BatchRequestItem, type BatchResultItem, type BatchResults, type BatchStatus, BatchStore, type BatchUsageSummary, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionRequest, type ChunkChoice, type ChunkDelta, type ContentPart, type CustomProviderConfig, type FinishReason, type GenerationStats, GenerationStatsStore, type Message, type ModelArchitecture, type ModelInfo, type ModelPricing, type ModelTopProvider, type NativeBatchStatus, type ProviderAdapter, type ProviderConfig, type ProviderPreferences, type ResponseFormat, type Role, type ServerOptions, type Tool, type ToolCall, type ToolChoice, type Usage, appendFileQueued, configureFsIO, createAnthropicBatchAdapter, createAnyModelServer, createOpenAIBatchAdapter, ensureDir, getFsQueueStatus, joinPath, readFileQueued, resolveConfig, startServer, waitForFsQueuesIdle, writeFileFlushedQueued, writeFileQueued };
|