extensionsruntime

package
v0.0.0-...-e12325a Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 96 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultComponentCompositionTimeout     = 2 * time.Second
	DefaultComponentCompositionMaxTimeout  = 5 * time.Second
	DefaultComponentCompositionMaxDepth    = 16
	DefaultComponentCompositionMaxSegments = 256
	DefaultComponentCompositionMaxBytes    = 1 << 20
	DefaultComponentCompositionMaxCalls    = 32
	DefaultComponentCompositionTraceLimit  = 256
)
View Source
const (
	ComponentRenderEncodingEscapedText   = "html-escaped-text"
	ComponentRenderEncodingSanitizedHTML = "sanitized-html"
)
View Source
const (
	ExtensionDatabaseLeaseIssuerActor = "actor"
	ExtensionDatabaseLeaseIssuerHost  = "host"

	ExtensionDatabaseLeaseActive   = "active"
	ExtensionDatabaseLeaseDraining = "draining"
	ExtensionDatabaseLeaseRevoked  = "revoked"
	ExtensionDatabaseLeaseFailed   = "failed"
)
View Source
const (
	DefaultExtensionDatabaseRuntimeLeaseReapLimit        = 64
	RecommendedExtensionDatabaseRuntimeLeaseReapInterval = 30 * time.Second
)
View Source
const (
	ProtocolV2ContentProviderSlot   = "sforum.content"
	ProtocolV2ContentRequestSchema  = "sforum.content.call.request@1"
	ProtocolV2ContentResponseSchema = "sforum.content.call.response@1"
)
View Source
const (
	ProtocolV2SEOProviderSlot      = "sforum.seo"
	ProtocolV2SEOProviderOperation = "apply"
	ProtocolV2SEORequestSchema     = "sforum.seo.apply.request@1"
	ProtocolV2SEOResponseSchema    = "sforum.seo.apply.response@1"
)
View Source
const (
	RecommendedProtocolDatabaseLeaseHeartbeatInterval = 30 * time.Second
	RecommendedProtocolDatabaseLeaseOperationTimeout  = 10 * time.Second
)
View Source
const (
	ProtocolV2AIToolProviderSlot      = "sforum.ai.tool"
	ProtocolV2AIToolProviderOperation = "invoke"
	ProtocolV2AIToolRequestSchema     = "sforum.ai.tool.invoke.request@1"
	ProtocolV2AIToolResponseSchema    = "sforum.ai.tool.invoke.response@1"
)

AI 工具调用复用既有的 versioned ProviderCall 传输。

为什么不新增一个 proto 服务:ProviderCall 已经带有精确声明绑定、契约版本、 超时与错误信封,新增 RPC 会把这套边界复制一遍并引入第二处漂移。工具只是 一个 slot 下的 operation,与 SEO 的做法完全一致。

View Source
const (
	DefaultProtocolV2MaxMessageBytes  = pluginv2sdk.DefaultMaxMessageBytes
	DefaultProtocolV2ConcurrentCalls  = pluginv2sdk.DefaultConcurrentCalls
	DefaultProtocolV2RequestTimeout   = pluginv2sdk.DefaultRequestTimeout
	DefaultProtocolV2HandshakeTimeout = pluginv2sdk.DefaultHandshakeTimeout

	ProtocolV2RuntimeTokenMetadataKey = pluginv2sdk.RuntimeTokenMetadataKey
)
View Source
const (
	DefaultMaxConcurrentRPC   = 4
	DefaultFailureThreshold   = 5
	DefaultCircuitOpenSeconds = 30
	DefaultMailTimeoutMS      = 15000
	// 存储 Put/Open 可跨多块 RPC;单次调用默认上限 120s(E6.2)。
	DefaultStorageTimeoutMS = 120000
)

F2.3 默认韧性参数。后续可接 runtime option,当前用稳定宿主默认。

View Source
const (
	RuntimeCallRoute            = extensionruntime.RuntimeCallRoute
	RuntimeCallGuard            = extensionruntime.RuntimeCallGuard
	RuntimeCallPage             = extensionruntime.RuntimeCallPage
	RuntimeCallHook             = extensionruntime.RuntimeCallHook
	RuntimeCallProvider         = extensionruntime.RuntimeCallProvider
	RuntimeCallService          = extensionruntime.RuntimeCallService
	RuntimeCallHost             = extensionruntime.RuntimeCallHost
	RuntimeCallJob              = extensionruntime.RuntimeCallJob
	RuntimeCallSchedule         = extensionruntime.RuntimeCallSchedule
	RuntimeCallCommand          = extensionruntime.RuntimeCallCommand
	RuntimeCallAdminSurface     = extensionruntime.RuntimeCallAdminSurface
	RuntimeCallLifecycleCleanup = extensionruntime.RuntimeCallLifecycleCleanup
)
View Source
const DefaultPluginChunkSize = 1 << 20

DefaultPluginChunkSize 默认分块大小(E6.2 决策:1 MiB)。

View Source
const DefaultProtocolV2RouteStreamTimeout = 24 * time.Hour

DefaultProtocolV2RouteStreamTimeout bounds abandoned long-lived connections while leaving ordinary disconnect and runtime-drain cancellation immediate.

View Source
const DefaultSiteSearchExtensionID = search.DefaultSiteSearchExtensionID

DefaultSiteSearchExtensionID 与 search 包默认站内扩展 id 一致。

View Source
const (
	MailProviderSlot = "mail.provider"
)
View Source
const MaxProtocolV2RouteChunkSize = 1 << 20
View Source
const ProtocolV2IdentityProviderSlot = "sforum.identity"
View Source
const RecommendedPluginRuntimeFullSetDrainTimeout = 30 * time.Second
View Source
const SearchProviderSlot = search.ProviderSlot

SearchProviderSlot 与 search.ProviderSlot 一致。

View Source
const VersionedProviderOperationInvoke = "invoke"

Variables

View Source
var (
	ErrAdminSurfaceNotInvokable = errors.New("admin surface has no typed runtime handler")
	ErrAdminSurfaceRuntimeStale = errors.New("admin surface runtime contract is stale")
)
View Source
var (
	ErrAdminSurfaceRegistryInvalid  = errors.New("admin surface registry declaration is invalid")
	ErrAdminSurfaceRegistryConflict = errors.New("admin surface registry contract conflicts with the active snapshot")
	ErrAdminSurfaceNotFound         = errors.New("admin surface is not found")
)
View Source
var (
	ErrComponentCompositionInvalid      = errors.New("component composition request is invalid")
	ErrComponentCompositionStale        = errors.New("component composition snapshot is stale")
	ErrComponentCompositionUnauthorized = errors.New("component composition artifact is not authorized")
	ErrComponentCompositionTimeout      = errors.New("component composition call timed out")
	ErrComponentCompositionCrash        = errors.New("component composition renderer crashed")
	ErrComponentCompositionCycle        = errors.New("component composition cycle detected")
	ErrComponentCompositionDepth        = errors.New("component composition depth exceeded")
	ErrComponentCompositionOutput       = errors.New("component composition output exceeds Host bounds")
	ErrComponentCompositionMutation     = errors.New("component composition changed a protected field")
	ErrComponentCompositionSEO          = errors.New("component composition removed primary SSR content")
	ErrComponentCompositionBusy         = errors.New("component composition renderer capacity is exhausted")
)
View Source
var (
	ErrComponentRegistryInvalid          = errors.New("component registry declaration is invalid")
	ErrComponentRegistryConflict         = errors.New("component registry contract conflicts with the active snapshot")
	ErrComponentRegistryTargetNotFound   = errors.New("component registry target is not found")
	ErrComponentRegistryProviderNotFound = errors.New("component registry replace provider is not found")
	ErrComponentRegistryRevisionConflict = errors.New("component registry revision conflict")
	ErrComponentRegistrySafeMode         = errors.New("component registry publication is disabled by Safe Mode")
)
View Source
var (
	ErrExtensionDatabaseDispositionInvalid  = errors.New("extension database disposition input is invalid")
	ErrExtensionDatabaseDispositionConflict = errors.New("extension database disposition exact fence conflict")
)
View Source
var (
	ErrExtensionDatabaseMigrationInvalid          = errors.New("extension database migration plan is invalid")
	ErrExtensionDatabaseMigrationArtifactConflict = errors.New("extension database migration exact artifact conflict")
	ErrExtensionDatabaseMigrationPackage          = errors.New("extension database migration package is invalid")
	ErrExtensionDatabaseMigrationChecksumDrift    = errors.New("extension database migration checksum drift")
)
View Source
var (
	ErrExtensionDatabaseMigrationParse  = errors.New("extension database migration parse failed")
	ErrExtensionDatabaseMigrationPolicy = errors.New("extension database migration transaction policy mismatch")
)
View Source
var (
	ErrExtensionDatabaseRegistryInvalid  = errors.New("extension database registry input is invalid")
	ErrExtensionDatabaseArtifactConflict = errors.New("extension database exact artifact conflict")
	ErrExtensionDatabaseGrantNotFound    = errors.New("extension database exact grant not found")
	ErrExtensionDatabaseAuthority        = errors.New("extension database authority is not supported")
	ErrExtensionDatabaseCoreIncompatible = errors.New("extension database authority is incompatible with migrated Core")
	ErrExtensionDatabaseResourceConflict = errors.New("extension database physical resource conflict")
	ErrExtensionDatabaseCredential       = errors.New("extension database credential operation failed")
)
View Source
var (
	ErrExtensionDatabaseRuntimeLeaseNotFound = errors.New("extension database runtime lease not found")
	ErrExtensionDatabaseRuntimeLeaseConflict = errors.New("extension database runtime lease conflict")
)
View Source
var (
	ErrHookRegistryInvalid          = errors.New("extension hook registry declaration is invalid")
	ErrHookRegistryConflict         = errors.New("extension hook registry contract conflicts with the active snapshot")
	ErrHookRegistryDependency       = errors.New("extension hook registry dependency is not declared")
	ErrHookRegistryContractNotFound = errors.New("extension hook registry contract is not found")
)
View Source
var (
	ErrLifecycleBoundaryFenceInvalid  = errors.New("extension lifecycle boundary fence is invalid")
	ErrLifecycleBoundaryFenceConflict = errors.New("extension lifecycle boundary exact fence conflict")
)
View Source
var (
	ErrLifecycleCleanupNotStaged        = errors.New("extension lifecycle cleanup tombstone is not staged")
	ErrLifecycleCleanupNotTerminal      = errors.New("extension lifecycle cleanup operation has not succeeded")
	ErrLifecycleCleanupPurgeUnavailable = errors.New("extension lifecycle cleanup physical purger is unavailable")
	ErrLifecycleCleanupPurgeInvalid     = errors.New("extension lifecycle cleanup purge receipt is invalid")
)
View Source
var (
	ErrLifecycleCleanupInvalid               = errors.New("extension lifecycle cleanup input is invalid")
	ErrLifecycleCleanupConflict              = errors.New("extension lifecycle cleanup exact fence conflict")
	ErrLifecycleCleanupExportEvidenceMissing = errors.New("extension lifecycle cleanup export evidence is missing")
)
View Source
var (
	ErrLifecycleBoundaryInvalid            = errors.New("extension lifecycle composed boundary is invalid")
	ErrLifecycleBoundaryDependencyMissing  = errors.New("extension lifecycle composed boundary dependency is unavailable")
	ErrLifecycleBoundaryCompensationFailed = errors.New("extension lifecycle composed boundary compensation failed")
	ErrLifecycleBoundarySourceResumeUnsafe = errors.New("extension lifecycle source resume is not proven safe")
)
View Source
var (
	ErrLifecycleHostGateInvalid     = errors.New("extension lifecycle Host gate is invalid")
	ErrLifecycleHostBoundaryMissing = errors.New("extension lifecycle Host boundary is unavailable")
	// ErrLifecycleHostRuntimeDiverged means the active process for an extension
	// does not run the artifact the Host records as its active version. The
	// source role must never stage a replacement for that case: the drain and
	// publication fences are keyed to the recorded artifact, so a staged decoy
	// can be drained while the real process stays open, and every later
	// publication fails closed on an unsatisfiable fence.
	ErrLifecycleHostRuntimeDiverged = errors.New("extension lifecycle active runtime diverged from the recorded active artifact")
)
View Source
var (
	ErrLifecycleBoundaryJobsUnavailable = errors.New("extension lifecycle jobs boundary is unavailable")
	ErrLifecycleBoundaryJobsInvalid     = errors.New("extension lifecycle jobs boundary input is invalid")
	ErrLifecycleBoundaryJobsConflict    = errors.New("extension lifecycle jobs publication conflict")
	ErrLifecycleBoundaryJobsUncommitted = errors.New("extension lifecycle jobs publication is not committed")
	ErrLifecycleBoundaryJobsCommitted   = errors.New("extension lifecycle jobs publication is already committed")
)
View Source
var (
	ErrLifecycleMigrationsInvalid       = errors.New("extension lifecycle migration boundary input is invalid")
	ErrLifecycleMigrationsConflict      = errors.New("extension lifecycle migration exact proof conflict")
	ErrLifecycleMigrationProofRequired  = errors.New("extension lifecycle real migration proof is required")
	ErrLifecycleMigrationEngineProofBad = errors.New("extension lifecycle migration engine returned an invalid proof")
)
View Source
var (
	ErrLifecyclePreflightUnavailable = errors.New("extension lifecycle static preflight dependency is unavailable")
	ErrLifecyclePreflightUntrusted   = errors.New("extension lifecycle target artifact is not trusted")
	ErrLifecyclePreflightMigrations  = errors.New("extension lifecycle target migration state is not ready")
)
View Source
var (
	ErrLifecyclePublicationJournalInvalid     = errors.New("extension lifecycle publication journal input is invalid")
	ErrLifecyclePublicationJournalNotPrepared = errors.New("extension lifecycle publication is not prepared")
	ErrLifecyclePublicationJournalConflict    = errors.New("extension lifecycle publication exact fence conflict")
)
View Source
var (
	ErrLifecycleRegistryPublicationInvalid     = errors.New("extension lifecycle registry publication input is invalid")
	ErrLifecycleRegistryPublicationConflict    = errors.New("extension lifecycle registry publication exact fence conflict")
	ErrLifecycleRegistryPublicationNotPrepared = errors.New("extension lifecycle registry publication is not prepared")
	ErrLifecycleRegistryPublicationCommitted   = errors.New("extension lifecycle registry publication marker is committed")
	ErrLifecycleRegistryPublicationUnavailable = errors.New("extension lifecycle registry publication dependency is unavailable")
)
View Source
var (
	ErrIdentityProviderInvocationInvalid = errors.New("identity provider invocation is invalid")
	ErrIdentityProviderUnavailable       = errors.New("identity provider runtime is unavailable")
	ErrIdentityProviderStale             = errors.New("identity provider exact contract is stale")
	ErrIdentityProviderAcceptFailed      = errors.New("identity provider Host acceptance failed")
)
View Source
var (
	ErrPluginCommandRegistryInvalid  = errors.New("plugin command registry declaration is invalid")
	ErrPluginCommandRegistryConflict = errors.New("plugin command registry contract conflicts with the active snapshot")
	ErrPluginCommandNotFound         = errors.New("plugin command is not found")
	ErrPluginCommandSafeMode         = errors.New("plugin command is unavailable in safe mode")
)
View Source
var (
	// ErrPluginRuntimeFullSetInvalid 表示 full-set 适配器入参或 durable publication 不合法。
	ErrPluginRuntimeFullSetInvalid = errors.New("extensions: plugin runtime full set is invalid")
	// ErrPluginRuntimeFullSetConflict 表示 exact artifact / Manager 指针与期望 full set 不一致。
	ErrPluginRuntimeFullSetConflict = errors.New("extensions: plugin runtime full set conflict")
)
View Source
var (
	ErrUnsupportedProtocol    = errors.New("unsupported plugin protocol")
	ErrInvalidPluginJobStream = errors.New("invalid protocol v2 plugin job progress stream")
	// ErrUnsafePluginRouteTarget 插件回报的 BaseURL 不允许被 API 代理(SSRF 防护)。
	ErrUnsafePluginRouteTarget = errors.New("plugin route target is not allowed")
)
View Source
var (
	ErrProtocolInstanceUnsupported = errors.New("protocol runtime instance operation is unsupported")
	ErrProtocolInstancePublished   = errors.New("protocol runtime instance has been published")
	ErrProtocolInstanceUnhealthy   = errors.New("protocol runtime instance is unhealthy")
	ErrProtocolInstanceNotReady    = errors.New("protocol runtime instance is not ready")
)
View Source
var (
	ErrLifecycleV2Unsupported = errors.New("protocol v2 lifecycle is not supported by this runtime")
	ErrInvalidLifecycleRun    = errors.New("invalid protocol v2 lifecycle run")
	ErrInvalidLifecycleStream = errors.New("invalid protocol v2 lifecycle progress stream")
)
View Source
var (
	ErrProtocolV2ActorDelegationInvalid       = errors.New("protocol v2 actor delegation is invalid")
	ErrProtocolV2ActorDelegationUnavailable   = errors.New("protocol v2 actor delegation is unavailable")
	ErrProtocolV2SessionDelegationUnavailable = errors.New("protocol v2 session delegation is unavailable")
)
View Source
var (
	ErrProtocolV2GuardInvalid       = errors.New("protocol v2 guard invocation is invalid")
	ErrProtocolV2GuardDenied        = errors.New("protocol v2 guard denied the request")
	ErrProtocolV2GuardRuntimeFailed = errors.New("protocol v2 guard runtime failed")
)
View Source
var (
	ErrProtocolV2RouteStreamInvalid         = errors.New("protocol v2 route stream is invalid")
	ErrProtocolV2RouteStreamMissingTerminal = errors.New("protocol v2 route stream terminal is missing")
)
View Source
var (
	ErrProtocolV2RouteInvalid         = errors.New("protocol v2 route invocation is invalid")
	ErrProtocolV2RouteResponseInvalid = errors.New("protocol v2 route response is invalid")
	ErrProtocolV2RouteUnsupported     = errors.New("protocol v2 unary route is unsupported")
	ErrProtocolV2RouteStream          = errors.New("protocol v2 route requires the streaming transport")
)
View Source
var (
	ErrProviderSlotInvalid       = errors.New("extension provider slot declaration is invalid")
	ErrProviderSlotConflict      = errors.New("extension provider slot contract conflicts with the active snapshot")
	ErrProviderSlotNotFound      = errors.New("extension provider slot is not found")
	ErrProviderSlotDenied        = errors.New("extension provider slot caller is denied")
	ErrProviderSlotNoProvider    = errors.New("extension provider slot has no available provider")
	ErrProviderSlotInputInvalid  = errors.New("extension provider slot input is invalid")
	ErrProviderSlotOutputInvalid = errors.New("extension provider slot output is invalid")
)
View Source
var (
	ErrProviderSlotSelectionInvalid          = errors.New("extension provider slot selection is invalid")
	ErrProviderSlotSelectionNotFound         = errors.New("extension provider slot selection is not found")
	ErrProviderSlotSelectionRevisionConflict = errors.New("extension provider slot selection revision conflict")
	ErrProviderSlotSelectionStale            = errors.New("extension provider slot selection is stale")
)
View Source
var (
	ErrRuntimeAdmissionInvalid     = extensionruntime.ErrRuntimeAdmissionInvalid
	ErrRuntimeAdmissionDraining    = extensionruntime.ErrRuntimeAdmissionDraining
	ErrRuntimeAdmissionQuarantined = extensionruntime.ErrRuntimeAdmissionQuarantined
	ErrRuntimeAdmissionForced      = extensionruntime.ErrRuntimeAdmissionForced
	ErrRuntimeAdmissionBusy        = extensionruntime.ErrRuntimeAdmissionBusy
)
View Source
var (
	ErrRuntimeInstanceNotFound   = extensionruntime.ErrRuntimeInstanceNotFound
	ErrRuntimeInstanceNotActive  = extensionruntime.ErrRuntimeInstanceNotActive
	ErrRuntimeInstanceActive     = extensionruntime.ErrRuntimeInstanceActive
	ErrRuntimeInstanceBusy       = extensionruntime.ErrRuntimeInstanceBusy
	ErrRuntimeInstanceConflict   = extensionruntime.ErrRuntimeInstanceConflict
	ErrRuntimeInstanceNotDrained = extensionruntime.ErrRuntimeInstanceNotDrained
	ErrRuntimeTrustRevoked       = extensionruntime.ErrRuntimeTrustRevoked
)
View Source
var (
	ErrStorageCircuitOpen = extensionruntime.ErrStorageCircuitOpen
	ErrStorageTimeout     = extensionruntime.ErrStorageTimeout
)

宿主侧可识别的存储 RPC 拒绝(PluginStorageAdapter 映射为 fail-closed)。

View Source
var ErrComponentCompositionPermissionDenied = errors.New("component composition permission denied")
View Source
var (
	ErrExtensionDatabaseIdentifier = extensiondatabase.ErrIdentifier
)
View Source
var ErrExtensionDatabaseMigrationRecoveryRequired = errors.New("extension database migration requires explicit recovery")
View Source
var ErrLifecycleBoundaryStateUnavailable = errors.New("extension lifecycle state repository is unavailable")
View Source
var ErrMailProviderUnavailable = errors.New("mail provider is unavailable")
View Source
var ErrPluginCommandRuntimeStale = errors.New("plugin command runtime contract is stale")
View Source
var ErrPluginExecutableUntrusted = errors.New("plugin executable is not the trusted artifact")

ErrPluginExecutableUntrusted 表示 exec 被拒绝:制品与受信结论不一致,或启动 环境落在不该允许的位置。

View Source
var ErrProtocolV2ContentInvalid = errors.New("protocol v2 content invocation is invalid")
View Source
var ErrProtocolV2IdentityProviderInvalid = errors.New("protocol v2 identity provider invocation is invalid")
View Source
var ErrProtocolV2RequestAuthorityInvalid = errors.New("protocol v2 request authority is invalid")
View Source
var ErrRuntimeRouteIncident = errors.New("extension runtime quarantined after route execution incident")
View Source
var ErrSearchProviderUnavailable = errors.New("search provider is unavailable")
View Source
var ErrVersionedRuntimeContractInvalid = errors.New("extension versioned runtime contract is invalid")
View Source
var NewRuntimeAdmissionGate = extensionruntime.NewRuntimeAdmissionGate

Functions

func BoundedProviderDocumentRevalidator

func BoundedProviderDocumentRevalidator(ctx context.Context, schema string, document map[string]any) error

func BuildLifecycleIdentityPublication

func BuildLifecycleIdentityPublication(
	extension extensions.Extension,
	binding extensions.LifecycleRuntimeBinding,
) (*identityregistry.Publication, error)

BuildLifecycleIdentityPublication constructs the exact lifecycle Identity Registry publication used by enable/restore paths. Integration tests call this to prove the same Schema/provider metadata path without driving the full coordinator.

func BuildLifecycleQueryPublication

func BuildLifecycleQueryPublication(
	extension extensions.Extension,
	binding extensions.LifecycleRuntimeBinding,
) (*queryregistry.Publication, error)

BuildLifecycleQueryPublication constructs the exact lifecycle Query Registry publication used by enable/restore paths. Integration tests call this to prove the same Schema/filter metadata path without driving the full coordinator.

func ExtensionDatabaseMigrationRoleFor

func ExtensionDatabaseMigrationRoleFor(extensionID string, planDigest string) (string, error)

func ExtensionDatabaseRuntimeLeaseRoleFor

func ExtensionDatabaseRuntimeLeaseRoleFor(extensionID string, runtimeInstanceID string, leaseID string) (string, error)

func IsSiteSearchProvider

func IsSiteSearchProvider(extensionID string) bool

IsSiteSearchProvider 判断扩展 id 是否为 Host 短路的站内搜索。

func NewCompositeQueryProviderResolver

func NewCompositeQueryProviderResolver(
	core queryregistry.ExecutableProviderResolver,
	manager *Manager,
	registry *queryregistry.Registry,
) (queryregistry.ExecutableProviderResolver, error)

NewCompositeQueryProviderResolver keeps Core HostAPI providers authoritative and resolves third-party executable handlers through Protocol V2 at call time. Composition uses the Query Registry package-private resolve surface via NewFallbackProviderResolver so Extensions never type-asserts unexported methods.

func NewProtocolV2QueryResultFilterSource

func NewProtocolV2QueryResultFilterSource(
	manager *Manager,
	registry *queryregistry.Registry,
) (queryregistry.ResultFilterSource, error)

NewProtocolV2QueryResultFilterSource builds Protocol V2 filter adapters from published ResultFilter declarations. Callables are resolved at execution time against the exact active runtime, not captured at process start.

func NewProtocolV2SEOProviderResolver

func NewProtocolV2SEOProviderResolver(manager *Manager) seoregistry.ProviderResolver

NewProtocolV2SEOProviderResolver maps immutable SEO Registry declarations to the existing Protocol V2 ProviderCall transport. Resolution performs no database work and never captures a startup-only runtime instance.

func NewSEOExecutionAdmission

func NewSEOExecutionAdmission(manager *Manager) seoregistry.ExecutionAdmission

NewSEOExecutionAdmission holds an exact Manager runtime lease across all SEO callbacks and the non-overridable Host final-policy fence.

func RegisterEventDeliveryWorker

func RegisterEventDeliveryWorker(registry *supportjobs.Registry, manager *Manager)

func ServeProtocolV2Plugin

func ServeProtocolV2Plugin(server pluginwire.PluginRuntimeServiceServer, config ProtocolV2ServerConfig)

ServeProtocolV2Plugin is retained for Host integration fixtures. Plugin authors should call pluginv2.Serve directly.

func ValidateLifecycleCleanupPurgeReceipt

func ValidateLifecycleCleanupPurgeReceipt(
	request LifecycleCleanupPurgeRequest,
	receipt LifecycleCleanupPurgeReceipt,
) ([]byte, string, error)

func ValidateProtocolV2InvocationIdempotencyKey

func ValidateProtocolV2InvocationIdempotencyKey(value string) error

ValidateProtocolV2InvocationIdempotencyKey lets HTTP adapters reject a bad key before audit or plugin execution. Empty means the optional header was not supplied and remains valid.

