pi-posthorse 0.10.33 → 0.10.35
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/package.json +4 -4
- package/src/history-pages.ts +6 -2
- package/src/history-search.ts +12 -4
- package/src/history.ts +1 -1
- package/ui.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-posthorse",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Posthorse: fresh context, same journey. No-summary context rollover for Pi, with sparse budget reminders, handoffs, notes, and history.",
|
|
6
6
|
"keywords": [
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"@earendil-works/pi-tui": "1.5.2",
|
|
73
73
|
"@types/node": "24.19.1",
|
|
74
74
|
"oxc-parser": "0.157.0",
|
|
75
|
-
"oxfmt": "0.
|
|
76
|
-
"oxlint": "1.
|
|
77
|
-
"
|
|
75
|
+
"oxfmt": "0.79.0",
|
|
76
|
+
"oxlint": "1.94.0",
|
|
77
|
+
"tsrs": "7.1.0-beta.tsrs2",
|
|
78
78
|
"typebox": "1.3.27",
|
|
79
79
|
"typescript": "7.0.2",
|
|
80
80
|
"yaml": "2.9.1"
|
package/src/history-pages.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { textResult, type TextResult } from "./ui/display.ts";
|
|
9
9
|
import { excerpt, shortKey, sourceTag } from "./message-text.ts";
|
|
10
10
|
import { cursorFor as cursorAt } from "./history-cursor.ts";
|
|
11
|
-
import type
|
|
11
|
+
import { MAX_SEARCH_LIMIT, type HistoryMatches, type HistoryParams } from "./history-search.ts";
|
|
12
12
|
import type { PageAccess } from "./paging.ts";
|
|
13
13
|
|
|
14
14
|
type Continuation<Position> =
|
|
@@ -170,8 +170,12 @@ export function historyReadPage(
|
|
|
170
170
|
continuation.kind === "more"
|
|
171
171
|
? `\nMore remains; call history read with id "${shownId}" and offset ${continuation.next.offset}${item.images.length > 0 ? ` and imageOffset ${continuation.next.imageOffset}` : ""}.`
|
|
172
172
|
: "";
|
|
173
|
+
const limitHint =
|
|
174
|
+
(params.limit ?? 0) > MAX_SEARCH_LIMIT
|
|
175
|
+
? "\n[Omit limit for history read. It sets the search result count, not the read page size.]"
|
|
176
|
+
: "";
|
|
173
177
|
const header = `${item.entry.timestamp ?? ""}${sourceTag(source)} [window ${item.windowId}] [${shownId}] [chars ${offset}-${end} of ${item.text.length}] `;
|
|
174
|
-
return textResult(`${header}${item.text.slice(offset, end)}${more}`, images, {
|
|
178
|
+
return textResult(`${header}${item.text.slice(offset, end)}${more}${limitHint}`, images, {
|
|
175
179
|
kind: "history-read",
|
|
176
180
|
headerLength: header.length,
|
|
177
181
|
offset,
|
package/src/history-search.ts
CHANGED
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
sessionWindowEntries,
|
|
20
20
|
} from "./session-files.ts";
|
|
21
21
|
|
|
22
|
+
const DEFAULT_SEARCH_LIMIT = 10;
|
|
23
|
+
export const MAX_SEARCH_LIMIT = 50;
|
|
24
|
+
|
|
22
25
|
export const historyParameters = Type.Object(
|
|
23
26
|
{
|
|
24
27
|
op: Type.Enum(["search", "read"], {
|
|
@@ -38,9 +41,8 @@ export const historyParameters = Type.Object(
|
|
|
38
41
|
),
|
|
39
42
|
limit: Type.Optional(
|
|
40
43
|
Type.Integer({
|
|
41
|
-
description:
|
|
44
|
+
description: `Search only: maximum results per page (1–${MAX_SEARCH_LIMIT}, default ${DEFAULT_SEARCH_LIMIT}). Omit for read; use its returned offset and imageOffset, if shown.`,
|
|
42
45
|
minimum: 1,
|
|
43
|
-
maximum: 50,
|
|
44
46
|
}),
|
|
45
47
|
),
|
|
46
48
|
cursor: Type.Optional(
|
|
@@ -51,7 +53,10 @@ export const historyParameters = Type.Object(
|
|
|
51
53
|
}),
|
|
52
54
|
),
|
|
53
55
|
offset: Type.Optional(
|
|
54
|
-
Type.Integer({
|
|
56
|
+
Type.Integer({
|
|
57
|
+
description: "Read only: character offset from the previous page (default 0)",
|
|
58
|
+
minimum: 0,
|
|
59
|
+
}),
|
|
55
60
|
),
|
|
56
61
|
imageOffset: Type.Optional(
|
|
57
62
|
Type.Integer({
|
|
@@ -324,8 +329,11 @@ export async function historyMatches(
|
|
|
324
329
|
signal: AbortSignal | undefined,
|
|
325
330
|
fail: (message: string) => never,
|
|
326
331
|
): Promise<HistoryMatches> {
|
|
332
|
+
const limit = params.limit ?? DEFAULT_SEARCH_LIMIT;
|
|
333
|
+
if (limit > MAX_SEARCH_LIMIT) {
|
|
334
|
+
fail(`History search limit must be between 1 and ${MAX_SEARCH_LIMIT} results per page.`);
|
|
335
|
+
}
|
|
327
336
|
const query = requireValue(params.query, "query", params.op).toLowerCase();
|
|
328
|
-
const limit = params.limit ?? 10;
|
|
329
337
|
const key = shortKey(JSON.stringify([query, params.all === true]));
|
|
330
338
|
let cursor: HistoryCursor | undefined;
|
|
331
339
|
try {
|
package/src/history.ts
CHANGED
|
@@ -81,7 +81,7 @@ export function registerHistory(
|
|
|
81
81
|
label: "History",
|
|
82
82
|
...toolCards("history"),
|
|
83
83
|
description:
|
|
84
|
-
"Search or read earlier session entries, including previous context windows. search skips entries still in your active context and lists original content before recovery echoes, newest first; all=true also searches this project's other sessions and subagent runs. read takes an entry id exactly as search printed it and
|
|
84
|
+
"Search or read earlier session entries, including previous context windows. search skips entries still in your active context and lists original content before recovery echoes, newest first; all=true also searches this project's other sessions and subagent runs. search pages with cursor; limit is a search result count only. read takes an entry id exactly as search printed it. Omit limit and continue with the returned offset and imageOffset, if shown.",
|
|
85
85
|
promptSnippet: "recover earlier conversation that left the active context window",
|
|
86
86
|
promptGuidelines: [
|
|
87
87
|
"Use history search first, then history read with the entry id exactly as printed",
|
package/ui.ts
CHANGED
|
@@ -47,7 +47,9 @@ export function registerPosthorseMessages(pi: ExtensionAPI): void {
|
|
|
47
47
|
const previewText = leadingRows(preview, theme, "toolOutput", previewRows);
|
|
48
48
|
const expandHint = options.keyHint("app.tools.expand", "to expand");
|
|
49
49
|
let fullText: Text | undefined;
|
|
50
|
-
let cached:
|
|
50
|
+
let cached:
|
|
51
|
+
| { readonly width: number; readonly lines: ReturnType<Component["render"]> }
|
|
52
|
+
| undefined;
|
|
51
53
|
const historyText = textBlock("Earlier conversation remains in history.", theme, "muted");
|
|
52
54
|
const messageLines = (inner: number, expanded: boolean): string[] => {
|
|
53
55
|
const title = `${expanded ? "▾" : "▸"} ${window ? "Context window started" : "Checkpoint reminder"}`;
|