pi-tuck 1.0.24 → 1.0.26
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 +49 -0
- package/README.md +3 -2
- package/dist/src/build-id.d.ts +1 -1
- package/dist/src/build-id.js +1 -1
- package/dist/src/compaction.d.ts +2 -1
- package/dist/src/compaction.js +218 -43
- package/dist/src/diagnostics.d.ts +1 -1
- package/dist/src/request-capacity.d.ts +20 -3
- package/dist/src/request-capacity.js +55 -8
- package/dist/src/status.d.ts +2 -0
- package/dist/src/status.js +3 -0
- package/dist/src/tuck.d.ts +1 -0
- package/dist/src/tuck.js +8 -0
- package/package.json +1 -1
- package/src/build-id.ts +1 -1
- package/src/compaction.ts +208 -51
- package/src/request-capacity.ts +53 -9
- package/src/status.ts +4 -1
- package/src/tuck.ts +9 -1
package/src/status.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const LOADED_VERSION: string = (() => {
|
|
|
15
15
|
export function statusText(input: {
|
|
16
16
|
version: string;
|
|
17
17
|
active: boolean;
|
|
18
|
-
branch: readonly { type: string; tokensBefore?: unknown; details?: unknown }[];
|
|
18
|
+
branch: readonly { type: string; tokensBefore?: unknown; details?: unknown; customType?: unknown; data?: unknown }[];
|
|
19
19
|
cutAt: number | undefined;
|
|
20
20
|
search: boolean;
|
|
21
21
|
semantic: { state: SemanticState; lastError: string | null };
|
|
@@ -27,6 +27,8 @@ export function statusText(input: {
|
|
|
27
27
|
const cutLine = ours.length === 0 ? "Cuts: none yet in this session. The recall tools appear after the first cut."
|
|
28
28
|
: `Cuts: ${ours.length} by pi-tuck in this session` + (typeof before === "number" && typeof after === "number" ? `, the last from ${count(before)} to ${count(after)} tokens.` : ".");
|
|
29
29
|
const native = cuts.length - ours.length;
|
|
30
|
+
const retries = input.branch.filter(entry => entry.type === "custom" && entry.customType === "pi-tuck-capacity" &&
|
|
31
|
+
(entry.data as { kind?: unknown } | null | undefined)?.kind === "retry").length;
|
|
30
32
|
const searchLine = !input.search ? "Search: by keyword (search by meaning needs macOS on Apple silicon)."
|
|
31
33
|
: input.semantic.state === "ready" || input.semantic.state === "waiting" ? "Search: by meaning and keyword."
|
|
32
34
|
: input.semantic.state === "preparing" ? "Search: by meaning and keyword; indexing history in the background."
|
|
@@ -34,6 +36,7 @@ export function statusText(input: {
|
|
|
34
36
|
return [
|
|
35
37
|
`pi-tuck ${input.version} (the version this session loaded; restart Pi after an update).`,
|
|
36
38
|
cutLine,
|
|
39
|
+
...(retries ? [`Retries: ${retries} after thinking-only length stops in this session.`] : []),
|
|
37
40
|
...(native > 0 ? [`Pi's own compaction cut ${native} time${native === 1 ? "" : "s"} in this session.`] : []),
|
|
38
41
|
input.cutAt === undefined ? "Cut point: adapts by itself." : `Cut point: fixed at cutAt ${input.cutAt} of the input room. Remove cutAt from pi-tuck.json to let it adapt.`,
|
|
39
42
|
searchLine,
|
package/src/tuck.ts
CHANGED
|
@@ -59,7 +59,7 @@ export function tuckDraft(tuck: Tuck, event: SessionBeforeCompactEvent, ctx: Ext
|
|
|
59
59
|
/** `newPrompt`: the cut is planned for a run that has not begun (a prompt Pi has not appended yet, an operator's manual cut, Pi's own cut before
|
|
60
60
|
* a run a custom message starts); the session has moved on from an ended run.
|
|
61
61
|
* `reRenderSummary`: the cut is due, so its summary may be re-rendered smaller (see the `no_live_messages` branch below). */
|
|
62
|
-
export function tuckObservedDraft(tuck: Tuck, input: { branchEntries: SessionEntry[]; tokensBefore: number; previousSummary?: string; operatorManual?: boolean; newPrompt?: boolean; reRenderSummary?: boolean; protectedPromptEntryId?: string }, ctx: ExtensionContext,
|
|
62
|
+
export function tuckObservedDraft(tuck: Tuck, input: { branchEntries: SessionEntry[]; tokensBefore: number; previousSummary?: string; operatorManual?: boolean; newPrompt?: boolean; reRenderSummary?: boolean; protectedPromptEntryId?: string; deepest?: boolean }, ctx: ExtensionContext,
|
|
63
63
|
reserveTokens: number, measure: Measure, policy: RecallPolicy = {}, retainCurrentInput = true): Draft {
|
|
64
64
|
const { isHistorySource, readable } = createRecall(policy);
|
|
65
65
|
const projected = ctx.sessionManager.buildSessionProjection();
|
|
@@ -304,6 +304,14 @@ export function tuckObservedDraft(tuck: Tuck, input: { branchEntries: SessionEnt
|
|
|
304
304
|
};
|
|
305
305
|
const calibrationHigh = highAt(floorBoundary, minimumOpeningLength);
|
|
306
306
|
const floorSummary = render(calibrationHigh.rows), floorProjection = preview(floorSummary, floorBoundary);
|
|
307
|
+
// The last admission attempt and thinking-only retry share this exact floor: whole protected prompts, the smallest
|
|
308
|
+
// existing summary representation, and the required fresh/native suffix. No historical fill or room target spends reply space.
|
|
309
|
+
if (input.deepest) {
|
|
310
|
+
assertNativeToolRounds(floorProjection);
|
|
311
|
+
const after = measure(floorProjection);
|
|
312
|
+
return { compaction: { summary: floorSummary, firstKeptEntryId: entries[floorBoundary]?.id ?? "", tokensBefore: input.tokensBefore,
|
|
313
|
+
details: { ...detailsAt(floorBoundary), tokensAfter: after, carriedTarget: after, view: "shrunk-dialogue", mode: "shrunk", deepest: true } }, after, mode: "shrunk" };
|
|
314
|
+
}
|
|
307
315
|
const offset = measure(floorProjection) - nativeAt(floorBoundary) - summaryTokens(floorSummary.length);
|
|
308
316
|
const price = (characters: number, boundary: number) => offset + nativeAt(boundary) + summaryTokens(characters);
|
|
309
317
|
const listCache = new Map<number, { files: ReturnType<typeof ledgerItems>; actions: ReturnType<typeof actionItems>; records: TranscriptRecord[] }>();
|