Help us shape the future of Go! Take the 2026 Go Developer Survey

runtime

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

README

Host runtime composition

This package assembles operator-owned authorization and resource configuration for a workspace host. It prepares provider factories, revision mappings, navigation and hosted-app readers, immutable authored sources, native window authority, and window delivery. It depends on app/executor and the source/provider helpers in app/host; those packages do not depend on this composition package.

The embedding application supplies Options and its linked UI artifact through Options.LinkedMetadata. Framework source constructors and DefaultFrameworkWindows also take that artifact explicitly. Core does not import an application's metadata package. A workspace directory cannot replace linked framework definitions.

Call ConfigureNativeWindows before constructing the executor, use the builder callback returned by ConfigureAuthorization, then call BindNativeWindowRuntime and Registration.Bind with the constructed runtime before serving requests. Registration.MenuReader and Registration.HostedAppReader expose only configured readers to the application's HTTP wiring.

app/host/reporting separately owns reporting discovery, development reloads and window/view enrichment. This package uses its registry enrichment when compiling immutable source snapshots. Managing MCP providers retain resource and datasource authority; host composition does not add business ACL grants.

Tests use a frozen linked chat/schedule artifact under internal/testmetadata, including platform variants and the shared file-browser dependency. The application continues to supply and test its own current linked artifact.

Documentation

Overview

Package runtime composes operator-owned resource providers, authorization, immutable source snapshots and native window delivery for a workspace host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindNativeWindowRuntime

func BindNativeWindowRuntime(options Options, runtime *executor.Runtime) error

BindNativeWindowRuntime binds delivery to the actual constructed runtime.

func ConfigureAuthorization

func ConfigureAuthorization(options Options, workspaceRoot string, workspaceConfig *wscfg.Root, enrich windowloader.WorkspaceWindowEnricher, internal ...*Registration) (func(context.Context, *executor.Builder) error, error)

func DefaultFrameworkWindows

func DefaultFrameworkWindows(metadata *embed.FS) ([]resources.NativeFrameworkWindowBinding, error)

DefaultFrameworkWindows declares only linked window entry points. It supplies the same trusted loader already used by explicit framework registrations.

func NewFrameworkLegacyTargetSupport

func NewFrameworkLegacyTargetSupport(ctx context.Context, metadata *embed.FS, bindings []windowloader.ResourceBinding, targets []types.WindowTarget) (forgeservice.WindowLegacyTargetSupport, error)

NewFrameworkLegacyTargetSupport establishes byte equivalence from the linked framework artifact, only for explicit host declarations. A match applies to that exact URI+content fingerprint, never another historical/default body. No runtime request reads a source directory or substitutes current metadata.

func NewFrameworkWindowBundleSource

func NewFrameworkWindowBundleSource(metadata *embed.FS, bindings []windowloader.ResourceBinding) (identity.ResourceSource, error)

NewFrameworkWindowBundleSource captures every declared linked target as one immutable parent definition. Existing singleton stamps retain their bytes.

func NewFrameworkWindowResourceSource

func NewFrameworkWindowResourceSource(metadata *embed.FS, bindings []windowloader.ResourceBinding) (identity.ResourceSource, error)

NewFrameworkWindowResourceSource exposes declared linked framework metadata for explicit resource imports. It grants no visibility or execution rights.

func ValidateHostAuthorizationConfiguration

func ValidateHostAuthorizationConfiguration(options Options) error

ValidateHostAuthorizationConfiguration validates operator-owned registration without execution services, schema/data writes or starting listeners. JWKS discovery uses the configured identity endpoint; no user token is sent.

Types

type AuthorizationProviderFactory

type AuthorizationProviderFactory = host.ProviderFactory

type AuthorizationProviders

type AuthorizationProviders = host.Providers

AuthorizationProviders and AuthorizationProviderFactory preserve the embedding API.

type HostAuthoredSource

type HostAuthoredSource = host.DirectorySource

Preserve embedding names while sharing one Core source declaration.

type HostNavigationSource

type HostNavigationSource struct {
	URI              string `json:"uri"`
	LocalLayoutPath  string `json:"localLayoutPath,omitempty"`
	ProviderIdentity string `json:"providerIdentity,omitempty"`
	Revision         string `json:"revision,omitempty"`
}

HostNavigationSource is explicit trusted publication/consumption configuration. An external source has an owner and no local path. Local paths publish only through the explicitly configured internal provider; authoring alone is inert.

type HostResourceAccess

