controller

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 133 Imported by: 0

Documentation

Overview

Copyright (c) 2026. MIT License - see LICENSE file for details.

Index

Constants

View Source
const (
	DefaultACPDispatchInterval           = time.Second
	DefaultACPDispatchWorkers            = 4
	DefaultACPIdlePoolTTL                = 15 * time.Minute
	DefaultACPRuntimePoolReservationTTL  = 2 * time.Minute
	DefaultACPRateLimitReconcileInterval = time.Second
)
View Source
const (
	DefaultACPBootstrapMaxMessages     = 64
	DefaultACPBootstrapMaxBytes        = 128 * 1024
	DefaultACPBootstrapMaxMessageBytes = 32 * 1024
)
View Source
const (
	DefaultACPQueueAgingInterval = 30 * time.Second
	DefaultACPQueueMaximumWait   = 5 * time.Minute
)
View Source
const (
	DefaultACPUpgradeDrainBindAddress    = "127.0.0.1:8083"
	DefaultACPUpgradeDrainPath           = "/acp/upgrade-drain"
	DefaultACPUpgradeDrainTimeout        = 5 * time.Minute
	DefaultACPUpgradeDrainPollInterval   = time.Second
	DefaultACPUpgradeDrainTriggerTimeout = 5*time.Minute + 15*time.Second
)
View Source
const (
	// DefaultAgentExecutionSnapshotRetentionInterval is the default cadence for
	// reference-aware encrypted snapshot collection.
	DefaultAgentExecutionSnapshotRetentionInterval = time.Hour
	// DefaultAgentExecutionSnapshotRetention is the minimum audit/backup
	// retention period before an unreferenced snapshot becomes collectible.
	DefaultAgentExecutionSnapshotRetention = 30 * 24 * time.Hour
)
View Source
const (
	// AgentSandboxWarmPoolPolicyDisabled disables pre-created sandbox workspaces.
	AgentSandboxWarmPoolPolicyDisabled = "disabled"
	// AgentSandboxWarmPoolPolicyTemplate allows warm pools to be keyed by workspace template.
	AgentSandboxWarmPoolPolicyTemplate = "template"

	// AgentSandboxNamespaceStrategyTask places sandbox resources in the Task namespace.
	AgentSandboxNamespaceStrategyTask = "task"
	// AgentSandboxNamespaceStrategyController places sandbox resources in the controller namespace.
	AgentSandboxNamespaceStrategyController = "controller"

	// Environment variable names for agent sandbox controller configuration.
	EnvAgentSandboxRouterURL         = "ORKA_AGENT_SANDBOX_ROUTER_URL"
	EnvAgentSandboxDefaultTemplate   = "ORKA_AGENT_SANDBOX_DEFAULT_TEMPLATE"
	EnvAgentSandboxWarmPoolPolicy    = "ORKA_AGENT_SANDBOX_WARM_POOL_POLICY"
	EnvAgentSandboxNamespaceStrategy = "ORKA_AGENT_SANDBOX_NAMESPACE_STRATEGY"
	EnvAgentSandboxClaimTimeout      = "ORKA_AGENT_SANDBOX_CLAIM_TIMEOUT"
	EnvAgentSandboxCommandTimeout    = "ORKA_AGENT_SANDBOX_COMMAND_TIMEOUT"
	EnvAgentSandboxCleanupPolicy     = "ORKA_AGENT_SANDBOX_CLEANUP_POLICY"
)
View Source
const (
	DefaultHarnessV1DispatchInterval = time.Second
	// The shipped harness v1 wrapper advertises and enforces one concurrent
	// turn. Keep the default dispatcher capacity aligned so wrapper capacity is
	// controller backpressure rather than a terminal Task rejection.
	DefaultHarnessV1DispatchWorkers = 1
)
View Source
const (
	// DefaultAIWorkerImage is the default image for AI tasks
	DefaultAIWorkerImage = "ghcr.io/orka-agents/orka/ai-worker:latest"

	// DefaultGeneralWorkerImage is the default image for container tasks
	DefaultGeneralWorkerImage = "ghcr.io/orka-agents/orka/general-worker:latest"

	// DefaultInitImage is the default image for init containers
	DefaultInitImage = "busybox:1.37"

	// AIWorkerServiceAccount is the ServiceAccount used by trusted AI task workers.
	AIWorkerServiceAccount = "orka-ai-worker"

	// VendorWorkerServiceAccount is the ServiceAccount used by untrusted vendor/agent task workers.
	VendorWorkerServiceAccount = "orka-vendor-worker"

	// ContainerWorkerServiceAccount is the ServiceAccount used by untrusted container task workers.
	ContainerWorkerServiceAccount = "orka-container-worker"

	// ResultEndpointEnvVar is the env var for the result submission URL
	ResultEndpointEnvVar = workerenv.ResultEndpoint

	// ControllerURLEnvVar is the env var for the controller base URL
	ControllerURLEnvVar = workerenv.ControllerURL

	// TaskNameEnvVar is the env var for the task name
	TaskNameEnvVar = workerenv.TaskName

	// TaskNamespaceEnvVar is the env var for the task namespace
	TaskNamespaceEnvVar = workerenv.TaskNamespace
)
View Source
const (
	EnvSubstrateAPIEndpoint               = "ORKA_SUBSTRATE_API_ENDPOINT"
	EnvSubstrateAPICAFile                 = "ORKA_SUBSTRATE_API_CA_FILE"
	EnvSubstrateAPICertFile               = "ORKA_SUBSTRATE_API_CERT_FILE"
	EnvSubstrateAPIKeyFile                = "ORKA_SUBSTRATE_API_KEY_FILE"
	EnvSubstrateAPIBearerTokenFile        = "ORKA_SUBSTRATE_API_BEARER_TOKEN_FILE"
	EnvSubstrateAPIInsecureSkipVerify     = "ORKA_SUBSTRATE_API_INSECURE_SKIP_VERIFY"
	EnvSubstrateDirectEgressEnabled       = "ORKA_SUBSTRATE_DIRECT_EGRESS_ENABLED"
	EnvSubstrateRouterURL                 = "ORKA_SUBSTRATE_ROUTER_URL"
	EnvSubstrateActorDNSSuffix            = "ORKA_SUBSTRATE_ACTOR_DNS_SUFFIX"
	EnvSubstrateDefaultTemplate           = "ORKA_SUBSTRATE_DEFAULT_TEMPLATE"
	EnvSubstrateDefaultTemplateNS         = "ORKA_SUBSTRATE_DEFAULT_TEMPLATE_NAMESPACE"
	EnvSubstrateBootstrapSecretName       = "ORKA_SUBSTRATE_BOOTSTRAP_TOKEN_SECRET_NAME"
	EnvSubstrateBootstrapSecretKey        = "ORKA_SUBSTRATE_BOOTSTRAP_TOKEN_SECRET_KEY"
	EnvSubstrateSessionIdentitySecretName = "ORKA_SUBSTRATE_SESSION_IDENTITY_TOKEN_SECRET_NAME"
	EnvSubstrateSessionIdentitySecretKey  = "ORKA_SUBSTRATE_SESSION_IDENTITY_TOKEN_SECRET_KEY"
	EnvSubstrateSessionIdentityRequired   = "ORKA_SUBSTRATE_SESSION_IDENTITY_REQUIRED"
	EnvSubstrateSessionIdentityAudience   = "ORKA_SUBSTRATE_SESSION_IDENTITY_AUDIENCE"
	EnvSubstrateSessionIdentityAppID      = "ORKA_SUBSTRATE_SESSION_IDENTITY_APP_ID"
	EnvSubstrateSessionIdentityUserID     = "ORKA_SUBSTRATE_SESSION_IDENTITY_USER_ID"
	EnvSubstrateClaimTimeout              = "ORKA_SUBSTRATE_CLAIM_TIMEOUT"
	EnvSubstrateCommandTimeout            = "ORKA_SUBSTRATE_COMMAND_TIMEOUT"
	EnvSubstrateCleanupPolicy             = "ORKA_SUBSTRATE_CLEANUP_POLICY"
)
View Source
const (
	// ConditionTypeComplete indicates the task has completed
	ConditionTypeComplete = "Complete"

	// ConditionTypeJobCreated indicates a Job has been created
	ConditionTypeJobCreated = "JobCreated"

	// ConditionTypeWaitingForApproval indicates a running task is parked on a human approval.
	ConditionTypeWaitingForApproval = "WaitingForApproval"
)
View Source
const (
	DefaultAIWorkerClusterRoleName        = "orka-ai-worker-role"
	DefaultVendorWorkerClusterRoleName    = "orka-vendor-worker-role"
	DefaultContainerWorkerClusterRoleName = "orka-container-worker-role"
)
View Source
const (
	EnvExecutionWorkspaceDefaultProvider = "ORKA_EXECUTION_WORKSPACE_DEFAULT_PROVIDER"
)
View Source
const (
	FakeWorkspaceControllerName = "fake.workspace.orka.ai/v1"
)

Variables

View Source
var (
	ErrACPAdmissionClosed       = errors.New("ACP admission is closed")
	ErrACPUpgradeDrainTimedOut  = errors.New("ACP planned upgrade drain timed out")
	ErrACPUpgradeDrainEpochLost = errors.New("controller epoch changed during ACP planned upgrade drain")
)
View Source
var (
	ErrWorkspaceAttachmentLocked = errors.New("execution workspace attachment is held by another task")
)

Functions

func ACPPublicationIDForTask added in v0.2.0

func ACPPublicationIDForTask(task *corev1alpha1.Task) string

ACPPublicationIDForTask returns the immutable publication identity used by the credential/artifact brokers.

func ACPPublicationOperationID added in v0.2.0

func ACPPublicationOperationID(kind string, task *corev1alpha1.Task) string

ACPPublicationOperationID returns the deterministic external-effect operation identity for one Task publication step.

func ACPRuntimeImageAvailable added in v0.2.0

func ACPRuntimeImageAvailable(image string) bool

ACPRuntimeImageAvailable reports whether a built-in runtime image is an immutable, non-placeholder reference suitable for task admission and chat.

func ExecutionWorkspaceDefaultProviderFromEnv

func ExecutionWorkspaceDefaultProviderFromEnv(getenv func(string) string) corev1alpha1.WorkspaceProvider

ExecutionWorkspaceDefaultProviderFromEnv reads the provider-neutral default workspace backend. Empty preserves the compatibility default.

func FindSubstrateMCPRecoveryState added in v0.2.0

func FindSubstrateMCPRecoveryState(ctx context.Context, reader client.Reader, namespace string) (string, error)

FindSubstrateMCPRecoveryState discovers MCP resources whose persisted cleanup finalizers can still own native Actors. Unused resources created while Substrate is disabled do not require provider recovery credentials.

func FindSubstrateRecoveryJournal added in v0.2.0

func FindSubstrateRecoveryJournal(ctx context.Context, reader client.Reader, namespace string) (string, error)

FindSubstrateRecoveryJournal discovers provider cleanup obligations that outlive their source RuntimePools. Inspect labels only: even a damaged journal requires recovery configuration rather than silently losing cleanup.

func PinnedBackendDialTransport added in v0.2.0

func PinnedBackendDialTransport(addresses []string) *http.Transport

PinnedBackendDialTransport returns a proxy-disabled transport that dials only the given verified backend addresses, ignoring the Service ClusterIP the URL would otherwise resolve to. Pinning the authenticated connection to a verified Pod backend closes the validate-then-dial TOCTOU that routing through the still-mutable Service would leave open. It shares the conformance package's dial implementation so dispatch and conformance pin identically.

func RequestACPUpgradeDrain added in v0.2.0

func RequestACPUpgradeDrain(ctx context.Context, endpoint string) error

RequestACPUpgradeDrain is the distroless-compatible preStop helper. cmd/main invokes it in trigger-only mode from a second /manager process; no shell, curl, wget, Service, or externally reachable drain endpoint is required.

func RunACPUpgradeDrainTriggerMode added in v0.2.0

func RunACPUpgradeDrainTriggerMode(ctx context.Context, options ACPUpgradeDrainOptions) (handled bool, err error)

RunACPUpgradeDrainTriggerMode is the single early-entrypoint hook used by cmd/main.go after flag parsing. It returns handled=true whenever TriggerURL is set, so the preStop child must exit instead of opening the store or starting a second controller manager.

func RuntimePoolProfileFromPlan added in v0.2.0

func RuntimePoolProfileFromPlan(plan ACPRuntimePlan) corev1alpha1.RuntimePoolProfileSpec

func ValidateHarnessV1DispatchWorkers added in v0.2.0

func ValidateHarnessV1DispatchWorkers(workers int) error

ValidateHarnessV1DispatchWorkers keeps controller admission aligned with the shipped wrapper's MaxConcurrentTurns=1 capability.

func ValidateOpenCodeAgentSpec added in v0.2.0

func ValidateOpenCodeAgentSpec(agent *corev1alpha1.Agent) error

