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

executor

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: 100 Imported by: 2

Documentation

Overview

Package executor provides runtime composition for agently-core.

It assembles model/agent finders, tool registry, conversation and data services, workspace stores, MCP manager, and optional hotswap wiring into a single Runtime via Builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationDecisionScope added in v0.1.57

type AuthorizationDecisionScope interface {
	BeginDecision(context.Context) (context.Context, func() error, error)
	WithoutDecision(context.Context) context.Context
	MetadataReadActive(context.Context) bool
}

StaticAuthorizationRegistration joins trusted service instances with exact host-owned mappings. The identity provider, ACL store and gate evaluator are supplied by the host; no product capability or account is built into Core.

type AuthorizationProvider added in v0.1.57

type AuthorizationProvider struct {
	DatasourceReadFactsScope      resourcesvc.ReadFactsScope
	WindowReadDecisionScope       forgeuisvc.WindowReadDecisionScope
	ExecutionContext              func(context.Context) context.Context
	AuthoritySnapshot             policy.AuthoritySnapshotResolver
	ComponentAuthoritySnapshot    policy.AuthoritySnapshotResolver
	DatasourceResourceRevalidator dssvc.ResourceRevalidator
	DatasourceDefinitionAuthorize dssvc.DefinitionAuthorizer
	DatasourceDefinitionResolver  dssvc.ResourceDefinitionResolver
	Service                       *authz.Service
	Account                       func(context.Context, authz.Facts) (string, error)
	AuthorityRevision             func(context.Context, authz.Facts, string) (string, time.Time, error)
	AccountProjection             permittedview.AccountProjection
	EntityPermission              func(context.Context, authz.Facts, authz.Entity, string) (bool, error)
	EntityPermissionWithLease     func(context.Context, authz.Facts, authz.Entity, string) (bool, time.Time, error)
	EntityRoles                   func(context.Context, authz.Facts, authz.Entity) ([]string, error)
	Gate                          policy.GateCheck
	GateEvaluator                 policy.EvaluatorBridge
	DatasourceAuthorize           func(context.Context, string, map[string]interface{}) error
	ToolAuthorize                 func(context.Context, string, map[string]interface{}) error
	PolicyVersion                 string
	PolicyResource                func(context.Context, string, policy.Candidate) (authz.Resource, string, error)
	WindowAuthorize               func(context.Context, string) (bool, error)
}

AuthorizationProvider is registered by the host, not workspace YAML.

type Builder

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

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context) (*Runtime, error)

func (*Builder) WithAgentDirectoryProvider added in v0.1.57

func (b *Builder) WithAgentDirectoryProvider(provider func() []llmagents.ListItem) *Builder

WithAgentDirectoryProvider supplies host-assembled external/MCP entries in addition to the configured local catalog. Explicit entries retain precedence.

func (*Builder) WithAgentFinder

func (b *Builder) WithAgentFinder(v agentmodel.Finder) *Builder

func (*Builder) WithAgentLoader

func (b *Builder) WithAgentLoader(v agentmodel.Loader) *Builder

func (*Builder) WithAgentService

func (b *Builder) WithAgentService(v *agentsvc.Service) *Builder

func (*Builder) WithAugmenter

func (b *Builder) WithAugmenter(v *augmenter.Service) *Builder

func (*Builder) WithAuthorizationProvider added in v0.1.57

func (b *Builder) WithAuthorizationProvider(ref string, provider AuthorizationProvider) *Builder

func (*Builder) WithCancelRegistry

func (b *Builder) WithCancelRegistry(v cancels.Registry) *Builder

func (*Builder) WithCapabilityMapping added in v0.1.57

func (b *Builder) WithCapabilityMapping(ref string, mapping permittedview.CapabilityMapping) *Builder

func (*Builder) WithCapabilityMappingV2 added in v0.1.57

func (b *Builder) WithCapabilityMappingV2(ref string, mapping permittedview.CapabilityMappingV2) *Builder

func (*Builder) WithComponentDispatcher added in v0.1.57

func (b *Builder) WithComponentDispatcher(dispatcher windowprotocol.ComponentDispatcher) *Builder

WithComponentDispatcher explicitly registers exact producer-supported component transport for both report runs and the public datasource stack.

