pi-smart-compact 7.15.0 → 7.15.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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [7.15.1] - 2026-06-15
4
+
5
+ ### Fixed
6
+ - **Delta section placement** — `injectDeltaSection` contained a dead ternary (`hasOpenLoops ? "next-steps" : "next-steps"`) that made the `hasOpenLoops` computation unreachable, so the "Changes Since Last Compaction" section always anchored before `Next Steps` regardless of whether `Open Loops` was present. The domain layer (`summary-parse.ts`) now supports a structured `SectionPlacement` hint with both `before` and `after` semantics; the delta injector anchors *after* `Open Loops` when present, otherwise *before* `Next Steps`. The new object form is additive — the legacy positional `before` argument remains backward-compatible.
7
+ - **Shadowed catch binding in exploration parser** — `parseExplorationReport` used `e` for both `lastIndexOf("}")` and the per-`catch` error, which compiled but was a confusing trap for future edits. Renamed the loop bounds to `startIdx`/`endIdx` and the catch bindings to `err`.
8
+ - **Defensive guards in LLM-output parsing** — `buildExplorationReportFromParsed` now validates `typeof parsed === "object"` before touching it, so a model that returns a primitive JSON value (`42`, `"ok"`, `true`, `null`) falls back to heuristic boundaries instead of risking a `TypeError`.
9
+ - **Non-negative index guard** — `branchIndexToMsgIndex` (used by anchor-aware keep-boundary resolution) now clamps to `Math.max(0, ...)`, so a future code path that reaches it without a prior message entry can never produce a negative index.
10
+
11
+ ### Changed
12
+ - **Typed theme in TUI overlays** — `renderContextBar` and `renderTokenBar` no longer take `theme: any`; they now use the real `Theme` class exported from `@earendil-works/pi-coding-agent`, restoring compile-time type safety over `.fg()` / `.bold()` calls without inventing a parallel local interface.
13
+
14
+ ### Build
15
+ - **Pi runtime peers 0.79.4** — `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, and `@earendil-works/pi-tui` resolved from 0.79.0 → 0.79.4. Peer dependency ranges remain wide (`*`).
16
+ - **`typebox` 1.2.11** — Patch upgrade from 1.2.3.
17
+ - **`@types/node` 25.9.3** — Patch upgrade from 25.9.2.
18
+
19
+ ### Docs
20
+ - **Architecture tables synchronized** — `ARCHITECTURE.md`'s layer tables now list every `src` module, including previously missing `pending-slot.ts`, `explore-wrap.ts`, `infra/session-identity.ts`, `utils/file-needles.ts`, `utils/file-ref-detect.ts`, and `utils/lru.ts`. README repository-layout tree and module counts updated to match (15 utility modules; 414 tests across 36 files).
21
+
22
+ ### Tests
23
+ - **7 new test cases (407 → 414)** covering `upsertSection` before/after placement and legacy back-compat, plus `buildExplorationReportFromParsed` primitive/null guards.
24
+
25
+ ### Chore
26
+ - **Ignore npm lockfile** — `.gitignore` now excludes `package-lock.json`; this project uses `bun` and the stray lockfile created by incidental `npm` commands should not be committed.
27
+
3
28
  ## [7.15.0] - 2026-06-08
4
29
 
5
30
  ### Changed
package/README.md CHANGED
@@ -324,6 +324,7 @@ At runtime, the extension writes to paths under `~/.pi/agent/`, including:
324
324
  │ ├── app/ # orchestration layer
325
325
  │ │ ├── run-smart-compact.ts # pipeline orchestrator (was core.ts)
326
326
  │ │ ├── run-context.ts # typed stage chain
327
+ │ │ ├── pending-slot.ts # encapsulated pending-compaction state cell
327
328
  │ │ ├── explore-wrap.ts # explore re-export shim
328
329
  │ │ └── steps/ # 10 stage modules
329
330
  │ │ ├── prepare.ts → resolves config + auth
@@ -350,12 +351,13 @@ At runtime, the extension writes to paths under `~/.pi/agent/`, including:
350
351
  │ │ ├── clock.ts # injectable clock
351
352
  │ │ ├── llm-client.ts # LLM client seam
352
353
  │ │ ├── llm-retry.ts # 429/5xx backoff
353
- │ │ └── services.ts # per-run services container
354
+ │ │ ├── services.ts # per-run services container
355
+ │ │ └── session-identity.ts # robust session-id resolution
354
356
  │ ├── ui/ # TUI overlays + dashboard
355
357
  │ │ ├── overlays.ts
356
358
  │ │ └── dashboard-format.ts
357
- │ └── utils/ # 13 focused utility modules
358
- ├── test/ # 280+ tests across 28 files
359
+ │ └── utils/ # 15 focused utility modules
360
+ ├── test/ # 414 tests across 36 files
359
361
  ├── docs/
360
362
  ├── dist/
361
363
  └── package.json
@@ -1 +1 @@
1
- {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/app/steps/window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQhE,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAqDzE"}
1
+ {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/app/steps/window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQhE,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CA+DzE"}
@@ -8,7 +8,7 @@ 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 = "7.15.0";
11
+ export declare const VERSION = "7.15.1";
12
12
  export declare const CHARS_PER_TOKEN = 3.8;
13
13
  export declare const COMPACT_SYSTEM_PREFIX: string;
14
14
  export declare const PROFILES: Record<CompressionProfile, ProfileConfig>;
@@ -31,16 +31,29 @@ export declare function hasSection(summary: CanonicalSummary | string, kind: Sec
31
31
  export declare function renderSummary(summary: CanonicalSummary, opts?: {
32
32
  canonicalHeadings?: boolean;
33
33
  }): string;
34
+ /**
35
+ * Placement hint for `upsertSection` when inserting a *new* section.
36
+ *
37
+ * `before`/`after` name the *kind* of an existing section that the new entry
38
+ * should anchor against. `before` inserts immediately ahead of the anchor;
39
+ * `after` inserts immediately behind it. When both are given, `before` wins
40
+ * (kept for back-compat with positional callers). When neither anchor is found
41
+ * the section falls back to append-at-end.
42
+ *
43
+ * This is how the synthesis pipeline keeps `Open Loops` ahead of `Next Steps`
44
+ * deterministically, and the delta injector places `Changes Since Last
45
+ * Compaction` directly after `Open Loops` when present.
46
+ */
47
+ export interface SectionPlacement {
48
+ before?: SectionKind;
49
+ after?: SectionKind;
50
+ }
34
51
  /**
35
52
  * Insert or replace a section. If a section with the same `kind` exists, its
36
53
  * heading is replaced with the canonical one and the body is overwritten. If
37
- * not, the section is appended.
38
- *
39
- * `before` hints at which section *kind* the new entry should precede; when
40
- * absent the section is appended. This is how the synthesis pipeline keeps
41
- * `Open Loops` ahead of `Next Steps` deterministically.
54
+ * not, the section is inserted according to `placement` (or appended).
42
55
  */
43
- export declare function upsertSection(summary: CanonicalSummary, kind: SectionKind, body: string, before?: SectionKind): CanonicalSummary;
56
+ export declare function upsertSection(summary: CanonicalSummary, kind: SectionKind, body: string, placement?: SectionKind | SectionPlacement): CanonicalSummary;
44
57
  /**
45
58
  * Append text to an existing section body. If the section is missing, it is
46
59
  * created with the provided body. This is the structural equivalent of the
@@ -1 +1 @@
1
- {"version":3,"file":"summary-parse.d.ts","sourceRoot":"","sources":["../../src/domain/summary-parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAqC,MAAM,qBAAqB,CAAC;AAmBhH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAiC/D;AAED,0DAA0D;AAC1D,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,CAGtG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAEzF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,GAAE;IAAE,iBAAiB,CAAC,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AM,EACZ,SAAS,CAAC,EAAE,WAAW,GAAG,gBAAgB,GACzC,gBAAgB,CAoClB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,YAAY,SAAK,GAChB,gBAAgB,CAWlB"}
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ var __export = (target, all) => {
16
16
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
17
 
18
18
  // src/constants.ts
19
- var VERSION = "7.15.0", CHARS_PER_TOKEN = 3.8, COMPACT_SYSTEM_PREFIX, PROFILES, DEFAULT_CONFIG, NO_OP_RE, SHIFT_RE, CHOICE_RE, SINGLE_PASS_PREFIX, SINGLE_PASS_SUFFIX = `
19
+ var VERSION = "7.15.1", CHARS_PER_TOKEN = 3.8, COMPACT_SYSTEM_PREFIX, PROFILES, DEFAULT_CONFIG, NO_OP_RE, SHIFT_RE, CHOICE_RE, SINGLE_PASS_PREFIX, SINGLE_PASS_SUFFIX = `
20
20
  {PREV_CONTEXT}
21
21
 
22
22
  {EXTRACTION_CONTEXT}
@@ -2009,7 +2009,7 @@ function branchIndexToMsgIndex(branchEntries, branchIdx, msgs) {
2009
2009
  msgCount++;
2010
2010
  }
2011
2011
  }
2012
- return Math.min(msgCount - 1, msgs.length - 1);
2012
+ return Math.max(0, Math.min(msgCount - 1, msgs.length - 1));
2013
2013
  }
2014
2014
  function smartKeepBoundary(msgs, keepFromIndex, branchEntries) {
2015
2015
  let adjusted = keepFromIndex;
@@ -2918,12 +2918,17 @@ function resolveCompactionWindow(rc) {
2918
2918
  }
2919
2919
  }
2920
2920
  keepFrom = smartKeepBoundary(msgs, keepFrom, branch);
2921
+ if (keepFrom >= msgs.length)
2922
+ keepFrom = msgs.length - 1;
2921
2923
  keepFrom = guardToolCallBoundary(msgs, keepFrom);
2924
+ if (msgs[keepFrom]?.message?.role === "toolResult") {
2925
+ return null;
2926
+ }
2922
2927
  const toCompact = msgs.slice(0, keepFrom);
2923
2928
  if (!toCompact.length)
2924
2929
  return null;
2925
2930
  const contextPercent = rc.ctx.model && totalTokens ? totalTokens / rc.ctx.model.contextWindow * 100 : 0;
2926
- const firstKeptId = msgs[keepFrom]?.id ?? msgs[msgs.length - 1]?.id;
2931
+ const firstKeptId = msgs[keepFrom].id;
2927
2932
  const sessionId = resolveSessionId(rc.ctx);
2928
2933
  const out = rc;
2929
2934
  out.sessionId = sessionId;
@@ -3761,20 +3766,20 @@ function parseExplorationReport(text, llmMessages) {
3761
3766
  const md = text.match(/```(?:json)?\s*([\s\S]*?)```/);
3762
3767
  if (md)
3763
3768
  json = md[1].trim();
3764
- let s = json.indexOf("{"), e = json.lastIndexOf("}");
3765
- if (s === -1 || e === -1)
3769
+ const startIdx = json.indexOf("{"), endIdx = json.lastIndexOf("}");
3770
+ if (startIdx === -1 || endIdx === -1)
3766
3771
  return fallbackExplorationReport(llmMessages);
3767
- let rawJson = json.slice(s, e + 1);
3772
+ const rawJson = json.slice(startIdx, endIdx + 1);
3768
3773
  try {
3769
3774
  return buildExplorationReportFromParsed(JSON.parse(rawJson), llmMessages);
3770
- } catch (e2) {
3771
- debug("JSON parse attempt 1 failed", e2);
3775
+ } catch (err) {
3776
+ debug("JSON parse attempt 1 failed", err);
3772
3777
  }
3773
3778
  const cleaned = rawJson.replace(/,\s*([}\]])/g, "$1").replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
3774
3779
  try {
3775
3780
  return buildExplorationReportFromParsed(JSON.parse(cleaned), llmMessages);
3776
- } catch (e2) {
3777
- debug("JSON parse attempt 2 (cleaned) failed", e2);
3781
+ } catch (err) {
3782
+ debug("JSON parse attempt 2 (cleaned) failed", err);
3778
3783
  }
3779
3784
  const boundaryMatch = rawJson.match(/"boundaries"\s*:\s*\[([\s\S]*?)\]/);
3780
3785
  if (boundaryMatch) {
@@ -3786,13 +3791,16 @@ function parseExplorationReport(text, llmMessages) {
3786
3791
  priority: ["critical", "high", "normal", "low"].includes(b.priority) ? b.priority : "normal",
3787
3792
  confidence: Math.min(1, Math.max(0, b.confidence ?? 0.5))
3788
3793
  })) };
3789
- } catch (e2) {
3790
- debug("Boundary JSON parse failed", e2);
3794
+ } catch (err) {
3795
+ debug("Boundary JSON parse failed", err);
3791
3796
  }
3792
3797
  }
3793
3798
  return fallbackExplorationReport(llmMessages);
3794
3799
  }
3795
3800
  function buildExplorationReportFromParsed(parsed, llmMessages) {
3801
+ if (typeof parsed !== "object" || parsed === null) {
3802
+ return fallbackExplorationReport(llmMessages);
3803
+ }
3796
3804
  return {
3797
3805
  boundaries: (parsed.boundaries ?? []).filter((b) => typeof b?.afterIndex === "number").map((b) => ({
3798
3806
  afterIndex: Math.min(b.afterIndex, llmMessages.length - 2),
@@ -4582,7 +4590,7 @@ function renderSummary(summary, opts = {}) {
4582
4590
  `).trim() + `
4583
4591
  `;