ValidateOpenCodeAgentSpec validates the reviewed managed OpenCode v2 runtime configuration. It is contract-aware: runtime.type: opencode exists in both harness protocols and is never protocol evidence, so the v2 rules apply only to an Agent explicitly classified orka.harness.v2. V1-selected and still-unclassified stored legacy OpenCode Agents are preserved unchanged; execution admission for them fails closed elsewhere.

func WorkspaceProviderSupported

func WorkspaceProviderSupported(provider corev1alpha1.WorkspaceProvider) bool

WorkspaceProviderSupported reports whether provider is a recognized execution workspace backend.

func WorkspaceReusable

func WorkspaceReusable(workspace *workspacev1alpha1.ExecutionWorkspace) bool

WorkspaceReusable reports whether a workspace is safe for selection by a new Task.

Types

type ACPAcquireSessionLeaseRequest added in v0.2.0

type ACPAcquireSessionLeaseRequest struct {
	Session             store.SessionControl
	Fence               store.ControllerEpochFence
	TaskName            string
	TaskUID             string
	Attempt             int64
	PromptID            string
	PromptRequestDigest string
	AcquiredAt          time.Time
	ExpiresAt           *time.Time

	// NamespaceUID, RuntimeIdentity, and ConfigDigest establish or verify the
	// Kubernetes-authoritative Session protocol/runtime lineage atomically with
	// the lease status CAS when lineage projection is configured.
	NamespaceUID      string
	ContractVersion   corev1alpha1.AgentRuntimeContractVersion
	LineageGeneration int64
	RuntimeIdentity   string
	ConfigDigest      string
}

ACPAcquireSessionLeaseRequest acquires the next generation from an exact SessionControl snapshot. PromptRequestDigest binds the lease to the immutable prompt attempt input without allowing a different prompt to reuse it.

type ACPAdmissionGate added in v0.2.0

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

ACPAdmissionGate is the process-local first barrier for new ACP demand. A planned drain closes it before any RuntimePool mutation. Callers must also check it inside the final RuntimePool reservation CAS so an admission that raced an earlier queue scan cannot cross the shutdown boundary.

func NewACPAdmissionGate added in v0.2.0

func NewACPAdmissionGate() *ACPAdmissionGate

func (*ACPAdmissionGate) Check added in v0.2.0

func (g *ACPAdmissionGate) Check() error

func (*ACPAdmissionGate) Close added in v0.2.0

func (g *ACPAdmissionGate) Close(reason string, now time.Time)

func (*ACPAdmissionGate) Closed added in v0.2.0

func (g *ACPAdmissionGate) Closed() (bool, string, time.Time)

type ACPBootstrapLimits added in v0.2.0

type ACPBootstrapLimits struct {
	MaxMessages     int
	MaxBytes        int
	MaxMessageBytes int
}

ACPBootstrapLimits bound the canonical transcript artifact used to recreate an ACP provider session after runtime loss, scale-to-zero, or profile rotation.

type ACPBootstrapMessage added in v0.2.0

type ACPBootstrapMessage struct {
	Role       string `json:"role"`
	Content    string `json:"content"`
	Name       string `json:"name,omitempty"`
	ToolCallID string `json:"toolCallID,omitempty"`
}

ACPBootstrapMessage is the portable, provider-neutral transcript shape.

type ACPBootstrapTranscript added in v0.2.0

type ACPBootstrapTranscript struct {
	SessionUID       string
	Messages         []ACPBootstrapMessage
	Artifact         []byte
	Digest           string
	MessageCount     uint32
	TotalMessages    int
	Truncated        bool
	VerifiedBaseline *store.VerifiedBranchBaseline
}

ACPBootstrapTranscript is a deterministic JSONL suffix of the canonical Orka transcript. Structured tool arguments are intentionally omitted: continuity restores conversation text without replaying provider-native or tool state.

type ACPDispatcher added in v0.2.0

type ACPDispatcher struct {
	Client                   client.Client
	APIReader                client.Reader
	Store                    store.DurableControlStore
	ResultStore              store.ResultStore
	EventStore               store.ExecutionEventStore
	PlanStore                store.PlanStore
	Snapshots                store.AgentExecutionSnapshotStore
	Epochs                   *ControllerEpochManager
	Sessions                 *ACPSessionContinuity
	Publisher                *publisherservice.Client
	ArtifactCapabilitySecret []byte
	ArtifactReservations     artifactcap.CapabilityReservationRecorder
	MCPRegistry              *tools.Registry
	Interval                 time.Duration
	MaxConcurrent            int
	IdlePoolTTL              time.Duration
	ReservationTTL           time.Duration
	RateLimitRetryInterval   time.Duration
	AdmissionGate            *ACPAdmissionGate
	ACPRuntimeImages         ACPRuntimeImages

	// SubstrateRouterURL and SubstrateActorDNSSuffix route Substrate-backed
	// RuntimePool instances through the provider router while preserving the
	// exact actor route host. Empty values fail closed for substrate pools.
	SubstrateRouterURL      string
	SubstrateActorDNSSuffix string
	// contains filtered or unexported fields
}

ACPDispatcher owns long-lived v2 prompt streams outside reconcile workers. Task reconciliation only persists queued demand; this leader-elected runnable reserves capacity and advances the durable attempt state machine.

func (*ACPDispatcher) CleanupSessionRuntime added in v0.2.0

func (d *ACPDispatcher) CleanupSessionRuntime(
	ctx context.Context,
	intent store.SessionCleanupIntent,
	fence store.ControllerEpochFence,
) error

CleanupSessionRuntime retires resident conversation processes after the durable Session cleanup intent has blocked new turns. All runtime authority comes from finalized turns and verified immutable Task execution snapshots. It is also used when replaying an interrupted Session deletion.

func (*ACPDispatcher) NeedLeaderElection added in v0.2.0

func (d *ACPDispatcher) NeedLeaderElection() bool

func (*ACPDispatcher) Start added in v0.2.0

func (d *ACPDispatcher) Start(ctx context.Context) error

type ACPEnsureSessionRequest added in v0.2.0

type ACPEnsureSessionRequest struct {
	Namespace                 string
	SessionName               string
	SessionType               string
	ExpectedSessionUID        string
	RequireExistingTranscript bool
	Fence                     store.ControllerEpochFence
	CreatedAt                 time.Time
}

ACPEnsureSessionRequest identifies one canonical transcript Session. An optional ExpectedSessionUID turns loading into an exact immutable-identity assertion; when omitted, a UID is generated only if the control record does not already exist.

type ACPExecutionWorkspaceAdapterReconciler added in v0.2.0

type ACPExecutionWorkspaceAdapterReconciler struct {
	client.Client
	APIReader client.Reader
	// RuntimeNamespace is the controller-configured ACP runtime namespace
	// where workspace-backed pools place their provider children (the
	// SandboxClaim and its realized durable PVC); empty means the workspace
	// namespace.
	RuntimeNamespace string
}

ACPExecutionWorkspaceAdapterReconciler is the in-tree status adapter for class-backed ACP execution workspaces. It owns exactly the adapter side of the generic contract: sanitized provider-observed state, the enforced attachment epoch, deletion progress, and the terminal cleanup disposition. The physical workload stays owned by the RuntimePool backends; this adapter drives them only through the linked RuntimePool object and never touches provider-native resources directly.

func (*ACPExecutionWorkspaceAdapterReconciler) Reconcile added in v0.2.0

func (*ACPExecutionWorkspaceAdapterReconciler) SetupWithManager added in v0.2.0