func (*Builder) WithConversation

func (b *Builder) WithConversation(v conversation.Client) *Builder

func (*Builder) WithCore

func (b *Builder) WithCore(v *core.Service) *Builder

func (*Builder) WithData

func (b *Builder) WithData(v data.Service) *Builder

func (*Builder) WithDefaults

func (b *Builder) WithDefaults(v *config.Defaults) *Builder

func (*Builder) WithElicitationRouter

func (b *Builder) WithElicitationRouter(v elicrouter.ElicitationRouter) *Builder

func (*Builder) WithEmbedderFinder

func (b *Builder) WithEmbedderFinder(v embedder.Finder) *Builder

func (*Builder) WithEmbedderLoader

func (b *Builder) WithEmbedderLoader(v *embedderloader.Service) *Builder

func (*Builder) WithGoalStore added in v0.1.57

func (b *Builder) WithGoalStore(store goalsys.Store) *Builder

WithGoalStore supplies a domain store using the shared Datly 1.0 invoker.

func (*Builder) WithHotSwap

func (b *Builder) WithHotSwap(enabled bool) *Builder

func (*Builder) WithKnowledgeStore

func (b *Builder) WithKnowledgeStore(v workspace.KnowledgeStore) *Builder

func (*Builder) WithLocalPrimitiveProvider added in v0.1.57

func (b *Builder) WithLocalPrimitiveProvider(provider *resourcesvc.LocalProvider) *Builder

WithLocalPrimitiveProvider installs the local authoritative YAML provider. The MCP server exposes it separately from federated registry tools.

func (*Builder) WithMCPAuthRTProvider

func (b *Builder) WithMCPAuthRTProvider(v mcpmgr.AuthRTProvider) *Builder

func (*Builder) WithMCPCookieJarProvider

func (b *Builder) WithMCPCookieJarProvider(v mcpmgr.JarProvider) *Builder

func (*Builder) WithMCPManager

func (b *Builder) WithMCPManager(v *mcpmgr.Manager) *Builder

func (*Builder) WithMCPUserIDExtractor

func (b *Builder) WithMCPUserIDExtractor(v mcpmgr.UserIDExtractor) *Builder

func (*Builder) WithModelFinder

func (b *Builder) WithModelFinder(v llm.Finder) *Builder

func (*Builder) WithModelLoader

func (b *Builder) WithModelLoader(v *modelloader.Service) *Builder

func (*Builder) WithNativeComponentProducers deprecated added in v0.1.57

func (b *Builder) WithNativeComponentProducers(services ...string) *Builder

Deprecated: producer classification does not impose a client component pin on ordinary MCP tools. Keep startup compatibility for previously configured hosts; provider-owned resources select and authorize revisions themselves.

func (*Builder) WithNativeLayoutDefault added in v0.1.57

func (b *Builder) WithNativeLayoutDefault(raw []byte) *Builder

WithNativeLayoutDefault supplies trusted process-owned authored layout bytes. The configured workspace layout retains precedence over this startup fallback.

func (*Builder) WithNativeRuntime added in v0.1.57

func (b *Builder) WithNativeRuntime(server *standalone.Server) *Builder

WithNativeRuntime supplies the one linked Datly runtime shared by migrated application callers. Its connector pools and shutdown belong to the caller.

func (*Builder) WithNativeWindowDefaults added in v0.1.57

func (b *Builder) WithNativeWindowDefaults(entries []resourcesvc.NativeFrameworkWindowBinding) *Builder

WithNativeWindowDefaults declares trusted linked framework source loaders. Workspace window entry points retain the original first-loader precedence.

func (*Builder) WithNewDatasourceDeliveryPreparer added in v0.1.57

func (b *Builder) WithNewDatasourceDeliveryPreparer(preparer dssvc.NewDeliveryPreparer) *Builder

WithNewDatasourceDeliveryPreparer installs trusted server preparation for new datasource interactions. The host verifies original selection and current credentials; normal read/write permission remains with the managing MCP. This callback is optional, never serialized, and never invoked at startup.

func (*Builder) WithPinnedDatasourceDefinitions added in v0.1.57

