feat(mcp): expose session Ping on Client

Gateway supervisors need a cheap liveness probe to detect mid-flight
upstream death (crashed stdio child, restarted HTTP server). Client.Ping
forwards to the SDK session's MCP ping; a non-nil error means the
session is no longer usable.

Also moves examples/minimal's keep-import-live statement above the REPL
loop — it sat after an infinite for loop, tripping go vet's unreachable
code check.
This commit is contained in:
sausheong committed 2026-06-10 12:44:21 +08:00
1 parent 6f0040f606
commit cf47b2fca8
3 files changed
+32 -1

No files matched your search

+2 -1
View File
@@ -82,6 +82,8 @@ func main() {
}
defer rt.Close() // no-op here (no MCP), but idiomatic
_ = llm.ReasoningOff // keep llm import live for clarity in the demo
// 5. REPL loop.
in := bufio.NewScanner(os.Stdin)
fmt.Println("harness demo — type a message, blank line to exit")
@@ -115,5 +117,4 @@ func main() {
}
}
}
_ = llm.ReasoningOff // keep llm import live for clarity in the demo
}