backend

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package backend provides the ConnectRPC client for the Kontext AgentService. Authenticates with the user's OIDC bearer token from `kontext login`. No client secrets, no client_credentials grant.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL() string

BaseURL returns the API base URL from env or default.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps the ConnectRPC AgentService client.

func NewClient

func NewClient(baseURL string, ts TokenSource) *Client

NewClient creates a ConnectRPC client that fetches a fresh token per request.

func (*Client) BootstrapCli added in v0.3.0

BootstrapCli prepares the shared CLI application for env template sync.

func (*Client) CreateSession

CreateSession creates a governed agent session.

func (*Client) EndSession

func (c *Client) EndSession(ctx context.Context, sessionID string) error

EndSession terminates a session.

func (*Client) Heartbeat

func (c *Client) Heartbeat(ctx context.Context, sessionID string) error

Heartbeat keeps a session alive.

func (*Client) IngestEvent

func (c *Client) IngestEvent(ctx context.Context, req *agentv1.ProcessHookEventRequest) error

IngestEvent sends a single hook event via the ProcessHookEvent unary RPC.

type TokenSource

type TokenSource func() (string, error)

TokenSource returns a valid access token, refreshing if necessary.

func StaticToken

func StaticToken(token string) TokenSource

StaticToken returns a TokenSource that always returns the same token. Useful for tests or short-lived commands.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL