instance

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 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 instance resolves runtime identity before application state is opened.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootMiddleware

func BootMiddleware(identity devcontract.BootIdentity) func(http.Handler) http.Handler

BootMiddleware wraps the outer asset chain, including the Vite proxy. JSON's default HTML escaping prevents a display name from terminating the script. HTML is never cached across instances; source index.html is not modified.

func PluginEnvironment

func PluginEnvironment(stateRoot, pluginID string, base []string) ([]string, error)

PluginEnvironment derives process ownership from the injected state service, not an inherited state-root variable. This also supports non-main embedders.

func PreparePluginArtifact

func PreparePluginArtifact(workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string) (string, func(), error)

PreparePluginArtifact fails closed before executing an unknown executable. It verifies a private executable snapshot against independent trusted build evidence, so replacement of the installed binary cannot race process launch. The caller must hold the selected root's ownership flock through launch; this read path validates the durable default owner but never claims one. cleanup must run only after the process has exited (or before any launch); Windows may retain an executing file until process termination.

func RecordBuiltArtifactSource

func RecordBuiltArtifactSource(workspace devcontract.ResolvedWorkspace, pluginID, binaryPath, expectedSDKRevision, sourceDigest string) error

RecordBuiltArtifactSource MUST only be called after the trusted builder verifies the selected SDK path and reviewed isolation-capable ancestor, then confirms the exact source digest is unchanged across a successful build. Dirty edits are supported: the digest identifies that working-tree snapshot, not a claim that hashing alone proves source inclusion in the executable.

func RestoreNativeChildEnvironment

func RestoreNativeChildEnvironment(base []string) ([]string, error)

RestoreNativeChildEnvironment restores absence as well as empty values, so plugin/tool credential and cache discovery sees exactly the caller's context.

func Snapshot

Snapshot returns a detached safe descriptor; no token or internal provenance path is part of the public instance contract.

func VerifyPluginArtifact

func VerifyPluginArtifact(workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string) error

VerifyPluginArtifact statically checks candidate bytes against the same workspace ownership and independent trusted build evidence used at launch, without copying the executable or writing to the artifact directory. The caller must hold the selected root's ownership flock. This is preflight only: bytes may subsequently change, so execution must still use the private verified snapshot returned by PreparePluginArtifact.

Types

type Options

type Options struct {
	CWD                 string
	Workspace           string
	EnvironmentManifest string
	StateRoot           string
	Home                string
	Channel             string
	Version             string
	Commit              string
	Generation          string
}

Options are resolved without creating files, opening settings, or starting services. StateRoot is an explicit selection, never an implicit production default.

type Profile

type Profile struct {
	Descriptor  devcontract.InstanceDescriptor
	Workspace   *devcontract.ResolvedWorkspace
	RuntimeRoot string
	WebviewRoot string
	// contains filtered or unexported fields
}

Profile is the resolved startup snapshot. Callers must not mutate Descriptor.

func Resolve

func Resolve(opts Options) (Profile, error)

func ResolveEnvironment

func ResolveEnvironment(version, commit string) (Profile, error)

ResolveEnvironment selects the host profile without relying on build optimization or telemetry's Development flag. A source/local build requires a workspace.

func (Profile) ChildEnvironment

func (p Profile) ChildEnvironment(base []string, pluginID string) ([]string, error)

ChildEnvironment replaces inherited ownership values, including for a root selected programmatically or by ldflags. It never replaces HOME/credentials.

func (Profile) NativeHostEnvironment

func (p Profile) NativeHostEnvironment(base []string) ([]string, error)

NativeHostEnvironment is applied only to the native host exec, never to its supervisor, source tools, plugins, HOME, config, runtime or desktop session. Discard inherited restore metadata: only this exec's actual input is trusted.

func (Profile) PrepareRuntime

func (p Profile) PrepareRuntime() error

PrepareRuntime creates only instance-owned transient directories. Call after native preflight and root/channel guards, never during profile resolution.

func (Profile) ValidateNativeHostEnvironment

func (p Profile) ValidateNativeHostEnvironment(getenv func(string) string) error

Jump to

Keyboard shortcuts

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