fix(coding-agent): re-export compact from legacy pi shim
Legacy pi extensions import `compact` from the `@earendil-works/pi-coding-agent` package root (aliased to the legacy shim). It lives in `@oh-my-pi/pi-agent-core/compaction` (same module as the already-bridged `estimateTokens`) and the coding-agent barrel does not forward it, so the shim's `export * from "../index"` left it off the surface and a named import failed Bun's static export check during plugin validation (`omp plugin install npm:pi-claude-bridge`). `keyHint` (also named in the report) already resolves via the modes/components barrel, so only `compact` needed bridging. Fixes #7174
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `omp plugin install` failing extension validation for pi extensions that import `compact` from `@earendil-works/pi-coding-agent` (e.g. pi-claude-bridge) — the legacy `@oh-my-pi/pi-coding-agent` shim did not forward `compact` (it lives in `@oh-my-pi/pi-agent-core/compaction`, the same module as the already-bridged `estimateTokens`), so a named import threw Bun's static "Export named 'compact' not found" error. Added the missing `compact` re-export ([#7174](https://github.com/can1357/oh-my-pi/issues/7174)).
|
||||
|
||||
## [17.2.1] - 2026-07-30
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1416,11 +1416,11 @@ export function getPackageDir(): string {
|
||||
}
|
||||
|
||||
// Legacy pi's `@earendil-works/pi-coding-agent` re-exported `estimateTokens`
|
||||
// from its package root (via `./core/compaction/index.ts`). In omp it lives in
|
||||
// `@oh-my-pi/pi-agent-core/compaction`, and the coding-agent barrel below does
|
||||
// not forward it, so legacy extensions importing it fail Bun's static export
|
||||
// check during validation (issue #6583).
|
||||
export { estimateTokens } from "@oh-my-pi/pi-agent-core/compaction";
|
||||
// and `compact` from its package root (via `./core/compaction/index.ts`). In
|
||||
// omp both live in `@oh-my-pi/pi-agent-core/compaction`, and the coding-agent
|
||||
// barrel below does not forward them, so legacy extensions importing either
|
||||
// fail Bun's static export check during validation (issues #6583, #7174).
|
||||
export { compact, estimateTokens } from "@oh-my-pi/pi-agent-core/compaction";
|
||||
|
||||
// Same barrel gap for two more legacy package-root exports: pi re-exported the
|
||||
// `CONFIG_DIR_NAME` constant and the CLI parser `parseArgs`. In omp
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { estimateTokens } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-coding-agent-shim";
|
||||
import { compact, estimateTokens } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-coding-agent-shim";
|
||||
|
||||
// Issue #6583: pi extensions import `estimateTokens` from
|
||||
// `@earendil-works/pi-coding-agent`, which aliases to this shim. Legacy pi
|
||||
@@ -16,4 +16,12 @@ describe("legacy shim compaction helpers", () => {
|
||||
const tokens = estimateTokens({ role: "user", content: "hello world", timestamp: Date.now() });
|
||||
expect(tokens).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
// Issue #7174: `compact` (same `@oh-my-pi/pi-agent-core/compaction` module as
|
||||
// `estimateTokens`) was likewise absent from the shim surface, so
|
||||
// `omp plugin install npm:pi-claude-bridge` failed with "Export named
|
||||
// 'compact' not found". Pin the callable re-export.
|
||||
it("re-exports compact as a callable function", () => {
|
||||
expect(typeof compact).toBe("function");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user