@pi-unipi/unipi 2.6.1 → 2.6.2

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.
Files changed (186) hide show
  1. package/package.json +1 -2
  2. package/packages/ask-user/settings-tui.ts +18 -34
  3. package/packages/autocomplete/src/constants.ts +0 -15
  4. package/packages/autocomplete/src/provider.ts +3 -17
  5. package/packages/btw/extensions/btw.ts +18 -45
  6. package/packages/compactor/README.md +2 -2
  7. package/packages/compactor/skills/compactor/SKILL.md +1 -1
  8. package/packages/compactor/skills/compactor-detail/SKILL.md +3 -5
  9. package/packages/compactor/skills/compactor-doctor/SKILL.md +1 -1
  10. package/packages/compactor/skills/compactor-stats/SKILL.md +1 -1
  11. package/packages/compactor/src/commands/index.ts +47 -78
  12. package/packages/compactor/src/compaction/brief.ts +161 -90
  13. package/packages/compactor/src/compaction/build-sections.ts +3 -4
  14. package/packages/compactor/src/compaction/compact-args.ts +86 -0
  15. package/packages/compactor/src/compaction/cut.ts +270 -28
  16. package/packages/compactor/src/compaction/drill-down.ts +261 -0
  17. package/packages/compactor/src/compaction/format-recall.ts +96 -0
  18. package/packages/compactor/src/compaction/format.ts +8 -3
  19. package/packages/compactor/src/compaction/hooks.ts +248 -72
  20. package/packages/compactor/src/compaction/merge.ts +34 -4
  21. package/packages/compactor/src/compaction/rank.ts +270 -0
  22. package/packages/compactor/src/compaction/recall-scope.ts +28 -0
  23. package/packages/compactor/src/compaction/search-entries.ts +333 -96
  24. package/packages/compactor/src/compaction/skill-collapse.ts +35 -0
  25. package/packages/compactor/src/compaction/summarize.ts +37 -6
  26. package/packages/compactor/src/compaction/token-estimate.ts +104 -0
  27. package/packages/compactor/src/compaction/touched-files.ts +35 -0
  28. package/packages/compactor/src/config/manager.ts +2 -27
  29. package/packages/compactor/src/config/presets.ts +0 -2
  30. package/packages/compactor/src/config/schema.ts +2 -16
  31. package/packages/compactor/src/executor/executor.ts +6 -15
  32. package/packages/compactor/src/executor/runtime.ts +2 -12
  33. package/packages/compactor/src/index.ts +4 -121
  34. package/packages/compactor/src/info-screen.ts +3 -10
  35. package/packages/compactor/src/security/evaluator.ts +0 -53
  36. package/packages/compactor/src/security/policy.ts +7 -8
  37. package/packages/compactor/src/session/db.ts +0 -6
  38. package/packages/compactor/src/tools/ctx-execute-file.ts +0 -5
  39. package/packages/compactor/src/tools/register.ts +27 -50
  40. package/packages/compactor/src/tools/vcc-recall.ts +86 -48
  41. package/packages/compactor/src/tui/settings-overlay.ts +20 -40
  42. package/packages/compactor/src/types.ts +43 -100
  43. package/packages/core/constants.ts +0 -28
  44. package/packages/core/events.ts +1 -83
  45. package/packages/core/index.ts +1 -0
  46. package/packages/core/package.json +2 -0
  47. package/packages/core/tui-overlay.ts +89 -0
  48. package/packages/core/tui-width.ts +18 -0
  49. package/packages/core/utils.ts +43 -0
  50. package/packages/footer/src/help.ts +2 -2
  51. package/packages/footer/src/index.ts +9 -10
  52. package/packages/footer/src/presets.ts +1 -27
  53. package/packages/footer/src/registry/index.ts +0 -23
  54. package/packages/footer/src/rendering/icons.ts +0 -13
  55. package/packages/footer/src/rendering/renderer.ts +5 -40
  56. package/packages/footer/src/rendering/separators.ts +0 -10
  57. package/packages/footer/src/rendering/theme.ts +1 -15
  58. package/packages/footer/src/segments/compactor.ts +7 -14
  59. package/packages/footer/src/segments/core.ts +15 -54
  60. package/packages/footer/src/segments/kanboard.ts +5 -5
  61. package/packages/footer/src/segments/mcp.ts +5 -5
  62. package/packages/footer/src/segments/memory.ts +4 -4
  63. package/packages/footer/src/segments/notify.ts +2 -2
  64. package/packages/footer/src/segments/ralph.ts +3 -3
  65. package/packages/footer/src/segments/status-ext.ts +1 -1
  66. package/packages/footer/src/segments/workflow.ts +3 -3
  67. package/packages/footer/src/tps-tracker.ts +0 -8
  68. package/packages/footer/src/tui/settings-tui.ts +14 -31
  69. package/packages/footer/src/types.ts +0 -15
  70. package/packages/image/src/register-providers.ts +0 -11
  71. package/packages/image/src/tools.ts +0 -3
  72. package/packages/image/src/tui/model-selector.ts +36 -71
  73. package/packages/info-screen/config.ts +0 -16
  74. package/packages/info-screen/core-groups.ts +0 -10
  75. package/packages/info-screen/index.ts +22 -13
  76. package/packages/info-screen/registry.ts +1 -72
  77. package/packages/info-screen/tui/info-overlay.ts +85 -100
  78. package/packages/info-screen/usage-parser.ts +12 -47
  79. package/packages/input-shortcuts/src/index.ts +3 -3
  80. package/packages/input-shortcuts/src/registers.ts +0 -8
  81. package/packages/input-shortcuts/src/settings-overlay.ts +4 -13
  82. package/packages/input-shortcuts/src/undo-redo.ts +0 -12
  83. package/packages/mcp/src/bridge/client.ts +0 -15
  84. package/packages/mcp/src/config/manager.ts +0 -38
  85. package/packages/mcp/src/config/schema.ts +0 -27
  86. package/packages/mcp/src/config/sync.ts +0 -29
  87. package/packages/mcp/src/index.ts +1 -1
  88. package/packages/mcp/src/tui/add-overlay.ts +6 -6
  89. package/packages/mcp/src/types.ts +0 -6
  90. package/packages/memory/embedding.ts +0 -31
  91. package/packages/memory/mempalace.ts +0 -16
  92. package/packages/memory/package.json +2 -6
  93. package/packages/memory/storage.ts +56 -753
  94. package/packages/milestone/hooks.ts +1 -6
  95. package/packages/milestone/milestone.ts +2 -41
  96. package/packages/notify/events.ts +0 -10
  97. package/packages/notify/settings.ts +0 -19
  98. package/packages/notify/tui/gotify-setup.ts +108 -143
  99. package/packages/notify/tui/ntfy-setup.ts +137 -172
  100. package/packages/notify/tui/recap-model-selector.ts +36 -71
  101. package/packages/notify/tui/settings-overlay.ts +50 -86
  102. package/packages/notify/tui/telegram-setup.ts +48 -79
  103. package/packages/notify/types.ts +0 -2
  104. package/packages/ralph/index.ts +11 -35
  105. package/packages/ralph/ralph-loop.ts +3 -44
  106. package/packages/subagents/package.json +1 -0
  107. package/packages/subagents/src/agent-manager.ts +0 -51
  108. package/packages/subagents/src/agent-runner.ts +6 -80
  109. package/packages/subagents/src/conversation-viewer.ts +1 -19
  110. package/packages/subagents/src/core-compat.ts +8 -25
  111. package/packages/subagents/src/custom-agents.ts +0 -1
  112. package/packages/subagents/src/index.ts +3 -48
  113. package/packages/subagents/src/types.ts +0 -11
  114. package/packages/subagents/src/widget.ts +5 -5
  115. package/packages/unipi/bundled.js +4330 -7707
  116. package/packages/unipi/index.ts +6 -3
  117. package/packages/updater/src/changelog.ts +1 -16
  118. package/packages/updater/src/index.ts +0 -5
  119. package/packages/updater/src/installer.ts +4 -26
  120. package/packages/updater/src/markdown.ts +6 -152
  121. package/packages/updater/src/settings.ts +0 -15
  122. package/packages/updater/src/tui/changelog-overlay.ts +42 -234
  123. package/packages/updater/src/tui/list-detail-overlay.ts +260 -0
  124. package/packages/updater/src/tui/readme-overlay.ts +53 -210
  125. package/packages/updater/src/tui/settings-overlay.ts +13 -26
  126. package/packages/updater/src/version.ts +2 -31
  127. package/packages/utility/package.json +1 -3
  128. package/packages/utility/src/commands.ts +4 -5
  129. package/packages/utility/src/herdr-sync.ts +136 -0
  130. package/packages/utility/src/index.ts +11 -68
  131. package/packages/utility/src/lifecycle/cleanup.ts +2 -16
  132. package/packages/utility/src/{diff/settings.ts → settings.ts} +42 -80
  133. package/packages/utility/src/tools/env.ts +0 -0
  134. package/packages/utility/src/tui/name-badge-state.ts +18 -2
  135. package/packages/utility/src/tui/name-badge.ts +5 -4
  136. package/packages/utility/src/tui/util-settings-tui.ts +41 -224
  137. package/packages/web-api/package.json +0 -4
  138. package/packages/web-api/src/engine/dependencies.ts +13 -134
  139. package/packages/web-api/src/engine/extract.ts +9 -99
  140. package/packages/web-api/src/engine/format.ts +0 -75
  141. package/packages/web-api/src/engine/types.ts +0 -39
  142. package/packages/web-api/src/index.ts +1 -2
  143. package/packages/web-api/src/providers/base.ts +0 -10
  144. package/packages/web-api/src/providers/duckduckgo.ts +0 -1
  145. package/packages/web-api/src/providers/firecrawl.ts +0 -9
  146. package/packages/web-api/src/providers/jina-reader.ts +0 -9
  147. package/packages/web-api/src/providers/jina-search.ts +0 -9
  148. package/packages/web-api/src/providers/perplexity.ts +0 -9
  149. package/packages/web-api/src/providers/registry.ts +0 -80
  150. package/packages/web-api/src/providers/serpapi.ts +0 -9
  151. package/packages/web-api/src/providers/tavily.ts +0 -9
  152. package/packages/web-api/src/providers/wigolo-client.ts +0 -30
  153. package/packages/web-api/src/providers/wigolo.ts +0 -1
  154. package/packages/web-api/src/settings.ts +17 -77
  155. package/packages/web-api/src/tools.ts +21 -24
  156. package/packages/web-api/src/tui/settings-dialog.ts +0 -1
  157. package/packages/workflow/commands.ts +38 -122
  158. package/packages/workflow/index.ts +1 -5
  159. package/packages/cocoindex/README.md +0 -94
  160. package/packages/cocoindex/bridge.ts +0 -842
  161. package/packages/cocoindex/commands.ts +0 -175
  162. package/packages/cocoindex/index.ts +0 -48
  163. package/packages/cocoindex/installer.ts +0 -397
  164. package/packages/cocoindex/package.json +0 -49
  165. package/packages/cocoindex/skills/cocoindex/SKILL.md +0 -88
  166. package/packages/cocoindex/tools.ts +0 -157
  167. package/packages/compactor/src/display/diff-renderer.ts +0 -281
  168. package/packages/compactor/src/display/line-width-safety.ts +0 -28
  169. package/packages/compactor/src/display/render-utils.ts +0 -52
  170. package/packages/compactor/src/display/thinking-label.ts +0 -18
  171. package/packages/compactor/src/display/tool-overrides.ts +0 -136
  172. package/packages/compactor/src/tools/compact.ts +0 -20
  173. package/packages/subagents/src/file-lock.ts +0 -102
  174. package/packages/utility/src/cache/ttl-cache.ts +0 -311
  175. package/packages/utility/src/diff/highlighter.ts +0 -352
  176. package/packages/utility/src/diff/parser.ts +0 -191
  177. package/packages/utility/src/diff/renderer.ts +0 -395
  178. package/packages/utility/src/diff/theme.ts +0 -316
  179. package/packages/utility/src/diff/wrapper.ts +0 -339
  180. package/packages/utility/src/display/capabilities.ts +0 -214
  181. package/packages/utility/src/display/width.ts +0 -226
  182. package/packages/utility/src/tools/batch.ts +0 -229
  183. package/packages/utility/src/tui/badge-settings-tui.ts +0 -388
  184. package/packages/utility/src/tui/badge-settings.ts +0 -67
  185. package/packages/utility/src/tui/settings-inspector.ts +0 -303
  186. package/packages/web-api/src/providers/llm-summarize.ts +0 -71
