@danypops/pi-lector 0.9.0 → 0.9.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.
@@ -34,7 +34,7 @@ import {
34
34
  type ExtensionAPI,
35
35
  } from "@earendil-works/pi-coding-agent";
36
36
  import { Text, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
37
- import { Table, type TextMeasure } from "malevich-tui-components";
37
+ import { renderBoundedTable, type TextMeasure } from "malevich-tui-components";
38
38
  import { Type } from "typebox";
39
39
 
40
40
  /** Real ANSI-aware measurement for Table -- Malevich's own default is ASCII-only, unsafe against theme-styled cell/header text. */
@@ -99,6 +99,8 @@ import {
99
99
  formatRepoCacheListResult,
100
100
  formatRepoFetchResult,
101
101
  REPO_CACHE_TABLE_COLUMNS,
102
+ REPO_CACHE_VISIBLE_ROWS,
103
+ repoCacheMoreLine,
102
104
  } from "./repo-cache-rendering.ts";
103
105
  import { createLectorRepoFetchOperations } from "./repo-fetch-operations.ts";
104
106
  import { createLectorSearchOperations } from "./search-operations.ts";
@@ -1447,7 +1449,7 @@ export default function (pi: ExtensionAPI) {
1447
1449
  text.setText(formatRepoCacheCall(action, args, theme));
1448
1450
  return text;
1449
1451
  },
1450
- renderResult(result, { isPartial }, theme, context) {
1452
+ renderResult(result, { isPartial, expanded }, theme, context) {
1451
1453
  if (isPartial) return new Text(theme.fg("warning", "Working on repo cache..."), 0, 0);
1452
1454
  if (context.isError) {
1453
1455
  const errorText = result.content
@@ -1457,16 +1459,23 @@ export default function (pi: ExtensionAPI) {
1457
1459
  return new Text(theme.fg("error", errorText || "repo_cache failed"), 0, 0);
1458
1460
  }
1459
1461
  const details = result.details as RepoCacheToolDetails | undefined;
1460
- // A non-empty list renders as a real Table -- the human channel actually shows
1461
- // host/owner/repo/ref/registered/size/fetched, not just a bare count. Every other
1462
- // branch (empty list, fetch, evict) stays a plain Text line as before.
1462
+ // A non-empty list renders as a real, bounded Table -- the human channel actually shows
1463
+ // host/owner/repo/ref/registered/size/fetched, not just a bare count, capped at
1464
+ // REPO_CACHE_VISIBLE_ROWS since a cache can grow arbitrarily large even though maxResults
1465
+ // bounds any one page. Every other branch (empty list, fetch, evict) stays a plain Text line.
1463
1466
  if (details?.action === "list" && details.page.entries.length > 0) {
1464
- const table =
1465
- context.lastComponent instanceof Table
1466
- ? context.lastComponent
1467
- : new Table({ columns: REPO_CACHE_TABLE_COLUMNS, rows: [], measure: tableMeasure, headerStyle: (s) => theme.fg("muted", theme.bold(s)) });
1468
- table.setRows(buildRepoCacheTableRows(details.page.entries));
1469
- return table;
1467
+ // Rebuilt fresh on every call (not reused via context.lastComponent) since expanded is
1468
+ // fixed at BoundedTable construction, matching every other truncated-list renderer in this
1469
+ // codebase (they all call renderTruncatedList fresh with the current expanded each time).
1470
+ return renderBoundedTable({
1471
+ columns: REPO_CACHE_TABLE_COLUMNS,
1472
+ rows: buildRepoCacheTableRows(details.page.entries),
1473
+ expanded,
1474
+ visibleRowCount: REPO_CACHE_VISIBLE_ROWS,
1475
+ moreLine: repoCacheMoreLine(theme),
1476
+ measure: tableMeasure,
1477
+ headerStyle: (s) => theme.fg("muted", theme.bold(s)),
1478
+ });
1470
1479
  }
1471
1480
  const text = context.lastComponent instanceof Text ? context.lastComponent : new Text("", 0, 0);
1472
1481
  if (details?.action === "list") text.setText(formatRepoCacheListResult(details.page, theme));
@@ -1,7 +1,15 @@
1
1
  import type { CachedRepositoryEntry, CachedRepositoryPage, RepoFetchResult } from "@danypops/lector";
2
+ import { keyHint } from "@earendil-works/pi-coding-agent";
2
3
  import type { TableColumn } from "malevich-tui-components";
3
4
  import type { LectorTheme } from "./lector-tui-theme.ts";
4
5
 
6
+ /** Table has no row-count bound of its own; a cache can grow arbitrarily large even though repo_cache's own `maxResults` bounds any one page, so the display itself still needs a cap independent of that. */
7
+ export const REPO_CACHE_VISIBLE_ROWS = 20;
8
+
9
+ export function repoCacheMoreLine(theme: LectorTheme): (hiddenCount: number) => string {
10
+ return (hiddenCount) => theme.fg("dim", `... ${hiddenCount} more (${keyHint("app.tools.expand", "to expand")})`);
11
+ }
12
+
5
13
  type RepoCacheAction = "fetch" | "list" | "evict";
6
14
 
7
15
  export function formatRepoCacheCall(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/pi-lector",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Pi host adapter for Lector: overrides read/write/edit with a daemon-backed, hash-guarded filesystem",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@danypops/vehicle-client": "^0.1.1",
22
22
  "@danypops/lector": "^0.10.0",
23
- "malevich-tui-components": "^0.17.0"
23
+ "malevich-tui-components": "^0.19.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@earendil-works/pi-ai": "^0.81.1",