@easbot/utils 0.1.7 → 0.1.12
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/LICENSE +21 -0
- package/dist/chunks/chunk-3QJJWPMF.mjs +1 -0
- package/dist/chunks/chunk-JRBFY3PQ.mjs +8 -0
- package/dist/chunks/chunk-PQ3EETPA.cjs +8 -0
- package/dist/chunks/chunk-PQC2BFS2.cjs +1 -0
- package/dist/chunks/log-S3VOL35O.mjs +1 -0
- package/dist/chunks/log-YI7B3XJ6.cjs +1 -0
- package/dist/chunks/main-7EGLGBLC.mjs +66 -0
- package/dist/chunks/main-BW4T3DHC.cjs +66 -0
- package/dist/index.cjs +55 -176
- package/dist/index.d.cts +849 -11
- package/dist/index.d.ts +849 -11
- package/dist/index.mjs +55 -176
- package/package.json +33 -24
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import z, { z as z$1 } from 'zod';
|
|
2
|
+
export { z } from 'zod';
|
|
3
|
+
import * as fs from 'fs';
|
|
2
4
|
import { statSync } from 'fs';
|
|
5
|
+
import * as stream from 'stream';
|
|
3
6
|
import { Readable } from 'stream';
|
|
7
|
+
import * as _hono_node_ws from '@hono/node-ws';
|
|
8
|
+
export { createNodeWebSocket } from '@hono/node-ws';
|
|
9
|
+
import { Context as Context$1, Next, Hono } from 'hono';
|
|
10
|
+
export { Hono, Next } from 'hono';
|
|
11
|
+
import { ServerType } from '@hono/node-server';
|
|
12
|
+
import { cors } from 'hono/cors';
|
|
13
|
+
export { cors } from 'hono/cors';
|
|
14
|
+
import { ChildProcess } from 'node:child_process';
|
|
15
|
+
import { EasbotShell, ShellExpression, EasbotShellPromise } from '@easbot/types';
|
|
16
|
+
export { HTTPException } from 'hono/http-exception';
|
|
17
|
+
export { SSEStreamingApi } from 'hono/streaming';
|
|
18
|
+
export { WebSocket as WSContext } from 'ws';
|
|
19
|
+
export { compress } from 'hono/compress';
|
|
20
|
+
export { logger } from 'hono/logger';
|
|
21
|
+
export { secureHeaders } from 'hono/secure-headers';
|
|
22
|
+
export { timeout } from 'hono/timeout';
|
|
23
|
+
export { validator } from 'hono/validator';
|
|
24
|
+
export { zValidator } from '@hono/zod-validator';
|
|
4
25
|
|
|
5
26
|
declare function findLast<T>(items: readonly T[], predicate: (item: T, index: number, items: readonly T[]) => boolean): T | undefined;
|
|
6
27
|
|
|
@@ -12,10 +33,48 @@ declare namespace Binary {
|
|
|
12
33
|
function insert<T>(array: T[], item: T, compare: (item: T) => string): T[];
|
|
13
34
|
}
|
|
14
35
|
|
|
15
|
-
declare
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
declare namespace Encode {
|
|
37
|
+
function base64Encode(value: string): string;
|
|
38
|
+
function base64Decode(value: string): string;
|
|
39
|
+
function hash(content: string, algorithm?: string): Promise<string>;
|
|
40
|
+
function checksum(content: string): string | undefined;
|
|
41
|
+
function sampledChecksum(content: string, limit?: number): string | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare namespace TruncateContent {
|
|
45
|
+
const DIR: string;
|
|
46
|
+
const DEFAULT_MAX_CHARS = 4000;
|
|
47
|
+
const DIRECTION: "head";
|
|
48
|
+
type Result = {
|
|
49
|
+
content: string;
|
|
50
|
+
truncated: false;
|
|
51
|
+
} | {
|
|
52
|
+
content: string;
|
|
53
|
+
truncated: true;
|
|
54
|
+
outputPath: string;
|
|
55
|
+
originalLength: number;
|
|
56
|
+
removedLength: number;
|
|
57
|
+
label: string;
|
|
58
|
+
};
|
|
59
|
+
interface Options {
|
|
60
|
+
maxChars?: number;
|
|
61
|
+
direction?: 'head' | 'tail';
|
|
62
|
+
label?: string;
|
|
63
|
+
dir?: string;
|
|
64
|
+
sourcePath?: string;
|
|
65
|
+
}
|
|
66
|
+
function truncate(content: string, options?: Options): Result;
|
|
67
|
+
function truncateAndSave(content: string, options?: Options): Promise<Result>;
|
|
68
|
+
function formatHint(result: Result): string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare function formatLocalISO(date: Date | number, includeMilliseconds?: boolean): string;
|
|
72
|
+
declare function formatLocalISOCompact(date: Date | number): string;
|
|
73
|
+
declare function now(): number;
|
|
74
|
+
declare function nowLocalISO(includeMilliseconds?: boolean): string;
|
|
75
|
+
declare function parseLocalISO(isoString: string): Date;
|
|
76
|
+
declare function formatLogTime(date: Date | number): string;
|
|
77
|
+
declare function getTimezoneOffset(date?: Date): string;
|
|
19
78
|
|
|
20
79
|
declare abstract class NamedError extends Error {
|
|
21
80
|
abstract schema(): z.core.$ZodType;
|
|
@@ -208,7 +267,11 @@ declare namespace Filesystem {
|
|
|
208
267
|
function writeJson(p: string, data: unknown, mode?: number): Promise<void>;
|
|
209
268
|
function writeStream(p: string, stream: ReadableStream<Uint8Array> | Readable, mode?: number): Promise<void>;
|
|
210
269
|
function mimeType(p: string): string;
|
|
211
|
-
function
|
|
270
|
+
function toUnixPath(p: string): string;
|
|
271
|
+
function normalize(p: string): string;
|
|
272
|
+
const normalizePath: typeof normalize;
|
|
273
|
+
function resolve(p: string): string;
|
|
274
|
+
function windowsPath(p: string): string;
|
|
212
275
|
function overlaps(a: string, b: string): boolean;
|
|
213
276
|
function contains(parent: string, child: string): boolean;
|
|
214
277
|
function findUp(target: string, start: string, stop?: string): Promise<string[]>;
|
|
@@ -216,15 +279,22 @@ declare namespace Filesystem {
|
|
|
216
279
|
targets: string[];
|
|
217
280
|
start: string;
|
|
218
281
|
stop?: string;
|
|
219
|
-
}): AsyncGenerator<string
|
|
282
|
+
}): AsyncGenerator<string>;
|
|
220
283
|
function globUp(pattern: string, start: string, stop?: string): Promise<string[]>;
|
|
221
284
|
}
|
|
222
285
|
|
|
223
|
-
declare function
|
|
286
|
+
declare function createFn<T extends z$1.ZodType, Result>(schema: T, cb: (input: z$1.infer<T>) => Result): {
|
|
224
287
|
(input: z$1.infer<T>): Result;
|
|
225
288
|
force(input: z$1.infer<T>): Result;
|
|
226
289
|
schema: T;
|
|
227
290
|
};
|
|
291
|
+
declare const fn: typeof createFn;
|
|
292
|
+
type Fn = typeof createFn;
|
|
293
|
+
declare namespace Fn {
|
|
294
|
+
const fn: typeof createFn;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare function loadEnv(): void;
|
|
228
298
|
|
|
229
299
|
declare namespace Identifier {
|
|
230
300
|
function ascending(): string;
|
|
@@ -232,8 +302,19 @@ declare namespace Identifier {
|
|
|
232
302
|
function create(descending: boolean, timestamp?: number): string;
|
|
233
303
|
}
|
|
234
304
|
|
|
305
|
+
interface GitResult {
|
|
306
|
+
exitCode: number;
|
|
307
|
+
text(): string | Promise<string>;
|
|
308
|
+
stdout: any;
|
|
309
|
+
stderr: any;
|
|
310
|
+
}
|
|
311
|
+
declare function git(args: string[], opts: {
|
|
312
|
+
cwd: string;
|
|
313
|
+
env?: Record<string, string>;
|
|
314
|
+
}): Promise<GitResult>;
|
|
315
|
+
|
|
235
316
|
declare function loadTextFile(relativePath: string, importMetaUrl?: string): {
|
|
236
|
-
():
|
|
317
|
+
(): string;
|
|
237
318
|
reset(): void;
|
|
238
319
|
};
|
|
239
320
|
declare function loadTextFileAsync(relativePath: string, importMetaUrl?: string): {
|
|
@@ -243,10 +324,26 @@ declare function loadTextFileAsync(relativePath: string, importMetaUrl?: string)
|
|
|
243
324
|
|
|
244
325
|
declare function iife<T>(fn: () => T): T;
|
|
245
326
|
|
|
246
|
-
declare function
|
|
327
|
+
declare function parseModelId(modelId: string): {
|
|
328
|
+
provider: string;
|
|
329
|
+
model: string;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
declare function createLazy<T>(fn: () => T): {
|
|
247
333
|
(): T;
|
|
248
334
|
reset(): void;
|
|
249
335
|
};
|
|
336
|
+
declare const lazy: typeof createLazy;
|
|
337
|
+
declare function createLazyAsync<T>(fn: () => Promise<T>): {
|
|
338
|
+
(): Promise<T>;
|
|
339
|
+
reset(): void;
|
|
340
|
+
};
|
|
341
|
+
declare const lazyAsync: typeof createLazyAsync;
|
|
342
|
+
type Lazy = typeof createLazy;
|
|
343
|
+
declare namespace Lazy {
|
|
344
|
+
const lazy: typeof createLazy;
|
|
345
|
+
const lazyAsync: typeof createLazyAsync;
|
|
346
|
+
}
|
|
250
347
|
|
|
251
348
|
declare const MarkdownStyleSchema: z$1.ZodEnum<{
|
|
252
349
|
bold: "bold";
|
|
@@ -343,8 +440,8 @@ declare const FormatOptionsSchema: z$1.ZodObject<{
|
|
|
343
440
|
indentSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
344
441
|
listMarker: z$1.ZodDefault<z$1.ZodEnum<{
|
|
345
442
|
"-": "-";
|
|
346
|
-
"\u2022": "•";
|
|
347
443
|
"*": "*";
|
|
444
|
+
"\u2022": "•";
|
|
348
445
|
}>>;
|
|
349
446
|
codeBlockMarker: z$1.ZodDefault<z$1.ZodEnum<{
|
|
350
447
|
"```": "```";
|
|
@@ -465,4 +562,745 @@ declare namespace Slug {
|
|
|
465
562
|
function create(): string;
|
|
466
563
|
}
|
|
467
564
|
|
|
468
|
-
|
|
565
|
+
type BunBuildTarget = 'bun-darwin-x64' | 'bun-darwin-x64-baseline' | 'bun-darwin-arm64' | 'bun-linux-x64' | 'bun-linux-x64-baseline' | 'bun-linux-x64-modern' | 'bun-linux-arm64' | 'bun-linux-x64-musl' | 'bun-linux-arm64-musl' | 'bun-windows-x64' | 'bun-windows-x64-baseline' | 'bun-windows-x64-modern';
|
|
566
|
+
interface BunCompileOptions {
|
|
567
|
+
target?: BunBuildTarget | string;
|
|
568
|
+
outfile?: string;
|
|
569
|
+
execArgv?: string[];
|
|
570
|
+
autoloadTsconfig?: boolean;
|
|
571
|
+
autoloadPackageJson?: boolean;
|
|
572
|
+
autoloadDotenv?: boolean;
|
|
573
|
+
autoloadBunfig?: boolean;
|
|
574
|
+
windows?: {
|
|
575
|
+
icon?: string;
|
|
576
|
+
hideConsole?: boolean;
|
|
577
|
+
title?: string;
|
|
578
|
+
publisher?: string;
|
|
579
|
+
version?: string;
|
|
580
|
+
description?: string;
|
|
581
|
+
copyright?: string;
|
|
582
|
+
};
|
|
583
|
+
codesign?: {
|
|
584
|
+
identity?: string;
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
interface BunBuildOptions {
|
|
588
|
+
entrypoints: string[];
|
|
589
|
+
outdir?: string;
|
|
590
|
+
target?: 'browser' | 'node' | 'bun';
|
|
591
|
+
minify?: boolean;
|
|
592
|
+
sourcemap?: 'inline' | 'external' | 'none' | 'linked';
|
|
593
|
+
splitting?: boolean;
|
|
594
|
+
plugins?: any[];
|
|
595
|
+
define?: Record<string, string>;
|
|
596
|
+
conditions?: string[];
|
|
597
|
+
tsconfig?: string;
|
|
598
|
+
external?: string[];
|
|
599
|
+
format?: 'esm' | 'cjs' | 'iife';
|
|
600
|
+
platform?: 'browser' | 'node' | 'neutral';
|
|
601
|
+
bundle?: boolean;
|
|
602
|
+
compile?: boolean | BunBuildTarget | BunCompileOptions;
|
|
603
|
+
bytecode?: boolean;
|
|
604
|
+
assets?: string[];
|
|
605
|
+
loader?: Record<string, string>;
|
|
606
|
+
write?: boolean;
|
|
607
|
+
entryNames?: string;
|
|
608
|
+
chunkNames?: string;
|
|
609
|
+
assetNames?: string;
|
|
610
|
+
publicPath?: string;
|
|
611
|
+
paths?: Record<string, string[]>;
|
|
612
|
+
inject?: string[];
|
|
613
|
+
}
|
|
614
|
+
interface BunBuildOutput {
|
|
615
|
+
path: string;
|
|
616
|
+
size: number;
|
|
617
|
+
}
|
|
618
|
+
interface BunBuildLog {
|
|
619
|
+
level: 'error' | 'warning' | 'info';
|
|
620
|
+
message: string;
|
|
621
|
+
path?: string;
|
|
622
|
+
position?: {
|
|
623
|
+
line: number;
|
|
624
|
+
column: number;
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
interface BunBuildResult {
|
|
628
|
+
outputs: BunBuildOutput[];
|
|
629
|
+
success: boolean;
|
|
630
|
+
logs: BunBuildLog[];
|
|
631
|
+
metafile?: any;
|
|
632
|
+
}
|
|
633
|
+
declare function build(options: BunBuildOptions): Promise<BunBuildResult>;
|
|
634
|
+
|
|
635
|
+
interface WebSocketHandler {
|
|
636
|
+
onMessage?: (event: MessageEvent, ws: any) => void | Promise<void>;
|
|
637
|
+
onClose?: (event: CloseEvent, ws: any) => void | Promise<void>;
|
|
638
|
+
onError?: (event: Event, ws: any) => void | Promise<void>;
|
|
639
|
+
onOpen?: (event: Event, ws: any) => void | Promise<void>;
|
|
640
|
+
}
|
|
641
|
+
type StreamHandler = (stream: ReadableStream) => Response | Promise<Response>;
|
|
642
|
+
type SSEHandler = (c: Context$1) => AsyncGenerator<{
|
|
643
|
+
data: string;
|
|
644
|
+
event?: string;
|
|
645
|
+
id?: string;
|
|
646
|
+
}, void, unknown>;
|
|
647
|
+
type RPCMethod<T = unknown> = (params: T, c: Context$1) => unknown | Promise<unknown>;
|
|
648
|
+
interface ServerOptions {
|
|
649
|
+
port?: number;
|
|
650
|
+
hostname?: string;
|
|
651
|
+
fetch?: (req: Request) => Response | Promise<Response>;
|
|
652
|
+
routes?: RouteDefinition[];
|
|
653
|
+
middlewares?: MiddlewareDefinition[];
|
|
654
|
+
websockets?: WebSocketRouteDefinition[];
|
|
655
|
+
rpc?: Record<string, RPCMethod>;
|
|
656
|
+
streaming?: boolean;
|
|
657
|
+
compression?: boolean;
|
|
658
|
+
cors?: boolean | Parameters<typeof cors>[0];
|
|
659
|
+
secureHeaders?: boolean;
|
|
660
|
+
timeout?: number;
|
|
661
|
+
onError?: (err: Error, c: Context$1) => Response | Promise<Response>;
|
|
662
|
+
onNotFound?: (c: Context$1) => Response | Promise<Response>;
|
|
663
|
+
}
|
|
664
|
+
interface RouteDefinition {
|
|
665
|
+
method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options';
|
|
666
|
+
path: string;
|
|
667
|
+
handler: (c: Context$1) => Response | Promise<Response>;
|
|
668
|
+
middlewares?: ((c: Context$1, next: Next) => Promise<void> | void)[];
|
|
669
|
+
validation?: z$1.ZodSchema;
|
|
670
|
+
}
|
|
671
|
+
interface MiddlewareDefinition {
|
|
672
|
+
path?: string;
|
|
673
|
+
handler: (c: Context$1, next: Next) => Promise<void> | void;
|
|
674
|
+
}
|
|
675
|
+
interface WebSocketRouteDefinition {
|
|
676
|
+
path: string;
|
|
677
|
+
handler: WebSocketHandler;
|
|
678
|
+
}
|
|
679
|
+
interface EasServer {
|
|
680
|
+
url: URL;
|
|
681
|
+
port: number;
|
|
682
|
+
hostname: string;
|
|
683
|
+
hono: Hono;
|
|
684
|
+
stop(closeActiveConnections?: boolean): Promise<void>;
|
|
685
|
+
raw?: ServerType;
|
|
686
|
+
}
|
|
687
|
+
declare function createServer(options?: ServerOptions): EasServer;
|
|
688
|
+
declare function createRPCServer(methods: Record<string, RPCMethod>): EasServer;
|
|
689
|
+
declare function startServer(fetch: (req: Request) => Response | Promise<Response>, port?: number, hostname?: string): EasServer;
|
|
690
|
+
declare function createRESTServer(routes: RouteDefinition[], options?: Omit<ServerOptions, 'routes'>): EasServer;
|
|
691
|
+
declare function createWebSocketServer(websockets: WebSocketRouteDefinition[], options?: Omit<ServerOptions, 'websockets'>): EasServer;
|
|
692
|
+
declare function createStreamingServer(sseHandlers: Record<string, (c: Context$1) => AsyncIterable<{
|
|
693
|
+
data: string;
|
|
694
|
+
event?: string;
|
|
695
|
+
id?: string;
|
|
696
|
+
}>>, options?: Omit<ServerOptions, 'routes'>): EasServer;
|
|
697
|
+
|
|
698
|
+
interface ShellOptions {
|
|
699
|
+
cwd?: string;
|
|
700
|
+
env?: Record<string, string | undefined>;
|
|
701
|
+
quiet?: boolean;
|
|
702
|
+
nothrow?: boolean;
|
|
703
|
+
}
|
|
704
|
+
declare class PkgShell {
|
|
705
|
+
private options;
|
|
706
|
+
constructor(options?: ShellOptions);
|
|
707
|
+
call(strings: TemplateStringsArray, ...expressions: ShellExpression[]): EasbotShellPromise;
|
|
708
|
+
braces(pattern: string): string[];
|
|
709
|
+
escape(input: string): string;
|
|
710
|
+
env(newEnv?: Record<string, string | undefined>): EasbotShell;
|
|
711
|
+
cwd(newCwd?: string): EasbotShell;
|
|
712
|
+
nothrow(): EasbotShell;
|
|
713
|
+
throws(shouldThrow: boolean): EasbotShell;
|
|
714
|
+
}
|
|
715
|
+
declare function createPkgShell(options?: ShellOptions): EasbotShell;
|
|
716
|
+
declare const $$1: EasbotShell;
|
|
717
|
+
|
|
718
|
+
interface NodeWhichOptions {
|
|
719
|
+
PATH?: string;
|
|
720
|
+
}
|
|
721
|
+
interface NodeSpawnOptions {
|
|
722
|
+
cwd?: string;
|
|
723
|
+
env?: Record<string, string | undefined>;
|
|
724
|
+
stdout?: 'pipe' | 'inherit' | 'null';
|
|
725
|
+
stderr?: 'pipe' | 'inherit' | 'null';
|
|
726
|
+
stdin?: 'pipe' | 'inherit' | 'null';
|
|
727
|
+
signal?: AbortSignal;
|
|
728
|
+
timeout?: number | false;
|
|
729
|
+
}
|
|
730
|
+
interface NodeSpawnObjectArgs {
|
|
731
|
+
cmd: string[];
|
|
732
|
+
cwd?: string;
|
|
733
|
+
env?: Record<string, string | undefined>;
|
|
734
|
+
stdout?: 'pipe' | 'inherit' | 'null';
|
|
735
|
+
stderr?: 'pipe' | 'inherit' | 'null';
|
|
736
|
+
stdin?: 'pipe' | 'inherit' | 'null';
|
|
737
|
+
signal?: AbortSignal;
|
|
738
|
+
timeout?: number | false;
|
|
739
|
+
}
|
|
740
|
+
interface NodeSpawnResult {
|
|
741
|
+
stdout: stream.Readable;
|
|
742
|
+
stderr: stream.Readable;
|
|
743
|
+
stdin: stream.Writable;
|
|
744
|
+
pid: number;
|
|
745
|
+
exited: Promise<number>;
|
|
746
|
+
kill: (signal?: string | number) => boolean;
|
|
747
|
+
exitCode?: number;
|
|
748
|
+
}
|
|
749
|
+
declare namespace PKG {
|
|
750
|
+
function which(command?: string, options?: NodeWhichOptions): Promise<string | null>;
|
|
751
|
+
function whichSync(command?: string, options?: NodeWhichOptions): string | null;
|
|
752
|
+
function clearWhichCache(): void;
|
|
753
|
+
function resolve(module: string, base?: string): Promise<string>;
|
|
754
|
+
function file(filePath: string): {
|
|
755
|
+
readonly name: string;
|
|
756
|
+
exists(): Promise<boolean>;
|
|
757
|
+
getSize(): Promise<number | undefined>;
|
|
758
|
+
text(): Promise<string>;
|
|
759
|
+
textSync(): string;
|
|
760
|
+
jsonSync(): unknown;
|
|
761
|
+
bytes(): Promise<Uint8Array>;
|
|
762
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
763
|
+
readonly type: string;
|
|
764
|
+
write(data: string | Buffer | Uint8Array | Response): Promise<void>;
|
|
765
|
+
json(): Promise<unknown>;
|
|
766
|
+
stat(): Promise<fs.Stats>;
|
|
767
|
+
};
|
|
768
|
+
function write(filePath: string, data: string | Buffer | Uint8Array | Response, options?: {
|
|
769
|
+
mode?: number;
|
|
770
|
+
}): Promise<void>;
|
|
771
|
+
function writeSync(filePath: string, data: string | Buffer | Uint8Array, options?: {
|
|
772
|
+
mode?: number;
|
|
773
|
+
}): void;
|
|
774
|
+
function readSync(filePath: string, encoding?: BufferEncoding): string;
|
|
775
|
+
function spawn(command: string | string[], options?: NodeSpawnOptions): NodeSpawnResult;
|
|
776
|
+
function spawn(args: NodeSpawnObjectArgs): NodeSpawnResult;
|
|
777
|
+
function run(cmd: string[], options?: {
|
|
778
|
+
cwd?: string;
|
|
779
|
+
env?: Record<string, string | undefined>;
|
|
780
|
+
timeout?: number;
|
|
781
|
+
}): Promise<{
|
|
782
|
+
code: number;
|
|
783
|
+
stdout: string;
|
|
784
|
+
stderr: string;
|
|
785
|
+
}>;
|
|
786
|
+
function runWithStream(cmd: string[], options?: {
|
|
787
|
+
cwd?: string;
|
|
788
|
+
env?: Record<string, string | undefined>;
|
|
789
|
+
timeout?: number;
|
|
790
|
+
}, callbacks?: {
|
|
791
|
+
onStdout?: (chunk: string) => void;
|
|
792
|
+
onStderr?: (chunk: string) => void;
|
|
793
|
+
onExit?: (code: number) => void;
|
|
794
|
+
}): Promise<{
|
|
795
|
+
code: number;
|
|
796
|
+
stdout: string;
|
|
797
|
+
stderr: string;
|
|
798
|
+
}>;
|
|
799
|
+
function $(strings: TemplateStringsArray, ...values: unknown[]): {
|
|
800
|
+
quiet: () => any;
|
|
801
|
+
nothrow: () => any;
|
|
802
|
+
cwd: (dir: string) => any;
|
|
803
|
+
env: (env: Record<string, string | undefined>) => any;
|
|
804
|
+
text: () => Promise<string>;
|
|
805
|
+
lines: () => Promise<string[]>;
|
|
806
|
+
then: (onfulfilled: (result: {
|
|
807
|
+
exitCode: number;
|
|
808
|
+
stdout: Uint8Array;
|
|
809
|
+
stderr: Uint8Array;
|
|
810
|
+
text: () => string;
|
|
811
|
+
lines: () => string[];
|
|
812
|
+
}) => void, onrejected?: (error: Error) => void) => Promise<void>;
|
|
813
|
+
};
|
|
814
|
+
function readableStreamToText(stream: ReadableStream<Uint8Array>): Promise<string>;
|
|
815
|
+
function nodeReadableStreamToText(stream: NodeJS.ReadableStream): Promise<string>;
|
|
816
|
+
function xxHash32(str: string, seed?: number): number;
|
|
817
|
+
function stringWidth(str: string): number;
|
|
818
|
+
class Glob {
|
|
819
|
+
private pattern;
|
|
820
|
+
constructor(pattern: string);
|
|
821
|
+
scan(options?: {
|
|
822
|
+
cwd?: string;
|
|
823
|
+
absolute?: boolean;
|
|
824
|
+
followSymlinks?: boolean;
|
|
825
|
+
dot?: boolean;
|
|
826
|
+
onlyFiles?: boolean;
|
|
827
|
+
}): AsyncIterable<string>;
|
|
828
|
+
scanSync(options?: {
|
|
829
|
+
cwd?: string;
|
|
830
|
+
absolute?: boolean;
|
|
831
|
+
followSymlinks?: boolean;
|
|
832
|
+
dot?: boolean;
|
|
833
|
+
onlyFiles?: boolean;
|
|
834
|
+
}): Generator<string>;
|
|
835
|
+
match(filepath: string): boolean;
|
|
836
|
+
}
|
|
837
|
+
const InstallFailedError: {
|
|
838
|
+
new (data: {
|
|
839
|
+
message: string;
|
|
840
|
+
pkg: string;
|
|
841
|
+
version: string;
|
|
842
|
+
originalError?: string | undefined;
|
|
843
|
+
}, options?: ErrorOptions): {
|
|
844
|
+
readonly name: "PKGInstallFailedError";
|
|
845
|
+
readonly data: {
|
|
846
|
+
message: string;
|
|
847
|
+
pkg: string;
|
|
848
|
+
version: string;
|
|
849
|
+
originalError?: string | undefined;
|
|
850
|
+
};
|
|
851
|
+
schema(): z.ZodObject<{
|
|
852
|
+
name: z.ZodLiteral<"PKGInstallFailedError">;
|
|
853
|
+
data: z.ZodObject<{
|
|
854
|
+
message: z.ZodString;
|
|
855
|
+
pkg: z.ZodString;
|
|
856
|
+
version: z.ZodString;
|
|
857
|
+
originalError: z.ZodOptional<z.ZodString>;
|
|
858
|
+
}, z.core.$strip>;
|
|
859
|
+
}, z.core.$strip>;
|
|
860
|
+
toObject(): {
|
|
861
|
+
name: "PKGInstallFailedError";
|
|
862
|
+
data: {
|
|
863
|
+
message: string;
|
|
864
|
+
pkg: string;
|
|
865
|
+
version: string;
|
|
866
|
+
originalError?: string | undefined;
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
message: string;
|
|
870
|
+
stack?: string;
|
|
871
|
+
cause?: unknown;
|
|
872
|
+
};
|
|
873
|
+
readonly Schema: z.ZodObject<{
|
|
874
|
+
name: z.ZodLiteral<"PKGInstallFailedError">;
|
|
875
|
+
data: z.ZodObject<{
|
|
876
|
+
message: z.ZodString;
|
|
877
|
+
pkg: z.ZodString;
|
|
878
|
+
version: z.ZodString;
|
|
879
|
+
originalError: z.ZodOptional<z.ZodString>;
|
|
880
|
+
}, z.core.$strip>;
|
|
881
|
+
}, z.core.$strip>;
|
|
882
|
+
isInstance(input: any): input is {
|
|
883
|
+
readonly name: "PKGInstallFailedError";
|
|
884
|
+
readonly data: {
|
|
885
|
+
message: string;
|
|
886
|
+
pkg: string;
|
|
887
|
+
version: string;
|
|
888
|
+
originalError?: string | undefined;
|
|
889
|
+
};
|
|
890
|
+
schema(): z.ZodObject<{
|
|
891
|
+
name: z.ZodLiteral<"PKGInstallFailedError">;
|
|
892
|
+
data: z.ZodObject<{
|
|
893
|
+
message: z.ZodString;
|
|
894
|
+
pkg: z.ZodString;
|
|
895
|
+
version: z.ZodString;
|
|
896
|
+
originalError: z.ZodOptional<z.ZodString>;
|
|
897
|
+
}, z.core.$strip>;
|
|
898
|
+
}, z.core.$strip>;
|
|
899
|
+
toObject(): {
|
|
900
|
+
name: "PKGInstallFailedError";
|
|
901
|
+
data: {
|
|
902
|
+
message: string;
|
|
903
|
+
pkg: string;
|
|
904
|
+
version: string;
|
|
905
|
+
originalError?: string | undefined;
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
message: string;
|
|
909
|
+
stack?: string;
|
|
910
|
+
cause?: unknown;
|
|
911
|
+
};
|
|
912
|
+
create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data): {
|
|
913
|
+
new (data: z.input<Data>, options?: ErrorOptions): {
|
|
914
|
+
readonly name: Name;
|
|
915
|
+
readonly data: z.core.input<Data>;
|
|
916
|
+
schema(): z.ZodObject<{
|
|
917
|
+
name: z.ZodLiteral<Name>;
|
|
918
|
+
data: Data;
|
|
919
|
+
}, z.core.$strip>;
|
|
920
|
+
toObject(): {
|
|
921
|
+
name: Name;
|
|
922
|
+
data: z.core.input<Data>;
|
|
923
|
+
};
|
|
924
|
+
message: string;
|
|
925
|
+
stack?: string;
|
|
926
|
+
cause?: unknown;
|
|
927
|
+
};
|
|
928
|
+
readonly Schema: z.ZodObject<{
|
|
929
|
+
name: z.ZodLiteral<Name>;
|
|
930
|
+
data: Data;
|
|
931
|
+
}, z.core.$strip>;
|
|
932
|
+
isInstance(input: any): input is InstanceType<any>;
|
|
933
|
+
create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data): any;
|
|
934
|
+
readonly Unknown: {
|
|
935
|
+
new (data: {
|
|
936
|
+
message: string;
|
|
937
|
+
}, options?: ErrorOptions): {
|
|
938
|
+
readonly name: "UnknownError";
|
|
939
|
+
readonly data: {
|
|
940
|
+
message: string;
|
|
941
|
+
};
|
|
942
|
+
schema(): z.ZodObject<{
|
|
943
|
+
name: z.ZodLiteral<"UnknownError">;
|
|
944
|
+
data: z.ZodObject<{
|
|
945
|
+
message: z.ZodString;
|
|
946
|
+
}, z.core.$strip>;
|
|
947
|
+
}, z.core.$strip>;
|
|
948
|
+
toObject(): {
|
|
949
|
+
name: "UnknownError";
|
|
950
|
+
data: {
|
|
951
|
+
message: string;
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
message: string;
|
|
955
|
+
stack?: string;
|
|
956
|
+
cause?: unknown;
|
|
957
|
+
};
|
|
958
|
+
readonly Schema: z.ZodObject<{
|
|
959
|
+
name: z.ZodLiteral<"UnknownError">;
|
|
960
|
+
data: z.ZodObject<{
|
|
961
|
+
message: z.ZodString;
|
|
962
|
+
}, z.core.$strip>;
|
|
963
|
+
}, z.core.$strip>;
|
|
964
|
+
isInstance(input: any): input is {
|
|
965
|
+
readonly name: "UnknownError";
|
|
966
|
+
readonly data: {
|
|
967
|
+
message: string;
|
|
968
|
+
};
|
|
969
|
+
schema(): z.ZodObject<{
|
|
970
|
+
name: z.ZodLiteral<"UnknownError">;
|
|
971
|
+
data: z.ZodObject<{
|
|
972
|
+
message: z.ZodString;
|
|
973
|
+
}, z.core.$strip>;
|
|
974
|
+
}, z.core.$strip>;
|
|
975
|
+
toObject(): {
|
|
976
|
+
name: "UnknownError";
|
|
977
|
+
data: {
|
|
978
|
+
message: string;
|
|
979
|
+
};
|
|
980
|
+
};
|
|
981
|
+
message: string;
|
|
982
|
+
stack?: string;
|
|
983
|
+
cause?: unknown;
|
|
984
|
+
};
|
|
985
|
+
create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data): any;
|
|
986
|
+
readonly Unknown: any;
|
|
987
|
+
isError(error: unknown): error is Error;
|
|
988
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
989
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
990
|
+
stackTraceLimit: number;
|
|
991
|
+
};
|
|
992
|
+
isError(error: unknown): error is Error;
|
|
993
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
994
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
995
|
+
stackTraceLimit: number;
|
|
996
|
+
};
|
|
997
|
+
readonly Unknown: {
|
|
998
|
+
new (data: {
|
|
999
|
+
message: string;
|
|
1000
|
+
}, options?: ErrorOptions): {
|
|
1001
|
+
readonly name: "UnknownError";
|
|
1002
|
+
readonly data: {
|
|
1003
|
+
message: string;
|
|
1004
|
+
};
|
|
1005
|
+
schema(): z.ZodObject<{
|
|
1006
|
+
name: z.ZodLiteral<"UnknownError">;
|
|
1007
|
+
data: z.ZodObject<{
|
|
1008
|
+
message: z.ZodString;
|
|
1009
|
+
}, z.core.$strip>;
|
|
1010
|
+
}, z.core.$strip>;
|
|
1011
|
+
toObject(): {
|
|
1012
|
+
name: "UnknownError";
|
|
1013
|
+
data: {
|
|
1014
|
+
message: string;
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
message: string;
|
|
1018
|
+
stack?: string;
|
|
1019
|
+
cause?: unknown;
|
|
1020
|
+
};
|
|
1021
|
+
readonly Schema: z.ZodObject<{
|
|
1022
|
+
name: z.ZodLiteral<"UnknownError">;
|
|
1023
|
+
data: z.ZodObject<{
|
|
1024
|
+
message: z.ZodString;
|
|
1025
|
+
}, z.core.$strip>;
|
|
1026
|
+
}, z.core.$strip>;
|
|
1027
|
+
isInstance(input: any): input is {
|
|
1028
|
+
readonly name: "UnknownError";
|
|
1029
|
+
readonly data: {
|
|
1030
|
+
message: string;
|
|
1031
|
+
};
|
|
1032
|
+
schema(): z.ZodObject<{
|
|
1033
|
+
name: z.ZodLiteral<"UnknownError">;
|
|
1034
|
+
data: z.ZodObject<{
|
|
1035
|
+
message: z.ZodString;
|
|
1036
|
+
}, z.core.$strip>;
|
|
1037
|
+
}, z.core.$strip>;
|
|
1038
|
+
toObject(): {
|
|
1039
|
+
name: "UnknownError";
|
|
1040
|
+
data: {
|
|
1041
|
+
message: string;
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
message: string;
|
|
1045
|
+
stack?: string;
|
|
1046
|
+
cause?: unknown;
|
|
1047
|
+
};
|
|
1048
|
+
create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data): {
|
|
1049
|
+
new (data: z.input<Data>, options?: ErrorOptions): {
|
|
1050
|
+
readonly name: Name;
|
|
1051
|
+
readonly data: z.core.input<Data>;
|
|
1052
|
+
schema(): z.ZodObject<{
|
|
1053
|
+
name: z.ZodLiteral<Name>;
|
|
1054
|
+
data: Data;
|
|
1055
|
+
}, z.core.$strip>;
|
|
1056
|
+
toObject(): {
|
|
1057
|
+
name: Name;
|
|
1058
|
+
data: z.core.input<Data>;
|
|
1059
|
+
};
|
|
1060
|
+
message: string;
|
|
1061
|
+
stack?: string;
|
|
1062
|
+
cause?: unknown;
|
|
1063
|
+
};
|
|
1064
|
+
readonly Schema: z.ZodObject<{
|
|
1065
|
+
name: z.ZodLiteral<Name>;
|
|
1066
|
+
data: Data;
|
|
1067
|
+
}, z.core.$strip>;
|
|
1068
|
+
isInstance(input: any): input is InstanceType<any>;
|
|
1069
|
+
create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data): any;
|
|
1070
|
+
readonly Unknown: any;
|
|
1071
|
+
isError(error: unknown): error is Error;
|
|
1072
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1073
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1074
|
+
stackTraceLimit: number;
|
|
1075
|
+
};
|
|
1076
|
+
readonly Unknown: any;
|
|
1077
|
+
isError(error: unknown): error is Error;
|
|
1078
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1079
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1080
|
+
stackTraceLimit: number;
|
|
1081
|
+
};
|
|
1082
|
+
isError(error: unknown): error is Error;
|
|
1083
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1084
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1085
|
+
stackTraceLimit: number;
|
|
1086
|
+
};
|
|
1087
|
+
function install(pkg: string, version?: string, installPath?: string): Promise<string>;
|
|
1088
|
+
const stdin: NodeJS.ReadStream & {
|
|
1089
|
+
fd: 0;
|
|
1090
|
+
};
|
|
1091
|
+
const stdout: NodeJS.WriteStream & {
|
|
1092
|
+
fd: 1;
|
|
1093
|
+
};
|
|
1094
|
+
const stderr: NodeJS.WriteStream & {
|
|
1095
|
+
fd: 2;
|
|
1096
|
+
};
|
|
1097
|
+
const sleep: (ms: number) => Promise<unknown>;
|
|
1098
|
+
const color: (color: string, format: "ansi") => string | null;
|
|
1099
|
+
const hash: {
|
|
1100
|
+
xxHash32: typeof xxHash32;
|
|
1101
|
+
};
|
|
1102
|
+
const build: typeof build;
|
|
1103
|
+
const server: typeof createServer;
|
|
1104
|
+
const nodeWebSocket: (init: _hono_node_ws.NodeWebSocketInit) => _hono_node_ws.NodeWebSocket;
|
|
1105
|
+
const restServer: typeof createRESTServer;
|
|
1106
|
+
const rpcServer: typeof createRPCServer;
|
|
1107
|
+
const streamingServer: typeof createStreamingServer;
|
|
1108
|
+
const webSocketServer: typeof createWebSocketServer;
|
|
1109
|
+
}
|
|
1110
|
+
declare const $: typeof PKG.$;
|
|
1111
|
+
declare const readableStreamToText: typeof PKG.readableStreamToText;
|
|
1112
|
+
declare const whichSync: typeof PKG.whichSync;
|
|
1113
|
+
|
|
1114
|
+
declare function abortAfter(ms: number): {
|
|
1115
|
+
controller: AbortController;
|
|
1116
|
+
signal: AbortSignal;
|
|
1117
|
+
clearTimeout: () => void;
|
|
1118
|
+
};
|
|
1119
|
+
declare function abortAfterAny(ms: number, ...signals: AbortSignal[]): {
|
|
1120
|
+
signal: AbortSignal;
|
|
1121
|
+
clearTimeout: () => void;
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
declare namespace Archive {
|
|
1125
|
+
function extractZip(zipPath: string, destDir: string): Promise<void>;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
declare namespace Color {
|
|
1129
|
+
function isValidHex(hex?: string): hex is string;
|
|
1130
|
+
function hexToRgb(hex: string): {
|
|
1131
|
+
r: number;
|
|
1132
|
+
g: number;
|
|
1133
|
+
b: number;
|
|
1134
|
+
};
|
|
1135
|
+
function hexToAnsiBold(hex?: string): string | undefined;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
declare namespace Context {
|
|
1139
|
+
class NotFound extends Error {
|
|
1140
|
+
readonly name: string;
|
|
1141
|
+
constructor(name: string);
|
|
1142
|
+
}
|
|
1143
|
+
function create<T>(name: string): {
|
|
1144
|
+
use(): NonNullable<T>;
|
|
1145
|
+
provide<R>(value: T, fn: () => R): R;
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
declare function defer<T extends () => void | Promise<void>>(fn: T): T extends () => Promise<void> ? {
|
|
1150
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
1151
|
+
} : {
|
|
1152
|
+
[Symbol.dispose]: () => void;
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
declare namespace EventLoop {
|
|
1156
|
+
function wait(): Promise<void>;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
declare function formatDuration(secs: number): string;
|
|
1160
|
+
|
|
1161
|
+
declare namespace Glob {
|
|
1162
|
+
interface Options {
|
|
1163
|
+
cwd?: string;
|
|
1164
|
+
absolute?: boolean;
|
|
1165
|
+
include?: 'file' | 'all';
|
|
1166
|
+
dot?: boolean;
|
|
1167
|
+
symlink?: boolean;
|
|
1168
|
+
}
|
|
1169
|
+
function scan(pattern: string, options?: Options): Promise<string[]>;
|
|
1170
|
+
function scanSync(pattern: string, options?: Options): string[];
|
|
1171
|
+
function match(pattern: string, filepath: string): boolean;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
declare namespace Keybind {
|
|
1175
|
+
type Info = {
|
|
1176
|
+
name: string;
|
|
1177
|
+
ctrl: boolean;
|
|
1178
|
+
meta: boolean;
|
|
1179
|
+
shift: boolean;
|
|
1180
|
+
super: boolean;
|
|
1181
|
+
leader: boolean;
|
|
1182
|
+
};
|
|
1183
|
+
function match(a: Info | undefined, b: Info): boolean;
|
|
1184
|
+
function fromParsedKey(key: {
|
|
1185
|
+
name: string;
|
|
1186
|
+
ctrl: boolean;
|
|
1187
|
+
meta: boolean;
|
|
1188
|
+
shift: boolean;
|
|
1189
|
+
super?: boolean;
|
|
1190
|
+
}, leader?: boolean): Info;
|
|
1191
|
+
function keyToString(info: Info | undefined): string;
|
|
1192
|
+
function parse(key: string): Info[];
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
declare namespace Locale {
|
|
1196
|
+
function titlecase(str: string): string;
|
|
1197
|
+
function time(input: number): string;
|
|
1198
|
+
function datetime(input: number): string;
|
|
1199
|
+
function todayTimeOrDateTime(input: number): string;
|
|
1200
|
+
function number(num: number): string;
|
|
1201
|
+
function duration(input: number): string;
|
|
1202
|
+
function truncate(str: string, len: number): string;
|
|
1203
|
+
function truncateMiddle(str: string, maxLength?: number): string;
|
|
1204
|
+
function pluralize(count: number, singular: string, plural: string): string;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
declare namespace Lock {
|
|
1208
|
+
function read(key: string): Promise<Disposable>;
|
|
1209
|
+
function write(key: string): Promise<Disposable>;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
declare namespace Process {
|
|
1213
|
+
type Stdio = 'inherit' | 'pipe' | 'ignore';
|
|
1214
|
+
type Shell = boolean | string;
|
|
1215
|
+
interface Options {
|
|
1216
|
+
cwd?: string;
|
|
1217
|
+
env?: NodeJS.ProcessEnv | null;
|
|
1218
|
+
stdin?: Stdio;
|
|
1219
|
+
stdout?: Stdio;
|
|
1220
|
+
stderr?: Stdio;
|
|
1221
|
+
shell?: Shell;
|
|
1222
|
+
abort?: AbortSignal;
|
|
1223
|
+
kill?: NodeJS.Signals | number;
|
|
1224
|
+
timeout?: number;
|
|
1225
|
+
}
|
|
1226
|
+
interface RunOptions extends Omit<Options, 'stdout' | 'stderr'> {
|
|
1227
|
+
nothrow?: boolean;
|
|
1228
|
+
}
|
|
1229
|
+
interface Result {
|
|
1230
|
+
code: number;
|
|
1231
|
+
stdout: Buffer;
|
|
1232
|
+
stderr: Buffer;
|
|
1233
|
+
}
|
|
1234
|
+
interface TextResult extends Result {
|
|
1235
|
+
text: string;
|
|
1236
|
+
}
|
|
1237
|
+
class RunFailedError extends Error {
|
|
1238
|
+
readonly cmd: string[];
|
|
1239
|
+
readonly code: number;
|
|
1240
|
+
readonly stdout: Buffer;
|
|
1241
|
+
readonly stderr: Buffer;
|
|
1242
|
+
constructor(cmd: string[], code: number, stdout: Buffer, stderr: Buffer);
|
|
1243
|
+
}
|
|
1244
|
+
type Child = ChildProcess & {
|
|
1245
|
+
exited: Promise<number>;
|
|
1246
|
+
};
|
|
1247
|
+
function spawn(cmd: string[], opts?: Options): Child;
|
|
1248
|
+
function run(cmd: string[], opts?: RunOptions): Promise<Result>;
|
|
1249
|
+
function stop(proc: ChildProcess): Promise<void>;
|
|
1250
|
+
function text(cmd: string[], opts?: RunOptions): Promise<TextResult>;
|
|
1251
|
+
function lines(cmd: string[], opts?: RunOptions): Promise<string[]>;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
declare function proxied(): boolean;
|
|
1255
|
+
|
|
1256
|
+
declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
1257
|
+
private queue;
|
|
1258
|
+
private resolvers;
|
|
1259
|
+
push(item: T): void;
|
|
1260
|
+
next(): Promise<T>;
|
|
1261
|
+
[Symbol.asyncIterator](): AsyncGenerator<Awaited<T>, void, unknown>;
|
|
1262
|
+
}
|
|
1263
|
+
declare function work<T>(concurrency: number, items: T[], fn: (item: T) => Promise<void>): Promise<void>;
|
|
1264
|
+
|
|
1265
|
+
declare function signal(): {
|
|
1266
|
+
trigger(): any;
|
|
1267
|
+
wait(): Promise<unknown>;
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
declare function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T>;
|
|
1271
|
+
|
|
1272
|
+
declare namespace Token {
|
|
1273
|
+
function estimate(input: string | null | undefined): number;
|
|
1274
|
+
function estimateObject(obj: unknown): number;
|
|
1275
|
+
function total(tokens: {
|
|
1276
|
+
total?: number;
|
|
1277
|
+
input?: number;
|
|
1278
|
+
output?: number;
|
|
1279
|
+
reasoning?: number;
|
|
1280
|
+
cache?: {
|
|
1281
|
+
read?: number;
|
|
1282
|
+
write?: number;
|
|
1283
|
+
};
|
|
1284
|
+
}): number;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
declare function updateSchema<T extends z.ZodRawShape>(schema: z.ZodObject<T>): z.ZodObject<{ -readonly [P in keyof { [K in keyof T]: z.ZodOptional<z.ZodNullable<T[K]>>; }]: { [K in keyof T]: z.ZodOptional<z.ZodNullable<T[K]>>; }[P]; }, z.core.$strip>;
|
|
1288
|
+
|
|
1289
|
+
declare namespace Wildcard {
|
|
1290
|
+
function match(str: string, pattern: string): boolean;
|
|
1291
|
+
function all(input: string, patterns: Record<string, unknown>): unknown;
|
|
1292
|
+
function allStructured(input: {
|
|
1293
|
+
head: string;
|
|
1294
|
+
tail: string[];
|
|
1295
|
+
}, patterns: Record<string, unknown>): unknown;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
declare function initLog(options: {
|
|
1299
|
+
print: boolean;
|
|
1300
|
+
logDir: string;
|
|
1301
|
+
logFile?: string;
|
|
1302
|
+
dev?: boolean;
|
|
1303
|
+
level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
1304
|
+
}): Promise<void>;
|
|
1305
|
+
|
|
1306
|
+
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, $$1 as EasbotShell, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, type ParsedFrontmatter, PkgShell, Process, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, type ServerOptions, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, now, nowLocalISO, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
|