Types

type AIToolRuntimeInvoker

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

AIToolRuntimeInvoker 是 AI 工具派发的聚焦协作者。

为什么单独一类:Manager(72) 与 RuntimeInvoker(28) 的接收者方法数都是不可增长 的架构基线,而 AI 工具派发是独立职责。与 events_publish.go 的 ExtensionEventPublisher 同一手法:新职责进新协作者,不往 God object 上堆。

它自己不做超时、schema 或身份判定——那些都在 protocolV2Client 的冻结声明校验 里;这里只负责从 Manager 拿到当前进程的 Starter 并转发一次。

func NewAIToolRuntimeInvoker

func NewAIToolRuntimeInvoker(manager *Manager) *AIToolRuntimeInvoker

NewAIToolRuntimeInvoker 绑定 Manager 持有的 Starter。 manager 为 nil 时构造出的协作者一律报告不可用,而不是静默成功。

func (*AIToolRuntimeInvoker) InvokeVersionedAITool

func (i *AIToolRuntimeInvoker) InvokeVersionedAITool(
	ctx context.Context,
	extension extensions.Extension,
	input VersionedAIToolRequest,
) (VersionedAIToolResponse, error)

type AdminSurfaceContract

type AdminSurfaceContract struct {
	ID                       string `json:"id"`
	ContractVersion          string `json:"contractVersion"`
	ExtensionID              string `json:"extensionId"`
	ExtensionVersion         string `json:"extensionVersion"`
	ArtifactDigest           string `json:"artifactDigest"`
	InstanceID               string `json:"runtimeInstanceId"`
	Kind                     string `json:"kind"`
	Action                   string `json:"action"`
	TargetID                 string `json:"targetId,omitempty"`
	PlacementID              string `json:"placementId,omitempty"`
	PlacementContractVersion string `json:"placementContractVersion,omitempty"`
	Label                    string `json:"label"`
	Handler                  string `json:"handler,omitempty"`
	PropsSchema              string `json:"propsSchema,omitempty"`
	PropsSchemaDigest        string `json:"propsSchemaDigest,omitempty"`
	ResultSchema             string `json:"resultSchema,omitempty"`
	ResultSchemaDigest       string `json:"resultSchemaDigest,omitempty"`
	Operation                string `json:"operation"`
	// Schema fields preserve the old catalog response until P13 removes the
	// single-document compatibility contract.
	Schema       string `json:"schema,omitempty"`
	SchemaDigest string `json:"schemaDigest,omitempty"`
	Permission   string `json:"permission,omitempty"`
	Priority     int    `json:"priority"`
	// contains filtered or unexported fields
}

type AdminSurfaceInvocation

type AdminSurfaceInvocation struct {
	ExpectedContract AdminSurfaceContract
	ContractVersion  string
	Input            map[string]any
	Actor            *ProtocolV2InvocationActor
	IdempotencyKey   string
}

type AdminSurfaceInvocationResult

type AdminSurfaceInvocationResult struct {
	Contract AdminSurfaceContract
	Output   map[string]any
}

type AdminSurfaceRegistry

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

AdminSurfaceRegistry freezes the complete operator UI contribution catalog to exact runtime instances. Rendering and handler invocation consume only a snapshot, so an upgrade cannot mutate contracts underneath an admin request.

func NewAdminSurfaceRegistry

func NewAdminSurfaceRegistry() *AdminSurfaceRegistry

func (*AdminSurfaceRegistry) RemoveRuntime

func (r *AdminSurfaceRegistry) RemoveRuntime(extensionID, instanceID string) (bool, error)

func (*AdminSurfaceRegistry) ReplaceRuntime

func (r *AdminSurfaceRegistry) ReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*AdminSurfaceRegistry) Resolve

func (*AdminSurfaceRegistry) Snapshot

func (*AdminSurfaceRegistry) ValidateDocument

func (r *AdminSurfaceRegistry) ValidateDocument(contract AdminSurfaceContract, document map[string]any) error

ValidateDocument preserves the pre-split API as a props validation alias.

func (*AdminSurfaceRegistry) ValidateProps

func (r *AdminSurfaceRegistry) ValidateProps(contract AdminSurfaceContract, document map[string]any) error

func (*AdminSurfaceRegistry) ValidateRemoveRuntime

func (r *AdminSurfaceRegistry) ValidateRemoveRuntime(extensionID, instanceID string) error

func (*AdminSurfaceRegistry) ValidateReplaceRuntime

func (r *AdminSurfaceRegistry) ValidateReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*AdminSurfaceRegistry) ValidateResult

func (r *AdminSurfaceRegistry) ValidateResult(contract AdminSurfaceContract, document map[string]any) error

type AdminSurfaceRegistrySnapshot

type AdminSurfaceRegistrySnapshot struct {
	Revision uint64                 `json:"revision"`
	Surfaces []AdminSurfaceContract `json:"surfaces"`
}

type ComponentActorAuthority

type ComponentActorAuthority struct {
	UserID      int64
	SuperAdmin  bool
	Permissions map[string]bool
}

ComponentActorAuthority is the Host-authenticated credential ceiling for one composition. The live authorizer intersects it with current RBAC; reloading a user must never restore permissions removed by a scoped PAT or other caller.

type ComponentCallPolicy

type ComponentCallPolicy struct {
	FailurePolicy string
	Timeout       time.Duration
}

type ComponentCallPolicyResolver

type ComponentCallPolicyResolver func(ComponentContribution) ComponentCallPolicy

type ComponentCompositionContract

type ComponentCompositionContract struct {
	ValidateProps        ComponentDocumentValidator
	ValidateResult       ComponentDocumentValidator
	MutablePropsFields   []string
	MutableResultFields  []string
	RetainPrimaryContent bool
}

type ComponentCompositionExecutor

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

func (*ComponentCompositionExecutor) Compose

func (*ComponentCompositionExecutor) InspectorTraces

type ComponentCompositionExecutorConfig

type ComponentCompositionExecutorConfig struct {
	Registry             *ComponentRegistry
	Renderer             ComponentSSRRenderer
	ResolveTarget        ComponentTargetBindingResolver
	Admission            ComponentRuntimeAdmission
	PermissionAuthorizer ComponentPermissionAuthorizer
	Terminator           ComponentRendererTerminator
	ResolvePolicy        ComponentCallPolicyResolver
	DefaultTimeout       time.Duration
	MaxTimeout           time.Duration
	MaxDepth             int
	MaxSegments          int
	MaxOutputBytes       int
	MaxConcurrentCalls   int
	TraceLimit           int
}

type ComponentCompositionInspector

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

ComponentCompositionInspector projects runtime state into the stable, redacted admin inspection contract.

func NewComponentCompositionInspector

func NewComponentCompositionInspector(registry *ComponentRegistry, composition *ProductionComponentComposition) *ComponentCompositionInspector

func (*ComponentCompositionInspector) Inspect

type ComponentCompositionRequest

type ComponentCompositionRequest struct {
	TargetID              string
	TargetContractVersion string
	ExpectedRevision      uint64
	Actor                 ComponentActorAuthority
	Props                 map[string]any
	Binding               ComponentTargetBinding
}

type ComponentCompositionResult

type ComponentCompositionResult struct {
	Revision uint64                   `json:"revision"`
	Target   ComponentTarget          `json:"target"`
	Props    map[string]any           `json:"props"`
	Result   map[string]any           `json:"result"`
	Segments []ComponentRenderSegment `json:"segments"`
	Hidden   bool                     `json:"hidden"`
	TraceID  string                   `json:"traceId"`
}

type ComponentCompositionTrace

type ComponentCompositionTrace struct {
	ID                    string                          `json:"id"`
	Revision              uint64                          `json:"revision"`
	TargetID              string                          `json:"targetId"`
	TargetContractVersion string                          `json:"targetContractVersion"`
	StartedAt             time.Time                       `json:"startedAt"`
	DurationMicros        int64                           `json:"durationMicros"`
	Status                string                          `json:"status"`
	Error                 string                          `json:"error,omitempty"`
	Steps                 []ComponentCompositionTraceStep `json:"steps"`
}

type ComponentCompositionTraceStep

type ComponentCompositionTraceStep struct {
	Sequence       int          `json:"sequence"`
	TargetID       string       `json:"targetId"`
	ContributionID string       `json:"contributionId,omitempty"`
	Action         string       `json:"action"`
	Artifact       HookArtifact `json:"artifact"`
	Status         string       `json:"status"`
	FailurePolicy  string       `json:"failurePolicy,omitempty"`
	TimeoutMS      int64        `json:"timeoutMs,omitempty"`
	FallbackReason string       `json:"fallbackReason,omitempty"`
	DurationMicros int64        `json:"durationMicros"`
}

type ComponentContribution

type ComponentContribution struct {
	ID                    string       `json:"id"`
	ContractVersion       string       `json:"contractVersion"`
	Action                string       `json:"action"`
	TargetID              string       `json:"targetId,omitempty"`
	TargetContractVersion string       `json:"targetContractVersion,omitempty"`
	Priority              int          `json:"priority"`
	Permission            string       `json:"permission,omitempty"`
	SSRTemplate           string       `json:"ssrTemplate,omitempty"`
	L2Component           string       `json:"l2Component,omitempty"`
	PropsSchema           string       `json:"propsSchema,omitempty"`
	PropsSchemaDigest     string       `json:"propsSchemaDigest,omitempty"`
	ResultSchema          string       `json:"resultSchema,omitempty"`
	ResultSchemaDigest    string       `json:"resultSchemaDigest,omitempty"`
	ThemeOverrideKey      string       `json:"themeOverrideKey,omitempty"`
	Artifact              HookArtifact `json:"artifact"`
	// contains filtered or unexported fields
}

type ComponentDocumentValidator

type ComponentDocumentValidator func(context.Context, map[string]any) error

ComponentDocumentValidator is supplied by the owner of the target contract. Core and plugin business schemas therefore remain authoritative; the composition executor does not infer a wider contract from a contribution.

type ComponentFallbackCall

type ComponentFallbackCall struct {
	TargetID              string         `json:"targetId"`
	TargetContractVersion string         `json:"targetContractVersion"`
	Props                 map[string]any `json:"props"`
	Depth                 int            `json:"depth"`
}

type ComponentFallbackEvidence

type ComponentFallbackEvidence struct {
	ContributionID string `json:"contributionId,omitempty"`
	Action         string `json:"action,omitempty"`
	Reason         string `json:"reason"`
	FailurePolicy  string `json:"failurePolicy,omitempty"`
}

type ComponentPermissionAuthorizer

type ComponentPermissionAuthorizer interface {
	AuthorizeComponent(context.Context, int64, string) (bool, error)
}

type ComponentPermissionAuthorizerFunc

type ComponentPermissionAuthorizerFunc func(context.Context, int64, string) (bool, error)

func (ComponentPermissionAuthorizerFunc) AuthorizeComponent

func (f ComponentPermissionAuthorizerFunc) AuthorizeComponent(
	ctx context.Context,
	actorUserID int64,
	permission string,
) (bool, error)

type ComponentProviderConflict

type ComponentProviderConflict struct {
	TargetID              string                  `json:"targetId"`
	TargetContractVersion string                  `json:"targetContractVersion"`
	Candidates            []ComponentContribution `json:"candidates"`
	Winner                *ComponentContribution  `json:"winner,omitempty"`
	ExplicitSelection     bool                    `json:"explicitSelection"`
}

type ComponentProviderSelection

type ComponentProviderSelection struct {
	TargetID              string       `json:"targetId"`
	TargetContractVersion string       `json:"targetContractVersion"`
	ContributionID        string       `json:"contributionId"`
	Artifact              HookArtifact `json:"artifact"`
	SelectedAtRevision    uint64       `json:"selectedAtRevision"`
}

type ComponentRegistry

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

ComponentRegistry publishes one complete component graph. Writers rebuild off to the side and readers observe either the old or the new exact-runtime snapshot, never a partially removed target or modifier chain.

func NewComponentRegistry

func NewComponentRegistry() *ComponentRegistry

func (*ComponentRegistry) AdmitPublicComponent

func (r *ComponentRegistry) AdmitPublicComponent(
	extension extensions.Extension,
	declaration extensions.ManifestComponent,
) bool

AdmitPublicComponent is the fail-closed bridge used by the public L2 descriptor service. It admits only the exact active artifact and, for a replacement, only the current winner. A hidden target never exposes an L2 descriptor even if its package manifest still contains the declaration.

func (*ComponentRegistry) PublishComponentPackageRuntime

func (r *ComponentRegistry) PublishComponentPackageRuntime(extension extensions.Extension) error

PublishComponentPackageRuntime 注册一个扩展包的公开 L2 组件运行时。 实例 id 由 componentPackageRuntimeInstanceID 按 type+id+version+digest 派生, 因此「启动恢复」(RestoreRuntimes)与「生命周期启用」得到同一注册结果。 无组件声明的包是空操作,便于调用方无条件下发。

func (*ComponentRegistry) PublishThemeTransition

func (r *ComponentRegistry) PublishThemeTransition(
	target,
	source *extensions.Extension,
	publicationRevision int64,
) error

PublishThemeTransition atomically replaces the exact active theme component publication. The durable theme publication revision makes two transitions from the same source deterministic even when they arrive out of order.

func (*ComponentRegistry) RemoveComponentPackageRuntime

func (r *ComponentRegistry) RemoveComponentPackageRuntime(extensionID string) (bool, error)

RemoveComponentPackageRuntime 移除该包的组件运行时注册(禁用/卸载收敛)。 未注册时返回 false,不视为错误。

func (*ComponentRegistry) RemoveRuntime

func (r *ComponentRegistry) RemoveRuntime(extensionID, instanceID string) (bool, error)

func (*ComponentRegistry) ReplaceAll

func (r *ComponentRegistry) ReplaceAll(snapshots []ComponentRuntimeSnapshot) error

ReplaceAll validates and publishes one complete component graph. The graph is built once, so required cross-plugin targets do not depend on input order.

func (*ComponentRegistry) ReplaceRuntime

func (r *ComponentRegistry) ReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*ComponentRegistry) ResetReplaceProvider

func (r *ComponentRegistry) ResetReplaceProvider(request ResetComponentProviderRequest) (bool, error)

func (*ComponentRegistry) ResolvePlan

func (r *ComponentRegistry) ResolvePlan(targetID, contractVersion string) (ComponentResolvePlan, error)

func (*ComponentRegistry) RestoreRuntimes

func (r *ComponentRegistry) RestoreRuntimes(items []extensions.Extension, safeMode bool) error

RestoreRuntimes reconstructs enabled Manifest V3 component packages without requiring an executable backend. Safe Mode atomically removes all extension registrations while retaining the Host-owned Core target catalog.

func (*ComponentRegistry) RollbackThemeTransition

func (r *ComponentRegistry) RollbackThemeTransition(
	target,
	source *extensions.Extension,
	publicationRevision int64,
) error

RollbackThemeTransition restores a process-local transition whose later Page publication failed. It succeeds only while that exact durable revision is still current, so a delayed rollback cannot revoke a newer artifact.

func (*ComponentRegistry) RuntimeSnapshot

func (r *ComponentRegistry) RuntimeSnapshot(extensionID string) (ComponentRuntimeSnapshot, bool)

func (*ComponentRegistry) SelectReplaceProvider

func (r *ComponentRegistry) SelectReplaceProvider(
	request SelectComponentProviderRequest,
) (ComponentProviderSelection, error)

SelectReplaceProvider applies an exact, revision-fenced in-memory selection. The admin/lifecycle owner must separately authorize the actor and durably audit the decision before calling this leaf; the Registry does not invent a second persistence or permission model.

func (*ComponentRegistry) Snapshot

func (*ComponentRegistry) ValidateProps

func (r *ComponentRegistry) ValidateProps(contribution ComponentContribution, document any) error

func (*ComponentRegistry) ValidateRemoveRuntime

func (r *ComponentRegistry) ValidateRemoveRuntime(extensionID, instanceID string) error

func (*ComponentRegistry) ValidateReplaceRuntime

func (r *ComponentRegistry) ValidateReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*ComponentRegistry) ValidateResult

func (r *ComponentRegistry) ValidateResult(contribution ComponentContribution, document any) error

func (*ComponentRegistry) ValidateThemeTransition

func (r *ComponentRegistry) ValidateThemeTransition(target, source *extensions.Extension) error

ValidateThemeTransition builds the exact post-switch component graph without publishing it. Theme activation calls this before its database CAS.

type ComponentRegistrySnapshot

type ComponentRegistrySnapshot struct {
	Revision      uint64                       `json:"revision"`
	SafeMode      bool                         `json:"safeMode"`
	Targets       []ComponentTarget            `json:"targets"`
	Contributions []ComponentContribution      `json:"contributions"`
	Conflicts     []ComponentProviderConflict  `json:"conflicts"`
	Selections    []ComponentProviderSelection `json:"selections"`
}

type ComponentRenderCall

type ComponentRenderCall struct {
	TargetID              string                   `json:"targetId"`
	TargetContractVersion string                   `json:"targetContractVersion"`
	Contribution          ComponentContribution    `json:"contribution"`
	Artifact              HookArtifact             `json:"artifact"`
	Props                 map[string]any           `json:"props"`
	Result                map[string]any           `json:"result"`
	Children              []ComponentRenderSegment `json:"children,omitempty"`
	Depth                 int                      `json:"depth"`
}

type ComponentRenderFragment

type ComponentRenderFragment struct {
	// Text is ordinary text and is escaped by html/template before release.
	Text string `json:"text,omitempty"`
	// ReviewedHTML is still untrusted transport input. The Host sanitizes it
	// with its component HTML policy before it can become a render segment.
	ReviewedHTML   string `json:"reviewedHtml,omitempty"`
	PrimaryContent bool   `json:"primaryContent,omitempty"`
	// contains filtered or unexported fields
}

type ComponentRenderResponse

type ComponentRenderResponse struct {
	Artifact  HookArtifact              `json:"artifact"`
	Document  map[string]any            `json:"document,omitempty"`
	Fragments []ComponentRenderFragment `json:"fragments,omitempty"`
}

ComponentRenderResponse contains only data a renderer may produce. Owner, contract, action, order, and fallback attribution are assigned by the Host.

type ComponentRenderSegment

type ComponentRenderSegment struct {
	OwnerID         string `json:"ownerId"`
	ComponentID     string `json:"componentId"`
	ContractVersion string `json:"contractVersion"`
	Action          string `json:"action"`
	Order           int    `json:"order"`
	Depth           int    `json:"depth"`
	// HTML is safe for an HTML text node/fragment according to Encoding. It is
	// never copied directly from a renderer response.
	HTML           string                      `json:"html"`
	Encoding       string                      `json:"encoding"`
	PrimaryContent bool                        `json:"primaryContent,omitempty"`
	L2Component    string                      `json:"l2Component,omitempty"`
	Artifact       *HookArtifact               `json:"artifact,omitempty"`
	Fallback       []ComponentFallbackEvidence `json:"fallback,omitempty"`
	Children       []ComponentRenderSegment    `json:"children,omitempty"`
}

ComponentRenderSegment is an SSR-first render tree. Children on wrap segments retain nested composition evidence; browser L2 identifiers are descriptive only and are never invoked by this executor.

type ComponentRendererTermination

type ComponentRendererTermination struct {
	Request ComponentRuntimeAdmissionRequest
	Cause   error
}

ComponentRendererTermination is a Host-owned, non-blocking signal to the process adapter. It does not grant permission to release a runtime lease: the lease remains held until RenderComponent really returns.

type ComponentRendererTerminator

type ComponentRendererTerminator interface {
	TerminateComponentCall(ComponentRendererTermination)
}

type ComponentResolvePlan

type ComponentResolvePlan struct {
	Revision          uint64                      `json:"revision"`
	Target            ComponentTarget             `json:"target"`
	Contributions     []ComponentContribution     `json:"contributions"`
	ReplaceCandidates []ComponentContribution     `json:"replaceCandidates,omitempty"`
	ReplaceWinner     *ComponentContribution      `json:"replaceWinner,omitempty"`
	Conflict          *ComponentProviderConflict  `json:"conflict,omitempty"`
	Selection         *ComponentProviderSelection `json:"selection,omitempty"`
}

type ComponentRuntimeAdmission

type ComponentRuntimeAdmission interface {
	AcquireComponentRuntime(context.Context, ComponentRuntimeAdmissionRequest) (ComponentRuntimeAdmissionLease, error)
}

type ComponentRuntimeAdmissionLease

type ComponentRuntimeAdmissionLease interface {
	Context() context.Context
	Validate(context.Context) error
	Release()
}

ComponentRuntimeAdmissionLease is exact-artifact authority for one composition. Release must be idempotent. Validate is the final Host-owned trust fence and must recheck the same artifact/revision represented by the acquisition request.

type ComponentRuntimeAdmissionProduction

type ComponentRuntimeAdmissionProduction struct {
	Manager *Manager
}

ComponentRuntimeAdmissionProduction acquires exact Manager leases for plugin artifacts and returns a no-op lease for Host Core.

func (*ComponentRuntimeAdmissionProduction) AcquireComponentRuntime

type ComponentRuntimeAdmissionRequest

type ComponentRuntimeAdmissionRequest struct {
	Revision              uint64       `json:"revision"`
	TargetID              string       `json:"targetId"`
	TargetContractVersion string       `json:"targetContractVersion"`
	ContributionID        string       `json:"contributionId"`
	Action                string       `json:"action"`
	Artifact              HookArtifact `json:"artifact"`
}

type ComponentRuntimeSnapshot

type ComponentRuntimeSnapshot struct {
	Extension  extensions.Extension `json:"extension"`
	InstanceID string               `json:"instanceId"`
}

ComponentRuntimeSnapshot identifies one exact Host-published package graph. Component publication is declarative and therefore does not borrow a plugin process identity, including for packages that have no backend process.

type ComponentSSRRenderer

type ComponentSSRRenderer interface {
	RenderComponent(context.Context, ComponentRenderCall) (ComponentRenderResponse, error)
}

type ComponentSSRRendererFunc

type ComponentSSRRendererFunc func(context.Context, ComponentRenderCall) (ComponentRenderResponse, error)

func (ComponentSSRRendererFunc) RenderComponent

type ComponentSSRRendererProduction

type ComponentSSRRendererProduction struct {
	PluginRenderer ComponentSSRRenderer
}

ComponentSSRRendererProduction is the Host Core-safe renderer. Core artifacts never leave the Host process; plugins are fail-closed unless PluginRenderer is supplied by a later transport seam.

func (*ComponentSSRRendererProduction) RenderComponent

type ComponentTarget

type ComponentTarget struct {
	ID              string                   `json:"id"`
	ContractVersion string                   `json:"contractVersion"`
	Core            bool                     `json:"core"`
	Kind            componentcatalog.Kind    `json:"kind,omitempty"`
	Owners          []componentcatalog.Owner `json:"owners,omitempty"`
	Route           string                   `json:"route,omitempty"`
	Source          string                   `json:"source,omitempty"`
	Provider        *ComponentContribution   `json:"provider,omitempty"`
}

type ComponentTargetBinding

type ComponentTargetBinding struct {
	Contract ComponentCompositionContract
	Fallback ComponentFallbackRenderer
}

type ComponentTargetBindingResolver

type ComponentTargetBindingResolver func(
	context.Context,
	ComponentTarget,
) (ComponentTargetBinding, error)

type ComposedLifecycleHostBoundary

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

func (*ComposedLifecycleHostBoundary) CanResumeLifecycleHostSources

func (b *ComposedLifecycleHostBoundary) CanResumeLifecycleHostSources(
	ctx context.Context,
	gate extensions.LifecycleCoordinatorGateRequest,
) (bool, error)

func (*ComposedLifecycleHostBoundary) DrainLifecycleHostSources

func (*ComposedLifecycleHostBoundary) ResumeLifecycleHostSources

func (*ComposedLifecycleHostBoundary) RunLifecycleHostBoundary

type ContentRegistryProtocolRuntime

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

ContentRegistryProtocolRuntime is the single production adapter for HostAPI admission and Content Registry provider callbacks. It captures one Manager; callers cannot substitute a different runtime authority per invocation.

func NewContentRegistryProtocolRuntime

func NewContentRegistryProtocolRuntime(manager *Manager) (*ContentRegistryProtocolRuntime, error)

func (*ContentRegistryProtocolRuntime) AcquireContentRegistryRuntime

func (*ContentRegistryProtocolRuntime) ResolveContentProviders

func (r *ContentRegistryProtocolRuntime) ResolveContentProviders(
	contribution contentregistry.Contribution,
) (contentregistry.ProviderSet, error)

type DeliveryStore

type DeliveryStore interface {
	CreateEventDelivery(ctx context.Context, input extensions.EventDeliveryInput) (extensions.ExtensionEventDelivery, error)
	UpdateEventDelivery(ctx context.Context, input extensions.EventDeliveryUpdateInput) error
}

type EventDeliveryArgs

type EventDeliveryArgs struct {
	DeliveryID        int64          `json:"delivery_id" river:"unique"`
	ExtensionID       string         `json:"extension_id"`
	EventName         string         `json:"event_name"`
	EventKind         string         `json:"event_kind"`
	CorrelationID     string         `json:"correlation_id"`
	Payload           map[string]any `json:"payload,omitempty"`
	PatchFields       []string       `json:"patch_fields,omitempty"`
	DeclarationID     string         `json:"declaration_id,omitempty"`
	HookID            string         `json:"hook_id,omitempty"`
	ContractVersion   string         `json:"contract_version,omitempty"`
	RuntimeInstanceID string         `json:"runtime_instance_id,omitempty"`
	PackageDigest     string         `json:"package_digest,omitempty"`
}

func (EventDeliveryArgs) EnqueueOptions

func (EventDeliveryArgs) EnqueueOptions() supportjobs.EnqueueOptions

func (EventDeliveryArgs) Kind

func (EventDeliveryArgs) Kind() string

type EventDeliveryWorker

type EventDeliveryWorker struct {
	river.WorkerDefaults[EventDeliveryArgs]
	Manager *Manager
}

func (*EventDeliveryWorker) Work