func (b *Builder) WithPinnedDatasourceDefinitions(revalidate dssvc.ResourceRevalidator, resolve dssvc.ResourceDefinitionResolver, authorize dssvc.DefinitionAuthorizer) *Builder

WithPinnedDatasourceDefinitions installs a host-owned definition boundary. The authorizer must make a fresh execution decision; pins alone grant no data access. This boundary is independent of the selected permission provider.

func (*Builder) WithPresentationPrincipalResolver added in v0.1.57

func (b *Builder) WithPresentationPrincipalResolver(source gating.PrincipalResolver) *Builder

WithPresentationPrincipalResolver binds a trusted startup identity source only to UI facts. It installs no resource/tool/data authorizer, capability mapping, backend preflight, or datasource cache policy. The source owns verification, account binding and lease/cache semantics; browser metadata supplies none.

func (*Builder) WithPrimitiveAuthority added in v0.1.57

func (b *Builder) WithPrimitiveAuthority(actor resourcesvc.ActorResolver, verify resourcesvc.ActorVerifier, localProviderIdentity string) *Builder

WithPrimitiveAuthority registers verified host identity for delegated discovery. Namespace restrictions belong to MCP connections, not here.

func (*Builder) WithPrimitiveGatewayIdentity added in v0.1.57

func (b *Builder) WithPrimitiveGatewayIdentity(identity string) *Builder

WithPrimitiveGatewayIdentity excludes an aggregate/self proxy identity. The distinct local authoritative YAML source may still be a provider.

func (*Builder) WithPrimitiveReportDependencyProof added in v0.1.57

func (b *Builder) WithPrimitiveReportDependencyProof(proof forgetypes.WindowTargetProof) *Builder

WithPrimitiveReportDependencyProof installs the startup proof verifier for canonical report datasource dependencies without enabling delegated windows.

func (*Builder) WithPrimitiveWindows added in v0.1.57

func (b *Builder) WithPrimitiveWindows(proof forgetypes.WindowTargetProof) *Builder

WithPrimitiveWindows enables delegated windows on the existing host open path. Provider namespaces and resources are discovered from MCP connections.

func (*Builder) WithRegistry

func (b *Builder) WithRegistry(v tool.Registry) *Builder

func (*Builder) WithReportResourceService added in v0.1.57

func (b *Builder) WithReportResourceService(service primitive.ResourceAuthoring) *Builder

func (*Builder) WithReportResources added in v0.1.57

func (b *Builder) WithReportResources(provider catalog.Provider, resolve reportingsvc.ResourceResolver) *Builder

WithReportResources connects existing report tools to the shared namespaced catalog and operation-specific revision resolver.

func (*Builder) WithReportingService added in v0.1.14

func (b *Builder) WithReportingService(v *reportingsvc.Service) *Builder

func (*Builder) WithSkipRegistryInitialize added in v0.1.57

func (b *Builder) WithSkipRegistryInitialize(skip bool) *Builder

WithSkipRegistryInitialize lets a host own asynchronous registry warmup. Default builders retain synchronous initialization and the environment override.

func (*Builder) WithStateStore

func (b *Builder) WithStateStore(v workspace.StateStore) *Builder

func (*Builder) WithStore

func (b *Builder) WithStore(v workspace.Store) *Builder

func (*Builder) WithStreamPublisher

func (b *Builder) WithStreamPublisher(v modelcallctx.StreamPublisher) *Builder

func (*Builder) WithStreamingBus

func (b *Builder) WithStreamingBus(v streaming.Bus) *Builder

func (*Builder) WithTokenProvider

func (b *Builder) WithTokenProvider(v token.Provider) *Builder

func (*Builder) WithUIBridge added in v0.1.57

func (b *Builder) WithUIBridge(bridge *forgeuisvc.Service) *Builder

WithUIBridge supplies a host-configured Forge bridge.

type PreparedAuthorization added in v0.1.57

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

func PrepareStaticAuthorization added in v0.1.57

func PrepareStaticAuthorization(registration StaticAuthorizationRegistration) (*PreparedAuthorization, error)

func (*PreparedAuthorization) AuthorizeResolvedWindow added in v0.1.57

func (p *PreparedAuthorization) AuthorizeResolvedWindow(ctx context.Context, pin identity.ResolvedResource, method string, params map[string]any) error

