devworkspace

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 53 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 devworkspace manages registered sources and ownership-safe feature worktrees. It has no desktop, native UI, or production-profile dependency.

Index

Constants

View Source
const (
	PluginRuntimeManaged = "managed"
	PluginRuntimeArchive = "archive"
)

Plugin runtime selections.

View Source
const (
	// SDKUnresolved: only the consumer's declared requirement was read, or an
	// earlier observation was withdrawn because a later verification of the
	// consumer was refused, a build's before/after comparison failed, or its
	// build failed. Nothing is claimed about the effective SDK; the resolved
	// version and checksums are empty.
	SDKUnresolved = "unresolved"
	// SDKVerified means exactly this, for an identity that passed the
	// before/after comparison of a build (or, for a verification with no build
	// around it, the one observation that was made and not contradicted):
	//
	//   - the extracted module-cache bytes of the SDK hash (dirhash) to the
	//     module and go.mod checksums the CONTROLLER itself reviewed (its
	//     compiled-in release table), not merely what the branch's go.sum says;
	//   - that module provides the state-root-v1 capability;
	//   - the compiled binary's Go build information names exactly that version
	//     and sum, with no replacement; and
	//   - the identity was unchanged between a before and an after observation of
	//     the build.
	//
	// It does NOT claim: that the SDK's behavior was reviewed for safety or
	// sandboxing; that the executable's bytes were compiled from the hashed
	// bytes (the build information is written by the go command, not measured);
	// or that the toolchain or the environment is trustworthy.
	SDKVerified = "verified"
	// SDKHistorical: a previous launch verified it. The workspace may have
	// changed since; this is evidence of that launch, not a fresh observation.
	SDKHistorical = "historical"
)

Verification labels of one SDK consumer. A declared requirement is never reported as an effective resolution: only a verifier's observation is.

Variables

This section is empty.

Functions

func CleanGenerated

func CleanGenerated(w Workspace) error

CleanGenerated requires the external operation lock and a stopped supervisor. All entries are checked before the first deletion; unknown .local resources remain untouched for their producer/lifecycle owner to handle explicitly.

func ConnectWorkspaceControl

func ConnectWorkspaceControl(ctx context.Context, w Workspace, home, generation string) (*devcontrol.Client, devcontract.InstanceDescriptor, error)

ConnectWorkspaceControl verifies kernel process identity and an authenticated protocol round trip. Neither a lease, /health nor an open TCP port is adopted.

func DiscoverCollections added in v0.15.0

func DiscoverCollections(ctx context.Context, directory string) ([]string, error)

DiscoverCollections lists reachable, validated collections associated with the selected Git repository's registered worktrees. It never selects a profile, scans sibling directories, fetches refs or creates a machine-global registry.

func GeneratedLockPath

func GeneratedLockPath(w Workspace, name string) (string, error)

func InspectOwnership added in v0.32.0

func InspectOwnership(ctx context.Context, w Workspace) (devoutputs.Inspection, error)

InspectOwnership enumerates every selected composition module root and staged producer, including unowned standalone trees. It does not install, lock, or create metadata. Launch repeats admission before starting each real writer.

func IsPinnedRef added in v0.7.1

func IsPinnedRef(ref string) bool

IsPinnedRef identifies hexadecimal commit selections, including common abbreviated object IDs. Branch and tag selections remain named refs.

func NewGeneration

func NewGeneration() string

func OwnershipMetadataPaths added in v0.32.0

func OwnershipMetadataPaths(w Workspace) map[string]string

OwnershipMetadataPaths exposes output metadata separately from runtime and profile state. The producer journal intentionally lives outside worktrees.

func ReadViteFeedbackContext

func ReadViteFeedbackContext(encoded string) (bool, error)

ReadViteFeedbackContext is the synchronous local authority used by managed Windows Vite children. It opens no network endpoint, performs no mutation and trusts only the captured explicit context and native retained-handle proof. Any failure must be treated as held by its caller.

func ReconcileGeneratedRoot

func ReconcileGeneratedRoot(w Workspace) error

ReconcileGeneratedRoot follows an A03-validated completed UUID rename. It neither adopts a second live root nor reacquires bytes changed by an editor.

func RecordGeneratedTree

func RecordGeneratedTree(prepared *GeneratedTree) error

RecordGeneratedTree is also required after a failed controlled build, so its partial outputs remain owned and recoverable instead of becoming foreign data.

func RequireStopped

func RequireStopped(ctx context.Context, w devcontract.ResolvedWorkspace) error

RequireStopped is suitable for Manager.Options.Stopped. A live supervisor owns build outputs even before its host has obtained the profile root lock.

func ResolveRepositoryUpstream added in v0.8.0

func ResolveRepositoryUpstream(
	ctx context.Context, common string, repository devcontract.Repository,
) (*devcontract.RepositoryUpstream, error)

ResolveRepositoryUpstream migrates only explicit remote-qualified selections. A plain local branch never acquires remote semantics through name guessing.

func RestoreRepositoryOutputs

func RestoreRepositoryOutputs(ctx context.Context, w Workspace) error

RestoreRepositoryOutputs runs only after the controller has stopped all owned producers and acquired its existing lifecycle/profile guards. It restores the current committed source, never a historic worktree snapshot.

func ResumeGeneratedPublication

func ResumeGeneratedPublication(w Workspace) error