type EventDispatcher

type EventDispatcher interface {
	Enqueue(ctx context.Context, args EventDeliveryArgs, opts supportjobs.EnqueueOptions) error
}

type ExactLifecycleCoordinatorHost

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

ExactLifecycleCoordinatorHost dispatches every Host gate in the authoritative lifecycle path. It owns exact process preparation, health, and drain; composed publication/migration/cleanup remains an explicit mandatory boundary.

type ExactLifecycleCoordinatorRuntimeAdapter

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

ExactLifecycleCoordinatorRuntimeAdapter dispatches lifecycle work only to the process identity persisted by the Host gate. It deliberately has no extension-level runner, so a stale binding can never fall back to the active process for the same extension id.

type ExecutableTrustRevocationFence

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

ExecutableTrustRevocationFence serializes the durable revoke with the local runtime full-set. PostgreSQL publication converges other API/worker nodes; this fence closes the exact process on the initiating node before returning.

func NewExecutableTrustRevocationFence

func NewExecutableTrustRevocationFence(
	runtime *Manager,
	policies executableTrustPolicyInvalidator,
) *ExecutableTrustRevocationFence

func (*ExecutableTrustRevocationFence) RevokeExecutableTrust

func (f *ExecutableTrustRevocationFence) RevokeExecutableTrust(
	ctx context.Context,
	extensionID string,
	reason string,
	durable func(context.Context) error,
) error

type ExtensionDatabaseArtifact

type ExtensionDatabaseArtifact struct {
	ExtensionID   string
	Version       string
	VersionID     int64
	PackageDigest string
}

type ExtensionDatabaseCredential

type ExtensionDatabaseCredential struct {
	GrantID            int64
	ExtensionID        string
	ExtensionVersion   string
	PackageDigest      string
	SchemaName         string
	OwnerRoleName      string
	RoleName           string
	DatabaseName       string
	SearchPath         string
	Password           string
	CredentialRevision int64
}

type ExtensionDatabaseDisposition

type ExtensionDatabaseDisposition interface {
	ApplyLifecycleDataDisposition(
		context.Context,
		ExtensionDatabaseDispositionRequest,
	) (ExtensionDatabaseDispositionReceipt, error)
}

ExtensionDatabaseDisposition is the only supported physical database cleanup boundary. Lifecycle purgers must not reproduce its private Registry SQL.

ApplyLifecycleDataDisposition 的 exact-artifact 授予校验只回答「本次要抹除的 artifact 自己还挂着 active grant 吗」,不再替调用方判定「有没有别的 artifact 的 grant 还活着」。调用方必须先完成 exact identity fence(例如 purger 的 lockExactExtension 比对 extensions.active_version_id,以及 disposition 之后 extension 级撤销 + active==0 断言),否则新的调用者可能跳过那道防线。

type ExtensionDatabaseDispositionReceipt

type ExtensionDatabaseDispositionReceipt struct {
	CleanupID            string
	OperationID          int64
	CleanupMode          LifecycleBoundaryCleanupMode
	Artifact             ExtensionDatabaseArtifact
	ExportArtifactID     string
	ExportDigest         string
	ExportEvidenceDigest string
	DataDisposition      string
	CredentialRevoked    bool
	SchemaRetained       bool
	// RolesRemoved means owner, runtime, and migration roles are all absent.
	// Preserve mode keeps the NOLOGIN owner with its retained schema.
	RolesRemoved    bool
	ResourceExisted bool
	ReceiptID       string
	Proof           json.RawMessage
	ProofDigest     string
}

type ExtensionDatabaseDispositionRequest

type ExtensionDatabaseDispositionRequest struct {
	CleanupID        string
	OperationID      int64
	CleanupMode      LifecycleBoundaryCleanupMode
	Artifact         ExtensionDatabaseArtifact
	ExportArtifactID string
	ExportDigest     string
}

type ExtensionDatabaseGrantRequest

type ExtensionDatabaseGrantRequest struct {
	Artifact     ExtensionDatabaseArtifact
	ActorUserID  int64
	AuditEventID int64
}

type ExtensionDatabaseGrantSnapshot

type ExtensionDatabaseGrantSnapshot struct {
	GrantID                  int64
	Artifact                 ExtensionDatabaseArtifact
	DatabaseContractVersion  string
	Authority                string
	SchemaName               string
	OwnerRoleName            string
	RuntimeRoleName          string
	Status                   string
	ActiveCredentialRevision int64
	GrantRevision            int64
}

type ExtensionDatabaseIdentifiers

type ExtensionDatabaseIdentifiers = extensiondatabase.Identifiers

ExtensionDatabaseIdentifiers are Host-owned physical PostgreSQL names. A manifest may describe a logical schema or role, but it cannot select a core or another extension's physical identity.

func ExtensionDatabaseIdentifiersFor

func ExtensionDatabaseIdentifiersFor(extensionID string) (ExtensionDatabaseIdentifiers, error)

type ExtensionDatabaseLeaseAuthority

type ExtensionDatabaseLeaseAuthority struct {
	Kind         string
	ActorUserID  int64
	AuditEventID int64
}

type ExtensionDatabaseRuntimeCredential

type ExtensionDatabaseRuntimeCredential struct {
	LeaseID           string
	GrantID           int64
	Artifact          ExtensionDatabaseArtifact
	RuntimeInstanceID string
	Powers            []string
	SchemaName        string
	OwnerRoleName     string
	RoleName          string
	DatabaseName      string
	SearchPath        string
	ConnectionURL     string
	Password          string
	ExpiresAt         time.Time
	Revision          int64
}

type ExtensionDatabaseRuntimeLeaseIssue

type ExtensionDatabaseRuntimeLeaseIssue struct {
	Artifact          ExtensionDatabaseArtifact
	RuntimeInstanceID string
	Authority         ExtensionDatabaseLeaseAuthority
}

type ExtensionDatabaseRuntimeLeaseRef

type ExtensionDatabaseRuntimeLeaseRef struct {
	Artifact          ExtensionDatabaseArtifact
	RuntimeInstanceID string
	LeaseID           string
}

type ExtensionDatabaseRuntimeLeaseSnapshot

type ExtensionDatabaseRuntimeLeaseSnapshot struct {
	ID                int64
	LeaseID           string
	GrantID           int64
	Artifact          ExtensionDatabaseArtifact
	RuntimeInstanceID string
	RoleName          string
	Status            string
	IssuerKind        string
	IssuedByUserID    int64
	IssueAuditEventID int64
	IssuedAt          time.Time
	LastHeartbeatAt   time.Time
	ExpiresAt         time.Time
	DrainingAt        *time.Time
	RevokedAt         *time.Time
	FailureCode       string
	Revision          int64
}

type ExtensionEventPublisher

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

ExtensionEventPublisher 是 Manager 对外暴露的事件发布协作者。

它从 manager.go 拆出来是为了守住两条架构基线:Manager 的接收者方法数与 RuntimeEventsProviders 的方法数都是不可增长的 ratchet。事件发布是独立职责, 放在这里比继续往 Manager 上堆方法更合适。

func NewExtensionEventPublisher

func NewExtensionEventPublisher(manager *Manager) *ExtensionEventPublisher

NewExtensionEventPublisher 绑定 Manager 拥有的事件 providers。 providers 为 nil 时发布一律报告不可用,而不是静默成功。

刻意给 Manager 加一个包内取值器而不是新增导出方法:Manager 与 RuntimeEventsProviders 的接收者方法数都是不可增长的架构基线。

func (*ExtensionEventPublisher) EmitFromExtension

func (p *ExtensionEventPublisher) EmitFromExtension(
	ctx context.Context,
	extensionID string,
	envelope appevents.Envelope,
) appevents.Result

EmitFromExtension 以调用方身份发布事件。extensionID 非空时,不在 Core 目录中、 但落在该扩展命名空间下的事件名同样被接受 —— 与 Manifest V3 的声明侧规则 (knownOrNamespacedContract)保持一致,否则会出现「能声明、不能发布」的规则分裂。

type HookArtifact

type HookArtifact struct {
	ExtensionID       string `json:"extensionId"`
	ExtensionVersion  string `json:"extensionVersion"`
	PackageDigest     string `json:"packageDigest"`
	RuntimeInstanceID string `json:"runtimeInstanceId"`
}

type HookBus

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

func NewHookBus

func NewHookBus(config HookBusConfig) *HookBus

func (*HookBus) AdminSurfaces

func (b *HookBus) AdminSurfaces() *AdminSurfaceRegistry

func (*HookBus) Commands

func (b *HookBus) Commands() *PluginCommandRegistry

func (*HookBus) Emit

func (b *HookBus) Emit(ctx context.Context, input HookInput) []HookResult

func (*HookBus) Listeners

func (b *HookBus) Listeners(name string) []extensions.Extension

func (*HookBus) ProviderSlots

func (b *HookBus) ProviderSlots() *VersionedProviderSlotRegistry

func (*HookBus) Register

func (b *HookBus) Register(extension extensions.Extension)

func (*HookBus) RegisterRuntime

func (b *HookBus) RegisterRuntime(extension extensions.Extension, instanceID string) error

RegisterRuntime atomically replaces one extension's hook declarations with the declarations owned by an exact process. Manager admission remains the execution gate, so registering a drained target does not open ordinary calls.

func (*HookBus) RuntimeRegistryGeneration

func (b *HookBus) RuntimeRegistryGeneration() RuntimeRegistryGenerationSnapshot

RuntimeRegistryGeneration returns one coherent cross-family observation. Every production HookBus writer owns b.mu for its whole multi-registry transaction, so this method never exposes an in-progress family swap.

func (*HookBus) RuntimeSnapshot

func (b *HookBus) RuntimeSnapshot(extensionID string) (HookRuntimeSnapshot, bool)

func (*HookBus) Unregister

func (b *HookBus) Unregister(extensionID string)

func (*HookBus) UnregisterRuntime

func (b *HookBus) UnregisterRuntime(extensionID, instanceID string) bool

UnregisterRuntime removes declarations only while they still belong to the stopping process. A retained source can therefore never clear its published replacement.

func (*HookBus) VersionedRegistry

func (b *HookBus) VersionedRegistry() *VersionedHookRegistry

type HookBusConfig

type HookBusConfig struct {
	Invoker HookInvoker
}

type HookDocumentRevalidator

type HookDocumentRevalidator func(context.Context, string, map[string]any) error

type HookInput

type HookInput struct {
	DeclarationID   string
	Name            string
	Kind            string
	ContractVersion string
	InputSchema     string
	ResultSchema    string
	FailurePolicy   string
	DeliveryID      int64
	CorrelationID   string
	Timeout         time.Duration
	Payload         map[string]any
	PatchFields     []string
}

type HookInvoker

type HookInvoker interface {
	InvokeHook(ctx context.Context, extension extensions.Extension, input HookInput) HookResult
}

type HookInvokerFunc

type HookInvokerFunc func(context.Context, extensions.Extension, HookInput) HookResult

func (HookInvokerFunc) InvokeHook

func (fn HookInvokerFunc) InvokeHook(ctx context.Context, extension extensions.Extension, input HookInput) HookResult

type HookResult

type HookResult struct {
	OK      bool
	Reason  string
	Message string
	Patch   map[string]any
	Result  map[string]any
}

type HookRuntimeSnapshot

type HookRuntimeSnapshot struct {
	Extension  extensions.Extension
	InstanceID string
}

HookRuntimeSnapshot binds the visible hook declarations to one exact runtime. InstanceID is empty only for the legacy compatibility path.

type HostAPIRegistrar

type HostAPIRegistrar interface {
	RegisterExtension(extensionID string) (token string, env []string, err error)
	UnregisterExtension(extensionID string)
}

HostAPIRegistrar 在插件启动时签发 Host API 凭证(F2.2)。

type IdentityProviderAccept

IdentityProviderAccept applies the Host-owned effect and audit while the exact runtime admission lease is still held. The callback must keep its own transaction rollback-capable when the fence rejects, honor ctx, and wait for every fence/effect operation before returning.

type IdentityProviderCommitFence

type IdentityProviderCommitFence func() error

IdentityProviderCommitFence is a one-shot final admission validation. Accept must call it inside its Host transaction immediately before committing the effect and audit. It does not provide a cross-system CAS: the Host store must keep its own exact-artifact checks and commit rollback-capable. The fence and transaction must remain synchronous and must not escape the Accept callback.

type IdentityProviderInvocation

type IdentityProviderInvocation struct {
	ProviderID  string
	Operation   string
	ActorUserID int64
	Input       map[string]any
}

IdentityProviderInvocation contains only Host-selected workflow input. The executable declaration, timeout, failure policy, and Schema references are always resolved from the immutable Identity Registry publication.

type IdentityProviderInvocationResult

type IdentityProviderInvocationResult struct {
	RegistryRevision uint64
	RegistryDigest   string
	Provider         identityregistry.ProviderContribution
	Operation        identityregistry.ProviderOperation
	Output           map[string]any
}

IdentityProviderInvocationResult is the exact proposal presented to the Host acceptance boundary. A provider response is never authority by itself.

type IdentityProviderRuntime

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

IdentityProviderRuntime binds one Manager to one authoritative Identity Registry. Callers cannot substitute a different Registry per invocation.

func NewIdentityProviderRuntime

func NewIdentityProviderRuntime(
	manager *Manager,
	registry *identityregistry.Registry,
) (*IdentityProviderRuntime, error)

func (*IdentityProviderRuntime) Invoke

Invoke resolves and invokes one currently active Identity provider. It deliberately has no Core or generic-provider fallback. Callers that already hold an immutable Registry claim must use InvokeExact so a same-id artifact replacement is rejected before any subprocess call.

func (*IdentityProviderRuntime) InvokeExact

InvokeExact invokes only the supplied immutable provider claim. The current Registry must still contain that exact artifact and contract before Schema validation, runtime admission, or subprocess transport begins.

type IdentitySessionEvaluateInvoker

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

IdentitySessionEvaluateInvoker adapts IdentityProviderRuntime to the Host session-policy evaluation boundary. It only ever invokes the exact provider claim supplied by ProviderResolution; callers cannot substitute Core or a generic provider slot.

func NewIdentitySessionEvaluateInvoker

func NewIdentitySessionEvaluateInvoker(
	runtime *IdentityProviderRuntime,
) (*IdentitySessionEvaluateInvoker, error)

func (*IdentitySessionEvaluateInvoker) InvokeExact

func (i *IdentitySessionEvaluateInvoker) InvokeExact(
	ctx context.Context,
	provider identityregistry.ProviderContribution,
	operation string,
	actorUserID int64,
	input map[string]any,
	accept func(context.Context, map[string]any, func() error) error,
) error

InvokeExact holds exact runtime admission through Accept and requires the Host accept callback to call the commit fence exactly once.

type InstanceAdmission

type InstanceAdmission struct {
	*Manager
	// contains filtered or unexported fields
}

func (*InstanceAdmission) AcquireActiveRuntimeCall

func (m *InstanceAdmission) AcquireActiveRuntimeCall(ctx context.Context, extensionID string, class RuntimeCallClass) (RuntimeInstanceSnapshot, *RuntimeAdmissionLease, error)

AcquireActiveRuntimeCall 在线性化边界内捕获活动实例并取得普通调用 lease。 返回的 target 与 lease 始终属于同一个 exact instance,调用方必须 Release。

func (*InstanceAdmission) AcquireRuntimeCall

AcquireRuntimeCall 只允许普通调用进入活动实例;cleanup 可显式进入保留的 draining 实例。

func (*InstanceAdmission) ActiveRuntimeInstance

func (m *InstanceAdmission) ActiveRuntimeInstance(extensionID string) (RuntimeInstanceSnapshot, error)

func (*InstanceAdmission) BeginDrain

func (*InstanceAdmission) BeginDrainContext

BeginDrainContext preserves the legacy BeginDrain surface while allowing multi-step transactions to bound runtime-set barrier contention.

func (*InstanceAdmission) DiscardRuntimeInstance

func (m *InstanceAdmission) DiscardRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

DiscardRuntimeInstance destroys only an unpublished inactive candidate.

func (*InstanceAdmission) ForceDrain

func (*InstanceAdmission) HealthRuntimeInstance

HealthRuntimeInstance performs health and readiness against one exact staged/published/retained process and verifies the frozen artifact again.

func (*InstanceAdmission) InspectRuntimeInstance

func (m *InstanceAdmission) InspectRuntimeInstance(identity RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)

func (*InstanceAdmission) NewExactLifecycleCoordinatorRuntimeAdapter

func (m *InstanceAdmission) NewExactLifecycleCoordinatorRuntimeAdapter() (*ExactLifecycleCoordinatorRuntimeAdapter, error)

NewExactLifecycleCoordinatorRuntimeAdapter returns the only production coordinator adapter allowed to use this Manager's private process starter. Bootstrap therefore cannot accidentally pair admission from one Manager with process execution from another ProtocolStarter.

func (*InstanceAdmission) PublishDrainedRuntimeInstance

func (m *InstanceAdmission) PublishDrainedRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)

PublishDrainedRuntimeInstance selects the exact process in ProtocolStarter and Manager while keeping its ordinary admission gate closed. Composed lifecycle publication opens it only after durable state and every registry snapshot have committed.

func (*InstanceAdmission) PublishRuntimeInstance

func (m *InstanceAdmission) PublishRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)

PublishRuntimeInstance switches ProtocolStarter first while the old Manager gate is closed, then publishes the same exact identity to Manager callers. The tiny cross-registry window is fail-closed because service/job admission still resolves the drained old Manager pointer until this method commits.

func (*InstanceAdmission) PublishRuntimeInstanceFrom

PublishRuntimeInstanceFrom atomically proves the exact drained source is still authoritative before a staged replacement can become active.

func (*InstanceAdmission) PublishRuntimeInstanceIfNoActive

func (m *InstanceAdmission) PublishRuntimeInstanceIfNoActive(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
) (RuntimeInstanceSnapshot, error)

PublishRuntimeInstanceIfNoActive restores a retained runtime only while no concurrent replacement owns the active pointer.

func (*InstanceAdmission) QuarantineRuntimeArtifact

func (m *InstanceAdmission) QuarantineRuntimeArtifact(
	exact RuntimeInstanceArtifactIdentity,
	cause error,
) ([]RuntimeAdmissionSnapshot, error)

QuarantineRuntimeArtifact closes every retained process for one exact package. Trust is artifact-scoped, so a staged settings replacement and its source must not be able to reopen each other after revocation.

func (*InstanceAdmission) QuarantineRuntimeInstance

func (m *InstanceAdmission) QuarantineRuntimeInstance(
	exact RuntimeInstanceArtifactIdentity,
	cause error,
) (RuntimeAdmissionSnapshot, error)

QuarantineRuntimeInstance deliberately bypasses runtime-set and lifecycle transition locks. Its only lock order is Manager -> exact gate, so an incident can close admission promptly even while publication is blocked.

func (*InstanceAdmission) RemoveRuntimeInstance

func (m *InstanceAdmission) RemoveRuntimeInstance(identity RuntimeInstanceIdentity) error

RemoveRuntimeInstance 只删除已停用且完全 idle 的精确实例;不会回退到当前活动实例。

func (*InstanceAdmission) ResumeRuntimeInstance

func (m *InstanceAdmission) ResumeRuntimeInstance(identity RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)

ResumeRuntimeInstance 只重开仍为活动指针的 exact instance,候选发布失败时可恢复旧版本。

func (*InstanceAdmission) ResumeRuntimeInstanceContext

func (m *InstanceAdmission) ResumeRuntimeInstanceContext(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)

ResumeRuntimeInstanceContext bounds compensation waits on the Manager-wide transition barrier. It retains the exact-active-only resume fence.

func (*InstanceAdmission) RuntimeInstanceAvailable

func (m *InstanceAdmission) RuntimeInstanceAvailable(identity RuntimeInstanceIdentity) bool

RuntimeInstanceAvailable is the read-side visibility predicate used by in-process registries. It never opens admission: execution must still acquire a lease, but a staged or drained target is hidden before the durable marker.

func (*InstanceAdmission) StageRuntimeInstance

func (m *InstanceAdmission) StageRuntimeInstance(ctx context.Context, extension extensions.Extension) (RuntimeInstanceSnapshot, error)

StageRuntimeInstance starts one inert Protocol V2 process and retains its Manager admission gate without changing the active runtime pointer.

func (*InstanceAdmission) StopRuntimeInstance

func (m *InstanceAdmission) StopRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

StopRuntimeInstance stops one exact V2 process after its gate is drained and idle. Stopping a retained instance cannot clear the active replacement.

func (*InstanceAdmission) WaitDrain

func (m *InstanceAdmission) WaitDrain(ctx context.Context, identity RuntimeInstanceIdentity) error

type InvalidateProviderSlotRequest

type InvalidateProviderSlotRequest struct {
	ExtensionID  string
	ActorUserID  int64
	AuditEventID int64
	ReasonCode   string
}

type JobDispatcherAdapter

type JobDispatcherAdapter struct {
	Dispatcher *supportjobs.Dispatcher
}

func (JobDispatcherAdapter) Enqueue

type LifecycleAction

type LifecycleAction = protocolv2.LifecycleAction

type LifecycleAssetAdmission

type LifecycleAssetAdmission interface {
	ValidatePublishedIdentity(context.Context, extensions.Extension, assetregistry.Artifact) error
}

LifecycleAssetAdmission checks the frozen publication against current trust. The production implementation performs an exact grant lookup without package I/O.

type LifecycleAssetAuthority

type LifecycleAssetAuthority interface {
	OperationImpactDigest(context.Context, int64, extensions.Extension) (string, error)
	RestoreImpactDigest(context.Context, extensions.Extension) (string, error)
}

LifecycleAssetAuthority supplies an impact digest from durable Host state. Implementations must never rebuild trust impact by scanning package bytes.

type LifecycleAssetOperationRepository

type LifecycleAssetOperationRepository interface {
	Operation(context.Context, string, int64) (extensions.LifecycleOperation, error)
	LastSuccessfulLifecycleAuthority(
		context.Context,
		extensions.ExactExtensionVersionInput,
	) (extensions.LifecycleAuthoritySnapshot, error)
}

LifecycleAssetOperationRepository is the durable operation/authority subset needed to reconstruct exact registry material after a process restart.

type LifecycleBoundaryArtifactTrust

type LifecycleBoundaryArtifactTrust interface {
	TrustedArtifact(context.Context, extensions.Extension) (bool, error)
}

type LifecycleBoundaryCleanup

type LifecycleBoundaryCleanup interface {
	StageLifecycleHostCleanup(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryCleanupMode) (LifecycleBoundaryCleanupResult, error)
}

Uninstall cleanup only stages a durable pending purge. The exact extension identity, package bytes, and recovery material must remain until the coordinator has durably committed the terminal operation; a later finalizer owns irreversible deletion.

type LifecycleBoundaryCleanupFinalizer

type LifecycleBoundaryCleanupFinalizer interface {
	FinalizeLifecycleHostCleanup(context.Context, int64) (LifecycleCleanupFinalizationResult, error)
}

LifecycleBoundaryCleanupFinalizer may run only after the operation ledger is durably succeeded. "finalized" means the physical purger returned a valid exact receipt; terminal acknowledgement alone never advances the tombstone.

type LifecycleBoundaryCleanupMode

type LifecycleBoundaryCleanupMode string
const (
	LifecycleBoundaryCleanupDisable       LifecycleBoundaryCleanupMode = "disable"
	LifecycleBoundaryCleanupRetiredSource LifecycleBoundaryCleanupMode = "retired_source"
	LifecycleBoundaryCleanupPreserve      LifecycleBoundaryCleanupMode = "uninstall_preserve"
	LifecycleBoundaryCleanupExport        LifecycleBoundaryCleanupMode = "uninstall_export_then_remove"
	LifecycleBoundaryCleanupComplete      LifecycleBoundaryCleanupMode = "uninstall_complete_removal"
)

type LifecycleBoundaryCleanupPurger

type LifecycleBoundaryCleanupPurger interface {
	PurgeLifecycleHostCleanup(context.Context, LifecycleCleanupPurgeRequest) (LifecycleCleanupPurgeReceipt, error)
}

type LifecycleBoundaryCleanupResult

type LifecycleBoundaryCleanupResult struct {
	DurableTombstone        bool
	TombstoneID             string
	IdentityRetained        bool
	PackageRetained         bool
	RuntimeRecoveryRetained bool
	RetentionMarker         string
	ExportArtifactID        string
	ExportDigest            string
}

type LifecycleBoundaryCommittedJobs

type LifecycleBoundaryCommittedJobs interface {
	ReconcileCommittedLifecycleJobs(
		context.Context,
		LifecycleBoundaryRequest,
		LifecycleBoundaryJobMode,
		LifecycleBoundaryPublicationMode,
	) error
}

LifecycleBoundaryCommittedJobs is intentionally separate from the prepared transaction. River cancel/migrate is irreversible and may run only after the shared publication marker has durably selected the target.

type LifecycleBoundaryExtensionInventory

type LifecycleBoundaryExtensionInventory interface {
	List(context.Context) ([]extensions.Extension, error)
}

type LifecycleBoundaryJobMigrationSource

type LifecycleBoundaryJobMigrationSource interface {
	LifecycleJobMigrations(
		context.Context,
		LifecycleBoundaryRequest,
		LifecycleBoundaryJobMode,
	) ([]supportjobs.PluginJobMigration, map[string]hostapi.PluginJobPayloadMigrator, error)
}

LifecycleBoundaryJobMigrationSource resolves only the already accepted payload migration contract. River row access and replacement remain owned by HostAPI's PluginJobLifecycleCoordinator.

type LifecycleBoundaryJobMode

type LifecycleBoundaryJobMode string
const (
	LifecycleBoundaryJobsInstall   LifecycleBoundaryJobMode = "install"
	LifecycleBoundaryJobsEnable    LifecycleBoundaryJobMode = "enable"
	LifecycleBoundaryJobsDisable   LifecycleBoundaryJobMode = "disable"
	LifecycleBoundaryJobsUpgrade   LifecycleBoundaryJobMode = "upgrade"
	LifecycleBoundaryJobsRollback  LifecycleBoundaryJobMode = "rollback"
	LifecycleBoundaryJobsUninstall LifecycleBoundaryJobMode = "uninstall"
)