AuthorizeResolvedWindow checks a named UI operation against the exact pinned resource version. The surrounding bridge revalidates content and principal binding both before and after command dispatch.

func (*PreparedAuthorization) Register added in v0.1.57

func (p *PreparedAuthorization) Register(builder *Builder) error

func (*PreparedAuthorization) ResourceActor added in v0.1.57

func (*PreparedAuthorization) ResourceAuthority added in v0.1.57

func (p *PreparedAuthorization) ResourceAuthority() identity.ResourceAuthority

ResourceAuthority checks explicit lifecycle selectors directly. Selection map access must not recursively invoke omitted revision selection.

func (*PreparedAuthorization) ResourceResolver added in v0.1.57

func (p *PreparedAuthorization) ResourceResolver(operation string, source identity.ResourceSource, selection func(context.Context, string) ([]authz.Entity, string, error)) (*identity.ResourceResolver, error)

ResourceResolver shares authz version selection and execution checks between local/remote windows and reporting callers, with a host-owned content source.

func (*PreparedAuthorization) SetResourceRevisionMappings added in v0.1.57

func (p *PreparedAuthorization) SetResourceRevisionMappings(store authz.SelectionStore) error

SetResourceRevisionMappings completes trusted construction before registration. It never reads identity-dependent selection data at startup.

func (*PreparedAuthorization) WindowAuthorizer added in v0.1.57

func (p *PreparedAuthorization) WindowAuthorizer(ctx context.Context, windowID string) (bool, error)

func (*PreparedAuthorization) WithWindowDependencyVerifier added in v0.1.57

WithWindowDependencyVerifier supplies fresh checks for original child pins. Reference-bearing formats fail closed until a trusted host registers it.

func (*PreparedAuthorization) WithWindowResourceResolver added in v0.1.57

func (p *PreparedAuthorization) WithWindowResourceResolver(resolve func(context.Context, string) (*identity.ResourceResolver, identity.ResourceRef, error)) error

WithWindowResourceResolver installs the same canonical admission for Core's UI lifecycle and Forge's definition catalog before registration.

func (*PreparedAuthorization) WithWindowTargetVerifier added in v0.1.57

WithWindowTargetVerifier verifies the exact parent/variant/profile selection independently from ACL admission. It must be registered by the trusted host.

type Runtime

type Runtime struct {
	NativeLayoutSource *resourcesvc.CapturedLayoutSource
	ExecutionContext   func(context.Context) context.Context

	RawResourceBoundary    *workspace.RawResourceBoundary
	ComponentDispatcher    windowprotocol.ComponentDispatcher
	ComponentAuthority     policy.AuthoritySnapshotResolver
	PrimitiveProviders     *resourcesvc.Gateway
	PrimitiveWindows       *resourcesvc.CompositeWindowCatalog
	LocalPrimitiveProvider *resourcesvc.LocalProvider
	NativeHostDocuments    *resourcesvc.HostDocuments

	Defaults *config.Defaults
	// AuthorizationTool is the workspace-configured MCP adapter for permitted
	// Forge views.
	AuthorizationTool              string
	AuthorizationPolicy            *policy.Runtime
	PermittedResolver              permittedview.Resolver
	DatasourceAuthorizer           func(context.Context, string, map[string]interface{}) error
	DatasourceNewDeliveryPreparer  dssvc.NewDeliveryPreparer
	DatasourceResourceRevalidator  dssvc.ResourceRevalidator
	DatasourceReadSequence         func(context.Context) (context.Context, func() error, error)
	DatasourceReadFactsScope       resourcesvc.ReadFactsScope
	DatasourceDefinitionAuthorizer dssvc.DefinitionAuthorizer
	DatasourceDefinitionResolver   dssvc.ResourceDefinitionResolver
	DatasourceProviderExecutor     dssvc.ProviderExecutor
	DatasourceDisableCache         bool
	ToolAuthorizer                 func(context.Context, string, map[string]interface{}) error
	Native                         *standalone.Server
	Conversation                   conversation.Client
	Data                           data.Service
	Registry                       tool.Registry
	Core                           *core.Service
	Augmenter                      *augmenter.Service
	Agent                          *agentsvc.Service
	MCPManager                     *mcpmgr.Manager
	CancelRegistry                 cancels.Registry
	ElicitationRouter              elicrouter.ElicitationRouter
	Elicitation                    *elicsvc.Service
	Streaming                      streaming.Bus
	HotSwap                        *hotswap.Manager
	Skills                         *skillsvc.Service
	SkillWatcher                   *skillsvc.Watcher
	CallbackDispatch               *callbacksvc.Service
	Reporting                      *reportingsvc.Service
	ReportingClient                reportstore.Client // host-owned persistence lookup for dynamic authorization mappings
	ReportRuns                     *reportingrunsvc.Service
	// GoalStore retains the resolved injected or native store for agent/tool sharing.
	GoalStore       goalsys.Store
	ReportingWorker *reportingsvc.Worker
	Store           workspace.Store
	KnowledgeStore  workspace.KnowledgeStore
	StateStore      workspace.StateStore
	// UIBridge is the single Forge UI service shared by browser RPC, agents,
	// and all UI-facing internal tools for this runtime.
	UIBridge *forgeuisvc.Service
	// VerifiedPrincipalResolver is the operator-configured ID-token principal
	// source used by UI presentation. Cohort admission may reuse its verified
	// facts; browser-provided roles and metadata never populate this field.
	VerifiedPrincipalResolver gating.PrincipalResolver

	// AuthConfig holds the auth configuration when auth is enabled.
	AuthConfig *svcauth.Config
	// AuthMiddleware is the HTTP middleware that extracts auth from requests.
	AuthMiddleware func(http.Handler) http.Handler

	// TokenProvider manages auth token lifecycle (cache, refresh, persistence).
	TokenProvider token.Provider
	// contains filtered or unexported fields
}

