capability

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package capability owns execution-side capability discovery. It converts private bounded probe observations into the closed, secret-free core inventory contract.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedPlatform    = errors.New("capability command: unsupported platform")
	ErrCommandAbsent          = errors.New("capability command: absent")
	ErrCommandOutputLimit     = errors.New("capability command: output limit exceeded")
	ErrCommandIdentityChanged = errors.New("capability command: executable identity changed")
)

Functions

func RecheckAll

func RecheckAll(mode corecap.RefreshMode, requestID string) corecap.RecheckRequest

func ValidateRecheckRequest

func ValidateRecheckRequest(request corecap.RecheckRequest) error

Types

type Client

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

func NewClient

func NewClient(token string) *Client

func NewClientWithToken

func NewClientWithToken(token func() string) *Client

NewClientWithToken reads the mesh token immediately before every request so a token minted by live mesh enrollment takes effect without a daemon restart.

func (*Client) Get

func (c *Client) Get(ctx context.Context, baseURL, expectedNodeID string) (corecap.NodeInventory, error)

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context, baseURL, expectedNodeID string, refresh corecap.RecheckRequest) (corecap.NodeInventory, error)

type CodexAppServerContract

type CodexAppServerContract struct {
	ExecutableDigest         string
	NormalSchemaDigest       string
	NormalSchemaFiles        int
	ExperimentalSchemaDigest string
	ExperimentalSchemaFiles  int
	GmailIsolationReady      bool
	SupabaseIsolationReady   bool
}

CodexAppServerContract carries facts verified outside the live JSONL session. The inspector copies only these normalized schema/isolation facts; account and model readiness always come from the current app-server session.

type CodexAppServerInspector

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

func NewCodexAppServerInspector

func NewCodexAppServerInspector(starter CodexAppServerStarter, contract CodexAppServerContract) *CodexAppServerInspector

func NewVerifiedCodexAppServerInspector

func NewVerifiedCodexAppServerInspector(starter CodexAppServerStarter, verifier CodexContractVerifier) *CodexAppServerInspector

NewVerifiedCodexAppServerInspector defers schema generation until a live capability probe needs Codex. A successful proof is immutable for this process; a failed proof is briefly cached so one inventory refresh cannot fan out into repeated expensive schema generation attempts.

func (*CodexAppServerInspector) Inspect

type CodexAppServerProcess

type CodexAppServerProcess interface {
	io.Reader
	io.Writer
	io.Closer
	ExecutableDigest() string
}

CodexAppServerProcess is the private JSONL process boundary used by the no-turn inspector. Tests substitute an in-memory transcript; production starts the exact executable identity held by CommandResolver.

type CodexAppServerStarter

type CodexAppServerStarter interface {
	Start(context.Context) (CodexAppServerProcess, error)
}

type CodexContractVerifier

type CodexContractVerifier interface {
	Verify(context.Context) (CodexAppServerContract, error)
}

CodexContractVerifier proves the held Codex executable's no-turn app-server schema contract. Production verification is intentionally lazy: wiring and read-only CLI commands must never run provider commands.

type CodexInspection

type CodexInspection struct {
	AccountReady             bool
	AccountHandle            string
	AccountType              string
	AccountPlan              string
	Models                   map[string]bool
	DefaultModel             string
	ExecutableDigest         string
	NormalSchemaDigest       string
	NormalSchemaFiles        int
	ExperimentalSchemaDigest string
	ExperimentalSchemaFiles  int
	GmailIsolationReady      bool
	SupabaseIsolationReady   bool
}

CodexInspection contains normalized process-private facts extracted from one no-turn app-server session and its generated schema bundles. The executable digest is compared internally and must never cross a public API boundary.

type CodexInspector

type CodexInspector interface {
	Inspect(context.Context) (CodexInspection, error)
}

type CodexSchemaContractVerifier

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

func NewCodexSchemaContractVerifier

func NewCodexSchemaContractVerifier(resolver *CommandResolver) *CodexSchemaContractVerifier

