@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.
Files changed (170) hide show
  1. package/CHANGELOG.md +2 -3
  2. package/README.md +18 -18
  3. package/package.json +57 -63
  4. package/src/async.ts +16 -0
  5. package/src/dirs.ts +15 -10
  6. package/src/incoming-json.ts +856 -0
  7. package/src/index.ts +1 -0
  8. package/src/json-lexer.ts +413 -0
  9. package/src/json-parse.ts +93 -350
  10. package/src/tls-fetch.ts +2 -16
  11. package/THIRD-PARTY-NOTICES.txt +0 -22909
  12. package/dist/types/abortable.d.ts +0 -32
  13. package/dist/types/acp/connection.d.ts +0 -118
  14. package/dist/types/acp/protocol.d.ts +0 -526
  15. package/dist/types/acp/schema.d.ts +0 -41
  16. package/dist/types/acp/stream.d.ts +0 -8
  17. package/dist/types/acp/transport.d.ts +0 -88
  18. package/dist/types/acp.d.ts +0 -6
  19. package/dist/types/ar/arj.d.ts +0 -5
  20. package/dist/types/ar/asar.d.ts +0 -7
  21. package/dist/types/ar/bytes.d.ts +0 -20
  22. package/dist/types/ar/cab.d.ts +0 -5
  23. package/dist/types/ar/checksums.d.ts +0 -10
  24. package/dist/types/ar/codecs/bzip2.d.ts +0 -4
  25. package/dist/types/ar/codecs/gzip.d.ts +0 -6
  26. package/dist/types/ar/codecs/lzma.d.ts +0 -6
  27. package/dist/types/ar/codecs/lzw.d.ts +0 -4
  28. package/dist/types/ar/codecs/lzx.d.ts +0 -7
  29. package/dist/types/ar/codecs/xz.d.ts +0 -4
  30. package/dist/types/ar/codecs/zstd.d.ts +0 -6
  31. package/dist/types/ar/cpio.d.ts +0 -7
  32. package/dist/types/ar/deb.d.ts +0 -5
  33. package/dist/types/ar/entries.d.ts +0 -22
  34. package/dist/types/ar/error.d.ts +0 -8
  35. package/dist/types/ar/index.d.ts +0 -11
  36. package/dist/types/ar/iso.d.ts +0 -5
  37. package/dist/types/ar/limits.d.ts +0 -33
  38. package/dist/types/ar/lzh.d.ts +0 -7
  39. package/dist/types/ar/open.d.ts +0 -45
  40. package/dist/types/ar/paths.d.ts +0 -18
  41. package/dist/types/ar/rar/rar4-decoder.d.ts +0 -6
  42. package/dist/types/ar/rar/rar5-decoder.d.ts +0 -6
  43. package/dist/types/ar/rar.d.ts +0 -5
  44. package/dist/types/ar/reader.d.ts +0 -28
  45. package/dist/types/ar/registry.d.ts +0 -17
  46. package/dist/types/ar/rpm.d.ts +0 -5
  47. package/dist/types/ar/sevenzip/decode.d.ts +0 -33
  48. package/dist/types/ar/sevenzip.d.ts +0 -5
  49. package/dist/types/ar/source.d.ts +0 -54
  50. package/dist/types/ar/tar.d.ts +0 -9
  51. package/dist/types/ar/types.d.ts +0 -99
  52. package/dist/types/ar/unix-ar.d.ts +0 -7
  53. package/dist/types/ar/write.d.ts +0 -10
  54. package/dist/types/ar/zip.d.ts +0 -10
  55. package/dist/types/async.d.ts +0 -22
  56. package/dist/types/binary.d.ts +0 -23
  57. package/dist/types/browsers.d.ts +0 -68
  58. package/dist/types/chalk.d.ts +0 -125
  59. package/dist/types/cli.d.ts +0 -134
  60. package/dist/types/color.d.ts +0 -136
  61. package/dist/types/dates.d.ts +0 -7
  62. package/dist/types/dirs.d.ts +0 -325
  63. package/dist/types/docx/converter.d.ts +0 -46
  64. package/dist/types/docx/xml.d.ts +0 -26
  65. package/dist/types/docx.d.ts +0 -11
  66. package/dist/types/dom/core.d.ts +0 -431
  67. package/dist/types/dom/parser.d.ts +0 -7
  68. package/dist/types/dom/selector.d.ts +0 -5
  69. package/dist/types/dom.d.ts +0 -5
  70. package/dist/types/env.d.ts +0 -133
  71. package/dist/types/fetch-retry.d.ts +0 -98
  72. package/dist/types/file-lock.d.ts +0 -23
  73. package/dist/types/format.d.ts +0 -37
  74. package/dist/types/frontmatter.d.ts +0 -46
  75. package/dist/types/fs-error.d.ts +0 -31
  76. package/dist/types/glob.d.ts +0 -28
  77. package/dist/types/headers.d.ts +0 -34
  78. package/dist/types/index.d.ts +0 -42
  79. package/dist/types/json-parse.d.ts +0 -83
  80. package/dist/types/json.d.ts +0 -20
  81. package/dist/types/logger/rotating-file.d.ts +0 -18
  82. package/dist/types/logger.d.ts +0 -96
  83. package/dist/types/loop-phase.d.ts +0 -10
  84. package/dist/types/lru.d.ts +0 -46
  85. package/dist/types/marked/core.d.ts +0 -445
  86. package/dist/types/marked.d.ts +0 -2
  87. package/dist/types/materialize-string.d.ts +0 -7
  88. package/dist/types/math-delimiters.d.ts +0 -45
  89. package/dist/types/mermaid-ascii.d.ts +0 -11
  90. package/dist/types/mime.d.ts +0 -29
  91. package/dist/types/module-timer.d.ts +0 -1
  92. package/dist/types/path-tree.d.ts +0 -76
  93. package/dist/types/path.d.ts +0 -4
  94. package/dist/types/peek-file.d.ts +0 -29
  95. package/dist/types/postmortem.d.ts +0 -178
  96. package/dist/types/process-name.d.ts +0 -7
  97. package/dist/types/procmgr.d.ts +0 -74
  98. package/dist/types/prompt.d.ts +0 -18
  99. package/dist/types/ptree.d.ts +0 -124
  100. package/dist/types/readability/readability.d.ts +0 -9
  101. package/dist/types/readability/readerable.d.ts +0 -10
  102. package/dist/types/readability/types.d.ts +0 -70
  103. package/dist/types/readability.d.ts +0 -4
  104. package/dist/types/ring.d.ts +0 -93
  105. package/dist/types/runtime-install.d.ts +0 -85
  106. package/dist/types/sanitize-text.d.ts +0 -29
  107. package/dist/types/snowflake.d.ts +0 -25
  108. package/dist/types/sqlite.d.ts +0 -26
  109. package/dist/types/stderr-guard.d.ts +0 -22
  110. package/dist/types/stream.d.ts +0 -75
  111. package/dist/types/tab-spacing.d.ts +0 -24
  112. package/dist/types/temp.d.ts +0 -24
  113. package/dist/types/template.d.ts +0 -62
  114. package/dist/types/timing-buffer.d.ts +0 -22
  115. package/dist/types/tls-fetch.d.ts +0 -37
  116. package/dist/types/turndown/gfm.d.ts +0 -11
  117. package/dist/types/turndown/html.d.ts +0 -5
  118. package/dist/types/turndown/service.d.ts +0 -21
  119. package/dist/types/turndown/types.d.ts +0 -70
  120. package/dist/types/turndown.d.ts +0 -4
  121. package/dist/types/type-guards.d.ts +0 -5
  122. package/dist/types/vendor/mermaid-ascii/ascii/ansi.d.ts +0 -41
  123. package/dist/types/vendor/mermaid-ascii/ascii/canvas.d.ts +0 -89
  124. package/dist/types/vendor/mermaid-ascii/ascii/class-diagram.d.ts +0 -7
  125. package/dist/types/vendor/mermaid-ascii/ascii/converter.d.ts +0 -12
  126. package/dist/types/vendor/mermaid-ascii/ascii/draw.d.ts +0 -66
  127. package/dist/types/vendor/mermaid-ascii/ascii/edge-bundling.d.ts +0 -48
  128. package/dist/types/vendor/mermaid-ascii/ascii/edge-routing.d.ts +0 -43
  129. package/dist/types/vendor/mermaid-ascii/ascii/er-diagram.d.ts +0 -7
  130. package/dist/types/vendor/mermaid-ascii/ascii/grid.d.ts +0 -56
  131. package/dist/types/vendor/mermaid-ascii/ascii/index.d.ts +0 -65
  132. package/dist/types/vendor/mermaid-ascii/ascii/multiline-utils.d.ts +0 -27
  133. package/dist/types/vendor/mermaid-ascii/ascii/pathfinder.d.ts +0 -17
  134. package/dist/types/vendor/mermaid-ascii/ascii/sequence.d.ts +0 -7
  135. package/dist/types/vendor/mermaid-ascii/ascii/shapes/circle.d.ts +0 -11
  136. package/dist/types/vendor/mermaid-ascii/ascii/shapes/corners.d.ts +0 -34
  137. package/dist/types/vendor/mermaid-ascii/ascii/shapes/diamond.d.ts +0 -11
  138. package/dist/types/vendor/mermaid-ascii/ascii/shapes/hexagon.d.ts +0 -11
  139. package/dist/types/vendor/mermaid-ascii/ascii/shapes/index.d.ts +0 -26
  140. package/dist/types/vendor/mermaid-ascii/ascii/shapes/rectangle.d.ts +0 -31
  141. package/dist/types/vendor/mermaid-ascii/ascii/shapes/rounded.d.ts +0 -11
  142. package/dist/types/vendor/mermaid-ascii/ascii/shapes/special.d.ts +0 -59
  143. package/dist/types/vendor/mermaid-ascii/ascii/shapes/stadium.d.ts +0 -17
  144. package/dist/types/vendor/mermaid-ascii/ascii/shapes/state.d.ts +0 -30
  145. package/dist/types/vendor/mermaid-ascii/ascii/shapes/types.d.ts +0 -55
  146. package/dist/types/vendor/mermaid-ascii/ascii/types.d.ts +0 -206
  147. package/dist/types/vendor/mermaid-ascii/ascii/validate.d.ts +0 -51
  148. package/dist/types/vendor/mermaid-ascii/ascii/xychart.d.ts +0 -2
  149. package/dist/types/vendor/mermaid-ascii/class/parser.d.ts +0 -6
  150. package/dist/types/vendor/mermaid-ascii/class/types.d.ts +0 -102
  151. package/dist/types/vendor/mermaid-ascii/er/parser.d.ts +0 -6
  152. package/dist/types/vendor/mermaid-ascii/er/types.d.ts +0 -76
  153. package/dist/types/vendor/mermaid-ascii/index.d.ts +0 -1
  154. package/dist/types/vendor/mermaid-ascii/multiline-utils.d.ts +0 -9
  155. package/dist/types/vendor/mermaid-ascii/parser.d.ts +0 -7
  156. package/dist/types/vendor/mermaid-ascii/sequence/parser.d.ts +0 -6
  157. package/dist/types/vendor/mermaid-ascii/sequence/types.d.ts +0 -130
  158. package/dist/types/vendor/mermaid-ascii/text-metrics.d.ts +0 -23
  159. package/dist/types/vendor/mermaid-ascii/types.d.ts +0 -114
  160. package/dist/types/vendor/mermaid-ascii/xychart/colors.d.ts +0 -25
  161. package/dist/types/vendor/mermaid-ascii/xychart/parser.d.ts +0 -6
  162. package/dist/types/vendor/mermaid-ascii/xychart/types.d.ts +0 -145
  163. package/dist/types/version.d.ts +0 -18
  164. package/dist/types/vterm/buffer.d.ts +0 -99
  165. package/dist/types/vterm/query-responder.d.ts +0 -24
  166. package/dist/types/vterm/terminal.d.ts +0 -44
  167. package/dist/types/vterm.d.ts +0 -9
  168. package/dist/types/which.d.ts +0 -37
  169. package/dist/types/worker-host.d.ts +0 -51
  170. package/dist/types/xml.d.ts +0 -31