type HostResourceAccess struct {
	// ProviderIdentity enables explicit native snapshot/provider construction.
	// It is supplied by the embedding host, never resource request data.
	ProviderIdentity string
	Resolver         func(context.Context, string, identity.ResourceSource) (*identity.ResourceResolver, error)
	Actor            func(context.Context) (identity.VerifiedActor, error)
	Authority        identity.ResourceAuthority
}

ReportResourceProviders supplies storage, never authorization. Source receives the current verified actor so a SQL implementation can bind tenant/account. Each canonical URI must have one configured source, including after imports.

type HostToolfeedSource

type HostToolfeedSource = host.DirectorySource

type NativeWindowExecutionBinding

type NativeWindowExecutionBinding struct {
	URI               string            `json:"uri"`
	DataSource        string            `json:"dataSource"`
	IdentitySelectors []string          `json:"identitySelectors"`
	ParentSelectors   map[string]string `json:"parentSelectors,omitempty"`
}

NativeWindowExecutionBinding is a legacy declaration retained for config decoding. The managing MCP endpoint owns argument and entity authorization.

type NativeWindowHostConfig

type NativeWindowHostConfig struct {
	SchemaVersion     int                            `json:"schemaVersion"`
	ProviderIdentity  string                         `json:"providerIdentity"`
	Identity          oauth.HTTPIdentityConfig       `json:"identity"`
	Windows           []windowloader.ResourceBinding `json:"windows"`
	FrameworkWindows  []windowloader.ResourceBinding `json:"frameworkWindows,omitempty"`
	ToolCapabilities  map[string]string              `json:"toolCapabilities"`
	ExecutionBindings []NativeWindowExecutionBinding `json:"executionBindings"`
	// contains filtered or unexported fields
}

NativeWindowHostConfig binds operator-installed templates without replacing the workspace's explicitly configured MCP permission provider. ToolCapabilities and ExecutionBindings are retained for config compatibility only. Managing MCP owns data authorization; no UI business grant is consulted.

type Options

type Options struct {
	LinkedMetadata                   *embed.FS
	NativeWindowRuntimeBinder        func(*executor.Runtime) error
	InternalResourceProviderIdentity string
	NativeWindowConfigPath           string
	WindowTargetProof                forgetypes.WindowTargetProof
	WindowLegacyTargetSupport        forgeservice.WindowLegacyTargetSupport
	ConfigureBuilder                 func(context.Context, *executor.Builder) error
	AuthorizationProviderFactory     AuthorizationProviderFactory
	ReportResourceProviderFactory    ReportResourceProviderFactory
	ResourceSelectionProviderFactory ResourceSelectionProviderFactory
	AuthzConfigPath                  string
	WorkspacePath                    string
}

Options supplies trusted host configuration and application-owned artifacts. LinkedMetadata is the framework bundle linked by the embedding application.

func ConfigureNativeWindows

func ConfigureNativeWindows(options Options) (Options, error)

type Registration

type Registration struct {
	// contains filtered or unexported fields
}

Registration holds prepared host readers and binds their immutable sources after the executor runtime has been constructed. Its zero value is ready to use.

func (*Registration) Bind

func (r *Registration) Bind(ctx context.Context, rt *executor.Runtime) error

func (*Registration) HostedAppReader

HostedAppReader binds configured hosted applications to the runtime backend.

func (*Registration) MenuReader

MenuReader returns the configured native navigation reader, if any.

type ReportResourceProviderFactory

type ReportResourceProviderFactory func(context.Context, json.RawMessage, string, HostResourceAccess) (ReportResourceProviders, error)

ReportResourceProviderFactory interprets only operator-owned storage settings. Construction must not migrate stores or import definitions. Those are explicit administrative operations, separate from validating/starting an HTTP host.

type ReportResourceProviders

type ReportResourceProviders struct {
	LocalBindings  []resourcesvc.LocalResourceBinding
	WindowSource   func(context.Context, identity.VerifiedActor) (identity.ResourceSource, error)
	BuilderWindows map[string]string
	Writer         primitive.ResourceAuthoringFactory
	Source         func(context.Context, identity.VerifiedActor) (identity.ResourceSource, error)
	Inventories    []catalog.ReportInventory
}

type ResourceSelectionProviderFactory

type ResourceSelectionProviderFactory func(context.Context, json.RawMessage, string, HostResourceAccess) (authz.SelectionStore, error)

ResourceSelectionProviderFactory binds persistent main/exposure revision mappings. It supplies selection only: ACL and requirements remain mandatory.

Directories

Path Synopsis
internal
testmetadata
Package testmetadata holds a frozen framework artifact used to verify host source composition independently of any embedding application's UI bundle.
Package testmetadata holds a frozen framework artifact used to verify host source composition independently of any embedding application's UI bundle.

Jump to

Keyboard shortcuts

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