pi-smart-compact 7.18.1 → 7.18.2
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 +5 -0
- package/dist/constants.d.ts +1 -1
- package/dist/index.js +14 -4
- package/dist/infra/llm-client.d.ts +2 -19
- package/dist/infra/llm-client.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [7.18.2] - 2026-07-09
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Extension load failure after 7.18.1** — 7.18.1 imported `complete` from the `@earendil-works/pi-ai/compat` subpath statically, which is not aliased by some host builds and crashed the extension at load time (`Cannot find module .../dist/index.js/compat`). `complete` is now resolved with a dynamic `import("@earendil-works/pi-ai/compat")` on first use, which is aliased by the host loader and resolves directly in raw node — works in both host and test contexts, and can never break extension loading.
|
|
7
|
+
|
|
3
8
|
## [7.18.1] - 2026-07-09
|
|
4
9
|
|
|
5
10
|
### Fixed
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { CompressionProfile, ProfileConfig } from "./types.ts";
|
|
|
8
8
|
* `package.json#version`. Do not hand-edit this line for releases; bump
|
|
9
9
|
* package.json and run `bun run sync-version`.
|
|
10
10
|
*/
|
|
11
|
-
export declare const VERSION = "7.18.
|
|
11
|
+
export declare const VERSION = "7.18.2";
|
|
12
12
|
export declare const CHARS_PER_TOKEN = 3.8;
|
|
13
13
|
export declare const COMPACT_SYSTEM_PREFIX: string;
|
|
14
14
|
export declare const PROFILES: Record<CompressionProfile, ProfileConfig>;
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,10 @@ var __export = (target, all) => {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
var __require = import.meta.require;
|
|
17
18
|
|
|
18
19
|
// src/constants.ts
|
|
19
|
-
var VERSION = "7.18.
|
|
20
|
+
var VERSION = "7.18.2", CHARS_PER_TOKEN = 3.8, COMPACT_SYSTEM_PREFIX, PROFILES, DEFAULT_CONFIG, NO_OP_RE, SHIFT_RE, CHOICE_RE, SINGLE_PASS_PREFIX, SINGLE_PASS_SUFFIX = `
|
|
20
21
|
{PREV_CONTEXT}
|
|
21
22
|
|
|
22
23
|
{EXTRACTION_CONTEXT}
|
|
@@ -737,15 +738,24 @@ var init_llm_retry = __esm(() => {
|
|
|
737
738
|
});
|
|
738
739
|
|
|
739
740
|
// src/infra/llm-client.ts
|
|
740
|
-
|
|
741
|
+
async function resolveComplete() {
|
|
742
|
+
if (_complete)
|
|
743
|
+
return _complete;
|
|
744
|
+
const mod = await import("@earendil-works/pi-ai/compat");
|
|
745
|
+
const fn = mod.complete;
|
|
746
|
+
if (typeof fn !== "function")
|
|
747
|
+
throw new Error("smart-compact: pi-ai /compat did not export complete()");
|
|
748
|
+
_complete = fn;
|
|
749
|
+
return fn;
|
|
750
|
+
}
|
|
741
751
|
function getLlmClient() {
|
|
742
752
|
return _client;
|
|
743
753
|
}
|
|
744
|
-
var rawLlmClient, defaultLlmClient, _client;
|
|
754
|
+
var _complete = null, rawLlmClient, defaultLlmClient, _client;
|
|
745
755
|
var init_llm_client = __esm(() => {
|
|
746
756
|
init_llm_retry();
|
|
747
757
|
rawLlmClient = {
|
|
748
|
-
complete: (model, body, opts) =>
|
|
758
|
+
complete: async (model, body, opts) => (await resolveComplete())(model, body, opts)
|
|
749
759
|
};
|
|
750
760
|
defaultLlmClient = withRetry(rawLlmClient);
|
|
751
761
|
_client = defaultLlmClient;
|
|
@@ -8,24 +8,6 @@
|
|
|
8
8
|
* metrics test path to the peer dependency, which made `bun test` fail
|
|
9
9
|
* when the peer was not installed.
|
|
10
10
|
*
|
|
11
|
-
* pi-ai 0.80 removed the standalone `complete()`/`stream()` from the package
|
|
12
|
-
* root and moved them to the `/compat` subpath. We import from `/compat`
|
|
13
|
-
* deliberately, NOT from `createModels()` + provider factories:
|
|
14
|
-
*
|
|
15
|
-
* - This is a Pi *extension*. The host (pi-coding-agent) owns model/auth
|
|
16
|
-
* management via `ctx.modelRegistry` (a `ModelRegistry`), which resolves
|
|
17
|
-
* auth but exposes no `.complete()`. The host itself imports its types
|
|
18
|
-
* from `@earendil-works/pi-ai/compat`.
|
|
19
|
-
* - `createModels()` would build a *second* registry that bypasses the
|
|
20
|
-
* host's `ctx.modelRegistry` and its auth — wrong for an extension.
|
|
21
|
-
* - pi-ai's "avoid /compat" advice targets standalone bundled apps, not
|
|
22
|
-
* host-managed extensions.
|
|
23
|
-
*
|
|
24
|
-
* The whole pi-coding-agent ecosystem (host + extensions) sits on `/compat`
|
|
25
|
-
* until the host finishes its ModelManager migration. The compat surface is
|
|
26
|
-
* pinned to this one file: when the host eventually offers completion on the
|
|
27
|
-
* context, change only the import + the call on line ~42 below.
|
|
28
|
-
*
|
|
29
11
|
* - Test fakes need to assert which `phase` was used, control failures, and
|
|
30
12
|
* return synthetic usage tokens for calibration tests.
|
|
31
13
|
*
|
|
@@ -37,7 +19,8 @@
|
|
|
37
19
|
*
|
|
38
20
|
* The default implementation (`defaultLlmClient`) calls `complete()` from
|
|
39
21
|
* pi-ai. `setLlmClient` is exposed for tests and for callers that wish to
|
|
40
|
-
* inject a wrapping/fallback client at extension boot.
|
|
22
|
+
* inject a wrapping/fallback client at extension boot. See `resolveComplete`
|
|
23
|
+
* below for how `complete` is obtained under the host's compat aliasing.
|
|
41
24
|
*/
|
|
42
25
|
import type { Model, Api, AssistantMessage, Context, ProviderStreamOptions } from "@earendil-works/pi-ai";
|
|
43
26
|
export interface LlmClient {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-client.d.ts","sourceRoot":"","sources":["../../src/infra/llm-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"llm-client.d.ts","sourceRoot":"","sources":["../../src/infra/llm-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA2B1G,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpG;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,EAAE,SAE1B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAmC,CAAC;AAInE,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAEpD;AAED,wFAAwF;AACxF,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-smart-compact",
|
|
3
|
-
"version": "7.18.
|
|
3
|
+
"version": "7.18.2",
|
|
4
4
|
"description": "Verification-oriented smart compaction extension for Pi Coding Agent — deterministic extraction, exploration, synthesis, verification, metrics, and safety checks.",
|
|
5
5
|
"packageManager": "bun@1.3.14",
|
|
6
6
|
"license": "MIT",
|