Documentation
¶
Overview ¶
Package bootstrap wires AgentSQL production components without transport concerns or process-global secret mutation.
Index ¶
- Constants
- type B2Status
- type B5DatasourceAuthority
- type B5Runtime
- func (runtime *B5Runtime) Admit() error
- func (runtime *B5Runtime) CheckDatasourceDialect(ctx context.Context, id string) error
- func (runtime *B5Runtime) Enabled() bool
- func (runtime *B5Runtime) FinalFence(ctx context.Context, result b5coordinator.Result) error
- func (runtime *B5Runtime) PostgresEnabled() bool
- func (runtime *B5Runtime) ResolveDatasource(ctx context.Context, id string) (B5DatasourceAuthority, error)
- func (runtime *B5Runtime) Status(_ context.Context) (B5Status, error)
- type B5Status
- type ChainManifestProvider
- type ChainMonitor
- type MySQLColumnGrant
- type Runtime
- func (runtime *Runtime) AuditWriterReady(domain string) bool
- func (runtime *Runtime) B2Ready() bool
- func (runtime *Runtime) B2Status() B2Status
- func (runtime *Runtime) B5Status(ctx context.Context) (B5Status, bool, error)
- func (runtime *Runtime) BindMySQLColumnPolicy(ctx context.Context, policyID string, expectedRevision int64, ...) (model.Policy, error)
- func (runtime *Runtime) Close() error
- func (runtime *Runtime) ListDatasourceSchema(ctx context.Context, datasource model.Datasource, tables []executor.TableRef) ([]executor.SchemaColumn, error)
- func (runtime *Runtime) NativeDiscover(ctx context.Context, datasource model.Datasource) (executor.NativeCatalog, error)
- func (runtime *Runtime) NativeQueryRead(ctx context.Context, datasource model.Datasource, ...) (executor.NativeQueryResult, error)
- func (runtime *Runtime) NativeServerVersion(ctx context.Context, datasource model.Datasource) (string, error)
- func (runtime *Runtime) PingDatasource(ctx context.Context, datasource model.Datasource) error
- func (runtime *Runtime) PublishManagementAudit(recorded model.AuditLog)
- func (runtime *Runtime) RedactionReady() (bool, []int)
- func (runtime *Runtime) RedactionReconciliation() (redactionstate.Result, bool)
- func (runtime *Runtime) RefreshNotificationNames(ctx context.Context) error
- func (runtime *Runtime) RerunRedactionReconciliation(ctx context.Context) error
- func (runtime *Runtime) RunChainVerificationOnce(ctx context.Context)
- func (runtime *Runtime) RunPeriodicRedactionReconciliationOnce(ctx context.Context) error
- func (runtime *Runtime) SetB5StatusProvider(provider func(context.Context) (B5Status, error))
- func (runtime *Runtime) ValidateRedactionActivation(rule mask.Rule) error
Constants ¶
const ( B2StateActive = "active" B2StateDryRun = "dry-run" B2StateFeatureOff = "feature-off" B2StateDegraded = "degraded" B2StateUnsupported = "unsupported" B2ReasonFeatureOff = "B2_FEATURE_OFF" B2ReasonDryRunReady = "B2_DRY_RUN_READY" B2ReasonNoPostgresDatasource = "B2_POSTGRES_DATASOURCE_REQUIRED" B2ReasonEnrollmentIncomplete = "B2_ENROLLMENT_INCOMPLETE" B2ReasonCatalogBindIncomplete = "B2_CATALOG_BIND_INCOMPLETE" B2ReasonBinderUnsupported = "B2_BINDER_ABI_UNSUPPORTED" B2ReasonBinderProbeFailed = "B2_BINDER_PROBE_FAILED" B2ReasonArtifactAttestation = "B2_ARTIFACT_ATTESTATION_FAILED" B2ReasonHeartbeatFailed = "B2_RUNTIME_HEARTBEAT_FAILED" B2ReasonRuntimeLeaseExpired = "B2_RUNTIME_LEASE_EXPIRED" B2ReasonDatasourceUnsupported = "B2_DATASOURCE_DIALECT_UNSUPPORTED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type B2Status ¶
type B2Status struct {
State string `json:"state"`
Reason string `json:"reason"`
Protocol int `json:"protocol"`
InstanceID string `json:"instance_id,omitempty"`
ArtifactDigest string `json:"artifact_digest,omitempty"`
LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
UnsupportedDatasources map[string]string `json:"unsupported_datasources,omitempty"`
DatasourceModes map[string]string `json:"datasource_modes,omitempty"`
}
B2Status is the stable, non-secret readiness/health projection.
type B5DatasourceAuthority ¶
type B5DatasourceAuthority struct {
Dialect, Mode string
ServerMajor int
KeyRevision, DatasourceRevision, PolicyRevision uint64
}
B5DatasourceAuthority is derived exclusively from metadata and a live read-only capability probe. MCP request dialect/version fields never become authority.
type B5Runtime ¶
type B5Runtime struct {
Directory *b5session.Directory
Coordinator *b5coordinator.Coordinator
Analyzer b5coordinator.PlanAnalyzerResolver
InstanceID string
StickyRoute string
Limits b5coordinator.ResourceLimits
// contains filtered or unexported fields
}
B5Runtime owns the complete production B5 graph. Protocol packages receive only the narrow directory/coordinator/analyzer surfaces below.
func (*B5Runtime) CheckDatasourceDialect ¶
CheckDatasourceDialect performs only metadata lookup. It is safe to run before parsing a client plan and guarantees that MySQL is rejected without opening a business pool or probing a server.
func (*B5Runtime) FinalFence ¶
func (*B5Runtime) PostgresEnabled ¶
func (*B5Runtime) ResolveDatasource ¶
type B5Status ¶
type B5Status struct {
Enabled bool `json:"enabled"`
State string `json:"state"`
Reason string `json:"reason"`
Ready bool `json:"ready"`
}
B5Status is the non-secret S9 projection linked into health/readiness by the production assembly. An explicit feature-off keeps the pre-S9 probe representation unchanged.
type ChainManifestProvider ¶
type ChainManifestProvider = store.ChainManifestProvider
ChainManifestProvider resolves trusted, database-external chain authority.
type ChainMonitor ¶
type ChainMonitor struct {
// contains filtered or unexported fields
}
ChainMonitor periodically verifies the configured audit-chain domains. It is observational: its result never participates in the process-wide readiness endpoint.
func NewChainMonitor ¶
func NewChainMonitor( metadataStore *store.Store, manifests ChainManifestProvider, hub *metrics.Metrics, domains []string, interval time.Duration, ) *ChainMonitor
NewChainMonitor constructs a monitor with production jitter. interval is injectable so tests and alternate orchestrators can use a shorter cadence.
func (*ChainMonitor) AuditWriterReady ¶
func (monitor *ChainMonitor) AuditWriterReady(domain string) bool
AuditWriterReady is false only when the trusted expected mode is HMAC and a non-empty current chain key cannot be obtained. Chain validity is deliberately irrelevant to writer readiness.
func (*ChainMonitor) Domains ¶
func (monitor *ChainMonitor) Domains() []string
Domains returns a defensive copy of the domains observed by this monitor.
func (*ChainMonitor) RunChainVerificationOnce ¶
func (monitor *ChainMonitor) RunChainVerificationOnce(ctx context.Context)
RunChainVerificationOnce synchronously attempts one verification for every domain. A domain already being verified is skipped without waiting.
type MySQLColumnGrant ¶ added in v1.3.0
type Runtime ¶
type Runtime struct {
Pipeline *pipeline.Pipeline
ControlledRead *controlledread.Service
ManagementAudit audit.Recorder
Store *store.Store
Metrics *metrics.Metrics
ChainMonitor *ChainMonitor
// Events is the in-process stream of successfully persisted audits.
Events *eventbus.Hub
// Notifications is the process-local best-effort notification manager.
Notifications *notify.Manager
// B5 owns the production logical-session and planned-transaction graph when
// mcp.sessions.enabled is effective.
B5 *B5Runtime
// contains filtered or unexported fields
}
Runtime owns the production pipeline, business connection manager, and metadata store for one AgentSQL process.
func Assemble ¶
Assemble validates configuration and wires the required pipeline ports and the optional store-backed runtime rule overrides.
func (*Runtime) AuditWriterReady ¶
AuditWriterReady reports only whether the expected HMAC key is currently available for writes in domain. Historical chain validity is not a gate.
func (*Runtime) B2Ready ¶
B2Ready is false whenever enabled enforcement cannot admit protocol-3 work. Feature-off and dry-run do not gate the existing table-level service.
func (*Runtime) B2Status ¶
B2Status returns the protocol-3 activation/lease state without exposing credentials or probe diagnostics.
func (*Runtime) BindMySQLColumnPolicy ¶ added in v1.3.0
func (runtime *Runtime) BindMySQLColumnPolicy(ctx context.Context, policyID string, expectedRevision int64, schema, table string, grants []MySQLColumnGrant, ) (model.Policy, error)
BindMySQLColumnPolicy is the administrative two-phase enrollment boundary. The first catalog read holds no control lock. The second revalidates while the metadata CAS is held, and keeps the business MDL until commit returns.
func (*Runtime) ListDatasourceSchema ¶
func (runtime *Runtime) ListDatasourceSchema( ctx context.Context, datasource model.Datasource, tables []executor.TableRef, ) ([]executor.SchemaColumn, error)
ListDatasourceSchema performs only the fixed typed information-schema read.
func (*Runtime) NativeDiscover ¶ added in v0.5.0
func (runtime *Runtime) NativeDiscover(ctx context.Context, datasource model.Datasource) (executor.NativeCatalog, error)
func (*Runtime) NativeQueryRead ¶ added in v0.5.0
func (runtime *Runtime) NativeQueryRead(ctx context.Context, datasource model.Datasource, request executor.NativeQueryRequest) (executor.NativeQueryResult, error)
These methods keep the runtime secret and read-only pool behind the runtime.
func (*Runtime) NativeServerVersion ¶ added in v0.5.0
func (*Runtime) PingDatasource ¶
PingDatasource performs a fixed health operation without exporting a database handle or accepting SQL.
func (*Runtime) PublishManagementAudit ¶
PublishManagementAudit emits an already-persisted management audit. It is best effort and intentionally does not affect the committed operation.
func (*Runtime) RedactionReady ¶
RedactionReady returns the last newly computed reconciliation gate. It never becomes true merely because time passed or another command reported success.
func (*Runtime) RedactionReconciliation ¶
func (runtime *Runtime) RedactionReconciliation() (redactionstate.Result, bool)
RedactionReconciliation returns a concurrency-safe, non-secret snapshot for readiness and management observation.
func (*Runtime) RefreshNotificationNames ¶
RefreshNotificationNames atomically refreshes the notification display-name cache. Delivery keeps using the previous snapshot if refresh fails.
func (*Runtime) RerunRedactionReconciliation ¶
RerunRedactionReconciliation performs one strong read and atomically replaces readiness with the result from this round's observed snapshot.
func (*Runtime) RunChainVerificationOnce ¶
RunChainVerificationOnce attempts one audit-chain verification round without changing process-wide readiness.
func (*Runtime) RunPeriodicRedactionReconciliationOnce ¶
RunPeriodicRedactionReconciliationOnce exposes the production periodic read-only behavior for deterministic scheduling tests and future orchestration.
func (*Runtime) SetB5StatusProvider ¶
SetB5StatusProvider does not activate B5 execution. It links an already explicitly assembled S9 runtime to the existing health/readiness surface.