Documentation
¶
Overview ¶
Code generated by contractgen; DO NOT EDIT.
Package e2b adapts the official SDK helper to managed compute operations.
Index ¶
- Constants
- Variables
- func BuildDirect(c sandbox.DirectConfig) (sandbox.SandboxProvider, error)
- func HelperErrors() []string
- func HelperOperations() []string
- func InstalledPaths(paths sandbox.ProcessPaths) (string, string, error)
- func NormalizeEndpoint(apiURL, domain string) (string, string, error)
- func NormalizeSelection(s sandbox.Selection) (sandbox.Selection, error)
- func Operations() providercontract.Operations
- func Policy() sandbox.DeploymentPolicy
- func ResolveChange(next, previous sandbox.Selection) sandbox.Selection
- func ValidateConfiguration(c *DeploymentConfiguration) error
- func ValidateResources(r sandbox.Resources) error
- func ValidateSpecification(s sandbox.DeploymentSpec) error
- func WithTemplateBuild(input sandbox.Selection, build *DeploymentBuild) sandbox.Selection
- type Caller
- type Config
- type ConfigurationAdapter
- func (ConfigurationAdapter) Decode(record sandbox.ConfigurationRecord) (sandbox.Configuration, error)
- func (ConfigurationAdapter) DecodeInput(public, secret json.RawMessage) (sandbox.Configuration, error)
- func (ConfigurationAdapter) DiscoverConfiguration(ctx context.Context, input sandbox.ConfigurationDiscoveryInput, ...) (json.RawMessage, error)
- func (ConfigurationAdapter) DiscoverSelection(ctx context.Context, c sandbox.DirectConfig) (sandbox.Selection, error)
- func (ConfigurationAdapter) Encode(value sandbox.Configuration) (sandbox.ConfigurationRecord, error)
- func (ConfigurationAdapter) Equal(a, b sandbox.Configuration) (bool, error)
- func (ConfigurationAdapter) Normalize(s sandbox.Selection) (sandbox.Selection, error)
- func (ConfigurationAdapter) Requirements() sandbox.ConfigurationRequirements
- func (a ConfigurationAdapter) ResolveChange(next, previous sandbox.Selection) (sandbox.Selection, error)
- func (ConfigurationAdapter) VerifyCredential(ctx context.Context, c sandbox.DirectConfig, refs []sandbox.Reference) error
- func (ConfigurationAdapter) WithCredential(owner, candidate sandbox.Configuration) (sandbox.Configuration, error)
- type DeploymentBuild
- type DeploymentConfiguration
- type Observation
- type ProcessCaller
- type Provider
- func (p *Provider) Create(ctx context.Context, b sandbox.Bootstrap) (sandbox.Info, error)
- func (p *Provider) DeleteSnapshot(context.Context, sandbox.Reference, sandbox.SnapshotIdentity) error
- func (p *Provider) GetCompute(context.Context, sandbox.Reference, sandbox.Compute) (sandbox.ComputeState, error)
- func (p *Provider) GetInfo(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)
- func (p *Provider) Initial(context.Context, sandbox.Reference) (sandbox.Compute, error)
- func (p *Provider) Kill(ctx context.Context, r sandbox.Reference) error
- func (p *Provider) KillCompute(context.Context, sandbox.Reference, sandbox.Compute) error
- func (p *Provider) NewCompute(context.Context, sandbox.Reference, uint64, *sandbox.SnapshotIdentity) (sandbox.Compute, error)
- func (p *Provider) Observe(ctx context.Context, target runtimeobs.Target) (runtimeobs.Sample, error)
- func (*Provider) ProviderOperations() providercontract.Operations
- func (p *Provider) Renew(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)
- func (p *Provider) Resume(context.Context, sandbox.ResumeRequest) (sandbox.ComputeState, error)
- func (p *Provider) ResumeCompute(context.Context, sandbox.Reference, sandbox.Compute) (sandbox.ComputeState, error)
- func (p *Provider) RunCommand(ctx context.Context, r sandbox.Reference, c sandbox.Command) (sandbox.CommandResult, error)
- func (p *Provider) RunCommandCompute(context.Context, sandbox.Reference, sandbox.Compute, sandbox.Command) (sandbox.CommandResult, error)
- func (p *Provider) Suspend(context.Context, sandbox.SuspendRequest) (sandbox.ComputeState, error)
- func (p *Provider) ValidateDeployment(ctx context.Context) (TemplateBuild, error)
- type ReadyBuild
- type Request
- type Response
- type TemplateBuild
- type TemplateSummary
Constants ¶
const MaxCommandInputBytes = sandbox.MaxCommandInputBytes
const MaxCredentialReferences = 32
const MaxOutputBytes = 1024 * 1024
const MaxRequestBytes = 72 * 1024 * 1024
const MaxResponseBytes = 16 * 1024 * 1024
const OfficialAPIURL = "https://api.e2b.app"
const OfficialDomain = "e2b.app"
const ProtocolVersion = 1
This adapter-private boundary is documented in tools/e2b-provider/README.md.
const SDKVersion = "2.51.0"
Variables ¶
var ErrEndpoint = errors.New("invalid E2B endpoint")
Functions ¶
func BuildDirect ¶ added in v0.0.10
func BuildDirect(c sandbox.DirectConfig) (sandbox.SandboxProvider, error)
BuildDirect builds the Provider for one direct-mode selection.
func HelperErrors ¶
func HelperErrors() []string
HelperErrors are sanitized wire outcomes; an empty code denotes success.
func HelperOperations ¶
func HelperOperations() []string
HelperOperations declares the complete set of one-shot helper operations.
func InstalledPaths ¶
func InstalledPaths(paths sandbox.ProcessPaths) (string, string, error)
InstalledPaths resolves the adapter's fixed distribution layout.
func NormalizeEndpoint ¶
NormalizeEndpoint returns the two SDK routing selectors. Both must be set together for a compatible service; omission selects the official cloud.
func NormalizeSelection ¶
NormalizeSelection accepts omitted candidate resources only until live build discovery. Persistence requires ValidateSpecification after preparation.
func Operations ¶
func Operations() providercontract.Operations
Operations is this adapter's complete authored resource contract.
func Policy ¶
func Policy() sandbox.DeploymentPolicy
func ValidateConfiguration ¶
func ValidateConfiguration(c *DeploymentConfiguration) error
func ValidateResources ¶
func ValidateSpecification ¶
func ValidateSpecification(s sandbox.DeploymentSpec) error
func WithTemplateBuild ¶
func WithTemplateBuild(input sandbox.Selection, build *DeploymentBuild) sandbox.Selection
Types ¶
type Config ¶
type Config struct {
Binary, StateDir, InstallationID, APIKey, Template, APIURL, Domain string
TimeoutSeconds int
Resources *sandbox.Resources
}
Config contains trusted deployment configuration; APIKey travels only on stdin.
type ConfigurationAdapter ¶
type ConfigurationAdapter struct{}
func (ConfigurationAdapter) Decode ¶
func (ConfigurationAdapter) Decode(record sandbox.ConfigurationRecord) (sandbox.Configuration, error)
func (ConfigurationAdapter) DecodeInput ¶
func (ConfigurationAdapter) DecodeInput(public, secret json.RawMessage) (sandbox.Configuration, error)
func (ConfigurationAdapter) DiscoverConfiguration ¶
func (ConfigurationAdapter) DiscoverConfiguration(ctx context.Context, input sandbox.ConfigurationDiscoveryInput, paths sandbox.ProcessPaths) (json.RawMessage, error)
func (ConfigurationAdapter) DiscoverSelection ¶ added in v0.0.10
func (ConfigurationAdapter) DiscoverSelection(ctx context.Context, c sandbox.DirectConfig) (sandbox.Selection, error)
DiscoverSelection checks the immutable native build without allocating compute.
func (ConfigurationAdapter) Encode ¶
func (ConfigurationAdapter) Encode(value sandbox.Configuration) (sandbox.ConfigurationRecord, error)
func (ConfigurationAdapter) Equal ¶
func (ConfigurationAdapter) Equal(a, b sandbox.Configuration) (bool, error)
func (ConfigurationAdapter) Requirements ¶
func (ConfigurationAdapter) Requirements() sandbox.ConfigurationRequirements
func (ConfigurationAdapter) ResolveChange ¶
func (ConfigurationAdapter) VerifyCredential ¶ added in v0.0.10
func (ConfigurationAdapter) VerifyCredential(ctx context.Context, c sandbox.DirectConfig, refs []sandbox.Reference) error
VerifyCredential is read-only and bounded. A public readable template alone does not prove team ownership. References are one bounded Core-owned page.
func (ConfigurationAdapter) WithCredential ¶
func (ConfigurationAdapter) WithCredential(owner, candidate sandbox.Configuration) (sandbox.Configuration, error)
type DeploymentBuild ¶
DeploymentBuild is the fixed build as read by the validation that admitted a selection. RootDiskMiB is nil when E2B does not report it.
type DeploymentConfiguration ¶
type DeploymentConfiguration struct {
CredentialSupplied bool `json:"-"`
APIKey string `json:"-"`
APIURL string `json:"api_url,omitempty"`
Domain string `json:"domain,omitempty"`
Template string `json:"template"`
TemplateBuild *DeploymentBuild `json:"-"`
// contains filtered or unexported fields
}
APIKey is internal configuration. HTTP requests use a write-only DTO. DeploymentBuild is set only by Core after it validates the candidate.
func (*DeploymentConfiguration) HasCredential ¶
func (c *DeploymentConfiguration) HasCredential() bool
func (*DeploymentConfiguration) MarshalJSON ¶
func (*DeploymentConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON blocks accidental serialization; ConfigurationAdapter.Encode owns the public projection.
func (*DeploymentConfiguration) ReplacesCredential ¶
func (c *DeploymentConfiguration) ReplacesCredential() bool
func (*DeploymentConfiguration) String ¶
func (c *DeploymentConfiguration) String() string
type Observation ¶
type Observation struct {
Status string
ObservedAt, StartedAt *time.Time `json:",omitempty"`
CPUCount, CPUUsedPct *float64 `json:",omitempty"`
MemUsed, MemTotal *uint64 `json:",omitempty"`
DiskUsed, DiskTotal *uint64 `json:",omitempty"`
}
Observation is the requested allocation's latest E2B metrics point. Status is observed, not_running, unavailable or ownership; only observed carries values. A malformed E2B point is unavailable. Values keep E2B's units: CPUUsedPct is a percentage of all CPUCount cores, and memory and disk are in bytes.
type ProcessCaller ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (*Provider) DeleteSnapshot ¶
func (*Provider) GetCompute ¶
func (*Provider) KillCompute ¶
func (*Provider) NewCompute ¶
func (*Provider) Observe ¶
func (p *Provider) Observe(ctx context.Context, target runtimeobs.Target) (runtimeobs.Sample, error)
Observe reads one allocation with one helper request. The helper takes the sandbox ID from its private receipt, confirms the running sandbox by its allocation labels and reads E2B's metrics. It never connects to, renews or changes a sandbox.
func (*Provider) ProviderOperations ¶
func (*Provider) ProviderOperations() providercontract.Operations
func (*Provider) Resume ¶
func (p *Provider) Resume(context.Context, sandbox.ResumeRequest) (sandbox.ComputeState, error)
func (*Provider) ResumeCompute ¶
func (*Provider) RunCommand ¶
func (*Provider) RunCommandCompute ¶
func (*Provider) Suspend ¶
func (p *Provider) Suspend(context.Context, sandbox.SuspendRequest) (sandbox.ComputeState, error)
func (*Provider) ValidateDeployment ¶
func (p *Provider) ValidateDeployment(ctx context.Context) (TemplateBuild, error)
ValidateDeployment verifies team ownership and reads the exact immutable build without creating compute or allocation receipts. Candidate configuration remains unpublished until it passes. It returns the build as read. Without configured Resources it only requires a ready build, whose CPU and memory the caller then adopts as the selection.
type ReadyBuild ¶
type Request ¶
type Request struct {
Version int
Operation string
Config Config
Reference sandbox.Reference
// References lists the allocations of one verify_credential request.
References []sandbox.Reference `json:",omitempty"`
Bootstrap *sandbox.Bootstrap `json:",omitempty"`
RuntimeBootstrap *runtimebootstrap.Connection `json:",omitempty"`
Command *sandbox.Command `json:",omitempty"`
Deadline time.Time
}
type Response ¶
type Response struct {
Version int
Info *sandbox.Info `json:",omitempty"`
Command *sandbox.CommandResult `json:",omitempty"`
ErrorCode string
DeploymentValid bool `json:",omitempty"`
TemplateBuild *TemplateBuild `json:",omitempty"`
Templates []TemplateSummary `json:",omitempty"`
Builds []ReadyBuild `json:",omitempty"`
Observation *Observation `json:",omitempty"`
}
type TemplateBuild ¶
TemplateBuild is the fixed build as read by deployment validation. RootDiskMiB is nil when E2B does not report the build's disk size.
type TemplateSummary ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
contractgen
command
Command contractgen projects the adapter's Go declarations into its Python artifacts.
|
Command contractgen projects the adapter's Go declarations into its Python artifacts. |