@@ -1,325 +0,0 @@
1
- /**
2
- * Centralized path helpers for zeta config directories.
3
- *
4
- * Uses PI_CONFIG_DIR (default ".zeta") for the config root and
5
- * PI_CODING_AGENT_DIR to override the agent directory.
6
- *
7
- * On Linux, if XDG_DATA_HOME / XDG_STATE_HOME / XDG_CACHE_HOME environment
8
- * variables are set, paths are redirected to XDG-compliant locations under
9
- * $XDG_*_HOME/zeta/. This requires running `zeta config migrate` first to
10
- * move data to the new locations. No filesystem existence checks are performed
11
- * — if the env var is set, omp trusts that the migration has been done.
12
- */
13
- /** App name (e.g. "omp") */
14
- export declare const APP_NAME: string;
15
- /** Config directory name (e.g. ".zeta") */
16
- export declare const CONFIG_DIR_NAME: string;
17
- /** Ordered main settings filenames: canonical write target first, legacy-compatible YAML fallback second. */
18
- export declare const MAIN_CONFIG_FILENAMES: readonly ["config.yml", "config.yaml"];
19
- /** Version (e.g. "1.0.0") */
20
- export declare const VERSION: string;
21
- /** Default User-Agent header string (e.g. "zeta/1.1.5") */
22
- export declare const USER_AGENT: string;
23
- /** Minimum Bun version */
24
- export declare const MIN_BUN_VERSION: string;
25
- /**
26
- * Normalize and validate a profile name. Returns `undefined` for the implicit
27
- * default (empty string, whitespace, or the explicit "default" sentinel) and
28
- * throws for syntactically invalid or platform-reserved names.
29
- *
30
- * Exported so consumers of `@linxiraos/pi-utils/dirs` (CLI bootstrap, tests,
31
- * downstream tools) can validate user input without re-deriving the rules.
32
- */
33
- export declare function normalizeProfileName(profile: string | undefined): string | undefined;
34
- /**
35
- * Resolve the active profile from the two profile env vars. `OMP_PROFILE` is the
36
- * canonical variable and takes precedence; `PI_PROFILE` is the legacy
37
- * compatibility fallback, consulted only when `OMP_PROFILE` is undefined. An
38
- * explicitly-empty `OMP_PROFILE` therefore selects the default profile rather
39
- * than silently inheriting `PI_PROFILE`. Delegates validation/normalization to
40
- * {@link normalizeProfileName} (which throws on a syntactically invalid value).
41
- */
42
- export declare function resolveProfileEnv(omp: string | undefined, pi: string | undefined): string | undefined;
43
- export declare function resolveEquivalentPath(inputPath: string): string;
44
- export declare function normalizePathForComparison(inputPath: string): string;
45
- export declare function pathIsWithin(root: string, candidate: string): boolean;
46
- export declare function relativePathWithinRoot(root: string, candidate: string): string | null;
47
- /** Get the project directory. */
48
- export declare function getProjectDir(): string;
49
- /** Set the project directory. */
50
- export declare function setProjectDir(dir: string): void;
51
- /** Reset the cached project directory (test seam). */
52
- export declare function __resetProjectDirCacheForTests(): void;
53
- /** Whether a path is absent or not a directory. Other stat failures return false. */
54
- export declare function directoryIsMissing(dir: string): Promise<boolean>;
55
- /**
56
- * Whether `dir` resolves to an existing directory. Any stat failure — a deleted
57
- * path (ENOENT), permission error, or a non-directory — returns `false`, so
58
- * callers can decide whether a directory is safe to `chdir` into or adopt as a
59
- * working directory before {@link setProjectDir} throws on it.
60
- */
61
- export declare function directoryExists(dir: string): Promise<boolean>;
62
- /**
63
- * Whether `dir` both exists and can be entered. POSIX `stat` succeeds for a
64
- * directory whose own search/execute permission is denied (it only needs
65
- * +x on the parent chain), so existence alone does not imply `chdir` works.
66
- * Callers that adopt a directory as a working directory must check this
67
- * rather than {@link directoryExists} alone.
68
- */
69
- export declare function directoryIsEnterable(dir: string): Promise<boolean>;
70
- /** Whether `dir` is enterable, synchronous variant. See {@link directoryIsEnterable}. */
71
- export declare function directoryIsEnterableSync(dir: string): boolean;
72
- /**
73
- * Project directory when it is enterable, otherwise a safe fallback.
74
- * Used by spawns that must preserve project-relative behavior when healthy.
75
- */
76
- export declare function getSafeProjectCwd(): string;
77
- /** Get the config directory name relative to home (e.g. ".zeta" or PI_CONFIG_DIR override). */
78
- export declare function getConfigDirName(): string;
79
- /** Get the config agent directory name relative to home (e.g. ".zeta/agent" or PI_CONFIG_DIR + "/agent"). */
80
- export declare function getConfigAgentDirName(): string;
81
- /**
82
- * Rebuild the dirs resolver from the current environment, reusing the profile
83
- * resolved at module load. Directory-affecting keys (XDG_*_HOME and, in default
84
- * mode, `PI_CODING_AGENT_DIR`) loaded from a profile/agent `.env` only reach
85
- * `process.env` *after* this module froze the resolver at import time, so
86
- * `env.ts` calls this once after applying its `.env` files. The agent `.env`
87
- * location derives from the profile name + home before this runs, so the
88
- * rebuild re-reads only the directory vars, never the profile selection. The
89
- * `preProfileAgentDirEnv` snapshot is intentionally left untouched.
90
- */
91
- export declare function refreshDirsFromEnv(): void;
92
- /** Get the config root directory (~/.zeta). */
93
- export declare function getConfigRootDir(): string;
94
- /** Set the coding agent directory. Creates a fresh resolver, invalidating all cached paths. */
95
- export declare function setAgentDir(dir: string): void;
96
- /**
97
- * Test-only: reset the pre-profile `PI_CODING_AGENT_DIR` snapshot to whatever
98
- * the current environment looks like. Cross-suite test pollution can otherwise
99
- * leak a stale snapshot through `setAgentDir` and corrupt `setProfile(undefined)`
100
- * restore semantics. Production code MUST NOT call this — the snapshot's
101
- * lifecycle is owned by `setAgentDir` / `setProfile` and a runtime caller has
102
- * no business clearing it.
103
- */
104
- export declare function __resetProfileSnapshotForTests(): void;
105
- /**
106
- * Test-only: rebuild profile + directory state from the current process env.
107
- * Production code keeps the module-load profile stable; tests that mutate
108
- * `setAgentDir`/`setProfile` need an exact restore point after they put env vars
109
- * back.
110
- */
111
- export declare function __resetDirsFromEnvForTests(): void;
112
- /** Activate a named profile. Passing undefined or "default" returns to the default profile. */
113
- export declare function setProfile(profile: string | undefined): void;
114
- /** Get the active named profile. Undefined means the default profile. */
115
- export declare function getActiveProfile(): string | undefined;
116
- /** Resolve the config root that backs a profile without activating it. */
117
- export declare function getProfileRootDir(profile: string | undefined): string;
118
- /** Get the agent config directory (~/.zeta/agent). */
119
- export declare function getAgentDir(): string;
120
- /** Get the project-local config directory (.zeta). */
121
- export declare function getProjectAgentDir(cwd?: string): string;
122
- /** Get the reports directory (~/.zeta/reports). */
123
- export declare function getReportsDir(): string;
124
- /** Get the logs directory (~/.zeta/logs). */
125
- export declare function getLogsDir(): string;
126
- /** Get this process's dated log path (~/.zeta/logs/omp.YYYY-MM-DD.PID.log). */
127
- export declare function getLogPath(date?: Date, pid?: number): string;
128
- /**
129
- * Get the plugins directory (~/.zeta/plugins or its XDG equivalent).
130
- *
131
- * No-arg form (production callers) goes through the XDG-aware DirResolver so
132
- * reads and writes always agree. The optional `home` parameter is for test
133
- * isolation: when it differs from `os.homedir()` it short-circuits the resolver
134
- * and returns `<home>/<configDir>/plugins` so tests with a temp HOME get a
135
- * deterministic path. Passing `os.homedir()` explicitly is identical to the
136
- * no-arg form — XDG semantics are preserved.
137
- */
138
- export declare function getPluginsDir(home?: string): string;
139
- /** Where npm installs packages (~/.zeta/plugins/node_modules). */
140
- export declare function getPluginsNodeModules(home?: string): string;
141
- /** Plugin manifest (~/.zeta/plugins/package.json). */
142
- export declare function getPluginsPackageJson(home?: string): string;
143
- /** Plugin lock file (~/.zeta/plugins/omp-plugins.lock.json). */
144
- export declare function getPluginsLockfile(home?: string): string;
145
- /** Get the remote mount directory (~/.zeta/remote). */
146
- export declare function getRemoteDir(): string;
147
- /**
148
- * Relocate the base directory for agent-managed worktrees (PR checkouts, task
149
- * isolation, and `omp worktree` cleanup all read the same base). Driven by the
150
- * `worktree.base` setting in coding-agent; pass `undefined`/empty to clear and
151
- * fall back to `OMP_WORKTREE_DIR` or the `~/.zeta/wt` default.
152
- *
153
- * `~` is expanded and a relative path is rejected (see {@link resolveWorktreeBase}).
154
- * Returns the absolute path that took effect, or `undefined` if the input was
155
- * cleared or rejected — callers can warn on a non-empty input that returns
156
- * `undefined`.
157
- */
158
- export declare function setWorktreesDir(dir: string | undefined): string | undefined;
159
- /**
160
- * Get the agent-managed worktrees directory. Resolution order: the
161
- * `OMP_WORKTREE_DIR` env var, then the {@link setWorktreesDir} override (the
162
- * `worktree.base` setting), then the `~/.zeta/wt` default. The env var and the
163
- * override are both `~`-expanded and must be absolute; a relative value is
164
- * ignored and resolution falls through.
165
- */
166
- export declare function getWorktreesDir(): string;
167
- /** Get the SSH control socket directory (~/.zeta/ssh-control). */
168
- export declare function getSshControlDir(): string;
169
- /** Get the remote host info directory (~/.zeta/remote-host). */
170
- export declare function getRemoteHostDir(): string;
171
- /** Get the managed Python venv directory (~/.zeta/python-env). */
172
- export declare function getPythonEnvDir(): string;
173
- /** Get the shared Python gateway state directory (~/.zeta/agent/python-gateway; XDG default: $XDG_STATE_HOME/zeta/python-gateway). */
174
- export declare function getPythonGatewayDir(): string;
175
- /** Get the puppeteer sandbox directory (~/.zeta/puppeteer). */
176
- export declare function getPuppeteerDir(): string;
177
- /** Get the browser relay extension install directory (~/.zeta/browser-relay). */
178
- export declare function getBrowserRelayDir(): string;
179
- /** Get DOCS_RS cache directory () */
180
- export declare function getDocsRsCacheDir(): string;
181
- /** Get the auto-QA grievances SQLite database path (~/.zeta/autoqa.db; XDG: $XDG_DATA_HOME/zeta/autoqa.db). */
182
- export declare function getAutoQaDbPath(): string;
183
- /**
184
- * Stable 7-character hex digest of an absolute filesystem path.
185
- *
186
- * Used to pack the project identity into a single short fs-safe segment
187
- * (e.g. PR-checkout and task-isolation worktree dirs under `~/.zeta/wt/`).
188
- * Bun.hash is non-cryptographic — collision space is ~2^28, which is fine
189
- * for naming a handful of repos on a single machine. Same input on the
190
- * same Bun runtime yields the same output.
191
- */
192
- export declare function hashPath(absPath: string): string;
193
- /** Get the path to a single worktree directory (~/.zeta/wt/<segment>). */
194
- export declare function getWorktreeDir(segment: string): string;
195
- /** Get the GPU cache path (~/.zeta/gpu_cache.json). */
196
- export declare function getGpuCachePath(): string;
197
- /**
198
- * Get the GitHub view cache database path (~/.zeta/cache/github-cache.db).
199
- * Honors the `OMP_GITHUB_CACHE_DB` env var when set so tests can isolate the
200
- * cache file without touching the rest of the config root.
201
- */
202
- export declare function getGithubCacheDbPath(): string;
203
- /**
204
- * Get the conventional commit inference cache database path (~/.zeta/cache/commit-inference.db).
205
- * Honors `OMP_COMMIT_CACHE_DB` so tests and operators can isolate the cache.
206
- */
207
- export declare function getCommitCacheDbPath(): string;
208
- /** Get the legacy Pi extension parse cache database path. */
209
- export declare function getLegacyPiExtensionCacheDbPath(): string;
210
- /**
211
- * Get the encrypted auth-broker snapshot cache path (~/.zeta/cache/auth-broker-snapshot.enc).
212
- * Honors the `OMP_AUTH_BROKER_SNAPSHOT_CACHE` env var when set so tests and
213
- * operators can isolate or relocate the cache file.
214
- */
215
- export declare function getAuthBrokerSnapshotCachePath(): string;
216
- /** Get the commit-author avatar cache directory (~/.zeta/cache/avatars). */
217
- export declare function getAvatarCacheDir(): string;
218
- /** Get the local FastEmbed model cache directory (~/.zeta/cache/fastembed). */
219
- export declare function getFastembedCacheDir(): string;
220
- /** Get the on-demand fastembed runtime install root (~/.zeta/cache/fastembed-runtime). */
221
- export declare function getFastembedRuntimeDir(): string;
222
- /** Get the natives directory (~/.zeta/natives). */
223
- export declare function getNativesDir(): string;
224
- /** Get the stats database path (~/.zeta/stats.db). */
225
- export declare function getStatsDbPath(): string;
226
- /** Get the autoresearch state directory (~/.zeta/autoresearch). */
227
- export declare function getAutoresearchDir(): string;
228
- /** Get the per-project autoresearch state directory (~/.zeta/autoresearch/<encoded-project>). */
229
- export declare function getAutoresearchProjectDir(encodedProject: string): string;
230
- /** Get the per-project autoresearch SQLite database path (~/.zeta/autoresearch/<encoded-project>.db). */
231
- export declare function getAutoresearchDbPath(encodedProject: string): string;
232
- /** Get the per-run artifact directory (~/.zeta/autoresearch/<encoded-project>/runs/<runId>). */
233
- export declare function getAutoresearchRunDir(encodedProject: string, runId: number): string;
234
- /** Get the security-analysis state directory (~/.zeta/security). */
235
- export declare function getSecurityDir(): string;
236
- /** Get one project's security-analysis state directory (~/.zeta/security/<project-key>). */
237
- export declare function getSecurityProjectDir(projectKey: string): string;
238
- /** Get the path to agent.db (SQLite database for settings and auth storage). */
239
- export declare function getAgentDbPath(agentDir?: string): string;
240
- /** Get the last-seen-changelog-version marker file (~/.zeta/agent/last-changelog-version). */
241
- export declare function getLastChangelogVersionPath(agentDir?: string): string;
242
- /** Get the path to history.db (SQLite database for session history). */
243
- export declare function getHistoryDbPath(agentDir?: string): string;
244
- /** Get the path to models.db (model cache database). */
245
- export declare function getModelDbPath(agentDir?: string): string;
246
- /** Get the tiny title model cache directory (~/.zeta/agent/cache/tiny-models). */
247
- export declare function getTinyModelsCacheDir(agentDir?: string): string;
248
- /** Get the document conversion cache directory (~/.zeta/agent/cache/document-conversions; XDG default: $XDG_CACHE_HOME/zeta/cache/document-conversions). */
249
- export declare function getDocumentConversionCacheDir(agentDir?: string): string;
250
- /** Get the per-project composer speculative cache directory (~/.zeta/agent/cache/composer; XDG default: $XDG_CACHE_HOME/zeta/cache/composer). */
251
- export declare function getComposerCacheDir(agentDir?: string): string;
252
- /** Get the sessions directory (~/.zeta/agent/sessions). */
253
- export declare function getSessionsDir(agentDir?: string): string;
254
- /** Get the content-addressed blob store directory (~/.zeta/agent/blobs). */
255
- export declare function getBlobsDir(agentDir?: string): string;
256
- /** Get the custom themes directory (~/.zeta/agent/themes). */
257
- export declare function getCustomThemesDir(agentDir?: string): string;
258
- /** Get the tools directory (~/.zeta/agent/tools). */
259
- export declare function getToolsDir(agentDir?: string): string;
260
- /** Get the slash commands directory (~/.zeta/agent/commands). */
261
- export declare function getCommandsDir(agentDir?: string): string;
262
- /** Get the prompts directory (~/.zeta/agent/prompts). */
263
- export declare function getPromptsDir(agentDir?: string): string;
264
- /** Get the user-level Python modules directory (~/.zeta/agent/modules). */
265
- export declare function getAgentModulesDir(agentDir?: string): string;
266
- /** Get the memories directory (~/.zeta/agent/memories). */
267
- export declare function getMemoriesDir(agentDir?: string): string;
268
- /** Get the terminal sessions directory (~/.zeta/agent/terminal-sessions). */
269
- export declare function getTerminalSessionsDir(agentDir?: string): string;
270
- /** Get the crash log path (~/.zeta/agent/omp-crash.log). */
271
- export declare function getCrashLogPath(agentDir?: string): string;
272
- /** Get the debug log path (~/.zeta/agent/omp-debug.log). */
273
- export declare function getDebugLogPath(agentDir?: string): string;
274
- /** Get the secret placeholder key path (~/.zeta/agent/secret-placeholder.key; XDG default: $XDG_STATE_HOME/zeta/secret-placeholder.key). Adopts a legacy key on first XDG resolution. */
275
- export declare function getSecretPlaceholderKeyPath(): string;
276
- /** Root directory containing every per-project daemon runtime scope (~/.zeta/run/daemons; XDG default: $XDG_STATE_HOME/zeta/run/daemons). */
277
- export declare function getDaemonRuntimeRoot(): string;
278
- /** Get the daemon runtime directory for a project (~/.zeta/run/daemons/<hash>; XDG default: $XDG_STATE_HOME/zeta/run/daemons/<hash>). */
279
- export declare function getDaemonRuntimeDir(projectDir: string): string;
280
- /** Root directory containing every machine-global daemon service scope. */
281
- export declare function getGlobalDaemonRuntimeRoot(): string;
282
- /** Get a profile-independent runtime directory for a machine-global daemon service. */
283
- export declare function getGlobalDaemonRuntimeDir(service: string): string;
284
- /** Get the provider in-flight root directory (~/.zeta/run/provider-inflight; XDG default: $XDG_STATE_HOME/zeta/run/provider-inflight). */
285
- export declare function getProviderInFlightRoot(): string;
286
- /** Get the marketplaces registry path (~/.zeta/marketplaces.json; XDG default: $XDG_DATA_HOME/zeta/marketplaces.json). Adopts a legacy registry on first XDG resolution. */
287
- export declare function getMarketplacesRegistryPath(): string;
288
- /** Get the project-level Python modules directory (.zeta/modules). */
289
- export declare function getProjectModulesDir(cwd?: string): string;
290
- /** Get the project-level prompts directory (.zeta/prompts). */
291
- export declare function getProjectPromptsDir(cwd?: string): string;
292
- /** Get the project-level plugin overrides path (.zeta/plugin-overrides.json). */
293
- export declare function getProjectPluginOverridesPath(cwd?: string): string;
294
- /** Get the primary MCP config file path (first candidate). */
295
- export declare function getMCPConfigPath(scope: "user" | "project", cwd?: string): string;
296
- /** Get the SSH config file path. */
297
- export declare function getSSHConfigPath(scope: "user" | "project", cwd?: string): string;
298
- /**
299
- * Application label for usage attribution (`OMP_APP_NAME`), defaulting to
300
- * `omp`. Embedders that drive omp programmatically (robomp, CI bots, …) set
301
- * the env var so broker-side per-client burn tracking can answer "what did
302
- * app X use" instead of folding everything into one install-wide bucket.
303
- */
304
- export declare function getAppName(): string;
305
- /**
306
- * Persistent per-install UUID stored at `~/.zeta/install-id`.
307
- *
308
- * Generated lazily on first call and persisted with `O_CREAT|O_EXCL` so
309
- * concurrent first-call races don't clobber each other (loser re-reads the
310
- * winner's id). Survives independently of agent state: deleting
311
- * `~/.zeta/agent/` does not regenerate it. Server-side dedup for grievance
312
- * pushes (and similar telemetry) keys on this id.
313
- *
314
- * Anchored to the base config root (`~/.zeta/install-id`) regardless of the
315
- * active profile: install identity is per-install, not per-profile, so every
316
- * profile shares one id and the global cache stays correct no matter the
317
- * profile / `getInstallId` call order.
318
- */
319
- export declare function getInstallId(): string;
320
- /** Test-only: clear cached install id. Never call from production code. */
321
- export declare function __resetInstallIdCacheForTests(): void;
322
- /** Get the project-level tracking directory (<project>/.zeta/tracking). */
323
- export declare function getProjectTrackingDir(cwd?: string): string;
324
- /** Get the global tracking index path (~/.zeta/agent/tracking-index.json). */
325
- export declare function getTrackingIndexPath(agentDir?: string): string;
@@ -1,46 +0,0 @@
1
- /** A mammoth-compatible diagnostic emitted while converting a document. */
2
- export interface DocxMessage {
3
- readonly type: "warning" | "error";
4
- readonly message: string;
5
- }
6
- /** The HTML and diagnostics produced by a DOCX conversion. */
7
- export interface DocxResult {
8
- readonly value: string;
9
- readonly messages: DocxMessage[];
10
- }
11
- /** An in-memory or filesystem DOCX input. */
12
- export type DocxInput = {
13
- readonly buffer: Uint8Array;
14
- readonly path?: never;
15
- } | {
16
- readonly path: string;
17
- readonly buffer?: never;
18
- };
19
- /** An image exposed to a custom image converter. */
20
- export interface DocxImage {
21
- readonly contentType: string;
22
- readonly altText: string;
23
- /** Read the image payload using mammoth's used encoding surface. */
24
- read(encoding: "base64"): Promise<string>;
25
- }
26
- /** HTML attributes returned by a custom image converter. */
27
- export type ImageAttributes = Readonly<Record<string, string>>;
28
- /** A callback that maps an embedded DOCX image to HTML attributes. */
29
- export type ImageAttributeConverter = (image: DocxImage) => ImageAttributes | Promise<ImageAttributes>;
30
- /** An image converter created by `images.imgElement`. */
31
- export interface ImageConverter {
32
- readonly convert: ImageAttributeConverter;
33
- }
34
- /** Options supported by the behavior-compatible DOCX converter. */
35
- export interface ConvertToHtmlOptions {
36
- readonly convertImage?: ImageConverter;
37
- readonly styleMap?: string | readonly string[];
38
- readonly includeDefaultStyleMap?: boolean;
39
- }
40
- /** Mammoth-shaped helpers for configuring embedded image conversion. */
41
- export declare const images: {
42
- /** Wrap an image-to-attributes callback for `convertToHtml`. */
43
- imgElement(convert: ImageAttributeConverter): ImageConverter;
44
- };
45
- /** Convert a DOCX buffer or path to mammoth-compatible HTML. */
46
- export declare function convertToHtml(input: DocxInput, options?: ConvertToHtmlOptions): Promise<DocxResult>;
@@ -1,26 +0,0 @@
1
- interface XmlText {
2
- readonly kind: "text";
3
- readonly value: string;
4
- }
5
- /** A minimal XML element used by the DOCX reader. */
6
- export interface XmlElement {
7
- readonly kind: "element";
8
- readonly name: string;
9
- readonly attributes: ReadonlyMap<string, string>;
10
- readonly children: readonly XmlNode[];
11
- }
12
- /** A node in the DOCX reader's minimal XML tree. */
13
- export type XmlNode = XmlElement | XmlText;
14
- /** Return the namespace-independent part of an XML qualified name. */
15
- export declare function localName(name: string): string;
16
- /** Parse XML into a small namespace-tolerant element tree. */
17
- export declare function parseXml(source: string): XmlElement;
18
- /** Return direct element children, optionally filtered by local name. */
19
- export declare function childElements(element: XmlElement, name?: string): XmlElement[];
20
- /** Return the first direct child with the given local name. */
21
- export declare function firstChild(element: XmlElement | undefined, name: string): XmlElement | undefined;
22
- /** Return an attribute by qualified or namespace-independent name. */
23
- export declare function attribute(element: XmlElement | undefined, name: string): string | undefined;
24
- /** Return all descendant elements with a given local name. */
25
- export declare function descendants(element: XmlElement, name: string): XmlElement[];
26
- export {};
@@ -1,11 +0,0 @@
1
- /** Behavior-compatible reimplementation of mammoth's used surface. */
2
- export { type ConvertToHtmlOptions, convertToHtml, type DocxImage, type DocxInput, type DocxMessage, type DocxResult, type ImageAttributeConverter, type ImageAttributes, type ImageConverter, images, } from "./docx/converter.js";
3
- import { convertToHtml } from "./docx/converter.js";
4
- /** Mammoth-shaped default export for drop-in consumer imports. */
5
- declare const docx: {
6
- convertToHtml: typeof convertToHtml;
7
- images: {
8
- imgElement(convert: import("./docx.js").ImageAttributeConverter): import("./docx.js").ImageConverter;
9
- };
10
- };
11
- export default docx;