type LifecycleBoundaryJobRuntime

type LifecycleBoundaryJobRuntime interface {
	InspectRuntimeInstance(RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)
	BeginDrain(RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)
	WaitDrain(context.Context, RuntimeInstanceIdentity) error
	ResumeRuntimeInstance(RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)
}

LifecycleBoundaryJobRuntime is the Manager surface shared by direct enqueue admission and lifecycle drain. There is deliberately no second job gate.

type LifecycleBoundaryJobs

type LifecycleBoundaryJobs interface {
	// Drain/Resume atomically cover queued-job enqueue admission and schedule
	// trigger admission for the exact source/target artifact. Resume publishes
	// schedules while RuntimeCallJob remains drained, then opens that exact
	// runtime once as the final action.
	DrainLifecycleJobs(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryJobMode, extensions.LifecycleCoordinatorRuntimeRole) error
	ResumeLifecycleJobs(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryJobMode, extensions.LifecycleCoordinatorRuntimeRole) error
	ValidateLifecycleJobs(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryJobMode) error
	PrepareLifecycleJobPublication(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) (LifecycleBoundaryTransaction, error)
	// River cancel/migrate is intentionally outside the reversible prepared
	// transaction and may execute only after the shared marker commits.
	ReconcileCommittedLifecycleJobs(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryJobMode, LifecycleBoundaryPublicationMode) error
}

type LifecycleBoundaryMigrationFacts

type LifecycleBoundaryMigrationFacts interface {
	LifecycleArtifactMigrationReady(context.Context, extensions.Extension) (bool, error)
	CanPrepareLifecycleMigrations(context.Context, LifecycleStaticPreflightRequest) (bool, error)
}

type LifecycleBoundaryMigrationMode

type LifecycleBoundaryMigrationMode string
const (
	LifecycleBoundaryMigrationInstall  LifecycleBoundaryMigrationMode = "install"
	LifecycleBoundaryMigrationUpgrade  LifecycleBoundaryMigrationMode = "upgrade"
	LifecycleBoundaryMigrationRollback LifecycleBoundaryMigrationMode = "rollback"
)

type LifecycleBoundaryMigrations

type LifecycleBoundaryMigrations interface {
	ReconcileLifecycleMigrations(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryMigrationMode) error
	// CanResumeLifecycleSource is a durable proof that migration state is either
	// rolled back or backward-compatible with the frozen source artifact.
	CanResumeLifecycleSource(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryMigrationMode) (bool, error)
}

Migration and cleanup delegates own durable idempotency by OperationID and StepID. A retry must resume or prove the exact step complete; it may not infer success from a different artifact or attempt.

type LifecycleBoundaryPreflight

type LifecycleBoundaryPreflight interface {
	CheckLifecycleBoundary(context.Context, LifecycleBoundaryRequest) error
}

type LifecycleBoundaryPublicationJournal

type LifecycleBoundaryPublicationJournal interface {
	PrepareLifecyclePublication(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) error
	LifecyclePublicationCommitted(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) (bool, error)
	// LifecyclePublicationCommittedForOperation is used by earlier Host gates
	// whose per-step attempt is unrelated to the publication step attempt. It
	// still validates the canonical publication step and both exact artifacts.
	LifecyclePublicationCommittedForOperation(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) (bool, error)
	CommitLifecyclePublication(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) error
}

LifecycleBoundaryPublicationJournal is stored outside the deletable extensions row. Prepare durably fences operation/step/mode and both exact artifacts before publication. Committed is the sole authority deciding whether crash recovery converges backward or forward.

type LifecycleBoundaryPublicationMode

type LifecycleBoundaryPublicationMode string
const (
	LifecycleBoundaryActivate   LifecycleBoundaryPublicationMode = "activate"
	LifecycleBoundaryDeactivate LifecycleBoundaryPublicationMode = "deactivate"
)

type LifecycleBoundaryRegistries

type LifecycleBoundaryRegistries interface {
	ValidateLifecycleRegistries(context.Context, LifecycleBoundaryRequest) error
	PrepareLifecycleRegistryPublication(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) (LifecycleBoundaryTransaction, error)
}

LifecycleBoundaryRegistries is an aggregate transaction over every registry affected by one artifact (routes, pages, services, schedules, and later V3 families). Adapters must not expose a partially published family snapshot.

type LifecycleBoundaryRequest

type LifecycleBoundaryRequest struct {
	OperationID     int64
	Operation       extensions.LifecycleMachineOperation
	Position        int
	StepID          string
	Attempt         int
	SourceExtension *extensions.Extension
	TargetExtension extensions.Extension
	SourceBinding   extensions.LifecycleRuntimeBinding
	TargetBinding   extensions.LifecycleRuntimeBinding
	RemovalMode     string
	Forced          bool
	ActorUserID     int64
	AuditEventID    int64
	// contains filtered or unexported fields
}

LifecycleBoundaryRequest is the allowlisted Host input passed to composed delegates. Trust grants, authority snapshots, opaque coordinator checkpoints, and previous Host results deliberately never cross this boundary.

func (LifecycleBoundaryRequest) ActionNames

func (LifecycleBoundaryRequest) ActionResult

ActionResult returns a fresh copy on every read. Delegates can inspect a durable plugin result but cannot mutate another delegate's view or the coordinator-owned ledger copy.

type LifecycleBoundaryState

type LifecycleBoundaryState interface {
	PrepareLifecycleStatePublication(context.Context, LifecycleBoundaryRequest, LifecycleBoundaryPublicationMode) (LifecycleBoundaryTransaction, error)
}

LifecycleBoundaryState prepares the exact durable extension-version/status CAS. It must restore only the captured source state and reject stale writers.

type LifecycleBoundaryStaticPreflight

type LifecycleBoundaryStaticPreflight interface {
	CheckLifecycleStaticPreflight(context.Context, LifecycleStaticPreflightRequest) error
}

type LifecycleBoundaryTransaction

type LifecycleBoundaryTransaction interface {
	Inspect(context.Context) (LifecycleBoundaryTransactionState, error)
	Publish(context.Context) error
	Restore(context.Context) error
}

LifecycleBoundaryTransaction is prepared without side effects. Publish and Restore must be idempotent and exact-operation fenced. Publish may return an error after changing state, so callers always invoke Restore after a failed publication attempt. Inspect and Restore must reconstruct prior-attempt state from durable operation/step identity, not an in-memory closure. Job/schedule transactions switch desired snapshots while keeping admission closed; only ResumeLifecycleJobs may open an exact source or target role.

type LifecycleBoundaryTransactionState

type LifecycleBoundaryTransactionState string
const (
	LifecycleBoundaryTransactionSource LifecycleBoundaryTransactionState = "source"
	LifecycleBoundaryTransactionTarget LifecycleBoundaryTransactionState = "target"
)

type LifecycleCleanupFinalizationResult

type LifecycleCleanupFinalizationResult struct {
	CleanupID              string
	OperationID            int64
	Status                 string
	PhysicalPurgeCompleted bool
	PurgeReceiptID         string
	PurgeProofDigest       string
	FinalizedAt            *time.Time
}

type LifecycleCleanupPurgeReceipt

type LifecycleCleanupPurgeReceipt struct {
	CleanupID             string
	OperationID           int64
	CleanupMode           LifecycleBoundaryCleanupMode
	RetainedPackageDigest string
	ReceiptID             string
	IdentityPurged        bool
	PackagePurged         bool
	RuntimeRecoveryPurged bool
	DataDisposition       string
	Proof                 json.RawMessage
}

type LifecycleCleanupPurgeRequest

type LifecycleCleanupPurgeRequest struct {
	CleanupID                string
	OperationID              int64
	CleanupMode              LifecycleBoundaryCleanupMode
	RetainedExtensionID      string
	RetainedExtensionVersion string
	RetainedPackageDigest    string
	RetainedVersionID        int64
	RetainedPackagePath      string
	RetentionMarker          string
	ExportArtifactID         string
	ExportDigest             string
}

LifecycleCleanupPurgeRequest is an immutable exact-artifact instruction. Implementations must be idempotent by CleanupID and return the same durable receipt after a process or database-commit failure.

type LifecycleCoordinatorRuntimeAdapter

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

LifecycleCoordinatorRuntimeAdapter connects the durable Host coordinator to the exact protocol-v2 runtime already frozen by ProtocolStarter.Start.

func NewLifecycleCoordinatorRuntimeAdapter

func NewLifecycleCoordinatorRuntimeAdapter(starter *ProtocolStarter) *LifecycleCoordinatorRuntimeAdapter

type LifecycleCoordinatorRuntimeAdmission

type LifecycleCoordinatorRuntimeAdmission interface {
	AcquireRuntimeCall(context.Context, RuntimeInstanceIdentity, RuntimeCallClass) (*RuntimeAdmissionLease, error)
}

LifecycleCoordinatorRuntimeAdmission is the Manager-owned exact-instance admission boundary required before lifecycle cleanup reaches a process.

type LifecycleHostBoundary

type LifecycleHostBoundary interface {
	RunLifecycleHostBoundary(context.Context, extensions.LifecycleCoordinatorGateRequest) (LifecycleHostBoundaryResult, error)
}

LifecycleHostBoundary executes Host-owned boundaries that require composed database, registry, job, schedule, or removal state. A missing implementation fails closed instead of treating an unimplemented safety gate as a no-op.

type LifecycleHostBoundaryResult

type LifecycleHostBoundaryResult struct {
	Checkpoint     string
	ResultDocument json.RawMessage
}

LifecycleHostBoundaryResult deliberately excludes runtime bindings. Exact process selection belongs to this dispatcher; database/registry/job/removal boundaries may only return their durable checkpoint and typed result.

type LifecycleHostDrainBoundary

type LifecycleHostDrainBoundary interface {
	DrainLifecycleHostSources(context.Context, extensions.LifecycleCoordinatorGateRequest) error
	CanResumeLifecycleHostSources(context.Context, extensions.LifecycleCoordinatorGateRequest) (bool, error)
	ResumeLifecycleHostSources(context.Context, extensions.LifecycleCoordinatorGateRequest) error
}

LifecycleHostDrainBoundary extends the dispatcher at its earlier draining gate, before plugin upgrade/uninstall actions run. Production paths require this capability; runtime drain alone cannot close schedules or job enqueue.

type LifecycleHostRuntime

LifecycleHostRuntime is the exact-instance process surface used by Host lifecycle gates. Manager implements it directly.

type LifecycleIdentityStartupRecovery

type LifecycleIdentityStartupRecovery interface {
	RecoverStaleIdentityPublication(
		context.Context,
		identityregistry.Publication,
	) (identityregistry.DurableState, bool, error)
}

LifecycleIdentityStartupRecovery repairs only an exact source publication whose failed deactivation never committed and whose aggregate registry and extension-state transactions both durably returned to source.

type LifecycleInvocation

type LifecycleInvocation struct {
	Action      LifecycleAction
	PlanVersion string
	StepID      string
	Checkpoint  string
	Input       *protocolv2.TypedDocument
	DryRun      bool
	Forced      bool
	OnProgress  func(LifecycleProgress) error
}

LifecycleInvocation is one stable, resumable lifecycle step. Checkpoint is opaque to the Host; the owning state machine persists and returns it.

type LifecycleMigrationArtifact

type LifecycleMigrationArtifact struct {
	ExtensionID      string
	Version          string
	PackageDigest    string
	VersionID        int64
	MigrationsDigest string
	Migrations       []extensions.ManifestMigration
}

type LifecycleMigrationBackupRequirement

type LifecycleMigrationBackupRequirement struct {
	Required   bool
	Strategies []string
}

type LifecycleMigrationEngine

type LifecycleMigrationEngine interface {
	ReconcileLifecycleMigration(context.Context, LifecycleMigrationEnginePlan) error
	InspectLifecycleMigration(context.Context, LifecycleMigrationEnginePlan) (LifecycleMigrationEngineProof, error)
}

LifecycleMigrationEngine is the stable P5 handoff. Reconcile must be idempotent by PlanDigest and Inspect must read a durable exact-plan ledger. A one-shot success return or the legacy checksum-only ledger is insufficient.

type LifecycleMigrationEnginePlan

type LifecycleMigrationEnginePlan struct {
	OperationID int64
	Operation   extensions.LifecycleMachineOperation
	StepID      string
	Attempt     int
	Mode        LifecycleBoundaryMigrationMode
	PlanDigest  string
	Source      *LifecycleMigrationArtifact
	Target      LifecycleMigrationArtifact
}

type LifecycleMigrationEngineProof

type LifecycleMigrationEngineProof struct {
	ProofID          string
	ProofDigest      string
	PlanDigest       string
	TargetReady      bool
	SourceResumeSafe bool
}

type LifecycleMigrationPreflight

type LifecycleMigrationPreflight interface {
	PreflightLifecycleMigration(context.Context, LifecycleMigrationEnginePlan) (LifecycleMigrationPreflightResult, error)
}

LifecycleMigrationPreflight exposes the exact migration plan without acquiring an execution lock, provisioning PostgreSQL resources, or writing migration state. Implementations must not execute package migration SQL.

type LifecycleMigrationPreflightArtifact

type LifecycleMigrationPreflightArtifact struct {
	ExtensionID             string
	Version                 string
	VersionID               int64
	PackageDigest           string
	MigrationsDigest        string
	DatabaseContractVersion string
	DatabaseGrants          []string
	BackupRequired          bool
	BackupStrategy          string
}

type LifecycleMigrationPreflightResult

type LifecycleMigrationPreflightResult struct {
	OperationID         int64
	Operation           extensions.LifecycleMachineOperation
	Mode                LifecycleBoundaryMigrationMode
	StepID              string
	Attempt             int
	PlanDigest          string
	DryRunDigest        string
	SchemaName          string
	OwnerRoleName       string
	Source              *LifecycleMigrationPreflightArtifact
	Target              LifecycleMigrationPreflightArtifact
	Steps               []LifecycleMigrationPreflightStep
	Warnings            []string
	HasNonTransactional bool
	Backup              LifecycleMigrationBackupRequirement
}

type LifecycleMigrationPreflightStep

type LifecycleMigrationPreflightStep struct {
	Position          int
	Direction         string
	MigrationID       string
	ContractVersion   string
	PackagePath       string
	Checksum          string
	TransactionPolicy string
	ExecutionMode     string
	NoTransaction     bool
	WarningCode       string
	Artifact          LifecycleMigrationPreflightArtifact
	StatementDigests  []string
}

type LifecycleProgress

type LifecycleProgress struct {
	State          LifecycleProgressState
	CompletedUnits uint32
	TotalUnits     uint32
	Checkpoint     string
	Message        string
	Result         *protocolv2.TypedDocument
}

type LifecycleProgressState

type LifecycleProgressState = protocolv2.ProgressState

type LifecycleRegistryBoundaryConfig

type LifecycleRegistryBoundaryConfig struct {
	Repository   LifecycleRegistryPublicationRepository
	Manager      *Manager
	Pages        *pages.Registry
	ThemeRuntime *pages.ThemeRuntimeRegistry
	PageSiteName string
	PageLocales  []string
	Routes       *routes.Registry
	RouteSchemas *extensionopenapi.RouteSchemaPublication
	Services     *hostapi.ServiceRegistry
	Components   *ComponentRegistry
	// ComponentComposition 可选:组件发布成功后同步编译包本地 SSR。
	ComponentComposition *ProductionComponentComposition
	Assets               *assetregistry.Registry
	Caches               *cacheregistry.Registry
	Queries              *queryregistry.Registry
	SEO                  *seoregistry.Registry
	Identity             *identityregistry.Registry
	IdentityStore        identityregistry.PublicationStore
	IdentityRecovery     LifecycleIdentityStartupRecovery
	Navigation           *navigationregistry.Registry
	Notifications        *notifications.Registry
	// Content is the P10 Content Registry (block/shortcode/embed/node/mark/…).
	Content *contentregistry.Registry
	// Media is the P10 Media Pipeline Registry (MIME policy/processors/variants).
	Media *mediaregistry.Registry
	// Editor is the P10 Tiptap node/mark/command/toolbar registry.
	Editor *editorregistry.Registry
	// Entity is the P10 Entity Type / Taxonomy / Field Schema registry.
	Entity         *entityregistry.Registry
	AssetAuthority LifecycleAssetAuthority
	AssetAdmission LifecycleAssetAdmission
}

type LifecycleRegistryPublicationPhase

type LifecycleRegistryPublicationPhase string
const (
	LifecycleRegistryPublicationSource LifecycleRegistryPublicationPhase = "source"
	LifecycleRegistryPublicationTarget LifecycleRegistryPublicationPhase = "target"
)

type LifecycleRegistryPublicationRef

type LifecycleRegistryPublicationRef struct {
	OperationID int64
	StepID      string
	Mode        LifecycleBoundaryPublicationMode
	Attempt     int
}

type LifecycleRegistryPublicationRepository

type LifecycleRegistryPublicationRepository interface {
	PrepareLifecycleRegistryPublication(context.Context, PrepareLifecycleRegistryPublicationInput) (LifecycleRegistryPublicationRef, error)
	InspectLifecycleRegistryPublication(context.Context, LifecycleRegistryPublicationRef) (LifecycleRegistryPublicationPhase, error)
	MoveLifecycleRegistryPublication(
		context.Context,
		LifecycleRegistryPublicationRef,
		LifecycleRegistryPublicationPhase,
		func() error,
	) error
}

LifecycleRegistryPublicationRepository owns the durable aggregate phase. Move keeps the PostgreSQL fence locked while one node reconciles its local immutable snapshots, so an opposite or stale attempt cannot commit midway.

type LifecycleRemoteError

type LifecycleRemoteError struct {
	StepID     string
	Checkpoint string
	State      LifecycleProgressState
	Code       protocolv2.ErrorCode
	Reason     string
	Message    string
	Retryable  bool
	RetryAfter time.Time
	Metadata   map[string]string
}

LifecycleRemoteError preserves a plugin's terminal typed failure while allowing cancellation/deadline handling through errors.Is.

func (*LifecycleRemoteError) Error

func (e *LifecycleRemoteError) Error() string

func (*LifecycleRemoteError) LifecycleCoordinatorFailure

func (e *LifecycleRemoteError) LifecycleCoordinatorFailure() extensions.LifecycleExecutionError

func (*LifecycleRemoteError) Unwrap

func (e *LifecycleRemoteError) Unwrap() error

type LifecycleRunResult

type LifecycleRunResult struct {
	StepID     string
	State      LifecycleProgressState
	Checkpoint string
	// CheckpointSchema preserves the frozen manifest association. Checkpoint is
	// still an opaque wire string and is not structurally validated against it.
	CheckpointSchema string
	Result           *protocolv2.TypedDocument
	Progress         []LifecycleProgress
}

type LifecycleStaticPreflightRequest

type LifecycleStaticPreflightRequest struct {
	Operation       extensions.LifecycleMachineOperation
	SourceExtension *extensions.Extension
	TargetExtension extensions.Extension
}

LifecycleStaticPreflightRequest intentionally has no runtime binding or coordinator step. Service calls this same immutable fact check before coordinator.Run and therefore before StageRuntimeInstance. Position-level boundary replay calls it again after validating the durable Host step.

type MailProviderInvoker

type MailProviderInvoker interface {
	SendMail(context.Context, string, MailProviderRequest) (MailProviderResponse, error)
}

type MailProviderRegistry

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

func NewMailProviderRegistry

func NewMailProviderRegistry(store MailProviderStore) *MailProviderRegistry

func (*MailProviderRegistry) EnsureDefault

func (r *MailProviderRegistry) EnsureDefault(ctx context.Context) (string, error)

EnsureDefault persists the recommended provider when no explicit selection exists. It is idempotent and safe to run from both API and worker startup.

func (*MailProviderRegistry) Resolve

Resolve is the authoritative read used by delivery and the admin surface. It applies the recommended default only when no explicit row exists; a row that points at a disabled plugin stays a preference and reports unavailable.

func (*MailProviderRegistry) RestoreDefault

func (r *MailProviderRegistry) RestoreDefault(ctx context.Context) error

func (*MailProviderRegistry) Select

func (r *MailProviderRegistry) Select(ctx context.Context, extensionID string) error

func (*MailProviderRegistry) Selected

Selected keeps the pre-default callers working. Delivery should use Resolve so a temporarily unavailable provider is retried instead of skipped.

type MailProviderRequest

type MailProviderRequest struct {
	DeliveryID    string
	CorrelationID string
	FromAddress   string
	FromName      string
	To            []string
	Subject       string
	TextBody      string
	HTMLBody      string
}

type MailProviderResponse

type MailProviderResponse struct {
	OK             bool
	Classification string
	Reason         string
	Message        string
}

type MailProviderSelection

type MailProviderSelection struct {
	ExtensionID string `json:"extensionId"`
	Label       string `json:"label"`
}

type MailProviderState

type MailProviderState string

MailProviderState separates "nobody chose a provider" from "a provider was chosen but cannot run right now". Delivery treats the two differently: unconfigured is terminal, unavailable is retryable.

const (
	MailProviderReady        MailProviderState = "ready"
	MailProviderUnavailable  MailProviderState = "unavailable"
	MailProviderUnconfigured MailProviderState = "unconfigured"
)

type MailProviderStore

type MailProviderStore interface {
	GetMailProviderExtension(context.Context, string) (extensions.Extension, error)
	List(context.Context) ([]extensions.Extension, error)
	SelectedMailProvider(context.Context) (string, error)
	SelectMailProvider(context.Context, string) error
	RestoreMailProvider(context.Context) error
}

type Manager

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

Manager 保留历史 runtime 契约,并将业务入口委托给 focused collaborators。

func NewManager

func NewManager(config ManagerConfig) *Manager

func (*Manager) AcquireActiveRuntimeCall

func (m *Manager) AcquireActiveRuntimeCall(ctx context.Context, extensionID string, class RuntimeCallClass) (RuntimeInstanceSnapshot, *RuntimeAdmissionLease, error)

func (*Manager) AcquireRuntimeCall

func (m *Manager) AcquireRuntimeCall(ctx context.Context, identity RuntimeInstanceIdentity, class RuntimeCallClass) (*RuntimeAdmissionLease, error)

func (*Manager) ActiveRuntimeInstance

func (m *Manager) ActiveRuntimeInstance(extensionID string) (RuntimeInstanceSnapshot, error)

func (*Manager) AdminSurfaceSnapshot

func (m *Manager) AdminSurfaceSnapshot(kind string) AdminSurfaceRegistrySnapshot

func (*Manager) BeginDrain

func (*Manager) BeginDrainContext

func (m *Manager) BeginDrainContext(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)

func (*Manager) BindProviderSlotSelections

func (m *Manager) BindProviderSlotSelections(store ProviderSlotSelectionStore)

BindProviderSlotSelections attaches the durable exact-artifact choice to the already constructed registry. API and worker bootstrap call this before any provider invocation; registry publication itself remains database-free.

func (*Manager) Check

func (m *Manager) Check(arg0 context.Context, extension extensions.Extension) error

func (*Manager) Close

func (m *Manager) Close(ctx context.Context)

func (*Manager) Deliver

func (m *Manager) Deliver(ctx context.Context, extensionID string, deliveryID int64, envelope appevents.Envelope) appevents.Result

func (*Manager) DiscardRuntimeInstance

func (m *Manager) DiscardRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

func (*Manager) Emit

func (m *Manager) Emit(ctx context.Context, envelope appevents.Envelope) appevents.Result

func (*Manager) EmitHook

func (m *Manager) EmitHook(ctx context.Context, name string, payload map[string]any)

func (*Manager) ExecutePluginCommand

func (m *Manager) ExecutePluginCommand(
	ctx context.Context,
	commandID string,
	input map[string]any,
	safeMode bool,
) (PluginCommandExecutionResult, error)

func (*Manager) ExecutePluginJob

func (m *Manager) ExecutePluginJob(ctx context.Context, invocation supportjobs.PluginJobInvocation) error

func (*Manager) FilterQueryResultInstance

func (m *Manager) FilterQueryResultInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedQueryResultFilterRequest,
) ([]queryregistry.QueryRow, error)

func (*Manager) ForceDrain

func (m *Manager) ForceDrain(identity RuntimeInstanceIdentity, cause error) (RuntimeAdmissionSnapshot, error)

func (*Manager) HealthRuntimeInstance

func (m *Manager) HealthRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) (ProtocolRuntimeInstanceSnapshot, error)

func (*Manager) HookBus

func (m *Manager) HookBus() *HookBus

func (*Manager) InspectRuntimeInstance

func (m *Manager) InspectRuntimeInstance(identity RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)

func (*Manager) InvokeAdminSurface

func (m *Manager) InvokeAdminSurface(
	ctx context.Context,
	input AdminSurfaceInvocation,
) (AdminSurfaceInvocationResult, error)

func (*Manager) InvokeGuardInstance

func (m *Manager) InvokeGuardInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2GuardRequest,
) error

func (*Manager) InvokeQueryInstance

func (m *Manager) InvokeQueryInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedQueryRequest,
) ([]queryregistry.QueryRow, error)

func (*Manager) InvokeRouteInstance

func (m *Manager) InvokeRouteInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2RouteRequest,
) (ProtocolV2RouteResponse, error)

func (*Manager) InvokeVersionedHook

func (m *Manager) InvokeVersionedHook(ctx context.Context, input VersionedHookInvocation) VersionedHookResult

func (*Manager) InvokeVersionedProvider

func (m *Manager) InvokeVersionedProvider(
	ctx context.Context,
	input VersionedProviderInvocation,
) (VersionedProviderInvocationResult, error)

func (*Manager) NewExactLifecycleCoordinatorRuntimeAdapter

func (m *Manager) NewExactLifecycleCoordinatorRuntimeAdapter() (*ExactLifecycleCoordinatorRuntimeAdapter, error)

func (*Manager) OpenRouteStreamInstance

func (m *Manager) OpenRouteStreamInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2RouteStreamRequest,
) (*ProtocolV2RouteStream, error)

func (*Manager) ProbeProviderSlotCandidate

func (m *Manager) ProbeProviderSlotCandidate(ctx context.Context, contractID, candidateID string) (ProviderSlotProbeResult, error)

func (*Manager) ProtocolV2ProviderBroker

func (m *Manager) ProtocolV2ProviderBroker() (hostapi.ProtocolV2ProviderBroker, error)

func (*Manager) ProviderSlotInspection

func (m *Manager) ProviderSlotInspection(ctx context.Context) (extensions.ProviderSlotInspection, error)

func (*Manager) ProviderSlotSelections

func (m *Manager) ProviderSlotSelections() *ProviderSlotSelectionAPI

func (*Manager) PublishDrainedRuntimeInstance

func (m *Manager) PublishDrainedRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)

func (*Manager) PublishRuntimeInstance

func (m *Manager) PublishRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeInstanceSnapshot, error)

func (*Manager) PublishRuntimeInstanceFrom

func (m *Manager) PublishRuntimeInstanceFrom(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	source RuntimeInstanceArtifactIdentity,
) (RuntimeInstanceSnapshot, error)

func (*Manager) PublishRuntimeInstanceIfNoActive

func (m *Manager) PublishRuntimeInstanceIfNoActive(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
) (RuntimeInstanceSnapshot, error)

func (*Manager) QuarantineRuntimeArtifact

func (m *Manager) QuarantineRuntimeArtifact(
	exact RuntimeInstanceArtifactIdentity,
	cause error,
) ([]RuntimeAdmissionSnapshot, error)

func (*Manager) QuarantineRuntimeInstance

func (m *Manager) QuarantineRuntimeInstance(
	exact RuntimeInstanceArtifactIdentity,
	cause error,
) (RuntimeAdmissionSnapshot, error)

func (*Manager) Reconcile

func (m *Manager) Reconcile(ctx context.Context, items []extensions.Extension)

func (*Manager) RefreshMailProvider

func (m *Manager) RefreshMailProvider(ctx context.Context, extensionID string) error

func (*Manager) RemoveRuntimeInstance

func (m *Manager) RemoveRuntimeInstance(identity RuntimeInstanceIdentity) error

func (*Manager) ResolveAdminSurface

func (m *Manager) ResolveAdminSurface(id string) (AdminSurfaceContract, error)

func (*Manager) ResumeRuntimeInstance

func (m *Manager) ResumeRuntimeInstance(identity RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)

func (*Manager) ResumeRuntimeInstanceContext

func (m *Manager) ResumeRuntimeInstanceContext(ctx context.Context, identity RuntimeInstanceIdentity) (RuntimeAdmissionSnapshot, error)

func (*Manager) RouteTarget

func (m *Manager) RouteTarget(extensionID string) (RouteTarget, bool)

func (*Manager) RuntimeInstanceAvailable

func (m *Manager) RuntimeInstanceAvailable(identity RuntimeInstanceIdentity) bool

func (*Manager) SearchEngineDelete

func (m *Manager) SearchEngineDelete(ctx context.Context, extensionID string, request SearchEngineDeleteRequest) (SearchEngineResult, error)

func (*Manager) SearchEngineEnsure

func (m *Manager) SearchEngineEnsure(ctx context.Context, extensionID string) (SearchEngineResult, error)

func (*Manager) SearchEngineIndex

func (m *Manager) SearchEngineIndex(ctx context.Context, extensionID string, request SearchEngineIndexRequest) (SearchEngineResult, error)

func (*Manager) SearchEngineProbe

func (m *Manager) SearchEngineProbe(ctx context.Context, extensionID string, request SearchEngineProbeRequest) (SearchEngineProbeResponse, error)

func (*Manager) SearchEngineSearch

func (m *Manager) SearchEngineSearch(ctx context.Context, extensionID string, request SearchEngineSearchRequest) (SearchEngineSearchResponse, error)

func (*Manager) SendMail

func (m *Manager) SendMail(ctx context.Context, extensionID string, request MailProviderRequest) (MailProviderResponse, error)

func (*Manager) SetStartPreparer

func (m *Manager) SetStartPreparer(preparer func(context.Context, extensions.Extension) error)

func (*Manager) StageRuntimeInstance

func (m *Manager) StageRuntimeInstance(ctx context.Context, extension extensions.Extension) (RuntimeInstanceSnapshot, error)

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, extension extensions.Extension) error

func (*Manager) Status

func (m *Manager) Status(arg0 context.Context, extension extensions.Extension) extensions.RuntimeStatus

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context, extension extensions.Extension) error

func (*Manager) StopRuntimeInstance

func (m *Manager) StopRuntimeInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

func (*Manager) StorageClose

func (m *Manager) StorageClose(ctx context.Context, extensionID string, request StorageCloseRequest) (StorageResult, error)

func (*Manager) StorageDelete

func (m *Manager) StorageDelete(ctx context.Context, extensionID string, request StorageObjectRequest) (StorageResult, error)

func (*Manager) StorageExists

func (m *Manager) StorageExists(ctx context.Context, extensionID string, request StorageExistsRequest) (StorageExistsResponse, error)

func (*Manager) StorageGetChunk

func (m *Manager) StorageGetChunk(ctx context.Context, extensionID string, request StorageGetChunkRequest) (StorageGetChunkResponse, error)

func (*Manager) StorageOpen

func (m *Manager) StorageOpen(ctx context.Context, extensionID string, request StorageOpenRequest) (StorageSessionResponse, error)

func (*Manager) StorageProbe

func (m *Manager) StorageProbe(ctx context.Context, extensionID string, request StorageProbeRequest) (StorageProbeResponse, error)

func (*Manager) StoragePublicURL

func (m *Manager) StoragePublicURL(ctx context.Context, extensionID string, request StoragePublicURLRequest) (StorageURLResponse, error)

func (*Manager) StoragePutBegin

func (m *Manager) StoragePutBegin(ctx context.Context, extensionID string, request StoragePutBeginRequest) (StorageSessionResponse, error)

func (*Manager) StoragePutChunk

func (m *Manager) StoragePutChunk(ctx context.Context, extensionID string, request StoragePutChunkRequest) (StorageResult, error)

func (*Manager) StorageSignedURL

func (m *Manager) StorageSignedURL(ctx context.Context, extensionID string, request StorageSignedURLRequest) (StorageURLResponse, error)

func (*Manager) StorageStat

func (m *Manager) StorageStat(ctx context.Context, extensionID string, request StorageStatRequest) (StorageStatResponse, error)

func (*Manager) WaitDrain

func (m *Manager) WaitDrain(ctx context.Context, identity RuntimeInstanceIdentity) error

func (*Manager) WithActivation

func (m *Manager) WithActivation(coordinator *extensions.ActivationCoordinator, bootID string) *Manager

type ManagerConfig

type ManagerConfig struct {
	Starter       Starter
	HookBus       *HookBus
	DeliveryStore DeliveryStore
	Dispatcher    EventDispatcher
	// Resilience 可选;nil 使用默认 F2.3 参数。
	Resilience ResilienceConfig
	Activation *extensions.ActivationCoordinator
	BootID     string
}

type ManagerPluginRuntimeFullSetApplier

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

ManagerPluginRuntimeFullSetApplier 是 process-local 的 PluginRuntimeFullSetApplier。 它把一条 durable full-set publication 收敛到 *Manager 的 exact 活动集合。

func NewManagerPluginRuntimeFullSetApplier

func NewManagerPluginRuntimeFullSetApplier(
	manager *Manager,
	inventory PluginRuntimeFullSetInventory,
	tierOrders ...[]string,
) (*ManagerPluginRuntimeFullSetApplier, error)

NewManagerPluginRuntimeFullSetApplier 构造 Protocol V2 full-set 适配器。

func (*ManagerPluginRuntimeFullSetApplier) ApplyPluginRuntimeFullSet

func (a *ManagerPluginRuntimeFullSetApplier) ApplyPluginRuntimeFullSet(
	ctx context.Context,
	publication extensions.PluginRuntimePublication,
) (applied []extensions.PluginRuntimeAppliedMember, err error)

ApplyPluginRuntimeFullSet 将 Manager 收敛到 publication 描述的完整 exact 集合。 成功时返回完整 applied evidence(含 node-local runtime instance id)。

type PackageLocalComponentSSRRenderer

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

PackageLocalComponentSSRRenderer 在 Host 进程内编译并执行插件/主题包的 声明式 SSR 模板。模板在 Publish 时按 exact digest 读入并缓存,请求路径 不再访问包文件系统。

这是生产 PluginRenderer 的第一阶段:覆盖 package-local html/template 片段, 以及 filter_props/filter_result 的 text/template JSON 文档变换。 Protocol V2 子进程渲染可在后续阶段替换同一接口。

func NewPackageLocalComponentSSRRenderer

func NewPackageLocalComponentSSRRenderer() *PackageLocalComponentSSRRenderer

NewPackageLocalComponentSSRRenderer 创建空的包本地 SSR 渲染器。

func (*PackageLocalComponentSSRRenderer) Count

Count 返回当前缓存的模板数(测试/检查器用)。

func (*PackageLocalComponentSSRRenderer) Publish

Publish 编译 extension 中所有组件引用到的 SSR 模板。digest 不匹配或 路径越界时 fail closed。同一 packageDigest 的重复 Publish 是幂等替换。

func (*PackageLocalComponentSSRRenderer) RemoveExtension

func (r *PackageLocalComponentSSRRenderer) RemoveExtension(extensionID string)

RemoveExtension 删除某扩展 id 下全部包版本的模板(禁用/卸载时使用)。

func (*PackageLocalComponentSSRRenderer) RemovePackage

func (r *PackageLocalComponentSSRRenderer) RemovePackage(packageDigest string)

RemovePackage 删除指定 packageDigest 的全部已编译模板。

func (*PackageLocalComponentSSRRenderer) RenderComponent

RenderComponent 实现 ComponentSSRRenderer。按 exact package digest + SSR 模板 id 查找已编译模板;未发布时 fail closed。

type PluginCommandContract

type PluginCommandContract struct {
	ID                 string
	ContractVersion    string
	ExtensionID        string
	ExtensionVersion   string
	ArtifactDigest     string
	InstanceID         string
	Handler            string
	Permission         string
	InputSchema        string
	ResultSchema       string
	InputSchemaDigest  string
	ResultSchemaDigest string
	Description        string
	RecoverySafe       bool
	Timeout            time.Duration
	// contains filtered or unexported fields
}

type PluginCommandExecutionResult

type PluginCommandExecutionResult struct {
	Contract PluginCommandContract
	Output   map[string]any
}

type PluginCommandRegistry

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

PluginCommandRegistry publishes one immutable command namespace across all exact protocol-v2 runtime instances.

func NewPluginCommandRegistry

func NewPluginCommandRegistry() *PluginCommandRegistry

func (*PluginCommandRegistry) RemoveRuntime

func (r *PluginCommandRegistry) RemoveRuntime(extensionID, instanceID string) (bool, error)

func (*PluginCommandRegistry) ReplaceRuntime

func (r *PluginCommandRegistry) ReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*PluginCommandRegistry) Resolve

func (r *PluginCommandRegistry) Resolve(id string, safeMode bool) (PluginCommandContract, error)

func (*PluginCommandRegistry) Snapshot

func (*PluginCommandRegistry) ValidateInput

func (r *PluginCommandRegistry) ValidateInput(contract PluginCommandContract, document map[string]any) error

func (*PluginCommandRegistry) ValidateRemoveRuntime

func (r *PluginCommandRegistry) ValidateRemoveRuntime(extensionID, instanceID string) error

func (*PluginCommandRegistry) ValidateReplaceRuntime

func (r *PluginCommandRegistry) ValidateReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*PluginCommandRegistry) ValidateResult

func (r *PluginCommandRegistry) ValidateResult(contract PluginCommandContract, document map[string]any) error

type PluginCommandRegistrySnapshot

type PluginCommandRegistrySnapshot struct {
	Revision uint64
	Commands []PluginCommandContract
}

type PluginHealth

type PluginHealth struct {
	OK bool
}

type PluginHookRequest

type PluginHookRequest struct {
	DeclarationID   string
	Name            string
	Kind            string
	ContractVersion string
	DeliveryID      int64
	CorrelationID   string
	TimeoutMS       int
	Payload         map[string]any
	PatchFields     []string
}

type PluginHookResponse

type PluginHookResponse struct {
	OK      bool
	Reason  string
	Message string
	Patch   map[string]any
	Result  map[string]any
}

type PluginRouteTarget

type PluginRouteTarget struct {
	BaseURL string
}

type PluginRuntimeFullSetInventory

type PluginRuntimeFullSetInventory interface {
	Get(context.Context, string) (extensions.Extension, error)
	GetExtensionVersion(context.Context, extensions.ExactExtensionVersionInput) (extensions.ExtensionVersion, error)
	LatestPluginRuntimePublication(context.Context) (extensions.PluginRuntimePublication, error)
}

PluginRuntimeFullSetInventory 提供 exact-artifact 元数据,不信任当前活动版本字段。 Get 只用于扩展身份元数据;不可变包内容必须以 GetExtensionVersion 为准。

type PluginSearchEngine

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

PluginSearchEngine 将 search.Engine 翻译为扩展 runtime 的 ProviderCall。

func NewPluginSearchEngine

func NewPluginSearchEngine(extensionID string, runtime SearchRuntime) (*PluginSearchEngine, error)

NewPluginSearchEngine 构造插件搜索引擎适配器。

func (*PluginSearchEngine) Delete

func (e *PluginSearchEngine) Delete(ctx context.Context, topicID int64) error

func (*PluginSearchEngine) EnsureIndex

func (e *PluginSearchEngine) EnsureIndex(ctx context.Context) error

func (*PluginSearchEngine) Index

func (*PluginSearchEngine) Probe

func (e *PluginSearchEngine) Probe(ctx context.Context) error

func (*PluginSearchEngine) Search

type PluginSettings

type PluginSettings interface {
	ListSettings(context.Context, string) (map[string]string, error)
}

type PluginStorageAdapter

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

PluginStorageAdapter 将 storage.Adapter 翻译为扩展 runtime 的分块存储 RPC。 放在 Extensions 包以避免 Support/Storage ↔ Extensions 的 import 环。 业务代码只依赖 storage.Adapter 接口。

func NewPluginStorageAdapter

func NewPluginStorageAdapter(extensionID string, runtime StorageRuntime, chunkSize int) (*PluginStorageAdapter, error)

NewPluginStorageAdapter 构造插件后端适配器。chunkSize<=0 时用 1 MiB。

func (*PluginStorageAdapter) Delete

func (a *PluginStorageAdapter) Delete(ctx context.Context, key string) error

func (*PluginStorageAdapter) Exists

func (a *PluginStorageAdapter) Exists(ctx context.Context, key string) (bool, error)

func (*PluginStorageAdapter) Open

func (*PluginStorageAdapter) Probe

func (a *PluginStorageAdapter) Probe(ctx context.Context) error

func (*PluginStorageAdapter) PublicURL

func (a *PluginStorageAdapter) PublicURL(key string) string

func (*PluginStorageAdapter) Put

func (*PluginStorageAdapter) SignedURL

func (a *PluginStorageAdapter) SignedURL(ctx context.Context, key string, ttl time.Duration) (string, error)

func (*PluginStorageAdapter) Stat

type PluginStorageAdapterFactory

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

PluginStorageAdapterFactory keeps concrete runtime RPCs behind the stable ExtensionRuntime adapter-factory boundary used by product models.

func NewPluginStorageAdapterFactory

func NewPluginStorageAdapterFactory(runtime StorageRuntime, chunkSize int) *PluginStorageAdapterFactory

func (*PluginStorageAdapterFactory) NewStorageAdapter

func (f *PluginStorageAdapterFactory) NewStorageAdapter(extensionID string) (storage.Adapter, error)

func (*PluginStorageAdapterFactory) NewStorageInstanceAdapter

func (f *PluginStorageAdapterFactory) NewStorageInstanceAdapter(ctx context.Context, extensionID, instanceID string, settings map[string]string) (storage.Adapter, error)

func (*PluginStorageAdapterFactory) ProbeStorageInstance

func (f *PluginStorageAdapterFactory) ProbeStorageInstance(ctx context.Context, extensionID string, settings map[string]string) error

func (*PluginStorageAdapterFactory) RemoveStorageInstance

func (f *PluginStorageAdapterFactory) RemoveStorageInstance(ctx context.Context, extensionID, instanceID string) error

type PostgresExtensionDatabaseDisposition

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

func NewPostgresExtensionDatabaseDisposition

func NewPostgresExtensionDatabaseDisposition(pool *pgxpool.Pool) *PostgresExtensionDatabaseDisposition

func (*PostgresExtensionDatabaseDisposition) ApplyLifecycleDataDisposition

type PostgresExtensionDatabaseRegistry

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

func NewPostgresExtensionDatabaseRegistry

func NewPostgresExtensionDatabaseRegistry(
	pool *pgxpool.Pool,
	random io.Reader,
) *PostgresExtensionDatabaseRegistry

func (*PostgresExtensionDatabaseRegistry) BeginRuntimeLeaseDrain

func (*PostgresExtensionDatabaseRegistry) HeartbeatRuntimeLease

func (*PostgresExtensionDatabaseRegistry) InspectOwnSchemaGrant

func (*PostgresExtensionDatabaseRegistry) InspectRuntimeLease

func (*PostgresExtensionDatabaseRegistry) IssueRuntimeLease

func (*PostgresExtensionDatabaseRegistry) ProvisionOwnSchema

func (*PostgresExtensionDatabaseRegistry) ReapExpiredRuntimeLeases

func (r *PostgresExtensionDatabaseRegistry) ReapExpiredRuntimeLeases(
	ctx context.Context,
	limit int,
) (int, error)

ReapExpiredRuntimeLeases retires physical login roles left behind when a Host process exits before it can revoke an exact runtime lease.

func (*PostgresExtensionDatabaseRegistry) RevokeOwnSchema

func (*PostgresExtensionDatabaseRegistry) RotateOwnSchemaCredential

type PostgresLifecycleAssetAuthority

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

PostgresLifecycleAssetAuthority reads immutable lifecycle authority first and falls back to an unambiguous exact live grant for asset-only extensions.

func NewPostgresLifecycleAssetAuthority

func NewPostgresLifecycleAssetAuthority(
	pool *pgxpool.Pool,
	operations LifecycleAssetOperationRepository,
) *PostgresLifecycleAssetAuthority

func (*PostgresLifecycleAssetAuthority) OperationImpactDigest

func (a *PostgresLifecycleAssetAuthority) OperationImpactDigest(
	ctx context.Context,
	operationID int64,
	extension extensions.Extension,
) (string, error)

func (*PostgresLifecycleAssetAuthority) RestoreImpactDigest

func (a *PostgresLifecycleAssetAuthority) RestoreImpactDigest(
	ctx context.Context,
	extension extensions.Extension,
) (string, error)

type PostgresLifecycleBoundaryCleanup

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

PostgresLifecycleBoundaryCleanup only persists cleanup intent and recovery evidence. It deliberately has no filesystem remover or extension store dependency, so staging can never delete an extension row or package.

func NewPostgresLifecycleBoundaryCleanup

func NewPostgresLifecycleBoundaryCleanup(pool *pgxpool.Pool) *PostgresLifecycleBoundaryCleanup

func (*PostgresLifecycleBoundaryCleanup) StageLifecycleHostCleanup

type PostgresLifecycleBoundaryCleanupFinalizer

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

func (*PostgresLifecycleBoundaryCleanupFinalizer) FinalizeLifecycleHostCleanup

func (f *PostgresLifecycleBoundaryCleanupFinalizer) FinalizeLifecycleHostCleanup(
	ctx context.Context,
	operationID int64,
) (LifecycleCleanupFinalizationResult, error)

type PostgresLifecycleBoundaryJobs

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

PostgresLifecycleBoundaryJobs composes River's existing lifecycle planner, Manager exact-runtime admission, and the schedule trigger admission registry. PostgreSQL stores only desired snapshots and sanitized reconciliation proof.

func (*PostgresLifecycleBoundaryJobs) DrainLifecycleJobs

func (*PostgresLifecycleBoundaryJobs) PrepareLifecycleJobPublication

func (*PostgresLifecycleBoundaryJobs) ReconcileCommittedLifecycleJobs

func (b *PostgresLifecycleBoundaryJobs) ReconcileCommittedLifecycleJobs(
	ctx context.Context,
	request LifecycleBoundaryRequest,
	mode LifecycleBoundaryJobMode,
	publicationMode LifecycleBoundaryPublicationMode,
) error

func (*PostgresLifecycleBoundaryJobs) ResumeLifecycleJobs

func (*PostgresLifecycleBoundaryJobs) ValidateLifecycleJobs

type PostgresLifecycleBoundaryPublicationJournal

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

PostgresLifecycleBoundaryPublicationJournal is the durable decision point for crash recovery. It records only exact artifact identities; extension rows and mutable manifests are deliberately not part of the retained authority.

func NewPostgresLifecycleBoundaryPublicationJournal

func NewPostgresLifecycleBoundaryPublicationJournal(pool *pgxpool.Pool) *PostgresLifecycleBoundaryPublicationJournal

func (*PostgresLifecycleBoundaryPublicationJournal) CommitLifecyclePublication

func (*PostgresLifecycleBoundaryPublicationJournal) LifecyclePublicationCommitted

func (*PostgresLifecycleBoundaryPublicationJournal) LifecyclePublicationCommittedForOperation

func (j *PostgresLifecycleBoundaryPublicationJournal) LifecyclePublicationCommittedForOperation(
	ctx context.Context,
	request LifecycleBoundaryRequest,
	mode LifecycleBoundaryPublicationMode,
) (bool, error)

LifecyclePublicationCommittedForOperation is the read-only recovery query used by an earlier source-drain step. Gate attempts are per-step, so this query deliberately ignores Attempt while retaining every logical and exact- artifact fence. It never prepares or advances the publication row.

func (*PostgresLifecycleBoundaryPublicationJournal) PrepareLifecyclePublication

type PostgresLifecycleBoundaryRegistries

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

PostgresLifecycleBoundaryRegistries composes the production HookBus, Protocol-v2 Service Registry, Page, Route, Component, and Asset registries, plus the exact package schema publication consumed by the Route dispatcher.

func (*PostgresLifecycleBoundaryRegistries) AssetRegistry

func (*PostgresLifecycleBoundaryRegistries) CacheRegistry

func (*PostgresLifecycleBoundaryRegistries) ComponentRegistry

func (*PostgresLifecycleBoundaryRegistries) ContentRegistry

func (*PostgresLifecycleBoundaryRegistries) EditorRegistry

func (*PostgresLifecycleBoundaryRegistries) EntityRegistry

func (*PostgresLifecycleBoundaryRegistries) IdentityRegistry

func (*PostgresLifecycleBoundaryRegistries) MediaRegistry

func (*PostgresLifecycleBoundaryRegistries) NavigationRegistry

func (*PostgresLifecycleBoundaryRegistries) PrepareLifecycleRegistryPublication

func (*PostgresLifecycleBoundaryRegistries) PrepareRuntimeQueriesForSettings

PrepareRuntimeQueriesForSettings closes source admission before Service persists new settings. The returned transaction owns publicationMu until it either commits the exact replacement or restores/keeps the source closed.

func (*PostgresLifecycleBoundaryRegistries) PublishRuntimeCaches

PublishRuntimeCaches production-binds a cache-bearing plugin that uses the legacy Service Enable path because it declares no Lifecycle V2 hook contract.

func (*PostgresLifecycleBoundaryRegistries) PublishRuntimeContent

func (*PostgresLifecycleBoundaryRegistries) PublishRuntimeEditor

func (*PostgresLifecycleBoundaryRegistries) PublishRuntimeIdentity

func (b *PostgresLifecycleBoundaryRegistries) PublishRuntimeIdentity(
	ctx context.Context,
	extension extensions.Extension,
	actorUserID int64,
	auditEventID int64,
) (extensions.RuntimeIdentityPublicationMutation, error)

func (*PostgresLifecycleBoundaryRegistries) PublishRuntimeQueries

PublishRuntimeQueries production-binds a Query Registry plugin that uses the legacy Service Enable path because it declares no Lifecycle V2 hook contract.

func (*PostgresLifecycleBoundaryRegistries) QuarantineRuntimeCaches

QuarantineRuntimeCaches closes exact runtime admission and removes only the observed complete publication. Rollback restores publication before admission.

func (*PostgresLifecycleBoundaryRegistries) QuarantineRuntimeContent

func (*PostgresLifecycleBoundaryRegistries) QuarantineRuntimeEditor

func (*PostgresLifecycleBoundaryRegistries) QuarantineRuntimeIdentity

func (b *PostgresLifecycleBoundaryRegistries) QuarantineRuntimeIdentity(
	ctx context.Context,
	extension extensions.Extension,
	actorUserID int64,
	auditEventID int64,
) (extensions.RuntimeIdentityPublicationMutation, error)

func (*PostgresLifecycleBoundaryRegistries) QuarantineRuntimeQueries

QuarantineRuntimeQueries closes exact runtime admission and removes only the observed publication. The returned mutation retains enough Host state to restore publication-before-resume if Store.Disable fails.

func (*PostgresLifecycleBoundaryRegistries) QueryRegistry

func (*PostgresLifecycleBoundaryRegistries) RestoreCachePublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreCachePublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

RestoreCachePublications exposes the cache-only startup boundary used by the standalone worker, which does not construct public Route/Page registries.

func (*PostgresLifecycleBoundaryRegistries) RestoreContentPublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreContentPublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) RestoreEditorPublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreEditorPublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) RestoreEntityPublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreEntityPublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) RestoreMediaPublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreMediaPublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) RestoreNavigationPublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreNavigationPublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) RestoreRoutePublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreRoutePublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) RestoreSEOPublications

func (b *PostgresLifecycleBoundaryRegistries) RestoreSEOPublications(
	ctx context.Context,
	items []extensions.Extension,
	safeMode bool,
) error

func (*PostgresLifecycleBoundaryRegistries) SEORegistry

func (*PostgresLifecycleBoundaryRegistries) SuppressedIdentityExtensions