@@ -11,7 +11,6 @@ import * as os from "node:os";
11
11
  import type {
12
12
  McpConfig,
13
13
  McpMetadata,
14
- McpAuth,
15
14
  ResolvedServer,
16
15
  ServerSource,
17
16
  } from "../types.js";
@@ -123,15 +122,6 @@ export function loadMetadata(dir: string): McpMetadata {
123
122
  };
124
123
  }
125
124
 
126
- /**
127
- * Load auth data (auth.json) from a directory.
128
- * Returns empty object if file doesn't exist.
129
- */
130
- export function loadAuth(dir: string): McpAuth {
131
- const filePath = path.join(dir, "auth.json");
132
- return readJsonFile<McpAuth>(filePath) ?? {};
133
- }
134
-
135
125
  // ── Config saving ─────────────────────────────────────────────────
136
126
 
137
127
  /**
@@ -150,14 +140,6 @@ export function saveMetadata(dir: string, meta: McpMetadata): void {
150
140
  writeJsonFile(filePath, meta);
151
141
  }
152
142
 
153
- /**
154
- * Save auth data (auth.json) with chmod 600.
155
- */
156
- export function saveAuth(dir: string, auth: McpAuth): void {
157
- const filePath = path.join(dir, "auth.json");
158
- writeJsonFile(filePath, auth, 0o600);
159
- }
160
-
161
143
  // ── Config merging ────────────────────────────────────────────────
