Documentation
¶
Index ¶
- Constants
- func CheckAPIServerRequirements() bool
- func ListenAddress(ctx context.Context, extra map[string]any) (any, int)
- type APIServerAdapter
- func (a *APIServerAdapter) ActiveAgentWorkCount() int
- func (a *APIServerAdapter) BindRunAdmissionAlias(key, admissionID string)
- func (a *APIServerAdapter) ConfiguredModelRoute(alias any) map[string]any
- func (a *APIServerAdapter) Connect(ctx context.Context, isReconnect bool) (bool, error)
- func (a *APIServerAdapter) Disconnect(ctx context.Context) error
- func (a *APIServerAdapter) EnsureSessionDB(ctx context.Context) (*state.SessionDB, error)
- func (a *APIServerAdapter) GetChatInfo(ctx context.Context, chatID string) (map[string]any, error)
- func (a *APIServerAdapter) InterruptActiveRuns(reason string) int
- func (a *APIServerAdapter) MarkShutdownRequested() int
- func (a *APIServerAdapter) PrepareTurnRuntime(ctx context.Context, model string, runtimeKwargs map[string]any, settings any) (string, error)
- func (a *APIServerAdapter) ReleaseRunAdmissionAlias(key, admissionID string)
- func (a *APIServerAdapter) RunAdmission(ctx context.Context, runID string) (*gateway.SessionAuthority, *jsonutil.Object, error)
- func (a *APIServerAdapter) RunInternalSessionTurn(ctx context.Context, sessionID, text, profile, notificationCategory string) error
- func (a *APIServerAdapter) SelfPostTarget() (string, int, string, string)
- func (a *APIServerAdapter) Send(ctx context.Context, chatID, content, replyTo string, metadata map[string]any) (gateway.SendResult, error)
- func (a *APIServerAdapter) SendClarify(ctx context.Context, chatID, question string, choices []string, ...) (gateway.SendResult, error)
- func (a *APIServerAdapter) TurnRuntimeMetadata(ag *agent.AIAgent, settings any, confirmedRuntimeLock bool) (*jsonutil.Object, error)
- type APIServerMemorySessions
- func (m *APIServerMemorySessions) Checkin(ctx context.Context, a *agent.AIAgent)
- func (m *APIServerMemorySessions) Checkout(ctx context.Context, sessionID string) *memory.MemoryManager
- func (m *APIServerMemorySessions) CloseAll(ctx context.Context)
- func (m *APIServerMemorySessions) Parked() map[[2]string]*memory.MemoryManager
- type HTTPEventAdapter
- type RoomGrantReauthorizationRequired
Constants ¶
const ( // Host the adapter binds when neither config nor env names one DefaultHost = "127.0.0.1" // Port the adapter binds when neither config nor env names one DefaultPort = 8642 // English failure label a gateway auth error sniffer keys on ProviderAuthFailedLabel = "Provider authentication failed" // English failure label a gateway rate limit sniffer keys on ProviderRateLimitedLabel = "Provider rate-limited" )
Variables ¶
This section is empty.
Functions ¶
func CheckAPIServerRequirements ¶
func CheckAPIServerRequirements() bool
Whether the API server can run, the HTTP server being built in
Types ¶
type APIServerAdapter ¶
type APIServerAdapter struct {
*gateway.BasePlatformAdapter
// contains filtered or unexported fields
}
APIServerAdapter serves OpenAI format requests through real agents on an HTTP listener
func NewAPIServerAdapter ¶
func NewAPIServerAdapter(ctx context.Context, cfg *gateway.PlatformConfig) (*APIServerAdapter, error)
Adapter for an API server platform config
func (*APIServerAdapter) ActiveAgentWorkCount ¶
func (a *APIServerAdapter) ActiveAgentWorkCount() int
Pending admissions plus in flight turns plus live structured run tasks
func (*APIServerAdapter) BindRunAdmissionAlias ¶
func (a *APIServerAdapter) BindRunAdmissionAlias(key, admissionID string)
Binds a streaming run id to the admission whose shared approval prompt it answers
func (*APIServerAdapter) ConfiguredModelRoute ¶
func (a *APIServerAdapter) ConfiguredModelRoute(alias any) map[string]any
Configured route of a model alias with its credentials, nil when the alias is unknown
func (*APIServerAdapter) Connect ¶
Starts the HTTP listener, a rejected key or a held port being a non retryable fatal error
func (*APIServerAdapter) Disconnect ¶
func (a *APIServerAdapter) Disconnect(ctx context.Context) error
Stops the listener and releases every owned store, memory manager and session handle
func (*APIServerAdapter) EnsureSessionDB ¶
Session store of the active profile home, the stateless adapter surface delegation deliveries write through
func (*APIServerAdapter) GetChatInfo ¶
Basic info about the API server
func (*APIServerAdapter) InterruptActiveRuns ¶
func (a *APIServerAdapter) InterruptActiveRuns(reason string) int
Interrupts every adapter owned agent during shutdown and returns how many were interrupted
func (*APIServerAdapter) MarkShutdownRequested ¶
func (a *APIServerAdapter) MarkShutdownRequested() int
Persists the gateway drain start on every nonterminal API run
func (*APIServerAdapter) PrepareTurnRuntime ¶
func (a *APIServerAdapter) PrepareTurnRuntime(ctx context.Context, model string, runtimeKwargs map[string]any, settings any) (string, error)
Model a gateway turn runs for an API admission, the settings route selecting over the resolved runtime kwargs
func (*APIServerAdapter) ReleaseRunAdmissionAlias ¶
func (a *APIServerAdapter) ReleaseRunAdmissionAlias(key, admissionID string)
Drops a streaming run id's binding while it still names this admission
func (*APIServerAdapter) RunAdmission ¶
func (a *APIServerAdapter) RunAdmission(ctx context.Context, runID string) (*gateway.SessionAuthority, *jsonutil.Object, error)
Authority and ledger row of a run's canonical admission, the ownership check's view of the adapter
func (*APIServerAdapter) RunInternalSessionTurn ¶
func (a *APIServerAdapter) RunInternalSessionTurn(ctx context.Context, sessionID, text, profile, notificationCategory string) error
Runs one background wake turn against a raw session id in process
func (*APIServerAdapter) SelfPostTarget ¶
func (a *APIServerAdapter) SelfPostTarget() (string, int, string, string)
Bind address, key and model name of this listener for a wake self post
func (*APIServerAdapter) Send ¶
func (a *APIServerAdapter) Send(ctx context.Context, chatID, content, replyTo string, metadata map[string]any) (gateway.SendResult, error)
Delivery is the HTTP request and response cycle itself, never send
func (*APIServerAdapter) SendClarify ¶
func (a *APIServerAdapter) SendClarify(ctx context.Context, chatID, question string, choices []string, clarifyID, sessionKey string, metadata map[string]any) (gateway.SendResult, error)
Clarify question routed to the authority run that asked it
func (*APIServerAdapter) TurnRuntimeMetadata ¶
func (a *APIServerAdapter) TurnRuntimeMetadata(ag *agent.AIAgent, settings any, confirmedRuntimeLock bool) (*jsonutil.Object, error)
Served runtime of a finished gateway turn under a confirmed model lock, an error when it differs from the lock
type APIServerMemorySessions ¶
type APIServerMemorySessions struct {
// contains filtered or unexported fields
}
APIServerMemorySessions keeps one initialised memory manager per profile home and session across requests
func NewAPIServerMemorySessions ¶
func NewAPIServerMemorySessions(maxSize *int, idleTTLSecs *float64) *APIServerMemorySessions
Registry with optional fixed bounds, the gateway agent cache bounds resolved lazily otherwise
func (*APIServerMemorySessions) Checkin ¶
func (m *APIServerMemorySessions) Checkin(ctx context.Context, a *agent.AIAgent)
Parks the agent's manager under its final session, shutting down displaced or idle managers
func (*APIServerMemorySessions) Checkout ¶
func (m *APIServerMemorySessions) Checkout(ctx context.Context, sessionID string) *memory.MemoryManager
Manager an earlier request on the session checked in, nil when none or parked past the retry horizon
func (*APIServerMemorySessions) CloseAll ¶
func (m *APIServerMemorySessions) CloseAll(ctx context.Context)
Drains and shuts down every parked manager inline at adapter shutdown
func (*APIServerMemorySessions) Parked ¶
func (m *APIServerMemorySessions) Parked() map[[2]string]*memory.MemoryManager
Parked managers by key, for tests
type HTTPEventAdapter ¶
type HTTPEventAdapter interface {
VerifyHTTPEventRequest(ctx context.Context, authHeader string) (bool, string, error)
DispatchHTTPEvent(ctx context.Context, payload *jsonutil.Object) (any, error)
}
Platform adapter answering HTTP events with its own verifier and dispatcher
type RoomGrantReauthorizationRequired ¶
RoomGrantReauthorizationRequired is a validly signed room grant that was revoked or superseded
func (*RoomGrantReauthorizationRequired) Error ¶
func (e *RoomGrantReauthorizationRequired) Error() string
Source Files
¶
- adapter.go
- api_turn.go
- assertions.go
- authority_runs.go
- bot_chat.go
- chat.go
- connect.go
- jobs.go
- log.go
- memory_sessions.go
- module.go
- openai_helpers.go
- openai_responses.go
- openai_responses_stream.go
- openai_routes.go
- openai_routes_sse.go
- register.go
- response_admissions.go
- room_dispatch.go
- room_files.go
- room_grants.go
- room_share.go
- routes.go
- runagent.go
- runagent_export.go
- runs_authority.go
- runs_execute.go
- runs_handle.go
- runs_lifecycle.go
- runs_routes.go
- runs_state.go
- runtime.go
- sessions.go
- wire_headers.go