func (b *PostgresLifecycleBoundaryRegistries) SuppressedIdentityExtensions() []string

SuppressedIdentityExtensions reports the plugins whose durable Identity publication was suppressed during this boot. They are published nowhere until a lifecycle operation republishes them.

func (*PostgresLifecycleBoundaryRegistries) ValidateLifecycleRegistries

func (b *PostgresLifecycleBoundaryRegistries) ValidateLifecycleRegistries(
	ctx context.Context,
	request LifecycleBoundaryRequest,
) error

type PostgresLifecycleBoundaryState

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

PostgresLifecycleBoundaryState adapts the Models exact-state repository to the composed boundary. Returned transactions retain only a durable row key; every method reloads source/target facts from PostgreSQL.

func (*PostgresLifecycleBoundaryState) PrepareLifecycleStatePublication

type PostgresLifecycleMigrationEngine

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

func NewPostgresLifecycleMigrationEngine

func NewPostgresLifecycleMigrationEngine(
	pool *pgxpool.Pool,
	random io.Reader,
) *PostgresLifecycleMigrationEngine

func (*PostgresLifecycleMigrationEngine) InspectLifecycleMigration

func (*PostgresLifecycleMigrationEngine) PreflightLifecycleMigration

PreflightLifecycleMigration performs the same exact-artifact discovery and Goose parsing used by execution. Goose is connected only to the in-memory statement recorder, so package SQL is inspected but never sent to PostgreSQL.

func (*PostgresLifecycleMigrationEngine) ReconcileLifecycleMigration

func (e *PostgresLifecycleMigrationEngine) ReconcileLifecycleMigration(
	ctx context.Context,
	plan LifecycleMigrationEnginePlan,
) error

type PostgresLifecycleRegistryPublicationRepository

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

func NewPostgresLifecycleRegistryPublicationRepository

func NewPostgresLifecycleRegistryPublicationRepository(
	pool *pgxpool.Pool,
) *PostgresLifecycleRegistryPublicationRepository

func (*PostgresLifecycleRegistryPublicationRepository) InspectLifecycleRegistryPublication

func (*PostgresLifecycleRegistryPublicationRepository) MoveLifecycleRegistryPublication

func (r *PostgresLifecycleRegistryPublicationRepository) MoveLifecycleRegistryPublication(
	ctx context.Context,
	ref LifecycleRegistryPublicationRef,
	destination LifecycleRegistryPublicationPhase,
	apply func() error,
) error

func (*PostgresLifecycleRegistryPublicationRepository) MoveLifecycleRegistryPublicationTx

func (r *PostgresLifecycleRegistryPublicationRepository) MoveLifecycleRegistryPublicationTx(
	ctx context.Context,
	ref LifecycleRegistryPublicationRef,
	destination LifecycleRegistryPublicationPhase,
	apply func(pgx.Tx) error,
) error

func (*PostgresLifecycleRegistryPublicationRepository) PrepareLifecycleRegistryPublication

type PostgresProviderSlotSelectionStore

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

func NewPostgresProviderSlotSelectionStore

func NewPostgresProviderSlotSelectionStore(pool *pgxpool.Pool) *PostgresProviderSlotSelectionStore

func (*PostgresProviderSlotSelectionStore) Desired

func (*PostgresProviderSlotSelectionStore) InvalidateExtension

func (*PostgresProviderSlotSelectionStore) ListEvents

func (*PostgresProviderSlotSelectionStore) Reset

func (*PostgresProviderSlotSelectionStore) Select

func (*PostgresProviderSlotSelectionStore) Selected

type PrepareLifecycleRegistryPublicationInput

type PrepareLifecycleRegistryPublicationInput struct {
	Fence                   lifecyclePublicationFence
	SourceDigest            string
	TargetDigest            string
	CompatibleSourceDigests []string
	CompatibleTargetDigests []string
}

type ProductionComponentComposition

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

ProductionComponentComposition is the production-bound ComponentCompositionExecutor service. Bootstrap owns one instance on the lifecycle stack.

func NewProductionComponentComposition

func NewProductionComponentComposition(
	config ProductionComponentCompositionConfig,
) (*ProductionComponentComposition, error)

NewProductionComponentComposition builds the production executor with Core renderer, Manager admission, and default target bindings.

func (*ProductionComponentComposition) Compose

Compose is the stable production entrypoint for Host composition. Callers may omit Binding; production resolves the Host default for the target.

func (*ProductionComponentComposition) ComposePageHTML

func (s *ProductionComponentComposition) ComposePageHTML(
	ctx context.Context,
	pageID string,
	props map[string]any,
) ([]string, error)

ComposePageHTML implements pages.PageCompositionRenderer without importing the pages package (Extensions already depends on Pages in lifecycle code).

func (*ProductionComponentComposition) ComposePageTarget

func (s *ProductionComponentComposition) ComposePageTarget(
	ctx context.Context,
	pageID string,
	props map[string]any,
	actor ComponentActorAuthority,
) ([]string, error)

ComposePageTarget maps a Page Registry id (e.g. forum.home) to the Host component target (core.component.page.forum.home) and composes it. Returned HTML is only non-Core contribution output so theme primary content is never replaced by this helper.

func (*ProductionComponentComposition) InspectorTraces

InspectorTraces exposes the detached composition trace ring for admin tools.

func (*ProductionComponentComposition) PublishPackageSSR

func (s *ProductionComponentComposition) PublishPackageSSR(extension extensions.Extension) error

PublishPackageSSR 在组件生命周期发布成功后编译包本地 SSR 模板。 外部自定义 PluginRenderer 时仍会更新内部缓存,以便后续切回默认渲染器。

func (*ProductionComponentComposition) RemovePackageSSR

func (s *ProductionComponentComposition) RemovePackageSSR(extensionID, packageDigest string)

RemovePackageSSR 在组件禁用/卸载时丢弃包本地 SSR 缓存。

func (*ProductionComponentComposition) ResolveTarget

ResolveTarget supplies Host-owned bindings. Page targets retain primary SSR content; validators deliberately accept any props/result until a target owner publishes a stricter contract.

type ProductionComponentCompositionConfig

type ProductionComponentCompositionConfig struct {
	Registry             *ComponentRegistry
	Manager              *Manager
	PluginRenderer       ComponentSSRRenderer
	PermissionAuthorizer ComponentPermissionAuthorizer
	ResolvePolicy        ComponentCallPolicyResolver
}

ProductionComponentCompositionConfig wires the Host-owned composition stack. PermissionAuthorizer 为 nil 时仅依赖 Actor 上限(SuperAdmin / 空 permission)。

type ProductionLifecycleBoundaryMigrations

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

ProductionLifecycleBoundaryMigrations is deliberately fail-closed until P5 installs a real engine. It never reads extension_migration_ledger because that v1 table did not execute SQL.

func NewProductionLifecycleBoundaryMigrations

func NewProductionLifecycleBoundaryMigrations(
	pool *pgxpool.Pool,
	engine LifecycleMigrationEngine,
) *ProductionLifecycleBoundaryMigrations

func (*ProductionLifecycleBoundaryMigrations) CanPrepareLifecycleMigrations

func (m *ProductionLifecycleBoundaryMigrations) CanPrepareLifecycleMigrations(
	ctx context.Context,
	request LifecycleStaticPreflightRequest,
) (bool, error)

CanPrepareLifecycleMigrations is safe to call before coordinator.Run. It never invokes the engine. Declared SQL can proceed only when the exact target already has a durable V3 proof or a real P5 engine is configured for the later fenced boundary step.

func (*ProductionLifecycleBoundaryMigrations) CanResumeLifecycleSource

func (*ProductionLifecycleBoundaryMigrations) LifecycleArtifactMigrationReady

func (m *ProductionLifecycleBoundaryMigrations) LifecycleArtifactMigrationReady(
	ctx context.Context,
	artifact extensions.Extension,
) (bool, error)

func (*ProductionLifecycleBoundaryMigrations) ReconcileLifecycleMigrations

type ProductionLifecycleBoundaryPreflight

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

ProductionLifecycleBoundaryPreflight uses only Host-owned static facts: installed manifests, feature flags, exact trust rows, package/Host protocol compatibility, and durable migration readiness. No dependency exposes a process start method through this adapter.

func (*ProductionLifecycleBoundaryPreflight) CheckLifecycleBoundary

func (p *ProductionLifecycleBoundaryPreflight) CheckLifecycleBoundary(
	ctx context.Context,
	request LifecycleBoundaryRequest,
) error

func (*ProductionLifecycleBoundaryPreflight) CheckLifecycleStaticPreflight

func (p *ProductionLifecycleBoundaryPreflight) CheckLifecycleStaticPreflight(
	ctx context.Context,
	request LifecycleStaticPreflightRequest,
) error

type ProtocolNoop

type ProtocolNoop struct{}

ProtocolNoop 提供 PluginProtocol 全部方法的安全默认实现。 插件可嵌入后只覆盖需要的 RPC(与 sdk/plugin.Noop 一致)。

func (ProtocolNoop) Health

func (ProtocolNoop) Health() (PluginHealth, error)

func (ProtocolNoop) InvokeHook

func (ProtocolNoop) ProviderProbe

func (ProtocolNoop) RouteTarget

func (ProtocolNoop) RouteTarget() (PluginRouteTarget, error)

func (ProtocolNoop) SendMail

func (ProtocolNoop) StorageClose

func (ProtocolNoop) StorageConfigureInstance

func (ProtocolNoop) StorageConfigureInstance(StorageConfigureInstanceRequest) (StorageResult, error)

func (ProtocolNoop) StorageDelete

func (ProtocolNoop) StorageExists

func (ProtocolNoop) StorageGetChunk

func (ProtocolNoop) StorageOpen

func (ProtocolNoop) StorageProbe

func (ProtocolNoop) StorageProbeConfig

func (ProtocolNoop) StoragePublicURL

func (ProtocolNoop) StoragePutBegin

func (ProtocolNoop) StoragePutChunk

func (ProtocolNoop) StorageRemoveInstance

func (ProtocolNoop) StorageSignedURL

func (ProtocolNoop) StorageStat

type ProtocolRuntimeInstanceSnapshot

type ProtocolRuntimeInstanceSnapshot struct {
	Identity         RuntimeInstanceIdentity
	ExtensionVersion string
	ArtifactDigest   string
	ManifestDigest   string
	ProtocolVersion  int
	Target           RouteTarget
	State            ProtocolRuntimeInstanceState
	Healthy          bool
	Ready            bool
	ReadinessChecked bool
	StartedAt        time.Time
}

ProtocolRuntimeInstanceSnapshot 只暴露宿主可安全检查的 exact process 元数据。

type ProtocolRuntimeInstanceState

type ProtocolRuntimeInstanceState string
const (
	ProtocolRuntimeStaged    ProtocolRuntimeInstanceState = "staged"
	ProtocolRuntimePublished ProtocolRuntimeInstanceState = "published"
	ProtocolRuntimeRetained  ProtocolRuntimeInstanceState = "retained"
)

type ProtocolRuntimeSetLease

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

ProtocolRuntimeSetLease keeps ProtocolStarter membership and the HostAPI service writer fence continuous across an aggregate Manager commit/rollback.

func (*ProtocolRuntimeSetLease) Release

func (l *ProtocolRuntimeSetLease) Release()

func (*ProtocolRuntimeSetLease) Restore

func (*ProtocolRuntimeSetLease) Validate

func (l *ProtocolRuntimeSetLease) Validate(ctx context.Context, identities []RuntimeInstanceIdentity) error

Validate proves that the complete published process set is still the exact live set while the ProtocolStarter and ServiceRegistry writer fences remain held. It is the final candidate fence immediately before Manager commit.

type ProtocolStarter

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

func NewProtocolStarter

func NewProtocolStarter(config ProtocolStarterConfig) *ProtocolStarter

func (*ProtocolStarter) DiscardInstance

func (s *ProtocolStarter) DiscardInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

DiscardInstance 只销毁从未发布的 V2 候选,不能误删活动或 rollback 保留实例。

func (*ProtocolStarter) ExecutePluginJob

func (s *ProtocolStarter) ExecutePluginJob(ctx context.Context, invocation supportjobs.PluginJobInvocation) error

func (*ProtocolStarter) FilterQueryResult

func (*ProtocolStarter) FilterQueryResultInstance

func (s *ProtocolStarter) FilterQueryResultInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedQueryResultFilterRequest,
) ([]queryregistry.QueryRow, error)

func (*ProtocolStarter) HealthInstance

func (s *ProtocolStarter) HealthInstance(ctx context.Context, identity RuntimeInstanceIdentity) (PluginHealth, error)

HealthInstance 对 exact V2 进程重新执行 health+readiness,不读取活动回退实例。

func (*ProtocolStarter) InspectInstance

func (*ProtocolStarter) InvokeAdminSurface

func (s *ProtocolStarter) InvokeAdminSurface(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	contract AdminSurfaceContract,
	input map[string]any,
	actor *ProtocolV2InvocationActor,
	idempotencyKey string,
) (map[string]any, error)

func (*ProtocolStarter) InvokeContentInstance

func (s *ProtocolStarter) InvokeContentInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedContentRequest,
) (VersionedContentResponse, error)

func (*ProtocolStarter) InvokeGuardInstance

func (s *ProtocolStarter) InvokeGuardInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2GuardRequest,
) error

func (*ProtocolStarter) InvokeHook

func (s *ProtocolStarter) InvokeHook(ctx context.Context, extension extensions.Extension, input HookInput) HookResult

func (*ProtocolStarter) InvokeIdentityProviderInstance

func (*ProtocolStarter) InvokePluginCommand

func (s *ProtocolStarter) InvokePluginCommand(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	contract PluginCommandContract,
	input map[string]any,
) (map[string]any, error)

func (*ProtocolStarter) InvokeQuery

func (*ProtocolStarter) InvokeQueryInstance

func (s *ProtocolStarter) InvokeQueryInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedQueryRequest,
) ([]queryregistry.QueryRow, error)

func (*ProtocolStarter) InvokeRouteInstance

func (s *ProtocolStarter) InvokeRouteInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2RouteRequest,
) (ProtocolV2RouteResponse, error)

InvokeRouteInstance never selects the active process as a fallback. Staged, published, and retained instances remain distinguishable by exact identity.

func (*ProtocolStarter) InvokeVersionedAITool

func (s *ProtocolStarter) InvokeVersionedAITool(
	ctx context.Context,
	extension extensions.Extension,
	input VersionedAIToolRequest,
) (VersionedAIToolResponse, error)

InvokeVersionedAITool 把一次工具调用派发到精确 runtime。 与 SEO 同一手法:先在运行时表里取到该插件的 Protocol V2 客户端,再调它。

func (*ProtocolStarter) InvokeVersionedProvider

func (s *ProtocolStarter) InvokeVersionedProvider(
	ctx context.Context,
	extension extensions.Extension,
	input VersionedProviderRequest,
) (VersionedProviderResponse, error)

func (*ProtocolStarter) InvokeVersionedSEO

func (s *ProtocolStarter) InvokeVersionedSEO(
	ctx context.Context,
	extension extensions.Extension,
	input VersionedSEORequest,
) (VersionedSEOResponse, error)

func (*ProtocolStarter) OpenRouteStreamInstance

func (s *ProtocolStarter) OpenRouteStreamInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2RouteStreamRequest,
) (*ProtocolV2RouteStream, error)

OpenRouteStreamInstance never re-selects the active runtime. A retained source process and its replacement may both drain streams under distinct exact identities during a rolling upgrade.

func (*ProtocolStarter) ProtocolTelemetry

func (s *ProtocolStarter) ProtocolTelemetry(extensionID string) ProtocolTelemetrySnapshot

func (*ProtocolStarter) ProviderProbe

func (s *ProtocolStarter) ProviderProbe(ctx context.Context, extensionID string, request ProviderProbeRequest) (ProviderProbeResponse, error)

func (*ProtocolStarter) PublishInstance

PublishInstance 健康检查后原子替换 V2 Service Registry,再切换活动 transport 指针。 调用方在此边界外负责关闭 Manager admission,避免跨 Registry 的新 ordinary 调用。

func (*ProtocolStarter) PublishInstanceSet

PublishInstanceSet validates and publishes exactly identities. Service discovery/dependency readers and ProtocolStarter pointer readers can observe only the complete previous set or the complete desired set.

func (*ProtocolStarter) RunLifecycle

func (s *ProtocolStarter) RunLifecycle(ctx context.Context, extension extensions.Extension, invocation LifecycleInvocation) (LifecycleRunResult, error)

RunLifecycle invokes only the typed v2 lifecycle surface. Protocol-v1 packages remain runnable, but never report lifecycle v2 as supported.

func (*ProtocolStarter) RunLifecycleInstance

func (s *ProtocolStarter) RunLifecycleInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	invocation LifecycleInvocation,
) (LifecycleRunResult, error)

RunLifecycleInstance invokes lifecycle code on one staged/published/retained V2 process. It never falls back to the extension's current active instance.

func (*ProtocolStarter) RuntimeInstanceSetVisible

func (s *ProtocolStarter) RuntimeInstanceSetVisible(ctx context.Context, identities []RuntimeInstanceIdentity) bool

RuntimeInstanceSetVisible checks both active process pointers and the exact Protocol V2 service/dependency snapshot for idempotent full-set replay.

func (*ProtocolStarter) SearchEngineDelete

func (s *ProtocolStarter) SearchEngineDelete(ctx context.Context, extensionID string, request SearchEngineDeleteRequest) (SearchEngineResult, error)

func (*ProtocolStarter) SearchEngineEnsure

func (s *ProtocolStarter) SearchEngineEnsure(ctx context.Context, extensionID string) (SearchEngineResult, error)

func (*ProtocolStarter) SearchEngineIndex

func (s *ProtocolStarter) SearchEngineIndex(ctx context.Context, extensionID string, request SearchEngineIndexRequest) (SearchEngineResult, error)

func (*ProtocolStarter) SearchEngineProbe

func (s *ProtocolStarter) SearchEngineProbe(ctx context.Context, extensionID string, request SearchEngineProbeRequest) (SearchEngineProbeResponse, error)

func (*ProtocolStarter) SearchEngineSearch

func (s *ProtocolStarter) SearchEngineSearch(ctx context.Context, extensionID string, request SearchEngineSearchRequest) (SearchEngineSearchResponse, error)

func (*ProtocolStarter) SendMail

func (s *ProtocolStarter) SendMail(ctx context.Context, extensionID string, request MailProviderRequest) (MailProviderResponse, error)

func (*ProtocolStarter) Start

func (s *ProtocolStarter) Start(ctx context.Context, extension extensions.Extension) (RouteTarget, error)

Start 内部完成 stage+publish。需要跨 health/drain 边界编排时,调用方应使用 StartInstance + PublishInstance。

func (*ProtocolStarter) StartInstance

func (s *ProtocolStarter) StartInstance(ctx context.Context, extension extensions.Extension) (RouteTarget, error)

StartInstance 启动并验证一个未发布的 V2 进程;不会改变活动指针或 Registry。

func (*ProtocolStarter) Stop

func (s *ProtocolStarter) Stop(ctx context.Context, extension extensions.Extension) error

func (*ProtocolStarter) StopInstance

func (s *ProtocolStarter) StopInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

StopInstance 停止任意 staged/published/retained V2 exact process。

func (*ProtocolStarter) StopRetainedInstance

func (s *ProtocolStarter) StopRetainedInstance(ctx context.Context, identity RuntimeInstanceIdentity) error

StopRetainedInstance stops one exact V2 process only after complete-set publication has made it unreachable. It cannot stop an active or staged candidate.

func (*ProtocolStarter) StorageClose

func (s *ProtocolStarter) StorageClose(ctx context.Context, extensionID string, request StorageCloseRequest) (StorageResult, error)

func (*ProtocolStarter) StorageConfigureInstance

func (s *ProtocolStarter) StorageConfigureInstance(ctx context.Context, extensionID string, request StorageConfigureInstanceRequest) (StorageResult, error)

func (*ProtocolStarter) StorageDelete

func (s *ProtocolStarter) StorageDelete(ctx context.Context, extensionID string, request StorageObjectRequest) (StorageResult, error)

func (*ProtocolStarter) StorageExists

func (s *ProtocolStarter) StorageExists(ctx context.Context, extensionID string, request StorageExistsRequest) (StorageExistsResponse, error)

func (*ProtocolStarter) StorageGetChunk

func (s *ProtocolStarter) StorageGetChunk(ctx context.Context, extensionID string, request StorageGetChunkRequest) (StorageGetChunkResponse, error)

func (*ProtocolStarter) StorageOpen

func (s *ProtocolStarter) StorageOpen(ctx context.Context, extensionID string, request StorageOpenRequest) (StorageSessionResponse, error)

func (*ProtocolStarter) StorageProbe

func (s *ProtocolStarter) StorageProbe(ctx context.Context, extensionID string, request StorageProbeRequest) (StorageProbeResponse, error)

func (*ProtocolStarter) StorageProbeConfig

func (s *ProtocolStarter) StorageProbeConfig(ctx context.Context, extensionID string, request StorageProbeConfigRequest) (StorageProbeResponse, error)

func (*ProtocolStarter) StoragePublicURL

func (s *ProtocolStarter) StoragePublicURL(ctx context.Context, extensionID string, request StoragePublicURLRequest) (StorageURLResponse, error)

func (*ProtocolStarter) StoragePutBegin

func (s *ProtocolStarter) StoragePutBegin(ctx context.Context, extensionID string, request StoragePutBeginRequest) (StorageSessionResponse, error)

func (*ProtocolStarter) StoragePutChunk

func (s *ProtocolStarter) StoragePutChunk(ctx context.Context, extensionID string, request StoragePutChunkRequest) (StorageResult, error)

func (*ProtocolStarter) StorageRemoveInstance

func (s *ProtocolStarter) StorageRemoveInstance(ctx context.Context, extensionID string, request StorageRemoveInstanceRequest) (StorageResult, error)

func (*ProtocolStarter) StorageSignedURL

func (s *ProtocolStarter) StorageSignedURL(ctx context.Context, extensionID string, request StorageSignedURLRequest) (StorageURLResponse, error)

func (*ProtocolStarter) StorageStat

func (s *ProtocolStarter) StorageStat(ctx context.Context, extensionID string, request StorageStatRequest) (StorageStatResponse, error)

type ProtocolStarterConfig

type ProtocolStarterConfig struct {
	Settings PluginSettings
	// HostAPI 可选;注入后向子进程写入 SFORUM_HOST_API_* 环境变量。
	HostAPI HostAPIRegistrar
	// Trust 为 v2 握手解析精确 artifact grant;上传包不可省略。
	Trust RuntimeTrustSource
	// DatabaseLeases 为声明直接数据库权限的 exact runtime 签发独立短租约。
	DatabaseLeases RuntimeDatabaseLeaseRegistry
	// 测试可缩短心跳;生产零值使用推荐值。
	DatabaseLeaseHeartbeatInterval time.Duration
	DatabaseLeaseOperationTimeout  time.Duration
}

type ProtocolTelemetrySnapshot

type ProtocolTelemetrySnapshot struct {
	ProtocolVersion int
	Transport       string
	Deprecated      bool
	StartCount      uint64
	CallCount       uint64
	LastCallAt      *time.Time
}

ProtocolTelemetrySnapshot is the operator-visible transport/deprecation metric for one extension runtime.

type ProtocolTelemetrySource

type ProtocolTelemetrySource interface {
	ProtocolTelemetry(extensionID string) ProtocolTelemetrySnapshot
}

ProtocolTelemetrySource lets Manager merge transport metrics into status.

type ProtocolV2Error

type ProtocolV2Error struct {
	Code      protocolv2.ErrorCode
	Reason    string
	Message   string
	Retryable bool
}

ProtocolV2Error preserves the stable typed error returned by a plugin.

func (*ProtocolV2Error) Error

func (e *ProtocolV2Error) Error() string

type ProtocolV2GuardCallFailure

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

ProtocolV2GuardCallFailure is created only after InvokeRoute has been called. Error text is deliberately detached from plugin-controlled error details.

func NewProtocolV2GuardCallFailure

func NewProtocolV2GuardCallFailure(kind ProtocolV2GuardFailureKind, cause error) *ProtocolV2GuardCallFailure

func (*ProtocolV2GuardCallFailure) Error

func (*ProtocolV2GuardCallFailure) Kind

func (*ProtocolV2GuardCallFailure) RuntimeExecutionObserved

func (e *ProtocolV2GuardCallFailure) RuntimeExecutionObserved() bool

func (*ProtocolV2GuardCallFailure) Unwrap

func (e *ProtocolV2GuardCallFailure) Unwrap() error

type ProtocolV2GuardFailureKind

type ProtocolV2GuardFailureKind string
const (
	ProtocolV2GuardFailureDenied   ProtocolV2GuardFailureKind = "denied"
	ProtocolV2GuardFailureCrash    ProtocolV2GuardFailureKind = "crash"
	ProtocolV2GuardFailureTimeout  ProtocolV2GuardFailureKind = "timeout"
	ProtocolV2GuardFailureProtocol ProtocolV2GuardFailureKind = "protocol"
	ProtocolV2GuardFailureCanceled ProtocolV2GuardFailureKind = "canceled"
)

type ProtocolV2GuardRequest

type ProtocolV2GuardRequest struct {
	GuardID              string
	GuardContractVersion string
	RouteID              string
	RouteContractVersion string
	Method               string
	Path                 string
	Headers              http.Header
	PathParameters       map[string]string
	QueryParameters      map[string]string
	QueryParameterValues map[string][]string
	RequestSchema        string
	Body                 map[string]any
	BodyPresent          bool
	Authority            ProtocolV2RequestAuthority
	Actor                *ProtocolV2RouteActor
	CorrelationID        string
	Timeout              time.Duration
}

ProtocolV2GuardRequest binds a custom guard to one exact frozen route. The request headers are projected only after the exact frozen guard and explicit Host authority agree.

type ProtocolV2HostRegistrar

type ProtocolV2HostRegistrar interface {
	RegisterProtocolV2(grpc.ServiceRegistrar)
}