ResumeGeneratedPublication only resumes bytes already attested by the completed producer capability. A process killed during compilation has no finalized output proof; it remains a precise ownership conflict, never an excuse to adopt/delete unknown files or PID-kill a surviving compiler.

func RunRepositoryCommand

func RunRepositoryCommand(ctx context.Context, command *exec.Cmd, owner devsession.ProcessOwner) error

RunRepositoryCommand runs one finite command under the caller's real workspace and fresh generation. It joins disposal of the entire owned descendant tree, including on cancellation, before returning authority to restore its inputs. The command must not use exec.CommandContext's independent leader-only kill.

func UpdateConfigurationFingerprint added in v0.8.0

func UpdateConfigurationFingerprint(manifest devcontract.WorkspaceManifest) string

func ValidateGenerated

func ValidateGenerated(_ context.Context, w Workspace) error

ValidateGenerated is the no-mutation ownership preflight used inside A03's guarded removal transaction before any irreversible native storage deletion.

func ValidateRepositoryOutputs

func ValidateRepositoryOutputs(ctx context.Context, w Workspace) error

Types

type ArchivePluginStatus added in v0.32.0

type ArchivePluginStatus struct {
	Archive       string   `json:"archive"`
	ArchiveSHA256 string   `json:"archiveSHA256"`
	BackendSHA256 string   `json:"backendSHA256,omitempty"`
	AssetFiles    int      `json:"assetFiles"`
	Capabilities  []string `json:"capabilities,omitempty"`
	OperationID   string   `json:"operationID,omitempty"`
}

ArchivePluginStatus is the nonsecret receipt of one published and installed static plugin archive. It records observations, not a provenance claim beyond the build evidence the producer actually recorded.

type BuildEvent

type BuildEvent struct {
	Node  string `json:"node"`
	Phase string `json:"phase"` // building, ready, error, invalidated
	Error string `json:"error,omitempty"`
	// contains filtered or unexported fields
}

type BuildGraph

type BuildGraph struct {
	Nodes []BuildNode `json:"nodes"`
	// contains filtered or unexported fields
}

func (*BuildGraph) Bootstrap

func (g *BuildGraph) Bootstrap(ctx context.Context) error

Bootstrap audits the complete installed composition before any producer. It never reinstalls dependencies under live consumers.

func (*BuildGraph) PNPMCommand

func (g *BuildGraph) PNPMCommand(ctx context.Context, pin string, args ...string) (string, []string, error)

PNPMCommand preserves the consumer's argv and actual cwd. Its private Node launcher dispatches only exact native12 and sets the validated aggregate root.

func (*BuildGraph) PublishPluginArchive added in v0.32.0

func (g *BuildGraph) PublishPluginArchive(ctx context.Context, plugin devcontract.Plugin) (string, ArchivePluginStatus, error)

PublishPluginArchive joins the actual frontend and backend outputs this graph produced for one selected plugin into a canonical archive under an owned generated tree. It only reads outputs whose ownership ledgers still match their recorded publication, and only packages a backend binary this graph recorded destination-owned build evidence for. It never installs.

func (*BuildGraph) ViteEnvironment

func (g *BuildGraph) ViteEnvironment() ([]string, error)

ViteEnvironment provides only selected absolute repository roots. Consumers must pass this to both host and plugin Vite children before their first launch.

func (*BuildGraph) Watch

func (g *BuildGraph) Watch(ctx context.Context, h WatchHooks) error

Watch is blocking and cancellation-owned. One workspace watcher owns output writes, while A08 retains plugin source watchers. Build failures are emitted and recover on the next edit; invalidated manifests and watcher I/O failures return to the supervisor for explicit reconfiguration, never auto-install.

type BuildNode

