@linxiraos/pi-utils 1.1.14 → 1.1.16
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 -52
- package/THIRD-PARTY-NOTICES.txt +54 -25
- package/dist/types/async.d.ts +18 -0
- package/dist/types/browsers.d.ts +2 -30
- package/dist/types/color.d.ts +2 -0
- package/dist/types/dirs.d.ts +21 -0
- package/dist/types/env.d.ts +12 -2
- package/dist/types/executable.d.ts +4 -0
- package/dist/types/fetch-retry.d.ts +8 -2
- package/dist/types/file-lock.d.ts +12 -0
- package/dist/types/format.d.ts +7 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/mime.d.ts +1 -0
- package/dist/types/path.d.ts +6 -0
- package/dist/types/peek-file.d.ts +2 -3
- package/dist/types/postmortem.d.ts +26 -5
- package/dist/types/procmgr.d.ts +2 -4
- package/dist/types/snowflake.d.ts +1 -0
- package/dist/types/sqlite.d.ts +27 -7
- package/dist/types/stream.d.ts +76 -1
- package/dist/types/which.d.ts +8 -2
- package/dist/types/yaml-config.d.ts +2 -0
- package/package.json +2 -2
- package/src/acp/transport.ts +37 -3
- package/src/async.ts +31 -0
- package/src/browsers.ts +46 -191
- package/src/color.ts +1 -1
- package/src/dirs.ts +34 -6
- package/src/env.ts +81 -34
- package/src/executable.ts +17 -0
- package/src/fetch-retry.ts +72 -13
- package/src/file-lock.ts +36 -2
- package/src/format.ts +16 -0
- package/src/index.ts +2 -1
- package/src/json.ts +12 -1
- package/src/logger/rotating-file.ts +40 -3
- package/src/logger.ts +16 -4
- package/src/mime.ts +3 -7
- package/src/path.ts +14 -0
- package/src/peek-file.ts +17 -67
- package/src/postmortem.ts +95 -47
- package/src/procmgr.ts +2 -12
- package/src/ptree.ts +36 -5
- package/src/snowflake.ts +12 -1
- package/src/sqlite.ts +242 -7
- package/src/stream.ts +167 -35
- package/src/which.ts +38 -14
- package/src/xml.ts +16 -0
- package/src/yaml-config.ts +8 -0
- package/dist/types/glob.d.ts +0 -28
- package/src/glob.ts +0 -189
package/CHANGELOG.md
CHANGED
|
@@ -2,57 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
-
## [1.1.
|
|
5
|
+
## [1.1.16] - 2026-09-19
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 上游 v18.2.5 同步:JSON 与缓存逻辑流线化重构、which 缓存改字符串键重写。
|
|
8
8
|
|
|
9
|
-
## [1.1.13] - 2026-09-10
|
|
10
|
-
|
|
11
|
-
- 上游 v18.1.16 同步:retry 提示解析升级为 longest-wins 合并(账号重置 + 追加 retry-after 同时出现时取更长窗口);`retry-after-ms` 支持 `:`/` =` 分隔形式;provider 明确要求立即重试(=0 或已过期时间戳)时返回 0 而非 undefined,避免误用启发式退避。
|
|
12
|
-
|
|
13
|
-
## [1.1.12] - 2026-09-10
|
|
14
|
-
|
|
15
|
-
- worker 宿主选择器族统一为 `__zeta_worker_*` 前缀(与主 CLI 对齐)。
|
|
16
|
-
|
|
17
|
-
## [1.1.10] - 2026-09-07
|
|
18
|
-
|
|
19
|
-
### Fixed
|
|
20
|
-
|
|
21
|
-
- Fixed `extractRetryHint` dropping the longer timing signal when an error body carries both an account reset and an appended retry hint: competing signals now merge by longest window instead of first match, so retries honor the provider's full backoff.
|
|
22
|
-
|
|
23
|
-
## [1.1.9] - 2026-09-05
|
|
24
|
-
|
|
25
|
-
- USER_AGENT constant restored to zeta/<version> (the v18.1.10 merge re-introduced the upstream omp/ UA on every provider request); brand wording in path-resolver docs corrected; profile validation error message Zeta'd.
|
|
26
|
-
|
|
27
|
-
## [1.1.6] - 2026-08-30
|
|
28
|
-
|
|
29
|
-
- 同步上游 OMP v18.0.10(`33cc6b9a043a`)。
|
|
30
|
-
- 同步上游 OMP v18.0.9(`cc14e04f075d`)。
|
|
31
|
-
|
|
32
|
-
## [1.1.5] - 2026-08-26
|
|
33
|
-
|
|
34
|
-
- 同步上游 OMP v18.0.5 / v18.0.6:新增 browsers / json 工具,SHA-2/SHA-3 在 ARM64 上加速。
|
|
35
|
-
|
|
36
|
-
## [1.1.2] - 2026-08-25
|
|
37
|
-
|
|
38
|
-
### Fixed
|
|
39
|
-
|
|
40
|
-
- Republished as 1.1.2 to reset the `latest` tag after the broken 1.1.0 (no functional change over 1.1.1).
|
|
41
|
-
|
|
42
|
-
## [1.1.1] - 2026-08-25
|
|
43
|
-
|
|
44
|
-
### Fixed
|
|
45
|
-
|
|
46
|
-
- Published tarballs now carry real dependency versions instead of Bun's `catalog:` protocol (1.1.0 installs failed with "Unsupported URL Type catalog:").
|
|
47
|
-
|
|
48
|
-
## [1.1.0] - 2026-08-25
|
|
49
|
-
|
|
50
|
-
### Changed
|
|
51
|
-
|
|
52
|
-
- 同步上游 OMP v18.0.3 / v18.0.4(内部运行时与构建改进,无独立用户可见变更)。
|
|
53
|
-
|
|
54
|
-
## [1.0.0] - 2026-08-13
|
|
55
|
-
|
|
56
|
-
### Changed
|
|
57
|
-
|
|
58
|
-
- Reset the version to 1.0.0 and republished under the `@linxiraos/*` scope, breaking from the `@linxiraos` version lineage.
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -10843,7 +10843,7 @@ RUST RUNTIME DEPENDENCY LICENSES
|
|
|
10843
10843
|
|
|
10844
10844
|
Generated from Cargo.lock by cargo-about 0.8.2 in locked, offline, workspace, all-feature, all-target mode, then restricted using cargo metadata to normal and build edges reachable from the workspace (development-only edges are excluded). cargo-deny independently evaluates the complete all-target graph.
|
|
10845
10845
|
|
|
10846
|
-
Native Opus (
|
|
10846
|
+
Native Opus (opus/opusic-sys) and PCRE2 (pcre2/pcre2-sys) are covered by the exact crate license payloads below. inferno 0.12.8 is package-scoped as CDDL-1.0: its CDDL-covered source remains available in the locked crates.io source archive at https://crates.io/crates/inferno/0.12.8 and https://github.com/jonhoo/inferno. The full locked license text follows below.
|
|
10847
10847
|
|
|
10848
10848
|
-------------------------------------------------------------------------------
|
|
10849
10849
|
License: Apache License 2.0 (Apache-2.0)
|
|
@@ -12509,6 +12509,58 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
12509
12509
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
12510
12510
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
12511
12511
|
|
|
12512
|
+
-------------------------------------------------------------------------------
|
|
12513
|
+
License: BSD 3-Clause "New" or "Revised" License (BSD-3-Clause)
|
|
12514
|
+
Used by:
|
|
12515
|
+
- opusic-sys 0.7.5 (https://github.com/DoumanAsh/opusic-sys)
|
|
12516
|
+
|
|
12517
|
+
Full license text:
|
|
12518
|
+
|
|
12519
|
+
Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic,
|
|
12520
|
+
Jean-Marc Valin, Timothy B. Terriberry,
|
|
12521
|
+
CSIRO, Gregory Maxwell, Mark Borgerding,
|
|
12522
|
+
Erik de Castro Lopo, Mozilla, Amazon
|
|
12523
|
+
|
|
12524
|
+
Redistribution and use in source and binary forms, with or without
|
|
12525
|
+
modification, are permitted provided that the following conditions
|
|
12526
|
+
are met:
|
|
12527
|
+
|
|
12528
|
+
- Redistributions of source code must retain the above copyright
|
|
12529
|
+
notice, this list of conditions and the following disclaimer.
|
|
12530
|
+
|
|
12531
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
12532
|
+
notice, this list of conditions and the following disclaimer in the
|
|
12533
|
+
documentation and/or other materials provided with the distribution.
|
|
12534
|
+
|
|
12535
|
+
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
|
12536
|
+
names of specific contributors, may be used to endorse or promote
|
|
12537
|
+
products derived from this software without specific prior written
|
|
12538
|
+
permission.
|
|
12539
|
+
|
|
12540
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
12541
|
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
12542
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
12543
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
|
12544
|
+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
12545
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
12546
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
12547
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
12548
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
12549
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
12550
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
12551
|
+
|
|
12552
|
+
Opus is subject to the royalty-free patent licenses which are
|
|
12553
|
+
specified at:
|
|
12554
|
+
|
|
12555
|
+
Xiph.Org Foundation:
|
|
12556
|
+
https://datatracker.ietf.org/ipr/1524/
|
|
12557
|
+
|
|
12558
|
+
Microsoft Corporation:
|
|
12559
|
+
https://datatracker.ietf.org/ipr/1914/
|
|
12560
|
+
|
|
12561
|
+
Broadcom Corporation:
|
|
12562
|
+
https://datatracker.ietf.org/ipr/1526/
|
|
12563
|
+
|
|
12512
12564
|
-------------------------------------------------------------------------------
|
|
12513
12565
|
License: BSD 3-Clause "New" or "Revised" License (BSD-3-Clause)
|
|
12514
12566
|
Used by:
|
|
@@ -13290,29 +13342,6 @@ jurisdiction of the Federal Courts of the Northern District of
|
|
|
13290
13342
|
California and the state courts of the State of California, with
|
|
13291
13343
|
venue lying in Santa Clara County, California.
|
|
13292
13344
|
|
|
13293
|
-
-------------------------------------------------------------------------------
|
|
13294
|
-
License: ISC License (ISC)
|
|
13295
|
-
Used by:
|
|
13296
|
-
- audiopus_sys 0.2.2 (https://github.com/lakelezz/audiopus_sys.git)
|
|
13297
|
-
|
|
13298
|
-
Full license text:
|
|
13299
|
-
|
|
13300
|
-
ISC License
|
|
13301
|
-
|
|
13302
|
-
Copyright (c) 2019, Lakelezz
|
|
13303
|
-
|
|
13304
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
13305
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
13306
|
-
copyright notice and this permission notice appear in all copies.
|
|
13307
|
-
|
|
13308
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
13309
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
13310
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
13311
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13312
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13313
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13314
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
13315
|
-
|
|
13316
13345
|
-------------------------------------------------------------------------------
|
|
13317
13346
|
License: ISC License (ISC)
|
|
13318
13347
|
Used by:
|
|
@@ -18734,7 +18763,7 @@ DEALINGS IN THE SOFTWARE.
|
|
|
18734
18763
|
-------------------------------------------------------------------------------
|
|
18735
18764
|
License: MIT License (MIT)
|
|
18736
18765
|
Used by:
|
|
18737
|
-
- opus 0.
|
|
18766
|
+
- opus 0.4.0 (https://github.com/SpaceManiac/opus-rs)
|
|
18738
18767
|
|
|
18739
18768
|
Full license text:
|
|
18740
18769
|
|
package/dist/types/async.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Largest delay `setTimeout` (and `timers/promises` `scheduler.wait`)
|
|
3
|
+
* accepts without 32-bit signed overflow: larger values wrap and fire
|
|
4
|
+
* almost immediately instead of sleeping. Chunk day-scale provider waits
|
|
5
|
+
* (e.g. a monthly quota reset parsed from an error hint) so the full
|
|
6
|
+
* duration elapses instead of overflowing the timer.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAX_TIMER_DELAY_MS = 2147483647;
|
|
9
|
+
/**
|
|
10
|
+
* Abortable sleep for arbitrarily long delays. Waits longer than
|
|
11
|
+
* {@link MAX_TIMER_DELAY_MS} chunk the sleep into back-to-back timer waits
|
|
12
|
+
* so no single timer overflows; an abort during any chunk rejects like
|
|
13
|
+
* `scheduler.wait`.
|
|
14
|
+
*
|
|
15
|
+
* Uses a monotonic deadline so a timer that wakes prematurely is re-armed for
|
|
16
|
+
* the unelapsed duration instead of shortening the requested sleep.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sleepLong(delayMs: number, signal?: AbortSignal): Promise<void>;
|
|
1
19
|
/**
|
|
2
20
|
* Wrap a promise with a timeout and optional abort signal.
|
|
3
21
|
* Rejects with the given error or a new error containing the given message if
|
package/dist/types/browsers.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/** Behavior-compatible reimplementation of @puppeteer/browsers' used surface. */
|
|
2
|
-
/** Supported browser products. */
|
|
3
|
-
export declare enum Browser {
|
|
4
|
-
CHROME = "chrome",
|
|
5
|
-
CHROMEHEADLESSSHELL = "chrome-headless-shell",
|
|
6
|
-
CHROMIUM = "chromium",
|
|
7
|
-
FIREFOX = "firefox",
|
|
8
|
-
CHROMEDRIVER = "chromedriver"
|
|
9
|
-
}
|
|
10
1
|
/** Browser download platform identifiers. */
|
|
11
2
|
export declare enum BrowserPlatform {
|
|
12
3
|
LINUX = "linux",
|
|
@@ -16,17 +7,6 @@ export declare enum BrowserPlatform {
|
|
|
16
7
|
WIN32 = "win32",
|
|
17
8
|
WIN64 = "win64"
|
|
18
9
|
}
|
|
19
|
-
/** Chrome-for-Testing release channel tags accepted by {@link resolveBuildId}. */
|
|
20
|
-
export declare enum BrowserTag {
|
|
21
|
-
CANARY = "canary",
|
|
22
|
-
NIGHTLY = "nightly",
|
|
23
|
-
BETA = "beta",
|
|
24
|
-
DEV = "dev",
|
|
25
|
-
DEVEDITION = "devedition",
|
|
26
|
-
STABLE = "stable",
|
|
27
|
-
ESR = "esr",
|
|
28
|
-
LATEST = "latest"
|
|
29
|
-
}
|
|
30
10
|
/** Download progress reported while a browser archive is streamed to disk. */
|
|
31
11
|
export interface BrowserDownloadProgress {
|
|
32
12
|
downloadedBytes: number;
|
|
@@ -34,7 +14,6 @@ export interface BrowserDownloadProgress {
|
|
|
34
14
|
}
|
|
35
15
|
/** Inputs used to locate an installed browser executable. */
|
|
36
16
|
export interface ComputeExecutablePathOptions {
|
|
37
|
-
browser: Browser;
|
|
38
17
|
buildId: string;
|
|
39
18
|
cacheDir: string;
|
|
40
19
|
platform?: BrowserPlatform;
|
|
@@ -44,9 +23,8 @@ export interface InstallOptions extends ComputeExecutablePathOptions {
|
|
|
44
23
|
baseUrl?: string;
|
|
45
24
|
downloadProgressCallback?: (progress: BrowserDownloadProgress) => void;
|
|
46
25
|
}
|
|
47
|
-
/** Metadata for
|
|
26
|
+
/** Metadata for a managed Chrome installation in Puppeteer's cache layout. */
|
|
48
27
|
export interface InstalledBrowser {
|
|
49
|
-
browser: Browser;
|
|
50
28
|
buildId: string;
|
|
51
29
|
platform: BrowserPlatform;
|
|
52
30
|
path: string;
|
|
@@ -54,15 +32,9 @@ export interface InstalledBrowser {
|
|
|
54
32
|
}
|
|
55
33
|
/** Detect the current host's Puppeteer browser platform. */
|
|
56
34
|
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
|
|
57
|
-
/** Resolve a Chrome-for-Testing channel, milestone, or build prefix to a full build ID. */
|
|
58
|
-
export declare function resolveBuildId(browser: Browser, _platform: BrowserPlatform, tag: string | BrowserTag): Promise<string>;
|
|
59
35
|
/** Return the Chrome-for-Testing archive URL for a browser build. */
|
|
60
|
-
export declare function getDownloadUrl(
|
|
36
|
+
export declare function getDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): URL;
|
|
61
37
|
/** Compute the executable path in Puppeteer's cache layout. */
|
|
62
38
|
export declare function computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
|
63
|
-
/** Scan a Puppeteer cache for browser installation directories. */
|
|
64
|
-
export declare function getInstalledBrowsers(options: {
|
|
65
|
-
cacheDir: string;
|
|
66
|
-
}): Promise<InstalledBrowser[]>;
|
|
67
39
|
/** Download and unpack Chrome into Puppeteer's existing cache layout. */
|
|
68
40
|
export declare function install(options: InstallOptions): Promise<InstalledBrowser>;
|
package/dist/types/color.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export declare function adjustHsv(hex: string, adj: HSVAdjustment): string;
|
|
|
82
82
|
* Convert HSL (h: 0-360, s: 0-1, l: 0-1) to a CSS hex string.
|
|
83
83
|
*/
|
|
84
84
|
export declare function hslToHex(h: number, s: number, l: number): string;
|
|
85
|
+
/** Parse a 256-color palette index (0–255) to RGB (0..255). */
|
|
86
|
+
export declare function paletteToRgb(index: number): RGB | undefined;
|
|
85
87
|
export interface OKLCH {
|
|
86
88
|
/** Perceptual lightness (0-1) */
|
|
87
89
|
l: number;
|
package/dist/types/dirs.d.ts
CHANGED
|
@@ -37,8 +37,20 @@ export declare function normalizeProfileName(profile: string | undefined): strin
|
|
|
37
37
|
* syntactically invalid value).
|
|
38
38
|
*/
|
|
39
39
|
export declare function resolveProfileEnv(profile: string | undefined): string | undefined;
|
|
40
|
+
/** Profile-independent config root (~/.zeta), shared by every zeta profile. */
|
|
41
|
+
export declare function getBaseConfigRoot(): string;
|
|
40
42
|
export declare function resolveEquivalentPath(inputPath: string): string;
|
|
41
43
|
export declare function normalizePathForComparison(inputPath: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Compare paths already normalized by {@link normalizePathForComparison}.
|
|
46
|
+
*
|
|
47
|
+
* Returns the relative path (an empty string when the paths are equal), or
|
|
48
|
+
* `null` when the candidate is outside the root. Callers classifying one
|
|
49
|
+
* candidate against several static roots can normalize each side once and
|
|
50
|
+
* reuse the public helpers' containment semantics without repeating realpath
|
|
51
|
+
* work.
|
|
52
|
+
*/
|
|
53
|
+
export declare function relativePathWithinNormalizedRoot(normalizedRoot: string, normalizedCandidate: string): string | null;
|
|
42
54
|
export declare function pathIsWithin(root: string, candidate: string): boolean;
|
|
43
55
|
export declare function relativePathWithinRoot(root: string, candidate: string): string | null;
|
|
44
56
|
/** Get the project directory. */
|
|
@@ -172,6 +184,8 @@ export declare function getPythonGatewayDir(): string;
|
|
|
172
184
|
export declare function getPuppeteerDir(): string;
|
|
173
185
|
/** Get the browser relay extension install directory (~/.zeta/browser-relay). */
|
|
174
186
|
export declare function getBrowserRelayDir(): string;
|
|
187
|
+
/** Get the profile root for Chromium browsers the browser tool spawns via `app.path` (~/.zeta/browser-profiles). */
|
|
188
|
+
export declare function getBrowserProfilesDir(): string;
|
|
175
189
|
/** Get DOCS_RS cache directory () */
|
|
176
190
|
export declare function getDocsRsCacheDir(): string;
|
|
177
191
|
/** Get the auto-QA grievances SQLite database path (~/.zeta/autoqa.db; XDG: $XDG_DATA_HOME/zeta/autoqa.db). */
|
|
@@ -263,6 +277,13 @@ export declare function getAgentModulesDir(agentDir?: string): string;
|
|
|
263
277
|
export declare function getMemoriesDir(agentDir?: string): string;
|
|
264
278
|
/** Get the terminal sessions directory (~/.zeta/agent/terminal-sessions). */
|
|
265
279
|
export declare function getTerminalSessionsDir(agentDir?: string): string;
|
|
280
|
+
/**
|
|
281
|
+
* Get the persistent registry of custom session files
|
|
282
|
+
* (~/.zeta/agent/custom-session-files). Each `--session-dir`/`--session`
|
|
283
|
+
* transcript is recorded here as one marker file so storage GC can scan its
|
|
284
|
+
* exact path after its terminal breadcrumb is overwritten by a later session.
|
|
285
|
+
*/
|
|
286
|
+
export declare function getCustomSessionFilesDir(agentDir?: string): string;
|
|
266
287
|
/** Get the crash log path (~/.zeta/agent/zeta-crash.log). */
|
|
267
288
|
export declare function getCrashLogPath(agentDir?: string): string;
|
|
268
289
|
/** Get the debug log path (~/.zeta/agent/zeta-debug.log). */
|
package/dist/types/env.d.ts
CHANGED
|
@@ -26,11 +26,21 @@ export declare function isMacosMallocStackLoggingEnvName(name: string): boolean;
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function isWsl(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
|
|
28
28
|
export declare function filterProcessEnv(env: Record<string, string | undefined>): Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Removes {@link GIT_REPO_LOCATION_ENV_NAMES} from a copied child env in place.
|
|
31
|
+
*
|
|
32
|
+
* Windows environment lookups are case-insensitive, so a block that spells a
|
|
33
|
+
* variable `git_dir` is just as binding there; match case-insensitively on
|
|
34
|
+
* win32 and exactly elsewhere (POSIX env names are case-sensitive).
|
|
35
|
+
*/
|
|
36
|
+
export declare function stripGitRepoLocationEnv(env: Record<string, string>, platform?: NodeJS.Platform): void;
|
|
29
37
|
/** Filters process env for child shells without launch-cwd dotenv values. */
|
|
30
38
|
export declare function filterChildShellEnv(env: Record<string, string | undefined>, cwd?: string): Record<string, string>;
|
|
39
|
+
/** Return every value defined by `cwd`'s dotenv files, plus environment values that came from them. */
|
|
40
|
+
export declare function getDotenvEnvValues(cwd?: string, env?: Record<string, string | undefined>): string[];
|
|
31
41
|
/**
|
|
32
|
-
* Parses a .env file
|
|
33
|
-
*
|
|
42
|
+
* Parses a complete .env file with the runtime's dotenv grammar, then retains
|
|
43
|
+
* only shell-identifier names and spawn-safe values.
|
|
34
44
|
*/
|
|
35
45
|
export declare function parseEnvFile(filePath: string): Record<string, string>;
|
|
36
46
|
/**
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/** Provider-specific interpretation for timezone-naive retry timestamps. */
|
|
2
|
+
export interface RetryHintOptions {
|
|
3
|
+
/** UTC offset appended to an absolute reset stamp that omits its timezone. */
|
|
4
|
+
naiveResetTimezoneOffset?: string;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* Server-suggested retry delay extraction. Merges the patterns historically used
|
|
3
|
-
* by the OpenAI Codex and Google Gemini retry helpers.
|
|
4
8
|
*
|
|
5
9
|
* Header sources (checked in order):
|
|
6
10
|
* - `retry-after-ms` (milliseconds)
|
|
@@ -16,12 +20,14 @@
|
|
|
16
20
|
* - `try again in 250ms` / `try again in 12s` / `try again in 5 min` / `try again in ~158 min`
|
|
17
21
|
* - `retry-after-ms=98497000` / `retry-after-ms: 7200000` / `retry-after-ms = 7200000`
|
|
18
22
|
* - `Your limit will reset at 2026-09-01 09:44:51` / `将在 2026-09-01 09:44:51 重置`
|
|
23
|
+
* (a provider offset makes a naive wall clock authoritative; otherwise it
|
|
24
|
+
* resolves only when no relative signal is present)
|
|
19
25
|
*
|
|
20
26
|
* Returns `undefined` if no signal is found, or `0` when the provider
|
|
21
27
|
* explicitly asks for an immediate retry (`retry-after…=0`, or an absolute
|
|
22
28
|
* reset timestamp that has already elapsed).
|
|
23
29
|
*/
|
|
24
|
-
export declare function extractRetryHint(source: Response | Headers | null | undefined, body?: string): number | undefined;
|
|
30
|
+
export declare function extractRetryHint(source: Response | Headers | null | undefined, body?: string, options?: RetryHintOptions): number | undefined;
|
|
25
31
|
export interface FetchWithRetryOptions extends RequestInit {
|
|
26
32
|
/** Total fetch attempts (initial + retries). Default `5`. */
|
|
27
33
|
maxAttempts?: number;
|
|
@@ -8,10 +8,22 @@ export interface FileLockOptions {
|
|
|
8
8
|
/** Maximum age of the lock before it is considered stale and can be broken. */
|
|
9
9
|
staleMs?: number;
|
|
10
10
|
}
|
|
11
|
+
/** An exclusive OS-backed lease. Releasing an already released handle is safe. */
|
|
12
|
+
export interface FileLockHandle {
|
|
13
|
+
release(): void;
|
|
14
|
+
}
|
|
15
|
+
/** An exclusive OS-backed lease. Releasing an already released handle is safe. */
|
|
16
|
+
export interface FileLockHandle {
|
|
17
|
+
release(): void;
|
|
18
|
+
}
|
|
11
19
|
declare function getLockPath(filePath: string): string;
|
|
12
20
|
declare function tryAcquireLock(lockPath: string): NativeFileLock | null;
|
|
21
|
+
/** Acquire an exclusive lease; callers must release it when their operation ends. */
|
|
22
|
+
export declare function acquireFileLock(filePath: string, options?: FileLockOptions): Promise<FileLockHandle>;
|
|
13
23
|
/** Run `fn` while holding an OS-backed exclusive lock for `filePath`. */
|
|
14
24
|
export declare function withFileLock<T>(filePath: string, fn: () => Promise<T>, options?: FileLockOptions): Promise<T>;
|
|
25
|
+
/** Run synchronous `fn` while holding an OS-backed exclusive lock for `filePath`. */
|
|
26
|
+
export declare function withFileLockSync<T>(filePath: string, fn: () => T, options?: FileLockOptions): T;
|
|
15
27
|
/**
|
|
16
28
|
* Test-only acquisition handle for forcing ownership handoffs. This is not
|
|
17
29
|
* part of the supported package API.
|
package/dist/types/format.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export declare function formatNumber(n: number): string;
|
|
|
14
14
|
* Examples: "512B", "1.5KB", "2.3MB", "1.2GB"
|
|
15
15
|
*/
|
|
16
16
|
export declare function formatBytes(bytes: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Count `\n` code units via native `indexOf` — no split array, roughly an
|
|
19
|
+
* order of magnitude cheaper than a per-code-unit loop on multi-MiB text.
|
|
20
|
+
* Line-count semantics are the caller's (empty text is 0 or 1 lines
|
|
21
|
+
* depending on the contract).
|
|
22
|
+
*/
|
|
23
|
+
export declare function countNewlines(text: string): number;
|
|
17
24
|
/**
|
|
18
25
|
* Truncate a string to maxLen characters, appending an ellipsis if truncated.
|
|
19
26
|
* For display-width-aware truncation (terminals), use truncateToWidth from @linxiraos/pi-tui.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ export * from "./binary.js";
|
|
|
4
4
|
export * from "./color.js";
|
|
5
5
|
export * from "./dirs.js";
|
|
6
6
|
export * from "./env.js";
|
|
7
|
+
export * from "./executable.js";
|
|
7
8
|
export * from "./fetch-retry.js";
|
|
8
9
|
export * from "./file-lock.js";
|
|
9
10
|
export * from "./format.js";
|
|
10
11
|
export * from "./frontmatter.js";
|
|
11
12
|
export * from "./fs-error.js";
|
|
12
|
-
export * from "./glob.js";
|
|
13
13
|
export * from "./incoming-json.js";
|
|
14
14
|
export * from "./json.js";
|
|
15
15
|
export * from "./json-parse.js";
|
|
@@ -40,4 +40,5 @@ export * from "./tls-fetch.js";
|
|
|
40
40
|
export * from "./type-guards.js";
|
|
41
41
|
export * from "./version.js";
|
|
42
42
|
export * from "./which.js";
|
|
43
|
+
export * from "./yaml-config.js";
|
|
43
44
|
export declare function structuredCloneJSON<T>(value: T): T;
|
package/dist/types/mime.d.ts
CHANGED
package/dist/types/path.d.ts
CHANGED
|
@@ -2,3 +2,9 @@
|
|
|
2
2
|
export declare function windowsPathToWslMount(filePath: string): string | undefined;
|
|
3
3
|
/** Removes Win32 extended-length prefixes before passing paths to Bun APIs. */
|
|
4
4
|
export declare function stripWindowsExtendedLengthPathPrefix(filePath: string, platform?: NodeJS.Platform): string;
|
|
5
|
+
/**
|
|
6
|
+
* Test whether a path is fully qualified and drive-independent.
|
|
7
|
+
* On Windows, requires a drive letter with separator (e.g. `C:\`) or UNC (`\\server\share` or `//server/share`).
|
|
8
|
+
* On POSIX, requires an absolute path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isFullyQualifiedPath(filePath: string, platform?: NodeJS.Platform): boolean;
|
|
@@ -10,9 +10,8 @@ export declare function peekFile<T>(filePath: string, maxBytes: number, op: (hea
|
|
|
10
10
|
/**
|
|
11
11
|
* Read up to the last `maxBytes` of `filePath` and pass that slice to `op`.
|
|
12
12
|
*
|
|
13
|
-
* The tail mirror of {@link peekFile}:
|
|
14
|
-
*
|
|
15
|
-
* window ends at EOF. When the file is shorter than `maxBytes`, the whole file is
|
|
13
|
+
* The tail mirror of {@link peekFile}: the read is positioned at `size - len` so
|
|
14
|
+
* the window ends at EOF. When the file is shorter than `maxBytes`, the whole file is
|
|
16
15
|
* returned. A multi-byte codepoint straddling the leading cut decodes to a
|
|
17
16
|
* replacement char — callers that parse line-oriented tails drop the partial
|
|
18
17
|
* leading line anyway.
|
|
@@ -27,6 +27,27 @@ export declare enum Reason {
|
|
|
27
27
|
* instances across bundles/realms.
|
|
28
28
|
*/
|
|
29
29
|
export declare const NATIVE_PROCESS_EXIT: unique symbol;
|
|
30
|
+
/**
|
|
31
|
+
* Hard-exit the process through the native primitive, resolved on every call.
|
|
32
|
+
*
|
|
33
|
+
* The native exit is deliberately re-resolved here rather than bound at module
|
|
34
|
+
* load: the extension/hook loader's `withHostGuard` transiently swaps
|
|
35
|
+
* `process.reallyExit`/`process.exit` for a stub that throws
|
|
36
|
+
* `ExtensionExitError`, and the shipped bundle defers this module's evaluation
|
|
37
|
+
* until first access — which can land inside that guard window, so binding at
|
|
38
|
+
* init could freeze the throwing stub forever and turn every later shutdown
|
|
39
|
+
* (SIGHUP/SIGINT/fatal) into an unhandled-rejection loop (#7393). When the
|
|
40
|
+
* guard is active the stub carries the native exit under
|
|
41
|
+
* {@link NATIVE_PROCESS_EXIT} (#6488).
|
|
42
|
+
*
|
|
43
|
+
* Both globals are reinstalled to their natives before exiting: Bun's
|
|
44
|
+
* `process.exit` re-reads `process.reallyExit` at call time, so exiting through
|
|
45
|
+
* one primitive while its sibling still holds the throwing stub re-enters the
|
|
46
|
+
* guard and loops the rejection storm (#11789). After restoring, `reallyExit`
|
|
47
|
+
* (the low-level primitive) is preferred; `process.exit` and finally `SIGKILL`
|
|
48
|
+
* are fallbacks so a poisoned or absent chain can never leave the process alive.
|
|
49
|
+
*/
|
|
50
|
+
export declare function exitProcess(code: number): never;
|
|
30
51
|
/** User-facing command printed before fatal cleanup so interrupted work can be resumed. */
|
|
31
52
|
export interface FatalRecoveryHint {
|
|
32
53
|
/** Stable label identifying the recoverable session or process. */
|
|
@@ -91,11 +112,11 @@ export declare function isWorkerIpcDeserializeError(err: unknown): boolean;
|
|
|
91
112
|
*/
|
|
92
113
|
export declare function registerWorkerIpcFaultHandler(handler: (err: Error) => void): () => void;
|
|
93
114
|
/**
|
|
94
|
-
* Treat
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
115
|
+
* Treat a closed stdout consumer as a graceful peer disconnect for the caller's
|
|
116
|
+
* active lifetime. Attaches one shared `process.stdout` `error` listener,
|
|
117
|
+
* ref-counted across registrants (the ACP protocol server, the one-shot CLI
|
|
118
|
+
* entry). The returned callback removes the registration; the listener detaches
|
|
119
|
+
* when the last registrant unregisters.
|
|
99
120
|
*/
|
|
100
121
|
export declare function registerStdioDisconnectHandling(): () => void;
|
|
101
122
|
/**
|
package/dist/types/procmgr.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Subprocess } from "bun";
|
|
2
|
+
import { isExecutable } from "./executable.js";
|
|
3
|
+
export { isExecutable };
|
|
2
4
|
export interface ShellConfig {
|
|
3
5
|
shell: string;
|
|
4
6
|
args: string[];
|
|
@@ -10,10 +12,6 @@ export interface ShellConfigOptions {
|
|
|
10
12
|
/** File path or runtime layer that supplied the active shell setting. */
|
|
11
13
|
configSource?: string;
|
|
12
14
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Check if a shell binary is executable.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isExecutable(path: string): boolean;
|
|
17
15
|
/**
|
|
18
16
|
* Get shell args for the resolved shell.
|
|
19
17
|
* cmd.exe takes `/c`; PowerShell (powershell.exe / pwsh) takes
|
package/dist/types/sqlite.d.ts
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
+
/** Shared SQLite opening, error attribution, and result-code classification for persistent stores. */
|
|
2
|
+
import { Database } from "bun:sqlite";
|
|
3
|
+
/** Controls opt-in replacement of an unrecoverably corrupt SQLite store. */
|
|
4
|
+
export interface SqliteOpenOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Preserve a corrupt store and its sidecars, recreate it, and run the
|
|
7
|
+
* initializer once more. Disabled by default.
|
|
8
|
+
*/
|
|
9
|
+
recoverCorruption?: boolean;
|
|
10
|
+
/** Runs after preservation and before the replacement is initialized. */
|
|
11
|
+
onCorruptionPreserved?: (backupPath: string, error: unknown) => void;
|
|
12
|
+
}
|
|
1
13
|
/**
|
|
2
|
-
*
|
|
14
|
+
* Opens and initializes a store, retrying BUSY failures up to four total attempts.
|
|
15
|
+
* Installs the busy handler before initialization and closes failed connections.
|
|
16
|
+
* The initializer may run again on a fresh connection; on success it owns the handle.
|
|
3
17
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* credential store and the model cache.
|
|
18
|
+
* With corruption recovery enabled, recovery is serialized across processes.
|
|
19
|
+
* The identity observed by the failed handle is checked under that lock, so a
|
|
20
|
+
* waiter adopts a replacement made by a peer instead of quarantining it.
|
|
21
|
+
* Final failures retain their SQLite codes and include the database path.
|
|
9
22
|
*/
|
|
10
|
-
|
|
23
|
+
export declare function openSqliteDatabase<T>(dbPath: string, initialize: (db: Database) => T | Promise<T>, options?: SqliteOpenOptions): Promise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Synchronous counterpart to {@link openSqliteDatabase}. It performs no BUSY
|
|
26
|
+
* retry loop; corruption recovery, when enabled, is bounded to one replacement.
|
|
27
|
+
*/
|
|
28
|
+
export declare function openSqliteDatabaseSync<T>(dbPath: string, initialize: (db: Database) => T, options?: SqliteOpenOptions): T;
|
|
29
|
+
/** Adds the failing store's path to an error without losing SQLite result codes or its original stack. */
|
|
30
|
+
export declare function annotateSqliteError(error: unknown, dbPath: string): Error;
|
|
11
31
|
/** Checkpoints committed WAL frames without waiting for concurrent readers. */
|
|
12
32
|
export declare function checkpointWal(db: Database): void;
|
|
13
33
|
/**
|