Documentation
¶
Overview ¶
Package endpoint defines the immutable compatible-mode base URL contract.
ParseBaseURL validates absolute http/https bases with no DNS or network I/O. Descriptor.Join applies one deterministic trailing-slash and separator policy for execution and inventory operations across the three generic modes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("endpoint: not implemented")
ErrNotImplemented is retained for Task 1.3 RED helpers; production paths no longer return it after Task 2.2.
Functions ¶
This section is empty.
Types ¶
type Descriptor ¶
type Descriptor struct {
// contains filtered or unexported fields
}
Descriptor is an immutable validated base URL.
Values are constructed only by ParseBaseURL. Zero value is invalid and must not be used for joining.
func ParseBaseURL ¶
func ParseBaseURL(raw string) (Descriptor, error)
ParseBaseURL validates an absolute http/https base URL with a non-empty host.
Contract:
- accept only http and https;
- reject userinfo, fragments, empty hosts, and malformed URLs;
- preserve explicit ports and intentional path prefixes;
- strip a single trailing slash for a deterministic join base;
- perform no DNS lookup or network I/O.
func (Descriptor) BaseURL ¶
func (d Descriptor) BaseURL() string
BaseURL returns the normalized absolute base URL without userinfo or fragment.
func (Descriptor) Host ¶
func (d Descriptor) Host() string
Host returns the validated host without userinfo.
func (Descriptor) Join ¶
func (d Descriptor) Join(op Operation) (string, error)
Join returns the absolute URL for an operation relative to the descriptor.
One deterministic trailing-slash / separator policy covers execution and inventory joins: the validated base never ends with `/`, and each operation suffix begins with exactly one `/`.
Anthropic policy (matches essential adapter + AnthropicModelsProvider): BaseURL is the API origin (and optional gateway prefix) without a `/v1` suffix. Join always appends `/v1/messages` or `/v1/models`. OpenAI-compatible bases typically already include `/v1`; Join appends `/chat/completions`, `/responses`, or `/models` only.
func (Descriptor) Path ¶
func (d Descriptor) Path() string
Path returns the intentional path prefix preserved from the base URL.
func (Descriptor) Port ¶
func (d Descriptor) Port() string
Port returns the explicit port when present; empty when the URL omitted it.
func (Descriptor) Scheme ¶
func (d Descriptor) Scheme() string
Scheme returns the validated URL scheme (http or https).
func (Descriptor) Valid ¶
func (d Descriptor) Valid() bool
Valid reports whether the descriptor was produced by a successful ParseBaseURL.
type Operation ¶
type Operation string
Operation identifies a deterministic join target shared by execution and inventory for the three generic compatible modes.
const ( OperationOpenAIChatCompletions Operation = "openai.chat_completions" OperationOpenAIResponses Operation = "openai.responses" OperationOpenAIModels Operation = "openai.models" OperationAnthropicMessages Operation = "anthropic.messages" OperationAnthropicModels Operation = "anthropic.models" )