substrate

package
v0.0.0-...-73e540a Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActorEgressPolicy

func ActorEgressPolicy(atespace string, destinations []string, credentials []egress.Credential) (*ateapipb.EgressPolicy, error)

ActorEgressPolicy compiles HTTP(S) origins into an actor's default allowlist. Credential bindings are already canonicalized by the store.

func ActorHost

func ActorHost(atespace, actorID, suffix string) string

ActorHost returns the logical A2A authority stored for an actor.

func ActorName

func ActorName(sessionID string) string

ActorName is the stable private Actor identity for a Session.

func ActorTargetFromHost

func ActorTargetFromHost(authority string) (string, error)

ActorTargetFromHost converts a stored A2A authority to Substrate's ate-target-actor header value. The authority itself is no longer routable.

func ActorTemplateForRevision

func ActorTemplateForRevision(spec *translator.Revision, revisionID translator.RevisionID) (*ateapipb.ActorTemplate, error)

ActorTemplateForRevision constructs the immutable ate-api resource for a compiled revision. It performs no reads or writes, which makes it safe to use inside a KRT transformation.

func ActorTemplateSpecEqual

func ActorTemplateSpecEqual(left, right *ateapipb.ActorTemplate) bool

ActorTemplateSpecEqual compares the client-owned immutable fields of two templates, excluding server-owned metadata and golden-snapshot status.

func AdvancePageToken

func AdvancePageToken(previous, next string) (string, error)

AdvancePageToken moves a paging loop on, refusing a token that repeats itself: a server answering with the token it was given is not advancing, and a loop that follows it re-reads the same page until whatever cap is above it. Exported because every loop over ate-api's pagination wants the check.

func ApplyActorTransition

func ApplyActorTransition(ctx context.Context, actors LifecycleClient, transition *ActorTransition) error

ApplyActorTransition requires durable execution authority. Errors retain the claim's durable intent and pins. Another bounded attempt can retry that intent.

func SandboxActorTemplate

func SandboxActorTemplate(template *v1alpha3.SandboxTemplate, class atev1alpha1.SandboxClass, policy SandboxPolicy) (*ateapipb.ActorTemplate, string, json.RawMessage, error)

SandboxActorTemplate compiles standalone inputs without an Agent Card or Harness. The image's entrypoint is replaced by the pinned, platform-managed guest.

Types

type ActorBinding

type ActorBinding struct {
	Atespace         string
	Name             string
	TemplateAtespace string
	TemplateName     string
}

type ActorCreation

type ActorCreation struct {
	EgressPolicy *ateapipb.EgressPolicy
	Snapshot     *ActorSnapshot
	Resume       bool
}

ActorCreation describes runtime startup, independent of the owning API. Agent creation stays suspended; a standalone guest starts serving immediately.

type ActorSnapshot

type ActorSnapshot struct {
	Tag          *ateapipb.ObjectRef
	URI          string
	ContentScope ateapipb.SnapshotContentScope
}

type ActorTransition

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

func PrepareActorRetry

func PrepareActorRetry(ctx context.Context, actors LifecycleClient, binding ActorBinding, operation apiv1.RuntimeOperation, creation *ActorCreation) (*ActorTransition, error)

PrepareActorRetry resumes previously issued intent. Substrate serializes lifecycle mutations with its Actor lease and resumes incomplete workflows. The immutable runtime name and pinned template identify an existing creation.

func PrepareActorTransition

func PrepareActorTransition(ctx context.Context, actors LifecycleClient, binding ActorBinding, operation apiv1.RuntimeOperation, creation *ActorCreation) (*ActorTransition, error)

PrepareActorTransition performs read-only checks before the store's durable claim. It never adopts an existing Actor for an unissued creation.

func (*ActorTransition) ActorUID

func (t *ActorTransition) ActorUID() string

ActorUID returns the observed runtime identity, including after creation.

type Client

type Client struct {
	ateapipb.ControlClient
	// contains filtered or unexported fields
}

Client wraps ate-api Control gRPC.

func Dial

func Dial(ctx context.Context, cfg Config) (*Client, error)

Dial connects to the ate-api server.

func (*Client) Close

func (c *Client) Close() error

func (*Client) CreateActor

func (c *Client) CreateActor(ctx context.Context, atespace, actorID, tmplNS, tmplName string) (*ateapipb.Actor, error)

func (*Client) CreateActorFromTag

func (c *Client) CreateActorFromTag(ctx context.Context, atespace, actorID, tmplNS, tmplName, tagAtespace, tagName string) (*ateapipb.Actor, error)

func (*Client) CreateActorTemplate