4584
4592
  }
4585
- function upsertSection(summary, kind, body, before) {
4593
+ function upsertSection(summary, kind, body, placement) {
4586
4594
  const heading = canonicalHeading(kind);
4587
4595
  const existing = summary.sections.findIndex((s) => s.kind === kind);
4588
4596
  if (existing >= 0) {
@@ -4590,15 +4598,30 @@ function upsertSection(summary, kind, body, before) {
4590
4598
  sections[existing] = { kind, heading, body: body.trim() };
4591
4599
  return { sections };
4592
4600
  }
4601
+ const hint = placement == null ? {} : typeof placement === "string" ? { before: placement } : placement;
4593
4602
  const section = { kind, heading, body: body.trim() };
4594
- if (before) {
4595
- const idx = summary.sections.findIndex((s) => s.kind === before);
4603
+ if (hint.before) {
4604
+ const idx = summary.sections.findIndex((s) => s.kind === hint.before);
4596
4605
  if (idx >= 0) {
4597
4606
  const sections = summary.sections.slice();
4598
4607
  sections.splice(idx, 0, section);
4599
4608
  return { sections };
4600
4609
  }
4601
4610
  }
4611
+ if (hint.after) {
4612
+ let idx = -1;
4613
+ for (let i = summary.sections.length - 1;i >= 0; i--) {
4614
+ if (summary.sections[i].kind === hint.after) {
4615
+ idx = i;
4616
+ break;
4617
+ }
4618
+ }
4619
+ if (idx >= 0) {
4620
+ const sections = summary.sections.slice();
4621
+ sections.splice(idx + 1, 0, section);
4622
+ return { sections };
4623
+ }
4624
+ }
4602
4625
  return { sections: [...summary.sections, section] };
4603
4626
  }
4604
4627
  function appendToSection(summary, kind, text, fallbackBody = "") {
@@ -5028,7 +5051,8 @@ function injectDeltaSection(summary, delta) {
5028
5051
  return summary;
5029
5052
  const parsed = parseSummary(summary);
5030
5053
  const hasOpenLoops = parsed.sections.some((s) => s.kind === "open-loops");
5031
- const updated = upsertSection(parsed, "changes", body, hasOpenLoops ? "next-steps" : "next-steps");
5054
+ const placement = hasOpenLoops ? { after: "open-loops" } : { before: "next-steps" };
5055
+ const updated = upsertSection(parsed, "changes", body, placement);
5032
5056
  return renderSummary(updated);
5033
5057
  }
5034
5058
  function extractNextActions(summary) {
@@ -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,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,iB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,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,oBAAoB,EAC3D,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,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"}
@@ -2,10 +2,11 @@
2
2
  * TUI overlays: model/profile selection, progress, result screen.
3
3
  */
4
4
  import type { ExtensionCommandContext, ExtensionContext } from "@earendil-works/pi-coding-agent";
5
+ import { Theme } from "@earendil-works/pi-coding-agent";
5
6
  import type { CompactMetricsEntry, CompressionProfile, ModelOption, ProgressState, SmartCompactDetails, StructuredExtraction } from "../types.ts";
6
7
  import type { SmartCompactServices } from "../infra/services.ts";
7
- export declare function renderContextBar(theme: any, pct: number, tokens: number, barLen?: number): string;
8
- export declare function renderTokenBar(theme: any, before: number, after: number, label: string, barLen?: number): string;
8
+ export declare function renderContextBar(theme: Theme, pct: number, tokens: number, barLen?: number): string;
9
+ export declare function renderTokenBar(theme: Theme, before: number, after: number, label: string, barLen?: number): string;
9
10
  export declare function selectModel(ctx: ExtensionCommandContext, opts: {
10
11
  contextTokens: number;
11
12
  contextPercent: number;
@@ -1 +1 @@
1
- {"version":3,"file":"overlays.d.ts","sourceRoot":"","sources":["../../src/ui/overlays.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAIjG,OAAO,KAAK,EACV,mBAAmB,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EACnE,mBAAmB,EAAE,oBAAoB,EAC1C,MAAM,aAAa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AAE,MAAM,EAAE,CAAC;IAC3B,oCAAoC;IACpC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,2CAA2C;IAC3C,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,2CAA2C;IAC3C,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,sDAAsD;IACtD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,eAAe,CAmD7F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CA+BjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,CA4BlF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAO5D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAIhE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-smart-compact",
3
- "version": "7.15.0",
3
+ "version": "7.15.1",
4
4
  "description": "Verification-oriented smart compaction extension for Pi Coding Agent — deterministic extraction, exploration, synthesis, verification, metrics, and safety checks.",
5
5
  "packageManager": "bun@1.3.14",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "typebox": "*"
62
62
  },
63
63
  "devDependencies": {
64
- "@types/node": "^24.0.0",
64
+ "@types/node": "^25.9.3",
65
65
  "@earendil-works/pi-ai": "*",
66
66
  "@earendil-works/pi-coding-agent": "*",
67
67
  "@earendil-works/pi-tui": "*",