@pi-unipi/unipi 2.6.0 → 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.
- package/CHANGELOG.md +19 -0
- package/package.json +21 -22
- package/packages/ask-user/package.json +2 -2
- package/packages/ask-user/settings-tui.ts +18 -34
- package/packages/autocomplete/package.json +1 -1
- package/packages/autocomplete/src/constants.ts +2 -15
- package/packages/autocomplete/src/provider.ts +3 -17
- package/packages/btw/extensions/btw.ts +18 -45
- package/packages/btw/package.json +2 -2
- package/packages/compactor/README.md +2 -2
- package/packages/compactor/package.json +3 -3
- package/packages/compactor/skills/compactor/SKILL.md +1 -1
- package/packages/compactor/skills/compactor-detail/SKILL.md +3 -5
- package/packages/compactor/skills/compactor-doctor/SKILL.md +1 -1
- package/packages/compactor/skills/compactor-stats/SKILL.md +1 -1
- package/packages/compactor/src/commands/index.ts +47 -78
- package/packages/compactor/src/compaction/brief.ts +161 -90
- package/packages/compactor/src/compaction/build-sections.ts +3 -4
- package/packages/compactor/src/compaction/compact-args.ts +86 -0
- package/packages/compactor/src/compaction/cut.ts +270 -28
- package/packages/compactor/src/compaction/drill-down.ts +261 -0
- package/packages/compactor/src/compaction/format-recall.ts +96 -0
- package/packages/compactor/src/compaction/format.ts +8 -3
- package/packages/compactor/src/compaction/hooks.ts +248 -72
- package/packages/compactor/src/compaction/merge.ts +34 -4
- package/packages/compactor/src/compaction/rank.ts +270 -0
- package/packages/compactor/src/compaction/recall-scope.ts +28 -0
- package/packages/compactor/src/compaction/search-entries.ts +333 -96
- package/packages/compactor/src/compaction/skill-collapse.ts +35 -0
- package/packages/compactor/src/compaction/summarize.ts +37 -6
- package/packages/compactor/src/compaction/token-estimate.ts +104 -0
- package/packages/compactor/src/compaction/touched-files.ts +35 -0
- package/packages/compactor/src/config/manager.ts +2 -27
- package/packages/compactor/src/config/presets.ts +0 -2
- package/packages/compactor/src/config/schema.ts +2 -16
- package/packages/compactor/src/executor/executor.ts +6 -15
- package/packages/compactor/src/executor/runtime.ts +2 -12
- package/packages/compactor/src/index.ts +4 -121
- package/packages/compactor/src/info-screen.ts +3 -10
- package/packages/compactor/src/security/evaluator.ts +0 -53
- package/packages/compactor/src/security/policy.ts +7 -8
- package/packages/compactor/src/session/db.ts +0 -6
- package/packages/compactor/src/tools/ctx-execute-file.ts +0 -5
- package/packages/compactor/src/tools/register.ts +27 -50
- package/packages/compactor/src/tools/vcc-recall.ts +86 -48
- package/packages/compactor/src/tui/settings-overlay.ts +20 -40
- package/packages/compactor/src/types.ts +43 -100
- package/packages/core/constants.ts +1 -28
- package/packages/core/events.ts +1 -83
- package/packages/core/index.ts +1 -0
- package/packages/core/model-cache.ts +18 -12
- package/packages/core/package.json +3 -1
- package/packages/core/tui-overlay.ts +89 -0
- package/packages/core/tui-width.ts +18 -0
- package/packages/core/utils.ts +43 -0
- package/packages/footer/package.json +2 -2
- package/packages/footer/src/help.ts +2 -2
- package/packages/footer/src/index.ts +9 -10
- package/packages/footer/src/presets.ts +1 -27
- package/packages/footer/src/registry/index.ts +0 -23
- package/packages/footer/src/rendering/icons.ts +0 -13
- package/packages/footer/src/rendering/renderer.ts +5 -40
- package/packages/footer/src/rendering/separators.ts +0 -10
- package/packages/footer/src/rendering/theme.ts +1 -15
- package/packages/footer/src/segments/compactor.ts +7 -14
- package/packages/footer/src/segments/core.ts +15 -54
- package/packages/footer/src/segments/kanboard.ts +5 -5
- package/packages/footer/src/segments/mcp.ts +5 -5
- package/packages/footer/src/segments/memory.ts +4 -4
- package/packages/footer/src/segments/notify.ts +2 -2
- package/packages/footer/src/segments/ralph.ts +3 -3
- package/packages/footer/src/segments/status-ext.ts +1 -1
- package/packages/footer/src/segments/workflow.ts +3 -3
- package/packages/footer/src/tps-tracker.ts +0 -8
- package/packages/footer/src/tui/settings-tui.ts +14 -31
- package/packages/footer/src/types.ts +0 -15
- package/packages/image/package.json +2 -2
- package/packages/image/src/register-providers.ts +0 -11
- package/packages/image/src/tools.ts +0 -3
- package/packages/image/src/tui/model-selector.ts +36 -71
- package/packages/info-screen/config.ts +0 -16
- package/packages/info-screen/core-groups.ts +0 -10
- package/packages/info-screen/index.ts +22 -13
- package/packages/info-screen/package.json +2 -2
- package/packages/info-screen/registry.ts +1 -72
- package/packages/info-screen/tui/info-overlay.ts +85 -100
- package/packages/info-screen/usage-parser.ts +12 -47
- package/packages/input-shortcuts/package.json +2 -2
- package/packages/input-shortcuts/src/index.ts +3 -3
- package/packages/input-shortcuts/src/registers.ts +0 -8
- package/packages/input-shortcuts/src/settings-overlay.ts +4 -13
- package/packages/input-shortcuts/src/undo-redo.ts +0 -12
- package/packages/kanboard/package.json +2 -2
- package/packages/mcp/package.json +2 -2
- package/packages/mcp/src/bridge/client.ts +0 -15
- package/packages/mcp/src/config/manager.ts +0 -38
- package/packages/mcp/src/config/schema.ts +0 -27
- package/packages/mcp/src/config/sync.ts +0 -29
- package/packages/mcp/src/index.ts +1 -1
- package/packages/mcp/src/tui/add-overlay.ts +6 -6
- package/packages/mcp/src/types.ts +0 -6
- package/packages/memory/embedding.ts +0 -31
- package/packages/memory/mempalace.ts +0 -16
- package/packages/memory/package.json +4 -8
- package/packages/memory/storage.ts +56 -753
- package/packages/milestone/hooks.ts +1 -6
- package/packages/milestone/milestone.ts +2 -41
- package/packages/milestone/package.json +2 -2
- package/packages/notify/README.md +1 -0
- package/packages/notify/commands.ts +61 -3
- package/packages/notify/events.ts +0 -10
- package/packages/notify/package.json +2 -2
- package/packages/notify/settings.ts +0 -19
- package/packages/notify/tui/gotify-setup.ts +108 -143
- package/packages/notify/tui/ntfy-setup.ts +137 -172
- package/packages/notify/tui/recap-model-selector.ts +107 -101
- package/packages/notify/tui/settings-overlay.ts +94 -117
- package/packages/notify/tui/telegram-setup.ts +48 -79
- package/packages/notify/types.ts +0 -2
- package/packages/ralph/index.ts +11 -35
- package/packages/ralph/package.json +3 -3
- package/packages/ralph/ralph-loop.ts +3 -44
- package/packages/subagents/package.json +2 -1
- package/packages/subagents/src/agent-manager.ts +0 -51
- package/packages/subagents/src/agent-runner.ts +6 -80
- package/packages/subagents/src/conversation-viewer.ts +1 -19
- package/packages/subagents/src/core-compat.ts +8 -25
- package/packages/subagents/src/custom-agents.ts +0 -1
- package/packages/subagents/src/index.ts +3 -48
- package/packages/subagents/src/types.ts +0 -11
- package/packages/subagents/src/widget.ts +5 -5
- package/packages/unipi/bundled.js +4468 -7769
- package/packages/unipi/index.ts +6 -3
- package/packages/updater/package.json +2 -2
- package/packages/updater/src/changelog.ts +1 -16
- package/packages/updater/src/index.ts +0 -5
- package/packages/updater/src/installer.ts +4 -26
- package/packages/updater/src/markdown.ts +6 -152
- package/packages/updater/src/settings.ts +0 -15
- package/packages/updater/src/tui/changelog-overlay.ts +42 -234
- package/packages/updater/src/tui/list-detail-overlay.ts +260 -0
- package/packages/updater/src/tui/readme-overlay.ts +53 -210
- package/packages/updater/src/tui/settings-overlay.ts +13 -26
- package/packages/updater/src/version.ts +2 -31
- package/packages/utility/package.json +2 -4
- package/packages/utility/src/commands.ts +4 -5
- package/packages/utility/src/herdr-sync.ts +136 -0
- package/packages/utility/src/index.ts +11 -68
- package/packages/utility/src/lifecycle/cleanup.ts +2 -16
- package/packages/utility/src/{diff/settings.ts → settings.ts} +42 -80
- package/packages/utility/src/tools/env.ts +0 -0
- package/packages/utility/src/tui/name-badge-state.ts +18 -2
- package/packages/utility/src/tui/name-badge.ts +5 -4
- package/packages/utility/src/tui/util-settings-tui.ts +41 -224
- package/packages/web-api/package.json +2 -6
- package/packages/web-api/src/engine/dependencies.ts +13 -134
- package/packages/web-api/src/engine/extract.ts +9 -99
- package/packages/web-api/src/engine/format.ts +0 -75
- package/packages/web-api/src/engine/types.ts +0 -39
- package/packages/web-api/src/index.ts +1 -2
- package/packages/web-api/src/providers/base.ts +0 -10
- package/packages/web-api/src/providers/duckduckgo.ts +0 -1
- package/packages/web-api/src/providers/firecrawl.ts +0 -9
- package/packages/web-api/src/providers/jina-reader.ts +0 -9
- package/packages/web-api/src/providers/jina-search.ts +0 -9
- package/packages/web-api/src/providers/perplexity.ts +0 -9
- package/packages/web-api/src/providers/registry.ts +0 -80
- package/packages/web-api/src/providers/serpapi.ts +0 -9
- package/packages/web-api/src/providers/tavily.ts +0 -9
- package/packages/web-api/src/providers/wigolo-client.ts +0 -30
- package/packages/web-api/src/providers/wigolo.ts +0 -1
- package/packages/web-api/src/settings.ts +17 -77
- package/packages/web-api/src/tools.ts +21 -24
- package/packages/web-api/src/tui/settings-dialog.ts +0 -1
- package/packages/workflow/commands.ts +38 -122
- package/packages/workflow/index.ts +1 -5
- package/packages/workflow/package.json +2 -2
- package/packages/cocoindex/README.md +0 -94
- package/packages/cocoindex/bridge.ts +0 -842
- package/packages/cocoindex/commands.ts +0 -175
- package/packages/cocoindex/index.ts +0 -48
- package/packages/cocoindex/installer.ts +0 -397
- package/packages/cocoindex/package.json +0 -49
- package/packages/cocoindex/skills/cocoindex/SKILL.md +0 -88
- package/packages/cocoindex/tools.ts +0 -157
- package/packages/compactor/src/display/diff-renderer.ts +0 -281
- package/packages/compactor/src/display/line-width-safety.ts +0 -28
- package/packages/compactor/src/display/render-utils.ts +0 -52
- package/packages/compactor/src/display/thinking-label.ts +0 -18
- package/packages/compactor/src/display/tool-overrides.ts +0 -136
- package/packages/compactor/src/tools/compact.ts +0 -20
- package/packages/subagents/src/file-lock.ts +0 -102
- package/packages/utility/src/cache/ttl-cache.ts +0 -311
- package/packages/utility/src/diff/highlighter.ts +0 -352
- package/packages/utility/src/diff/parser.ts +0 -191
- package/packages/utility/src/diff/renderer.ts +0 -395
- package/packages/utility/src/diff/theme.ts +0 -316
- package/packages/utility/src/diff/wrapper.ts +0 -339
- package/packages/utility/src/display/capabilities.ts +0 -214
- package/packages/utility/src/display/width.ts +0 -226
- package/packages/utility/src/tools/batch.ts +0 -229
- package/packages/utility/src/tui/badge-settings-tui.ts +0 -388
- package/packages/utility/src/tui/badge-settings.ts +0 -67
- package/packages/utility/src/tui/settings-inspector.ts +0 -303
- package/packages/web-api/src/providers/llm-summarize.ts +0 -71
|
@@ -74,17 +74,9 @@ const THEME: SettingsListTheme = {
|
|
|
74
74
|
export class SettingsOverlay implements Component {
|
|
75
75
|
private list: SettingsList;
|
|
76
76
|
private config: InputShortcutsConfig;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
constructor(
|
|
81
|
-
done: () => void,
|
|
82
|
-
baseDir?: string,
|
|
83
|
-
onSaved?: (config: InputShortcutsConfig) => void,
|
|
84
|
-
) {
|
|
85
|
-
this.baseDir = baseDir;
|
|
86
|
-
this.onSaved = onSaved;
|
|
87
|
-
this.config = loadConfig(baseDir);
|
|
77
|
+
|
|
78
|
+
constructor(done: () => void) {
|
|
79
|
+
this.config = loadConfig();
|
|
88
80
|
|
|
89
81
|
const items = this.buildItems();
|
|
90
82
|
this.list = new SettingsList(
|
|
@@ -93,8 +85,7 @@ export class SettingsOverlay implements Component {
|
|
|
93
85
|
THEME,
|
|
94
86
|
(id, newValue) => this.handleChange(id, newValue),
|
|
95
87
|
() => {
|
|
96
|
-
saveConfig(this.config
|
|
97
|
-
this.onSaved?.(this.config);
|
|
88
|
+
saveConfig(this.config);
|
|
98
89
|
done();
|
|
99
90
|
},
|
|
100
91
|
);
|
|
@@ -20,7 +20,6 @@ export class UndoRedoBuffer {
|
|
|
20
20
|
private undoStack: TextSnapshot[] = [];
|
|
21
21
|
private redoStack: TextSnapshot[] = [];
|
|
22
22
|
private lastSnapshotAt = 0;
|
|
23
|
-
private lastUndoAt = 0;
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Take a snapshot of current text BEFORE it changes.
|
|
@@ -66,21 +65,10 @@ export class UndoRedoBuffer {
|
|
|
66
65
|
return { text: snapshot.text, ok: true };
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
/** Check if undo stack has entries. */
|
|
70
|
-
hasUndo(): boolean {
|
|
71
|
-
return this.undoStack.length > 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** Check if redo stack has entries. */
|
|
75
|
-
hasRedo(): boolean {
|
|
76
|
-
return this.redoStack.length > 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
68
|
/** Clear both stacks. Call on session shutdown. */
|
|
80
69
|
clear(): void {
|
|
81
70
|
this.undoStack = [];
|
|
82
71
|
this.redoStack = [];
|
|
83
72
|
this.lastSnapshotAt = 0;
|
|
84
|
-
this.lastUndoAt = 0;
|
|
85
73
|
}
|
|
86
74
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/kanboard",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Visualization layer for unipi workflow — HTTP server with htmx/Alpine.js UI, modular parsers, TUI overlay, and kanban board",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@pi-unipi/core": "2.6.
|
|
42
|
+
"@pi-unipi/core": "2.6.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@earendil-works/pi-coding-agent": "^0.80.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/mcp",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "MCP server management extension for Pi coding agent — browse, add, configure, and use MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "npx tsx --test tests/**/*.test.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@pi-unipi/core": "2.6.
|
|
33
|
+
"@pi-unipi/core": "2.6.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@earendil-works/pi-coding-agent": "^0.80.0",
|
|
@@ -47,8 +47,6 @@ interface PendingRequest {
|
|
|
47
47
|
export interface McpClientOptions {
|
|
48
48
|
/** Per-request timeout in ms (default: MCP_DEFAULTS.STARTUP_TIMEOUT_MS) */
|
|
49
49
|
timeoutMs?: number;
|
|
50
|
-
/** Working directory for the spawned process */
|
|
51
|
-
cwd?: string;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
/**
|
|
@@ -65,11 +63,9 @@ export class McpClient {
|
|
|
65
63
|
private connected = false;
|
|
66
64
|
private stderrBuffer = "";
|
|
67
65
|
private readonly timeoutMs: number;
|
|
68
|
-
private readonly cwd?: string;
|
|
69
66
|
|
|
70
67
|
constructor(options?: McpClientOptions) {
|
|
71
68
|
this.timeoutMs = options?.timeoutMs ?? MCP_DEFAULTS.STARTUP_TIMEOUT_MS;
|
|
72
|
-
this.cwd = options?.cwd;
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
/**
|
|
@@ -91,7 +87,6 @@ export class McpClient {
|
|
|
91
87
|
this.process = spawn(command, args, {
|
|
92
88
|
stdio: ["pipe", "pipe", "pipe"],
|
|
93
89
|
env: mergedEnv,
|
|
94
|
-
cwd: this.cwd,
|
|
95
90
|
});
|
|
96
91
|
|
|
97
92
|
this.process.on("error", (err) => {
|
|
@@ -230,21 +225,11 @@ export class McpClient {
|
|
|
230
225
|
this.cleanup();
|
|
231
226
|
}
|
|
232
227
|
|
|
233
|
-
/** Whether the client is currently connected */
|
|
234
|
-
get isConnected(): boolean {
|
|
235
|
-
return this.connected;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
228
|
/** Process ID of the spawned MCP server, or undefined if not connected */
|
|
239
229
|
get pid(): number | undefined {
|
|
240
230
|
return this.process?.pid;
|
|
241
231
|
}
|
|
242
232
|
|
|
243
|
-
/** Captured stderr output */
|
|
244
|
-
get stderr(): string {
|
|
245
|
-
return this.stderrBuffer;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
233
|
// ── Internal methods ────────────────────────────────────────────
|
|
249
234
|
|
|
250
235
|
private ensureConnected(): void {
|
|
@@ -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
|
|
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 === "
|
|
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 === "
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/memory",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Persistent cross-session memory with MemPalace backend (auto-installed) and SQLite fallback for Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -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
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"js-yaml": "^4.1.0"
|
|
46
|
-
"@pi-unipi/core": "2.6.0",
|
|
47
|
-
"@pi-unipi/info-screen": "2.6.0"
|
|
42
|
+
"@pi-unipi/core": "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
|
},
|