func (c *Client) CreateActorTemplate(ctx context.Context, template *ateapipb.ActorTemplate) (*ateapipb.ActorTemplate, error)

func (*Client) CreateTag

func (c *Client) CreateTag(ctx context.Context, atespace, name, actorName string) (*ateapipb.Tag, error)

func (*Client) DeleteActor

func (c *Client) DeleteActor(ctx context.Context, atespace, actorID string) error

func (*Client) DeleteActorTemplate

func (c *Client) DeleteActorTemplate(ctx context.Context, atespace, name string) error

DeleteActorTemplate delegates golden Actor and Tag cleanup to Substrate.

func (*Client) DeleteTag

func (c *Client) DeleteTag(ctx context.Context, atespace, name, uid string) error

func (*Client) EnsureActorEgressPolicy

func (c *Client) EnsureActorEgressPolicy(ctx context.Context, atespace, name string, policy *ateapipb.EgressPolicy) error

EnsureActorEgressPolicy can be retried after a lost create response. A prepared revision is immutable, so an existing policy must match; never accept or overwrite a different allowlist. Substrate deletes the policy with its Actor.

func (*Client) EnsureAtespace

func (c *Client) EnsureAtespace(ctx context.Context, name string) error

EnsureAtespace idempotently ensures the named atespace exists on the substrate side. Actors cannot be created into a nonexistent atespace (FailedPrecondition).

func (*Client) GetActor

func (c *Client) GetActor(ctx context.Context, atespace, actorID string) (*ateapipb.Actor, error)

func (*Client) GetActorTemplate

func (c *Client) GetActorTemplate(ctx context.Context, atespace, name string) (*ateapipb.ActorTemplate, error)

func (*Client) GetTag

func (c *Client) GetTag(ctx context.Context, atespace, name string) (*ateapipb.Tag, error)

func (*Client) ListActorTemplates

func (c *Client) ListActorTemplates(ctx context.Context, atespace string) ([]*ateapipb.ActorTemplate, error)

ListActorTemplates returns every template in an atespace, following pagination. Draining is right here where it is not for actors: templates are configuration, so operators set their count rather than the cluster.

func (*Client) ListActorTemplatesPage

func (c *Client) ListActorTemplatesPage(ctx context.Context, atespace string, pageToken string) ([]*ateapipb.ActorTemplate, string, error)

ListActorTemplatesPage returns one page of templates in the given atespace, with the token for the next page or "" on the last one.

func (*Client) ListActorsPage

func (c *Client) ListActorsPage(ctx context.Context, atespace string, pageSize int32, pageToken string) ([]*ateapipb.Actor, string, error)

ListActorsPage returns one page of actors in the given atespace (empty = all of them, including substrate's reserved golden atespace), with the token for the next page or "" on the last. A page may be empty and still not be the last, so a caller that stops on an empty page stops early.

func (*Client) ListWorkersPage

func (c *Client) ListWorkersPage(ctx context.Context, pageSize int32, pageToken string) ([]*ateapipb.Worker, string, error)

ListWorkersPage returns one page of workers, with the token for the next page or "" on the last one.

func (*Client) ResumeActor

func (c *Client) ResumeActor(ctx context.Context, atespace, actorID string) (*ateapipb.Actor, error)

func (*Client) SuspendActor

func (c *Client) SuspendActor(ctx context.Context, atespace, actorID string) (*ateapipb.Actor, error)

type Config

type Config struct {
	// AteAPIEndpoint is a gRPC target (e.g. dns:///api.ate-system.svc:443).
	AteAPIEndpoint string
	// CAFile contains the CA certificates used to verify ate-api.
	CAFile string
	// ClientCertFile contains the PEM client certificate and private key used for mTLS.
	ClientCertFile string
	DialTimeout    time.Duration
	CallTimeout    time.Duration
}

Config holds connection settings for Agent Substrate ate-api.

type LifecycleClient

type LifecycleClient interface {
	GetActor(context.Context, string, string) (*ateapipb.Actor, error)
	CreateActor(context.Context, string, string, string, string) (*ateapipb.Actor, error)
	CreateActorFromTag(context.Context, string, string, string, string, string, string) (*ateapipb.Actor, error)
	EnsureActorEgressPolicy(context.Context, string, string, *ateapipb.EgressPolicy) error
	ResumeActor(context.Context, string, string) (*ateapipb.Actor, error)
	SuspendActor(context.Context, string, string) (*ateapipb.Actor, error)
	DeleteActor(context.Context, string, string) error
}

type SandboxPolicy

type SandboxPolicy struct {
	GuestImage string
	CPU        string
	Memory     string
}

SandboxPolicy is operator-owned. Its resolved values are pinned in each revision.

Jump to

Keyboard shortcuts

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