NewCodexSchemaContractVerifier constructs the catalog-v2 production verifier. Verify must succeed before its contract is supplied to the live app-server inspector.

func (*CodexSchemaContractVerifier) Verify

type CodexSchemaGenerator

type CodexSchemaGenerator interface {
	Generate(context.Context, string, string) (string, error)
}

CodexSchemaGenerator is the bounded command seam for generating both schema bundles from one executable identity.

type CodexSubscriptionResolver added in v1.0.4

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

CodexSubscriptionResolver bridges capability-authorized, content-addressed Codex bytes into the isolated subscription runtime. It returns no account identifiers or auth paths beyond the process-private environment required by the already authenticated Codex executable.

func NewCodexSubscriptionResolver added in v1.0.4

func NewCodexSubscriptionResolver(resolver *CommandResolver) *CodexSubscriptionResolver

func (*CodexSubscriptionResolver) ResolveCodex added in v1.0.4

type CommandExecutor

type CommandExecutor interface {
	Run(context.Context, string, ...string) CommandResult
}

CommandExecutor is the narrow command-probe seam used by LocalProber.

type CommandResolver

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

CommandResolver resolves a command once, reads it through a no-follow file descriptor, and stages immutable content-addressed bytes for both probes and dispatch. Paths and fingerprints stay execution-private.

func NewCommandResolver

func NewCommandResolver(options CommandResolverOptions) (*CommandResolver, error)

func (*CommandResolver) AuthorizeExecutable

func (r *CommandResolver) AuthorizeExecutable(name, digest string) error

AuthorizeExecutable pins one command name to bytes whose capability contract has completed successfully. A running daemon never silently adopts different bytes; an upgrade requires a restart and a fresh capability probe.

func (*CommandResolver) Hold

func (r *CommandResolver) Hold(name string) (*HeldCommand, error)

func (*CommandResolver) ResolveVerifiedExecutable

func (r *CommandResolver) ResolveVerifiedExecutable(name string) (string, error)

ResolveVerifiedExecutable implements native.VerifiedExecutableResolver without importing the concrete native package. It re-holds the current PATH target, compares it with the authorized digest, and returns only the immutable staged path. All failures collapse to one secret-free drift error.

type CommandResolverOptions

type CommandResolverOptions struct {
	Platform             string
	StageDir             string
	Environment          []string
	PreferredExecutables map[string]string
}

type CommandResult

type CommandResult struct {
	Output           []byte
	ExecutableDigest string
	Err              error
}

CommandResult is the private result of one bounded, held executable probe. Output must be parsed and discarded by the prober; it never enters public inventory or error text.

type DiscoveryError

type DiscoveryError struct {
	Reason corecap.Reason
}

func (*DiscoveryError) Error

func (e *DiscoveryError) Error() string

type GmailInspection

type GmailInspection struct {
	Ready         bool
	BindingHandle string
}

type GmailInspector

type GmailInspector interface {
	InspectGmail(context.Context) (GmailInspection, error)
}

type HeldCommand

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

func (*HeldCommand) Digest

func (h *HeldCommand) Digest() string

Digest is an internal stable executable-content identity. It must never be copied into public inventory or errors.

func (*HeldCommand) Environment

func (h *HeldCommand) Environment() []string

func (*HeldCommand) Executable

func (h *HeldCommand) Executable() string

Executable returns the immutable staged path for an execution adapter. This is process-private and must not cross an API boundary.

func (*HeldCommand) Run

func (h *HeldCommand) Run(ctx context.Context, args []string, maximum int, timeout time.Duration) ([]byte, error)

Run executes the held identity with bounded combined output. On an output limit error no probe bytes are returned.

type LocalProber

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

LocalProber implements only the catalog's closed predicate IDs. Raw command output and private connector identifiers are reduced to stable binding material before Registry hashes them into opaque revisions.

func NewLocalProber

func NewLocalProber(commands CommandExecutor, codex CodexInspector, gmail GmailInspector, supabase SupabaseInspector) *LocalProber

