@linxiraos/pi-utils 1.1.8 → 1.1.9
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/CHANGELOG.md +2 -3
- package/README.md +18 -18
- package/package.json +57 -63
- package/src/async.ts +16 -0
- package/src/dirs.ts +15 -10
- package/src/incoming-json.ts +856 -0
- package/src/index.ts +1 -0
- package/src/json-lexer.ts +413 -0
- package/src/json-parse.ts +93 -350
- package/src/tls-fetch.ts +2 -16
- package/THIRD-PARTY-NOTICES.txt +0 -22909
- package/dist/types/abortable.d.ts +0 -32
- package/dist/types/acp/connection.d.ts +0 -118
- package/dist/types/acp/protocol.d.ts +0 -526
- package/dist/types/acp/schema.d.ts +0 -41
- package/dist/types/acp/stream.d.ts +0 -8
- package/dist/types/acp/transport.d.ts +0 -88
- package/dist/types/acp.d.ts +0 -6
- package/dist/types/ar/arj.d.ts +0 -5
- package/dist/types/ar/asar.d.ts +0 -7
- package/dist/types/ar/bytes.d.ts +0 -20
- package/dist/types/ar/cab.d.ts +0 -5
- package/dist/types/ar/checksums.d.ts +0 -10
- package/dist/types/ar/codecs/bzip2.d.ts +0 -4
- package/dist/types/ar/codecs/gzip.d.ts +0 -6
- package/dist/types/ar/codecs/lzma.d.ts +0 -6
- package/dist/types/ar/codecs/lzw.d.ts +0 -4
- package/dist/types/ar/codecs/lzx.d.ts +0 -7
- package/dist/types/ar/codecs/xz.d.ts +0 -4
- package/dist/types/ar/codecs/zstd.d.ts +0 -6
- package/dist/types/ar/cpio.d.ts +0 -7
- package/dist/types/ar/deb.d.ts +0 -5
- package/dist/types/ar/entries.d.ts +0 -22
- package/dist/types/ar/error.d.ts +0 -8
- package/dist/types/ar/index.d.ts +0 -11
- package/dist/types/ar/iso.d.ts +0 -5
- package/dist/types/ar/limits.d.ts +0 -33
- package/dist/types/ar/lzh.d.ts +0 -7
- package/dist/types/ar/open.d.ts +0 -45
- package/dist/types/ar/paths.d.ts +0 -18
- package/dist/types/ar/rar/rar4-decoder.d.ts +0 -6
- package/dist/types/ar/rar/rar5-decoder.d.ts +0 -6
- package/dist/types/ar/rar.d.ts +0 -5
- package/dist/types/ar/reader.d.ts +0 -28
- package/dist/types/ar/registry.d.ts +0 -17
- package/dist/types/ar/rpm.d.ts +0 -5
- package/dist/types/ar/sevenzip/decode.d.ts +0 -33
- package/dist/types/ar/sevenzip.d.ts +0 -5
- package/dist/types/ar/source.d.ts +0 -54
- package/dist/types/ar/tar.d.ts +0 -9
- package/dist/types/ar/types.d.ts +0 -99
- package/dist/types/ar/unix-ar.d.ts +0 -7
- package/dist/types/ar/write.d.ts +0 -10
- package/dist/types/ar/zip.d.ts +0 -10
- package/dist/types/async.d.ts +0 -22
- package/dist/types/binary.d.ts +0 -23
- package/dist/types/browsers.d.ts +0 -68
- package/dist/types/chalk.d.ts +0 -125
- package/dist/types/cli.d.ts +0 -134
- package/dist/types/color.d.ts +0 -136
- package/dist/types/dates.d.ts +0 -7
- package/dist/types/dirs.d.ts +0 -325
- package/dist/types/docx/converter.d.ts +0 -46
- package/dist/types/docx/xml.d.ts +0 -26
- package/dist/types/docx.d.ts +0 -11
- package/dist/types/dom/core.d.ts +0 -431
- package/dist/types/dom/parser.d.ts +0 -7
- package/dist/types/dom/selector.d.ts +0 -5
- package/dist/types/dom.d.ts +0 -5
- package/dist/types/env.d.ts +0 -133
- package/dist/types/fetch-retry.d.ts +0 -98
- package/dist/types/file-lock.d.ts +0 -23
- package/dist/types/format.d.ts +0 -37
- package/dist/types/frontmatter.d.ts +0 -46
- package/dist/types/fs-error.d.ts +0 -31
- package/dist/types/glob.d.ts +0 -28
- package/dist/types/headers.d.ts +0 -34
- package/dist/types/index.d.ts +0 -42
- package/dist/types/json-parse.d.ts +0 -83
- package/dist/types/json.d.ts +0 -20
- package/dist/types/logger/rotating-file.d.ts +0 -18
- package/dist/types/logger.d.ts +0 -96
- package/dist/types/loop-phase.d.ts +0 -10
- package/dist/types/lru.d.ts +0 -46
- package/dist/types/marked/core.d.ts +0 -445
- package/dist/types/marked.d.ts +0 -2
- package/dist/types/materialize-string.d.ts +0 -7
- package/dist/types/math-delimiters.d.ts +0 -45
- package/dist/types/mermaid-ascii.d.ts +0 -11
- package/dist/types/mime.d.ts +0 -29
- package/dist/types/module-timer.d.ts +0 -1
- package/dist/types/path-tree.d.ts +0 -76
- package/dist/types/path.d.ts +0 -4
- package/dist/types/peek-file.d.ts +0 -29
- package/dist/types/postmortem.d.ts +0 -178
- package/dist/types/process-name.d.ts +0 -7
- package/dist/types/procmgr.d.ts +0 -74
- package/dist/types/prompt.d.ts +0 -18
- package/dist/types/ptree.d.ts +0 -124
- package/dist/types/readability/readability.d.ts +0 -9
- package/dist/types/readability/readerable.d.ts +0 -10
- package/dist/types/readability/types.d.ts +0 -70
- package/dist/types/readability.d.ts +0 -4
- package/dist/types/ring.d.ts +0 -93
- package/dist/types/runtime-install.d.ts +0 -85
- package/dist/types/sanitize-text.d.ts +0 -29
- package/dist/types/snowflake.d.ts +0 -25
- package/dist/types/sqlite.d.ts +0 -26
- package/dist/types/stderr-guard.d.ts +0 -22
- package/dist/types/stream.d.ts +0 -75
- package/dist/types/tab-spacing.d.ts +0 -24
- package/dist/types/temp.d.ts +0 -24
- package/dist/types/template.d.ts +0 -62
- package/dist/types/timing-buffer.d.ts +0 -22
- package/dist/types/tls-fetch.d.ts +0 -37
- package/dist/types/turndown/gfm.d.ts +0 -11
- package/dist/types/turndown/html.d.ts +0 -5
- package/dist/types/turndown/service.d.ts +0 -21
- package/dist/types/turndown/types.d.ts +0 -70
- package/dist/types/turndown.d.ts +0 -4
- package/dist/types/type-guards.d.ts +0 -5
- package/dist/types/vendor/mermaid-ascii/ascii/ansi.d.ts +0 -41
- package/dist/types/vendor/mermaid-ascii/ascii/canvas.d.ts +0 -89
- package/dist/types/vendor/mermaid-ascii/ascii/class-diagram.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/ascii/converter.d.ts +0 -12
- package/dist/types/vendor/mermaid-ascii/ascii/draw.d.ts +0 -66
- package/dist/types/vendor/mermaid-ascii/ascii/edge-bundling.d.ts +0 -48
- package/dist/types/vendor/mermaid-ascii/ascii/edge-routing.d.ts +0 -43
- package/dist/types/vendor/mermaid-ascii/ascii/er-diagram.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/ascii/grid.d.ts +0 -56
- package/dist/types/vendor/mermaid-ascii/ascii/index.d.ts +0 -65
- package/dist/types/vendor/mermaid-ascii/ascii/multiline-utils.d.ts +0 -27
- package/dist/types/vendor/mermaid-ascii/ascii/pathfinder.d.ts +0 -17
- package/dist/types/vendor/mermaid-ascii/ascii/sequence.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/circle.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/corners.d.ts +0 -34
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/diamond.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/hexagon.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/index.d.ts +0 -26
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/rectangle.d.ts +0 -31
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/rounded.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/special.d.ts +0 -59
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/stadium.d.ts +0 -17
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/state.d.ts +0 -30
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/types.d.ts +0 -55
- package/dist/types/vendor/mermaid-ascii/ascii/types.d.ts +0 -206
- package/dist/types/vendor/mermaid-ascii/ascii/validate.d.ts +0 -51
- package/dist/types/vendor/mermaid-ascii/ascii/xychart.d.ts +0 -2
- package/dist/types/vendor/mermaid-ascii/class/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/class/types.d.ts +0 -102
- package/dist/types/vendor/mermaid-ascii/er/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/er/types.d.ts +0 -76
- package/dist/types/vendor/mermaid-ascii/index.d.ts +0 -1
- package/dist/types/vendor/mermaid-ascii/multiline-utils.d.ts +0 -9
- package/dist/types/vendor/mermaid-ascii/parser.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/sequence/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/sequence/types.d.ts +0 -130
- package/dist/types/vendor/mermaid-ascii/text-metrics.d.ts +0 -23
- package/dist/types/vendor/mermaid-ascii/types.d.ts +0 -114
- package/dist/types/vendor/mermaid-ascii/xychart/colors.d.ts +0 -25
- package/dist/types/vendor/mermaid-ascii/xychart/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/xychart/types.d.ts +0 -145
- package/dist/types/version.d.ts +0 -18
- package/dist/types/vterm/buffer.d.ts +0 -99
- package/dist/types/vterm/query-responder.d.ts +0 -24
- package/dist/types/vterm/terminal.d.ts +0 -44
- package/dist/types/vterm.d.ts +0 -9
- package/dist/types/which.d.ts +0 -37
- package/dist/types/worker-host.d.ts +0 -51
- package/dist/types/xml.d.ts +0 -31
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Walk a conditional `exports` target (string, array of fallbacks, or a
|
|
3
|
-
* condition object) and return the first relative path that matches a runtime
|
|
4
|
-
* condition in declaration order. Returns `null` when nothing applies (e.g.
|
|
5
|
-
* an `import`-only entry).
|
|
6
|
-
*/
|
|
7
|
-
export declare function selectConditionalTarget(target: unknown): string | null;
|
|
8
|
-
/**
|
|
9
|
-
* Split a bare specifier into its package name and optional subpath, handling
|
|
10
|
-
* scoped packages (`@scope/name/sub` → `@scope/name` + `sub`).
|
|
11
|
-
*/
|
|
12
|
-
export declare function splitBareSpecifier(specifier: string): {
|
|
13
|
-
packageName: string;
|
|
14
|
-
subpath: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Resolve a bare specifier against an installed `node_modules` directory,
|
|
18
|
-
* honoring `exports` (CommonJS conditions), then `main`, then `index.js`.
|
|
19
|
-
* Returns an absolute file path, or `null` when the package/entry is absent.
|
|
20
|
-
*/
|
|
21
|
-
export declare function resolveRuntimeModule(runtimeNodeModules: string, specifier: string): string | null;
|
|
22
|
-
export interface RuntimeResolverOptions {
|
|
23
|
-
/** Absolute path to the runtime cache's `node_modules`. */
|
|
24
|
-
runtimeNodeModules: string;
|
|
25
|
-
/** Bare specifier → absolute file path overrides (e.g. `sharp` → no-op stub). */
|
|
26
|
-
stubs?: Record<string, string>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Patch `node:module`'s resolver (idempotently) so bare specifiers that the
|
|
30
|
-
* stock compiled-binary resolver cannot find fall back to the registered
|
|
31
|
-
* runtime caches. Stock resolution is tried first and kept for anything
|
|
32
|
-
* outside the registered roots (bundled imports, node builtins, host or
|
|
33
|
-
* extension trees). Multiple runtime roots may register; they are consulted
|
|
34
|
-
* in registration order. Returns an uninstaller that drops the registration
|
|
35
|
-
* and restores the stock resolver once no registrations remain.
|
|
36
|
-
*
|
|
37
|
-
* One stock "success" is distrusted: the compiled-binary resolver ignores
|
|
38
|
-
* `main`/`exports` for real-FS packages (Bun #1763), so a package shipping
|
|
39
|
-
* its TS source next to `dist/` (e.g. `@huggingface/hub`'s root `index.ts`)
|
|
40
|
-
* resolves to the wrong file. When the stock hit lands inside a registered
|
|
41
|
-
* runtime root, the manifest-aware resolution wins.
|
|
42
|
-
*
|
|
43
|
-
* KNOWN LIMITATION (Bun 1.3.14): while any JS override of
|
|
44
|
-
* `Module._resolveFilename` is installed, Bun routes `createRequire(...)`
|
|
45
|
-
* resolution through it with `parent === undefined` — the requester context is
|
|
46
|
-
* never passed, so relative requires from a `createRequire` require fail with
|
|
47
|
-
* "Cannot find module './x' from ''". The override cannot recover what it is
|
|
48
|
-
* never given. Keep this patch scoped to dedicated worker/runtime processes
|
|
49
|
-
* (tiny-inference, fastembed); never install it in the main agent process,
|
|
50
|
-
* where legacy-pi extensions rely on `createRequire` relative requires.
|
|
51
|
-
*/
|
|
52
|
-
export declare function installRuntimeModuleResolver({ runtimeNodeModules, stubs }: RuntimeResolverOptions): () => void;
|
|
53
|
-
/** Pinned dependency set materialized into a runtime cache directory. */
|
|
54
|
-
export interface RuntimeInstallSpec {
|
|
55
|
-
dependencies: Record<string, string>;
|
|
56
|
-
/** Version pins forced across the whole runtime tree (bun `overrides`), e.g. dislodging a transitive dep. */
|
|
57
|
-
overrides?: Record<string, string>;
|
|
58
|
-
/** Packages whose lifecycle scripts bun may run during the install. */
|
|
59
|
-
trustedDependencies?: string[];
|
|
60
|
-
}
|
|
61
|
-
export type RuntimeInstallPhase = "initiate" | "download" | "done";
|
|
62
|
-
export interface EnsureRuntimeInstalledOptions {
|
|
63
|
-
/** Directory owning the runtime `package.json` + `node_modules`. */
|
|
64
|
-
runtimeDir: string;
|
|
65
|
-
install: RuntimeInstallSpec;
|
|
66
|
-
/** Package whose installed manifest marks the runtime complete; defaults to the first dependency. */
|
|
67
|
-
probePackage?: string;
|
|
68
|
-
/** Phase notifications (progress UI); not emitted when already installed. */
|
|
69
|
-
onPhase?: (phase: RuntimeInstallPhase) => void;
|
|
70
|
-
lockAttempts?: number;
|
|
71
|
-
lockSleepMs?: number;
|
|
72
|
-
}
|
|
73
|
-
export declare function writeRuntimeManifest(runtimeDir: string, install: RuntimeInstallSpec): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Materialize a pinned dependency set into `runtimeDir` (idempotent,
|
|
76
|
-
* cross-process safe). Returns `runtimeDir`.
|
|
77
|
-
*
|
|
78
|
-
* Serialization uses the OS-backed {@link withFileLock} at
|
|
79
|
-
* `${runtimeDir}.install.lock`, which the kernel releases on process death, so
|
|
80
|
-
* a crashed installer cannot wedge later attempts (issue #10120). The path is
|
|
81
|
-
* deliberately distinct from the legacy `${runtimeDir}.lock` mkdir directory;
|
|
82
|
-
* {@link withLegacyInstallLock} atomically reserves that namespace during the
|
|
83
|
-
* new install so older processes cannot cross the migration boundary.
|
|
84
|
-
*/
|
|
85
|
-
export declare function ensureRuntimeInstalled(options: EnsureRuntimeInstalledOptions): Promise<string>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strip ANSI escape sequences, remove control characters / lone surrogates,
|
|
3
|
-
* and normalize line endings.
|
|
4
|
-
*
|
|
5
|
-
* Bun-native implementation of the former native `sanitizeText` (see
|
|
6
|
-
* `crates/pi-natives/src/text.rs::sanitize_text`). JavaScript strings are
|
|
7
|
-
* already UTF-16 code-unit arrays. `toWellFormed()` handles the uncommon
|
|
8
|
-
* malformed path; when it changes the input, replacement characters are
|
|
9
|
-
* dropped and the normalized result goes through the well-formed sanitizer.
|
|
10
|
-
*
|
|
11
|
-
* Fast path: well-formed input with no controls or ANSI returns the original
|
|
12
|
-
* string after the control probe.
|
|
13
|
-
*/
|
|
14
|
-
export declare function sanitizeText(text: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Escape the three XML-significant characters (`&`, `<`, `>`) in text destined
|
|
17
|
-
* for an XML/markup element body. Allocation-conscious: returns the input
|
|
18
|
-
* unchanged (same reference) when nothing needs escaping. Quotes are left as-is
|
|
19
|
-
* — use it for element text, not attribute values.
|
|
20
|
-
*/
|
|
21
|
-
export declare function escapeXmlText(input: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Escape XML-significant characters for an attribute VALUE: the three body
|
|
24
|
-
* characters (`&`, `<`, `>`) plus the double quote (`"` → `"`) that would
|
|
25
|
-
* otherwise close the attribute. Allocation-conscious: returns the input
|
|
26
|
-
* unchanged (same reference) when nothing needs escaping. Use it for attribute
|
|
27
|
-
* values; {@link escapeXmlText} is for element bodies and leaves `"` intact.
|
|
28
|
-
*/
|
|
29
|
-
export declare function escapeXmlAttribute(input: string): string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type Snowflake = string & {
|
|
2
|
-
readonly __brand: unique symbol;
|
|
3
|
-
};
|
|
4
|
-
declare namespace Snowflake {
|
|
5
|
-
const PATTERN: RegExp;
|
|
6
|
-
const EPOCH_TIMESTAMP = 1420070400000;
|
|
7
|
-
const MAX_SEQUENCE = 4194303;
|
|
8
|
-
function formatParts(dt: number, seq: number): Snowflake;
|
|
9
|
-
class Source {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(sequence?: number);
|
|
12
|
-
get sequence(): number;
|
|
13
|
-
set sequence(v: number);
|
|
14
|
-
reset(): void;
|
|
15
|
-
generate(timestamp: number): Snowflake;
|
|
16
|
-
}
|
|
17
|
-
function next(timestamp?: number): Snowflake;
|
|
18
|
-
function valid(value: string): value is Snowflake;
|
|
19
|
-
function lowerbound(timelike: Date | number | Snowflake): Snowflake;
|
|
20
|
-
function upperbound(timelike: Date | number | Snowflake): Snowflake;
|
|
21
|
-
function getSequence(value: Snowflake): number;
|
|
22
|
-
function getTimestamp(value: Snowflake): number;
|
|
23
|
-
function getDate(value: Snowflake): Date;
|
|
24
|
-
}
|
|
25
|
-
export { Snowflake };
|
package/dist/types/sqlite.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared classifiers for `bun:sqlite` error result codes.
|
|
3
|
-
*
|
|
4
|
-
* Every omp SQLite store (`agent.db` credential/usage store, `models.db` model
|
|
5
|
-
* cache, `history.db`) needs the same two distinctions: a transient BUSY that
|
|
6
|
-
* clears by retrying, and an unrecoverable corruption that never does. Keeping
|
|
7
|
-
* one implementation here prevents the classifiers from drifting between the
|
|
8
|
-
* credential store and the model cache.
|
|
9
|
-
*/
|
|
10
|
-
import type { Database } from "bun:sqlite";
|
|
11
|
-
/** Checkpoints committed WAL frames without waiting for concurrent readers. */
|
|
12
|
-
export declare function checkpointWal(db: Database): void;
|
|
13
|
-
/**
|
|
14
|
-
* SQLite's busy result-code family — base `SQLITE_BUSY` plus the extended
|
|
15
|
-
* variants `SQLITE_BUSY_RECOVERY` (concurrent WAL recovery), `SQLITE_BUSY_SNAPSHOT`,
|
|
16
|
-
* and `SQLITE_BUSY_TIMEOUT`. All warrant the same backoff-and-retry treatment.
|
|
17
|
-
*/
|
|
18
|
-
export declare function isSqliteBusyError(err: unknown): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* SQLite's unrecoverable-corruption result codes — the `SQLITE_CORRUPT` family
|
|
21
|
-
* (base plus extended variants like `SQLITE_CORRUPT_VTAB` / `SQLITE_CORRUPT_INDEX`)
|
|
22
|
-
* and `SQLITE_NOTADB` (the file header is not a database). Unlike
|
|
23
|
-
* {@link isSqliteBusyError}, these never clear by retrying: the store must be
|
|
24
|
-
* repaired or replaced, so callers latch, quarantine, or recreate the file.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isSqliteCorruptionError(err: unknown): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface SuppressTerminalStderrOptions {
|
|
2
|
-
/** Redirect target path; defaults to today's omp log file, then /dev/null. */
|
|
3
|
-
redirectPath?: string;
|
|
4
|
-
/** Bypass the macOS + same-terminal gate. Tests only. */
|
|
5
|
-
force?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Redirect fd 2 away from the terminal while the TUI owns the viewport.
|
|
9
|
-
* Returns true when suppression is (already) active. No-op — returning
|
|
10
|
-
* false — off macOS, when stderr does not target the stdout terminal, or
|
|
11
|
-
* when the libc fd ops are unavailable.
|
|
12
|
-
*/
|
|
13
|
-
export declare function suppressTerminalStderr(options?: SuppressTerminalStderrOptions): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Re-point fd 2 at the saved terminal stderr. Safe to call unconditionally:
|
|
16
|
-
* no-op when suppression is not active. Called at every terminal-ownership
|
|
17
|
-
* release and by the postmortem fatal handlers before they print, so crash
|
|
18
|
-
* reports reach the real terminal.
|
|
19
|
-
*/
|
|
20
|
-
export declare function restoreTerminalStderr(): void;
|
|
21
|
-
/** Whether fd 2 is currently redirected away from the terminal. */
|
|
22
|
-
export declare function isTerminalStderrSuppressed(): boolean;
|
package/dist/types/stream.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export declare function readLines(stream: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<Uint8Array>;
|
|
2
|
-
export declare function readJsonl<T>(stream: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<T>;
|
|
3
|
-
/**
|
|
4
|
-
* Stream parsed JSON objects from SSE `data:` lines.
|
|
5
|
-
*
|
|
6
|
-
* Thin wrapper over {@link readSseEvents}: yields one parsed JSON value per
|
|
7
|
-
* dispatched SSE event, skipping events with empty `data` and stopping at the
|
|
8
|
-
* OpenAI-style `[DONE]` sentinel. If your consumer doesn't care about `event:`
|
|
9
|
-
* names or doesn't need a custom parse step, use this; otherwise call
|
|
10
|
-
* `readSseEvents` directly.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* for await (const obj of readSseJson(response.body!)) {
|
|
15
|
-
* console.log(obj);
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export type SseEventObserver = (event: ServerSentEvent) => void;
|
|
20
|
-
export declare function readSseJson<T>(stream: ReadableStream<Uint8Array>, signal?: AbortSignal, onEvent?: SseEventObserver): AsyncGenerator<T>;
|
|
21
|
-
/**
|
|
22
|
-
* A single Server-Sent Event dispatched on a blank-line boundary.
|
|
23
|
-
*
|
|
24
|
-
* - `event` is the value of the most recent `event:` field, or `null` if none.
|
|
25
|
-
* - `data` is the concatenation (joined by `\n`) of every `data:` field in the
|
|
26
|
-
* event, exactly as required by the SSE spec.
|
|
27
|
-
* - `raw` is the list of decoded non-empty lines that made up the event,
|
|
28
|
-
* preserved for diagnostic context (error reporting, debugging). The
|
|
29
|
-
* dispatching blank line is not included.
|
|
30
|
-
* - `id` and `retry` are present only when the event carried valid fields with
|
|
31
|
-
* those names. Control-only events are yielded so reconnecting transports can
|
|
32
|
-
* retain the cursor and server-requested retry interval.
|
|
33
|
-
*/
|
|
34
|
-
export interface ServerSentEvent {
|
|
35
|
-
event: string | null;
|
|
36
|
-
data: string;
|
|
37
|
-
raw: string[];
|
|
38
|
-
id?: string;
|
|
39
|
-
retry?: number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Stream raw Server-Sent Events from an HTTP response body.
|
|
43
|
-
*
|
|
44
|
-
* Yields one `ServerSentEvent` per blank-line dispatch. The consumer is
|
|
45
|
-
* responsible for parsing `data` (e.g. JSON, plain text, error envelope).
|
|
46
|
-
* Use `readSseJson` instead when every event is a single `data:` JSON object
|
|
47
|
-
* and you don't need access to the `event:` field.
|
|
48
|
-
*
|
|
49
|
-
* Internally backed by a Buffer-based reader (`ConcatSink`) that batches all
|
|
50
|
-
* complete lines in each source chunk into one UTF-8 decode.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* for await (const sse of readSseEvents(response.body!)) {
|
|
55
|
-
* if (sse.event === "ping") continue;
|
|
56
|
-
* const obj = JSON.parse(sse.data);
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare function readSseEvents(stream: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<ServerSentEvent>;
|
|
61
|
-
/**
|
|
62
|
-
* Parse a complete JSONL string, skipping malformed lines instead of throwing.
|
|
63
|
-
*
|
|
64
|
-
* Uses `Bun.JSONL.parseChunk` internally. On parse errors, the malformed
|
|
65
|
-
* region is skipped up to the next newline and parsing continues.
|
|
66
|
-
*
|
|
67
|
-
* @param options.onMalformedRecord Called once for every skipped JSONL record.
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* const entries = parseJsonlLenient<MyType>(fileContents);
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare function parseJsonlLenient<T>(buffer: string, options?: {
|
|
74
|
-
onMalformedRecord?: () => void;
|
|
75
|
-
}): T[];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare const MIN_TAB_WIDTH = 1;
|
|
2
|
-
export declare const MAX_TAB_WIDTH = 16;
|
|
3
|
-
export declare const DEFAULT_TAB_WIDTH = 3;
|
|
4
|
-
/**
|
|
5
|
-
* `.editorconfig`-derived formatting options for an LSP `textDocument/formatting` request.
|
|
6
|
-
*
|
|
7
|
-
* Both fields are absent when the resolved `.editorconfig` chain does not pin them, so callers
|
|
8
|
-
* can layer their own fallbacks (content sniffing, project defaults) underneath. Returned values
|
|
9
|
-
* are clamped to {@link MIN_TAB_WIDTH}..{@link MAX_TAB_WIDTH}.
|
|
10
|
-
*/
|
|
11
|
-
export interface EditorConfigFormatting {
|
|
12
|
-
/** Effective indent width in columns, from `indent_size` or `tab_width`. */
|
|
13
|
-
tabSize?: number;
|
|
14
|
-
/** `true` for `indent_style = space`, `false` for `indent_style = tab` (or `indent_size = tab`). */
|
|
15
|
-
insertSpaces?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Resolve `.editorconfig` formatting hints for `file` without falling back to any default.
|
|
19
|
-
*
|
|
20
|
-
* Used by the LSP format-on-write path so a missing `.editorconfig` declaration falls through
|
|
21
|
-
* to caller-provided defaults instead of clobbering the file with the renderer's
|
|
22
|
-
* display tab width (issue #2329).
|
|
23
|
-
*/
|
|
24
|
-
export declare function getEditorConfigFormatting(file?: string | null, projectDir?: string | null): EditorConfigFormatting;
|
package/dist/types/temp.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare class TempDir {
|
|
2
|
-
#private;
|
|
3
|
-
private constructor();
|
|
4
|
-
static createSync(prefix?: string): TempDir;
|
|
5
|
-
static create(prefix?: string): Promise<TempDir>;
|
|
6
|
-
path(): string;
|
|
7
|
-
absolute(): string;
|
|
8
|
-
remove(): Promise<void>;
|
|
9
|
-
removeSync(): void;
|
|
10
|
-
toString(): string;
|
|
11
|
-
join(...paths: string[]): string;
|
|
12
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
13
|
-
[Symbol.dispose](): void;
|
|
14
|
-
}
|
|
15
|
-
/** Removes a path recursively, retrying transient Windows deletion failures. */
|
|
16
|
-
export declare function removeWithRetries(target: string): Promise<void>;
|
|
17
|
-
export declare function removeSyncWithRetries(target: string): void;
|
|
18
|
-
/**
|
|
19
|
-
* Create a directory symlink in a platform-correct way. Windows denies
|
|
20
|
-
* unprivileged file/dir symlinks (EPERM on `fs.symlink` without a type), but
|
|
21
|
-
* allows directory *junctions*, which every test that links temp directories
|
|
22
|
-
* should use instead. POSIX ignores the type argument.
|
|
23
|
-
*/
|
|
24
|
-
export declare function symlinkDirectorySync(target: string, linkPath: string): void;
|
package/dist/types/template.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/** Behavior-compatible reimplementation of handlebars' used surface. */
|
|
2
|
-
/** Values accepted as registered partial templates. */
|
|
3
|
-
export type Template = string | TemplateDelegate;
|
|
4
|
-
/** A compiled template function. */
|
|
5
|
-
export type TemplateDelegate<T = unknown> = (context?: T, options?: RuntimeOptions) => string;
|
|
6
|
-
/** Runtime options accepted by compiled templates. */
|
|
7
|
-
export interface RuntimeOptions {
|
|
8
|
-
data?: Record<string, unknown>;
|
|
9
|
-
helpers?: Record<string, HelperDelegate>;
|
|
10
|
-
partials?: Record<string, Template>;
|
|
11
|
-
}
|
|
12
|
-
/** Options passed as the final argument to helpers. */
|
|
13
|
-
export interface HelperOptions {
|
|
14
|
-
name: string;
|
|
15
|
-
hash: Record<string, unknown>;
|
|
16
|
-
data: Record<string, unknown>;
|
|
17
|
-
fn: (context?: unknown, options?: {
|
|
18
|
-
data?: Record<string, unknown>;
|
|
19
|
-
}) => string;
|
|
20
|
-
inverse: (context?: unknown, options?: {
|
|
21
|
-
data?: Record<string, unknown>;
|
|
22
|
-
}) => string;
|
|
23
|
-
lookupProperty: (parent: unknown, propertyName: string) => unknown;
|
|
24
|
-
}
|
|
25
|
-
/** A template helper function. */
|
|
26
|
-
export type HelperDelegate = {
|
|
27
|
-
bivarianceHack(this: unknown, ...args: unknown[]): unknown;
|
|
28
|
-
}["bivarianceHack"];
|
|
29
|
-
/** Template compilation behavior. */
|
|
30
|
-
export interface CompileOptions {
|
|
31
|
-
noEscape?: boolean;
|
|
32
|
-
strict?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/** A string that bypasses HTML escaping when interpolated. */
|
|
35
|
-
export declare class SafeString {
|
|
36
|
-
#private;
|
|
37
|
-
constructor(value: unknown);
|
|
38
|
-
/** Return the unescaped string value. */
|
|
39
|
-
toString(): string;
|
|
40
|
-
/** Return the unescaped primitive value. */
|
|
41
|
-
toHTML(): string;
|
|
42
|
-
}
|
|
43
|
-
/** Escape a value with Handlebars' HTML entity set. */
|
|
44
|
-
export declare function escapeExpression(value: unknown): string;
|
|
45
|
-
/** Register a helper for subsequently compiled templates. */
|
|
46
|
-
export declare function registerHelper(name: string, helper: HelperDelegate): void;
|
|
47
|
-
/** Register a partial for subsequently rendered templates. */
|
|
48
|
-
export declare function registerPartial(name: string, partial: Template): void;
|
|
49
|
-
/** Compile a template into a reusable rendering function. */
|
|
50
|
-
export declare function compile<T = unknown>(source: string, options?: CompileOptions): TemplateDelegate<T>;
|
|
51
|
-
/** Create an isolated template engine with its own helper and partial registries. */
|
|
52
|
-
export declare function create(): TemplateEngine;
|
|
53
|
-
/** Isolated template compiler and registry. */
|
|
54
|
-
export declare class TemplateEngine {
|
|
55
|
-
#private;
|
|
56
|
-
/** Register a helper in this engine. */
|
|
57
|
-
registerHelper(name: string, helper: HelperDelegate): void;
|
|
58
|
-
/** Register a partial in this engine. */
|
|
59
|
-
registerPartial(name: string, partial: Template): void;
|
|
60
|
-
/** Compile a template using this engine's registries. */
|
|
61
|
-
compile<T = unknown>(source: string, options?: CompileOptions): TemplateDelegate<T>;
|
|
62
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared contract between the {@link module-timer} preload and {@link logger}'s
|
|
3
|
-
* timing tree. Kept in its own dependency-free module so the preload can import
|
|
4
|
-
* it without pulling in winston (via logger) and the logger can drain the buffer
|
|
5
|
-
* without importing the Bun-plugin preload.
|
|
6
|
-
*/
|
|
7
|
-
export interface ModuleLoadEvent {
|
|
8
|
-
/** Absolute or Bun-resolved module path. */
|
|
9
|
-
path: string;
|
|
10
|
-
/** `performance.now()` timestamp captured at Bun `onLoad` entry. */
|
|
11
|
-
start: number;
|
|
12
|
-
/** Inclusive module window: `onLoad` entry → appended final marker. */
|
|
13
|
-
durationMs: number;
|
|
14
|
-
/** Own top-level body / TLA time: prepended body marker → appended final marker. */
|
|
15
|
-
bodyMs?: number;
|
|
16
|
-
/** Resolved static children imported by this module. */
|
|
17
|
-
imports: string[];
|
|
18
|
-
}
|
|
19
|
-
/** The append-only buffer the preload pushes into (created on first access). */
|
|
20
|
-
export declare function moduleLoadBuffer(): ModuleLoadEvent[];
|
|
21
|
-
/** Drain and return all buffered events, leaving the buffer empty. */
|
|
22
|
-
export declare function drainModuleLoadEvents(): ModuleLoadEvent[];
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `fetch`-compatible function. Accepts any callable matching the standard
|
|
3
|
-
* fetch signature; `preconnect` is optional because non-Bun runtimes
|
|
4
|
-
* (browsers, test mocks) won't expose it.
|
|
5
|
-
*/
|
|
6
|
-
export type FetchImpl = ((input: string | URL | Request, init?: RequestInit) => Promise<Response>) & {
|
|
7
|
-
preconnect?: typeof globalThis.fetch.preconnect;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* `NODE_EXTRA_CA_CERTS` was set but unusable (path does not exist). This is
|
|
11
|
-
* a config/contract error, not a transient transport fault — it is never
|
|
12
|
-
* retried.
|
|
13
|
-
*/
|
|
14
|
-
export declare class ExtraCaError extends Error {
|
|
15
|
-
constructor(message: string, options?: {
|
|
16
|
-
cause?: unknown;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/** Test seam: drop the cached PEM so a follow-up call re-reads the env. */
|
|
20
|
-
export declare function __resetExtraCaCache(): void;
|
|
21
|
-
/**
|
|
22
|
-
* Wrap `fetchImpl` so every call honours `NODE_EXTRA_CA_CERTS`. Idempotent:
|
|
23
|
-
* a fetch already wrapped is returned unchanged so repeated composition
|
|
24
|
-
* (Anthropic auth-retry replays, request-debug fan-out) never stacks
|
|
25
|
-
* wrappers. When the env var is unset the original fetch is returned, so
|
|
26
|
-
* default deployments pay nothing.
|
|
27
|
-
*/
|
|
28
|
-
export declare function wrapFetchForExtraCa(fetchImpl: FetchImpl): FetchImpl;
|
|
29
|
-
/**
|
|
30
|
-
* Convenience for options-bag composition (e.g. the stream-entry path in
|
|
31
|
-
* `@linxiraos/pi-ai`'s `stream.ts`, which mirrors `withRequestDebugFetch` so
|
|
32
|
-
* the proxy/debug/extra-CA wrappers compose uniformly). No-op when the env
|
|
33
|
-
* var is unset.
|
|
34
|
-
*/
|
|
35
|
-
export declare function withExtraCaFetch<T extends {
|
|
36
|
-
fetch?: FetchImpl;
|
|
37
|
-
} | undefined>(options: T): T;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TurndownPlugin } from "./types.js";
|
|
2
|
-
/** Install GitHub fenced code blocks selected by `highlight-source-*` wrappers. */
|
|
3
|
-
export declare const highlightedCodeBlock: TurndownPlugin;
|
|
4
|
-
/** Install GFM strikethrough conversion. */
|
|
5
|
-
export declare const strikethrough: TurndownPlugin;
|
|
6
|
-
/** Install GFM task-list checkbox conversion. */
|
|
7
|
-
export declare const taskListItems: TurndownPlugin;
|
|
8
|
-
/** Install GFM table conversion for tables with a heading row. */
|
|
9
|
-
export declare const tables: TurndownPlugin;
|
|
10
|
-
/** Install every GFM rule used by the coding agent. */
|
|
11
|
-
export declare const gfm: TurndownPlugin;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { TurndownNode } from "./types.js";
|
|
2
|
-
/** Parse an HTML fragment into the small DOM subset needed by Turndown. */
|
|
3
|
-
export declare function parseHtmlFragment(html: string): TurndownNode;
|
|
4
|
-
/** Serialize a standards-shaped or internal HTML node. */
|
|
5
|
-
export declare function serializeNode(node: TurndownNode): string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ResolvedTurndownOptions, RuleFilter, TurndownNode, TurndownOptions, TurndownPlugin, TurndownRule } from "./types.js";
|
|
2
|
-
/** Convert HTML fragments to Markdown with extensible Turndown-compatible rules. */
|
|
3
|
-
export default class TurndownService {
|
|
4
|
-
#private;
|
|
5
|
-
readonly options: ResolvedTurndownOptions;
|
|
6
|
-
constructor(options?: TurndownOptions);
|
|
7
|
-
/** Install a highest-priority named conversion rule. */
|
|
8
|
-
addRule(key: string, rule: TurndownRule): this;
|
|
9
|
-
/** Preserve matching elements as HTML when no custom rule handles them. */
|
|
10
|
-
keep(filter: RuleFilter): this;
|
|
11
|
-
/** Drop matching elements and all of their converted content. */
|
|
12
|
-
remove(filter: RuleFilter): this;
|
|
13
|
-
/** Install one plugin or an ordered list of plugins. */
|
|
14
|
-
use(plugin: TurndownPlugin | readonly TurndownPlugin[]): this;
|
|
15
|
-
/** Escape Markdown punctuation using Turndown's public escaping rules. */
|
|
16
|
-
escape(text: string): string;
|
|
17
|
-
/** Convert an HTML string or standards-shaped DOM node to Markdown. */
|
|
18
|
-
turndown(input: string | TurndownNode): string;
|
|
19
|
-
/** Convert only a node's children within the active conversion. */
|
|
20
|
-
convertChildren(node: TurndownNode): string;
|
|
21
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/** Behavior-compatible reimplementation of turndown's used surface. */
|
|
2
|
-
/** A DOM-shaped node accepted by conversion rules. */
|
|
3
|
-
export interface TurndownNode {
|
|
4
|
-
readonly nodeType: number;
|
|
5
|
-
readonly nodeName: string;
|
|
6
|
-
readonly parentNode: TurndownNode | null;
|
|
7
|
-
readonly childNodes: ArrayLike<TurndownNode>;
|
|
8
|
-
readonly children: ArrayLike<TurndownNode>;
|
|
9
|
-
readonly firstChild: TurndownNode | null;
|
|
10
|
-
readonly lastChild: TurndownNode | null;
|
|
11
|
-
readonly nextSibling: TurndownNode | null;
|
|
12
|
-
readonly previousSibling: TurndownNode | null;
|
|
13
|
-
readonly textContent: string | null;
|
|
14
|
-
readonly outerHTML?: string;
|
|
15
|
-
getAttribute(name: string): string | null;
|
|
16
|
-
hasAttribute(name: string): boolean;
|
|
17
|
-
}
|
|
18
|
-
/** Options supported by the HTML-to-Markdown converter. */
|
|
19
|
-
export interface TurndownOptions {
|
|
20
|
-
headingStyle?: "setext" | "atx";
|
|
21
|
-
hr?: string;
|
|
22
|
-
bulletListMarker?: "*" | "-" | "+";
|
|
23
|
-
codeBlockStyle?: "indented" | "fenced";
|
|
24
|
-
fence?: string;
|
|
25
|
-
emDelimiter?: "_" | "*";
|
|
26
|
-
strongDelimiter?: "**" | "__";
|
|
27
|
-
linkStyle?: "inlined" | "referenced";
|
|
28
|
-
linkReferenceStyle?: "full" | "collapsed" | "shortcut";
|
|
29
|
-
preformattedCode?: boolean;
|
|
30
|
-
blankReplacement?: ReplacementFunction;
|
|
31
|
-
keepReplacement?: ReplacementFunction;
|
|
32
|
-
defaultReplacement?: ReplacementFunction;
|
|
33
|
-
}
|
|
34
|
-
/** Fully resolved options passed to replacement callbacks. */
|
|
35
|
-
export interface ResolvedTurndownOptions {
|
|
36
|
-
headingStyle: "setext" | "atx";
|
|
37
|
-
hr: string;
|
|
38
|
-
bulletListMarker: "*" | "-" | "+";
|
|
39
|
-
codeBlockStyle: "indented" | "fenced";
|
|
40
|
-
fence: string;
|
|
41
|
-
emDelimiter: "_" | "*";
|
|
42
|
-
strongDelimiter: "**" | "__";
|
|
43
|
-
linkStyle: "inlined" | "referenced";
|
|
44
|
-
linkReferenceStyle: "full" | "collapsed" | "shortcut";
|
|
45
|
-
preformattedCode: boolean;
|
|
46
|
-
blankReplacement?: ReplacementFunction;
|
|
47
|
-
keepReplacement?: ReplacementFunction;
|
|
48
|
-
defaultReplacement?: ReplacementFunction;
|
|
49
|
-
}
|
|
50
|
-
/** A tag name, list of tag names, or predicate selecting nodes for a rule. */
|
|
51
|
-
export type RuleFilter = string | readonly string[] | ((node: TurndownNode, options: ResolvedTurndownOptions) => boolean);
|
|
52
|
-
/** Produces Markdown for a matched node and its already-converted children. */
|
|
53
|
-
export type ReplacementFunction = (content: string, node: TurndownNode, options: ResolvedTurndownOptions) => string;
|
|
54
|
-
/** A named conversion rule accepted by `addRule`. */
|
|
55
|
-
export interface TurndownRule {
|
|
56
|
-
filter: RuleFilter;
|
|
57
|
-
replacement: ReplacementFunction;
|
|
58
|
-
}
|
|
59
|
-
/** A plugin that installs one or more conversion rules. */
|
|
60
|
-
export type TurndownPlugin = (service: TurndownServiceLike) => void;
|
|
61
|
-
/** Structural service surface available to plugins. */
|
|
62
|
-
export interface TurndownServiceLike {
|
|
63
|
-
readonly options: ResolvedTurndownOptions;
|
|
64
|
-
addRule(key: string, rule: TurndownRule): this;
|
|
65
|
-
convertChildren(node: TurndownNode): string;
|
|
66
|
-
keep(filter: RuleFilter): this;
|
|
67
|
-
remove(filter: RuleFilter): this;
|
|
68
|
-
turndown(input: string | TurndownNode): string;
|
|
69
|
-
escape(text: string): string;
|
|
70
|
-
}
|
package/dist/types/turndown.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
2
|
-
/** Reads an own string-valued property without invoking accessors. */
|
|
3
|
-
export declare function stringProperty(value: object, key: string): string | undefined;
|
|
4
|
-
export declare function asRecord(value: unknown): Record<string, unknown> | null;
|
|
5
|
-
export declare function toError(value: unknown): Error;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { CharRole, AsciiTheme, ColorMode } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Default ASCII theme derived from the SVG renderer's color palette.
|
|
4
|
-
* Uses the same mixing ratios to maintain visual consistency.
|
|
5
|
-
*/
|
|
6
|
-
export declare const DEFAULT_ASCII_THEME: AsciiTheme;
|
|
7
|
-
/**
|
|
8
|
-
* Detect the best color mode for the current environment.
|
|
9
|
-
*
|
|
10
|
-
* Terminal detection order:
|
|
11
|
-
* 1. COLORTERM=truecolor or COLORTERM=24bit → truecolor
|
|
12
|
-
* 2. TERM contains "256color" → ansi256
|
|
13
|
-
* 3. TERM is set and not "dumb" → ansi16
|
|
14
|
-
*
|
|
15
|
-
* Browser: returns 'html' (uses <span> tags with inline styles).
|
|
16
|
-
* Unknown/piped: returns 'none'.
|
|
17
|
-
*/
|
|
18
|
-
export declare function detectColorMode(): ColorMode;
|
|
19
|
-
/**
|
|
20
|
-
* Generate the ANSI escape sequence for a role color.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAnsiColor(role: CharRole, theme: AsciiTheme, mode: ColorMode): string;
|
|
23
|
-
/**
|
|
24
|
-
* Get the ANSI reset sequence.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getAnsiReset(mode: ColorMode): string;
|
|
27
|
-
/**
|
|
28
|
-
* Wrap a character with ANSI color codes based on its role.
|
|
29
|
-
*/
|
|
30
|
-
export declare function colorizeChar(char: string, role: CharRole | null, theme: AsciiTheme, mode: ColorMode): string;
|
|
31
|
-
/**
|
|
32
|
-
* Colorize an entire line efficiently by grouping consecutive same-role characters.
|
|
33
|
-
* This reduces the number of escape sequences (ANSI) or span tags (HTML) in the output.
|
|
34
|
-
*/
|
|
35
|
-
export declare function colorizeLine(chars: string[], roles: (CharRole | null)[], theme: AsciiTheme, mode: ColorMode): string;
|
|
36
|
-
/**
|
|
37
|
-
* Colorize a text string with a direct hex color.
|
|
38
|
-
* Used by renderers that need per-cell color control (e.g. multi-series xychart).
|
|
39
|
-
* Handles all output modes: ANSI (16/256/truecolor) and HTML.
|
|
40
|
-
*/
|
|
41
|
-
export declare function colorizeText(text: string, hex: string, mode: ColorMode): string;
|