162
144
 
163
145
  /**
@@ -220,26 +202,6 @@ export function resolveServers(
220
202
  }));
221
203
  }
222
204
 
223
- /**
224
- * Merge auth.json env vars into a server definition at spawn time.
225
- * Auth env vars are added to the server's env, but don't override
226
- * explicitly set values in mcp-config.json.
227
- */
228
- export function mergeEnvWithAuth(
229
- serverDef: McpConfig["mcpServers"][string],
230
- auth: Record<string, string>,
231
- ): McpConfig["mcpServers"][string] {
232
- if (Object.keys(auth).length === 0) return serverDef;
233
-
234
- return {
235
- ...serverDef,
236
- env: {
237
- ...auth,
238
- ...(serverDef.env ?? {}),
239
- },
240
- };
241
- }
242
-
243
205
  /**
244
206
  * Load both global and project configs and resolve servers.
245
207
  * Convenience wrapper around the individual load + resolve functions.
@@ -85,30 +85,3 @@ export function validateMcpConfig(config: unknown): ValidationResult {
85
85
 
86
86
  return { valid: errors.length === 0, errors };
87
87
  }
88
-
89
- /**
90
- * Create a minimal server definition template for a new server.
91
- */
92
- export function createServerTemplate(
93
- name: string,
94
- command: string,
95
- args: string[],
96
- envVars?: string[],
97
- ): McpConfig {
98
- const env: Record<string, string> = {};
99
- if (envVars) {
100
- for (const v of envVars) {
101
- env[v] = "";
102
- }
103
- }
104
-
105
- return {
106
- mcpServers: {
107
- [name]: {
108
- command,
109
- args,
110
- env: Object.keys(env).length > 0 ? env : undefined,
111
- },
112
- },
113
- };
114
- }
@@ -319,15 +319,6 @@ function enrichWithInstallInfo(entries: CatalogEntry[]): CatalogEntry[] {
319
319
  });