func (*LocalProber) Probe

func (p *LocalProber) Probe(ctx context.Context, request ProbeRequest) ProbeObservation

type MachineRefresher

type MachineRefresher interface {
	RefreshMachine(context.Context, string, corecap.RefreshMode, []string) (corecap.MachineInventory, error)
}

MachineRefresher is the narrow capability-control seam needed immediately before provider dispatch. It refreshes only the machine placement already selected by the deterministic core.

type ProbeError

type ProbeError struct {
	Reason corecap.Reason
}

ProbeError permits a private inspector to return a closed public reason without exposing its underlying output or credentials.

func (*ProbeError) Error

func (e *ProbeError) Error() string

type ProbeObservation

type ProbeObservation struct {
	State          corecap.PredicateState
	Reason         corecap.Reason
	StableBinding  []string
	ResolvedModel  string
	TextOnlyOption *corecap.TextOnlyOptionOffer
}

type ProbeRequest

type ProbeRequest struct {
	AdapterID   string
	TargetID    string
	ProfileID   string
	BindingID   string
	PredicateID string
}

type Prober

type Prober interface {
	Probe(context.Context, ProbeRequest) ProbeObservation
}

type ProfileGate

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

ProfileGate blocks legacy dispatch unless its exact cataloged execution profile is ready on the already-selected machine. It never substitutes a model or changes placement.

func NewProfileGate

func NewProfileGate(next runtime.Runtime, refresher MachineRefresher) *ProfileGate

func (*ProfileGate) Dispatch

func (g *ProfileGate) Dispatch(ctx context.Context, spec runtime.RunSpec) (runtime.Run, error)

func (*ProfileGate) Name

func (g *ProfileGate) Name() string

type ProfilePreflightError

type ProfilePreflightError struct {
	ProfileID string
	Machine   string
	Reason    corecap.Reason
}

ProfilePreflightError is safe to persist and render. It contains only closed catalog identifiers, the public machine name, and a closed reason code.

func (*ProfilePreflightError) Error

func (e *ProfilePreflightError) Error() string

type Registry

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

func NewRegistry

func NewRegistry(options RegistryOptions) (*Registry, error)

func (*Registry) Current

func (r *Registry) Current() corecap.NodeInventory

func (*Registry) Refresh

type RegistryOptions

type RegistryOptions struct {
	NodeID      string
	Platform    string
	RevisionKey []byte
	Prober      Prober
	Now         func() time.Time
}

type ResolverCodexAppServerStarter

type ResolverCodexAppServerStarter struct {
	Resolver *CommandResolver
}

ResolverCodexAppServerStarter launches the same immutable staged Codex bytes and environment policy used by the ordinary command probes.

func (ResolverCodexAppServerStarter) Start

type ResolverCodexSchemaGenerator

type ResolverCodexSchemaGenerator struct {
	Resolver *CommandResolver
}

ResolverCodexSchemaGenerator runs both schema commands from one held Codex executable identity. Command output is bounded and discarded.

func (ResolverCodexSchemaGenerator) Generate

func (g ResolverCodexSchemaGenerator) Generate(ctx context.Context, normalDir, experimentalDir string) (string, error)

type ResolverExecutor

type ResolverExecutor struct {
	Resolver *CommandResolver
}

ResolverExecutor holds the exact executable bytes before every probe and runs that staged identity with the capability probe bounds.

func (ResolverExecutor) AuthorizeExecutable

func (e ResolverExecutor) AuthorizeExecutable(name, digest string) error

func (ResolverExecutor) Run

func (e ResolverExecutor) Run(ctx context.Context, name string, args ...string) CommandResult

type SupabaseInspection

type SupabaseInspection struct {
	Ready         bool
	BindingHandle string
}

type SupabaseInspector

type SupabaseInspector interface {
	InspectSupabase(context.Context) (SupabaseInspection, error)
}

Jump to

Keyboard shortcuts

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