pi-posthorse 0.10.9 → 0.10.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-posthorse",
3
- "version": "0.10.9",
3
+ "version": "0.10.10",
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": [
@@ -71,9 +71,9 @@
71
71
  "@earendil-works/pi-coding-agent": "1.5.0",
72
72
  "@earendil-works/pi-tui": "1.5.0",
73
73
  "@types/node": "24.19.1",
74
- "oxc-parser": "0.156.0",
75
- "oxfmt": "0.75.0",
76
- "oxlint": "1.90.0",
74
+ "oxc-parser": "0.157.0",
75
+ "oxfmt": "0.76.0",
76
+ "oxlint": "1.91.0",
77
77
  "oxlint-tsgolint": "7.0.2005",
78
78
  "typebox": "1.3.27",
79
79
  "typescript": "7.0.2",
@@ -70,9 +70,7 @@ export function registerContextTools(
70
70
  }),
71
71
  ),
72
72
  }),
73
- // Pi's fixed tool contract supplies id, params, signal, updates, and context.
74
- // oxlint-disable-next-line max-params -- QX-002: Pi supplies five fixed positional tool arguments.
75
- async execute(id, { handoff }, _signal, _onUpdate, ctx) {
73
+ async execute(...[id, { handoff }, , , ctx]) {
76
74
  const trimmed = handoff?.trim();
77
75
  const limit = freshPayloadChars(policy(ctx), activeToolTokens());
78
76
  if (trimmed !== undefined && trimmed !== "" && trimmed.length > limit) {
@@ -98,9 +96,7 @@ export function registerContextTools(
98
96
  promptSnippet:
99
97
  "verify remaining context before reporting a token count or changing plans because of context limits",
100
98
  parameters: Type.Object({}),
101
- // Pi's fixed tool contract supplies id, params, signal, updates, and context.
102
- // oxlint-disable-next-line max-params -- QX-002: Pi supplies five fixed positional tool arguments.
103
- async execute(_id, _params, _signal, _onUpdate, ctx) {
99
+ async execute(...[, , , , ctx]) {
104
100
  return contextReport(policy(ctx));
105
101
  },
106
102
  });
package/src/contracts.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { PosthorseDisplay } from "../ui.ts";
3
3
 
4
+ export { isRecord } from "./records.ts";
5
+
4
6
  export type CompactionPolicy = {
5
7
  readonly enabled: boolean;
6
8
  readonly reserveTokens: number;
@@ -108,9 +110,6 @@ export const REMINDER_TYPE = "posthorse-reminder";
108
110
  export const AUTO_HANDOFF_PREFIX = "Automatic context rollover recovery record.";
109
111
  export const EMPTY_HANDOFF = "Fresh context. Restore relevant notes and history before continuing.";
110
112
 
111
- export function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
112
- return typeof value === "object" && value !== null && !Array.isArray(value);
113
- }
114
113
  export function unknownArray(value: unknown): readonly unknown[] | undefined {
115
114
  return Array.isArray(value) ? value : undefined;
116
115
  }
package/src/history.ts CHANGED
@@ -127,9 +127,7 @@ export function registerHistory(
127
127
  }),
128
128
  ),
129
129
  }),
130
- // Pi's fixed tool contract supplies id, params, signal, updates, and context.
131
- // oxlint-disable-next-line max-params -- QX-002: Pi supplies five fixed positional tool arguments.
132
- async execute(_id, params, signal, _onUpdate, ctx) {
130
+ async execute(...[, params, signal, , ctx]) {
133
131
  const source = historySource(ctx);
134
132
  if (params.op === "search") {
135
133
  const fail = (message: string): never =>
package/src/notes.ts CHANGED
@@ -330,9 +330,7 @@ export function registerNotes(
330
330
  }),
331
331
  ),
332
332
  }),
333
- // Pi's fixed tool contract supplies id, params, signal, updates, and context.
334
- // oxlint-disable-next-line max-params -- QX-002: Pi supplies five fixed positional tool arguments.
335
- async execute(_id, params, signal, _onUpdate, ctx) {
333
+ async execute(...[_id, params, signal, , ctx]) {
336
334
  // Migrate newly returned legacy package notes without changing this session’s binding.
337
335
  notesDir(ctx.cwd);
338
336
  const session = await store.get(ctx);
package/src/records.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
2
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3
+ }
package/src/ui/text.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { Text, stripTerminalSequences, truncateToWidth } from "@earendil-works/pi-tui";
3
+ import { isRecord } from "../records.ts";
4
+
5
+ export { isRecord } from "../records.ts";
3
6
 
4
7
  export type OutputColor = "toolOutput" | "muted" | "dim" | "error" | "warning";
5
8
 
@@ -8,10 +11,6 @@ export function clean(value: string): string {
8
11
  return stripTerminalSequences(value).replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f\ufff9-\ufffb]/g, "");
9
12
  }
10
13
 
11
- export function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
12
- return value !== null && typeof value === "object" && !Array.isArray(value);
13
- }
14
-
15
14
  export function argsOf(value: unknown): Readonly<Record<string, unknown>> {
16
15
  return isRecord(value) ? value : {};
17
16
  }