internal/webfetchhelp/help.go
// Package webfetchhelp provides the canonical, embedded help text shared by
// ez-agent-webfetch and the builtin buffer tool. It intentionally has no
// dependency on the webfetch implementation or networking packages.
package webfetchhelp
import (
_ "embed"
"strings"
)
var (
//go:embed text/general.txt
general string
//go:embed text/http.txt
httpHelp string
//go:embed text/html.txt
htmlHelp string
//go:embed text/websocket.txt
websocketHelp string
//go:embed text/framed.txt
framedHelp string
//go:embed text/mcp.txt
mcpHelp string
)
const exitAndSecurity = `EXIT STATUSES AND SECURITY NOTES
0 Successful operation, help, or version output. MCP tool_error also exits 0;
inspect its structured outcome rather than treating this as tool success.
1 Runtime failure (network, TLS, status, limit, filesystem, framing,
abnormal WebSocket close, timeout, signal, or output failure).
2 Usage failure (bad flag, URL, header, value, or option combination).
Diagnostics are written only to stderr; HTTP/WebSocket payload bytes are written
only to stdout or the requested output file. MCP writes a structured JSON response
to stdout; its result/protocol data is untrusted, and OAuth handoff data stays local.
Partial stdout or direct file output cannot be rolled back after a later failure.
URL userinfo and unnecessary query data are removed from diagnostics, and request
bodies and secret headers are not logged.
HTTPS and WSS always verify hostnames and certificates with the system root CA
store. There is no insecure TLS mode. HTTP and WS are plaintext. Standard Go
HTTP_PROXY, HTTPS_PROXY, and NO_PROXY behavior is retained. Secret command-line
header values may be visible in process listings and shell history.
`
// General returns the concise command help, including its final LF.
func General() string { return general }
// HTTP returns the HTTP reference, including its final LF.
func HTTP() string { return httpHelp }
// HTML returns the response transform reference, including its final LF.
func HTML() string { return htmlHelp }
// WebSocket returns the WebSocket and stream-mode reference, including its final LF.
func WebSocket() string { return websocketHelp }
// Framed returns the framed WebSocket protocol reference, including its final LF.
func Framed() string { return framedHelp }
// MCP returns the outbound MCP client reference, including its final LF.
func MCP() string { return mcpHelp }
// All returns all help sections in deterministic contract order.
func All() string {
return strings.Join([]string{
strings.TrimSuffix(general, "\n"),
strings.TrimSuffix(httpHelp, "\n"),
strings.TrimSuffix(htmlHelp, "\n"),
strings.TrimSuffix(websocketHelp, "\n"),
strings.TrimSuffix(framedHelp, "\n"),
strings.TrimSuffix(mcpHelp, "\n"),
strings.TrimSuffix(exitAndSecurity, "\n"),
}, "\n\n") + "\n"
}
// Meta returns canonical content for a static webfetch-help meta buffer.
func Meta(name string) (string, bool) {
switch name {
case "meta:webfetch-help":
return General(), true
case "meta:webfetch-help/http":
return HTTP(), true
case "meta:webfetch-help/html":
return HTML(), true
case "meta:webfetch-help/websocket":
return WebSocket(), true
case "meta:webfetch-help/framed":
return Framed(), true
case "meta:webfetch-help/mcp":
return MCP(), true
case "meta:webfetch-help/all":
return All(), true
default:
return "", false
}
}