bridge

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bridge serves Atmos API services to native plugins within live invocations.

Index

Constants

View Source
const InvocationMetadata = "atmos-invocation-id"

InvocationMetadata is set by Plugin SDK calls back into the Atmos API.

Variables

This section is empty.

Functions

func ClearPrivateSession

func ClearPrivateSession(storage keyring.Keyring, namespace string) error

ClearPrivateSession deletes a whole host-selected scope without enumerating the keyring. OS keychains support this just like encrypted file and memory backends.

Types

type Invocation

type Invocation struct {
	Context context.Context
	Browser api.Browser
	HTTP    api.HTTP
	Secrets SecretReader
	Keyring keyring.Keyring
	// Logs shows the log entries the plugin delivers while the call runs. Nil grants no live delivery.
	Logs        LogSink
	Namespace   string
	Interactive bool
	// AwaitUser marks the call as waiting for the user and returns the function that ends the
	// wait, so the call timeout does not run while a person signs in. Nil means no such pause;
	// the native runtime sets it for interactive invocations with a call timeout.
	AwaitUser func() (resume func())
}

Invocation scopes API services to a single active call. Namespace includes the package, configured provider, realm, and configuration fingerprint.

type LogSink

type LogSink interface {
	WriteLogs(context.Context, []*pluginv1.LogEntry)
}

LogSink shows the log entries a plugin delivers during its invocation. Write returns after the entries are shown, which is what lets a plugin order its entries before its result. It must not fail the invocation.

type SecretReader

type SecretReader interface {
	ReadSecret(context.Context, string) (string, error)
}

SecretReader grants logical names, never arbitrary store paths, to one provider.

type Server

Server rejects API requests after their invocation has completed.

func New

func New() *Server

New creates an isolated API server for one native plugin process.

func (*Server) Begin

func (s *Server) Begin(id string, invocation Invocation) (func(), error)

Begin grants API access until the returned cleanup function is called.

func (*Server) Delete

func (s *Server) Delete(ctx context.Context, request *apiv1.DeleteRequest) (*emptypb.Empty, error)

Delete removes session state even after its access token has expired.

func (*Server) Do

func (s *Server) Do(ctx context.Context, request *apiv1.HTTPRequest) (*apiv1.HTTPResponse, error)

Do executes one exchange through the invocation's shared HTTP transport.

func (*Server) Get

func (s *Server) Get(ctx context.Context, request *apiv1.GetRequest) (*apiv1.GetResponse, error)

Get reads opaque private session state without applying access-token expiry.

func (*Server) Listen

Listen sends readiness before waiting for exactly one matching callback.

func (*Server) Open

func (s *Server) Open(ctx context.Context, request *apiv1.OpenRequest) (*emptypb.Empty, error)

Open launches the browser configured for this invocation.

func (*Server) Put

func (s *Server) Put(ctx context.Context, request *apiv1.PutRequest) (*emptypb.Empty, error)

Put persists a replacement session before the plugin publishes new credentials.

func (*Server) Read

func (s *Server) Read(ctx context.Context, request *apiv1.SecretRequest) (*apiv1.SecretResponse, error)

Read reads an explicitly granted secret without exposing backend diagnostics.

func (*Server) Register

func (s *Server) Register(server *grpc.Server)

Register attaches all API services to one broker connection.

func (*Server) Write

func (s *Server) Write(ctx context.Context, request *pluginv1.LogRequest) (*emptypb.Empty, error)

Write shows entries delivered by the active invocation. An invocation without a sink, or an unknown or finished one, delivers nothing; the plugin then returns the entries in its response instead.

Jump to

Keyboard shortcuts

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