@oh-my-pi/pi-utils 18.8.0 → 18.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.8.1] - 2026-10-07
6
+
7
+ ### Added
8
+
9
+ - Added `PI_NATIVES_DIR` support to `getNativesDir()` for configuring the native addon directory.
10
+ - Added `ZipPackage` for lazily reading ZIP-based document packages with a total decompressed-size limit, along with `DocxImage.readBytes()` for accessing raw DOCX image data.
11
+
5
12
  ## [18.8.0] - 2026-10-07
6
13
 
7
14
  ### Added
@@ -173,7 +173,7 @@ export declare function getRemoteDir(): string;
173
173
  * `worktree.base` setting in coding-agent; pass `undefined`/empty to clear and
174
174
  * fall back to `OMP_WORKTREE_DIR` or the `~/.omp/wt` default.
175
175
  *
176
- * `~` is expanded and a relative path is rejected (see {@link resolveWorktreeBase}).
176
+ * `~` is expanded and a relative path is rejected (see {@link resolveAbsoluteDir}).
177
177
  * Returns the absolute path that took effect, or `undefined` if the input was
178
178
  * cleared or rejected — callers can warn on a non-empty input that returns
179
179
  * `undefined`.
@@ -247,7 +247,7 @@ export declare function getAvatarCacheDir(): string;
247
247
  export declare function getFastembedCacheDir(): string;
248
248
  /** Get the on-demand fastembed runtime install root (~/.omp/cache/fastembed-runtime). */
249
249
  export declare function getFastembedRuntimeDir(): string;
250
- /** Get the natives directory (~/.omp/natives). */
250
+ /** Get the natives directory. PI_NATIVES_DIR overrides the usual cache root; relative values are ignored. */
251
251
  export declare function getNativesDir(): string;
252
252
  /** Get the stats database path (~/.omp/stats.db). */
253
253
  export declare function getStatsDbPath(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-utils",
3
- "version": "18.8.0",
3
+ "version": "18.8.1",
4
4
  "description": "Shared utilities for pi packages",
5
5
  "keywords": [
6
6
  "cli",
@@ -57,7 +57,7 @@
57
57
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
58
58
  },
59
59
  "dependencies": {
60
- "@oh-my-pi/pi-natives": "18.8.0"
60
+ "@oh-my-pi/pi-natives": "18.8.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/bun": "^1.3.14"
package/src/dirs.ts CHANGED
@@ -697,12 +697,14 @@ export function getRemoteDir(): string {
697
697
  * Expand a leading `~` and require an absolute result. Returns `undefined` for
698
698
  * empty/whitespace input or a path that is still relative after expansion.
699
699
  *
700
- * A worktree base is process-global and consumed by both creation
701
- * (PR checkout, task isolation) and cleanup (`omp worktree`). A relative value
702
- * would resolve against whatever cwd happened to launch `omp`, so checkout and
703
- * cleanup could disagree — we refuse it rather than silently bind it to cwd.
700
+ * Worktree bases and the natives directory are process-global: a worktree base
701
+ * is consumed by both creation (PR checkout, task isolation) and cleanup
702
+ * (`omp worktree`), and every launch extracts or loads the native addon from
703
+ * the same natives directory. A relative value would resolve against whatever
704
+ * cwd happened to launch `omp`, so those readers could disagree — we refuse it
705
+ * rather than silently bind it to cwd.
704
706
  */
705
- function resolveWorktreeBase(value: string | undefined): string | undefined {
707
+ function resolveAbsoluteDir(value: string | undefined): string | undefined {
706
708
  const trimmed = value?.trim();
707
709
  if (!trimmed) return undefined;
708
710
  let p = trimmed;
@@ -719,13 +721,13 @@ let worktreesDirOverride: string | undefined;
719
721
  * `worktree.base` setting in coding-agent; pass `undefined`/empty to clear and
720
722
  * fall back to `OMP_WORKTREE_DIR` or the `~/.omp/wt` default.
721
723
  *
722
- * `~` is expanded and a relative path is rejected (see {@link resolveWorktreeBase}).
724
+ * `~` is expanded and a relative path is rejected (see {@link resolveAbsoluteDir}).
723
725
  * Returns the absolute path that took effect, or `undefined` if the input was
724
726
  * cleared or rejected — callers can warn on a non-empty input that returns
725
727
  * `undefined`.
726
728
  */
727
729
  export function setWorktreesDir(dir: string | undefined): string | undefined {
728
- worktreesDirOverride = resolveWorktreeBase(dir);
730
+ worktreesDirOverride = resolveAbsoluteDir(dir);
729
731
  return worktreesDirOverride;
730
732
  }
731
733
 
@@ -737,7 +739,7 @@ export function setWorktreesDir(dir: string | undefined): string | undefined {
737
739
  * ignored and resolution falls through.
738
740
  */
739
741
  export function getWorktreesDir(): string {
740
- return resolveWorktreeBase(process.env.OMP_WORKTREE_DIR) ?? worktreesDirOverride ?? dirs.rootSubdir("wt", "data");
742
+ return resolveAbsoluteDir(process.env.OMP_WORKTREE_DIR) ?? worktreesDirOverride ?? dirs.rootSubdir("wt", "data");
741
743
  }
742
744
 
743
745
  /** Get the SSH control socket directory (~/.omp/ssh-control). */
@@ -863,9 +865,9 @@ export function getFastembedRuntimeDir(): string {
863
865
  return dirs.rootSubdir(path.join("cache", "fastembed-runtime"), "cache");
864
866
  }
865
867
 
866
- /** Get the natives directory (~/.omp/natives). */
868
+ /** Get the natives directory. PI_NATIVES_DIR overrides the usual cache root; relative values are ignored. */
867
869
  export function getNativesDir(): string {
868
- return dirs.rootSubdir("natives", "cache");
870
+ return resolveAbsoluteDir(process.env.PI_NATIVES_DIR) ?? dirs.rootSubdir("natives", "cache");
869
871
  }
870
872
 
871
873
  /** Get the stats database path (~/.omp/stats.db). */