pi-smart-compact 7.13.0 → 7.13.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 +19 -0
- package/README.md +58 -13
- package/SECURITY.md +28 -0
- package/SUPPORT.md +17 -0
- package/dist/app/explore-wrap.d.ts +8 -0
- package/dist/app/explore-wrap.d.ts.map +1 -0
- package/dist/app/run-context.d.ts +196 -0
- package/dist/app/run-context.d.ts.map +1 -0
- package/dist/app/run-smart-compact.d.ts +69 -0
- package/dist/app/run-smart-compact.d.ts.map +1 -0
- package/dist/app/steps/extract.d.ts +21 -0
- package/dist/app/steps/extract.d.ts.map +1 -0
- package/dist/app/steps/metrics.d.ts +33 -0
- package/dist/app/steps/metrics.d.ts.map +1 -0
- package/dist/app/steps/persist.d.ts +47 -0
- package/dist/app/steps/persist.d.ts.map +1 -0
- package/dist/app/steps/prepare.d.ts +12 -0
- package/dist/app/steps/prepare.d.ts.map +1 -0
- package/dist/app/steps/recover.d.ts +13 -0
- package/dist/app/steps/recover.d.ts.map +1 -0
- package/dist/app/steps/state.d.ts +13 -0
- package/dist/app/steps/state.d.ts.map +1 -0
- package/dist/app/steps/synthesize.d.ts +22 -0
- package/dist/app/steps/synthesize.d.ts.map +1 -0
- package/dist/app/steps/tier.d.ts +12 -0
- package/dist/app/steps/tier.d.ts.map +1 -0
- package/dist/app/steps/verify.d.ts +19 -0
- package/dist/app/steps/verify.d.ts.map +1 -0
- package/dist/app/steps/window.d.ts +18 -0
- package/dist/app/steps/window.d.ts.map +1 -0
- package/dist/constants.d.ts +11 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/domain/summary-parse.d.ts +50 -0
- package/dist/domain/summary-parse.d.ts.map +1 -0
- package/dist/domain/summary-schema.d.ts +49 -0
- package/dist/domain/summary-schema.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4647 -3564
- package/dist/infra/clock.d.ts +13 -0
- package/dist/infra/clock.d.ts.map +1 -0
- package/dist/infra/fs.d.ts +57 -0
- package/dist/infra/fs.d.ts.map +1 -0
- package/dist/infra/git.d.ts +17 -0
- package/dist/infra/git.d.ts.map +1 -0
- package/dist/infra/llm-client.d.ts +42 -0
- package/dist/infra/llm-client.d.ts.map +1 -0
- package/dist/infra/llm-retry.d.ts +46 -0
- package/dist/infra/llm-retry.d.ts.map +1 -0
- package/dist/infra/paths.d.ts +46 -0
- package/dist/infra/paths.d.ts.map +1 -0
- package/dist/infra/services.d.ts +111 -0
- package/dist/infra/services.d.ts.map +1 -0
- package/dist/phases/explore.d.ts +15 -3
- package/dist/phases/explore.d.ts.map +1 -1
- package/dist/phases/synthesize.d.ts +4 -3
- package/dist/phases/synthesize.d.ts.map +1 -1
- package/dist/phases/verify.d.ts +18 -2
- package/dist/phases/verify.d.ts.map +1 -1
- package/dist/types.d.ts +42 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/overlays.d.ts +2 -1
- package/dist/ui/overlays.d.ts.map +1 -1
- package/dist/utils/cache.d.ts +41 -13
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/damage.d.ts.map +1 -1
- package/dist/utils/extraction.d.ts +11 -1
- package/dist/utils/extraction.d.ts.map +1 -1
- package/dist/utils/fingerprint.d.ts +7 -0
- package/dist/utils/fingerprint.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts +2 -0
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/id-fingerprint.d.ts +52 -0
- package/dist/utils/id-fingerprint.d.ts.map +1 -0
- package/dist/utils/pruning.d.ts +17 -1
- package/dist/utils/pruning.d.ts.map +1 -1
- package/dist/utils/session-log.d.ts.map +1 -1
- package/dist/utils/state.d.ts +18 -1
- package/dist/utils/state.d.ts.map +1 -1
- package/dist/utils/tokens.d.ts +30 -2
- package/dist/utils/tokens.d.ts.map +1 -1
- package/dist/utils/type-guards.d.ts +22 -0
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/docs/RELEASE.md +40 -0
- package/docs/assets/pi-smart-compact.png +0 -0
- package/package.json +14 -3
- package/dist/core.d.ts +0 -31
- package/dist/core.d.ts.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clock abstraction.
|
|
3
|
+
*
|
|
4
|
+
* Most callers want `Date.now()` directly, but `runSmartCompact` and the
|
|
5
|
+
* pendingRef lifecycle compare timestamps in tight windows (TTL, timeouts,
|
|
6
|
+
* cache freshness). Routing every `Date.now()` through a Clock makes those
|
|
7
|
+
* paths deterministic in tests and reusable across services.
|
|
8
|
+
*/
|
|
9
|
+
export interface Clock {
|
|
10
|
+
now(): number;
|
|
11
|
+
}
|
|
12
|
+
export declare const systemClock: Clock;
|
|
13
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/infra/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,KAAK;IACpB,GAAG,IAAI,MAAM,CAAC;CACf;AAED,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem primitives with atomic-write and lock semantics.
|
|
3
|
+
*
|
|
4
|
+
* Why this module exists:
|
|
5
|
+
*
|
|
6
|
+
* - Several disk writes (extraction cache, project fingerprint, compaction
|
|
7
|
+
* state, metrics dashboard) used `fs.writeFileSync` directly. A process
|
|
8
|
+
* crash mid-write leaves the JSON half-truncated, and the next load throws
|
|
9
|
+
* on `JSON.parse`. We now write to `<file>.tmp.<pid>.<rand>` then rename,
|
|
10
|
+
* so readers either see the previous payload or the new one — never both.
|
|
11
|
+
*
|
|
12
|
+
* - The append-only metrics log was written with `appendFileSync`. Multiple
|
|
13
|
+
* pi sessions writing concurrently could interleave bytes mid-line and
|
|
14
|
+
* produce a single corrupted JSON record. We hold a short-lived file lock
|
|
15
|
+
* while opening and appending, so contiguous lines stay intact.
|
|
16
|
+
*
|
|
17
|
+
* - Several pieces of code re-checked `existsSync` then `mkdirSync`. The
|
|
18
|
+
* `ensureDir` helper deduplicates that pattern.
|
|
19
|
+
*
|
|
20
|
+
* Sync vs async:
|
|
21
|
+
* - The extension runs inside the pi event loop. The hot path through
|
|
22
|
+
* `runSmartCompact` already does many sync FS calls; turning every helper
|
|
23
|
+
* into async would balloon the diff. We expose both shapes:
|
|
24
|
+
* `atomicWriteFileSync` for the existing call sites (kept simple) and
|
|
25
|
+
* `atomicWriteFile` for new async-friendly callers (background metrics).
|
|
26
|
+
*
|
|
27
|
+
* Lock files are best-effort; they prevent the common case (two pi sessions
|
|
28
|
+
* appending at once) without introducing a hard dependency. If a stale lock
|
|
29
|
+
* sticks around for >5s we ignore it.
|
|
30
|
+
*/
|
|
31
|
+
/** Ensure a directory exists, ignoring EEXIST races. */
|
|
32
|
+
export declare function ensureDir(dir: string): void;
|
|
33
|
+
export declare function ensureDirAsync(dir: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Atomically write a file: write to a sibling temp file, fsync (best effort),
|
|
36
|
+
* then rename. If anything fails mid-write the original file is preserved.
|
|
37
|
+
*/
|
|
38
|
+
export declare function atomicWriteFileSync(target: string, data: string | Uint8Array): void;
|
|
39
|
+
export declare function atomicWriteFile(target: string, data: string | Uint8Array): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Acquire a coarse-grained lock by creating a `<file>.lock` directory.
|
|
42
|
+
* `mkdir` is atomic on every reasonable filesystem, which is exactly what we
|
|
43
|
+
* need for a multi-process advisory lock without depending on `flock`.
|
|
44
|
+
*
|
|
45
|
+
* The lock is best-effort: if it stays held for longer than LOCK_STALE_MS we
|
|
46
|
+
* assume the owning process crashed and reclaim it. Callers should always
|
|
47
|
+
* release through the returned function.
|
|
48
|
+
*/
|
|
49
|
+
export declare function acquireLockSync(target: string): () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Append a single line of text under a coarse lock. The newline is appended if
|
|
52
|
+
* `line` does not already end with one.
|
|
53
|
+
*/
|
|
54
|
+
export declare function appendLineLocked(target: string, line: string): void;
|
|
55
|
+
export declare function readJsonSync<T>(target: string): T | null;
|
|
56
|
+
export declare function writeJsonSync(target: string, value: unknown, pretty?: boolean): void;
|
|
57
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/infra/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAYH,wDAAwD;AACxD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ3C;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAWnF;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAU9F;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,CAwC1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAQnE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CASxD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAQ,GAAG,IAAI,CAElF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git root resolver with a cwd-keyed cache.
|
|
3
|
+
*
|
|
4
|
+
* `runSmartCompact` calls `findGitRoot(ctx.cwd)` once per run. Each call shells
|
|
5
|
+
* out via `execSync("git rev-parse --show-toplevel")`, which blocks the event
|
|
6
|
+
* loop for ~5-25ms on typical machines. Under auto-trigger this fires on every
|
|
7
|
+
* compaction. Caching by cwd is safe because the git root for a given cwd
|
|
8
|
+
* never changes within an extension process lifetime, and the cache only holds
|
|
9
|
+
* a few entries per session.
|
|
10
|
+
*
|
|
11
|
+
* Non-git directories are also cached (null result) so we don't re-shell out
|
|
12
|
+
* for every single invocation in a non-repo directory.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findGitRoot(cwd: string): string | null;
|
|
15
|
+
/** Test helper — clears the cache between runs. */
|
|
16
|
+
export declare function _resetGitRootCacheForTests(): void;
|
|
17
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/infra/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAatD;AAED,mDAAmD;AACnD,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM client seam.
|
|
3
|
+
*
|
|
4
|
+
* Why we have a seam at all:
|
|
5
|
+
*
|
|
6
|
+
* - `complete` from `@earendil-works/pi-ai` is the *only* runtime entry point
|
|
7
|
+
* into a model. Importing it directly from utility modules tied even the
|
|
8
|
+
* metrics test path to the peer dependency, which made `bun test` fail
|
|
9
|
+
* when the peer was not installed.
|
|
10
|
+
*
|
|
11
|
+
* - Test fakes need to assert which `phase` was used, control failures, and
|
|
12
|
+
* return synthetic usage tokens for calibration tests.
|
|
13
|
+
*
|
|
14
|
+
* - Future provider fallback work (per `implement-llm-provider-fallback`)
|
|
15
|
+
* becomes a single-file change instead of a cross-module refactor.
|
|
16
|
+
*
|
|
17
|
+
* The interface is intentionally narrow: a single `complete()` method matching
|
|
18
|
+
* the pi-ai shape, plus the same options object existing callers already pass.
|
|
19
|
+
*
|
|
20
|
+
* The default implementation (`defaultLlmClient`) calls `complete()` from
|
|
21
|
+
* pi-ai. `setLlmClient` is exposed for tests and for callers that wish to
|
|
22
|
+
* inject a wrapping/fallback client at extension boot.
|
|
23
|
+
*/
|
|
24
|
+
import type { Model, Api, AssistantMessage, Context, ProviderStreamOptions } from "@earendil-works/pi-ai";
|
|
25
|
+
export interface LlmClient {
|
|
26
|
+
complete(model: Model<Api>, body: Context, opts: ProviderStreamOptions): Promise<AssistantMessage>;
|
|
27
|
+
}
|
|
28
|
+
/** Raw client — direct pass-through to pi-ai. Tests can install this to skip retries. */
|
|
29
|
+
export declare const rawLlmClient: LlmClient;
|
|
30
|
+
/**
|
|
31
|
+
* Production default: pi-ai wrapped with the retry/backoff policy from
|
|
32
|
+
* `llm-retry.ts`. The wrapper is transparent on the happy path — the first
|
|
33
|
+
* `complete()` call goes straight through — but on a 429 or transient 5xx it
|
|
34
|
+
* backs off exponentially with jitter so we don't waste an entire compaction
|
|
35
|
+
* run on a single rate-limit blip.
|
|
36
|
+
*/
|
|
37
|
+
export declare const defaultLlmClient: LlmClient;
|
|
38
|
+
export declare function getLlmClient(): LlmClient;
|
|
39
|
+
export declare function setLlmClient(client: LlmClient): void;
|
|
40
|
+
/** Restore the production client. Tests should always pair `setLlmClient` with this. */
|
|
41
|
+
export declare function resetLlmClient(): void;
|
|
42
|
+
//# sourceMappingURL=llm-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-client.d.ts","sourceRoot":"","sources":["../../src/infra/llm-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI1G,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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrying LLM client wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Smart-compact issues several LLM calls per run (probe + explore loop +
|
|
5
|
+
* batch synthesis + assembly + optional patch). Without a retry layer a
|
|
6
|
+
* single 429 from a rate-limited provider — or a transient 5xx during a
|
|
7
|
+
* provider hiccup — aborts the whole pipeline and forces Pi back to native
|
|
8
|
+
* compact. That's the worst possible outcome: native compact discards all of
|
|
9
|
+
* our verification, deterministic extraction, and damage detection.
|
|
10
|
+
*
|
|
11
|
+
* This wrapper preserves the `LlmClient` interface so the rest of the code
|
|
12
|
+
* doesn't know it exists. It only adds behaviour on the failure path:
|
|
13
|
+
*
|
|
14
|
+
* - 429 (rate limit) / 5xx / network → exponential backoff with jitter,
|
|
15
|
+
* respecting `Retry-After` when the provider supplied one.
|
|
16
|
+
* - 4xx other than 408/425/429 → fail fast (bad auth, bad request — no
|
|
17
|
+
* point retrying).
|
|
18
|
+
* - AbortSignal aborts → propagate immediately, no retry.
|
|
19
|
+
*
|
|
20
|
+
* Number of retries and base delay come from `RetryPolicy`. Defaults are
|
|
21
|
+
* tuned for the synthesis batch path: 2 retries (3 attempts total) with
|
|
22
|
+
* 500ms base delay covers >95% of transient rate limits without bloating
|
|
23
|
+
* latency on the happy path.
|
|
24
|
+
*
|
|
25
|
+
* We do NOT retry on `tool_call_id is not found` or other model-side
|
|
26
|
+
* structural errors — they always reproduce. The classifier below handles
|
|
27
|
+
* the common shapes; anything unrecognized retries once at most.
|
|
28
|
+
*/
|
|
29
|
+
import type { LlmClient } from "./llm-client.ts";
|
|
30
|
+
export interface RetryPolicy {
|
|
31
|
+
/** Total attempts including the first try (e.g. 3 = first + 2 retries). */
|
|
32
|
+
maxAttempts: number;
|
|
33
|
+
/** Base backoff in ms; actual delay is base * 2^(attempt-1) with jitter. */
|
|
34
|
+
baseDelayMs: number;
|
|
35
|
+
/** Cap on backoff to avoid waiting forever on a hot loop. */
|
|
36
|
+
maxDelayMs: number;
|
|
37
|
+
/** Multiplier applied to `Retry-After` hints from providers (1 = honor verbatim). */
|
|
38
|
+
retryAfterMultiplier: number;
|
|
39
|
+
}
|
|
40
|
+
export declare const DEFAULT_RETRY_POLICY: RetryPolicy;
|
|
41
|
+
/**
|
|
42
|
+
* Wrap an LlmClient with retry semantics. Returns a new client that delegates
|
|
43
|
+
* to the underlying one and retries transient failures according to `policy`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function withRetry(inner: LlmClient, policy?: RetryPolicy): LlmClient;
|
|
46
|
+
//# sourceMappingURL=llm-retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-retry.d.ts","sourceRoot":"","sources":["../../src/infra/llm-retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,EAAE,WAKlC,CAAC;AAqEF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,GAAE,WAAkC,GAAG,SAAS,CA4BjG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized filesystem path resolution.
|
|
3
|
+
*
|
|
4
|
+
* Every disk-bound subsystem in the extension (extraction cache, metrics log,
|
|
5
|
+
* project fingerprints, compaction state, damage reports, backups, session
|
|
6
|
+
* logs) used to compute its own `path.join(process.env.HOME …)` on every call.
|
|
7
|
+
* That made it impossible to:
|
|
8
|
+
*
|
|
9
|
+
* - test path layout deterministically (HOME changes per test, but module
|
|
10
|
+
* state captured an old HOME),
|
|
11
|
+
* - swap roots in worktree / CI scenarios,
|
|
12
|
+
* - reason about file ownership when adding atomic writes and locking.
|
|
13
|
+
*
|
|
14
|
+
* This module is intentionally **stateless**: every function reads
|
|
15
|
+
* `process.env.HOME` at call time. That way tests can override HOME in
|
|
16
|
+
* `beforeEach` and the next call sees the new root.
|
|
17
|
+
*/
|
|
18
|
+
/** Root pi agent directory (`~/.pi/agent`). */
|
|
19
|
+
export declare function piAgentDir(): string;
|
|
20
|
+
/** Shared cache root (`~/.pi/agent/.cache`). */
|
|
21
|
+
export declare function cacheDir(): string;
|
|
22
|
+
/** Smart-compact specific cache root (`~/.pi/agent/.cache/smart-compact`). */
|
|
23
|
+
export declare function smartCompactCacheDir(): string;
|
|
24
|
+
/** Project fingerprint directory. */
|
|
25
|
+
export declare function projectFingerprintDir(): string;
|
|
26
|
+
/** Compaction state directory. */
|
|
27
|
+
export declare function compactionStateDir(): string;
|
|
28
|
+
/** Pi-coding-agent session log directory. */
|
|
29
|
+
export declare function sessionsDir(): string;
|
|
30
|
+
/** Pi-coding-agent settings file. */
|
|
31
|
+
export declare function settingsFile(): string;
|
|
32
|
+
/** Default backup directory. */
|
|
33
|
+
export declare function defaultBackupDir(): string;
|
|
34
|
+
/** Metrics JSONL log. */
|
|
35
|
+
export declare function metricsLogFile(): string;
|
|
36
|
+
/** Damage reports JSONL log. */
|
|
37
|
+
export declare function damageReportsFile(): string;
|
|
38
|
+
/** Extraction cache file for a given session. */
|
|
39
|
+
export declare function extractionCacheFile(sessionId: string): string;
|
|
40
|
+
/** Project fingerprint file for a given project id. */
|
|
41
|
+
export declare function projectFingerprintFile(projectId: string): string;
|
|
42
|
+
/** Compaction state file for a given project id. */
|
|
43
|
+
export declare function compactionStateFile(projectId: string): string;
|
|
44
|
+
/** HTML metrics dashboard file. */
|
|
45
|
+
export declare function metricsDashboardFile(): string;
|
|
46
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/infra/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,+CAA+C;AAC/C,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,gDAAgD;AAChD,wBAAgB,QAAQ,IAAI,MAAM,CAEjC;AAED,8EAA8E;AAC9E,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,qCAAqC;AACrC,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,kCAAkC;AAClC,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,qCAAqC;AACrC,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,gCAAgC;AAChC,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,yBAAyB;AACzB,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,gCAAgC;AAChC,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,iDAAiD;AACjD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,uDAAuD;AACvD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,oDAAoD;AACpD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service container — the dependency-injection backbone for one
|
|
3
|
+
* `runSmartCompact` invocation.
|
|
4
|
+
*
|
|
5
|
+
* Background: the original codebase relied on module-level mutable singletons
|
|
6
|
+
* for everything that needed cross-call state — the metrics array in
|
|
7
|
+
* `cache.ts`, `_toolSupportCache` in `explore.ts`, the config cache in
|
|
8
|
+
* `helpers.ts`, the calibration map in `tokens.ts`. Each singleton is
|
|
9
|
+
* convenient on the happy path but breaks down once you run two pi sessions
|
|
10
|
+
* simultaneously or write tests that need isolation:
|
|
11
|
+
*
|
|
12
|
+
* - `_metrics` is shared across sessions, so one session's summary
|
|
13
|
+
* reset wipes another's in-flight call record.
|
|
14
|
+
* - `_toolSupportCache` carries TTL'd state into every test run; a flaky
|
|
15
|
+
* test that toggles tool support leaks into the next describe block.
|
|
16
|
+
* - Hot path metrics writes contend on the same array indices.
|
|
17
|
+
*
|
|
18
|
+
* The `SmartCompactServices` bag fixes this by giving every run its own
|
|
19
|
+
* services instance. The container is intentionally narrow — only things that
|
|
20
|
+
* (a) hold state across calls *within* a run, or (b) are worth swapping out in
|
|
21
|
+
* tests, live here.
|
|
22
|
+
*
|
|
23
|
+
* Services that are stateless or already inject through their own seam
|
|
24
|
+
* (`LlmClient`, `Clock`, file system helpers in `infra/fs.ts`) are exposed via
|
|
25
|
+
* the container for convenience but never mutated through it.
|
|
26
|
+
*/
|
|
27
|
+
import type { Clock } from "./clock.ts";
|
|
28
|
+
import type { LlmClient } from "./llm-client.ts";
|
|
29
|
+
import type { LLMCallMetric } from "../types.ts";
|
|
30
|
+
import { TokenCalibrationStore } from "../utils/tokens.ts";
|
|
31
|
+
/**
|
|
32
|
+
* In-memory cache for "does this provider support tools?".
|
|
33
|
+
*
|
|
34
|
+
* Used by `explore.ts` to avoid the 1-tool probe call on every compaction.
|
|
35
|
+
* Per-run isolation matters because:
|
|
36
|
+
* - Tests can spin up a fake provider that toggles support without bleeding
|
|
37
|
+
* into other tests.
|
|
38
|
+
* - A provider may temporarily drop tool support during an outage; per-run
|
|
39
|
+
* scoping bounds how long we cache a stale negative.
|
|
40
|
+
*
|
|
41
|
+
* TTL: 1 hour, matching the previous singleton's behaviour.
|
|
42
|
+
*/
|
|
43
|
+
export declare class ToolSupportCache {
|
|
44
|
+
private readonly entries;
|
|
45
|
+
private readonly ttlMs;
|
|
46
|
+
constructor(ttlMs?: number);
|
|
47
|
+
/** Returns the cached value if fresh, or undefined to force a probe. */
|
|
48
|
+
get(key: string, now: number): boolean | undefined;
|
|
49
|
+
set(key: string, value: boolean, now: number): void;
|
|
50
|
+
/** Snapshot for debug logging; safe to call from anywhere. */
|
|
51
|
+
size(): number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Per-run metrics sink.
|
|
55
|
+
*
|
|
56
|
+
* Caps at `maxEntries` and trims from the front so a runaway test or a long
|
|
57
|
+
* batch synthesis doesn't grow unbounded. `summary()` is O(n) but n is bounded
|
|
58
|
+
* by `maxEntries`, so it's safe to call from the result screen.
|
|
59
|
+
*/
|
|
60
|
+
export declare class MetricsSink {
|
|
61
|
+
private readonly buf;
|
|
62
|
+
private readonly maxEntries;
|
|
63
|
+
constructor(maxEntries?: number);
|
|
64
|
+
record(metric: LLMCallMetric): void;
|
|
65
|
+
snapshot(): LLMCallMetric[];
|
|
66
|
+
clear(): void;
|
|
67
|
+
summary(): {
|
|
68
|
+
totalCalls: number;
|
|
69
|
+
totalInput: number;
|
|
70
|
+
totalOutput: number;
|
|
71
|
+
totalCacheHit: number;
|
|
72
|
+
avgLatency: number;
|
|
73
|
+
cacheHitRate: number;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Per-run extraction cache stats.
|
|
78
|
+
*
|
|
79
|
+
* Tracks hits vs misses on `loadCachedExtraction`. Surfaced into the metrics
|
|
80
|
+
* dashboard so we can tune the prefix-match tolerance over time.
|
|
81
|
+
*/
|
|
82
|
+
export declare class ExtractionCacheStats {
|
|
83
|
+
private hits;
|
|
84
|
+
private misses;
|
|
85
|
+
recordHit(): void;
|
|
86
|
+
recordMiss(): void;
|
|
87
|
+
snapshot(): {
|
|
88
|
+
hits: number;
|
|
89
|
+
misses: number;
|
|
90
|
+
hitRate: number;
|
|
91
|
+
};
|
|
92
|
+
clear(): void;
|
|
93
|
+
}
|
|
94
|
+
/** The full per-run service bag. */
|
|
95
|
+
export interface SmartCompactServices {
|
|
96
|
+
clock: Clock;
|
|
97
|
+
llm: LlmClient;
|
|
98
|
+
toolSupport: ToolSupportCache;
|
|
99
|
+
metrics: MetricsSink;
|
|
100
|
+
extractionCacheStats: ExtractionCacheStats;
|
|
101
|
+
tokenCalibration: TokenCalibrationStore;
|
|
102
|
+
/** Per-run prompt-cache namespace for providers that support prompt caching. */
|
|
103
|
+
compactSessionId: string;
|
|
104
|
+
}
|
|
105
|
+
export declare function createServices(overrides?: Partial<SmartCompactServices>): SmartCompactServices;
|
|
106
|
+
export declare function getDefaultServices(): SmartCompactServices;
|
|
107
|
+
/** Swap the default container; tests use this to inject a clock/llm. */
|
|
108
|
+
export declare function setDefaultServices(services: SmartCompactServices): void;
|
|
109
|
+
/** Reset between runs — equivalent to the old per-session `resetMetrics`. */
|
|
110
|
+
export declare function resetDefaultServices(): void;
|
|
111
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/infra/services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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IAAI;IAElB,QAAQ,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAK7D,KAAK,IAAI,IAAI;CACd;AAED,oCAAoC;AACpC,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,gBAAgB,CAAC;IAC9B,OAAO,EAAE,WAAW,CAAC;IACrB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAMD,wBAAgB,cAAc,CAAC,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,oBAAoB,CAUlG;AAgBD,wBAAgB,kBAAkB,IAAI,oBAAoB,CAAqB;AAE/E,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAyB;AAEjG,6EAA6E;AAC7E,wBAAgB,oBAAoB,IAAI,IAAI,CAAiC"}
|
package/dist/phases/explore.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { Model, Api } from "@earendil-works/pi-ai";
|
|
5
5
|
import type { LlmMessage, StructuredExtraction, ExplorationReport } from "../types.ts";
|
|
6
|
+
import type { SmartCompactServices } from "../infra/services.ts";
|
|
6
7
|
/**
|
|
7
8
|
* Determine whether exploration is worthwhile based on session complexity.
|
|
8
9
|
* Simple sessions (few topics, few errors, few decisions) skip exploration
|
|
@@ -16,10 +17,21 @@ export declare function executeExplorationTool(call: {
|
|
|
16
17
|
export declare function parseExplorationReport(text: string, llmMessages: LlmMessage[]): ExplorationReport;
|
|
17
18
|
export declare function buildExplorationReportFromParsed(parsed: any, llmMessages: LlmMessage[]): ExplorationReport;
|
|
18
19
|
export declare function fallbackExplorationReport(llmMessages: LlmMessage[]): ExplorationReport;
|
|
20
|
+
/**
|
|
21
|
+
* Top-level exploration entry point.
|
|
22
|
+
*
|
|
23
|
+
* `services` is threaded in explicitly rather than reached via
|
|
24
|
+
* `getDefaultServices()` because `runSmartCompact` resets the default
|
|
25
|
+
* services container at the start of every run. Two concurrent pi sessions
|
|
26
|
+
* sharing the Node process would otherwise stomp on each other's
|
|
27
|
+
* `toolSupport` cache. The optional fallback to `getDefaultServices()` is
|
|
28
|
+
* preserved for direct callers that haven't been migrated yet (legacy
|
|
29
|
+
* tests, REPL use).
|
|
30
|
+
*/
|
|
19
31
|
export declare function exploreConversation(llmMessages: LlmMessage[], extraction: StructuredExtraction, model: Model<Api>, auth: {
|
|
20
32
|
apiKey: string;
|
|
21
33
|
headers?: Record<string, string>;
|
|
22
|
-
}, prevSummary: string | undefined, userNote: string | undefined, signal?: AbortSignal, maxRounds?: number, notify?: (msg: string, type?: "info" | "success" | "warning" | "error") => void): Promise<{
|
|
34
|
+
}, prevSummary: string | undefined, userNote: string | undefined, signal?: AbortSignal, maxRounds?: number, notify?: (msg: string, type?: "info" | "success" | "warning" | "error") => void, services?: SmartCompactServices): Promise<{
|
|
23
35
|
report: ExplorationReport;
|
|
24
36
|
rounds: number;
|
|
25
37
|
toolSupported: boolean;
|
|
@@ -27,9 +39,9 @@ export declare function exploreConversation(llmMessages: LlmMessage[], extractio
|
|
|
27
39
|
export declare function explorationRetry(model: Model<Api>, auth: {
|
|
28
40
|
apiKey: string;
|
|
29
41
|
headers?: Record<string, string>;
|
|
30
|
-
}, llmMessages: LlmMessage[], extraction: StructuredExtraction, prevSummary: string | undefined, userNote: string | undefined, signal?: AbortSignal): Promise<ExplorationReport>;
|
|
42
|
+
}, llmMessages: LlmMessage[], extraction: StructuredExtraction, prevSummary: string | undefined, userNote: string | undefined, signal?: AbortSignal, services?: SmartCompactServices): Promise<ExplorationReport>;
|
|
31
43
|
export declare function directExploration(llmMessages: LlmMessage[], extraction: StructuredExtraction, model: Model<Api>, auth: {
|
|
32
44
|
apiKey: string;
|
|
33
45
|
headers?: Record<string, string>;
|
|
34
|
-
}, prevSummary: string | undefined, userNote: string | undefined, signal?: AbortSignal): Promise<ExplorationReport>;
|
|
46
|
+
}, prevSummary: string | undefined, userNote: string | undefined, signal?: AbortSignal, services?: SmartCompactServices): Promise<ExplorationReport>;
|
|
35
47
|
//# sourceMappingURL=explore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore.d.ts","sourceRoot":"","sources":["../../src/phases/explore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"explore.d.ts","sourceRoot":"","sources":["../../src/phases/explore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAkC,MAAM,uBAAuB,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAQjE;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAcvE;AA6BD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAqFpI;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAoCjG;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAoB1G;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,UA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E,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAC7E,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC7D,MAAM,CAAC,EAAE,WAAW,EACpB,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAsB5B"}
|
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { Model, Api } from "@earendil-works/pi-ai";
|
|
5
5
|
import type { LlmMessage, LlmChunk, ChunkSummary, StructuredExtraction, ExplorationReport, ProfileConfig } from "../types.ts";
|
|
6
|
+
import type { SmartCompactServices } from "../infra/services.ts";
|
|
6
7
|
export declare function chunkLlmMessages(msgs: LlmMessage[], boundaries: import("../types.ts").TopicBoundary[], pc: ProfileConfig): LlmChunk[];
|
|
7
8
|
export declare function singlePassCompact(convText: string, extraction: StructuredExtraction, report: ExplorationReport | null, prevContext: string, model: Model<Api>, auth: {
|
|
8
9
|
apiKey: string;
|
|
9
10
|
headers?: Record<string, string>;
|
|
10
|
-
}, budgetTokens: number, signal?: AbortSignal): Promise<{
|
|
11
|
+
}, budgetTokens: number, signal?: AbortSignal, services?: SmartCompactServices): Promise<{
|
|
11
12
|
summary: string;
|
|
12
13
|
llmCalls: 1;
|
|
13
14
|
}>;
|
|
14
15
|
export declare function summarizeBatch(batch: LlmChunk[], extraction: StructuredExtraction, model: Model<Api>, auth: {
|
|
15
16
|
apiKey: string;
|
|
16
17
|
headers?: Record<string, string>;
|
|
17
|
-
}, signal?: AbortSignal): Promise<ChunkSummary[]>;
|
|
18
|
+
}, signal?: AbortSignal, services?: SmartCompactServices): Promise<ChunkSummary[]>;
|
|
18
19
|
export declare function assembleLLM(summaries: ChunkSummary[], extraction: StructuredExtraction, report: ExplorationReport | null, model: Model<Api>, auth: {
|
|
19
20
|
apiKey: string;
|
|
20
21
|
headers?: Record<string, string>;
|
|
21
|
-
}, budget: number, prevContext: string, signal?: AbortSignal): Promise<string>;
|
|
22
|
+
}, budget: number, prevContext: string, signal?: AbortSignal, services?: SmartCompactServices): Promise<string>;
|
|
22
23
|
export declare function assembleFallback(summaries: ChunkSummary[], extraction: StructuredExtraction): string;
|
|
23
24
|
//# sourceMappingURL=synthesize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/phases/synthesize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EACV,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EACxD,iBAAiB,EAAE,aAAa,EACjC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/phases/synthesize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EACV,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EACxD,iBAAiB,EAAE,aAAa,EACjC,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAOjE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,OAAO,aAAa,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,aAAa,GAAG,QAAQ,EAAE,CAoDrI;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI,EACpF,WAAW,EAAE,MAAM,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
package/dist/phases/verify.d.ts
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Phase 4: Verification + Quality Score.
|
|
3
|
+
*
|
|
4
|
+
* Verification was historically a long chain of `summary.toLowerCase().includes(...)`
|
|
5
|
+
* checks. That worked but coupled the score to the exact markdown wording, so
|
|
6
|
+
* `### Goal` instead of `## Goal` registered as a missing section even though
|
|
7
|
+
* the content was right there. We now parse the summary once into a
|
|
8
|
+
* `CanonicalSummary` (see `domain/summary-schema.ts`) and run section-level
|
|
9
|
+
* checks against the structured form. The text-content checks (file names,
|
|
10
|
+
* error snippets, decisions) still run on the body string, but only after the
|
|
11
|
+
* section has been positively identified by `kind`.
|
|
12
|
+
*
|
|
13
|
+
* Deterministic patching writes structured sections back into the summary via
|
|
14
|
+
* `appendToSection` / `upsertSection`, so a follow-up parse round always sees
|
|
15
|
+
* the canonical headings even when the LLM produced something idiosyncratic.
|
|
3
16
|
*/
|
|
4
17
|
import type { Model, Api } from "@earendil-works/pi-ai";
|
|
5
18
|
import type { StructuredExtraction, VerificationResult } from "../types.ts";
|
|
19
|
+
import type { SmartCompactServices } from "../infra/services.ts";
|
|
6
20
|
export declare function verifySummary(summary: string, extraction: StructuredExtraction): VerificationResult;
|
|
7
21
|
/**
|
|
8
22
|
* Deterministic patch — injects missing items directly into the summary
|
|
9
|
-
* without an LLM call.
|
|
23
|
+
* without an LLM call. All structural mutations go through the canonical
|
|
24
|
+
* parse/upsert path so the resulting markdown always has the canonical
|
|
25
|
+
* headings, even if the LLM produced lowercase or differently punctuated ones.
|
|
10
26
|
*/
|
|
11
27
|
export declare function patchDeterministic(summary: string, gaps: string[], extraction: StructuredExtraction): string;
|
|
12
28
|
export declare function patchSummary(summary: string, gaps: string[], model: Model<Api>, auth: {
|
|
13
29
|
apiKey: string;
|
|
14
30
|
headers?: Record<string, string>;
|
|
15
|
-
}, signal?: AbortSignal): Promise<string>;
|
|
31
|
+
}, signal?: AbortSignal, services?: SmartCompactServices): Promise<string>;
|
|
16
32
|
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/phases/verify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/phases/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAM5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,kBAAkB,CAyHnG;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,oBAAoB,GAAG,MAAM,CA6D5G;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAC/B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,WAAW,EACnG,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -135,7 +135,16 @@ export interface ModelOption {
|
|
|
135
135
|
value: string;
|
|
136
136
|
label: string;
|
|
137
137
|
model: Model<Api>;
|
|
138
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Tri-state tool support hint:
|
|
140
|
+
* true - confirmed (cached or known-good provider)
|
|
141
|
+
* false - confirmed unsupported (cached after a failed probe)
|
|
142
|
+
* "probe" - unknown; will be runtime-probed during exploration
|
|
143
|
+
* The previous boolean form always set `true` in the UI, which silently
|
|
144
|
+
* lied to the user about providers like LM Studio that don't actually
|
|
145
|
+
* support function calling.
|
|
146
|
+
*/
|
|
147
|
+
supportsTools: boolean | "probe";
|
|
139
148
|
}
|
|
140
149
|
export interface VerificationResult {
|
|
141
150
|
ok: boolean;
|
|
@@ -222,6 +231,13 @@ export interface LlmMessage {
|
|
|
222
231
|
content?: unknown;
|
|
223
232
|
isError?: boolean;
|
|
224
233
|
toolCallId?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Optional tool name on `toolResult` messages. Some providers require it
|
|
236
|
+
* alongside `toolCallId` (Anthropic), others ignore it. We store it when
|
|
237
|
+
* we know it so the explore-loop can round-trip the metadata back to the
|
|
238
|
+
* provider without re-fetching the original toolCall block.
|
|
239
|
+
*/
|
|
240
|
+
toolName?: string;
|
|
225
241
|
timestamp?: number;
|
|
226
242
|
}
|
|
227
243
|
export interface LlmTextBlock {
|
|
@@ -243,6 +259,24 @@ export interface CacheAwareOptions {
|
|
|
243
259
|
cacheRetention?: "none" | "short" | "long";
|
|
244
260
|
sessionId?: string;
|
|
245
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Compact summary of an entry-ID list used for cache prefix matching.
|
|
264
|
+
*
|
|
265
|
+
* Storing the full id array on disk balloons the cache file linearly with
|
|
266
|
+
* session length (5k msgs ⇒ ~100KB rewritten on every compact). The fingerprint
|
|
267
|
+
* captures everything `extractWithCache` actually checks:
|
|
268
|
+
*
|
|
269
|
+
* - `count` — array length, used to bound the prefix verification.
|
|
270
|
+
* - `prefixHash` — sha256 over `ids.join("\n")`, used to *prove* the cached
|
|
271
|
+
* prefix is a prefix of the current run without storing the full list.
|
|
272
|
+
* - `tail` — last few ids verbatim, used as a fast first-line sanity check
|
|
273
|
+
* before computing the hash. Cheap O(K) string compare.
|
|
274
|
+
*/
|
|
275
|
+
export interface EntryIdFingerprint {
|
|
276
|
+
count: number;
|
|
277
|
+
prefixHash: string;
|
|
278
|
+
tail: string[];
|
|
279
|
+
}
|
|
246
280
|
export interface CachedExtraction {
|
|
247
281
|
lastMessageIndex: number;
|
|
248
282
|
extraction: StructuredExtraction;
|
|
@@ -251,10 +285,15 @@ export interface CachedExtraction {
|
|
|
251
285
|
/** First/last entry IDs for branch-aware cache invalidation */
|
|
252
286
|
firstEntryId?: string;
|
|
253
287
|
lastEntryId?: string;
|
|
254
|
-
/**
|
|
288
|
+
/** Legacy: full id array. Kept on the type for backwards-compatible reads of
|
|
289
|
+
* older cache files. New saves use {entryIdsFp, keptEntryIdsFp} instead. */
|
|
255
290
|
entryIds?: string[];
|
|
256
|
-
/**
|
|
291
|
+
/** Legacy: full kept-id array. See `entryIds`. */
|
|
257
292
|
keptEntryIds?: string[];
|
|
293
|
+
/** Compact branch fingerprint (replaces `entryIds` for new caches). */
|
|
294
|
+
entryIdsFp?: EntryIdFingerprint;
|
|
295
|
+
/** Compact pruned fingerprint (replaces `keptEntryIds` for new caches). */
|
|
296
|
+
keptEntryIdsFp?: EntryIdFingerprint;
|
|
258
297
|
}
|
|
259
298
|
/** An open loop — unresolved task detected during compaction */
|
|
260
299
|
export interface OpenLoop {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAExD,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAEnF,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,MA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