320
320
  }
321
321
 
322
- /**
323
- * Check if enough time has passed since last sync.
324
- */
325
- function shouldSync(lastSyncAt: string | null, intervalMs: number): boolean {
326
- if (!lastSyncAt) return true;
327
- const elapsed = Date.now() - new Date(lastSyncAt).getTime();
328
- return elapsed >= intervalMs;
329
- }
330
-
331
322
  /**
332
323
  * Sync the MCP server catalog from GitHub.
333
324
  * Parses the awesome-mcp-servers README, enriches with install info,
@@ -394,23 +385,3 @@ export function loadCatalog(): CatalogData {
394
385
  };
395
386
  }
396
387
  }
397
-
398
- /**
399
- * Sync if enough time has passed since last sync.
400
- * Returns null if no sync was needed, or the catalog data if synced.
401
- */
402
- export async function syncIfNeeded(): Promise<CatalogData | null> {
403
- const configDir = getGlobalConfigDir();
404
- const meta = loadMetadata(configDir);
405
-
406
- if (!shouldSync(meta.sync.lastSyncAt, meta.sync.syncIntervalMs)) {
407
- return null;
408
- }
409
-
410
- try {
411
- return await syncCatalog();
412
- } catch {
413
- // Sync failed — return null, will use cached/seed data
414
- return null;
415
- }
416
- }
@@ -16,7 +16,7 @@ import {
16
16
  } from "@pi-unipi/core";