func (*Runtime) Close added in v0.1.57

func (r *Runtime) Close(ctx context.Context) error

Close releases resources created by this builder.

func (*Runtime) DefaultModel

func (r *Runtime) DefaultModel() string

func (*Runtime) InitializeRegistryAsync added in v0.1.57

func (r *Runtime) InitializeRegistryAsync(ctx context.Context, timeout time.Duration) <-chan struct{}

InitializeRegistryAsync owns one background warmup without closing a borrowed registry. Close cancels and joins this work before shutting down runtime resources.

func (*Runtime) IsReady

func (r *Runtime) IsReady() bool

type StaticAuthorizationRegistration added in v0.1.57

type StaticAuthorizationRegistration struct {
	ExecutionContext         func(context.Context) context.Context
	DecisionScope            AuthorizationDecisionScope
	DatasourceReadFactsScope resourcesvc.ReadFactsScope
	AuthoritySnapshot        policy.AuthoritySnapshotResolver
	// ComponentAuthoritySnapshot must bypass metadata and pure-decision scopes.
	// Execution uses fresh authority while metadata may retain explicit batching.
	ComponentAuthoritySnapshot policy.AuthoritySnapshotResolver
	ResourceRevisionBindings   []policy.ResourceRevisionBinding
	ResourceRevisionMappings   authz.SelectionStore
	ProviderRef                string
	CapabilityMappingRef       string
	PolicyVersion              string
	Service                    *authz.Service
	Account                    func(context.Context, authz.Facts) (string, error)
	AuthorityRevision          func(context.Context, authz.Facts, string) (string, time.Time, error)
	AccountProjection          permittedview.AccountProjection
	GateEvaluator              policy.EvaluatorBridge
	EntityPermission           func(context.Context, authz.Facts, authz.Entity, string) (bool, error)
	EntityPermissionWithLease  func(context.Context, authz.Facts, authz.Entity, string) (bool, time.Time, error)
	EntityRoles                func(context.Context, authz.Facts, authz.Entity) ([]string, error)
	WholeResources             []policy.ResourceBinding
	Capabilities               []permittedview.CapabilityBinding
	BackendResources           []policy.BackendBinding
	BackendMapper              policy.BackendMapper // trusted dynamic lookup for IDs created after startup
	ProtectTools               bool                 // opt in only when every dispatchable tool is mapped
}

Directories

Path Synopsis
Package config defines executor-level defaults and tuning knobs.
Package config defines executor-level defaults and tuning knobs.

Jump to

Keyboard shortcuts

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