func (r *ACPExecutionWorkspaceAdapterReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the adapter for ExecutionWorkspaces and requeues them as their linked RuntimePools progress through deletion.

type ACPFinalizationProjection added in v0.2.0

type ACPFinalizationProjection struct {
	ID             string
	ProjectionKind string
	Payload        json.RawMessage
	AvailableAt    time.Time
}

ACPFinalizationProjection is the transactional-outbox projection committed with the SessionTurn. The helper owns the aggregate identity and payload digest so callers cannot accidentally project a different turn.

type ACPFinalizeAssistantRequest added in v0.2.0

type ACPFinalizeAssistantRequest struct {
	SessionTurn     ACPSessionTurn
	Fence           store.ControllerEpochFence
	AssistantResult string
	PublicationID   string
	Projection      ACPFinalizationProjection
	FinalizedAt     time.Time
}

ACPFinalizeAssistantRequest finalizes a known prompt result. If publication is terminally ambiguous, the assistant result remains canonical but the Session and BranchClaim stay reconciliation-blocked.

type ACPFinalizeOutcomeMarkerRequest added in v0.2.0

type ACPFinalizeOutcomeMarkerRequest struct {
	SessionTurn ACPSessionTurn
	Fence       store.ControllerEpochFence
	Kind        string
	Reason      string
	Projection  ACPFinalizationProjection
	FinalizedAt time.Time
}

ACPFinalizeOutcomeMarkerRequest records a proven non-success terminal marker such as Cancelled or Failed without misclassifying it as OutcomeUnknown.

type ACPFinalizeOutcomeUnknownRequest added in v0.2.0

type ACPFinalizeOutcomeUnknownRequest struct {
	SessionTurn   ACPSessionTurn
	Fence         store.ControllerEpochFence
	Reason        string
	PublicationID string
	Projection    ACPFinalizationProjection
	FinalizedAt   time.Time
}

ACPFinalizeOutcomeUnknownRequest records an explicit system outcome marker. There is intentionally no assistant-result field, preventing invented output when prompt acceptance or settlement cannot be established.

type ACPIndependentBranchReceipt added in v0.2.0

type ACPIndependentBranchReceipt struct {
	OperationID  string
	RepositoryID string
	Ref          string
	SHA          string
	VerifiedAt   time.Time
	Digest       string
}

ACPIndependentBranchReceipt is the controller boundary for a fresh remote observation performed outside the runtime Pod. Digest covers the exact repository, ref, SHA, operation, and observation time.

func NewACPIndependentBranchReceipt added in v0.2.0

func NewACPIndependentBranchReceipt(operationID, repositoryID, ref, sha string, verifiedAt time.Time) (ACPIndependentBranchReceipt, error)

NewACPIndependentBranchReceipt creates a canonical recovery receipt after an independent clean-room remote observation has established the actual branch.

type ACPMCPAuthenticatedTask added in v0.2.0

type ACPMCPAuthenticatedTask struct {
	Name         string
	Namespace    string
	UID          string
	ParentTaskID string
	AgentName    string
}

func ACPMCPAuthenticatedTaskFromContext added in v0.2.0

func ACPMCPAuthenticatedTaskFromContext(ctx context.Context) (ACPMCPAuthenticatedTask, bool)

type ACPMCPBroker added in v0.2.0

type ACPMCPBroker struct {
	Credentials    ACPMCPBrokerCredentialResolver
	Prompts        ACPMCPPromptAuthorizer
	Executor       ACPMCPToolExecutor
	Effects        store.ExternalEffectStore
	EpochMutations store.ControllerEpochMutationStore
	MaxBodyBytes   int64
}

func NewProductionACPMCPBroker added in v0.2.0

func NewProductionACPMCPBroker(dependencies ACPMCPBrokerDependencies) (*ACPMCPBroker, error)

func (*ACPMCPBroker) ServeHTTP added in v0.2.0

func (b *ACPMCPBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ACPMCPBroker) Validate added in v0.2.0

func (b *ACPMCPBroker) Validate() error

type ACPMCPBrokerCredentialResolver added in v0.2.0

type ACPMCPBrokerCredentialResolver interface {
	ResolveACPMCPBrokerCredentials(context.Context, harnessv2.MCPBrokerCallRequest) (ACPMCPBrokerCredentials, error)
}

type ACPMCPBrokerCredentialResolverFunc added in v0.2.0

type ACPMCPBrokerCredentialResolverFunc func(context.Context, harnessv2.MCPBrokerCallRequest) (ACPMCPBrokerCredentials, error)

func (ACPMCPBrokerCredentialResolverFunc) ResolveACPMCPBrokerCredentials added in v0.2.0

type ACPMCPBrokerCredentials added in v0.2.0

type ACPMCPBrokerCredentials struct {
	ControllerBearerToken string
	CapabilitySecret      []byte
	ExpectedFence         harnessv2.Fence
	RuntimeProfile        harnessv2.RuntimeProfile
	// ExpectedMCPConfiguration freezes the exact prompt-scoped tool and
	// approval policy for external runtimes. RuntimePool callers leave it nil
	// because their controller-owned supervisor receives the same policy.
	ExpectedMCPConfiguration *harnessv2.MCPPolicyConfiguration
	ControllerFence          store.ControllerEpochFence
	Task                     ACPMCPAuthenticatedTask
}

type ACPMCPBrokerDependencies added in v0.2.0

type ACPMCPBrokerDependencies struct {
	Reader                  client.Reader
	Epochs                  *ControllerEpochManager
	ControlStore            store.DurableControlStore
	AgentExecutionSnapshots store.AgentExecutionSnapshotStore
	KubeClient              kubernetes.Interface
	HTTPClient              *http.Client
	Registry                *tools.Registry
	OutboundAccess          outboundaccess.Resolver
	TransactionExchange     *workerexecutor.TransactionExchangeConfig
	ContextFactory          func(context.Context, harnessv2.MCPBrokerCallRequest) (*tools.ToolContext, error)

	// EnforceTransactionCredentialAuth and TransactionCredentialReadScopes bind
	// brokered custom-Tool executions to the authenticated Task's transaction
	// authority; see RegistryACPMCPToolExecutor.
	EnforceTransactionCredentialAuth bool
	TransactionCredentialReadScopes  []string
}

type ACPMCPBrokerPreAuthenticator added in v0.2.0

type ACPMCPBrokerPreAuthenticator interface {
	PreAuthenticateACPMCPBroker(ctx context.Context, poolNamespace, poolUID, authorizationHeader string) error
}

ACPMCPBrokerPreAuthenticator resolves and verifies the controller bearer from the non-secret pool identity carried in request headers, so the broker can reject unauthenticated callers before consuming their request bodies.

type ACPMCPPromptAuthorizer added in v0.2.0

type ACPMCPPromptAuthorizer interface {
	AuthorizeACPMCPPrompt(context.Context, harnessv2.MCPBrokerCallRequest) error
}

type ACPMCPPromptAuthorizerFunc added in v0.2.0

type ACPMCPPromptAuthorizerFunc func(context.Context, harnessv2.MCPBrokerCallRequest) error

func (ACPMCPPromptAuthorizerFunc) AuthorizeACPMCPPrompt added in v0.2.0

func (f ACPMCPPromptAuthorizerFunc) AuthorizeACPMCPPrompt(ctx context.Context, request harnessv2.MCPBrokerCallRequest) error

type ACPMCPTaskDataGuard added in v0.2.0

type ACPMCPTaskDataGuard func(context.Context, func(context.Context) error) error

ACPMCPTaskDataGuard retains an authenticated prompt's immutable identity and serializes short data access with authoritative prompt/session transitions. The callback must finish Kubernetes reads before opening its data transaction and must not invoke a control-store mutation or a remote tool.

func ACPMCPTaskDataGuardFromContext added in v0.2.0

func ACPMCPTaskDataGuardFromContext(ctx context.Context) (ACPMCPTaskDataGuard, bool)

type ACPMCPToolExecutor added in v0.2.0

type ACPMCPToolExecutor interface {
	ExecuteACPMCPTool(context.Context, harnessv2.MCPBrokerCallRequest, harnessv2.MCPToolDescriptor) (json.RawMessage, error)
}

type ACPMCPToolExecutorFunc added in v0.2.0

func (ACPMCPToolExecutorFunc) ExecuteACPMCPTool added in v0.2.0

type ACPOpenSessionTurnRequest added in v0.2.0

type ACPOpenSessionTurnRequest struct {
	Lease                ACPSessionLease
	Fence                store.ControllerEpochFence
	PromptAttemptID      string
	PromptRequestDigest  string
	UserPrompt           string
	SkipTranscriptAppend bool
	SkipUserPromptAppend bool
	OpenedAt             time.Time
}

ACPOpenSessionTurnRequest opens the durable turn after the PromptAttempt has been bound to the returned lease, but before any prompt request is written.

type ACPOutboxProjector added in v0.2.0

type ACPOutboxProjector struct {
	Client      client.Client
	Store       store.OutboxProjectionStore
	Epochs      *ControllerEpochManager
	WorkerID    string
	Interval    time.Duration
	MaxAttempts int64
}

func (*ACPOutboxProjector) NeedLeaderElection added in v0.2.0

func (p *ACPOutboxProjector) NeedLeaderElection() bool

func (*ACPOutboxProjector) Start added in v0.2.0

func (p *ACPOutboxProjector) Start(ctx context.Context) error

type ACPPublicationReclaimer added in v0.2.0

type ACPPublicationReclaimer interface {
	ReclaimPublication(context.Context, publisherservice.PublicationReclaimRequest) (publisherservice.PublicationReclaimResponse, error)
}

ACPPublicationReclaimer removes Publisher-local cache state after every durable publication/session barrier for a deleting Task has settled.

type ACPRecoverBlockedSessionRequest added in v0.2.0

type ACPRecoverBlockedSessionRequest struct {
	Namespace   string
	SessionName string
	SessionUID  string
	Fence       store.ControllerEpochFence
	Receipt     ACPIndependentBranchReceipt
}

ACPRecoverBlockedSessionRequest supplies the immutable Session identity and a fresh independent branch receipt. Store versions and generations are loaded immediately before the cross-aggregate CAS reconciliation.

type ACPReleaseSessionLeaseRequest added in v0.2.0

type ACPReleaseSessionLeaseRequest struct {
	Lease      ACPSessionLease
	Fence      store.ControllerEpochFence
	ReleasedAt time.Time
}

type ACPResumeSessionTurnFinalizationRequest added in v0.2.0

type ACPResumeSessionTurnFinalizationRequest struct {
	SessionTurn ACPSessionTurn
	Fence       store.ControllerEpochFence
}

ACPResumeSessionTurnFinalizationRequest identifies an already-finalized durable SessionTurn whose Kubernetes and outbox activation tail may have been interrupted by controller restart.

type ACPRuntimeImages added in v0.2.0

type ACPRuntimeImages struct {
	Codex    string
	Claude   string
	Copilot  string
	Opencode string
}

type ACPRuntimePlan added in v0.2.0

type ACPRuntimePlan struct {
	PoolName string
	Image    string
	Profile  harnessv2.RuntimeProfile
	Digest   harnessv2.ProfileDigest
	// Workspace, when set, binds the pool to an execution-workspace provider.
	// It changes PoolName so workspace-backed sessions never share a plain pool.
	Workspace *ACPRuntimeWorkspaceBinding
}

func PlanACPRuntimeWithConfiguration added in v0.2.0

func PlanACPRuntimeWithConfiguration(
	task *corev1alpha1.Task,
	agent *corev1alpha1.Agent,
	images ACPRuntimeImages,
	configuration harnessv2.AgentSessionConfiguration,
) (ACPRuntimePlan, error)

type ACPRuntimeSessionBinding added in v0.2.0

type ACPRuntimeSessionBinding struct {
	SessionUID         string
	Generation         uint64
	ProfileDigest      harnessv2.ProfileDigest
	RuntimeInstanceID  harnessv2.RuntimeInstanceID
	SupervisorBootID   harnessv2.SupervisorBootID
	WorkspaceDigest    string
	MCPDigest          string
	RecreationRequired bool
}

ACPRuntimeSessionBinding is the controller-owned durable identity projected into RuntimeSession status. Generation is incremented whenever the provider session must be recreated rather than transparently recovered.

type ACPRuntimeSessionPlan added in v0.2.0

type ACPRuntimeSessionPlan struct {
	Binding           ACPRuntimeSessionBinding
	Recreate          bool
	BootstrapRequired bool
	Reason            string
}

ACPRuntimeSessionPlan explains whether the supervisor session can be reused or must be recreated from the verified branch plus bounded transcript.

func PlanACPRuntimeSession added in v0.2.0

func PlanACPRuntimeSession(
	session store.SessionControl,
	current *ACPRuntimeSessionBinding,
	desiredProfileDigest harnessv2.ProfileDigest,
	desiredMCPDigest string,
	desiredRuntimeInstanceID harnessv2.RuntimeInstanceID,
	desiredSupervisorBootID harnessv2.SupervisorBootID,
) (ACPRuntimeSessionPlan, error)

PlanACPRuntimeSession selects the next monotonic RuntimeSession generation. A profile rotation or proven runtime loss increments exactly once and always requires canonical bootstrap; unchanged live state is reused.

type ACPRuntimeWorkspaceBinding added in v0.2.0

type ACPRuntimeWorkspaceBinding struct {
	Provider      corev1alpha1.WorkspaceProvider
	ReusePolicy   corev1alpha1.WorkspaceReusePolicy
	CleanupPolicy corev1alpha1.WorkspaceCleanupPolicy
	WorkspaceSlot string
	// SessionUID is the immutable durable SessionControl identity when
	// ReusePolicy is session. It is empty for per-Task workspaces.
	SessionUID string
	// SessionKey scopes the physical workspace to one logical RuntimeSession:
	// the immutable Session UID under reusePolicy session, or the exact Task UID
	// otherwise.
	SessionKey string
	// TemplateNamespace and TemplateName reference the operator-owned Substrate
	// infrastructure ActorTemplate. They are set exactly when Provider is
	// substrate: agent-sandbox workloads run only controller-rendered templates.
	TemplateNamespace string
	TemplateName      string
	// Class is the frozen controller-first ExecutionWorkspaceClass binding for
	// class-selected workspaces. It is nil for legacy provider-shaped requests.
	Class *ACPWorkspaceClassBinding
	// RestoreFrom is a provider-neutral immutable Data checkpoint reference.
	RestoreFrom *corev1alpha1.WorkspaceCheckpointReference
	// BindingDigest is the canonical digest over the fields above. It is part
	// of the RuntimePool identity.
	BindingDigest string
}

ACPRuntimeWorkspaceBinding is the resolved, canonical execution-workspace binding for one ACP RuntimePool. It carries no provider-native identifiers and no secrets; it is frozen into the immutable execution snapshot and recomputed exactly during snapshot verification.

type ACPSandboxDurableVolume added in v0.2.0

type ACPSandboxDurableVolume struct {
	StorageClassName string
	// StorageClassUID pins the exact StorageClass whose Delete reclaim
	// semantics were validated at class resolution; provisioning reverifies
	// it so a same-name replacement class cannot silently retain volumes.
	StorageClassUID string
	AccessModes     []string
	Capacity        string
}

ACPSandboxDurableVolume is the frozen durable workspace PVC shape for a suspend-capable agent-sandbox class binding.

type ACPSessionContinuity added in v0.2.0

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

ACPSessionContinuity is the controller-side integration boundary for durable ACP Session identity, mutation fencing, canonical transcript bootstrap, and atomic SessionTurn completion. It deliberately does not submit prompts.

func NewACPSessionContinuity added in v0.2.0

func NewACPSessionContinuity(config ACPSessionContinuityConfig) (*ACPSessionContinuity, error)

NewACPSessionContinuity creates a continuity component. All stores are required because publication ambiguity and blocked-session recovery must be classified from durable receipts rather than caller assertions.

func NewHarnessV1SessionContinuity added in v0.2.0

func NewHarnessV1SessionContinuity(config HarnessV1SessionContinuityConfig) (*ACPSessionContinuity, error)

NewHarnessV1SessionContinuity creates the publication-free v1 continuity boundary. A nonempty publication ID fails closed because no PublicationStore or cluster-scoped BranchClaimStore is attached.

func (*ACPSessionContinuity) AcquireMutationLease added in v0.2.0

func (c *ACPSessionContinuity) AcquireMutationLease(ctx context.Context, request ACPAcquireSessionLeaseRequest) (*ACPSessionLease, error)

AcquireMutationLease acquires one monotonic, non-reusable Session lease.

func (*ACPSessionContinuity) BuildBootstrapTranscript added in v0.2.0

func (c *ACPSessionContinuity) BuildBootstrapTranscript(ctx context.Context, session store.SessionControl) (*ACPBootstrapTranscript, error)

BuildBootstrapTranscript returns a bounded, deterministic suffix of the Orka transcript. It refuses reconciliation-blocked Sessions and returns the last independently verified branch baseline for separate workspace recovery.

func (*ACPSessionContinuity) BuildBootstrapTranscriptThrough added in v0.2.0

func (c *ACPSessionContinuity) BuildBootstrapTranscriptThrough(
	ctx context.Context, session store.SessionControl, throughMessageID string, maxMessages int, excludeThroughMessage bool,
) (*ACPBootstrapTranscript, *store.SessionMessage, error)

BuildBootstrapTranscriptThrough returns the bounded transcript ending at one exact stable message ID together with that untruncated terminal message. Gateway Tasks use the terminal user message as the durable SessionTurn prompt while avoiding a duplicate prompt block in provider input.

func (*ACPSessionContinuity) BuildBootstrapTranscriptWithLimit added in v0.2.0

func (c *ACPSessionContinuity) BuildBootstrapTranscriptWithLimit(
	ctx context.Context, session store.SessionControl, maxMessages int,
) (*ACPBootstrapTranscript, error)

BuildBootstrapTranscriptWithLimit returns the same canonical suffix while applying the Task-specific transcript limit before the continuity-wide byte and message caps. The explicit limit prevents a caller's narrower context boundary from being widened during provider-session recreation.

func (*ACPSessionContinuity) CommitRuntimeSessionGeneration added in v0.2.0

func (c *ACPSessionContinuity) CommitRuntimeSessionGeneration(
	ctx context.Context,
	lease ACPSessionLease,
	fence store.ControllerEpochFence,
	generation uint64,
	committedAt time.Time,
) (*ACPSessionLease, error)

CommitRuntimeSessionGeneration records the newest provider RuntimeSession generation proven live while this exact Session mutation lease is active.

func (*ACPSessionContinuity) EnsureSession added in v0.2.0

EnsureSession creates or loads the transcript Session and its immutable SessionControl UID record. Concurrent creators converge on the first durable UID; an explicitly expected different UID is rejected.

func (*ACPSessionContinuity) FinalizeAssistantResult added in v0.2.0

func (c *ACPSessionContinuity) FinalizeAssistantResult(ctx context.Context, request ACPFinalizeAssistantRequest) (*ACPSessionFinalization, error)

FinalizeAssistantResult atomically appends the user prompt and known assistant result, snapshots any durable publication receipt, releases only the matching lease, and derives baseline advancement inside the store.

func (*ACPSessionContinuity) FinalizeOutcomeMarker added in v0.2.0

func (*ACPSessionContinuity) FinalizeOutcomeUnknown added in v0.2.0

FinalizeOutcomeUnknown atomically appends the user prompt and an explicit canonical outcome marker. It never accepts or synthesizes assistant content.

func (*ACPSessionContinuity) OpenTurn added in v0.2.0

OpenTurn creates the SessionTurn durability barrier that prompt execution must not cross before this method succeeds.

func (*ACPSessionContinuity) RecordsLineage added in v0.2.0

func (c *ACPSessionContinuity) RecordsLineage() bool

RecordsLineage reports whether Session lineage recording is configured.

func (*ACPSessionContinuity) RecoverBlockedSession added in v0.2.0

RecoverBlockedSession establishes the actual remote baseline and atomically returns a PublicationOutcomeUnknown/DeliveryConflict Session and BranchClaim to Available. It cannot be used to bypass a missing independent receipt.

func (*ACPSessionContinuity) ReleaseMutationLease added in v0.2.0

func (*ACPSessionContinuity) ResumeSessionTurnFinalization added in v0.2.0

ResumeSessionTurnFinalization reloads every finalization input from the persisted SessionTurn/outbox records and idempotently completes the remaining BranchClaim, SessionControl, coordination Lease, and outbox activation steps.

type ACPSessionContinuityConfig added in v0.2.0

type ACPSessionContinuityConfig struct {
	SessionControls store.SessionControlStore
	Transcripts     store.SessionStore
	GatewayEvents   store.GatewayEventStore
	Publications    store.PublicationStore
	BranchClaims    store.BranchClaimStore
	BootstrapLimits ACPBootstrapLimits
	NewSessionUID   func() (string, error)

	// Lineages receives an idempotent SQLite payload projection only after the
	// Kubernetes SessionControl store has established or verified lineage in
	// the same status CAS that records the mutation Lease.
	Lineages store.SessionLineageStore
}

ACPSessionContinuityConfig supplies the durable stores used by the ACP session-continuity boundary. In production these interfaces are normally implemented by the same SQLite-backed durable control store.

type ACPSessionFinalization added in v0.2.0

type ACPSessionFinalization struct {
	Turn    store.SessionTurn
	Session store.SessionControl
}

ACPSessionFinalization is the committed turn plus its latest Session state.

type ACPSessionLease added in v0.2.0

type ACPSessionLease struct {
	Session store.SessionControl
	Key     store.SessionTurnKey
}

ACPSessionLease is the exact mutation fence that must be used when opening and finalizing the SessionTurn.

type ACPSessionTurn added in v0.2.0

type ACPSessionTurn struct {
	Lease                ACPSessionLease
	Turn                 store.SessionTurn
	SkipTranscriptAppend bool
	SkipUserPromptAppend bool
}

ACPSessionTurn is the exact session and turn snapshot used for terminal finalization. A newer lease or Session version cannot finalize this turn.

type ACPUpgradeDrainBarrierObserver added in v0.2.0

type ACPUpgradeDrainBarrierObserver interface {
	ObserveACPUpgradeDrainBarriers(context.Context) (ACPUpgradeDrainBarrierSnapshot, error)
}

ACPUpgradeDrainBarrierObserver reads the publication, external-effect, and transactional-outbox barriers without mutating or claiming them.

type ACPUpgradeDrainBarrierObserverFunc added in v0.2.0

type ACPUpgradeDrainBarrierObserverFunc func(context.Context) (ACPUpgradeDrainBarrierSnapshot, error)

ACPUpgradeDrainBarrierObserverFunc adapts a function for tests or a composite store implementation during the Kubernetes control-store cutover.

func (ACPUpgradeDrainBarrierObserverFunc) ObserveACPUpgradeDrainBarriers added in v0.2.0

type ACPUpgradeDrainBarrierSnapshot added in v0.2.0

type ACPUpgradeDrainBarrierSnapshot struct {
	UnsettledOutboxProjections int64 `json:"unsettledOutboxProjections"`
	NonterminalPromptAttempts  int64 `json:"nonterminalPromptAttempts"`
	ActiveSessionControls      int64 `json:"activeSessionControls"`
	NonterminalPublications    int64 `json:"nonterminalPublications"`
	NonterminalExternalEffects int64 `json:"nonterminalExternalEffects"`
}

ACPUpgradeDrainBarrierSnapshot is the durable work outside RuntimePool supervisor state that must settle before a planned leader handoff.

func (ACPUpgradeDrainBarrierSnapshot) Quiescent added in v0.2.0

func (s ACPUpgradeDrainBarrierSnapshot) Quiescent() bool

type ACPUpgradeDrainCoordinator added in v0.2.0

type ACPUpgradeDrainCoordinator struct {
	Client              client.Client
	APIReader           client.Reader
	Epochs              ACPUpgradeDrainEpochSource
	EpochStore          store.ControllerEpochStore
	AdmissionGate       *ACPAdmissionGate
	Barriers            ACPUpgradeDrainBarrierObserver
	SupervisorClient    RuntimePoolSupervisorClient
	HTTPClient          *http.Client
	SubstrateConfig     SubstrateConfig
	ControllerNamespace string
	Options             ACPUpgradeDrainOptions
	Now                 func() time.Time
	// contains filtered or unexported fields
}

ACPUpgradeDrainCoordinator runs only on the elected leader. It exposes a loopback trigger for a same-binary preStop child and retains leadership while RuntimePools and durable finalization barriers settle.

func NewACPUpgradeDrainCoordinator added in v0.2.0

func NewACPUpgradeDrainCoordinator(
	kubeClient client.Client,
	reader client.Reader,
	epochs ACPUpgradeDrainEpochSource,
	epochStore store.ControllerEpochStore,
	barriers ACPUpgradeDrainBarrierObserver,
	gate *ACPAdmissionGate,
	options ACPUpgradeDrainOptions,
) *ACPUpgradeDrainCoordinator

func (*ACPUpgradeDrainCoordinator) Handler added in v0.2.0

func (*ACPUpgradeDrainCoordinator) NeedLeaderElection added in v0.2.0

func (c *ACPUpgradeDrainCoordinator) NeedLeaderElection() bool

func (*ACPUpgradeDrainCoordinator) ReadyzChecker added in v0.2.0

func (c *ACPUpgradeDrainCoordinator) ReadyzChecker() healthz.Checker

func (*ACPUpgradeDrainCoordinator) Start added in v0.2.0

func (*ACPUpgradeDrainCoordinator) Status added in v0.2.0

func (*ACPUpgradeDrainCoordinator) Trigger added in v0.2.0

Trigger starts the same drain path used by the preStop endpoint and waits for completion, timeout, epoch loss, or caller cancellation.

type ACPUpgradeDrainEpochSource added in v0.2.0

type ACPUpgradeDrainEpochSource interface {
	CurrentFence(context.Context) (store.ControllerEpochFence, error)
}

ACPUpgradeDrainEpochSource supplies the epoch already acquired after controller-runtime leader election.

type ACPUpgradeDrainMarker added in v0.2.0

type ACPUpgradeDrainMarker struct {
	Version             string                     `json:"version"`
	State               ACPUpgradeDrainMarkerState `json:"state"`
	ControllerEpochName string                     `json:"controllerEpochName"`
	ControllerEpoch     int64                      `json:"controllerEpoch"`
	HolderID            string                     `json:"holderID"`
	StartedAt           time.Time                  `json:"startedAt"`
	Deadline            time.Time                  `json:"deadline"`
	CompletedAt         *time.Time                 `json:"completedAt,omitempty"`
	TimedOutAt          *time.Time                 `json:"timedOutAt,omitempty"`
	LastError           string                     `json:"lastError,omitempty"`
	Snapshot            ACPUpgradeDrainSnapshot    `json:"snapshot"`
}

ACPUpgradeDrainMarker is the durable proof used by the next leader. Only a Completed marker for the exact previous epoch permits planned-takeover recovery; missing, Intent, TimedOut, malformed, or stale markers are deliberately classified as unplanned takeover.

type ACPUpgradeDrainMarkerState added in v0.2.0

type ACPUpgradeDrainMarkerState string
const (
	ACPUpgradeDrainMarkerIntent    ACPUpgradeDrainMarkerState = "Intent"
	ACPUpgradeDrainMarkerCompleted ACPUpgradeDrainMarkerState = "Completed"
	ACPUpgradeDrainMarkerTimedOut  ACPUpgradeDrainMarkerState = "TimedOut"
)

type ACPUpgradeDrainOptions added in v0.2.0

type ACPUpgradeDrainOptions struct {
	BindAddress       string
	Timeout           time.Duration
	PollInterval      time.Duration
	MarkerNamespace   string
	WatchNamespace    string
	RuntimePoolLabels map[string]string
	TriggerURL        string
	TriggerTimeout    time.Duration
}

ACPUpgradeDrainOptions is shared by the normal controller process and the same-binary preStop trigger mode. The trigger listener is deliberately loopback-only; the preStop child shares the Pod network namespace.

func DefaultACPUpgradeDrainOptions added in v0.2.0

func DefaultACPUpgradeDrainOptions() ACPUpgradeDrainOptions

func (*ACPUpgradeDrainOptions) BindFlags added in v0.2.0

func (o *ACPUpgradeDrainOptions) BindFlags(fs *flag.FlagSet)

BindFlags registers all flags required by cmd/main.go. TriggerURL is empty in the long-running controller and non-empty only in the preStop child process.

type ACPUpgradeDrainOutboxBarrier added in v0.2.0

type ACPUpgradeDrainOutboxBarrier interface {
	CountUnsettledOutboxProjections(context.Context) (int64, error)
}

ACPUpgradeDrainOutboxBarrier must report all Pending or Delivering outbox records, including records whose retry availability is in the future.

type ACPUpgradeDrainOutboxBarrierFunc added in v0.2.0

type ACPUpgradeDrainOutboxBarrierFunc func(context.Context) (int64, error)

ACPUpgradeDrainOutboxBarrierFunc adapts a function for store-specific wiring.

func (ACPUpgradeDrainOutboxBarrierFunc) CountUnsettledOutboxProjections added in v0.2.0

func (f ACPUpgradeDrainOutboxBarrierFunc) CountUnsettledOutboxProjections(ctx context.Context) (int64, error)

type ACPUpgradeDrainPhase added in v0.2.0

type ACPUpgradeDrainPhase string
const (
	ACPUpgradeDrainReady     ACPUpgradeDrainPhase = "Ready"
	ACPUpgradeDrainDraining  ACPUpgradeDrainPhase = "Draining"
	ACPUpgradeDrainCompleted ACPUpgradeDrainPhase = "Completed"
	ACPUpgradeDrainTimedOut  ACPUpgradeDrainPhase = "TimedOut"
	ACPUpgradeDrainFailed    ACPUpgradeDrainPhase = "Failed"
)

type ACPUpgradeDrainSnapshot added in v0.2.0

type ACPUpgradeDrainSnapshot struct {
	ObservedPools              int                            `json:"observedPools"`
	PoolsAwaitingQuiescence    int                            `json:"poolsAwaitingQuiescence"`
	QueuedTasks                int64                          `json:"queuedTasks"`
	ReservedSessions           int64                          `json:"reservedSessions"`
	ReservedPrompts            int64                          `json:"reservedPrompts"`
	ReservationRecords         int64                          `json:"reservationRecords"`
	RunningPrompts             int64                          `json:"runningPrompts"`
	ResidentSessions           int64                          `json:"residentSessions"`
	FinalizingSessions         int64                          `json:"finalizingSessions"`
	PendingPermissions         int64                          `json:"pendingPermissions"`
	LiveDescendants            int64                          `json:"liveDescendants"`
	QueuedSupervisorAdmissions int64                          `json:"queuedSupervisorAdmissions"`
	Barriers                   ACPUpgradeDrainBarrierSnapshot `json:"barriers"`
}

ACPUpgradeDrainSnapshot combines exact RuntimePool and durable-store barriers.

func (ACPUpgradeDrainSnapshot) Quiescent added in v0.2.0

func (s ACPUpgradeDrainSnapshot) Quiescent() bool

type ACPUpgradeDrainStatus added in v0.2.0

type ACPUpgradeDrainStatus struct {
	Phase           ACPUpgradeDrainPhase    `json:"phase"`
	ControllerEpoch int64                   `json:"controllerEpoch,omitempty"`
	TriggeredAt     *time.Time              `json:"triggeredAt,omitempty"`
	Deadline        *time.Time              `json:"deadline,omitempty"`
	CompletedAt     *time.Time              `json:"completedAt,omitempty"`
	LastError       string                  `json:"lastError,omitempty"`
	Snapshot        ACPUpgradeDrainSnapshot `json:"snapshot"`
}

ACPUpgradeDrainStatus is safe to expose through readiness and diagnostics.

type ACPWorkspaceClassBinding added in v0.2.0

type ACPWorkspaceClassBinding struct {
	Name               string
	UID                string
	Generation         int64
	ProfileHash        string
	ProviderName       string
	ProviderUID        string
	ProviderGeneration int64
	// ProviderConfigUID pins the exact cluster-scoped RuntimeProviderConfig
	// that selected the physical backend: recreating the immutable config
	// under the same name must read as drift, never as a silent backend swap.
	ProviderConfigUID string
	// EffectiveOnDetach is the validated detach action for this Task: the
	// Task-requested value when the class allows it, otherwise the class
	// default. Delete is always executable; Suspend is executable only for
	// session-reused workspaces whose backend profile permits DataOnly
	// suspension.
	EffectiveOnDetach string
	// SuspendMode freezes the operator-permitted suspension scope from the
	// class profile. Empty means suspension is not permitted; DataOnly is the
	// only supported value.
	SuspendMode string
	// SandboxVolume freezes the durable workspace PVC shape for
	// suspend-capable agent-sandbox classes. It is nil for every other class.
	SandboxVolume *ACPSandboxDurableVolume
	// MaxSuspendedWorkspaces freezes the class retention cap. Nil means
	// per-workspace age must be bounded by idleTimeout or maxLifetime.
	MaxSuspendedWorkspaces *int32
	// DefaultOnDetach and AllowedOnDetach freeze the class lifecycle policy in
	// class order so the materialized ExecutionWorkspace carries the exact
	// class lifecycle and never drifts from it.
	DefaultOnDetach string
	AllowedOnDetach []string
	DetachTimeout   string
	IdleTimeout     string
	MaxLifetime     string
	DeletionPolicy  ACPWorkspaceClassDeletionPolicy
}

ACPWorkspaceClassBinding is the frozen controller-first class identity for one ACP execution-workspace binding. Every field is immutable snapshot input: live class or provider drift is rejected against these exact values instead of silently rebinding.

func (*ACPWorkspaceClassBinding) Lifecycle added in v0.2.0

Lifecycle rebuilds the exact class lifecycle frozen into this binding. The result must match the live class spec byte for byte, or the workspace core controller rejects the materialized workspace as policy drift.

type ACPWorkspaceClassDeletionPolicy added in v0.2.0

type ACPWorkspaceClassDeletionPolicy struct {
	ProviderResources string
	PersistentVolumes string
	Checkpoints       string
}

ACPWorkspaceClassDeletionPolicy freezes the class deletion dispositions that finalization must honor independently for each retained-data category.

type ACPWorkspaceProviderAdapterReconciler added in v0.2.0

type ACPWorkspaceProviderAdapterReconciler struct {
	client.Client
	AgentSandboxEnabled          bool
	SubstrateEnabled             bool
	SubstrateDirectEgressEnabled bool
	SubstrateCheckpointsEnabled  bool
	ACPWorkspaceDispatchEnabled  bool
	WorkspaceProviderAPIEnabled  bool
	Now                          func() time.Time
}

ACPWorkspaceProviderAdapterReconciler advertises the in-tree ACP RuntimePool execution-workspace adapter on ExecutionWorkspaceProvider objects carrying the reserved ACP controllerName. Advertisement is fail-closed: a provider whose backend flags are disabled, or whose RuntimeProviderConfig is missing or invalid, loses its advertisement and can no longer admit classes.

The advertised exec, files, and reset features name the ACP runtime data plane: RuntimeSession prompt execution and the brokered repository workspace, not the generic workspace-agent protocol. The suspend feature names data-only cold suspension, whose class-profile policy decides whether a given class may actually request it.

func (*ACPWorkspaceProviderAdapterReconciler) Reconcile added in v0.2.0

func (*ACPWorkspaceProviderAdapterReconciler) SetupWithManager added in v0.2.0

func (r *ACPWorkspaceProviderAdapterReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the ACP provider advertisement controller.

type ACPWorkspaceRetentionReconciler added in v0.2.0

type ACPWorkspaceRetentionReconciler struct {
	client.Client
	// APIReader bypasses the informer cache for suspended-capacity counts so
	// a quota claim never trusts a stale list. Falls back to Client when nil.
	APIReader client.Reader
	// DurableControlStore resolves immutable Session identities for unlinked
	// continuation Tasks. Without it, retention keeps demand fail-closed.
	DurableControlStore store.DurableControlStore
	Recorder            events.EventRecorder
	Now                 func() time.Time
}

ACPWorkspaceRetentionReconciler enforces the frozen class lifetime policy on class-backed ACP execution workspaces: idleTimeout bounds how long an unattached workspace may stay Ready or Suspended, and maxLifetime is the hard upper bound that forces terminal cleanup regardless of state. It acts in Orka core's role (it writes desired state and object deletion only); the workspace adapter keeps executing the transitions.

func (*ACPWorkspaceRetentionReconciler) Reconcile added in v0.2.0

func (*ACPWorkspaceRetentionReconciler) SetupWithManager added in v0.2.0

func (r *ACPWorkspaceRetentionReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers retention enforcement for ACP class workspaces.

type AgentExecutionSnapshotRetentionManager added in v0.2.0

type AgentExecutionSnapshotRetentionManager struct {
	APIReader client.Reader
	Store     store.AgentExecutionSnapshotLifecycleStore
	Namespace string

	Retention time.Duration
	Interval  time.Duration
	Now       func() time.Time
	// contains filtered or unexported fields
}

AgentExecutionSnapshotRetentionManager removes encrypted execution snapshots only after both Kubernetes and durable-store references have been absent for a complete retention window. The in-memory unreferenced clock is intentionally conservative: a controller restart starts the window again, delaying collection rather than risking premature deletion.

func (*AgentExecutionSnapshotRetentionManager) NeedLeaderElection added in v0.2.0

func (*AgentExecutionSnapshotRetentionManager) NeedLeaderElection() bool

NeedLeaderElection keeps lifecycle decisions on the single elected writer.

func (*AgentExecutionSnapshotRetentionManager) Start added in v0.2.0

Start runs one pass immediately and then periodically until cancellation.

type AgentReconciler

type AgentReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// Mode is the controller's static execution mode. A built-in Agent that
	// omitted contractVersion is stamped with it on first reconcile so the
	// stored object carries its classification.
	Mode executionmode.Mode
}

AgentReconciler reconciles a Agent object

func (*AgentReconciler) Reconcile

func (r *AgentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile validates the Agent configuration and updates its status.

func (*AgentReconciler) SetupWithManager

func (r *AgentReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type AgentRuntimeReconciler

type AgentRuntimeReconciler struct {
	client.Client
	APIReader              client.Reader
	Scheme                 *k8sruntime.Scheme
	HarnessV1HTTPClient    *http.Client
	MCPRegistry            *tools.Registry
	ControllerEpochManager *ControllerEpochManager
	ControlStore           store.DurableControlStore
}

AgentRuntimeReconciler reconciles external harness v1 and v2 registry entries.

func (*AgentRuntimeReconciler) AgentRuntimeConformedServiceBackendPins added in v0.2.0

func (r *AgentRuntimeReconciler) AgentRuntimeConformedServiceBackendPins(ctx context.Context, runtime *corev1alpha1.AgentRuntime) ([]string, error)

AgentRuntimeConformedServiceBackendPins additionally requires that every current v2 Service backend belongs to the last successful conformance check. New work uses this method; cleanup keeps its original frozen authority and uses AgentRuntimeServiceBackendPins even after the serving backend changes.

func (*AgentRuntimeReconciler) AgentRuntimeServiceBackendPins added in v0.2.0

func (r *AgentRuntimeReconciler) AgentRuntimeServiceBackendPins(ctx context.Context, runtime *corev1alpha1.AgentRuntime) ([]string, error)

AgentRuntimeServiceBackendPins validates the endpoint policy and, for a same-namespace Service endpoint, returns the verified backend addresses to pin the dial to. It returns nil for non-Service endpoints (which the public-address dial control governs instead). The reader must be uncached for a dispatch-time revalidation.

func (*AgentRuntimeReconciler) Reconcile

func (r *AgentRuntimeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile validates one exact external runtime and publishes condition-ready status.

func (*AgentRuntimeReconciler) SetupWithManager

func (r *AgentRuntimeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type AgentSandboxConfig

type AgentSandboxConfig struct {
	// RouterURL is the optional base URL for an agent-sandbox router service.
	RouterURL string
	// DefaultTemplate is the default agent-sandbox SandboxWarmPool name used when a workspace omits templateRef.name.
	DefaultTemplate string
	// WarmPoolPolicy is retained for the legacy worker environment contract.
	WarmPoolPolicy string
	// NamespaceStrategy selects where sandbox lifecycle resources are managed.
	NamespaceStrategy string
	// ControllerNamespace is the namespace used for controller-scoped sandbox lifecycle resources.
	ControllerNamespace string
	// ClaimTimeout bounds workspace claim and readiness operations.
	ClaimTimeout time.Duration
	// CommandTimeout bounds sandbox command execution operations.
	CommandTimeout time.Duration
	// CleanupPolicy is the controller default when a Task workspace omits cleanupPolicy.
	CleanupPolicy corev1alpha1.WorkspaceCleanupPolicy
}

AgentSandboxConfig holds disabled-by-default alpha configuration for agent sandbox workspace integration. The controller validates workspace requests and propagates resolved settings to agent worker Jobs; the worker wrapper performs the upstream sandbox claim, execution, and cleanup lifecycle.

func AgentSandboxConfigFromEnv

func AgentSandboxConfigFromEnv(getenv func(string) string) (AgentSandboxConfig, error)

AgentSandboxConfigFromEnv loads agent sandbox config defaults from the process environment.

func DefaultAgentSandboxConfig

func DefaultAgentSandboxConfig() AgentSandboxConfig

DefaultAgentSandboxConfig returns safe alpha defaults. Empty RouterURL and DefaultTemplate values require callers to provide an upstream router/default template or set a template per Task before execution.

func (AgentSandboxConfig) Validate

func (c AgentSandboxConfig) Validate() error

Validate rejects unsupported sandbox config values. Callers should only enforce this while the experimental sandbox feature gate is enabled so unrelated startup behavior remains unchanged.

func (AgentSandboxConfig) WithDefaults

func (c AgentSandboxConfig) WithDefaults() AgentSandboxConfig

WithDefaults fills unset optional fields with safe defaults.

type ControllerEpochManager added in v0.2.0

type ControllerEpochManager struct {
	Store    store.ControllerEpochStore
	Name     string
	HolderID string
	Mirrors  []store.ControllerEpochMirror
	// contains filtered or unexported fields
}

ControllerEpochManager acquires one durable epoch after controller-runtime leader election. Every ACP control-store mutation must use CurrentFence so a stale leader cannot commit authoritative state after takeover.

func NewControllerEpochManager added in v0.2.0

func NewControllerEpochManager(epochStore store.ControllerEpochStore, holderID string) *ControllerEpochManager

func (*ControllerEpochManager) Current added in v0.2.0

func (*ControllerEpochManager) CurrentFence added in v0.2.0

func (*ControllerEpochManager) NeedLeaderElection added in v0.2.0

func (m *ControllerEpochManager) NeedLeaderElection() bool

func (*ControllerEpochManager) Start added in v0.2.0

func (*ControllerEpochManager) WithMirror added in v0.2.0

WithMirror registers a subordinate epoch mirror that must synchronize before CurrentFence becomes available. Call this only during startup wiring.

type DurableACPMCPPromptAuthorizer added in v0.2.0

type DurableACPMCPPromptAuthorizer struct {
	Attempts store.PromptAttemptStore
}

func (DurableACPMCPPromptAuthorizer) AuthorizeACPMCPPrompt added in v0.2.0

func (a DurableACPMCPPromptAuthorizer) AuthorizeACPMCPPrompt(ctx context.Context, request harnessv2.MCPBrokerCallRequest) error

type ExecutionWorkspaceClassReconciler

type ExecutionWorkspaceClassReconciler struct {
	client.Client
	APIReader   client.Reader
	RESTMapper  apimeta.RESTMapper
	CleanupOnly bool
}

ExecutionWorkspaceClassReconciler resolves provider/pool references and publishes provider-neutral class readiness. Authorization is performed for each Task/Tool caller by WorkspaceClassAuthorizer.

func (*ExecutionWorkspaceClassReconciler) Reconcile

func (*ExecutionWorkspaceClassReconciler) SetupWithManager

func (r *ExecutionWorkspaceClassReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the class reference/readiness controller.

type ExecutionWorkspaceProviderReconciler

type ExecutionWorkspaceProviderReconciler struct {
	client.Client
	APIReader        client.Reader
	RESTMapper       apimeta.RESTMapper
	HeartbeatTimeout time.Duration
	Now              func() time.Time
	CleanupOnly      bool
}

ExecutionWorkspaceProviderReconciler evaluates generic provider usability and prevents deletion while pools or concrete workspaces remain bound to a provider. Adapter-owned status fields are preserved.

func (*ExecutionWorkspaceProviderReconciler) Reconcile

func (*ExecutionWorkspaceProviderReconciler) SetupWithManager

func (r *ExecutionWorkspaceProviderReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the generic provider usability controller.

type ExecutionWorkspaceReconciler

type ExecutionWorkspaceReconciler struct {
	client.Client
	APIReader               client.Reader
	RESTMapper              apimeta.RESTMapper
	AdmissionLeaseNamespace string
	CleanupOnly             bool
}

ExecutionWorkspaceReconciler owns generic workspace identity, immutable binding validation, desired lifecycle, and finalization. It never writes provider-native fields or performs provider lifecycle calls directly.

func (*ExecutionWorkspaceReconciler) Reconcile

func (*ExecutionWorkspaceReconciler) SetupWithManager

func (r *ExecutionWorkspaceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the generic concrete workspace coordinator.

type ExecutionWorkspaceRequest

type ExecutionWorkspaceRequest struct {
	TemplateName      string
	TemplateNamespace string
	TemplateUID       string

	SubstrateBootstrapSecretName string
	SubstrateBootstrapSecretKey  string
}

ExecutionWorkspaceRequest identifies a Substrate ActorTemplate (plus the controller-configured bootstrap Secret) for template validation by the Tool and SubstrateActorPool reconcilers.

type FakeExecutionWorkspacePoolReconciler

type FakeExecutionWorkspacePoolReconciler struct {
	client.Client
}

FakeExecutionWorkspacePoolReconciler derives deterministic pool counts from concrete workspaces. It does not create provider-native resources.

func (*FakeExecutionWorkspacePoolReconciler) Reconcile

func (*FakeExecutionWorkspacePoolReconciler) SetupWithManager

func (r *FakeExecutionWorkspacePoolReconciler) SetupWithManager(mgr ctrl.Manager) error

type FakeExecutionWorkspaceProviderReconciler

type FakeExecutionWorkspaceProviderReconciler struct {
	client.Client
	Now func() time.Time
}

FakeExecutionWorkspaceProviderReconciler is a status-only reference adapter used by envtest and development. It owns only providers with the fake controllerName.

func (*FakeExecutionWorkspaceProviderReconciler) Reconcile

func (*FakeExecutionWorkspaceProviderReconciler) SetupWithManager

type FakeExecutionWorkspaceReconciler

type FakeExecutionWorkspaceReconciler struct {
	client.Client
	APIReader  client.Reader
	RESTMapper apimeta.RESTMapper
}

FakeExecutionWorkspaceReconciler implements the generic lifecycle entirely in status and is intentionally free of provider-native branches.

func (*FakeExecutionWorkspaceReconciler) Reconcile

func (*FakeExecutionWorkspaceReconciler) SetupWithManager

func (r *FakeExecutionWorkspaceReconciler) SetupWithManager(mgr ctrl.Manager) error

type GatewayBindingReconciler

type GatewayBindingReconciler struct {
	client.Client
	Scheme *k8sruntime.Scheme
}

GatewayBindingReconciler validates semantic routing and target references.

func (*GatewayBindingReconciler) Reconcile

Reconcile validates one semantic GatewayBinding.

func (*GatewayBindingReconciler) SetupWithManager

func (r *GatewayBindingReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers binding watches.

type GatewayClassReconciler

type GatewayClassReconciler struct {
	client.Client
	Scheme *k8sruntime.Scheme
}

GatewayClassReconciler validates administrator-owned adapter profiles.

func (*GatewayClassReconciler) Reconcile

func (r *GatewayClassReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile validates one GatewayClass.

func (*GatewayClassReconciler) SetupWithManager

func (r *GatewayClassReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the GatewayClass controller.

type GatewayReconciler

type GatewayReconciler struct {
	client.Client
	Scheme                *k8sruntime.Scheme
	HTTPClient            *http.Client
	AllowInsecureLoopback bool
}

GatewayReconciler resolves adapter references and probes orka.gateway.v1.

func (*GatewayReconciler) Reconcile

func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile validates references, Secret boundaries, health, and capabilities.

func (*GatewayReconciler) SetupWithManager

func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers Gateway watches, including Secret and Service rotation.

type HarnessV1BrokeredToolExecutor added in v0.2.0

type HarnessV1BrokeredToolExecutor interface {
	ExecuteHarnessV1BrokeredTool(
		context.Context,
		string,
		*corev1alpha1.Tool,
		harness.ToolCallRequest,
	) (json.RawMessage, error)
}

HarnessV1BrokeredToolExecutor is the controller-owned execution boundary for Tool CRDs requested by an external harness v1 runtime. Implementations must propagate request.IdempotencyKey to the downstream operation.

type HarnessV1Dispatcher added in v0.2.0

type HarnessV1Dispatcher struct {
	Client               client.Client
	APIReader            client.Reader
	Attempts             store.HarnessV1AttemptStore
	Snapshots            store.AgentExecutionSnapshotStore
	ResultStore          store.ResultStore
	EventStore           store.ExecutionEventStore
	ExternalEffects      store.ExternalEffectStore
	BrokeredToolExecutor HarnessV1BrokeredToolExecutor
	Sessions             *ACPSessionContinuity
	Epochs               *ControllerEpochManager
	Interval             time.Duration
	MaxConcurrent        int
	HTTPClient           *http.Client
	// contains filtered or unexported fields
}

HarnessV1Dispatcher owns harness v1 network effects outside Task reconcile. A Prepared attempt is moved durably to Submitting before StartTurn. On takeover, Submitting is always treated as potentially submitted: ledger and frame evidence are consulted before any state change and the request is never replayed merely because evidence is unavailable.

func (*HarnessV1Dispatcher) AcknowledgeHarnessV1Settlement added in v0.2.0

func (d *HarnessV1Dispatcher) AcknowledgeHarnessV1Settlement(
	ctx context.Context,
	task *corev1alpha1.Task,
	attempt *store.HarnessV1Attempt,
) error

AcknowledgeHarnessV1Settlement retries the wrapper's idempotent terminal acknowledgement before Task finalization removes the durable attempt used to reconstruct it.

func (*HarnessV1Dispatcher) NeedLeaderElection added in v0.2.0

func (d *HarnessV1Dispatcher) NeedLeaderElection() bool

func (*HarnessV1Dispatcher) Start added in v0.2.0

func (d *HarnessV1Dispatcher) Start(ctx context.Context) error

type HarnessV1SessionContinuityConfig added in v0.2.0

type HarnessV1SessionContinuityConfig struct {
	SessionControls store.SessionControlStore
	Transcripts     store.SessionStore
	GatewayEvents   store.GatewayEventStore
	BootstrapLimits ACPBootstrapLimits
	NewSessionUID   func() (string, error)
	Lineages        store.SessionLineageStore
}

HarnessV1SessionContinuityConfig supplies only the namespaced continuity stores used by the publication-free harness v1 contract.

type HarnessV1SettlementAcknowledger added in v0.2.0

type HarnessV1SettlementAcknowledger interface {
	AcknowledgeHarnessV1Settlement(
		context.Context,
		*corev1alpha1.Task,
		*store.HarnessV1Attempt,
	) error
}

HarnessV1SettlementAcknowledger proves that a terminal wrapper ledger row may be reclaimed before its durable attempt identity is removed.

type JobBuildOptions

type JobBuildOptions struct {
	ResolvedApprovalsJSON       string
	RepositoryMonitorValidation bool
}

JobBuildOptions carries optional inputs that affect Job rendering while keeping the historical Build signature stable.

type JobBuilder

type JobBuilder struct {
	client.Client
	AIWorkerImage                              string
	GeneralWorkerImage                         string
	InitImage                                  string
	AIWorkerServiceAccountName                 string
	ContainerWorkerServiceAccountName          string
	ControllerURL                              string // e.g. http://orka-controller.orka-system.svc:8080
	ControllerMode                             executionmode.Mode
	ContextTokenTTSEndpoint                    string
	ContextTokenTTSAudience                    string
	ContextTokenTTSTimeout                     string
	ContextTokenTTSTokenSource                 string
	ContextTokenSubjectTokenType               string
	ContextTokenChildScope                     string
	ContextTokenOutboundScope                  string
	ContextTokenChildTokenTTL                  string
	ContextTokenToolTokenTTL                   string
	EnforceTransactionCredentialAuth           bool
	TransactionCredentialReadScopes            []string
	OutboundAccessTrustedGatewayServices       string
	OutboundAccessTrustedTokenEndpointServices string
	EnableTelemetry                            bool
	// contains filtered or unexported fields
}

JobBuilder builds Kubernetes Jobs for Tasks

func NewJobBuilder

func NewJobBuilder(c client.Client) *JobBuilder

NewJobBuilder creates a new JobBuilder

func (*JobBuilder) Build

func (b *JobBuilder) Build(ctx context.Context, task *corev1alpha1.Task, agent *corev1alpha1.Agent, provider *corev1alpha1.Provider) (*batchv1.Job, error)

Build creates a Job for the given Task.

func (*JobBuilder) BuildWithOptions

func (b *JobBuilder) BuildWithOptions(ctx context.Context, task *corev1alpha1.Task, agent *corev1alpha1.Agent, provider *corev1alpha1.Provider, opts JobBuildOptions) (*batchv1.Job, error)

BuildWithOptions creates a Job for the given Task using additional resolved options.

type KubernetesACPMCPBrokerCredentialResolver added in v0.2.0

type KubernetesACPMCPBrokerCredentialResolver struct {
	Reader                  client.Reader
	Epochs                  *ControllerEpochManager
	AgentExecutionSnapshots store.AgentExecutionSnapshotStore
}

func (KubernetesACPMCPBrokerCredentialResolver) PreAuthenticateACPMCPBroker added in v0.2.0

func (r KubernetesACPMCPBrokerCredentialResolver) PreAuthenticateACPMCPBroker(
	ctx context.Context,
	poolNamespace, poolUID, authorizationHeader string,
) error

PreAuthenticateACPMCPBroker resolves the runtime's controller bearer from the non-secret namespace + pool UID headers and constant-time compares it to the presented Authorization header, before any request body is read.

func (KubernetesACPMCPBrokerCredentialResolver) ResolveACPMCPBrokerCredentials added in v0.2.0

type KubernetesACPUpgradeDrainBarrierObserver added in v0.2.0

type KubernetesACPUpgradeDrainBarrierObserver struct {
	Reader    client.Reader
	Outbox    ACPUpgradeDrainOutboxBarrier
	Namespace string
}

KubernetesACPUpgradeDrainBarrierObserver treats Kubernetes PromptAttempt, RuntimeSessionControl, Publication, and ExternalEffect records as authoritative. It samples the SQLite-backed outbox before and after those sinks so a Delivering record cannot disappear into newly projected work.

func (*KubernetesACPUpgradeDrainBarrierObserver) ObserveACPUpgradeDrainBarriers added in v0.2.0

type KubernetesHarnessV1BrokeredToolExecutor added in v0.2.0

type KubernetesHarnessV1BrokeredToolExecutor struct {
	Reader              client.Reader
	KubeClient          kubernetes.Interface
	HTTPClient          *http.Client
	OutboundAccess      outboundaccess.Resolver
	TransactionExchange *workerexecutor.TransactionExchangeConfig

	// EnforceTransactionCredentialAuth mirrors the controller-wide
	// context-token authorization enforcement mode. When set, brokered Tool
	// executions bind the authenticated Task's transaction and credential
	// authority before running and fail closed when it cannot be resolved.
	EnforceTransactionCredentialAuth bool
	// TransactionCredentialReadScopes lists the transaction scopes that
	// authorize Secret-backed outbound credentials, matching the scopes the
	// controller stamps into worker Jobs.
	TransactionCredentialReadScopes []string
}

KubernetesHarnessV1BrokeredToolExecutor executes brokered harness v1 Tool calls through the shared worker Tool executor. Every execution binds the authenticated Task's transaction token and scopes per request in every authorization mode, mirroring the transaction environment and owner-referenced token Secret the controller stamps into worker Jobs and disabling the executor's process-global token-file fallback inside the controller. Secret-backed credential authorization is additionally enforced when EnforceTransactionCredentialAuth is set, mirroring RegistryACPMCPToolExecutor for the v2 ACP MCP broker; missing Task authority always fails closed.

func (*KubernetesHarnessV1BrokeredToolExecutor) ExecuteHarnessV1BrokeredTool added in v0.2.0

func (e *KubernetesHarnessV1BrokeredToolExecutor) ExecuteHarnessV1BrokeredTool(
	ctx context.Context,
	namespace string,
	tool *corev1alpha1.Tool,
	request harness.ToolCallRequest,
) (json.RawMessage, error)

type OutboundAccessPolicyReconciler

type OutboundAccessPolicyReconciler struct {
	client.Client
	APIReader                  client.Reader
	Scheme                     *runtime.Scheme
	Trust                      outboundaccess.TrustConfig
	AIWorkerServiceAccountName string
}

OutboundAccessPolicyReconciler validates policy structure and references.

func (*OutboundAccessPolicyReconciler) Reconcile

func (*OutboundAccessPolicyReconciler) SetupWithManager

func (r *OutboundAccessPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers policy, referenced-object, and managed-RBAC watches.

type ProviderReconciler

type ProviderReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ProviderReconciler reconciles a Provider object

func (*ProviderReconciler) Reconcile

func (r *ProviderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile handles Provider reconciliation

func (*ProviderReconciler) SetupWithManager

func (r *ProviderReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager

type RegistryACPMCPToolExecutor added in v0.2.0

type RegistryACPMCPToolExecutor struct {
	Registry            *tools.Registry
	Reader              client.Reader
	KubeClient          kubernetes.Interface
	HTTPClient          *http.Client
	OutboundAccess      outboundaccess.Resolver
	TransactionExchange *workerexecutor.TransactionExchangeConfig
	ContextFactory      func(context.Context, harnessv2.MCPBrokerCallRequest) (*tools.ToolContext, error)

	// EnforceTransactionCredentialAuth mirrors the controller-wide context-token
	// authorization enforcement mode. Custom-Tool executions always bind the
	// authenticated Task's transaction authority; this flag gates only its
	// Secret-credential authorization.
	EnforceTransactionCredentialAuth bool
	// TransactionCredentialReadScopes lists the transaction scopes that
	// authorize Secret-backed outbound credentials, matching the scopes the
	// controller stamps into worker Jobs.
	TransactionCredentialReadScopes []string
}

func (RegistryACPMCPToolExecutor) ExecuteACPMCPTool added in v0.2.0

type RepositoryMonitorReconciler

type RepositoryMonitorReconciler struct {
	client.Client
	APIReader                 client.Reader
	Scheme                    *runtime.Scheme
	Store                     store.RepositoryMonitorStore
	ResultStore               store.ResultStore
	ArtifactStore             store.ArtifactStore
	DurableControlStore       store.DurableControlStore
	ControllerEpochManager    *ControllerEpochManager
	HTTPClient                *http.Client
	GitHubAPIBaseURL          string
	EnforceNamespaceIsolation bool
}

RepositoryMonitorReconciler reconciles RepositoryMonitor resources.

func (*RepositoryMonitorReconciler) Reconcile

Reconcile keeps monitor metadata durable and publishes basic status.

func (*RepositoryMonitorReconciler) SetupWithManager

func (r *RepositoryMonitorReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the manager.

type RepositoryScanReconciler

type RepositoryScanReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	SecurityStore    store.SecurityStore
	ArtifactStore    store.ArtifactStore
	ResultStore      store.ResultStore
	PublicationStore store.PublicationStore
	// APIReader reads uncached Secrets and verifies RepositoryScan identity
	// before run admission or cleanup; nil falls back to Client.
	APIReader client.Reader
	// HTTPClient and GitHubAPIBaseURL serve the published-commit read that
	// backs harness-v2 patch evidence; zero values use the defaults.
	HTTPClient       *http.Client
	GitHubAPIBaseURL string
}

RepositoryScanReconciler reconciles RepositoryScan resources.

func (*RepositoryScanReconciler) Reconcile

Reconcile drives repository scan lifecycle, task creation, and task ingestion.

func (*RepositoryScanReconciler) SetupWithManager

func (r *RepositoryScanReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the manager.

type ResultRefPayload

type ResultRefPayload struct {
	Available bool `json:"available"`
}

ResultRefPayload is the result reference in the webhook payload

type RuntimePoolProbeResult added in v0.2.0

type RuntimePoolProbeResult struct {
	Capabilities harnessv2.CapabilitiesResponse
	Status       harnessv2.StatusResponse
}

RuntimePoolProbeResult is the authenticated, exact-instance supervisor view used to select and fence one active runtime Pod.

type RuntimePoolProviderProxyConfig added in v0.2.0

type RuntimePoolProviderProxyConfig struct {
	BaseURL         string
	Namespace       string
	PodLabels       map[string]string
	BearerToken     []byte
	BearerTokenFile string
}

RuntimePoolProviderProxyConfig binds managed RuntimePools to the authenticated cluster-local provider proxy. BearerToken is copied into an epoch-scoped RuntimePool Secret and is never placed in Pod environment variables.

func (RuntimePoolProviderProxyConfig) GoString added in v0.2.0

func (RuntimePoolProviderProxyConfig) String added in v0.2.0

func (RuntimePoolProviderProxyConfig) Validate added in v0.2.0

Validate verifies that the provider boundary is complete and cluster-local.

type RuntimePoolReconciler added in v0.2.0

type RuntimePoolReconciler struct {
	client.Client
	APIReader client.Reader
	Scheme    *k8sruntime.Scheme

	// RuntimeNamespace is used when spec.runtimeNamespace is empty.
	RuntimeNamespace string
	// ControllerNamespace is the namespace allowed to reach the runtime control port.
	ControllerNamespace string
	// ControllerAPIURL is the exact internal artifact/broker API base URL.
	ControllerAPIURL string
	// ControllerAPIPort is the controller Pod target port allowed by the runtime egress policy.
	ControllerAPIPort int32
	// WorkspaceArtifactMaxBytes is the Publisher-advertised maximum inbound
	// workspace artifact size propagated to every built-in runtime.
	WorkspaceArtifactMaxBytes int64
	// ProviderProxy is the authenticated, NetworkPolicy-confined provider boundary.
	ProviderProxy RuntimePoolProviderProxyConfig
	// ControllerEpoch is a test/static override. Production uses Epochs.
	ControllerEpoch int64
	// Epochs supplies the current durable leader epoch.
	Epochs *ControllerEpochManager
	// EnablePDB protects a serving singleton from voluntary disruption.
	EnablePDB bool
	// EnableTelemetry projects non-secret trace exporter settings into supervisors.
	EnableTelemetry bool
	// AllowedImages is the controller-configured immutable image allowlist for
	// built-in pools. RuntimePool is controller-owned; its public spec cannot be
	// used to select an arbitrary privileged supervisor image.
	AllowedImages ACPRuntimeImages
	// CleanupOnly keeps deletion finalization active while ACP runtime admission
	// is disabled without adding finalizers or creating runtime resources.
	CleanupOnly bool
	// E2EPromptWriteAmbiguityMarker is a disabled-by-default live-conformance
	// fault marker projected into built-in runtime supervisors.
	E2EPromptWriteAmbiguityMarker string

	// AgentSandboxEnabled admits Agent Sandbox-backed workspace pools.
	AgentSandboxEnabled bool
	// SubstrateEnabled admits Substrate-backed workspace pools.
	SubstrateEnabled bool
	// SubstrateConfig carries the externally operated Substrate control-plane
	// and router configuration for Substrate-backed workspace pools.
	SubstrateConfig SubstrateConfig
	// SubstrateActorControlFactory builds the narrow, suspension-free actor
	// control client. Tests inject fakes; production defaults to the gRPC client.
	SubstrateActorControlFactory func(SubstrateConfig) (workspace.SubstrateRuntimeActorControl, error)
	SubstrateNativeClientFactory func(SubstrateConfig) (*workspace.SubstrateNativeClient, error)
	SubstrateTemplates           substrateTemplateStore
	// SubstrateCredentialSeeder overrides the fresh-boot credential PUT for
	// tests. Production sends fresh boots through the router; data-resumed actors
	// require the provider control's operation-fenced bootstrap contract.
	SubstrateCredentialSeeder func(ctx context.Context, routeHost, nonce string, capabilitySecret []byte, request harnessv2.CredentialBootstrapRequest) error
	// WorkspaceCredentialSeeder overrides the Agent Sandbox credential
	// bootstrap PUT for tests. Production seeds the exact attested Pod endpoint
	// directly after provider materialization is verified.
	WorkspaceCredentialSeeder func(ctx context.Context, endpoint, nonce string, capabilitySecret []byte, request harnessv2.CredentialBootstrapRequest) (alreadyComplete bool, err error)

	SupervisorClient RuntimePoolSupervisorClient
	HTTPClient       *http.Client
	Rand             io.Reader
	Now              func() time.Time
	// contains filtered or unexported fields
}

RuntimePoolReconciler reconciles controller-owned built-in ACP runtime pools.

func (*RuntimePoolReconciler) Reconcile added in v0.2.0

func (r *RuntimePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile converges the singleton Deployment and publishes exact-Pod pool status.

func (*RuntimePoolReconciler) SetupWithManager added in v0.2.0

func (r *RuntimePoolReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up watches for RuntimePools and their cross-namespace children.

type RuntimePoolSupervisorClient added in v0.2.0

type RuntimePoolSupervisorClient interface {
	Probe(ctx context.Context, endpoint, bearerToken string, capabilitySecret []byte) (RuntimePoolProbeResult, error)
	RequestDrain(ctx context.Context, endpoint, bearerToken string, capabilitySecret []byte, status harnessv2.StatusResponse, reason string) error
}

RuntimePoolSupervisorClient is the v2 control surface required by the Kubernetes reconciler. It intentionally excludes task and session dispatch.

type SessionCleanupRecoveryManager added in v0.2.0

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

SessionCleanupRecoveryManager replays durable cross-store Session deletion intents after controller restart. It runs only on the elected controller.

func NewSessionCleanupRecoveryManager added in v0.2.0

func NewSessionCleanupRecoveryManager(cleanup store.SessionCleanupRecoveryStore, epochs *ControllerEpochManager) *SessionCleanupRecoveryManager

NewSessionCleanupRecoveryManager constructs the startup recovery runnable.

func (*SessionCleanupRecoveryManager) NeedLeaderElection added in v0.2.0

func (*SessionCleanupRecoveryManager) NeedLeaderElection() bool

NeedLeaderElection keeps recovery single-writer with the controller epoch.

func (*SessionCleanupRecoveryManager) Start added in v0.2.0

Start retries pending cleanups until the manager context is cancelled.

type SessionManager

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

SessionManager manages sessions for conversation continuity. It delegates persistence to a store.SessionStore and orchestrates the acquire → job → append → release lifecycle.

func NewSessionManager

func NewSessionManager(ss store.SessionStore) *SessionManager

NewSessionManager creates a new SessionManager backed by the given store.

func (*SessionManager) AcquireLock

func (m *SessionManager) AcquireLock(ctx context.Context, task *corev1alpha1.Task) error

AcquireLock acquires the session lock for a task.

func (*SessionManager) AppendMessages

func (m *SessionManager) AppendMessages(ctx context.Context, task *corev1alpha1.Task, resultStore store.ResultStore) error

AppendMessages appends messages from a completed task to the session. The resultStore is used to fetch the task result for the assistant message.

func (*SessionManager) DeleteSession

func (m *SessionManager) DeleteSession(ctx context.Context, namespace, name string) error

DeleteSession deletes a session. ACP-enabled deployments coordinate the Kubernetes-authoritative controls before removing the SQLite transcript.

func (*SessionManager) GetSession

func (m *SessionManager) GetSession(ctx context.Context, namespace, name string) (*store.SessionRecord, error)

GetSession gets a session by name.

func (*SessionManager) IsLocked

func (m *SessionManager) IsLocked(ctx context.Context, task *corev1alpha1.Task) (bool, error)

IsLocked checks if a session is locked by another task.

func (*SessionManager) ListSessions

func (m *SessionManager) ListSessions(ctx context.Context, namespace string) ([]store.SessionMetadata, error)

ListSessions lists all sessions in a namespace.

func (*SessionManager) ListSessionsPage added in v0.2.0

func (m *SessionManager) ListSessionsPage(ctx context.Context, namespace, afterName string, limit int, excludeType string) ([]store.SessionMetadata, bool, error)

ListSessionsPage lists one name-ordered page of sessions in a namespace.

func (*SessionManager) LoadTranscript

func (m *SessionManager) LoadTranscript(ctx context.Context, task *corev1alpha1.Task) ([]store.SessionMessage, error)

LoadTranscript loads the session transcript for a task.

func (*SessionManager) ReleaseLock

func (m *SessionManager) ReleaseLock(ctx context.Context, task *corev1alpha1.Task) error

ReleaseLock releases the session lock for a task.

func (*SessionManager) SetACPSessionCleanup added in v0.2.0

func (m *SessionManager) SetACPSessionCleanup(cleanup store.SessionCleanupStore, epochs *ControllerEpochManager)

SetACPSessionCleanup enables the hard-cutover cross-store Session deletion path. It is configured only when ACP Kubernetes control storage is enabled.

func (*SessionManager) SetGatewayEventStore

func (m *SessionManager) SetGatewayEventStore(events store.GatewayEventStore)

SetGatewayEventStore enables durable gateway transcript policy resolution.

type SkillReconciler

type SkillReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

SkillReconciler reconciles a Skill object

func (*SkillReconciler) Reconcile

func (r *SkillReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile validates the Skill content, computes a content hash, and updates the Skill's status accordingly.

func (*SkillReconciler) SetupWithManager

func (r *SkillReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SubstrateActorPoolReconciler

type SubstrateActorPoolReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	SubstrateEnabled bool
	SubstrateConfig  SubstrateConfig

	SubstrateTemplateValidator func(context.Context, *ExecutionWorkspaceRequest) error
	SubstrateExecutorFactory   func(SubstrateConfig) (SubstratePoolExecutor, error)
}

SubstrateActorPoolReconciler reconciles SubstrateActorPool objects.

func (*SubstrateActorPoolReconciler) Reconcile

Reconcile updates pool density and optionally pre-creates warm actors.

func (*SubstrateActorPoolReconciler) SetupWithManager

func (r *SubstrateActorPoolReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SubstrateCheckpointReconciler added in v0.2.0

type SubstrateCheckpointReconciler struct {
	RuntimePools           *RuntimePoolReconciler
	CheckpointAPIInstalled bool
}

SubstrateCheckpointReconciler exports only already verified Data artifacts. It shares native configuration and journal ownership with RuntimePool.

func (*SubstrateCheckpointReconciler) Reconcile added in v0.2.0

func (*SubstrateCheckpointReconciler) SetupWithManager added in v0.2.0

func (r *SubstrateCheckpointReconciler) SetupWithManager(mgr ctrl.Manager) error

type SubstrateConfig

type SubstrateConfig struct {
	APIEndpoint        string
	APICAFile          string
	APICertFile        string
	APIKeyFile         string
	APIBearerTokenFile string
	// Atespace is selected from the immutable workspace binding by the controller.
	Atespace              string
	APIInsecureSkipVerify bool
	// DirectEgressEnabled acknowledges that ateapi has tunneled egress disabled.
	// ACP requires worker-scoped NetworkPolicies to see the Actor's destinations.
	DirectEgressEnabled       bool
	RouterURL                 string
	ActorDNSSuffix            string
	DefaultTemplate           string
	DefaultTemplateNS         string
	BootstrapSecretName       string
	BootstrapSecretKey        string
	SessionIdentitySecretName string
	SessionIdentitySecretKey  string
	SessionIdentityRequired   bool
	SessionIdentityAudience   string
	SessionIdentityAppID      string
	SessionIdentityUserID     string
	ClaimTimeout              time.Duration
	CommandTimeout            time.Duration
	CleanupPolicy             corev1alpha1.WorkspaceCleanupPolicy
}

SubstrateConfig holds disabled-by-default alpha configuration for the Agent Substrate execution workspace provider.

func DefaultSubstrateConfig

func DefaultSubstrateConfig() SubstrateConfig

DefaultSubstrateConfig returns safe alpha defaults. Substrate is still disabled unless the controller feature gate is explicitly enabled.

func SubstrateConfigFromEnv

func SubstrateConfigFromEnv(getenv func(string) string) (SubstrateConfig, error)

SubstrateConfigFromEnv loads Substrate config defaults from process env.

func (SubstrateConfig) Validate

func (c SubstrateConfig) Validate() error

Validate rejects unsupported legacy Substrate workspace-agent config values.

func (SubstrateConfig) ValidateACPRuntimePool added in v0.2.0

func (c SubstrateConfig) ValidateACPRuntimePool() error

ValidateACPRuntimePool rejects invalid configuration used by the credential-bootstrap Substrate RuntimePool backend. Legacy workspace-agent bootstrap and SessionIdentity settings are intentionally not required: ACP supervisors boot credential-free and receive pool credentials post-boot.

func (SubstrateConfig) WithDefaults

func (c SubstrateConfig) WithDefaults() SubstrateConfig

WithDefaults fills unset optional fields with safe defaults.

func (SubstrateConfig) WorkspaceClientConfig added in v0.2.0

func (c SubstrateConfig) WorkspaceClientConfig() workspace.SubstrateConfig

WorkspaceClientConfig keeps authentication and routing consistent across ACP, direct workspaces, MCP actor pools and native resource operations.

type SubstratePoolExecutor

type SubstratePoolExecutor interface {
	ConvergeSubstrateActors(ctx context.Context, prefix string, target int, template workspace.TemplateRef) (int, int, error)
	PruneSubstrateActors(ctx context.Context, prefix string, target int) (int, error)
	SubstratePoolTelemetry(ctx context.Context, prefix string, template workspace.TemplateRef, workerPool workspace.TemplateRef) (workspace.Density, error)
}

SubstratePoolExecutor is the executor surface the pool controller needs.

type TaskReconciler

type TaskReconciler struct {
	client.Client
	APIReader                    client.Reader
	Scheme                       *runtime.Scheme
	JobBuilder                   *JobBuilder
	SessionManager               *SessionManager
	WebhookNotifier              *WebhookNotifier
	Recorder                     record.EventRecorder
	KubeClient                   kubernetes.Interface
	OutboundAccessResolver       outboundaccess.Resolver
	BrokeredTransactionExchange  *workerpkg.TransactionExchangeConfig
	ResultStore                  store.ResultStore
	PlanStore                    store.PlanStore
	MessageStore                 store.MessageStore
	ArtifactStore                store.ArtifactStore
	ExecutionEventStore          store.ExecutionEventStore
	DurableControlStore          store.DurableControlStore
	AgentExecutionSnapshots      store.AgentExecutionSnapshotStore
	RepositoryValidationBindings tools.RepositoryValidationBindingStore
	MCPRegistry                  *tools.Registry
	ACPArtifactRetirer           artifactcap.IdentityRetirer
	ACPPublicationReclaimer      ACPPublicationReclaimer
	ControllerEpochManager       *ControllerEpochManager
	ControllerNamespace          string
	ACPAdmissionGate             *ACPAdmissionGate
	HarnessV1Enabled             bool
	// Mode is the controller's static execution mode; it classifies built-in
	// Agents that omitted contractVersion.
	Mode                              executionmode.Mode
	HarnessV1Endpoint                 string
	HarnessV1AuthSecretNamespace      string
	HarnessV1AuthSecretName           string
	HarnessV1AuthSecretKey            string
	HarnessV1Attempts                 store.HarnessV1AttemptStore
	HarnessV1SettlementAcknowledger   HarnessV1SettlementAcknowledger
	ACPRuntimeEnabled                 bool
	ACPRuntimeImages                  ACPRuntimeImages
	ACPRuntimeNamespace               string
	EnforceNamespaceIsolation         bool
	MaxTasksPerNamespace              int32
	ExecutionWorkspaceDefaultProvider corev1alpha1.WorkspaceProvider
	WorkspaceProviderAPIEnabled       bool
	// WorkspaceSettlementProtected reports that Task provenance admission
	// guards the reserved acp.workspace.orka.ai/ metadata settlement reads
	// from. When false (a cleanup-only installation without the webhook),
	// class settlement runs non-destructively: it never revokes or deletes a
	// workspace from forgeable Task metadata, and existing workspaces are
	// cleaned through explicit workspace deletion instead.
	WorkspaceSettlementProtected bool
	// ACPWorkspaceDispatchEnabled admits workspace-provider-backed ACP
	// RuntimeSession dispatch. When false, workspace-backed agent Tasks fail
	// closed before any workspace or RuntimePool demand exists.
	ACPWorkspaceDispatchEnabled       bool
	AgentSandboxEnabled               bool
	AgentSandboxConfig                AgentSandboxConfig
	SubstrateEnabled                  bool
	SubstrateConfig                   SubstrateConfig
	AIWorkerServiceAccountName        string
	VendorWorkerServiceAccountName    string
	ContainerWorkerServiceAccountName string
	AIWorkerClusterRoleName           string
	VendorWorkerClusterRoleName       string
	ContainerWorkerClusterRoleName    string
	WorkerRoleBindingNamePrefix       string
	EnforceTransactionCredentialAuth  bool
	TransactionCredentialReadScopes   []string
	OutboundAccessTrust               outboundaccess.TrustConfig
	// contains filtered or unexported fields
}

TaskReconciler reconciles a Task object

func (*TaskReconciler) Reconcile

func (r *TaskReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile handles the reconciliation loop for Task resources

func (*TaskReconciler) SetupWithManager

func (r *TaskReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ToolReconciler

type ToolReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	// HTTPClient is the HTTP client used for health checks. If nil, a default is used.
	HTTPClient *http.Client

	// SkipSSRFValidation disables SSRF protection for testing. Do NOT set to true in production.
	SkipSSRFValidation bool

	// SubstrateEnabled enables durable MCP tool actors.
	SubstrateEnabled            bool
	SubstrateConfig             SubstrateConfig
	EnforceNamespaceIsolation   bool
	WorkspaceProviderAPIEnabled bool
	OutboundAccessTrust         outboundaccess.TrustConfig

	// SubstrateExecutorFactory is injectable for tests.
	SubstrateTemplateValidator func(context.Context, *ExecutionWorkspaceRequest) error
	SubstrateExecutorFactory   func(SubstrateConfig) (workspace.WorkspaceExecutor, error)
}

ToolReconciler reconciles a Tool object

func (*ToolReconciler) Reconcile

func (r *ToolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile validates the Tool configuration, performs a health check on the HTTP endpoint, and updates the Tool's status accordingly.

func (*ToolReconciler) SetupWithManager

func (r *ToolReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type WebhookNotifier

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

WebhookNotifier sends webhook notifications for task completion

func NewWebhookNotifier

func NewWebhookNotifier() *WebhookNotifier

NewWebhookNotifier creates a new WebhookNotifier

func (*WebhookNotifier) Notify

func (w *WebhookNotifier) Notify(ctx context.Context, task *corev1alpha1.Task) error

Notify sends a webhook notification for a completed task

func (*WebhookNotifier) SetKubeClient

func (w *WebhookNotifier) SetKubeClient(kubeClient ctrlclient.Reader)

SetKubeClient configures the Kubernetes reader used for same-namespace service validation.

type WebhookPayload

type WebhookPayload struct {
	TaskName       string                 `json:"taskName"`
	TaskNamespace  string                 `json:"taskNamespace"`
	Phase          corev1alpha1.TaskPhase `json:"phase"`
	Message        string                 `json:"message,omitempty"`
	StartTime      *string                `json:"startTime,omitempty"`
	CompletionTime *string                `json:"completionTime,omitempty"`
	Attempts       int32                  `json:"attempts"`
	ResultRef      *ResultRefPayload      `json:"resultRef,omitempty"`
	RuntimeType    string                 `json:"runtimeType,omitempty"`
}

WebhookPayload is the payload sent to webhook URLs

type WorkspaceAttachmentManager

type WorkspaceAttachmentManager struct {
	Client    client.Client
	APIReader client.Reader
	LeaseTTL  time.Duration
	Now       func() time.Time
}

WorkspaceAttachmentManager owns Lease, epoch, and attachment Secret rotation.

func (WorkspaceAttachmentManager) Attach

Attach rotates authority and writes attachment intent. Bearer token text exists only in the created Secret and this function's short-lived buffer.

func (WorkspaceAttachmentManager) BeginRevocation

func (m WorkspaceAttachmentManager) BeginRevocation(
	ctx context.Context,
	workspace *workspacev1alpha1.ExecutionWorkspace,
	epoch int64,
) error

BeginRevocation clears attachment intent. The adapter must revoke the active epoch before FinalizeRevocation removes the Secret and Lease.

func (WorkspaceAttachmentManager) FinalizeRevocation

func (m WorkspaceAttachmentManager) FinalizeRevocation(
	ctx context.Context,
	workspace *workspacev1alpha1.ExecutionWorkspace,
	epoch int64,
	secretName string,
) error

FinalizeRevocation deletes the token Secret and Lease only after provider status no longer reports the epoch as attached.

type WorkspaceAttachmentResult

type WorkspaceAttachmentResult struct {
	Epoch         int64
	AttachmentRef workspacev1alpha1.SecretReference
	ExpiresAt     metav1.Time
}

WorkspaceAttachmentResult contains references safe to pass to a worker Job.

type WorkspaceClassAuthorizer

type WorkspaceClassAuthorizer struct {
	Client client.Client
}

WorkspaceClassAuthorizer performs the explicit Kubernetes `use` authorization check required before an admission request may select an ExecutionWorkspaceClass. Callers must pass AdmissionRequest.UserInfo from the live Kubernetes admission request, never identity copied from a Task spec.

func (WorkspaceClassAuthorizer) Authorize

func (a WorkspaceClassAuthorizer) Authorize(
	ctx context.Context,
	namespace string,
	className string,
	caller authenticationv1.UserInfo,
) error

Authorize submits a direct SubjectAccessReview for verb use on the class.

func (WorkspaceClassAuthorizer) AuthorizeCheckpoint added in v0.2.0

func (a WorkspaceClassAuthorizer) AuthorizeCheckpoint(ctx context.Context, namespace, name string, caller authenticationv1.UserInfo) error

AuthorizeCheckpoint checks permission to consume retained workspace data.

func (WorkspaceClassAuthorizer) AuthorizeCheckpointSource added in v0.2.0

func (a WorkspaceClassAuthorizer) AuthorizeCheckpointSource(ctx context.Context, namespace, name string, caller authenticationv1.UserInfo) error

AuthorizeCheckpointSource checks permission to export a workspace's data.

Source Files

Jump to

Keyboard shortcuts

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