17
17
  import type { ResolvedServer } from "./types.js";
18
18
  import { loadAndResolve, getGlobalConfigDir } from "./config/manager.js";
19
- import { syncCatalog, loadCatalog } from "./config/sync.js";
19
+ import { syncCatalog } from "./config/sync.js";
20
20
  import { ServerRegistry } from "./bridge/registry.js";
21
21
  import { compareCodeUnits } from "./bridge/translator.js";
22
22
  import { renderMcpAddOverlay } from "./tui/add-overlay.js";
@@ -353,7 +353,7 @@ export function renderMcpAddOverlay(params?: {
353
353
  return;
354
354
  }
355
355
  // Arrow keys + j/k navigate list while searching
356
- if (matchesKey(data, Key.down) || data === "\x1b[B" || data === "j") {
356
+ if (matchesKey(data, Key.down) || data === "j") {
357
357
  if (state.selectedIndex < state.filteredServers.length - 1) {
358
358
  state.selectedIndex++;
359
359
  ensureVisible();
@@ -361,7 +361,7 @@ export function renderMcpAddOverlay(params?: {
361
361
  }
362
362
  return;
363
363
  }
364
- if (matchesKey(data, Key.up) || data === "\x1b[A" || data === "k") {
364
+ if (matchesKey(data, Key.up) || data === "k") {
365
365
  if (state.selectedIndex > 0) {
366
366
  state.selectedIndex--;
367
367
  ensureVisible();
@@ -370,13 +370,13 @@ export function renderMcpAddOverlay(params?: {
370
370
  return;
371
371
  }
372
372
  // PgUp/PgDn also work in search
373
- if (data === "\x1b[6~") {
373
+ if (matchesKey(data, Key.pageDown)) {
374
374
  state.selectedIndex = Math.min(state.filteredServers.length - 1, state.selectedIndex + lastListHeight);
375
375
  ensureVisible();
376
376
  refresh();
377
377
  return;
378
378
  }
379
- if (data === "\x1b[5~") {
379
+ if (matchesKey(data, Key.pageUp)) {
380
380
  state.selectedIndex = Math.max(0, state.selectedIndex - lastListHeight);
381
381
  ensureVisible();
382
382
  refresh();
@@ -463,13 +463,13 @@ export function renderMcpAddOverlay(params?: {
463
463
  return;
464
464
  }
465
465
  // PageDown / PageUp
466
- if (data === "\x1b[6~") {
466
+ if (matchesKey(data, Key.pageDown)) {
467
467
  state.selectedIndex = Math.min(listLen - 1, state.selectedIndex + lastListHeight);
468
468
  ensureVisible();
469
469
  refresh();
470
470
  return;
471
471
  }
472
- if (data === "\x1b[5~") {
472
+ if (matchesKey(data, Key.pageUp)) {
473
473
  state.selectedIndex = Math.max(0, state.selectedIndex - lastListHeight);
474
474
  ensureVisible();
475
475
  refresh();
@@ -46,12 +46,6 @@ export interface McpMetadata {
46
46
  sync: SyncConfig;
47
47
  }
48
48
 
49
- /** Per-server auth data (auth.json) */
50
- export interface McpAuth {
51
- /** Map of server name → environment variable key-value pairs */
52
- [serverName: string]: Record<string, string>;
53
- }
54
-
55
49
  /** Single entry from the MCP server catalog */
56
50
  export interface CatalogEntry {
57
51
  /** Unique identifier (e.g. "github/github-mcp-server") */
@@ -31,12 +31,6 @@ function getConfig(): EmbeddingConfig {
31
31
  return cachedConfig;
32
32
  }
33
33
 
34
- /** Force refresh config cache */
35
- export function refreshConfig(): void {
36
- cachedConfig = null;
37
- lastConfigLoad = 0;
38
- }
39
-
40
34
  /**
41
35
  * Generate an embedding for the given text via OpenRouter API.
42
36
  * Returns null if not configured or on error.
@@ -216,28 +210,3 @@ export async function reembedAllMemories(ctx: ExtensionCommandContext): Promise<
216
210
  return count;
217
211
  }
218
212
 
219
- /**
220
- * Convert Float32Array to Buffer for SQLite storage.
221
- */
222
- export function vectorToBuffer(vec: Float32Array): Buffer {
223
- return Buffer.from(vec.buffer);
224
- }
225
-
226
- /**
227
- * Convert Buffer from SQLite to Float32Array.
228
- */
229
- export function bufferToVector(buf: Buffer): Float32Array {
230
- return new Float32Array(buf.buffer, buf.byteOffset, buf.byteLength / 4);
231
- }
232
-
233
- /**
234
- * Check if embeddings are available (sqlite-vec loaded).
235
- */
236
- export function hasEmbeddings(db: { prepare(sql: string): { get(...args: unknown[]): unknown } }): boolean {
237
- try {
238
- db.prepare("SELECT * FROM memories_vec LIMIT 1").get();
239
- return true;
240
- } catch {
241
- return false;
242
- }
243
- }
@@ -94,11 +94,6 @@ function getBridgePath(): string | null {
94
94
  return cachedBridgePath;
95
95
  }
96
96
 
97
- /** Clear bridge discovery cache (primarily for recovery/tests). */
98
- export function invalidateBridgePathCache(): void {
99
- cachedBridgePath = undefined;
100
- }
101
-
102
97
  export interface BridgeResponse<T> {
103
98
  ok: boolean;
104
99
  result?: T;
@@ -232,12 +227,6 @@ export function ensureMempalace(): MempalaceInstall | null {
232
227
  return install;
233
228
  }
234
229
 
235
- /** Drop the cached install record (forces re-detection next session). */
236
- export function invalidateInstallCache(): void {
237
- try { if (fs.existsSync(INSTALL_FLAG)) fs.unlinkSync(INSTALL_FLAG); } catch { /* ignore */ }
238
- invalidatePingVerified();
239
- }
240
-
241
230
  /** Was the palace ping-verified recently enough to trust without re-pinging? */
242
231
  export function isPingVerified(): boolean {
243
232
  try {
@@ -351,11 +340,6 @@ export function markMigrated(
351
340
  }
352
341
  }
353
342
 
354
- /** Force re-migration by clearing the flag. */
355
- export function clearMigratedFlag(flagPath = MIGRATED_FLAG): void {
356
- try { if (fs.existsSync(flagPath)) fs.unlinkSync(flagPath); } catch { /* ignore */ }
357
- }
358
-
359
343
  /**
360
344
  * Run one bridge command synchronously. Returns the parsed result, or null
361
345
  * on any failure (timeout, non-zero exit, bad JSON, ok=false).
@@ -28,7 +28,6 @@
28
28
  "files": [
29
29
  "index.ts",
30
30
  "storage.ts",
31
- "search.ts",
32
31
  "embedding.ts",
33
32
  "settings.ts",
34
33
  "tools.ts",
@@ -40,18 +39,15 @@
40
39
  "README.md"
41
40
  ],
42
41
  "dependencies": {
43
- "better-sqlite3": "^12.9.0",
44
- "sqlite-vec": "^0.1.9",
45
- "js-yaml": "^4.1.0",
46
42
  "@pi-unipi/core": "2.6.1",
47
- "@pi-unipi/info-screen": "2.6.1"
43
+ "@pi-unipi/info-screen": "2.6.1",
44
+ "js-yaml": "^4.1.0"
48
45
  },
49
46
  "peerDependencies": {
50
47
  "@earendil-works/pi-coding-agent": "^0.80.0",
51
48
  "typebox": "^1.1.38"
52
49
  },
53
50
  "devDependencies": {
54
- "@types/better-sqlite3": "^7.6.0",
55
51
  "@types/js-yaml": "^4.0.0",
56
52
  "@types/node": "^25.6.0"
57
53
  },