devworkspace

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 51 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

This section is empty.

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 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 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 BuildEvent

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

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) 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
	// Must be independently supplied by the reviewed SDK barrier, not BaseCommit.
	ExpectedSDKRevision string
	// Required trusted local-source verifier; normally devsource.Verify, or an
	// explicit per-workspace VerifyWithOptions adapter for isolation-core work.
	VerifySDKSource func(context.Context, string, string) (devsource.Identity, error)
	// 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(context.Context) 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"`
}

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
	SDKDirectory        string
	ExpectedSDKRevision string
	SDKSource           devsource.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"`
	ReviewedSDKRevision         string               `json:"reviewedSDKRevision"`
	AllowIsolationSourceChanges bool                 `json:"allowIsolationSourceChanges"`
	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"`
}

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(w Workspace, o LaunchOptions) LaunchPreflight

PreflightLaunch checks all independent launch prerequisites, retaining the normal gates.

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) 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 and divergent SDK ancestry before Create publishes intent, branches, worktrees or a profile. Launch still verifies the actual materialized source, including isolation-boundary bytes.

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) 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) 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
}

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 string `json:"servedSource"`
	Readiness    string `json:"readiness"`
	HMR          string `json:"hmr"`
	SourceReload string `json:"sourceReload"`
}

RuntimeHealth keeps independent observations independent. Unknown never means ready.

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"`
	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
	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"`
	ServedCheckouts map[string]CheckoutStatus       `json:"servedCheckouts,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"`

	// 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"`
}

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"`
}

Jump to

Keyboard shortcuts

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