@geohar/pi-mcp-combiner 0.13.4 → 0.14.0
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/README.md +227 -126
- package/dist/client/config-ladder.d.ts +62 -0
- package/dist/client/config-ladder.d.ts.map +1 -0
- package/dist/client/config-ladder.js +162 -0
- package/dist/client/config-ladder.js.map +1 -0
- package/dist/client/connection.d.ts +113 -0
- package/dist/client/connection.d.ts.map +1 -0
- package/dist/client/connection.js +332 -0
- package/dist/client/connection.js.map +1 -0
- package/dist/client/control.d.ts +17 -0
- package/dist/client/control.d.ts.map +1 -0
- package/dist/client/control.js +80 -0
- package/dist/client/control.js.map +1 -0
- package/dist/client/direct-tools.d.ts +41 -0
- package/dist/client/direct-tools.d.ts.map +1 -0
- package/dist/client/direct-tools.js +122 -0
- package/dist/client/direct-tools.js.map +1 -0
- package/dist/client/elicitation.d.ts +22 -0
- package/dist/client/elicitation.d.ts.map +1 -0
- package/dist/client/elicitation.js +93 -0
- package/dist/client/elicitation.js.map +1 -0
- package/dist/client/footer.d.ts +17 -0
- package/dist/client/footer.d.ts.map +1 -0
- package/dist/client/footer.js +99 -0
- package/dist/client/footer.js.map +1 -0
- package/dist/client/panel.d.ts +16 -0
- package/dist/client/panel.d.ts.map +1 -0
- package/dist/client/panel.js +426 -0
- package/dist/client/panel.js.map +1 -0
- package/dist/client/prompts.d.ts +30 -0
- package/dist/client/prompts.d.ts.map +1 -0
- package/dist/client/prompts.js +230 -0
- package/dist/client/prompts.js.map +1 -0
- package/dist/client/proxy-tool.d.ts +22 -0
- package/dist/client/proxy-tool.d.ts.map +1 -0
- package/dist/client/proxy-tool.js +225 -0
- package/dist/client/proxy-tool.js.map +1 -0
- package/dist/client/ranking.d.ts +21 -0
- package/dist/client/ranking.d.ts.map +1 -0
- package/dist/client/ranking.js +113 -0
- package/dist/client/ranking.js.map +1 -0
- package/dist/client/render.d.ts +28 -0
- package/dist/client/render.d.ts.map +1 -0
- package/dist/client/render.js +166 -0
- package/dist/client/render.js.map +1 -0
- package/dist/client/renderers.d.ts +31 -0
- package/dist/client/renderers.d.ts.map +1 -0
- package/dist/client/renderers.js +191 -0
- package/dist/client/renderers.js.map +1 -0
- package/dist/client/resources.d.ts +20 -0
- package/dist/client/resources.d.ts.map +1 -0
- package/dist/client/resources.js +119 -0
- package/dist/client/resources.js.map +1 -0
- package/dist/client/schema-signature.d.ts +3 -0
- package/dist/client/schema-signature.d.ts.map +1 -0
- package/dist/client/schema-signature.js +183 -0
- package/dist/client/schema-signature.js.map +1 -0
- package/dist/client/script.d.ts +10 -0
- package/dist/client/script.d.ts.map +1 -0
- package/dist/client/script.js +130 -0
- package/dist/client/script.js.map +1 -0
- package/dist/client/settings.d.ts +46 -0
- package/dist/client/settings.d.ts.map +1 -0
- package/dist/client/settings.js +81 -0
- package/dist/client/settings.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +333 -29
- package/dist/index.js.map +1 -1
- package/dist/pi.d.ts +82 -2
- package/dist/pi.d.ts.map +1 -1
- package/dist/pi.js +2 -1
- package/dist/pi.js.map +1 -1
- package/dist/sharedserver-resolve.d.ts.map +1 -1
- package/dist/sharedserver-resolve.js +2 -1
- package/dist/sharedserver-resolve.js.map +1 -1
- package/package.json +68 -57
- package/src/client/config-ladder.ts +221 -0
- package/src/client/connection.ts +373 -0
- package/src/client/control.ts +94 -0
- package/src/client/direct-tools.ts +146 -0
- package/src/client/elicitation.ts +115 -0
- package/src/client/footer.ts +108 -0
- package/src/client/panel.ts +478 -0
- package/src/client/prompts.ts +251 -0
- package/src/client/proxy-tool.ts +261 -0
- package/src/client/ranking.ts +130 -0
- package/src/client/render.ts +166 -0
- package/src/client/renderers.ts +211 -0
- package/src/client/resources.ts +137 -0
- package/src/client/schema-signature.ts +184 -0
- package/src/client/script.ts +150 -0
- package/src/client/settings.ts +109 -0
- package/src/index.ts +384 -32
- package/src/pi.ts +86 -6
- package/src/sharedserver-resolve.ts +10 -3
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
// The /mcp-combiner panel — a lean interactive TUI over the combiner state, in the
|
|
2
|
+
// pi-mcp-adapter /mcp panel idiom (overlay via ctx.ui.custom, Component with
|
|
3
|
+
// handleInput, matchesKey routing — MIT, © 2026 Nico Bailon) but combiner-shaped and aligned with the
|
|
4
|
+
// Neovim plugin's :MCPStatus UX (lua/mcp_companion/ui/init.lua): the same state
|
|
5
|
+
// glyphs (● ○ ⊘ ✗ ◌), the per-server tools/resources/prompts counts trio, the
|
|
6
|
+
// [session off] label for servers hidden from THIS chat by the project filter,
|
|
7
|
+
// padded columns, and `e` to toggle enable/disable (driven through the combiner__
|
|
8
|
+
// meta-tools). MIT-credited idioms from pi-mcp-adapter's mcp-panel.ts.
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
10
|
+
import { Container, Text, matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
11
|
+
import { metaToolCall } from "./control.js";
|
|
12
|
+
import { resourceServer } from "./resources.js";
|
|
13
|
+
// State glyphs mirror the Neovim plugin's status_icon() table; "meta" marks the
|
|
14
|
+
// combiner's own combiner__* tools group (nvim's combiner_on hexagon).
|
|
15
|
+
const STATE_GLYPHS = {
|
|
16
|
+
ready: "●",
|
|
17
|
+
connected: "●",
|
|
18
|
+
connecting: "◌",
|
|
19
|
+
starting: "◌",
|
|
20
|
+
disconnected: "○",
|
|
21
|
+
idle: "○",
|
|
22
|
+
disabled: "⊘",
|
|
23
|
+
failed: "✗",
|
|
24
|
+
error: "✗",
|
|
25
|
+
meta: "⬢",
|
|
26
|
+
};
|
|
27
|
+
// Nerd-font codepoints (no emoji, matching the footer's plug convention).
|
|
28
|
+
const ICON_TOOL = "\uF0E7"; // nf-fa-bolt
|
|
29
|
+
const ICON_RESOURCE = "\uF15B"; // nf-fa-file
|
|
30
|
+
const ICON_PROMPT = "\uF075"; // nf-fa-comment
|
|
31
|
+
const MAX_VISIBLE = 24;
|
|
32
|
+
const PANEL_WIDTH = 92;
|
|
33
|
+
const NAME_PAD = 18;
|
|
34
|
+
const TOOL_PAD = 30;
|
|
35
|
+
function stateGlyph(state) {
|
|
36
|
+
return STATE_GLYPHS[state.toLowerCase()] ?? "?";
|
|
37
|
+
}
|
|
38
|
+
function stateColor(state) {
|
|
39
|
+
if (state === "meta")
|
|
40
|
+
return "toolTitle";
|
|
41
|
+
if (state === "ready" || state === "connected")
|
|
42
|
+
return "success";
|
|
43
|
+
if (state === "failed" || state === "error")
|
|
44
|
+
return "error";
|
|
45
|
+
if (state === "disabled")
|
|
46
|
+
return "muted";
|
|
47
|
+
return "muted";
|
|
48
|
+
}
|
|
49
|
+
function pad(s, w) {
|
|
50
|
+
const vis = visibleWidth(s);
|
|
51
|
+
return vis >= w ? s : s + " ".repeat(w - vis);
|
|
52
|
+
}
|
|
53
|
+
/** Rough token estimate per tool, adapter-style (chars/4 + base). */
|
|
54
|
+
function estimateTokens(tool) {
|
|
55
|
+
const schemaLen = JSON.stringify(tool.inputSchema ?? {}).length;
|
|
56
|
+
return Math.ceil((tool.name.length + (tool.description?.length ?? 0) + schemaLen) / 4) + 10;
|
|
57
|
+
}
|
|
58
|
+
function serverOf(name) {
|
|
59
|
+
return name.split("_", 1)[0] ?? "";
|
|
60
|
+
}
|
|
61
|
+
/** Attribute a tool/prompt name to its server against the KNOWN server list,
|
|
62
|
+
* longest-match-first — server names may themselves contain underscores
|
|
63
|
+
* (gws_georgeharker_tools belongs to gws_georgeharker, not a phantom "gws").
|
|
64
|
+
* Falls back to the first segment for names no known server prefixes. */
|
|
65
|
+
function groupServer(name, knownServers) {
|
|
66
|
+
let best;
|
|
67
|
+
for (const s of knownServers) {
|
|
68
|
+
if (!name.startsWith(`${s}_`))
|
|
69
|
+
continue;
|
|
70
|
+
if (best === undefined || s.length > best.length)
|
|
71
|
+
best = s;
|
|
72
|
+
}
|
|
73
|
+
return best ?? serverOf(name);
|
|
74
|
+
}
|
|
75
|
+
/** Copy text to the system clipboard; notifies as fallback when no tool exists. */
|
|
76
|
+
function copyToClipboard(text, notify) {
|
|
77
|
+
const cmd = process.platform === "darwin" ? ["pbcopy"] : ["xclip", "-selection", "clipboard"];
|
|
78
|
+
try {
|
|
79
|
+
const child = spawn(cmd[0], cmd.slice(1), { stdio: ["pipe", "ignore", "ignore"] });
|
|
80
|
+
child.on("error", () => notify(`tool name: ${text}`));
|
|
81
|
+
child.stdin?.end(text);
|
|
82
|
+
notify(`copied: ${text}`);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
notify(`tool name: ${text}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
class CombinerPanel {
|
|
89
|
+
container = new Container();
|
|
90
|
+
deps;
|
|
91
|
+
tui;
|
|
92
|
+
theme;
|
|
93
|
+
done;
|
|
94
|
+
rows = [];
|
|
95
|
+
visible = [];
|
|
96
|
+
cursor = 0;
|
|
97
|
+
offset = 0;
|
|
98
|
+
query = "";
|
|
99
|
+
searchActive = false;
|
|
100
|
+
notice = null;
|
|
101
|
+
loading = true;
|
|
102
|
+
expandedServer = null;
|
|
103
|
+
constructor(deps, tui, theme, done) {
|
|
104
|
+
this.deps = deps;
|
|
105
|
+
this.tui = tui;
|
|
106
|
+
this.theme = theme;
|
|
107
|
+
this.done = done;
|
|
108
|
+
void this.refresh();
|
|
109
|
+
}
|
|
110
|
+
dispose() {
|
|
111
|
+
// nothing held beyond closures
|
|
112
|
+
}
|
|
113
|
+
/** pi-tui Component contract — our render rebuilds from scratch (Container.clear),
|
|
114
|
+
* so there is no cached rendering to drop. */
|
|
115
|
+
invalidate() {
|
|
116
|
+
// no-op by design
|
|
117
|
+
}
|
|
118
|
+
fg(color, text) {
|
|
119
|
+
return this.theme?.fg ? this.theme.fg(color, text) : text;
|
|
120
|
+
}
|
|
121
|
+
async refresh() {
|
|
122
|
+
this.loading = true;
|
|
123
|
+
this.tui.requestRender();
|
|
124
|
+
const servers = new Map();
|
|
125
|
+
try {
|
|
126
|
+
const health = (await this.deps.connection.health());
|
|
127
|
+
for (const [name, s] of Object.entries(health.servers ?? {}))
|
|
128
|
+
servers.set(name, s);
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
this.notice = `/health unreachable: ${e instanceof Error ? e.message : String(e)}`;
|
|
132
|
+
}
|
|
133
|
+
const [tools, prompts, resources] = await Promise.all([
|
|
134
|
+
this.deps.connection.listTools(true).catch(() => []),
|
|
135
|
+
this.deps.connection.listPrompts(true).catch(() => []),
|
|
136
|
+
this.deps.connection.listResources(true).catch(() => []),
|
|
137
|
+
]);
|
|
138
|
+
const toolsBy = new Map();
|
|
139
|
+
const promptsBy = new Map();
|
|
140
|
+
const resourcesBy = new Map();
|
|
141
|
+
const push = (map, key, value) => {
|
|
142
|
+
const list = map.get(key);
|
|
143
|
+
if (list)
|
|
144
|
+
list.push(value);
|
|
145
|
+
else
|
|
146
|
+
map.set(key, [value]);
|
|
147
|
+
};
|
|
148
|
+
const known = [...servers.keys()].sort((a, b) => b.length - a.length);
|
|
149
|
+
for (const t of tools) {
|
|
150
|
+
const s = groupServer(t.name, known);
|
|
151
|
+
if (s)
|
|
152
|
+
push(toolsBy, s, t);
|
|
153
|
+
}
|
|
154
|
+
for (const p of prompts) {
|
|
155
|
+
const s = groupServer(p.name, known);
|
|
156
|
+
if (s)
|
|
157
|
+
push(promptsBy, s, p);
|
|
158
|
+
}
|
|
159
|
+
for (const r of resources) {
|
|
160
|
+
const s = resourceServer(r);
|
|
161
|
+
if (s)
|
|
162
|
+
push(resourcesBy, s, r);
|
|
163
|
+
}
|
|
164
|
+
const prev = new Map(this.rows.filter((r) => r.kind === "server").map((r) => [r.name, r]));
|
|
165
|
+
const build = (name, h) => {
|
|
166
|
+
const p = prev.get(name);
|
|
167
|
+
// The fallback group holding the combiner's own combiner__* tools has no
|
|
168
|
+
// /health entry — mark it "meta" rather than "unknown" so it renders as
|
|
169
|
+
// the combiner itself (⬢), not a broken (?) server.
|
|
170
|
+
const isMeta = name === "combiner" && !servers.has(name);
|
|
171
|
+
return {
|
|
172
|
+
kind: "server",
|
|
173
|
+
name,
|
|
174
|
+
state: isMeta ? "meta" : String(h.state ?? h.status ?? "unknown"),
|
|
175
|
+
transport: typeof h.transport === "string" ? h.transport : "",
|
|
176
|
+
disabled: h.disabled === true,
|
|
177
|
+
sessionOff: this.sessionOff(name),
|
|
178
|
+
tools: toolsBy.get(name) ?? [],
|
|
179
|
+
prompts: promptsBy.get(name) ?? [],
|
|
180
|
+
resources: resourcesBy.get(name) ?? [],
|
|
181
|
+
expanded: p?.expanded ?? false,
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
const next = [...servers.keys()].sort().map((n) => build(n, servers.get(n) ?? {}));
|
|
185
|
+
// tools/prompts/resources whose server has no /health entry still get a group
|
|
186
|
+
for (const name of new Set([...toolsBy.keys(), ...promptsBy.keys(), ...resourcesBy.keys()])) {
|
|
187
|
+
if (!servers.has(name))
|
|
188
|
+
next.push(build(name, {}));
|
|
189
|
+
}
|
|
190
|
+
this.rows = next;
|
|
191
|
+
this.loading = false;
|
|
192
|
+
this.applyFilter();
|
|
193
|
+
this.tui.requestRender();
|
|
194
|
+
}
|
|
195
|
+
sessionOff(server) {
|
|
196
|
+
const filter = this.deps.getFilter();
|
|
197
|
+
if (!filter)
|
|
198
|
+
return false;
|
|
199
|
+
if (filter.allow?.length)
|
|
200
|
+
return !filter.allow.includes(server);
|
|
201
|
+
if (filter.deny?.length)
|
|
202
|
+
return filter.deny.includes(server);
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
/** Expand rows into the visible list honoring the search query. An expanded
|
|
206
|
+
* server contributes its tool rows beneath it (token estimates included). */
|
|
207
|
+
applyFilter() {
|
|
208
|
+
const q = this.query.trim().toLowerCase();
|
|
209
|
+
const out = [];
|
|
210
|
+
for (const row of this.rows) {
|
|
211
|
+
if (row.kind !== "server")
|
|
212
|
+
continue;
|
|
213
|
+
const serverMatch = !q || row.name.toLowerCase().includes(q) || String(row.tools.length).includes(q);
|
|
214
|
+
if (!serverMatch)
|
|
215
|
+
continue;
|
|
216
|
+
out.push(row);
|
|
217
|
+
if (!row.expanded)
|
|
218
|
+
continue;
|
|
219
|
+
if (row.tools.length === 0) {
|
|
220
|
+
const hint = row.sessionOff
|
|
221
|
+
? "(session off — tools hidden from this chat)"
|
|
222
|
+
: row.disabled
|
|
223
|
+
? "(press e to enable)"
|
|
224
|
+
: "(no tools advertised — disconnected or none)";
|
|
225
|
+
out.push({ kind: "hint", server: row.name, text: hint });
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
for (const t of row.tools) {
|
|
229
|
+
const toolMatch = !q || t.name.toLowerCase().includes(q) || (t.description ?? "").toLowerCase().includes(q);
|
|
230
|
+
if (!toolMatch)
|
|
231
|
+
continue;
|
|
232
|
+
out.push({
|
|
233
|
+
kind: "tool",
|
|
234
|
+
server: row.name,
|
|
235
|
+
name: t.name,
|
|
236
|
+
desc: t.description ?? "",
|
|
237
|
+
tokens: estimateTokens(t),
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
this.visible = out;
|
|
242
|
+
if (this.cursor >= this.visible.length)
|
|
243
|
+
this.cursor = Math.max(0, this.visible.length - 1);
|
|
244
|
+
}
|
|
245
|
+
// ── rendering ──
|
|
246
|
+
render(width) {
|
|
247
|
+
const w = Math.min(PANEL_WIDTH, Math.max(40, width));
|
|
248
|
+
const inner = w - 4;
|
|
249
|
+
this.container.clear();
|
|
250
|
+
const line = (text) => this.container.addChild(new Text(text, 0, 0));
|
|
251
|
+
line(`${this.fg("muted", "╭─ ")}${this.fg("toolTitle", "mcp-combiner")}${this.fg("muted", ` ${"─".repeat(Math.max(0, w - 17))}╮`)}`);
|
|
252
|
+
const port = (() => {
|
|
253
|
+
try {
|
|
254
|
+
return new URL(this.deps.connection.controlOrigin()).port || "80";
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
return "?";
|
|
258
|
+
}
|
|
259
|
+
})();
|
|
260
|
+
this.row(`${this.fg(stateColor(this.deps.connection.state), stateGlyph(this.deps.connection.state))} connection ${this.deps.connection.state} · :${port} · token ${this.deps.getToken() ?? "-"}`, inner);
|
|
261
|
+
const filter = this.deps.getFilter();
|
|
262
|
+
this.row(filter
|
|
263
|
+
? `exposure ${filter.allow ? `allow: ${filter.allow.join(", ")}` : `deny: ${filter.deny?.join(", ") ?? ""}`}`
|
|
264
|
+
: "exposure all servers", inner);
|
|
265
|
+
let searchLine;
|
|
266
|
+
if (this.searchActive) {
|
|
267
|
+
searchLine = `◎ search: ${this.query}▏`;
|
|
268
|
+
}
|
|
269
|
+
else if (this.query) {
|
|
270
|
+
searchLine = `◎ ${this.query} (esc clears)`;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
searchLine = `◎ ${this.fg("muted", "type / to filter")}`;
|
|
274
|
+
}
|
|
275
|
+
this.row(searchLine, inner);
|
|
276
|
+
if (this.notice)
|
|
277
|
+
this.row(this.fg("error", this.notice), inner);
|
|
278
|
+
line(this.fg("muted", "├" + "─".repeat(w - 2) + "┤"));
|
|
279
|
+
if (this.loading) {
|
|
280
|
+
this.row(this.fg("muted", "loading…"), inner);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
const slice = this.visible.slice(this.offset, this.offset + MAX_VISIBLE);
|
|
284
|
+
slice.forEach((row, i) => {
|
|
285
|
+
const sel = this.offset + i === this.cursor;
|
|
286
|
+
const mark = sel ? this.fg("toolTitle", "›") : " ";
|
|
287
|
+
if (row.kind === "server") {
|
|
288
|
+
const g = this.fg(stateColor(row.state), stateGlyph(row.state));
|
|
289
|
+
let head = `${mark} ${row.expanded ? "▾" : "▸"} ${g} ${pad(row.name, NAME_PAD)}`;
|
|
290
|
+
if (row.disabled) {
|
|
291
|
+
head += this.fg("muted", " [disabled]");
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
head += this.fg("muted", ` ${row.tools.length} ${ICON_TOOL} ${row.resources.length} ${ICON_RESOURCE} ${row.prompts.length} ${ICON_PROMPT}`);
|
|
295
|
+
}
|
|
296
|
+
if (row.transport)
|
|
297
|
+
head += this.fg("muted", ` [${row.transport}]`);
|
|
298
|
+
if (row.sessionOff)
|
|
299
|
+
head += this.fg("error", " [session off]");
|
|
300
|
+
this.row(head, inner);
|
|
301
|
+
}
|
|
302
|
+
else if (row.kind === "hint") {
|
|
303
|
+
this.row(` ${this.fg("muted", row.text)}`, inner);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
const body = truncateToWidth(`${pad(row.name, TOOL_PAD)}${row.desc.split("\n", 1)[0] ?? ""}`, inner - 12, "…");
|
|
307
|
+
const tail = this.fg("muted", `~${row.tokens}t`);
|
|
308
|
+
this.row(`${sel ? body : this.fg("muted", body)}${" ".repeat(Math.max(1, inner - 12 - visibleWidth(body) - 6))}${tail}`, inner);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
const total = this.visible.length;
|
|
312
|
+
if (total > MAX_VISIBLE)
|
|
313
|
+
this.row(this.fg("muted", `… ${total - MAX_VISIBLE} more (↑/↓)`), inner);
|
|
314
|
+
}
|
|
315
|
+
line(this.fg("muted", "├" + "─".repeat(w - 2) + "┤"));
|
|
316
|
+
this.row(this.fg("muted", "↑↓ move · enter expand · e enable/disable · c copy · / filter · r refresh · q close"), inner);
|
|
317
|
+
line(this.fg("muted", "╰" + "─".repeat(w - 2) + "╯"));
|
|
318
|
+
return this.container.render(w);
|
|
319
|
+
}
|
|
320
|
+
/** Add a row with muted side rails, padded to the panel width. */
|
|
321
|
+
row(text, inner) {
|
|
322
|
+
const padded = Math.max(0, inner - visibleWidth(text));
|
|
323
|
+
const rail = this.fg("muted", "│");
|
|
324
|
+
this.container.addChild(new Text(`${rail} ${text}${" ".repeat(padded)} ${rail}`, 0, 0));
|
|
325
|
+
}
|
|
326
|
+
// ── input ──
|
|
327
|
+
handleInput(data) {
|
|
328
|
+
if (matchesKey(data, "ctrl+c") || matchesKey(data, "escape")) {
|
|
329
|
+
if (this.searchActive || this.query) {
|
|
330
|
+
this.searchActive = false;
|
|
331
|
+
this.query = "";
|
|
332
|
+
this.applyFilter();
|
|
333
|
+
this.tui.requestRender();
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
this.done();
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (matchesKey(data, "q")) {
|
|
340
|
+
this.done();
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (matchesKey(data, "r")) {
|
|
344
|
+
void this.refresh();
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (this.searchActive) {
|
|
348
|
+
if (matchesKey(data, "enter")) {
|
|
349
|
+
this.searchActive = false;
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (matchesKey(data, "backspace")) {
|
|
353
|
+
this.query = this.query.slice(0, -1);
|
|
354
|
+
}
|
|
355
|
+
else if (data.length === 1 && data >= " " && data <= "~") {
|
|
356
|
+
this.query += data;
|
|
357
|
+
}
|
|
358
|
+
this.applyFilter();
|
|
359
|
+
this.tui.requestRender();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (matchesKey(data, "/")) {
|
|
363
|
+
this.searchActive = true;
|
|
364
|
+
this.tui.requestRender();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const move = (delta) => {
|
|
368
|
+
this.cursor = Math.min(this.visible.length - 1, Math.max(0, this.cursor + delta));
|
|
369
|
+
if (this.cursor < this.offset)
|
|
370
|
+
this.offset = this.cursor;
|
|
371
|
+
if (this.cursor >= this.offset + MAX_VISIBLE)
|
|
372
|
+
this.offset = this.cursor - MAX_VISIBLE + 1;
|
|
373
|
+
this.tui.requestRender();
|
|
374
|
+
};
|
|
375
|
+
if (matchesKey(data, "up") || matchesKey(data, "k"))
|
|
376
|
+
return move(-1);
|
|
377
|
+
if (matchesKey(data, "down") || matchesKey(data, "j"))
|
|
378
|
+
return move(1);
|
|
379
|
+
const row = this.visible[this.cursor];
|
|
380
|
+
if (matchesKey(data, "enter") || matchesKey(data, "space")) {
|
|
381
|
+
if (row?.kind === "server") {
|
|
382
|
+
this.expandedServer = this.expandedServer === row.name ? null : row.name;
|
|
383
|
+
for (const r of this.rows)
|
|
384
|
+
if (r.kind === "server" && r.name === row.name)
|
|
385
|
+
r.expanded = !r.expanded;
|
|
386
|
+
this.applyFilter();
|
|
387
|
+
this.tui.requestRender();
|
|
388
|
+
}
|
|
389
|
+
else if (row?.kind === "tool") {
|
|
390
|
+
copyToClipboard(row.name, this.deps.notify);
|
|
391
|
+
}
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (matchesKey(data, "c") && row?.kind === "tool") {
|
|
395
|
+
copyToClipboard(row.name, this.deps.notify);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if ((matchesKey(data, "e") || matchesKey(data, "d")) && row?.kind === "server") {
|
|
399
|
+
const verb = row.disabled ? "enable" : "disable";
|
|
400
|
+
this.notice = `${verb} ${row.name}…`;
|
|
401
|
+
this.tui.requestRender();
|
|
402
|
+
void metaToolCall(this.deps.connection, verb, row.name)
|
|
403
|
+
.then((msg) => {
|
|
404
|
+
this.notice = msg;
|
|
405
|
+
return this.refresh();
|
|
406
|
+
})
|
|
407
|
+
.catch((e) => {
|
|
408
|
+
this.notice = `${verb} failed: ${e instanceof Error ? e.message : String(e)}`;
|
|
409
|
+
this.tui.requestRender();
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/** Open the panel as a centered overlay; resolves when closed. */
|
|
415
|
+
export async function openCombinerPanel(deps, ui) {
|
|
416
|
+
const custom = ui?.custom;
|
|
417
|
+
if (!custom) {
|
|
418
|
+
deps.notify("mcp-combiner: panel requires a TUI session (ctx.ui.custom)", "warn");
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
await custom((tui, theme, _keybindings, done) => new CombinerPanel(deps, tui, theme, () => done(undefined)), {
|
|
422
|
+
overlay: true,
|
|
423
|
+
overlayOptions: { anchor: "center", width: PANEL_WIDTH },
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.js","sourceRoot":"","sources":["../../src/client/panel.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,6EAA6E;AAC7E,sGAAsG;AACtG,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,kFAAkF;AAClF,uEAAuE;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,wBAAwB,CAAA;AAEnH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAmC/C,gFAAgF;AAChF,uEAAuE;AACvE,MAAM,YAAY,GAA2B;IACzC,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,GAAG;IACd,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,GAAG;IACb,YAAY,EAAE,GAAG;IACjB,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;CACZ,CAAA;AACD,0EAA0E;AAC1E,MAAM,SAAS,GAAG,QAAQ,CAAA,CAAC,aAAa;AACxC,MAAM,aAAa,GAAG,QAAQ,CAAA,CAAC,aAAa;AAC5C,MAAM,WAAW,GAAG,QAAQ,CAAA,CAAC,gBAAgB;AAE7C,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,QAAQ,GAAG,EAAE,CAAA;AACnB,MAAM,QAAQ,GAAG,EAAE,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AAC,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;iBAClD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACV,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA;gBACjB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;YACzB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,IAAI,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;gBAC7E,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAA;YAC5B,CAAC,CAAC,CAAA;QACV,CAAC;IACL,CAAC;CACJ;AAED,kEAAkE;AAClE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAe,EAAE,EAAW;IAChE,MAAM,MAAM,GAAI,EAA8C,EAAE,MAUjD,CAAA;IACf,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,IAAI,CAAC,MAAM,CAAC,4DAA4D,EAAE,MAAM,CAAC,CAAA;QACjF,OAAM;IACV,CAAC;IACD,MAAM,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE;QACzG,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE;KAC3D,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "../pi.js";
|
|
2
|
+
import type { CombinerConnection, PromptSummary } from "./connection.js";
|
|
3
|
+
/** Adapter-compatible prompt-name sanitizer: collapse invalid runs to `_`, trim,
|
|
4
|
+
* `prompt` when empty, leading `_` when it starts with a digit. */
|
|
5
|
+
export declare function sanitizePromptName(name: string): string;
|
|
6
|
+
/** Command name for a combiner prompt (`<server>_<name>`), in adapter shape. */
|
|
7
|
+
export declare function promptCommandName(prefixedPromptName: string, prefix: string): string;
|
|
8
|
+
export declare function parsePromptArgs(input: string): {
|
|
9
|
+
positional: string[];
|
|
10
|
+
named: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedPromptArgs = {
|
|
13
|
+
ok: true;
|
|
14
|
+
args: Record<string, string>;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
error: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function resolvePromptArgs(prompt: PromptSummary, parsed: {
|
|
20
|
+
positional: string[];
|
|
21
|
+
named: Record<string, string>;
|
|
22
|
+
}): ResolvedPromptArgs;
|
|
23
|
+
/** Flatten a prompts/get result into one string for sendUserMessage: role markers
|
|
24
|
+
* when multi-message, bare text for a single user message; non-text content
|
|
25
|
+
* becomes inline `[resource uri]` / `[image mime]` / `[audio mime]` markers. */
|
|
26
|
+
export declare function formatPromptResult(result: unknown): string;
|
|
27
|
+
/** Discover prompts and register one command each. Idempotent: prompts already
|
|
28
|
+
* registered are left alone; new ones are added. Returns the count seen. */
|
|
29
|
+
export declare function syncPromptCommands(pi: ExtensionAPI, connection: CombinerConnection, prefix: string, registered: Set<string>, notify: (message: string, level: "info" | "warn" | "error") => void): Promise<number>;
|
|
30
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/client/prompts.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAIxE;oEACoE;AACpE,wBAAgB,kBAAkB,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