Documentation
¶
Overview ¶
Package instance resolves runtime identity before application state is opened.
Index ¶
- func BootMiddleware(identity devcontract.BootIdentity) func(http.Handler) http.Handler
- func PluginEnvironment(stateRoot, pluginID string, base []string) ([]string, error)
- func PreparePluginArtifact(workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string) (string, func(), error)
- func RecordBuiltArtifact(workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string, ...) error
- func RecordBuiltArtifactAtHome(home string, workspace devcontract.ResolvedWorkspace, ...) error
- func RestoreNativeChildEnvironment(base []string) ([]string, error)
- func Snapshot(d devcontract.InstanceDescriptor) devcontract.InstanceDescriptor
- func VerifyPluginArtifact(workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string) error
- func VerifyPluginArtifactAtHome(home string, workspace devcontract.ResolvedWorkspace, ...) error
- type Options
- type Profile
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 ¶
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 RecordBuiltArtifact ¶ added in v0.32.0
func RecordBuiltArtifact( workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string, sdk devsdk.Identity, ) error
RecordBuiltArtifact MUST only be called after the trusted builder verifies the selected SDK and confirms the exact identity is unchanged across a successful build. A source identity is written as the schema 3 record; a published identity is written as a schema 4 record with its typed identity, capability and the SHA-256 of the exact bytes. Dirty source edits are supported: the digest identifies that working-tree snapshot, not a claim that hashing alone proves source inclusion in the executable.
func RecordBuiltArtifactAtHome ¶ added in v0.36.0
func RecordBuiltArtifactAtHome( home string, workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string, sdk devsdk.Identity, ) error
RecordBuiltArtifactAtHome records the same verified artifact under an explicit manager home. It always acquires the real stable UUID guard itself; callers must finish their stopped build and release that guard before recording.
func RestoreNativeChildEnvironment ¶
RestoreNativeChildEnvironment restores absence as well as empty values, so plugin/tool credential and cache discovery sees exactly the caller's context.
func Snapshot ¶
func Snapshot(d devcontract.InstanceDescriptor) devcontract.InstanceDescriptor
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.
func VerifyPluginArtifactAtHome ¶ added in v0.36.0
func VerifyPluginArtifactAtHome(home string, workspace devcontract.ResolvedWorkspace, pluginID, binaryPath string) error
VerifyPluginArtifactAtHome applies the same ownership and hash checks to an explicit manager home. The caller still holds the selected root ownership flock.
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 ResolveEnvironment ¶
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 ¶
ChildEnvironment replaces inherited ownership values, including for a root selected programmatically or by ldflags. It never replaces HOME/credentials.
func (Profile) NativeHostEnvironment ¶
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 ¶
PrepareRuntime creates only instance-owned transient directories. Call after native preflight and root/channel guards, never during profile resolution.