nameresolver

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectedEntry

type ConnectedEntry struct {
	ExeID       string `json:"exe_id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	IsDefault   bool   `json:"is_default"`
	LastSeenAt  string `json:"last_seen_at,omitempty"`
}

ConnectedEntry mirrors the JSON shape codex-exec-gateway's /api/exec-gateway/connected returns. Exported so in-process callers (sdk.Server) can supply a Fetcher closure that returns these without the resolver round-tripping through HTTP. Per v0.54.0, exe_id is returned by the API but stripped from anything we send to the LLM.

type Fetcher

type Fetcher func(ctx context.Context) ([]ConnectedEntry, error)

Fetcher returns the current connected-executor set. Used by callers that already have the list in-process (codex-exec-gateway's SDK layer); HTTP-mode callers (codex-app-gateway) still use NewResolver.

type Resolver

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

Resolver maintains a workspace-scoped name → exe_id map by periodically refreshing from app-gateway's /internal/connected. Tools that take an environment_id (semantically a name) call Resolve to get the underlying exe_id for bridge.Pool.Get.

Cache strategy:

  • First Resolve populates the cache.
  • Subsequent Resolves use the cache if its age is under cacheTTL.
  • A Resolve miss forces an immediate refresh before erroring.

func NewResolver

func NewResolver(loopbackURL, loopbackToken string, logger *slog.Logger) *Resolver

func NewResolverWithFetcher

func NewResolverWithFetcher(fetch Fetcher, logger *slog.Logger) *Resolver

NewResolverWithFetcher constructs a Resolver that calls fetch instead of making an HTTP request. Use this from in-process callers that have the connected list directly (codex-exec-gateway SDK layer) to avoid a loopback HTTP hop and the associated workspace cap-token plumbing.

func (*Resolver) LLMView

func (r *Resolver) LLMView(ctx context.Context) ([]byte, error)

LLMView returns the entries reshaped for the LLM (omits exe_id). Always refreshes to keep the LLM's view fresh.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, name string) (string, error)

Resolve returns the exe_id bound to name in the current workspace. If name isn't in the cache, refreshes once before reporting not-found.

Jump to

Keyboard shortcuts

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