type BuildNode struct {
	ID           string   `json:"id"`
	Directory    string   `json:"directory"`
	PNPMVersion  string   `json:"pnpmVersion,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
	PluginID     string   `json:"pluginID,omitempty"`
	Kind         string   `json:"kind"`
}

BuildNode is one output owner. The graph runs independent nodes in parallel; consumers may inspect this list but must not execute nodes concurrently with Bootstrap or Watch.

type BuildOptions

type BuildOptions struct {
	// The current owned supervisor generation authorizes generated build outputs.
	Generation string
	// An already-owned UUID profile runtime cache, never a source-tree cache.
	GoBuildCacheDirectory string
	// Required verifier of the selected SDK; normally devsdk.NewVerifier under
	// the manager's injected devsdk.Policy. A published selection is verified
	// per consumer from its effective module graph; a source selection from the
	// selected checkout.
	VerifySDK devsdk.Verifier
	// ObserveSDK, when set, receives a consumer's published SDK identity only
	// after it has passed a build's before/after comparison (or, for a
	// verification with no build around it, such as a plugin archive's
	// re-verification or a reused artifact's re-attestation, after the one
	// observation that was made and not contradicted). It reports; it never
	// authorizes.
	ObserveSDK func(consumer string, identity devsdk.Identity)
	// DowngradeSDK, when set, is called with the consumer's repository ID
	// whenever a verification of that consumer is refused, a before/after
	// comparison fails, or its node errors after an observation: whatever was
	// reported for the consumer is no longer evidence, so the reporter must
	// stop calling it verified.
	DowngradeSDK func(consumer string)
	// HostBuild must compile the selected host (including native/module flags).
	HostBuild func(context.Context, HostBuildRequest) error
	// Optional real Task adapter. Output must remain exclusively in outputDirectory.
	// An adapter may add explicit host GO_MODFILE/BUILD_FLAGS task variables.
	Bindings func(ctx context.Context, hostDirectory, outputDirectory string) error
	// HostVariant names every host build setting outside source files (mode,
	// tags); it is part of the bindings and Go node reuse fingerprints.
	HostVariant string
	// HostOutput is the generated tree HostBuild publishes. With ReuseHost it
	// enables host reuse: ReuseHost adopts that unchanged published tree as the
	// launch binary instead of compiling. Both empty disables host reuse.
	HostOutput string
	ReuseHost  func(ctx context.Context, sdk devsdk.Identity) error
	Output     io.Writer
	OnEvent    func(BuildEvent)
}

type CheckoutStatus added in v0.7.1

type CheckoutStatus struct {
	Commit       string `json:"commit"`
	Branch       string `json:"branch,omitempty"`
	Dirty        bool   `json:"dirty"`
	SourceDigest string `json:"sourceDigest"`
	Error        string `json:"error,omitempty"`
}

CheckoutStatus is a filesystem observation, not a served-source attestation.

type CreateOptions

type CreateOptions struct {
	Slug         string
	DisplayName  string
	Repositories []string
	Plugins      []string
	Refs         map[string]string
	Baseline     *string
	Ports        *devcontract.PortPolicy
	// contains filtered or unexported fields
}

type EditOptions

type EditOptions struct {
	DisplayName        *string
	AddRepositories    []string
	RemoveRepositories []string
	AddPlugins         []string
	RemovePlugins      []string
	Slug               *string
	Refs               map[string]string
	Upstreams          map[string]string
	PreserveSelection  bool
	Ports              *devcontract.PortPolicy
}

type FollowOptions added in v0.8.0

type FollowOptions struct {
	UpdateOptions
	Interval time.Duration
	Apply    bool
	// contains filtered or unexported fields
}

type FollowStatus added in v0.8.0

type FollowStatus struct {
	WorkspaceID     string                      `json:"workspaceID"`
	Enabled         bool                        `json:"enabled"`
	Apply           bool                        `json:"apply"`
	Owner           string                      `json:"owner"`
	Process         devcontract.ProcessIdentity `json:"process"`
	LastObservation time.Time                   `json:"lastObservation,omitempty"`
	NextAttempt     time.Time                   `json:"nextAttempt,omitempty"`
	ActiveOperation string                      `json:"activeOperation,omitempty"`
	PendingCohort   string                      `json:"pendingCohort,omitempty"`
	Result          string                      `json:"result"`
	BlockedReason   string                      `json:"blockedReason,omitempty"`
	NextCommand     string                      `json:"nextCommand,omitempty"`
	NextArgv        []string                    `json:"nextArgv,omitempty"`
	Plan            *UpdatePlan                 `json:"plan,omitempty"`
	Error           string                      `json:"error,omitempty"`
}

type GeneratedTree

type GeneratedTree struct {
	Directory   string
	Destination string
	// contains filtered or unexported fields
}

GeneratedTree is an unforgeable in-process preparation capability. Producers write ONLY Directory, a newly created private staging tree, never Destination. Record publishes that tree only if the old destination remains unchanged.

func PrepareGeneratedTree

func PrepareGeneratedTree(w Workspace, relative, generation string) (*GeneratedTree, error)

PrepareGeneratedTree never adopts an existing unrecorded output. A private staging directory prevents concurrent editor changes to final output being mistaken for bytes authored by an external compiler/task.

type GuardFile

type GuardFile struct {
	Role string
	File *os.File
}

GuardFile borrows a retained Darwin BSD-flock open file description. Roles are exactly uuid, selected-state, and distinct default-state. Callback callers may pass duplicates via Cmd.ExtraFiles, but MUST NOT close/unlock the parent file. The native child closes its inherited copies WITHOUT explicitly unlocking. Other platforms retain ordinary guards and supply no native FD capabilities.

type HostBuildRequest

type HostBuildRequest struct {
	Workspace Workspace
	// SDK is the verified identity of the SDK the host is built against.
	SDK devsdk.Identity
}

type InitOptions

type InitOptions struct {
	Root string
	// Sources replaces automatic discovery. Explicit mappings resolve duplicate
	// historical clones; no origin URLs or credentials are written to the registry.
	Sources []SourceSpec
}

type LaunchOptions

type LaunchOptions struct {
	Mode         string `json:"mode"`
	MCP          bool   `json:"mcp"`
	Watch        bool   `json:"watch"`
	LiveFrontend bool   `json:"liveFrontend"`
	// PluginRuntime selects how selected plugins reach the host: managed
	// source links (default) or installed static archives built from the
	// same selected sources. Empty means managed.
	PluginRuntime   string               `json:"pluginRuntime,omitempty"`
	LinkEvidence    LinkProtocolEvidence `json:"linkEvidence"`
	BaselineSource  string               `json:"baselineSource,omitempty"`
	BaselineVersion string               `json:"baselineVersion,omitempty"`
	Timeout         time.Duration        `json:"timeout"`
}

LaunchOptions is persisted privately so up/restart use the same explicit source trust, tooling and mode. No credentials are copied into this record.

func LoadLaunchOptions

func LoadLaunchOptions(w Workspace) (LaunchOptions, error)

func (LaunchOptions) Validate

func (o LaunchOptions) Validate() error

Validate checks launch selection before creating worktrees or starting tools.

type LaunchPreflight added in v0.9.0

type LaunchPreflight struct {
	Ready            bool                   `json:"ready"`
	Issues           []*devcontract.Error   `json:"issues"`
	OwnershipChecked bool                   `json:"ownershipChecked"`
	Ownership        *devoutputs.Inspection `json:"ownership,omitempty"`
	// SDK reports the plugin SDK selection the manifest decides and each Go
	// consumer's declared requirement. Preflight resolves nothing: every consumer
	// is "unresolved" until a launch verifies its effective SDK.
	SDK *SDKStatus `json:"sdk,omitempty"`
}

LaunchPreflight reports launch inputs without installing dependencies or starting processes. Readiness here does not replace source trust, composition or runtime checks at launch.

func PreflightLaunch added in v0.9.0

func PreflightLaunch(ctx context.Context, w Workspace, o LaunchOptions, policy devsdk.Policy) LaunchPreflight

PreflightLaunch checks all independent launch prerequisites, retaining the normal gates. It reads checked-out module files only: no installs, no network, no writes, no process. In published mode it also reads the Go environment file, so a GOFLAGS refusal shows here. Issue order: evidence, declaration, Go environment, mode, MCP, plugin runtime. policy judges each consumer's declared published SDK version the way a launch would.

type LinkOptions

type LinkOptions struct {
	Evidence LinkProtocolEvidence
}

type LinkProtocolEvidence

type LinkProtocolEvidence struct {
	Protocol   string   `json:"protocol"`
	Versions   []string `json:"versions"`
	AtomicDist bool     `json:"atomicDist"`
	Peers      bool     `json:"peers"`
	Runtime    bool     `json:"runtime"`
}

LinkProtocolEvidence is emitted by TestLinkPinnedProtocolProbe, not inferred from the existence of node_modules symlinks. Keep the gate fail-closed until the pinned-version live-dist and peer probe has actually been run.

type LinkReport

type LinkReport struct {
	WorkspaceID     string                       `json:"workspaceID"`
	Protocol        string                       `json:"protocol"`
	Phase           string                       `json:"phase"`
	Resolutions     []LinkResolution             `json:"resolutions"`
	SeedConvergence []devcompose.LockConvergence `json:"seedConvergence,omitempty"`
}

type LinkResolution

type LinkResolution struct {
	Consumer string `json:"consumer"`
	Package  string `json:"package"`
	Expected string `json:"expected"`
	Resolved string `json:"resolved,omitempty"`
	Version  string `json:"version,omitempty"`
	Problem  string `json:"problem,omitempty"`
}

type ManagedBuildHooks

type ManagedBuildHooks interface {
	SetDependencyWatching(string, string, bool) error
	RebuildPluginGeneration(context.Context, string, string) error
}

ManagedBuildHooks deliberately excludes Start/Stop; A08 owns plugin processes and source watchers. Adapters must resolve the currently active generation.

type Manager

type Manager struct {
	Root string
	// contains filtered or unexported fields
}

func Open

func Open(root string, opts Options) (*Manager, error)

func (*Manager) BuildPluginUI

func (m *Manager) BuildPluginUI(ctx context.Context, name, pluginID string, output io.Writer) (string, error)

BuildPluginUI builds only a real plugin's JavaScript dependency closure in an already-linked workspace. Checked-in Wails bindings are source inputs, as for task packages. This never builds native binaries, launches the app or attests actual IPC. It shares native pnpm, peer audits, shim ordering and repository output ownership with the full workspace graph.

func (*Manager) ConfigureUpstreams added in v0.8.0

func (m *Manager) ConfigureUpstreams(ctx context.Context, name string, values map[string]string) (Workspace, error)

ConfigureUpstreams uses the same owned lifecycle transaction as an edit.

func (*Manager) Create

func (m *Manager) Create(ctx context.Context, opts CreateOptions) (Workspace, error)

func (*Manager) Down

func (m *Manager) Down(ctx context.Context, name string) (Status, error)

func (*Manager) Edit

func (m *Manager) Edit(ctx context.Context, name string, opts EditOptions) (Workspace, error)

func (*Manager) Follow added in v0.8.0

func (m *Manager) Follow(
	ctx context.Context, name string, options FollowOptions, emit func(FollowStatus) error,
) (resultErr error)

Follow owns scheduling only. Update and the existing supervisor own all producers.

func (*Manager) GenerateBindings added in v0.32.0

func (m *Manager) GenerateBindings(ctx context.Context, name string, output io.Writer) (string, error)

GenerateBindings uses the canonical task through the staged graph producer. Collection, worktree, profile and exact stopped-process guards stay held until the command and all its owned descendants terminate or retain an uncertain writer.

func (*Manager) Inspect

func (m *Manager) Inspect(ctx context.Context, name string) (Workspace, error)
func (m *Manager) InspectLinks(ctx context.Context, name string) (LinkReport, error)
func (m *Manager) Link(ctx context.Context, name string, opts LinkOptions) (LinkReport, error)

Link installs one feature composition and independent actual Go replacements. Source package manifests, policies and lockfiles remain standalone inputs.

func (*Manager) LinkEvidence

func (m *Manager) LinkEvidence(ctx context.Context, name string) (LinkProtocolEvidence, error)

LinkEvidence retrieves static native12 protocol proof for stopped unlink/reconfigure/relink. It does not attest current source-input readiness: Installed and graph/install gates independently require fresh source hashes. Workspace identity, completed phase and generated/Go CAS remain mandatory.

func (*Manager) List

func (m *Manager) List(ctx context.Context) ([]Workspace, error)

func (*Manager) NewBuildGraph

func (m *Manager) NewBuildGraph(ctx context.Context, name string, opts BuildOptions) (*BuildGraph, error)

NewBuildGraph accepts an applied, successfully installed link overlay even if dist exports do not exist yet. Bootstrap resolves exports only after building; it never mistakes a failed installer or peer check for a missing-dist issue.

func (*Manager) Paths

func (m *Manager) Paths(ctx context.Context, name string) (WorkspacePaths, error)

func (*Manager) PlanUpdate added in v0.8.0

func (m *Manager) PlanUpdate(ctx context.Context, name string, options UpdateOptions) (UpdatePlan, error)

PlanUpdate fetches selected branches but never changes a checkout, journal or runtime. Mutation authority and captured-state revalidation remain the apply transaction's job.

func (*Manager) PreflightCreateLaunch added in v0.15.0

func (m *Manager) PreflightCreateLaunch(ctx context.Context, create CreateOptions, options LaunchOptions) error

PreflightCreateLaunch rejects missing launch inputs before Create publishes intent, branches, worktrees or a profile. It reads the selected committed module files, never a checkout. Launch verifies materialized source.

func (*Manager) PreflightEdit added in v0.9.2

func (m *Manager) PreflightEdit(ctx context.Context, name string, options EditOptions) error

PreflightEdit validates canonical edit intent without requiring a stopped supervisor or changing workspace state. Edit repeats planning under its lock.

func (*Manager) PrepareRecovery added in v0.32.0

func (m *Manager) PrepareRecovery(ctx context.Context, name string) (Workspace, error)

PrepareRecovery validates the owned lifecycle journal without requiring a completed workspace's supervisor to stop. Journal-only creation retains the original stopped-only materialization resume path.

func (*Manager) ProtocolEvidence added in v0.7.1

func (m *Manager) ProtocolEvidence(ctx context.Context, name string) (LinkProtocolEvidence, error)

ProtocolEvidence reuses acceptance proof, not an attestation of installed dependencies. Link and build gates still check current source inputs.

func (*Manager) ReconcileOutput added in v0.32.0

func (m *Manager) ReconcileOutput(ctx context.Context, name, consumer, producer, preserveAt string) (devoutputs.Reconciliation, error)

ReconcileOutput preserves only the explicitly selected staged producer. It holds the same stopped/profile/worktree guards as other managed writers.

func (*Manager) Reconfigure

func (m *Manager) Reconfigure(ctx context.Context, name string, options EditOptions) (ReconfigureResult, error)

Reconfigure preserves A03's durable intent transaction. Validation failures restore the previous link graph; interrupted Git mutations remain resumable, not falsely advertised as an atomic inverse of user edits.

func (*Manager) Recover added in v0.8.0

func (m *Manager) Recover(ctx context.Context, name string, options RefreshOptions) (RefreshResult, error)

Recover resumes retained work only. Retrying completed recovery does not create another dependency install or restart a running supervisor.

func (m *Manager) RecoverLinks(ctx context.Context, name string) (LinkReport, error)

RecoverLinks preserves changed bytes before retiring the old graph. Unknown installer bytes are never adopted as a successful installation.

func (*Manager) Refresh added in v0.7.1

func (m *Manager) Refresh(ctx context.Context, name string, options RefreshOptions) (RefreshResult, error)

func (*Manager) Remove

func (m *Manager) Remove(ctx context.Context, name string, opts RemoveOptions) (RemoveResult, error)

func (*Manager) RemoveWorkspace

func (m *Manager) RemoveWorkspace(ctx context.Context, name string, options RemoveOptions, diagnostics io.Writer) (RemoveResult, error)

RemoveWorkspace performs producer-owned teardown before A03's foreign-file preflight, while a stable external operation guard excludes concurrent up. State and branches are retained unless the caller explicitly selects deletion.

func (*Manager) ResetModules added in v0.9.0

func (m *Manager) ResetModules(ctx context.Context, name string) (ResetModulesReport, error)

ResetModules is the explicit recovery for an externally changed dependency tree. In a stopped, linked workspace it deletes every owned modules tree and dependency cache (plus stray node_modules at the selected package roots), then reinstalls them through the recorded composition writer. During an interrupted unlink it only deletes them so the teardown can resume. It never adopts foreign bytes and leaves every other repository output untouched.

func (*Manager) Restart

func (m *Manager) Restart(ctx context.Context, name string) (Status, error)

func (*Manager) Resume

func (m *Manager) Resume(ctx context.Context, name string) (Workspace, error)

func (*Manager) ResumeWorkspace

func (m *Manager) ResumeWorkspace(ctx context.Context, name string) (Workspace, error)

func (*Manager) RevalidateUpdatePlan added in v0.8.0

func (m *Manager) RevalidateUpdatePlan(ctx context.Context, name string, plan UpdatePlan) error

RevalidateUpdatePlan checks captured authority without fetching or resolving a new target. Refresh calls it again under its mutation authority.

func (*Manager) Rollback

func (m *Manager) Rollback(ctx context.Context, name string) error

func (*Manager) RollbackWorkspace

func (m *Manager) RollbackWorkspace(ctx context.Context, name string) error

func (*Manager) ServeSupervisor

func (m *Manager) ServeSupervisor(ctx context.Context, name string, output io.Writer) (resultErr error)

ServeSupervisor is the long-lived hidden CLI entrypoint. It holds real Cmd ownership for every host/frontend lifetime; a later CLI only authenticates it.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, name string, o LaunchOptions, executable string, diagnostics io.Writer) (Status, error)

Start creates a persistent, authenticated supervisor using this exact CLI executable. The short-lived caller never adopts or kills a recorded PID.

func (*Manager) Status

func (m *Manager) Status(ctx context.Context, name string) (Status, error)
func (m *Manager) Unlink(ctx context.Context, name string) (LinkReport, error)

Unlink restores only attested aggregate/Go files and owned outputs. It does not independently reinstall any source root or modify its standalone lockfile.

func (*Manager) Update added in v0.7.1

func (m *Manager) Update(ctx context.Context, name string, options UpdateOptions) (RefreshResult, error)

Update advances only selected tracking refs. Explicit commit pins stay pinned. Edit's existing ownership, clean-worktree and fast-forward checks remain final.

func (*Manager) ValidateLifecycleContext

func (m *Manager) ValidateLifecycleContext(ctx context.Context, name, environmentManifest, stateEnvironment string) (string, error)

ValidateLifecycleContext resolves explicit destructive targets before effects, retaining A03 journal/retirement authority when the manifest was already moved.

func (*Manager) VerifySourceReload added in v0.7.1

func (m *Manager) VerifySourceReload(ctx context.Context, name, modulePath, marker string) (SourceReloadEvidence, error)

VerifySourceReload accepts a caller's unique marker from a deliberate source edit. It authenticates the host and supervisor, then reads the transformed source from their exact owned Vite endpoint. It does not claim browser execution evidence.

type Options

type Options struct {
	Home string
	// Stopped is an additional process/session guard supplied by the orchestrator.
	// The canonical state-root flock is always held independently of this guard.
	Stopped func(context.Context, devcontract.ResolvedWorkspace) error
	// SDKPolicy admits the SDK identities this manager's builds may use. The zero
	// policy admits source identities only. It is a constructor input: nothing
	// reads it from the environment.
	SDKPolicy devsdk.Policy
	// Executable resolves the CLI executable that hosts a new supervisor when
	// Start or Restart receive none. Nil resolves os.Executable. Tests inject a
	// resolver so no launch path can execute the test binary.
	Executable func() (string, error)
}

type ReconfigureResult

type ReconfigureResult struct {
	Workspace
	Links             *LinkReport `json:"links,omitempty"`
	RequiresBootstrap bool        `json:"requiresBootstrap"`
}

type RefreshOptions added in v0.7.1

type RefreshOptions struct {
	Executable  string
	Diagnostics io.Writer
	Evidence    LinkProtocolEvidence
	Launch      *LaunchOptions
	Restart     bool
	// contains filtered or unexported fields
}

type RefreshResult added in v0.7.1

type RefreshResult struct {
	WorkspaceID     string      `json:"workspaceID"`
	Phase           string      `json:"phase"`
	BackupDirectory string      `json:"backupDirectory"`
	Status          Status      `json:"status"`
	Plan            *UpdatePlan `json:"plan,omitempty"`
}

type Registry

type Registry struct {
	SchemaVersion int      `json:"schemaVersion"`
	Repositories  []Source `json:"repositories"`
}

func AddRepository added in v0.7.1

func AddRepository(ctx context.Context, root string, spec SourceSpec) (Registry, error)

AddRepository appends one mapping without rediscovering or replacing sources.

func Init

func Init(ctx context.Context, opts InitOptions) (Registry, error)

func LoadRegistry

func LoadRegistry(ctx context.Context, root string) (Registry, error)

func RemoveRepository added in v0.7.1

func RemoveRepository(ctx context.Context, root, id string) (Registry, error)

RemoveRepository unregisters an unused source. It never removes a checkout, branch, profile, or workspace. Retained resources still count as references.

type RemoveOptions

type RemoveOptions struct {
	PurgeState     bool
	DeleteBranches bool
	// ValidateGenerated must validate every non-lifecycle .local resource and
	// nested generated tree against its external ownership ledger, without mutation.
	ValidateGenerated func(context.Context, Workspace) error
	// BeforeRemove runs after every refusal preflight, while UUID/state guards
	// remain held, and before journal/Git/profile mutation. It may complete native
	// cleanup then remove only proven generated resources. Errors retain sources.
	BeforeRemove func(context.Context, Workspace, []GuardFile) error
}

type RemoveResult

type RemoveResult struct {
	WorkspaceID      string `json:"workspaceID"`
	StateRoot        string `json:"stateRoot"`
	StateRetained    bool   `json:"stateRetained"`
	BranchesRetained bool   `json:"branchesRetained"`
}

type RepositoryUpdatePlan added in v0.8.0

type RepositoryUpdatePlan struct {
	ID                   string                        `json:"id"`
	SelectionKind        string                        `json:"selectionKind"`
	Remote               string                        `json:"remote,omitempty"`
	Branch               string                        `json:"branch,omitempty"`
	OldSHA               string                        `json:"oldSHA"`
	TargetSHA            string                        `json:"targetSHA,omitempty"`
	ActualHEAD           string                        `json:"actualHEAD,omitempty"`
	Classification       string                        `json:"classification"`
	TreesEqual           bool                          `json:"treesEqual"`
	BlockerPaths         []string                      `json:"blockerPaths,omitempty"`
	BlockedReason        string                        `json:"blockedReason,omitempty"`
	ConfigurationChoices []UpstreamConfigurationChoice `json:"configurationChoices,omitempty"`
}

type ResetModulesReport added in v0.9.0

type ResetModulesReport struct {
	WorkspaceID string   `json:"workspaceID"`
	Phase       string   `json:"phase"`
	Removed     []string `json:"removed"`
	Reinstalled bool     `json:"reinstalled"`
}

ResetModulesReport lists the deleted dependency trees. Phase is the link phase the reset ran in: "linked" reinstalls through the recorded composition writer; "unlinking" only deletes, leaving the interrupted unlink/remove to be rerun.

type RuntimeHealth added in v0.7.1

type RuntimeHealth struct {
	Liveness     string `json:"liveness"`
	Build        string `json:"build"`
	Dependencies string `json:"dependencies"`
	// ServedSource remains unknown without an artifact-to-source attestation.
	ServedSource       string `json:"servedSource"`
	CheckoutSinceReady string `json:"checkoutSinceReady"`
	Readiness          string `json:"readiness"`
	HMR                string `json:"hmr"`
	SourceReload       string `json:"sourceReload"`
}

RuntimeHealth keeps independent observations independent. Unknown never means ready.

type SDKConsumer added in v0.32.0

type SDKConsumer struct {
	RepositoryID string `json:"repositoryID"`
	// RequiredVersion is the version the consumer's go.mod requires.
	RequiredVersion string `json:"requiredVersion,omitempty"`
	// ResolvedVersion is the effective MVS-selected version, present only for a
	// consumer labelled verified: an identity that passed a build's before/after
	// comparison (or the one uncontradicted observation of a verification with
	// no build around it). ModuleSum and GoModSum are its module and go.mod
	// checksums, the ones the controller's reviewed release table holds. All
	// three are cleared when the label is withdrawn. They never claim that the
	// SDK's behavior was reviewed, that the executable's bytes were compiled from
	// the hashed bytes, or that the toolchain or environment is trustworthy; see
	// SDKVerified.
	ResolvedVersion string `json:"resolvedVersion,omitempty"`
	ModuleSum       string `json:"moduleSum,omitempty"`
	GoModSum        string `json:"goModSum,omitempty"`
	// Verification is one of SDKUnresolved, SDKVerified and SDKHistorical.
	Verification string `json:"verification"`
}

SDKConsumer is one Go consumer's published SDK, as far as it is known.

type SDKStatus added in v0.32.0

type SDKStatus struct {
	Mode devsdk.Mode `json:"mode"`
	// RepositoryID is the selected SDK repository in source mode.
	RepositoryID string `json:"repositoryID,omitempty"`
	// Consumers lists the published mode's Go consumers: the host and every
	// selected plugin repository with a Go module.
	Consumers []SDKConsumer `json:"consumers,omitempty"`
}

SDKStatus reports which plugin SDK a workspace builds against. The mode is derived from the manifest's single selection authority: a linked SDK repository means source mode, no link means each Go consumer's published module. It is observation, never authorization.

type ServiceStatus

type ServiceStatus struct {
	URL     string                      `json:"url"`
	HMR     string                      `json:"hmr,omitempty"`
	Process devcontract.ProcessIdentity `json:"process"`
	Ready   bool                        `json:"ready"`
}

type Source

type Source struct {
	ID         string `json:"id"`
	CommonDir  string `json:"commonDir"`
	Worktree   string `json:"worktree,omitempty"`
	DefaultRef string `json:"defaultRef"`
	Directory  string `json:"directory"`
}

type SourceReloadEvidence added in v0.7.1

type SourceReloadEvidence struct {
	WorkspaceID    string                    `json:"workspaceID"`
	Generation     string                    `json:"generation"`
	ModulePath     string                    `json:"modulePath"`
	SourceMarker   string                    `json:"sourceMarker"`
	VerifiedAt     time.Time                 `json:"verifiedAt"`
	Verification   string                    `json:"verification"`
	ResponseDigest string                    `json:"responseDigest"`
	Checkouts      map[string]CheckoutStatus `json:"checkouts"`
}

SourceReloadEvidence records explicit source-marker delivery, not merely HMR connectivity.

type SourceSpec

type SourceSpec struct {
	ID         string `json:"id"`
	Path       string `json:"path"`
	Worktree   string `json:"worktree,omitempty"`
	DefaultRef string `json:"defaultRef,omitempty"`
	Directory  string `json:"directory,omitempty"`
}

type Status

type Status struct {
	Workspace
	Seed       *devbaseline.Result             `json:"seed,omitempty"`
	Generation string                          `json:"generation,omitempty"`
	Phase      string                          `json:"launchPhase"`
	Instance   *devcontract.InstanceDescriptor `json:"instance,omitempty"`
	Builds     map[string]BuildEvent           `json:"builds,omitempty"`
	Services   map[string]ServiceStatus        `json:"services,omitempty"`
	LastError  *devcontract.Error              `json:"lastError,omitempty"`
	Health     RuntimeHealth                   `json:"health"`
	Checkouts  map[string]CheckoutStatus       `json:"checkouts,omitempty"`
	// ArchivePlugins lists the installed archive cohort of an archive plugin
	// runtime launch, keyed by plugin ID.
	ArchivePlugins map[string]ArchivePluginStatus `json:"archivePlugins,omitempty"`
	// ReadyCheckouts samples the filesystem after a successful readiness
	// transition. It does not bind compiler inputs or served artifact bytes.
	ReadyCheckouts        map[string]CheckoutStatus `json:"readyCheckouts,omitempty"`
	FailedStage           string                    `json:"failedStage,omitempty"`
	WaitStage             string                    `json:"waitStage,omitempty"`
	RecoveryCommand       string                    `json:"recoveryCommand,omitempty"`
	Follow                *FollowStatus             `json:"follow,omitempty"`
	Update                *UpdatePlan               `json:"update,omitempty"`
	HistoricalError       *devcontract.Error        `json:"historicalError,omitempty"`
	HistoricalFailedStage string                    `json:"historicalFailedStage,omitempty"`

	// PluginRuntime is the live supervisor's plugin runtime, reported only
	// for an archive runtime launch.
	PluginRuntime string `json:"pluginRuntime,omitempty"`

	// SDK reports the plugin SDK mode (derived from the manifest's single
	// selection authority) and, in published mode, each Go consumer's declared
	// requirement and the effective version a launch verified. It is
	// observation, never authorization.
	SDK *SDKStatus `json:"sdk,omitempty"`

	// SourceUpdateSupported is evidence only in an authenticated live response.
	SourceUpdateSupported bool `json:"sourceUpdateSupported,omitempty"`
}

Status separates lifecycle/build progress from an identity-checked live host. A saved status file is diagnostic history, never evidence of current readiness.

type UpdateOptions added in v0.7.1

type UpdateOptions struct {
	RefreshOptions
	Repositories []string
	Check        bool
}

type UpdatePlan added in v0.8.0

type UpdatePlan struct {
	WorkspaceID              string                 `json:"workspaceID"`
	OperationID              string                 `json:"operationID"`
	Result                   string                 `json:"result"`
	Repositories             []RepositoryUpdatePlan `json:"repositories"`
	CompositionFingerprint   string                 `json:"compositionFingerprint"`
	ConfigurationFingerprint string                 `json:"configurationFingerprint"`
	DependencyChanged        bool                   `json:"dependencyChanged"`
	NextCommand              string                 `json:"nextCommand,omitempty"`
	NextArgv                 []string               `json:"nextArgv,omitempty"`
}

type UpstreamConfigurationChoice added in v0.8.0

type UpstreamConfigurationChoice struct {
	Remote      string   `json:"remote"`
	Branch      string   `json:"branch"`
	NextArgv    []string `json:"nextArgv"`
	NextCommand string   `json:"nextCommand"`
}

type WatchChange

type WatchChange struct {
	Paths          []string
	Nodes          []string
	SDKChanged     bool
	RuntimeChanged bool
}

type WatchHooks

type WatchHooks struct {
	Managed ManagedBuildHooks
	// Generations returns the currently owned managed backend generations. It
	// must not return an installation's stale generation after a host restart.
	Generations func(context.Context) (map[string]string, error)
	// WaitPluginReady must call A08 WaitReady for the supplied exact generation;
	// compilation, PID presence and log text alone do not satisfy readiness.
	WaitPluginReady func(context.Context, string, string) error
	// HostRebuildAndWait builds/restarts the intended host through its owned
	// supervisor and waits for actual host readiness. It returns IDs of plugins
	// already rebuilt AND ready by that restart, preventing duplicate rebuilds.
	HostRebuildAndWait func(context.Context, HostBuildRequest) (map[string]bool, error)
	// RefreshConsumers restarts affected Vite/shim consumers when necessary and
	// waits for their actual ready endpoints. CommitFeedback publishes the
	// deliberate browser reload only after this completes successfully.
	RefreshConsumers func(context.Context, WatchChange) error
	// BeginFeedback fences browser feedback before any affected producer runs.
	// CommitFeedback releases only the successfully completed transaction.
	BeginFeedback  func(context.Context, WatchChange) error
	CommitFeedback func(context.Context, WatchChange) error
	Debounce       time.Duration
}

type Workspace

type Workspace struct {
	devcontract.ResolvedWorkspace
	Phase    string            `json:"phase"`
	Metadata map[string]string `json:"metadata"`
}

type WorkspacePaths

type WorkspacePaths struct {
	WorkspaceID  string            `json:"workspaceID"`
	Root         string            `json:"root"`
	ManifestPath string            `json:"manifestPath"`
	LocalRoot    string            `json:"localRoot"`
	StateRoot    string            `json:"stateRoot"`
	RuntimeRoot  string            `json:"runtimeRoot"`
	WebviewRoot  string            `json:"webviewRoot"`
	Repositories map[string]string `json:"repositories"`
	Metadata     map[string]string `json:"metadata"`
}

Jump to

Keyboard shortcuts

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