@geohar/pi-mcp-combiner 0.24.2 → 0.24.5
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 +101 -0
- package/dist/client/footer.d.ts +10 -2
- package/dist/client/footer.d.ts.map +1 -1
- package/dist/client/footer.js +15 -6
- package/dist/client/footer.js.map +1 -1
- package/dist/combiner-process.d.ts +160 -0
- package/dist/combiner-process.d.ts.map +1 -0
- package/dist/combiner-process.js +721 -0
- package/dist/combiner-process.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +140 -306
- package/dist/index.js.map +1 -1
- package/dist/native/combiner-connection.d.ts +84 -0
- package/dist/native/combiner-connection.d.ts.map +1 -1
- package/dist/native/combiner-connection.js +194 -5
- package/dist/native/combiner-connection.js.map +1 -1
- package/dist/native/index.d.ts +32 -4
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js +94 -6
- package/dist/native/index.js.map +1 -1
- package/dist/native/resources.d.ts +3 -0
- package/dist/native/resources.d.ts.map +1 -1
- package/dist/native/resources.js +6 -1
- package/dist/native/resources.js.map +1 -1
- package/dist/native/tool-surface.d.ts +31 -2
- package/dist/native/tool-surface.d.ts.map +1 -1
- package/dist/native/tool-surface.js +62 -18
- package/dist/native/tool-surface.js.map +1 -1
- package/dist/pi.d.ts +9 -1
- package/dist/pi.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/client/footer.ts +16 -4
- package/src/client/panel.ts +1 -1
- package/src/client/renderers.ts +2 -2
- package/src/combiner-process.ts +813 -0
- package/src/index.ts +142 -355
- package/src/native/combiner-connection.ts +220 -10
- package/src/native/index.ts +119 -18
- package/src/native/resources.ts +8 -1
- package/src/native/tool-surface.ts +80 -18
- package/src/pi.ts +6 -1
package/src/client/footer.ts
CHANGED
|
@@ -50,19 +50,25 @@ export function countsFromHealth(health: unknown): FooterCounts {
|
|
|
50
50
|
return { enabled, ready, disabled }
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/** A native tool-registration pass in progress: tools registered so far / to register. */
|
|
54
|
+
export type RegisterProgress = { done: number; total: number }
|
|
55
|
+
|
|
53
56
|
/** Render the footer text for a mode (undefined = clear the slot). */
|
|
54
57
|
export function footerText(
|
|
55
58
|
mode: FooterStatus,
|
|
56
59
|
counts: FooterCounts,
|
|
57
60
|
connectionState: string,
|
|
58
61
|
toolCount?: number,
|
|
62
|
+
registering?: RegisterProgress,
|
|
59
63
|
): string | undefined {
|
|
60
64
|
if (mode === "off") return undefined
|
|
61
65
|
if (mode === "compact") return `${PLUG} MCP ${counts.ready}/${counts.enabled}`
|
|
62
66
|
let text = `${PLUG} ${counts.enabled} ${counts.enabled === 1 ? "server" : "servers"} enabled`
|
|
63
67
|
if (counts.ready > 0) text += ` (${counts.ready} ready)`
|
|
64
68
|
if (counts.disabled > 0) text += ` (${counts.disabled} disabled)`
|
|
65
|
-
if (
|
|
69
|
+
if (registering && registering.done < registering.total) {
|
|
70
|
+
text += ` · registering tools ${registering.done}/${registering.total}`
|
|
71
|
+
} else if (typeof toolCount === "number" && toolCount > 0) text += ` · ${toolCount} tools`
|
|
66
72
|
if (connectionState !== "connected" && connectionState !== "disconnected") {
|
|
67
73
|
text += ` — ${connectionState}`
|
|
68
74
|
}
|
|
@@ -78,6 +84,9 @@ export async function updateFooter(
|
|
|
78
84
|
ui: ExtensionUIContext | undefined,
|
|
79
85
|
key: string,
|
|
80
86
|
mode: FooterStatus,
|
|
87
|
+
/** Read AFTER the /health and tools/list awaits, so a slow paint that resolves
|
|
88
|
+
* last shows the progress as it is then, not as it was when it started. */
|
|
89
|
+
registering?: () => RegisterProgress | undefined,
|
|
81
90
|
): Promise<void> {
|
|
82
91
|
if (mode === "off") return
|
|
83
92
|
const setStatus = ui?.setStatus
|
|
@@ -92,9 +101,12 @@ export async function updateFooter(
|
|
|
92
101
|
}
|
|
93
102
|
let text: string | undefined
|
|
94
103
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
// List tools only on a live connection: a footer repaint must never start a
|
|
105
|
+
// connect itself (it would bypass the connection's reconnect backoff).
|
|
106
|
+
const tools = connection.state === "connected" ? connection.listTools().catch(() => undefined) : undefined
|
|
107
|
+
const [health, toolList] = await Promise.all([connection.health(), tools])
|
|
108
|
+
const toolCount = toolList?.length
|
|
109
|
+
text = footerText(mode, countsFromHealth(health), connection.state, toolCount, registering?.())
|
|
98
110
|
} catch {
|
|
99
111
|
// Combiner unreachable: report our connection state honestly, still occupying
|
|
100
112
|
// the slot so the label never silently vanishes.
|
package/src/client/panel.ts
CHANGED
|
@@ -276,7 +276,7 @@ class CombinerPanel implements Component {
|
|
|
276
276
|
|
|
277
277
|
// ── rendering ──
|
|
278
278
|
|
|
279
|
-
render(width: number): string[] {
|
|
279
|
+
render(width: number): readonly string[] {
|
|
280
280
|
const w = Math.min(PANEL_WIDTH, Math.max(40, width))
|
|
281
281
|
const inner = w - 4
|
|
282
282
|
this.container.clear()
|
package/src/client/renderers.ts
CHANGED
|
@@ -37,7 +37,7 @@ class TitleRow implements TuiComponent {
|
|
|
37
37
|
this.cached = null
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
render(width: number): string[] {
|
|
40
|
+
render(width: number): readonly string[] {
|
|
41
41
|
const safeWidth = Math.max(1, Math.floor(width))
|
|
42
42
|
if (this.cached?.width === safeWidth) return this.cached.lines
|
|
43
43
|
const fg = this.theme?.fg?.bind(this.theme)
|
|
@@ -84,7 +84,7 @@ class CompactResult implements TuiComponent {
|
|
|
84
84
|
this.cached = null
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
render(width: number): string[] {
|
|
87
|
+
render(width: number): readonly string[] {
|
|
88
88
|
const safeWidth = Math.max(1, Math.floor(width))
|
|
89
89
|
if (this.cached?.width === safeWidth) return this.cached.lines
|
|
90
90
|
const fg = this.theme?.fg?.bind(this.theme)
|