pi-smart-compact 9.7.1 → 10.0.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/ARCHITECTURE.md +973 -372
- package/CHANGELOG.md +721 -0
- package/LICENSE +8 -0
- package/README.md +128 -640
- package/SECURITY.md +34 -12
- package/SUPPORT.md +26 -9
- package/assets/DejaVu-LICENSE.txt +187 -0
- package/assets/DejaVuSansMono.ttf +0 -0
- package/assets/README.md +26 -0
- package/assets/skills/context-management/SKILL.md +34 -0
- package/dist/app/anchor-cache.d.ts +36 -0
- package/dist/app/anchor-cache.d.ts.map +1 -0
- package/dist/app/artifact-storage.d.ts +47 -0
- package/dist/app/artifact-storage.d.ts.map +1 -0
- package/dist/app/background-preparation.d.ts +39 -0
- package/dist/app/background-preparation.d.ts.map +1 -0
- package/dist/app/compaction-commit-store.d.ts +5 -1
- package/dist/app/compaction-commit-store.d.ts.map +1 -1
- package/dist/app/context-evidence.d.ts +57 -0
- package/dist/app/context-evidence.d.ts.map +1 -0
- package/dist/app/context-guide.d.ts +3 -0
- package/dist/app/context-guide.d.ts.map +1 -0
- package/dist/app/context-operations.d.ts +106 -0
- package/dist/app/context-operations.d.ts.map +1 -0
- package/dist/app/effective-state.d.ts +23 -0
- package/dist/app/effective-state.d.ts.map +1 -0
- package/dist/app/global-settings-runtime.d.ts +3 -3
- package/dist/app/global-settings-runtime.d.ts.map +1 -1
- package/dist/app/hindsight-memory.d.ts +100 -0
- package/dist/app/hindsight-memory.d.ts.map +1 -0
- package/dist/app/host-cache-ledger.d.ts +68 -0
- package/dist/app/host-cache-ledger.d.ts.map +1 -0
- package/dist/app/lazy-tools.d.ts +36 -0
- package/dist/app/lazy-tools.d.ts.map +1 -0
- package/dist/app/memory-backend.d.ts +58 -0
- package/dist/app/memory-backend.d.ts.map +1 -0
- package/dist/app/mnemopi-memory.d.ts +13 -0
- package/dist/app/mnemopi-memory.d.ts.map +1 -0
- package/dist/app/mnemopi-protocol.d.ts +78 -0
- package/dist/app/mnemopi-protocol.d.ts.map +1 -0
- package/dist/app/mnemopi-worker.d.ts +2 -0
- package/dist/app/mnemopi-worker.d.ts.map +1 -0
- package/dist/app/model-feasibility.d.ts +20 -0
- package/dist/app/model-feasibility.d.ts.map +1 -0
- package/dist/app/native-compaction.d.ts +88 -0
- package/dist/app/native-compaction.d.ts.map +1 -0
- package/dist/app/native-continuity-bridge.d.ts.map +1 -1
- package/dist/app/navigation-data.d.ts +28 -0
- package/dist/app/navigation-data.d.ts.map +1 -0
- package/dist/app/navigation-types.d.ts +60 -0
- package/dist/app/navigation-types.d.ts.map +1 -0
- package/dist/app/pending-slot.d.ts +11 -1
- package/dist/app/pending-slot.d.ts.map +1 -1
- package/dist/app/preflight.d.ts.map +1 -1
- package/dist/app/register-context-tools.d.ts +16 -3
- package/dist/app/register-context-tools.d.ts.map +1 -1
- package/dist/app/register-navigation.d.ts +20 -0
- package/dist/app/register-navigation.d.ts.map +1 -0
- package/dist/app/register-smart-compact-command.d.ts +17 -2
- package/dist/app/register-smart-compact-command.d.ts.map +1 -1
- package/dist/app/register-smart-compact-tool.d.ts.map +1 -1
- package/dist/app/register-smart-context-tool.d.ts +55 -0
- package/dist/app/register-smart-context-tool.d.ts.map +1 -0
- package/dist/app/run-context.d.ts +1 -0
- package/dist/app/run-context.d.ts.map +1 -1
- package/dist/app/run-smart-compact.d.ts +3 -3
- package/dist/app/run-smart-compact.d.ts.map +1 -1
- package/dist/app/session-handoff.d.ts +64 -0
- package/dist/app/session-handoff.d.ts.map +1 -0
- package/dist/app/session-lineage.d.ts +17 -0
- package/dist/app/session-lineage.d.ts.map +1 -0
- package/dist/app/session-run-lock.d.ts +0 -2
- package/dist/app/session-run-lock.d.ts.map +1 -1
- package/dist/app/settled-auto-trigger.d.ts +2 -0
- package/dist/app/settled-auto-trigger.d.ts.map +1 -1
- package/dist/app/smart-compact-input.d.ts +1 -1
- package/dist/app/smart-compact-input.d.ts.map +1 -1
- package/dist/app/smart-compact-policy.d.ts +1 -1
- package/dist/app/smart-compact-policy.d.ts.map +1 -1
- package/dist/app/steps/extract.d.ts +45 -1
- package/dist/app/steps/extract.d.ts.map +1 -1
- package/dist/app/steps/metrics.d.ts +1 -0
- package/dist/app/steps/metrics.d.ts.map +1 -1
- package/dist/app/steps/persist.d.ts.map +1 -1
- package/dist/app/steps/prepare.d.ts.map +1 -1
- package/dist/app/steps/recover.d.ts +9 -0
- package/dist/app/steps/recover.d.ts.map +1 -1
- package/dist/app/steps/synthesize.d.ts.map +1 -1
- package/dist/app/steps/tier.d.ts.map +1 -1
- package/dist/app/steps/verify.d.ts.map +1 -1
- package/dist/app/steps/visual.d.ts +4 -0
- package/dist/app/steps/visual.d.ts.map +1 -0
- package/dist/app/steps/window.d.ts.map +1 -1
- package/dist/app/tool-artifacts.d.ts +27 -0
- package/dist/app/tool-artifacts.d.ts.map +1 -0
- package/dist/app/visual-archive.d.ts +29 -0
- package/dist/app/visual-archive.d.ts.map +1 -0
- package/dist/constants.d.ts +96 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/domain/compaction-usage.d.ts +16 -0
- package/dist/domain/compaction-usage.d.ts.map +1 -0
- package/dist/domain/model-capacity.d.ts +12 -0
- package/dist/domain/model-capacity.d.ts.map +1 -0
- package/dist/domain/provider-evaluation.d.ts +7 -0
- package/dist/domain/provider-evaluation.d.ts.map +1 -1
- package/dist/domain/telemetry.d.ts +43 -2
- package/dist/domain/telemetry.d.ts.map +1 -1
- package/dist/domain/tool-semantics.d.ts +23 -0
- package/dist/domain/tool-semantics.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15757 -6942
- package/dist/infra/ai-messages.d.ts +1 -1
- package/dist/infra/ai-messages.d.ts.map +1 -1
- package/dist/infra/context-graph.d.ts +38 -7
- package/dist/infra/context-graph.d.ts.map +1 -1
- package/dist/infra/fs.d.ts.map +1 -1
- package/dist/infra/hindsight-client.d.ts +73 -0
- package/dist/infra/hindsight-client.d.ts.map +1 -0
- package/dist/infra/hindsight-receipts.d.ts +68 -0
- package/dist/infra/hindsight-receipts.d.ts.map +1 -0
- package/dist/infra/llm-client.d.ts +26 -23
- package/dist/infra/llm-client.d.ts.map +1 -1
- package/dist/infra/memory-ref.d.ts +27 -0
- package/dist/infra/memory-ref.d.ts.map +1 -0
- package/dist/infra/native-protocol.d.ts +54 -0
- package/dist/infra/native-protocol.d.ts.map +1 -0
- package/dist/infra/optional-components.d.ts +15 -0
- package/dist/infra/optional-components.d.ts.map +1 -0
- package/dist/infra/paths.d.ts +2 -0
- package/dist/infra/paths.d.ts.map +1 -1
- package/dist/infra/services.d.ts +15 -5
- package/dist/infra/services.d.ts.map +1 -1
- package/dist/infra/visual-renderer.d.ts +16 -0
- package/dist/infra/visual-renderer.d.ts.map +1 -0
- package/dist/mnemopi-worker.js +213 -0
- package/dist/phases/explore.d.ts +12 -9
- package/dist/phases/explore.d.ts.map +1 -1
- package/dist/phases/synthesize.d.ts +18 -3
- package/dist/phases/synthesize.d.ts.map +1 -1
- package/dist/phases/verify.d.ts +5 -1
- package/dist/phases/verify.d.ts.map +1 -1
- package/dist/rtk.d.ts +7 -0
- package/dist/rtk.d.ts.map +1 -0
- package/dist/rtk.js +767 -0
- package/dist/types.d.ts +128 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/dashboard-format.d.ts +2 -1
- package/dist/ui/dashboard-format.d.ts.map +1 -1
- package/dist/ui/dashboard-insights.d.ts +9 -1
- package/dist/ui/dashboard-insights.d.ts.map +1 -1
- package/dist/ui/error-format.d.ts +7 -2
- package/dist/ui/error-format.d.ts.map +1 -1
- package/dist/ui/handoff-overlay.d.ts +26 -0
- package/dist/ui/handoff-overlay.d.ts.map +1 -0
- package/dist/ui/home-overlay.d.ts +54 -0
- package/dist/ui/home-overlay.d.ts.map +1 -0
- package/dist/ui/metrics-dashboard-overlay.d.ts.map +1 -1
- package/dist/ui/metrics-report.d.ts.map +1 -1
- package/dist/ui/navigation-overlay.d.ts +92 -0
- package/dist/ui/navigation-overlay.d.ts.map +1 -0
- package/dist/ui/overlays.d.ts +12 -2
- package/dist/ui/overlays.d.ts.map +1 -1
- package/dist/ui/profiles.d.ts +51 -0
- package/dist/ui/profiles.d.ts.map +1 -0
- package/dist/ui/settings-complex.d.ts +49 -3
- package/dist/ui/settings-complex.d.ts.map +1 -1
- package/dist/ui/settings-list.d.ts +28 -0
- package/dist/ui/settings-list.d.ts.map +1 -0
- package/dist/ui/settings-overlay.d.ts +13 -6
- package/dist/ui/settings-overlay.d.ts.map +1 -1
- package/dist/ui/storage-report.d.ts +4 -0
- package/dist/ui/storage-report.d.ts.map +1 -0
- package/dist/utils/backups.d.ts.map +1 -1
- package/dist/utils/cache.d.ts +6 -2
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/config.d.ts +12 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/id-fingerprint.d.ts +3 -1
- package/dist/utils/id-fingerprint.d.ts.map +1 -1
- package/dist/utils/issues.d.ts +61 -0
- package/dist/utils/issues.d.ts.map +1 -0
- package/dist/utils/pruning.d.ts.map +1 -1
- package/dist/utils/session-log.d.ts +0 -2
- package/dist/utils/session-log.d.ts.map +1 -1
- package/dist/utils/state.d.ts +3 -1
- package/dist/utils/state.d.ts.map +1 -1
- package/dist/utils/tokens.d.ts +10 -2
- package/dist/utils/tokens.d.ts.map +1 -1
- package/docs/MIGRATING_TO_V8.md +7 -1
- package/docs/README.md +69 -0
- package/docs/RELEASE.md +173 -56
- package/docs/assets/banner.png +0 -0
- package/docs/assets/banner.svg +1158 -70
- package/docs/assets/pi-smart-compact.png +0 -0
- package/docs/assets/pi-smart-compact.svg +24 -0
- package/docs/configuration.md +637 -0
- package/docs/evaluation.md +408 -0
- package/docs/guide.md +860 -0
- package/docs/hindsight-memory.md +314 -0
- package/docs/identity.md +124 -0
- package/package.json +44 -11
- package/dist/provider-eval.js +0 -2122
- package/dist/provider-scenario-eval.js +0 -2900
- package/dist/telemetry-report.js +0 -1973
- package/docs/provider-evaluation-2026-08-06.md +0 -63
|
@@ -4,7 +4,7 @@ export interface SmartCompactInput {
|
|
|
4
4
|
mode?: CompactionMode;
|
|
5
5
|
verbose: boolean;
|
|
6
6
|
dryRun: boolean;
|
|
7
|
-
action?: "metrics" | "dashboard" | "restore" | "loops" | "settings" | "forget";
|
|
7
|
+
action?: "metrics" | "dashboard" | "restore" | "loops" | "settings" | "forget" | "storage" | "trim" | "handoff";
|
|
8
8
|
focus?: string;
|
|
9
9
|
note?: string;
|
|
10
10
|
maxLlmCalls?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-compact-input.d.ts","sourceRoot":"","sources":["../../src/app/smart-compact-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAItE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EACH,SAAS,GACT,WAAW,GACX,SAAS,GACT,OAAO,GACP,UAAU,GACV,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"smart-compact-input.d.ts","sourceRoot":"","sources":["../../src/app/smart-compact-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAItE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EACH,SAAS,GACT,WAAW,GACX,SAAS,GACT,OAAO,GACP,UAAU,GACV,QAAQ,GACR,SAAS,GACT,MAAM,GACN,SAAS,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,GACtC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA4HjC,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GACvC,uBAAuB,CAqEzB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,uBAAuB,CA+CzB"}
|
|
@@ -31,6 +31,6 @@ export interface SmartCompactPolicy {
|
|
|
31
31
|
update(patch: Partial<DesiredSmartCompactPolicy>, ctx: ExtensionContext): SmartCompactPolicyUpdate;
|
|
32
32
|
reset(field: SmartCompactPolicyField, ctx: ExtensionContext): SmartCompactPolicyUpdate;
|
|
33
33
|
}
|
|
34
|
-
export declare function createSmartCompactPolicy(pi: ExtensionAPI): SmartCompactPolicy;
|
|
34
|
+
export declare function createSmartCompactPolicy(pi: ExtensionAPI, syncTools: () => void): SmartCompactPolicy;
|
|
35
35
|
export {};
|
|
36
36
|
//# sourceMappingURL=smart-compact-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-compact-policy.d.ts","sourceRoot":"","sources":["../../src/app/smart-compact-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
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G,EAAE,gBAAgB,GACpB,wBAAwB,CAAC;CAC7B;AA0FD,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,IAAI,GAAG,kBAAkB,CA6FpG"}
|
|
@@ -16,6 +16,50 @@
|
|
|
16
16
|
* `extractionCacheMissReason` captures *why* the cache could not be used so
|
|
17
17
|
* the metrics dashboard can show the hit-rate alongside the failure mode.
|
|
18
18
|
*/
|
|
19
|
-
import type { TieredRc, ExtractedRc } from "../run-context.ts";
|
|
19
|
+
import type { TieredRc, ExtractedRc, WindowedRc } from "../run-context.ts";
|
|
20
|
+
import type { PreparedConversationBackup, StructuredExtraction, CachedExtraction, LlmMessage, ProfileConfig } from "../../types.ts";
|
|
21
|
+
/** Shared continuity input; previews must request a read-only state load. */
|
|
22
|
+
export declare function loadExtractionContinuity(rc: {
|
|
23
|
+
cwd: string;
|
|
24
|
+
branch: unknown[];
|
|
25
|
+
sessionId: string;
|
|
26
|
+
llmMessages: LlmMessage[];
|
|
27
|
+
}, extraction: StructuredExtraction, options?: {
|
|
28
|
+
readOnly?: boolean;
|
|
29
|
+
}): {
|
|
30
|
+
projectId: string;
|
|
31
|
+
fingerprint: import("../../utils/fingerprint.ts").ProjectFingerprint | null;
|
|
32
|
+
projectCtx: string;
|
|
33
|
+
continuityScope: {
|
|
34
|
+
schemaVersion: 2;
|
|
35
|
+
projectId: string;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
branchHeadId?: string | undefined;
|
|
38
|
+
branchAncestryIds?: string[] | undefined;
|
|
39
|
+
};
|
|
40
|
+
previousState: import("../../types.ts").CompactionState | null;
|
|
41
|
+
factOverrides: import("../../types.ts").ContinuityOverride[];
|
|
42
|
+
continuity: string;
|
|
43
|
+
};
|
|
44
|
+
/** Pure cache selection, including branch/content validation and delta extraction. */
|
|
45
|
+
export declare function selectCachedExtraction(input: {
|
|
46
|
+
llmMessages: LlmMessage[];
|
|
47
|
+
profileCfg: ProfileConfig;
|
|
48
|
+
currentEntryIds: string[];
|
|
49
|
+
currentKeptEntryIds: string[];
|
|
50
|
+
cachedExt: CachedExtraction | null;
|
|
51
|
+
}): {
|
|
52
|
+
extraction: StructuredExtraction;
|
|
53
|
+
cache: "exact" | "incremental" | "miss";
|
|
54
|
+
missReason?: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Deferred conversation backup of the compacted messages, shared by the EESV
|
|
58
|
+
* and native engines. Nothing is serialized until Pi confirms compaction;
|
|
59
|
+
* structured redaction and the text scrubber run before serialization, and
|
|
60
|
+
* redactions are surfaced because a restore brings back the redacted text.
|
|
61
|
+
* `scrubbedText` reuses an already scrubbed serialization of `messages`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function prepareScrubbedBackup(rc: Pick<WindowedRc, "config" | "services" | "notify" | "sessionId" | "branch" | "totalTokens">, messages: LlmMessage[], scrubbedText?: string): PreparedConversationBackup | undefined;
|
|
20
64
|
export declare function extractWithCache(rc: TieredRc): ExtractedRc;
|
|
21
65
|
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/app/steps/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/app/steps/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,KAAK,EACX,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,MAAM,gBAAgB,CAAC;AAqCxB,6EAA6E;AAC7E,wBAAgB,wBAAwB,CACvC,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,EACpF,UAAU,EAAE,oBAAoB,EAChC,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;uBAOpB,CAAC;;;;;;;;;EAajB;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC7C,WAAW,EAAE,UAAU,EAAE,CAAC;IAAC,UAAU,EAAE,aAAa,CAAC;IACrD,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC7F,GAAG;IAAE,UAAU,EAAE,oBAAoB,CAAC;IAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CA8CrG;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACpC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC,EAC/F,QAAQ,EAAE,UAAU,EAAE,EACtB,YAAY,CAAC,EAAE,MAAM,GACnB,0BAA0B,GAAG,SAAS,CAwBxC;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,WAAW,CAwI1D"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { RcBase, StatedRc } from "../run-context.ts";
|
|
18
18
|
import type { CompactionMode, MetricsSnapshot } from "../../types.ts";
|
|
19
|
+
export declare function runType(rc: Pick<RcBase, "flags">): "manual" | "auto" | "tool";
|
|
19
20
|
export declare function buildSuccessMetrics(rc: StatedRc, status: "success" | "dry-run" | "cancelled"): MetricsSnapshot;
|
|
20
21
|
export declare function recordSuccessMetrics(rc: StatedRc, status: "success" | "dry-run" | "cancelled"): Promise<void>;
|
|
21
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/app/steps/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/app/steps/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EACX,cAAc,EACd,eAAe,EAGf,MAAM,gBAAgB,CAAC;AA4BxB,wBAAgB,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAM7E;AAyBD,wBAAgB,mBAAmB,CAClC,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GACzC,eAAe,CAwEjB;AAED,wBAAsB,oBAAoB,CACzC,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GACzC,OAAO,CAAC,IAAI,CAAC,CAsCf;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,cAAc,CAAC;CACtB;AAED,wBAAsB,oBAAoB,CACzC,EAAE,EAAE,MAAM,GAAG,QAAQ,EACrB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,oBAAoB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA+Gf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../../src/app/steps/persist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAElB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../../src/app/steps/persist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAElB,MAAM,gBAAgB,CAAC;AAexB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAWlD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CA8BnB;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAoBnB;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CA0CvD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,UAAU,EACd,eAAe,CAAC,EAAE,eAAe,GAChC,iBAAiB,CA2BnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA2BlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../src/app/steps/prepare.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../src/app/steps/prepare.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAY1E,wBAAsB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAkFhE"}
|
|
@@ -9,5 +9,14 @@
|
|
|
9
9
|
* messages — the summary still beats no summary at all.
|
|
10
10
|
*/
|
|
11
11
|
import type { WindowedRc, RecoveredRc } from "../run-context.ts";
|
|
12
|
+
import type { LlmMessage } from "../../types.ts";
|
|
13
|
+
/** Read-only source recovery shared by preflight and execution. */
|
|
14
|
+
export declare function recoverSourceMessages(sessionId: string, entries: WindowedRc["toCompact"], cwd: string): Promise<{
|
|
15
|
+
messages: Array<{
|
|
16
|
+
entryId: string;
|
|
17
|
+
message: LlmMessage;
|
|
18
|
+
}>;
|
|
19
|
+
fromLog: boolean;
|
|
20
|
+
}>;
|
|
12
21
|
export declare function recoverSessionLog(rc: WindowedRc): Promise<RecoveredRc>;
|
|
13
22
|
//# sourceMappingURL=recover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recover.d.ts","sourceRoot":"","sources":["../../../src/app/steps/recover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"recover.d.ts","sourceRoot":"","sources":["../../../src/app/steps/recover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,mEAAmE;AACnE,wBAAsB,qBAAqB,CAC1C,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,MAAM,GAC9D,OAAO,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAY1F;AAED,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAY5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/app/steps/synthesize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/app/steps/synthesize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA4BH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYpE,wBAAsB,qBAAqB,CAC1C,EAAE,EAAE,WAAW,GACb,OAAO,CAAC,aAAa,CAAC,CA8lBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../../src/app/steps/tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../../src/app/steps/tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAc,MAAM,mBAAmB,CAAC;AAS3E,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,GAAG,QAAQ,GAAG,IAAI,CA8B3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/app/steps/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBnE,wBAAsB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/app/steps/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBnE,wBAAsB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAoN3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/app/steps/visual.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,iBAAiB,EAAkB,MAAM,gCAAgC,CAAC;AAGzG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIlD,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,2BAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/app/steps/window.ts"],"names":[],"mappings":"AAAA,0EAA0E;
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/app/steps/window.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAI1E,OAAO,KAAK,EACX,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EAEV,UAAU,EACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACX,uBAAuB,EAEvB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,gBAAgB,CAAC;AAexB,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIhF,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,UAAU,EAAE,aAAa,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,6EAA6E;IAC7E,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAe7E;AAED,oFAAoF;AACpF,wBAAgB,6BAA6B,CAC5C,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,cAAc,EACzB,YAAY,EAAE,oBAAoB,GAAG,SAAS,GAC5C,MAAM,CAkBR;AAyDD,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,yBAAyB,GAC9B,oBAAoB,CA0LtB;AA8BD,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAqGzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExtensionAPI, SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { CompactConfig } from "../types.ts";
|
|
3
|
+
export declare const ARTIFACT_DETAILS_KEY = "smartCompactArtifact";
|
|
4
|
+
export declare const ARTIFACT_MIN_CHARS = 16384;
|
|
5
|
+
export declare const ARTIFACT_MAX_BYTES: number;
|
|
6
|
+
export declare const ARTIFACT_SESSION_BYTES: number;
|
|
7
|
+
export declare const ARTIFACT_SESSION_FILES = 256;
|
|
8
|
+
export declare const digest: (text: string) => string;
|
|
9
|
+
export interface ToolArtifact {
|
|
10
|
+
version: 1;
|
|
11
|
+
owner: string;
|
|
12
|
+
hash: string;
|
|
13
|
+
previewHash: string;
|
|
14
|
+
chars: number;
|
|
15
|
+
bytes: number;
|
|
16
|
+
lines: number;
|
|
17
|
+
tool: string;
|
|
18
|
+
source: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const artifactId: (artifact: ToolArtifact) => string;
|
|
21
|
+
export declare function parseToolArtifact(value: unknown): ToolArtifact | null;
|
|
22
|
+
/** Caller must first prove the reference is reachable from its active branch. */
|
|
23
|
+
export declare function readToolArtifact(artifact: ToolArtifact): Promise<string>;
|
|
24
|
+
/** `retrievable` answers whether the agent can reach `smart_context` to read an offloaded output back. */
|
|
25
|
+
export declare function registerArtifactOffload(pi: ExtensionAPI, config: () => CompactConfig, retrievable: () => boolean): void;
|
|
26
|
+
export declare function branchToolArtifacts(branch: readonly SessionEntry[], ownedReferences: ReadonlySet<string>): Map<string, ToolArtifact>;
|
|
27
|
+
//# sourceMappingURL=tool-artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-artifacts.d.ts","sourceRoot":"","sources":["../../src/app/tool-artifacts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAmB,MAAM,iCAAiC,CAAC;AAKnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,eAAO,MAAM,kBAAkB,QAAS,CAAC;AACzC,eAAO,MAAM,kBAAkB,QAAkB,CAAC;AAClD,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AACvD,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,MAAM,SAAU,MAAM,WAAoD,CAAC;AAExF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,eAAO,MAAM,UAAU,aAAc,YAAY,WAAgC,CAAC;AAElF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAOrE;AAiBD,iFAAiF;AACjF,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB9E;AA6CD,0GAA0G;AAC1G,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,GAAG,IAAI,CA2CvH;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,6BAcxG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
2
|
+
import { type ContextEvent, type ExtensionContext, type SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { SecretScrubber } from "../domain/scrub.ts";
|
|
4
|
+
import type { SessionMessageEntry, VisualArchive } from "../types.ts";
|
|
5
|
+
export declare const VISUAL_CONTEXT_TYPE = "smart-compact-visual-evidence";
|
|
6
|
+
export declare const VISUAL_MAX_SOURCE_CHARS = 24000;
|
|
7
|
+
export declare function canReadVisual(model: Pick<Model<Api>, "input" | "api"> | undefined): boolean;
|
|
8
|
+
/** Planning only, not billed savings. Expand supported models after validating their image rules. */
|
|
9
|
+
export declare function visualEconomics(reader: VisualArchive["reader"], sources: VisualArchive["sources"], frames: Array<{
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}>, estimateText?: (text: string) => number): {
|
|
13
|
+
textTokens: number;
|
|
14
|
+
imageTokens: number | null;
|
|
15
|
+
worthwhile: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function visualSourceLines(source: VisualArchive["sources"][number]): string[];
|
|
18
|
+
export declare function visualPages(sources: VisualArchive["sources"]): string[][];
|
|
19
|
+
/** Validate persisted data before it can become model input or a retrieval result. */
|
|
20
|
+
export declare function validVisualArchive(value: unknown): value is VisualArchive;
|
|
21
|
+
export declare function activeVisualArchive(branch: readonly SessionEntry[]): {
|
|
22
|
+
entry: import("@earendil-works/pi-coding-agent").CompactionEntry<unknown>;
|
|
23
|
+
archive: VisualArchive;
|
|
24
|
+
} | null;
|
|
25
|
+
/** Prefer recent evidence; carry bounded source text across generations without OCR. */
|
|
26
|
+
export declare function selectVisualSources(branch: SessionEntry[], toCompact: SessionMessageEntry[], summary: string, scrubber: SecretScrubber): VisualArchive["sources"];
|
|
27
|
+
/** Append image evidence beside, not instead of, the exact summary in this request. */
|
|
28
|
+
export declare function injectVisualArchive(messages: ContextEvent["messages"], branch: SessionEntry[], ctx: Pick<ExtensionContext, "model" | "getContextUsage">, enabled: boolean, scrubber?: SecretScrubber): ContextEvent["messages"];
|
|
29
|
+
//# sourceMappingURL=visual-archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual-archive.d.ts","sourceRoot":"","sources":["../../src/app/visual-archive.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAA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,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,iBAAiB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,iBAAuB,GAAG,YAAY,CAAC,UAAU,CAAC,CAuBrO"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,29 @@ 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 = "
|
|
11
|
+
export declare const VERSION = "10.0.1";
|
|
12
|
+
/**
|
|
13
|
+
* Opt-in components that are not installed with the extension: optional peer
|
|
14
|
+
* dependencies in package.json, pinned to the versions the release audit
|
|
15
|
+
* exercises. The audit fails if these drift from the manifest.
|
|
16
|
+
*/
|
|
17
|
+
export declare const OPTIONAL_COMPONENTS: {
|
|
18
|
+
readonly mnemopi: {
|
|
19
|
+
readonly name: "@oh-my-pi/pi-mnemopi";
|
|
20
|
+
readonly version: "18.3.1";
|
|
21
|
+
readonly enables: "Mnemopi memory store";
|
|
22
|
+
};
|
|
23
|
+
readonly bun: {
|
|
24
|
+
readonly name: "bun";
|
|
25
|
+
readonly version: "1.4.2";
|
|
26
|
+
readonly enables: "Mnemopi worker runtime when no Bun 1.3.14+ is on PATH";
|
|
27
|
+
};
|
|
28
|
+
readonly resvg: {
|
|
29
|
+
readonly name: "@resvg/resvg-js";
|
|
30
|
+
readonly version: "2.6.2";
|
|
31
|
+
readonly enables: "image snapshots";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
12
34
|
export declare const CHARS_PER_TOKEN = 3.8;
|
|
13
35
|
export declare const MIN_COMPACTION_SAVING_RATIO = 0.1;
|
|
14
36
|
export declare const ESTIMATOR_ROUNDING_TOLERANCE_TOKENS = 1;
|
|
@@ -22,6 +44,24 @@ export declare const AUTO_TRIGGER_TIMEOUT_CAP_MS = 60000;
|
|
|
22
44
|
export declare const AUTO_TRIGGER_MAX_LLM_CALLS = 4;
|
|
23
45
|
/** Suppress proactive settled-trigger churn after any confirmed compaction. */
|
|
24
46
|
export declare const SETTLED_TRIGGER_COOLDOWN_MS: number;
|
|
47
|
+
/**
|
|
48
|
+
* Minimum uncached prompt tokens (input + cacheWrite) for a host request to
|
|
49
|
+
* count as a prompt-cache rebuild. Anthropic caches need >=1024-4096-token
|
|
50
|
+
* prefixes and every turn legitimately re-sends the new tail uncached (tool
|
|
51
|
+
* results, user input: routinely a few thousand tokens); 16k sits clearly
|
|
52
|
+
* above that tail noise while staying far below a real prefix rebuild.
|
|
53
|
+
*/
|
|
54
|
+
export declare const REBUILD_MIN_TOKENS = 16384;
|
|
55
|
+
/**
|
|
56
|
+
* Further requests within which a warm-cache automatic trim must pay back its
|
|
57
|
+
* prefix rewrite; sessions rarely run that many requests without another prefix change.
|
|
58
|
+
*/
|
|
59
|
+
export declare const AUTO_TRIM_BREAK_EVEN_REQUESTS = 24;
|
|
60
|
+
/**
|
|
61
|
+
* Expected savings (USD) a prompt-cache refresh must reach to be worth sending;
|
|
62
|
+
* Pi warms when `continuationProbability * missCost - warmCost >= 0.05` (Pi docs/settings.md).
|
|
63
|
+
*/
|
|
64
|
+
export declare const CACHE_WARMING_MIN_SAVINGS_USD = 0.05;
|
|
25
65
|
/** Positive per-run bounds shared by CLI and tool arguments; config separately allows 0 as a mode-derived sentinel. */
|
|
26
66
|
export declare const BUDGET_LIMITS: {
|
|
27
67
|
readonly CALLS: {
|
|
@@ -47,12 +87,19 @@ export declare const PROFILE_NUMERIC_BOUNDS: {
|
|
|
47
87
|
readonly singlePassMaxTokens: readonly [1000, 500000];
|
|
48
88
|
readonly batchMaxTokens: readonly [1000, 500000];
|
|
49
89
|
};
|
|
90
|
+
/** Home warns above this model window when maxContextTokens is off. */
|
|
91
|
+
export declare const LARGE_CONTEXT_WINDOW_TOKENS = 400000;
|
|
50
92
|
export declare const CONFIG_NUMERIC_LIMITS: {
|
|
51
93
|
readonly minContextPercent: {
|
|
52
94
|
readonly min: 0;
|
|
53
95
|
readonly max: 100;
|
|
54
96
|
readonly integer: false;
|
|
55
97
|
};
|
|
98
|
+
readonly prepareContextPercent: {
|
|
99
|
+
readonly min: 0;
|
|
100
|
+
readonly max: 100;
|
|
101
|
+
readonly integer: false;
|
|
102
|
+
};
|
|
56
103
|
readonly autoTriggerTimeoutMs: {
|
|
57
104
|
readonly min: 1000;
|
|
58
105
|
readonly max: 300000;
|
|
@@ -68,6 +115,12 @@ export declare const CONFIG_NUMERIC_LIMITS: {
|
|
|
68
115
|
readonly max: 1000000;
|
|
69
116
|
readonly integer: true;
|
|
70
117
|
};
|
|
118
|
+
readonly maxContextTokens: {
|
|
119
|
+
readonly min: 16384;
|
|
120
|
+
readonly max: 2000000;
|
|
121
|
+
readonly integer: true;
|
|
122
|
+
readonly zeroOrRange: true;
|
|
123
|
+
};
|
|
71
124
|
readonly codexMaxCallMs: {
|
|
72
125
|
readonly min: 5000;
|
|
73
126
|
readonly max: 3600000;
|
|
@@ -85,6 +138,16 @@ export declare const CONFIG_NUMERIC_LIMITS: {
|
|
|
85
138
|
readonly max: 3600000;
|
|
86
139
|
readonly integer: true;
|
|
87
140
|
};
|
|
141
|
+
readonly hindsightTimeoutMs: {
|
|
142
|
+
readonly min: 1000;
|
|
143
|
+
readonly max: 60000;
|
|
144
|
+
readonly integer: true;
|
|
145
|
+
};
|
|
146
|
+
readonly hindsightRecallMaxTokens: {
|
|
147
|
+
readonly min: 128;
|
|
148
|
+
readonly max: 4096;
|
|
149
|
+
readonly integer: true;
|
|
150
|
+
};
|
|
88
151
|
};
|
|
89
152
|
export declare const DEFAULT_CONFIG: {
|
|
90
153
|
mode: "auto";
|
|
@@ -96,6 +159,7 @@ export declare const DEFAULT_CONFIG: {
|
|
|
96
159
|
summaryThinkingLevel: "minimal";
|
|
97
160
|
segmentationThinkingLevel: "minimal";
|
|
98
161
|
agentToolAccess: "inherit";
|
|
162
|
+
toolLoading: "lazy";
|
|
99
163
|
autoTrigger: boolean;
|
|
100
164
|
showStatus: boolean;
|
|
101
165
|
autoTriggerStrategy: "native-hook";
|
|
@@ -103,6 +167,8 @@ export declare const DEFAULT_CONFIG: {
|
|
|
103
167
|
backupEnabled: boolean;
|
|
104
168
|
backupDir: string;
|
|
105
169
|
minContextPercent: number;
|
|
170
|
+
prepareContextPercent: number | null;
|
|
171
|
+
maxContextTokens: number;
|
|
106
172
|
requireApproval: boolean;
|
|
107
173
|
scrubSecrets: boolean;
|
|
108
174
|
scrubPii: boolean;
|
|
@@ -114,6 +180,23 @@ export declare const DEFAULT_CONFIG: {
|
|
|
114
180
|
focusWeighting: boolean;
|
|
115
181
|
zeroCallEnabled: boolean;
|
|
116
182
|
contextGraphEnabled: boolean;
|
|
183
|
+
compactionEngines: Array<"eesv" | "native">;
|
|
184
|
+
memoryBackend: "local";
|
|
185
|
+
hindsightBaseUrl: string | null;
|
|
186
|
+
hindsightBankId: string | null;
|
|
187
|
+
hindsightApiKeyEnv: string | null;
|
|
188
|
+
hindsightTimeoutMs: number;
|
|
189
|
+
hindsightRecallMaxTokens: number;
|
|
190
|
+
mnemopiDataDir: string | null;
|
|
191
|
+
visualArchiveEnabled: boolean;
|
|
192
|
+
artifactOffloadEnabled: boolean;
|
|
193
|
+
contextHygieneEnabled: boolean;
|
|
194
|
+
contextNavigationEnabled: boolean;
|
|
195
|
+
contextRecallEnabled: boolean;
|
|
196
|
+
contextPivotEnabled: boolean;
|
|
197
|
+
contextAnchorCacheEnabled: boolean;
|
|
198
|
+
contextAnchorStatusEnabled: boolean;
|
|
199
|
+
contextGuidanceEnabled: boolean;
|
|
117
200
|
telemetryChannel: "stable";
|
|
118
201
|
adaptiveDamageFeedback: boolean;
|
|
119
202
|
onlineDamageMonitor: boolean;
|
|
@@ -217,10 +300,22 @@ export declare const MAX_TOOL_OUTPUT_CHARS = 800;
|
|
|
217
300
|
export declare const MAX_EXPLORER_OUTPUT_CHARS = 12000;
|
|
218
301
|
/** Shell-output patterns signalling a likely error even in a non-`isError` result. */
|
|
219
302
|
export declare const LIKELY_ERROR_RE: RegExp;
|
|
303
|
+
/** Conservative risk lines kept in a trim marker's digest (errors, failures, warnings, exits). */
|
|
304
|
+
export declare const TRIM_RISK_LINE_RE: RegExp;
|
|
305
|
+
/** Trim marker digest bounds: line 1 always kept; later lines dropped from the end to fit. */
|
|
306
|
+
export declare const TRIM_MARKER_MAX_LINES = 6;
|
|
307
|
+
export declare const TRIM_MARKER_MAX_CHARS = 400;
|
|
220
308
|
/** How far forward to look for a retry of the same tool after an error. */
|
|
221
309
|
export declare const ERROR_RETRY_WINDOW = 6;
|
|
222
310
|
/** How far forward to look for that retry's resolving (non-error) result. */
|
|
223
311
|
export declare const ERROR_RESOLVE_WINDOW = 10;
|
|
312
|
+
/** Handoff seed cap (same as a pivot carryover); recall gets a bounded share. */
|
|
313
|
+
export declare const HANDOFF_MAX_CHARS = 16000;
|
|
314
|
+
export declare const HANDOFF_RECALL_MAX_CHARS = 6000;
|
|
315
|
+
export declare const HANDOFF_RECALL_LIMIT = 5;
|
|
316
|
+
/** Parent sessions `smart_context scope=lineage` follows through `parentSession` headers, and the largest file it loads. */
|
|
317
|
+
export declare const LINEAGE_MAX_DEPTH = 3;
|
|
318
|
+
export declare const LINEAGE_MAX_FILE_BYTES: number;
|
|
224
319
|
export declare const METRICS_BUFFER_MAX = 200;
|
|
225
320
|
export declare const RUNTIME_LOG_MAX_BYTES: number;
|
|
226
321
|
export declare const CONFIG_KEY = "smartCompact";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Api, Model, Usage } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { MetricsSnapshot } from "../types.ts";
|
|
3
|
+
export type RouteModelResolver = (provider: string, model: string) => Model<Api> | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Provider-reported usage of one compaction run in Pi's `Usage` shape, so a
|
|
6
|
+
* `session_before_compact` result can carry it into Pi's session totals.
|
|
7
|
+
*
|
|
8
|
+
* Tokens come from the run's per-route metrics (or the run totals when no
|
|
9
|
+
* route rows exist). Cost uses the catalog rates of each route's model, the
|
|
10
|
+
* way Pi prices its own requests; an unresolvable model contributes tokens
|
|
11
|
+
* but no cost. Returns undefined when the run made no provider call or when
|
|
12
|
+
* any route's usage was estimated rather than reported: Pi's totals must not
|
|
13
|
+
* mix local estimates with provider counts.
|
|
14
|
+
*/
|
|
15
|
+
export declare function compactionUsage(snapshot: Pick<MetricsSnapshot, "totalCalls" | "totalInput" | "totalOutput" | "totalCacheHit" | "totalCacheWrite" | "providerRoutes" | "provider" | "model">, resolveModel: RouteModelResolver): Usage | undefined;
|
|
16
|
+
//# sourceMappingURL=compaction-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-usage.d.ts","sourceRoot":"","sources":["../../src/domain/compaction-usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AAQ7F;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC9B,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,UAAU,GAAG,OAAO,CAAC,EAC5J,YAAY,EAAE,kBAAkB,GAC9B,KAAK,GAAG,SAAS,CA2BnB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { LLMCallMetric } from "../types.ts";
|
|
3
|
+
type CapacityModel = Pick<Model<Api>, "provider" | "id" | "contextWindow" | "maxTokens">;
|
|
4
|
+
export declare function clampCompletionMaxTokens(model: CapacityModel, requested: number | undefined): number | undefined;
|
|
5
|
+
/** Local estimate, not a provider tokenizer guarantee. Applied again to each built request. */
|
|
6
|
+
export declare function modelRequestCapacityReason(model: CapacityModel, estimatedInputTokens: number, requestedOutputTokens: number | undefined): string | undefined;
|
|
7
|
+
export declare class ModelCapacityError extends Error {
|
|
8
|
+
readonly phase: LLMCallMetric["phase"];
|
|
9
|
+
constructor(phase: LLMCallMetric["phase"], reason: string);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=model-capacity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-capacity.d.ts","sourceRoot":"","sources":["../../src/domain/model-capacity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,eAAe,GAAG,WAAW,CAAC,CAAC;AAMzF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,SAAS,CAMpB;AAED,+FAA+F;AAC/F,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,aAAa,EACpB,oBAAoB,EAAE,MAAM,EAC5B,qBAAqB,EAAE,MAAM,GAAG,SAAS,GACxC,MAAM,GAAG,SAAS,CAapB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC/B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAAlD,YAAqB,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAGjE;CACF"}
|
|
@@ -9,12 +9,19 @@ export interface ProviderEvaluationCell {
|
|
|
9
9
|
calls: number;
|
|
10
10
|
successRate: number;
|
|
11
11
|
avgLatencyMs: number;
|
|
12
|
+
/** Quota-inclusive: input + cacheRead + cacheWrite + output per call. */
|
|
12
13
|
avgTokensPerCall: number;
|
|
14
|
+
avgCacheReadTokensPerCall: number;
|
|
15
|
+
avgCacheWriteTokensPerCall: number;
|
|
13
16
|
avgQuality: number | null;
|
|
14
17
|
qualityCoverage: number;
|
|
15
18
|
score: number;
|
|
16
19
|
confidence: number;
|
|
17
20
|
eligible: boolean;
|
|
21
|
+
/** Present when any contributing run used estimated usage. */
|
|
22
|
+
usageBasis?: "reported" | "estimated";
|
|
23
|
+
/** Subscription (OAuth) rows must never be priced at API rates. */
|
|
24
|
+
billing?: "api" | "subscription";
|
|
18
25
|
}
|
|
19
26
|
export interface ProviderRouteRecommendation {
|
|
20
27
|
stage: ProviderRouteStage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-evaluation.d.ts","sourceRoot":"","sources":["../../src/domain/provider-evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAC5E,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,gBAAgB,GACxB,wBAAwB,GAAG,eAAe,GAAG,oBAAoB,GACjE,yBAAyB,GAAG,gBAAgB,GAAG,qBAAqB,GACpE,yBAAyB,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;AA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AwB,GAAG,MAAM,CAwBjF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompactMetricsEntry, TelemetryFailureKind } from "../types.ts";
|
|
1
|
+
import type { CompactMetricsEntry, PreparationDiscardReason, TelemetryFailureKind } from "../types.ts";
|
|
2
2
|
export interface DamageTelemetryEntry {
|
|
3
3
|
ts?: string;
|
|
4
4
|
/** Originating compaction run; required for trustworthy quality/damage joins. */
|
|
@@ -10,7 +10,10 @@ export interface DamageTelemetryEntry {
|
|
|
10
10
|
}
|
|
11
11
|
export interface TelemetryWindowStats {
|
|
12
12
|
runs: number;
|
|
13
|
+
/** Host-confirmed applies only (status success). */
|
|
13
14
|
appliedRuns: number;
|
|
15
|
+
/** Real non-dry, non-cancel attempts backing the failure-rate signal. */
|
|
16
|
+
attemptedRuns: number;
|
|
14
17
|
successRate: number;
|
|
15
18
|
avgQuality: number | null;
|
|
16
19
|
qualityCoverage: number;
|
|
@@ -37,22 +40,58 @@ export interface CanaryAssessment {
|
|
|
37
40
|
}
|
|
38
41
|
export interface PrivacySafeTelemetryAggregate {
|
|
39
42
|
version: string;
|
|
40
|
-
|
|
43
|
+
/** "unknown" when an entry carries no explicit channel; never silently stable. */
|
|
44
|
+
channel: "stable" | "canary" | "unknown";
|
|
41
45
|
provider: string;
|
|
42
46
|
model: string;
|
|
43
47
|
runs: number;
|
|
48
|
+
/** Host-confirmed applies only. */
|
|
44
49
|
successes: number;
|
|
45
50
|
avgQuality: number | null;
|
|
46
51
|
avgLatencyMs: number;
|
|
47
52
|
inputTokens: number;
|
|
53
|
+
cacheReadTokens: number;
|
|
54
|
+
cacheWriteTokens: number;
|
|
48
55
|
outputTokens: number;
|
|
49
56
|
}
|
|
57
|
+
/** Content-free policy measurements for speculative preparation. */
|
|
58
|
+
export interface PreparationPolicyStats {
|
|
59
|
+
preparedRuns: number;
|
|
60
|
+
usedRuns: number;
|
|
61
|
+
discardedRuns: number;
|
|
62
|
+
/** Prepared runs that ended in timeout/error — real failures, not discards. */
|
|
63
|
+
otherOutcomes: number;
|
|
64
|
+
discardReasons: Partial<Record<PreparationDiscardReason, number>>;
|
|
65
|
+
medianReadyMs: number | null;
|
|
66
|
+
medianWaitMs: number | null;
|
|
67
|
+
/** used / (used + discarded); null before the first resolvable outcome. */
|
|
68
|
+
reuseRate: number | null;
|
|
69
|
+
/** Spend on work that never applied; counted once, never in the applied cohort. */
|
|
70
|
+
discardedCost: {
|
|
71
|
+
calls: number;
|
|
72
|
+
inputTokens: number;
|
|
73
|
+
cacheReadTokens: number;
|
|
74
|
+
cacheWriteTokens: number;
|
|
75
|
+
outputTokens: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** Aggregate visibility for existing verifier-provenance fields. */
|
|
79
|
+
export interface QualityProvenanceStats {
|
|
80
|
+
measuredRuns: number;
|
|
81
|
+
avgInitialQuality: number | null;
|
|
82
|
+
avgRepairGain: number | null;
|
|
83
|
+
deterministicPatchRuns: number;
|
|
84
|
+
llmPatchRuns: number;
|
|
85
|
+
qualityFloorRuns: number;
|
|
86
|
+
}
|
|
50
87
|
export interface PrivacySafeTelemetry {
|
|
51
88
|
generatedAt: string;
|
|
52
89
|
totalRuns: number;
|
|
53
90
|
aggregates: PrivacySafeTelemetryAggregate[];
|
|
54
91
|
failures: Partial<Record<TelemetryFailureKind, number>>;
|
|
55
92
|
canary: CanaryAssessment;
|
|
93
|
+
preparation: PreparationPolicyStats;
|
|
94
|
+
qualityProvenance: QualityProvenanceStats;
|
|
56
95
|
privacy: "aggregate-only; no session ids, project ids, prompts, summaries, paths, or error text";
|
|
57
96
|
}
|
|
58
97
|
/** Stable, content-free failure taxonomy for aggregate telemetry. */
|
|
@@ -64,6 +103,8 @@ export declare function assessCanary(entries: readonly CompactMetricsEntry[], da
|
|
|
64
103
|
}): CanaryAssessment;
|
|
65
104
|
export declare const TELEMETRY_FAILURE_KINDS: ReadonlySet<TelemetryFailureKind>;
|
|
66
105
|
export declare function isTelemetryFailureKind(value: unknown): value is TelemetryFailureKind;
|
|
106
|
+
export declare function buildPreparationStats(entries: readonly CompactMetricsEntry[]): PreparationPolicyStats;
|
|
107
|
+
export declare function buildQualityProvenanceStats(entries: readonly CompactMetricsEntry[]): QualityProvenanceStats;
|
|
67
108
|
export declare function buildPrivacySafeTelemetry(entries: readonly CompactMetricsEntry[], damageEntries: readonly DamageTelemetryEntry[], options: {
|
|
68
109
|
version: string;
|
|
69
110
|
minCanaryRuns?: number;
|