ProtocolV2HostRegistrar registers host-owned generated services on one runtime-scoped broker server. Authentication remains owned by the runtime.

type ProtocolV2InvocationActor

type ProtocolV2InvocationActor struct {
	UserID         int64
	PermissionKeys []string
}

ProtocolV2InvocationActor is Host-authored request authority shared by route and admin invocations. Plugin output can never add actor or permission data.

func NewProtocolV2InvocationActor

func NewProtocolV2InvocationActor(userID int64, authenticated bool, permissions map[string]bool) *ProtocolV2InvocationActor

type ProtocolV2ProviderBroker

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

func NewProtocolV2ProviderBroker

func NewProtocolV2ProviderBroker(manager *Manager, revalidate HookDocumentRevalidator) (*ProtocolV2ProviderBroker, error)

func (*ProtocolV2ProviderBroker) InvokeProtocolV2Provider

type ProtocolV2RequestAuthority

type ProtocolV2RequestAuthority struct {
	Mode      ProtocolV2RequestAuthorityMode
	GuardKind ProtocolV2RequestGuardKind
}

func ProtocolV2RouteRequestAuthority

func ProtocolV2RouteRequestAuthority(
	route extensions.ManifestRoute,
	guards []extensions.ManifestGuard,
) (ProtocolV2RequestAuthority, error)

ProtocolV2RouteRequestAuthority 返回一条清单路由在 Protocol V2 线路上冻结的请求权威。

宿主侧所有 V2 入口(声明路由派发、legacy 代理前缀回落)必须用这一份实现推导: 运行时会用同一份清单重算并逐字段比对,推导结果不一致的调用只会被 ErrProtocolV2RequestAuthorityInvalid 拒绝,而不是被悄悄降级成另一种权威。

type ProtocolV2RequestAuthorityMode

type ProtocolV2RequestAuthorityMode string
const (
	ProtocolV2RequestAuthorityFiltered ProtocolV2RequestAuthorityMode = "filtered"
	ProtocolV2RequestAuthorityRaw      ProtocolV2RequestAuthorityMode = "raw"
)

type ProtocolV2RequestGuardKind

type ProtocolV2RequestGuardKind string
const (
	ProtocolV2RequestGuardHost       ProtocolV2RequestGuardKind = "host"
	ProtocolV2RequestGuardCustom     ProtocolV2RequestGuardKind = "custom"
	ProtocolV2RequestGuardRawRequest ProtocolV2RequestGuardKind = "raw_request"
)

type ProtocolV2RouteActor

type ProtocolV2RouteActor = ProtocolV2InvocationActor

ProtocolV2RouteActor preserves the route transport API name.

func NewProtocolV2RouteActor

func NewProtocolV2RouteActor(userID int64, authenticated bool, permissions map[string]bool) *ProtocolV2RouteActor

NewProtocolV2RouteActor converts an authenticated Host dispatch snapshot to the wire actor. Anonymous and inactive actors are represented by nil.

type ProtocolV2RouteInvocationStage

type ProtocolV2RouteInvocationStage string
const (
	ProtocolV2RouteInvocationStageHandler  ProtocolV2RouteInvocationStage = "handler"
	ProtocolV2RouteInvocationStageRequest  ProtocolV2RouteInvocationStage = "request"
	ProtocolV2RouteInvocationStageResponse ProtocolV2RouteInvocationStage = "response"
)

type ProtocolV2RoutePatchKind

type ProtocolV2RoutePatchKind string
const (
	ProtocolV2RoutePatchAdd     ProtocolV2RoutePatchKind = "add"
	ProtocolV2RoutePatchReplace ProtocolV2RoutePatchKind = "replace"
	ProtocolV2RoutePatchRemove  ProtocolV2RoutePatchKind = "remove"
)

type ProtocolV2RoutePatchOperation

type ProtocolV2RoutePatchOperation struct {
	Kind  ProtocolV2RoutePatchKind
	Path  string
	Value json.RawMessage
}

ProtocolV2RoutePatchOperation is decoded transport data. Routes remains authoritative for applying the ordered operations to Host-owned documents.

type ProtocolV2RouteRequest

type ProtocolV2RouteRequest struct {
	RouteID               string
	ContractVersion       string
	RouteAction           string
	InvocationStage       ProtocolV2RouteInvocationStage
	Method                string
	Path                  string
	Headers               http.Header
	PathParameters        map[string]string
	QueryParameters       map[string]string
	QueryParameterValues  map[string][]string
	RequestSchema         string
	ResponseSchema        string
	MutableRequestFields  []string
	MutableResponseFields []string
	Body                  map[string]any
	BodyPresent           bool
	PriorResponse         *ProtocolV2RouteResponseDocument
	Authority             ProtocolV2RequestAuthority
	Actor                 *ProtocolV2RouteActor
	IdempotencyKey        string
	CorrelationID         string
	Timeout               time.Duration
}

ProtocolV2RouteRequest is transport-neutral and binds one unary call to the immutable Route Registry step selected by the Host.

type ProtocolV2RouteResponse

type ProtocolV2RouteResponse struct {
	StatusCode    int
	Headers       http.Header
	Body          map[string]any
	BodyPresent   bool
	StreamFollows bool
	RequestPatch  []ProtocolV2RoutePatchOperation
	ResponsePatch []ProtocolV2RoutePatchOperation
}

type ProtocolV2RouteResponseDocument

type ProtocolV2RouteResponseDocument struct {
	StatusCode  int
	Headers     http.Header
	Body        map[string]any
	BodyPresent bool
}

type ProtocolV2RouteStream

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

ProtocolV2RouteStream owns the child deadline until the peer sends a valid terminal frame or the Host explicitly cancels the stream.

func (*ProtocolV2RouteStream) Cancel

func (s *ProtocolV2RouteStream) Cancel()

Cancel propagates browser disconnects and Host shutdown to the gRPC stream.

func (*ProtocolV2RouteStream) CloseRequest

func (s *ProtocolV2RouteStream) CloseRequest() error

CloseRequest half-closes the Host request direction while leaving the peer response readable. A final data chunk is optional for an empty request body.

func (*ProtocolV2RouteStream) Context

func (s *ProtocolV2RouteStream) Context() context.Context

func (*ProtocolV2RouteStream) Recv

func (*ProtocolV2RouteStream) Response

func (*ProtocolV2RouteStream) Send

func (s *ProtocolV2RouteStream) Send(data []byte, final bool) error

Send copies one bounded request chunk. Sequence and checksum are authored by the Host so plugins cannot exploit caller-controlled framing metadata.

type ProtocolV2RouteStreamChunk

type ProtocolV2RouteStreamChunk struct {
	Sequence uint64
	Data     []byte
	Final    bool
}

type ProtocolV2RouteStreamRequest

type ProtocolV2RouteStreamRequest struct {
	RouteID         string
	ContractVersion string
	Method          string
	Path            string
	Mode            string
	Headers         http.Header
	Authority       ProtocolV2RequestAuthority
	Actor           *ProtocolV2RouteActor
	IdempotencyKey  string
	CorrelationID   string
	Timeout         time.Duration
}

ProtocolV2RouteStreamRequest binds a bidirectional stream to one exact non-buffered route declaration. Path may include the raw query because the v2 stream open frame deliberately carries the original request target.

type ProtocolV2RouteStreamResponse

type ProtocolV2RouteStreamResponse struct {
	StatusCode int
	Headers    http.Header
}

type ProtocolV2SEOApplyRequest

type ProtocolV2SEOApplyRequest struct {
	Scope        string                    `json:"scope"`
	Contribution ProtocolV2SEOContribution `json:"contribution"`
	Current      seoregistry.Document      `json:"current"`
}

type ProtocolV2SEOApplyResponse

type ProtocolV2SEOApplyResponse struct {
	Document seoregistry.Document `json:"document"`
}

type ProtocolV2SEOContribution

type ProtocolV2SEOContribution struct {
	ID              string `json:"id"`
	ContractVersion string `json:"contractVersion"`
	Scope           string `json:"scope"`
	Kind            string `json:"kind"`
	Action          string `json:"action"`
	Handler         string `json:"handler"`
	Priority        int    `json:"priority,omitempty"`
	FailurePolicy   string `json:"failurePolicy"`
	TimeoutMS       int    `json:"timeoutMs"`
}

ProtocolV2SEOContribution is the public wire projection of a frozen SEO declaration. Exact artifact identity remains in RequestContext and the Host admission lease; PostgreSQL ids and trust digests are not duplicated through google.protobuf.Struct numbers.

type ProtocolV2ServerConfig

type ProtocolV2ServerConfig = pluginv2sdk.ServeOptions

ProtocolV2ServerConfig is retained for Host-side compatibility. Plugin subprocesses own this transport contract through the public SDK.

type ProviderProbeRequest

type ProviderProbeRequest struct {
	Slot string
}

type ProviderProbeResponse

type ProviderProbeResponse struct {
	OK          bool
	Reason      string
	Message     string
	Details     map[string]string
	Suggestions []string
}

type ProviderRegistry

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

func NewProviderRegistry

func NewProviderRegistry() *ProviderRegistry

func (*ProviderRegistry) RestoreDefault

func (r *ProviderRegistry) RestoreDefault(slot string)

func (*ProviderRegistry) Select

func (r *ProviderRegistry) Select(slot string, selection ProviderSelection)

func (*ProviderRegistry) Selected

func (r *ProviderRegistry) Selected(slot string) ProviderSelection

type ProviderSelection

type ProviderSelection struct {
	ExtensionID string
	Label       string
}

type ProviderSlotCaller

type ProviderSlotCaller struct {
	ExtensionID       string
	ExtensionVersion  string
	ArtifactDigest    string
	RuntimeInstanceID string
	Attested          bool
}

type ProviderSlotCandidate

type ProviderSlotCandidate struct {
	ID       string       `json:"id"`
	TargetID string       `json:"targetId"`
	Label    string       `json:"label"`
	Handler  string       `json:"handler"`
	Priority int          `json:"priority"`
	Artifact HookArtifact `json:"artifact"`
	// contains filtered or unexported fields
}

type ProviderSlotContract

type ProviderSlotContract struct {
	ID                   string       `json:"id"`
	Slot                 string       `json:"slot"`
	ContractVersion      string       `json:"contractVersion"`
	RequestSchema        string       `json:"requestSchema"`
	ResponseSchema       string       `json:"responseSchema"`
	RequestSchemaDigest  string       `json:"requestSchemaDigest,omitempty"`
	ResponseSchemaDigest string       `json:"responseSchemaDigest,omitempty"`
	Fallback             string       `json:"fallback"`
	TimeoutMS            int          `json:"timeoutMs"`
	Artifact             HookArtifact `json:"artifact"`
	// contains filtered or unexported fields
}

type ProviderSlotProbeResult

type ProviderSlotProbeResult struct {
	ContractID  string            `json:"contractId"`
	CandidateID string            `json:"candidateId"`
	Artifact    HookArtifact      `json:"artifact"`
	OK          bool              `json:"ok"`
	Reason      string            `json:"reason"`
	Message     string            `json:"message"`
	Details     map[string]string `json:"details,omitempty"`
	Suggestions []string          `json:"suggestions,omitempty"`
	DurationMS  int64             `json:"durationMs"`
}

type ProviderSlotRegistrySnapshot

type ProviderSlotRegistrySnapshot struct {
	Revision   uint64                  `json:"revision"`
	Contracts  []ProviderSlotContract  `json:"contracts"`
	Candidates []ProviderSlotCandidate `json:"candidates"`
}

type ProviderSlotResolution

type ProviderSlotResolution struct {
	Revision   uint64
	Contract   ProviderSlotContract
	Candidates []ProviderSlotCandidate
}

type ProviderSlotSelection

type ProviderSlotSelection struct {
	ContractID        string       `json:"contractId"`
	ContractVersion   string       `json:"contractVersion"`
	Slot              string       `json:"slot"`
	ContractArtifact  HookArtifact `json:"contractArtifact"`
	ContractVersionID int64        `json:"-"`
	CandidateID       string       `json:"candidateId"`
	ProviderArtifact  HookArtifact `json:"providerArtifact"`
	ProviderVersionID int64        `json:"-"`
	SelectedByUserID  int64        `json:"selectedByUserId"`
	SelectionAuditID  int64        `json:"selectionAuditEventId"`
	Revision          int64        `json:"revision"`
	SelectedAt        time.Time    `json:"selectedAt"`
	UpdatedAt         time.Time    `json:"updatedAt"`
}

type ProviderSlotSelectionAPI

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

ProviderSlotSelectionAPI validates every write against one immutable registry snapshot. The store then binds the chosen pair to active immutable extension-version rows with a revision compare-and-swap.

func (*ProviderSlotSelectionAPI) Current

func (*ProviderSlotSelectionAPI) Events

func (a *ProviderSlotSelectionAPI) Events(ctx context.Context, contractID string, limit int) ([]ProviderSlotSelectionEvent, error)

func (*ProviderSlotSelectionAPI) InvalidateExtension

func (a *ProviderSlotSelectionAPI) InvalidateExtension(ctx context.Context, request InvalidateProviderSlotRequest) (int64, error)

func (*ProviderSlotSelectionAPI) InvalidateProviderSlotSelections

func (a *ProviderSlotSelectionAPI) InvalidateProviderSlotSelections(
	ctx context.Context,
	extensionID string,
	actorUserID int64,
	auditEventID int64,
	reasonCode string,
) error

InvalidateProviderSlotSelections is the narrow lifecycle adapter used by Models/Extensions without importing registry or PostgreSQL implementation details.

func (*ProviderSlotSelectionAPI) Reset

func (*ProviderSlotSelectionAPI) Resolve

func (a *ProviderSlotSelectionAPI) Resolve(ctx context.Context, caller ProviderSlotCaller, contractID, contractVersion string) (ProviderSlotResolution, string, error)

func (*ProviderSlotSelectionAPI) Select

func (a *ProviderSlotSelectionAPI) Select(ctx context.Context, contractID, candidateID string, expectedRevision, actorUserID, auditEventID int64) (ProviderSlotSelection, error)

type ProviderSlotSelectionEvent

type ProviderSlotSelectionEvent struct {
	ID                int64                  `json:"id"`
	ContractID        string                 `json:"contractId"`
	ContractVersion   string                 `json:"contractVersion"`
	Slot              string                 `json:"slot"`
	Action            string                 `json:"action"`
	PreviousSelection *ProviderSlotSelection `json:"previousSelection,omitempty"`
	SelectedSelection *ProviderSlotSelection `json:"selectedSelection,omitempty"`
	ActorUserID       int64                  `json:"actorUserId,omitempty"`
	AuditEventID      int64                  `json:"auditEventId"`
	ReasonCode        string                 `json:"reasonCode,omitempty"`
	SelectionRevision int64                  `json:"selectionRevision"`
	CreatedAt         time.Time              `json:"createdAt"`
}

type ProxyInput

type ProxyInput = extensionprotocol.ProxyInput

type ResetComponentProviderRequest

type ResetComponentProviderRequest struct {
	TargetID              string
	TargetContractVersion string
	ExpectedRevision      uint64
}

type ResetProviderSlotRequest

type ResetProviderSlotRequest struct {
	ContractID       string
	ExpectedRevision int64
	ActorUserID      int64
	AuditEventID     int64
	ReasonCode       string
}

type ResilienceConfig

type ResilienceConfig struct {
	MaxConcurrent         int
	FailureThreshold      int
	CircuitOpenFor        time.Duration
	DefaultMailTimeout    time.Duration
	DefaultStorageTimeout time.Duration
}

ResilienceConfig 控制每扩展 RPC 闸门与熔断。

type ResolvingSearchEngine

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

ResolvingSearchEngine 按运营选择解析 search.provider。 站内默认(sforum.search-site)短路到进程内 site 引擎;外部插件走 RPC。

func NewResolvingSearchEngine

func NewResolvingSearchEngine(registry *SearchProviderRegistry, runtime SearchRuntime, site search.Engine) *ResolvingSearchEngine

NewResolvingSearchEngine 构造解析引擎。site 为站内引擎(必填生产路径);nil 时站内回落 Unavailable。

func (*ResolvingSearchEngine) Delete

func (e *ResolvingSearchEngine) Delete(ctx context.Context, topicID int64) error

func (*ResolvingSearchEngine) Enabled

func (e *ResolvingSearchEngine) Enabled(ctx context.Context) bool

Enabled 站内默认始终可用;外部 pin 时只要 Selected 成功即 true。

func (*ResolvingSearchEngine) EnsureIndex

func (e *ResolvingSearchEngine) EnsureIndex(ctx context.Context) error

func (*ResolvingSearchEngine) Index

func (*ResolvingSearchEngine) Probe

func (*ResolvingSearchEngine) Search

func (*ResolvingSearchEngine) SelectedID

func (e *ResolvingSearchEngine) SelectedID(ctx context.Context) (string, bool, error)

SelectedID 返回当前解析到的扩展 id。

type RouteGateway

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

func NewRouteGateway

func NewRouteGateway() *RouteGateway

func (*RouteGateway) Proxy

func (g *RouteGateway) Proxy(input *ProxyInput) error

type RouteTarget

type RouteTarget = extensionprotocol.RouteTarget

type RuntimeCallClass

type RuntimeCallClass = extensionruntime.RuntimeCallClass

type RuntimeEventsProviders

type RuntimeEventsProviders struct {
	*Manager
	// contains filtered or unexported fields
}

func (*RuntimeEventsProviders) AdminSurfaceSnapshot

func (m *RuntimeEventsProviders) AdminSurfaceSnapshot(kind string) AdminSurfaceRegistrySnapshot

AdminSurfaceSnapshot returns only contracts whose exact runtime instance is active and accepting ordinary calls. The immutable registry may already hold a drained target during lifecycle publication, but consumers must not observe it before the durable lifecycle marker opens admission.

func (*RuntimeEventsProviders) Deliver

func (m *RuntimeEventsProviders) Deliver(ctx context.Context, extensionID string, deliveryID int64, envelope appevents.Envelope) appevents.Result

func (*RuntimeEventsProviders) Emit

func (*RuntimeEventsProviders) EmitHook

func (m *RuntimeEventsProviders) EmitHook(ctx context.Context, name string, payload map[string]any)

func (*RuntimeEventsProviders) HookBus

func (m *RuntimeEventsProviders) HookBus() *HookBus

HookBus exposes the Manager-owned exact hook snapshot to the lifecycle aggregate. Callers must still use Manager admission for execution.

func (*RuntimeEventsProviders) InvokeVersionedHook

InvokeVersionedHook composes one frozen listener chain. A filter cannot run without a Host revalidator, and every accepted patch is rechecked before the next listener observes it.

func (*RuntimeEventsProviders) ProbeProviderSlotCandidate

func (m *RuntimeEventsProviders) ProbeProviderSlotCandidate(ctx context.Context, contractID, candidateID string) (ProviderSlotProbeResult, error)

ProbeProviderSlotCandidate checks the active exact runtime through the provider's side-effect-free probe RPC. It never sends a business invocation document and therefore cannot accidentally create provider-owned work.

func (*RuntimeEventsProviders) ProtocolV2ProviderBroker

func (m *RuntimeEventsProviders) ProtocolV2ProviderBroker() (hostapi.ProtocolV2ProviderBroker, error)

func (*RuntimeEventsProviders) ProviderSlotInspection

func (*RuntimeEventsProviders) ProviderSlotSelections

func (m *RuntimeEventsProviders) ProviderSlotSelections() *ProviderSlotSelectionAPI

func (*RuntimeEventsProviders) ResolveAdminSurface

func (m *RuntimeEventsProviders) ResolveAdminSurface(id string) (AdminSurfaceContract, error)

ResolveAdminSurface applies the same exact-runtime visibility fence as the catalog read. Invocation still acquires admission after resolution so a concurrent drain fails closed.

type RuntimeInvoker

type RuntimeInvoker struct{ *Manager }

func (*RuntimeInvoker) ExecutePluginCommand

func (m *RuntimeInvoker) ExecutePluginCommand(
	ctx context.Context,
	commandID string,
	input map[string]any,
	safeMode bool,
) (PluginCommandExecutionResult, error)

ExecutePluginCommand resolves an immutable Registry contract, validates both typed documents, and holds exact runtime admission for the complete RPC.

func (*RuntimeInvoker) ExecutePluginJob

func (m *RuntimeInvoker) ExecutePluginJob(ctx context.Context, invocation supportjobs.PluginJobInvocation) error

ExecutePluginJob rechecks the running manifest immediately before transport dispatch so an upgrade cannot race a worker's earlier database resolution.

func (*RuntimeInvoker) FilterQueryResultInstance

func (m *RuntimeInvoker) FilterQueryResultInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedQueryResultFilterRequest,
) ([]queryregistry.QueryRow, error)

FilterQueryResultInstance has the same exact-instance boundary as the owner query call; cross-plugin filters therefore cannot drift to a replacement.

func (*RuntimeInvoker) InvokeAdminSurface

InvokeAdminSurface resolves one exact Registry contract and holds runtime admission while the typed props/result round trip crosses Protocol V2.

func (*RuntimeInvoker) InvokeGuardInstance

func (m *RuntimeInvoker) InvokeGuardInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2GuardRequest,
) error

InvokeGuardInstance uses only the exact process selected by the immutable Route Registry step. The caller owns the separate guard admission lease.

func (*RuntimeInvoker) InvokeQueryInstance

func (m *RuntimeInvoker) InvokeQueryInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	extension extensions.Extension,
	request VersionedQueryRequest,
) ([]queryregistry.QueryRow, error)

InvokeQueryInstance dispatches through the exact process protected by the caller's Manager admission lease. It never falls back to the active pointer.

func (*RuntimeInvoker) InvokeRouteInstance

func (m *RuntimeInvoker) InvokeRouteInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2RouteRequest,
) (ProtocolV2RouteResponse, error)

InvokeRouteInstance dispatches through the exact process selected by a caller that already owns the Manager route admission lease. It must not open another lease, otherwise drain accounting becomes double-counted.

func (*RuntimeInvoker) InvokeVersionedProvider

func (*RuntimeInvoker) OpenRouteStreamInstance

func (m *RuntimeInvoker) OpenRouteStreamInstance(
	ctx context.Context,
	identity RuntimeInstanceIdentity,
	request ProtocolV2RouteStreamRequest,
) (*ProtocolV2RouteStream, error)

OpenRouteStreamInstance delegates only after the caller has acquired the exact runtime's route admission lease. The stream lifetime therefore remains visible to drain and upgrade coordination without double-counting leases.

func (*RuntimeInvoker) ProbeSettingsAction

ProbeSettingsAction starts an isolated short-lived RPC runtime. It receives no Host API token and is never registered in Manager routes, hooks, jobs, schedules, or providers.

两条探测路径共用一个方法:provider_probe 走 provider slot,ai_tool_probe 走 插件自己声明的 AI 工具(保留槽 sforum.ai.tool/invoke)。请求对象化是为了不 触碰 RuntimeInvoker 的接收者方法数基线。

func (*RuntimeInvoker) RefreshMailProvider

func (m *RuntimeInvoker) RefreshMailProvider(ctx context.Context, extensionID string) error

func (*RuntimeInvoker) SearchEngineDelete

func (m *RuntimeInvoker) SearchEngineDelete(ctx context.Context, extensionID string, request SearchEngineDeleteRequest) (SearchEngineResult, error)

func (*RuntimeInvoker) SearchEngineEnsure

func (m *RuntimeInvoker) SearchEngineEnsure(ctx context.Context, extensionID string) (SearchEngineResult, error)

func (*RuntimeInvoker) SearchEngineIndex

func (m *RuntimeInvoker) SearchEngineIndex(ctx context.Context, extensionID string, request SearchEngineIndexRequest) (SearchEngineResult, error)

func (*RuntimeInvoker) SearchEngineProbe

func (m *RuntimeInvoker) SearchEngineProbe(ctx context.Context, extensionID string, request SearchEngineProbeRequest) (SearchEngineProbeResponse, error)

func (*RuntimeInvoker) SearchEngineSearch

func (m *RuntimeInvoker) SearchEngineSearch(ctx context.Context, extensionID string, request SearchEngineSearchRequest) (SearchEngineSearchResponse, error)

func (*RuntimeInvoker) SendMail

func (m *RuntimeInvoker) SendMail(ctx context.Context, extensionID string, request MailProviderRequest) (MailProviderResponse, error)

func (*RuntimeInvoker) StorageClose

func (m *RuntimeInvoker) StorageClose(ctx context.Context, extensionID string, request StorageCloseRequest) (StorageResult, error)

func (*RuntimeInvoker) StorageDelete

func (m *RuntimeInvoker) StorageDelete(ctx context.Context, extensionID string, request StorageObjectRequest) (StorageResult, error)

func (*RuntimeInvoker) StorageExists

func (m *RuntimeInvoker) StorageExists(ctx context.Context, extensionID string, request StorageExistsRequest) (StorageExistsResponse, error)

func (*RuntimeInvoker) StorageGetChunk

func (m *RuntimeInvoker) StorageGetChunk(ctx context.Context, extensionID string, request StorageGetChunkRequest) (StorageGetChunkResponse, error)

func (*RuntimeInvoker) StorageOpen

func (m *RuntimeInvoker) StorageOpen(ctx context.Context, extensionID string, request StorageOpenRequest) (StorageSessionResponse, error)

func (*RuntimeInvoker) StorageProbe

func (m *RuntimeInvoker) StorageProbe(ctx context.Context, extensionID string, request StorageProbeRequest) (StorageProbeResponse, error)

func (*RuntimeInvoker) StoragePublicURL

func (m *RuntimeInvoker) StoragePublicURL(ctx context.Context, extensionID string, request StoragePublicURLRequest) (StorageURLResponse, error)

func (*RuntimeInvoker) StoragePutBegin

func (m *RuntimeInvoker) StoragePutBegin(ctx context.Context, extensionID string, request StoragePutBeginRequest) (StorageSessionResponse, error)

func (*RuntimeInvoker) StoragePutChunk

func (m *RuntimeInvoker) StoragePutChunk(ctx context.Context, extensionID string, request StoragePutChunkRequest) (StorageResult, error)

