Documentation
¶
Index ¶
- Constants
- Variables
- func Execute() error
- func GetAPIURL() string
- func GetFormat() string
- func GetOrg() string
- func GetSite() string
- func IsDebug() bool
- func IsDryRun() bool
- func IsQuiet() bool
- func Print(format string, args ...any)
- func PrintLn(msg string)
- func RunStdioBridge(ctx context.Context, cfg StdioBridgeConfig) error
- func SetSite(site string)
- type DeviceCodeResponse
- type DeviceCodeStatusResponse
- type StdioBridgeConfig
- type TokenSource
Constants ¶
const DefaultAPIURL = "https://studio.taufinity.io"
DefaultAPIURL is the default Taufinity API endpoint.
Variables ¶
var ( Version = "dev" GitCommit = "unknown" BuildTime = "unknown" )
Build-time variables (set via ldflags). Kept as package-level vars so the Makefile's -X linker flags still work; buildinfo.FromBuildtime falls back to debug.BuildInfo when they're left at their defaults.
Functions ¶
func RunStdioBridge ¶
func RunStdioBridge(ctx context.Context, cfg StdioBridgeConfig) error
RunStdioBridge runs the stdio bridge against the configured upstream. It blocks until ctx is canceled, stdin reaches EOF, or a fatal error occurs.
Types ¶
type DeviceCodeResponse ¶
type DeviceCodeResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
DeviceCodeResponse matches the API response.
type DeviceCodeStatusResponse ¶
type DeviceCodeStatusResponse struct {
Status string `json:"status"`
AccessToken string `json:"access_token,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Email string `json:"email,omitempty"`
OrganizationName string `json:"organization_name,omitempty"`
}
DeviceCodeStatusResponse matches the API response.
type StdioBridgeConfig ¶
type StdioBridgeConfig struct {
UpstreamURL string
TokenSource TokenSource
Token string // static fallback; ignored if TokenSource is set
OrgID string // if set, sends X-Organization-ID on every request
UserAgent string
Timeout time.Duration
MaxFrameBytes int // 0 → defaultMaxFrameBytes
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
StdioBridgeConfig configures the stdio MCP bridge.
Either TokenSource or Token may be set. TokenSource is preferred — it is called per-request so a token rotated outside the process (e.g. user re-running `taufinity auth login`) is picked up without restarting the bridge. Token is a static fallback for tests and embedded callers; it never expires for the bridge's purposes.
type TokenSource ¶
TokenSource produces a bearer token for the upstream /mcp endpoint. It is called once per outbound HTTP request (via WithHTTPHeaderFunc), with results cached in-memory until the token is within tokenRefreshLeeway of expiry. Implementations should be cheap (single file read) but safe to call concurrently. Returning an error suppresses the Authorization header for that request, surfacing a clear upstream 401 to the client rather than silently sending a stale bearer.