Documentation
¶
Overview ¶
Package epwire assembles endpoints (#2170): the binding store, the bot check, the runner and manage_script's endpoint commands, from what the script wiring already holds. internal/platform/scriptwiring builds it and hands the commands to the script layer; the HTTP surface (internal/endpoint/ephttp) and the portal routes read the rest through the script layer's handle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
DB *sql.DB
Server *mcp.Server
Audit middleware.AuditLogger
Metrics *observability.Metrics
// Subjects resolves where an author's managed resources land.
Subjects interface {
ForRun(ctx context.Context, address, saved string) string
}
Limits scriptrun.PlatformLimits
Destinations []script.Destination
// Sources reads the managed-resource text a version loads.
Sources *scriptsrc.Reader
// Key signs proof-of-work challenges (botcheck.Key); nil leaves the
// deployment unable to issue one.
Key []byte
// Encryptor decrypts the stored secret a bot check provider's key is in.
Encryptor secretstore.Encryptor
// BaseURL is the deployment's public address.
BaseURL string
// Authority resolves a run's roles to the persona a token key's
// allow_personas is checked against.
Authority scripttoken.Authority
}
Deps is what the script wiring hands over.
type Endpoints ¶
type Endpoints struct {
Bindings epbinding.Store
Checker *botcheck.Checker
Runner *eprun.Runner
Commands *epcmd.Handler
// Tokens answers the tokens a script mints and verifies (#2175), in an
// endpoint request, a run and a draft alike.
Tokens *scripttoken.Issuer
// Refusals counts the requests refused before their handler ran
// (#2208); its flush loop runs with the platform's lifecycle.
Refusals *eprefusal.Counter
// Approvals is the Approvals queue (#2437, #2494): a form's version is
// approved before callers with no session are served it. Its notifier
// and approvers are set once notifications are assembled.
Approvals *approval.Service
// Previews opens a form's preview for its owner (#2494).
Previews *eppreview.Previews
// Sites is the static sites and pages feature (#2517, #2518), nil where
// it cannot run.
Sites *sitewire.Runtime
// Handler is the HTTP surface, set when its routes are mounted; an
// application's page origin answers through it.
Handler *ephttp.Handler
// PortalCaller is who a portal request is signed in as, set with Handler.
PortalCaller func(r *http.Request) (*eprun.Caller, error)
}
Endpoints is the assembled feature.
func Build ¶
Build assembles endpoints, or returns nil with no database: there is nowhere to keep a binding.
func (*Endpoints) Forms ¶ added in v1.152.0
Forms is what an asset's declaration of mcp:form:<endpoint> reads (#2177): whether the endpoint serves a form, whether it answers signed-in callers only, and who owns its script.
func (*Endpoints) Start ¶ added in v1.149.0
Start runs what runs in the background: the refusal counts' flush loop. Nil-safe.
func (*Endpoints) TokenIssuer ¶
func (e *Endpoints) TokenIssuer() *scripttoken.Issuer
TokenIssuer is the token issuer, nil on nil Endpoints: a deployment with no database issues no tokens.