func (*RuntimeInvoker) StorageSignedURL

func (m *RuntimeInvoker) StorageSignedURL(ctx context.Context, extensionID string, request StorageSignedURLRequest) (StorageURLResponse, error)

func (*RuntimeInvoker) StorageStat

func (m *RuntimeInvoker) StorageStat(ctx context.Context, extensionID string, request StorageStatRequest) (StorageStatResponse, error)

type RuntimeRegistryGenerationSnapshot

type RuntimeRegistryGenerationSnapshot struct {
	Generation           uint64
	PublicationRevision  int64
	RuntimeMembers       []RuntimeInstanceIdentity
	HookMembers          []RuntimeInstanceIdentity
	ProviderMembers      []RuntimeInstanceIdentity
	CommandMembers       []RuntimeInstanceIdentity
	AdminSurfaceMembers  []RuntimeInstanceIdentity
	HookRevision         uint64
	ProviderRevision     uint64
	CommandRevision      uint64
	AdminSurfaceRevision uint64
}

RuntimeRegistryGenerationSnapshot is one outer-lock observation of every Manager-owned HookBus registry family. Individual registries stay available for compatibility, while coordinators and inspectors can pin one generation.

type RuntimeSupervisor

type RuntimeSupervisor struct{ *Manager }

func (*RuntimeSupervisor) Check

func (m *RuntimeSupervisor) Check(_ context.Context, extension extensions.Extension) error

func (*RuntimeSupervisor) Close

func (m *RuntimeSupervisor) Close(ctx context.Context)

func (*RuntimeSupervisor) Reconcile

func (m *RuntimeSupervisor) Reconcile(ctx context.Context, items []extensions.Extension)

func (*RuntimeSupervisor) RouteTarget

func (m *RuntimeSupervisor) RouteTarget(extensionID string) (RouteTarget, bool)

func (*RuntimeSupervisor) Start

func (m *RuntimeSupervisor) Start(ctx context.Context, extension extensions.Extension) error

func (*RuntimeSupervisor) Status

func (*RuntimeSupervisor) Stop

func (m *RuntimeSupervisor) Stop(ctx context.Context, extension extensions.Extension) error

type RuntimeTrustSource

type RuntimeTrustSource interface {
	RuntimeIdentity(context.Context, extensions.Extension) (extensions.RuntimeTrustIdentity, error)
}

RuntimeTrustSource resolves the live exact-artifact grant before process start. The wire identity is disclosure only; this host lookup is authoritative.

type SearchEngineDeleteRequest

type SearchEngineDeleteRequest struct {
	TopicID int64
}

SearchEngineDeleteRequest 按主题 id 删除。

type SearchEngineIndexRequest

type SearchEngineIndexRequest struct {
	Document search.TopicSearchDoc
}

SearchEngineIndexRequest 写入一篇主题文档。

type SearchEngineInvoker

SearchEngineInvoker 由 ProtocolStarter 实现,供 Manager 做准入后转发。

type SearchEngineProbeRequest

type SearchEngineProbeRequest struct{}

SearchEngineProbeRequest 预留;当前无输入。

type SearchEngineProbeResponse

type SearchEngineProbeResponse struct {
	OK      bool
	Reason  string
	Message string
}

SearchEngineProbeResponse 探测结果。

type SearchEngineResult

type SearchEngineResult struct {
	OK      bool
	Reason  string
	Message string
}

SearchEngineResult 无载荷写操作结果。

type SearchEngineSearchRequest

type SearchEngineSearchRequest struct {
	Query        string
	CategorySlug string
	TagSlug      string
	Page         int
	PerPage      int
}

SearchEngineSearchRequest / SearchEngineSearchResponse 公开检索。

type SearchEngineSearchResponse

type SearchEngineSearchResponse struct {
	OK      bool
	Reason  string
	Message string
	Items   []search.TopicSearchDoc
	Total   int64
	Page    int
	PerPage int
}

type SearchProviderCandidate

type SearchProviderCandidate struct {
	ExtensionID string
	Label       string
	Healthy     bool
	IsDefault   bool
}

SearchProviderCandidate 运营可选的 search.provider 候选。

type SearchProviderRegistry

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

SearchProviderRegistry 管理 search.provider 槽位的运营选择。 默认:受保护内置站内搜索 sforum.search-site(无显式 pin 时始终可用)。

func NewSearchProviderRegistry

func NewSearchProviderRegistry(store SearchProviderStore) *SearchProviderRegistry

func (*SearchProviderRegistry) Candidates

Candidates 列出已启用的 search.provider 候选;始终包含站内默认。

func (*SearchProviderRegistry) IsPinned

func (r *SearchProviderRegistry) IsPinned(ctx context.Context) (bool, error)

IsPinned 是否存在运营显式 pin(与解析后的 Selected 不同:无 pin 时仍可能解析到站内默认)。

func (*SearchProviderRegistry) RestoreDefault

func (r *SearchProviderRegistry) RestoreDefault(ctx context.Context) error

RestoreDefault 清除显式 pin;Selected 随后解析为站内搜索。

func (*SearchProviderRegistry) Select

func (r *SearchProviderRegistry) Select(ctx context.Context, extensionID string) error

func (*SearchProviderRegistry) Selected

type SearchProviderSelection

type SearchProviderSelection struct {
	ExtensionID string
	Label       string
}

type SearchProviderStore

type SearchProviderStore interface {
	GetSearchProviderExtension(context.Context, string) (extensions.Extension, error)
	SelectedSearchProvider(context.Context) (string, error)
	SelectSearchProvider(context.Context, string) error
	RestoreSearchProvider(context.Context) error
	// List 用于在无显式选择时回退到唯一已启用的 search.provider 插件。
	List(context.Context) ([]extensions.Extension, error)
}

type SearchRuntime

type SearchRuntime interface {
	SearchEngineProbe(ctx context.Context, extensionID string, request SearchEngineProbeRequest) (SearchEngineProbeResponse, error)
	SearchEngineEnsure(ctx context.Context, extensionID string) (SearchEngineResult, error)
	SearchEngineIndex(ctx context.Context, extensionID string, request SearchEngineIndexRequest) (SearchEngineResult, error)
	SearchEngineDelete(ctx context.Context, extensionID string, request SearchEngineDeleteRequest) (SearchEngineResult, error)
	SearchEngineSearch(ctx context.Context, extensionID string, request SearchEngineSearchRequest) (SearchEngineSearchResponse, error)
}

SearchRuntime 是插件搜索引擎 RPC 入口(Manager / ProtocolStarter)。

type SelectComponentProviderRequest

type SelectComponentProviderRequest struct {
	TargetID              string
	TargetContractVersion string
	ContributionID        string
	ExpectedRevision      uint64
}

type SelectProviderSlotRequest

type SelectProviderSlotRequest struct {
	Contract         ProviderSlotContract
	Candidate        ProviderSlotCandidate
	ExpectedRevision int64
	ActorUserID      int64
	AuditEventID     int64
}

type StagedRuntimeSetStarter

type StagedRuntimeSetStarter interface {
	StagedRuntimeStarter
	PublishInstanceSet(context.Context, []RuntimeInstanceIdentity) ([]ProtocolRuntimeInstanceSnapshot, *ProtocolRuntimeSetLease, error)
	RuntimeInstanceSetVisible(context.Context, []RuntimeInstanceIdentity) bool
}

StagedRuntimeSetStarter publishes the complete desired V2 process set at one ProtocolStarter and ServiceRegistry linearization boundary.

type StagedRuntimeStarter

StagedRuntimeStarter 是 lifecycle coordinator 使用的 V2 exact-process 最小契约。

type Starter

type Starter interface {
	Start(ctx context.Context, extension extensions.Extension) (RouteTarget, error)
	Stop(ctx context.Context, extension extensions.Extension) error
}

type StorageCloseRequest

type StorageCloseRequest struct {
	SessionID string
}

StorageCloseRequest 关闭读/写会话(Abort 未完成 Put,或释放 Open)。

type StorageConfigureInstanceRequest

type StorageConfigureInstanceRequest struct {
	InstanceID string
	Settings   map[string]string
}

StorageConfigureInstanceRequest installs or replaces one Host-owned provider instance in the running plugin. Settings may contain resolved secrets and must never be logged or included in telemetry.

type StorageExistsRequest

type StorageExistsRequest struct {
	InstanceID string
	Key        string
}

StorageExistsRequest / StorageExistsResponse 存在性查询。

type StorageExistsResponse

type StorageExistsResponse struct {
	OK      bool
	Exists  bool
	Reason  string
	Message string
}

type StorageGetChunkRequest

type StorageGetChunkRequest struct {
	SessionID string
	// MaxBytes 宿主希望的最大块;插件可返回更短。0 表示由插件默认。
	MaxBytes int
}

StorageGetChunkRequest 从读会话拉取下一块。

type StorageGetChunkResponse

type StorageGetChunkResponse struct {
	OK      bool
	Data    []byte
	EOF     bool
	Reason  string
	Message string
}

StorageGetChunkResponse 读块结果;EOF=true 表示无更多数据。

type StorageInstanceInvoker

type StorageInstanceInvoker struct{ *Manager }

StorageInstanceInvoker owns Host-side multi-instance storage calls without growing the legacy Manager or RuntimeInvoker facades.

func (*StorageInstanceInvoker) StorageConfigureInstance

func (m *StorageInstanceInvoker) StorageConfigureInstance(ctx context.Context, extensionID string, request StorageConfigureInstanceRequest) (StorageResult, error)

func (*StorageInstanceInvoker) StorageProbeConfig

func (m *StorageInstanceInvoker) StorageProbeConfig(ctx context.Context, extensionID string, request StorageProbeConfigRequest) (StorageProbeResponse, error)

func (*StorageInstanceInvoker) StorageRemoveInstance

func (m *StorageInstanceInvoker) StorageRemoveInstance(ctx context.Context, extensionID string, request StorageRemoveInstanceRequest) (StorageResult, error)

type StorageInstanceProtocol

type StorageInstanceProtocol interface {
	StorageConfigureInstance(StorageConfigureInstanceRequest) (StorageResult, error)
	StorageRemoveInstance(StorageRemoveInstanceRequest) (StorageResult, error)
	StorageProbeConfig(StorageProbeConfigRequest) (StorageProbeResponse, error)
}

type StorageInstanceRuntime

type StorageInstanceRuntime interface {
	StorageConfigureInstance(ctx context.Context, extensionID string, request StorageConfigureInstanceRequest) (StorageResult, error)
	StorageRemoveInstance(ctx context.Context, extensionID string, request StorageRemoveInstanceRequest) (StorageResult, error)
	StorageProbeConfig(ctx context.Context, extensionID string, request StorageProbeConfigRequest) (StorageProbeResponse, error)
}

type StorageObjectRequest

type StorageObjectRequest struct {
	InstanceID string
	Key        string
}

StorageObjectRequest 仅含对象 key 的操作(Delete)。

type StorageOpenRequest

type StorageOpenRequest struct {
	InstanceID string
	Key        string
}

StorageOpenRequest 按 key 打开对象读会话。

type StorageProbeConfigRequest

type StorageProbeConfigRequest struct {
	Settings map[string]string
}

StorageProbeConfigRequest validates draft configuration without changing the active in-process instance map.

type StorageProbeRequest

type StorageProbeRequest struct {
	InstanceID string
}

StorageProbeRequest / StorageProbeResponse 管理端「测试连接」。

type StorageProbeResponse

type StorageProbeResponse struct {
	OK      bool
	Reason  string
	Message string
}

type StorageProviderInvoker

type StorageProviderInvoker interface {
	StoragePutBegin(ctx context.Context, extensionID string, request StoragePutBeginRequest) (StorageSessionResponse, error)
	StoragePutChunk(ctx context.Context, extensionID string, request StoragePutChunkRequest) (StorageResult, error)
	StorageOpen(ctx context.Context, extensionID string, request StorageOpenRequest) (StorageSessionResponse, error)
	StorageGetChunk(ctx context.Context, extensionID string, request StorageGetChunkRequest) (StorageGetChunkResponse, error)
	StorageClose(ctx context.Context, extensionID string, request StorageCloseRequest) (StorageResult, error)
	StorageDelete(ctx context.Context, extensionID string, request StorageObjectRequest) (StorageResult, error)
	StorageStat(ctx context.Context, extensionID string, request StorageStatRequest) (StorageStatResponse, error)
	StorageExists(ctx context.Context, extensionID string, request StorageExistsRequest) (StorageExistsResponse, error)
	StoragePublicURL(ctx context.Context, extensionID string, request StoragePublicURLRequest) (StorageURLResponse, error)
	StorageSignedURL(ctx context.Context, extensionID string, request StorageSignedURLRequest) (StorageURLResponse, error)
	StorageProbe(ctx context.Context, extensionID string, request StorageProbeRequest) (StorageProbeResponse, error)
	StorageConfigureInstance(ctx context.Context, extensionID string, request StorageConfigureInstanceRequest) (StorageResult, error)
	StorageRemoveInstance(ctx context.Context, extensionID string, request StorageRemoveInstanceRequest) (StorageResult, error)
	StorageProbeConfig(ctx context.Context, extensionID string, request StorageProbeConfigRequest) (StorageProbeResponse, error)
}

StorageProviderInvoker 是 ProtocolStarter / 测试替身对存储 RPC 的宿主入口。 Manager 在闸门/熔断之后调用此接口。

type StoragePublicURLRequest

type StoragePublicURLRequest struct {
	InstanceID string
	Key        string
}

StoragePublicURLRequest / StorageSignedURLRequest / StorageURLResponse URL 辅助。

type StoragePutBeginRequest

type StoragePutBeginRequest struct {
	InstanceID  string
	Key         string
	ContentType string
	// Size 为对象总字节;未知时为 0。宿主在流结束前仍以 Final 标记结束。
	Size int64
}

StoragePutBeginRequest 开启一次 Put 会话。

type StoragePutChunkRequest

type StoragePutChunkRequest struct {
	SessionID string
	Data      []byte
	Final     bool
}

StoragePutChunkRequest 写入一块数据;Final=true 表示对象写完并提交。

type StorageRPCError

type StorageRPCError = extensionruntime.StorageRPCError

StorageRPCError 把插件返回的 !OK 转成带 Reason 的错误,供 Adapter 使用。

type StorageRemoveInstanceRequest

type StorageRemoveInstanceRequest struct {
	InstanceID string
}

type StorageResult

type StorageResult struct {
	OK      bool
	Reason  string
	Message string
}

StorageResult 是无载荷写操作的通用结果(PutChunk / Close / Delete)。

type StorageRuntime

type StorageRuntime interface {
	StoragePutBegin(ctx context.Context, extensionID string, request StoragePutBeginRequest) (StorageSessionResponse, error)
	StoragePutChunk(ctx context.Context, extensionID string, request StoragePutChunkRequest) (StorageResult, error)
	StorageOpen(ctx context.Context, extensionID string, request StorageOpenRequest) (StorageSessionResponse, error)
	StorageGetChunk(ctx context.Context, extensionID string, request StorageGetChunkRequest) (StorageGetChunkResponse, error)
	StorageClose(ctx context.Context, extensionID string, request StorageCloseRequest) (StorageResult, error)
	StorageDelete(ctx context.Context, extensionID string, request StorageObjectRequest) (StorageResult, error)
	StorageStat(ctx context.Context, extensionID string, request StorageStatRequest) (StorageStatResponse, error)
	StorageExists(ctx context.Context, extensionID string, request StorageExistsRequest) (StorageExistsResponse, error)
	StoragePublicURL(ctx context.Context, extensionID string, request StoragePublicURLRequest) (StorageURLResponse, error)
	StorageSignedURL(ctx context.Context, extensionID string, request StorageSignedURLRequest) (StorageURLResponse, error)
	StorageProbe(ctx context.Context, extensionID string, request StorageProbeRequest) (StorageProbeResponse, error)
}

StorageRuntime 是 Attachments / PluginStorageAdapter 依赖的最小 runtime 面。 Manager 实现本接口;bootstrap 把 extensionRuntime 注入附件服务。

type StorageSessionResponse

type StorageSessionResponse struct {
	OK          bool
	SessionID   string
	Size        int64
	ContentType string
	Reason      string
	Message     string
}

StorageSessionResponse 返回会话 id(PutBegin / Open)。

type StorageSignedURLRequest

type StorageSignedURLRequest struct {
	InstanceID string
	Key        string
	TTLSeconds int64
}

type StorageStatRequest

type StorageStatRequest struct {
	InstanceID string
	Key        string
}

StorageStatRequest / StorageStatResponse 元数据查询。

type StorageStatResponse

type StorageStatResponse struct {
	OK           bool
	Exists       bool
	Size         int64
	ContentType  string
	ModifiedUnix int64
	Reason       string
	Message      string
}

type StorageURLResponse

type StorageURLResponse struct {
	OK      bool
	URL     string
	Reason  string
	Message string
}

type VersionedAIToolRequest

type VersionedAIToolRequest struct {
	DeclarationID   string
	ContractVersion string
	Handler         string
	Timeout         time.Duration
	// Name 是模型要求的工具名。它必须与声明一致:宿主不会把一次调用改派给
	// 同一个 handler 下的另一个工具名。
	Name      string
	Arguments string
	// Locale / TopicID / ViewerUserID 是清单 aiTools[].context 声明过的会话事实。
	// 未声明的项保持零值,不会出现在请求文档里——声明即授权,宿主不做隐式披露。
	Locale       string
	TopicID      int64
	ViewerUserID int64
}

VersionedAIToolRequest freezes one tool call to an exact declaration carried by this runtime. The Host never asks the plugin "which tools do you have or what is your timeout" — both come from the frozen manifest declaration.

type VersionedAIToolResponse

type VersionedAIToolResponse struct {
	Content string
	IsError bool
}

VersionedAIToolResponse 是插件给出的结果。

IsError 区分「工具可解释的失败」与「调用本身失败」:前者原样给模型(它可以 据此换参数重试),后者由宿主替换成一句通用说明,避免插件内部错误串借模型之口 发布到社区。

type VersionedContentRequest

type VersionedContentRequest struct {
	DeclarationID   string
	ContractVersion string
	Kind            string
	Handler         string
	Schema          string
	Renderer        string
	Migration       string
	Operation       string
	Timeout         time.Duration
	Input           map[string]any
	// ActorUserID is Host-internal delegation input. It is never serialized in
	// the content call document or RequestContext actor field. Zero is anonymous.
	ActorUserID int64
	// SuppressHostDelegations is Host-internal and never enters the content
	// document. Protected rendering sets it after Host authorization.
	SuppressHostDelegations bool
}

type VersionedContentResponse

type VersionedContentResponse struct {
	Output map[string]any
}

type VersionedHookContract

type VersionedHookContract struct {
	ID              string       `json:"id"`
	Name            string       `json:"name"`
	ContractVersion string       `json:"contractVersion"`
	Kind            string       `json:"kind"`
	InputSchema     string       `json:"inputSchema"`
	ResultSchema    string       `json:"resultSchema,omitempty"`
	Execution       string       `json:"execution"`
	FailurePolicy   string       `json:"failurePolicy"`
	TimeoutMS       int          `json:"timeoutMs"`
	MutableFields   []string     `json:"mutableFields,omitempty"`
	Artifact        HookArtifact `json:"artifact"`
}

type VersionedHookInvocation

type VersionedHookInvocation struct {
	HookID          string
	ContractVersion string
	CorrelationID   string
	Payload         map[string]any
	Revalidate      HookDocumentRevalidator
}

type VersionedHookListener

type VersionedHookListener struct {
	ID       string       `json:"id"`
	TargetID string       `json:"targetId"`
	Handler  string       `json:"handler"`
	Priority int          `json:"priority"`
	Artifact HookArtifact `json:"artifact"`
	// contains filtered or unexported fields
}

type VersionedHookRegistry

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

VersionedHookRegistry publishes one immutable, exact-runtime hook graph. Readers never observe a provider without all of its listeners or vice versa.

func NewVersionedHookRegistry

func NewVersionedHookRegistry() *VersionedHookRegistry

func (*VersionedHookRegistry) RemoveRuntime

func (r *VersionedHookRegistry) RemoveRuntime(extensionID, instanceID string) (bool, error)

func (*VersionedHookRegistry) ReplaceRuntime

func (r *VersionedHookRegistry) ReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*VersionedHookRegistry) Resolve

func (r *VersionedHookRegistry) Resolve(id, contractVersion string) (VersionedHookContract, []VersionedHookListener, error)

func (*VersionedHookRegistry) Snapshot

func (*VersionedHookRegistry) ValidateRemoveRuntime

func (r *VersionedHookRegistry) ValidateRemoveRuntime(extensionID, instanceID string) error

func (*VersionedHookRegistry) ValidateReplaceRuntime

func (r *VersionedHookRegistry) ValidateReplaceRuntime(extension extensions.Extension, instanceID string) error

type VersionedHookRegistrySnapshot

type VersionedHookRegistrySnapshot struct {
	Revision  uint64                  `json:"revision"`
	Contracts []VersionedHookContract `json:"contracts"`
	Listeners []VersionedHookListener `json:"listeners"`
}

type VersionedHookResult

type VersionedHookResult struct {
	OK      bool
	Reason  string
	Message string
	Payload map[string]any
	Results []map[string]any
	Queued  int
}

type VersionedIdentityProviderRequest

type VersionedIdentityProviderRequest struct {
	ProviderID                string
	ContractVersion           string
	Kind                      string
	Handler                   string
	Priority                  int
	Operation                 string
	InputSchema               string
	InputSchemaWireReference  string
	OutputSchema              string
	OutputSchemaWireReference string
	Timeout                   time.Duration
	FailurePolicy             string
	ActorUserID               int64
	Input                     map[string]any
}

VersionedIdentityProviderRequest keeps the package declaration reference and the Registry-derived wire reference separate. Package-path Schemas are valid Manifest material but TypedDocument always carries the canonical id@version.

type VersionedIdentityProviderResponse

type VersionedIdentityProviderResponse struct {
	Output map[string]any
}

type VersionedProviderInvocation

type VersionedProviderInvocation struct {
	Caller          ProviderSlotCaller
	SlotID          string
	ContractVersion string
	Operation       string
	InputSchema     string
	Input           map[string]any
	Revalidate      HookDocumentRevalidator
}

type VersionedProviderInvocationResult

type VersionedProviderInvocationResult struct {
	ProviderID        string
	ExtensionID       string
	ProviderArtifact  HookArtifact
	RuntimeInstanceID string
	ResponseSchema    string
	Output            map[string]any
	Attempts          int
}

type VersionedProviderRequest

type VersionedProviderRequest struct {
	DeclarationID   string
	Slot            string
	ContractVersion string
	Operation       string
	RequestSchema   string
	ResponseSchema  string
	Timeout         time.Duration
	Input           map[string]any
}

type VersionedProviderResponse

type VersionedProviderResponse struct {
	Output map[string]any
}

type VersionedProviderSlotRegistry

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

func NewVersionedProviderSlotRegistry

func NewVersionedProviderSlotRegistry() *VersionedProviderSlotRegistry

func (*VersionedProviderSlotRegistry) Discover

func (r *VersionedProviderSlotRegistry) Discover(
	caller ProviderSlotCaller,
	id, contractVersion string,
) (ProviderSlotResolution, error)

func (*VersionedProviderSlotRegistry) HasCompiledSchemas

func (r *VersionedProviderSlotRegistry) HasCompiledSchemas(id, contractVersion string) bool

func (*VersionedProviderSlotRegistry) HasContract

func (r *VersionedProviderSlotRegistry) HasContract(id, contractVersion string) bool

func (*VersionedProviderSlotRegistry) RemoveRuntime

func (r *VersionedProviderSlotRegistry) RemoveRuntime(extensionID, instanceID string) (bool, error)

func (*VersionedProviderSlotRegistry) ReplaceRuntime

func (r *VersionedProviderSlotRegistry) ReplaceRuntime(extension extensions.Extension, instanceID string) error

func (*VersionedProviderSlotRegistry) Snapshot

func (*VersionedProviderSlotRegistry) ValidateDocument

func (r *VersionedProviderSlotRegistry) ValidateDocument(contractID, schema string, document map[string]any) error

func (*VersionedProviderSlotRegistry) ValidateRemoveRuntime

func (r *VersionedProviderSlotRegistry) ValidateRemoveRuntime(extensionID, instanceID string) error

func (*VersionedProviderSlotRegistry) ValidateReplaceRuntime

func (r *VersionedProviderSlotRegistry) ValidateReplaceRuntime(extension extensions.Extension, instanceID string) error

type VersionedQueryRequest

type VersionedQueryRequest struct {
	QueryID         string
	ContractVersion string
	PlanVersion     string
	ResultSchema    string
	Handler         string
	Plan            queryregistry.QueryPlan
	FetchLimit      int
	Timeout         time.Duration
}

VersionedQueryRequest is the Host-normalized InvokeQuery projection.

type VersionedQueryResultFilterRequest

type VersionedQueryResultFilterRequest struct {
	FilterID              string
	FilterContractVersion string
	QueryID               string
	QueryContractVersion  string
	QueryPlanVersion      string
	ResultSchema          string
	Handler               string
	Plan                  queryregistry.QueryPlan
	Rows                  []queryregistry.QueryRow
	Timeout               time.Duration
}

VersionedQueryResultFilterRequest is the Host-normalized FilterQueryResult projection. Identity and permission material stay on the Host side.

type VersionedSEORequest

type VersionedSEORequest struct {
	DeclarationID   string
	ContractVersion string
	Handler         string
	Timeout         time.Duration
	Input           map[string]any
}

VersionedSEORequest reuses the Protocol V2 ProviderCall transport while freezing dispatch to one exact Manifest SEO declaration. Input and output remain typed documents; plugins never receive raw request/session authority.

type VersionedSEOResponse

type VersionedSEOResponse struct {
	Output map[string]any
}

Source Files

Directories

Path Synopsis
Package pluginprocess 承载插件子进程的平台级启动约束:独立进程组、可用资源 上限与整组回收。
Package pluginprocess 承载插件子进程的平台级启动约束:独立进程组、可用资源 上限与整组回收。

Jump to

Keyboard shortcuts

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