Documentation
¶
Overview ¶
Package convert provides dbq→proto conversion functions shared by api and realtime packages.
Index ¶
- func A2ASettingsToProto(s siblingssvc.A2ASettings) *airlockv1.A2ASettings
- func AddableSiblingToProto(a siblingssvc.Addable) *airlockv1.AddableSiblingInfo
- func AgentBuildDetailToProto(b dbq.AgentBuild, rollbackTargetSourceRef string) *airlockv1.AgentBuildInfo
- func AgentBuildListItemToProto(b dbq.ListAgentBuildsByAgentRow, rollbackTargetSourceRef string) *airlockv1.AgentBuildInfo
- func AgentModelConfigToProto(agent dbq.Agent, slots []dbq.AgentModelSlot) *airlockv1.AgentModelConfig
- func AgentToProto(a dbq.Agent) *airlockv1.AgentInfo
- func AgentToolToProto(t dbq.AgentTool) *airlockv1.ToolInfo
- func AnyToListValue(v any) *structpb.ListValue
- func AnyToStruct(v any) *structpb.Struct
- func BridgeFieldsToProto(id, agentID, ownerPrincipalID pgtype.UUID, ...) *airlockv1.BridgeInfo
- func BridgeListItemToProto(item bridgessvc.ListItem) *airlockv1.BridgeInfo
- func BridgeResultToProto(res bridgessvc.Result) *airlockv1.BridgeInfo
- func BridgeRowToProto(br dbq.Bridge) *airlockv1.BridgeInfo
- func BuildMCPAuthURL(publicURL, agentID, slug, authMode string) string
- func CatalogModelToProto(m catalogsvc.Model) *airlockv1.ModelInfo
- func CatalogProviderToProto(p catalogsvc.Provider) *airlockv1.ProviderInfo
- func ConnectionDTOToProto(c connsvc.Connection, publicURL, agentID string) *airlockv1.ConnectionInfo
- func ConnectionToProto(c dbq.ListConnectionNeedsByAgentRow, publicURL, agentID string) *airlockv1.ConnectionInfo
- func ConnectionWarnings(authMode string, authorized, hasRefreshToken bool) []string
- func ConversationToProto(c dbq.AgentConversation) *airlockv1.ConversationInfo
- func CredentialStatusToProto(st connsvc.Status) *airlockv1.CredentialStatusResponse
- func EnvVarToProto(e connsvc.EnvVar) *airlockv1.EnvVarInfo
- func ExecEndpointRowToProto(ep dbq.AgentExecEndpoint) *airlockv1.ExecEndpointInfo
- func ExecEndpointTestToProto(r execsvc.TestResult) *airlockv1.ExecEndpointTestResult
- func ExecNeedRowToProto(ep dbq.ListExecNeedsByAgentRow) *airlockv1.ExecEndpointInfo
- func GitCredToProto(c gitcredssvc.Credential) *airlockv1.GitCredential
- func InboundSiblingToProto(s siblingssvc.Inbound) *airlockv1.InboundSiblingInfo
- func JSONToListValue(data []byte) *structpb.ListValue
- func JSONToStruct(data []byte) *structpb.Struct
- func MCPServerToProto(m connsvc.MCPServer, publicURL, agentID string) *airlockv1.MCPServerInfo
- func MCPStatusToProto(s connsvc.MCPStatus) *airlockv1.MCPStatusInfo
- func MemberToProto(m memberssvc.Member) *airlockv1.AgentMemberInfo
- func PasskeyToProto(p passkeyssvc.Passkey) *airlockv1.Passkey
- func PendingSystemToolFromCheckpoint(blob []byte) *airlockv1.PendingSystemTool
- func PgNumericToFloat(n pgtype.Numeric) float64
- func PgTimestampToProto(t pgtype.Timestamptz) *timestamppb.Timestamp
- func PgUUIDToString(u pgtype.UUID) string
- func ProviderCapabilityToProto(c catalogsvc.ProviderCapability) *airlockv1.ProviderCapabilityInfo
- func ProviderToProto(p dbq.Provider) *airlockv1.Provider
- func RouteToProto(r dbq.AgentRoute) *airlockv1.RouteInfo
- func RunToProto(r dbq.Run, detail bool) *airlockv1.RunInfo
- func ScheduleToProto(s dbq.ListSchedulesWithNextFireRow) *airlockv1.ScheduleInfo
- func SetupCountsToProto(c connsvc.SetupCounts) *airlockv1.SetupCountsInfo
- func SiblingToProto(s siblingssvc.Sibling) *airlockv1.SiblingInfo
- func SysConversationToProto(t dbq.SystemConversation) *airlockv1.SystemConversationInfo
- func SysMessageToProto(m dbq.SystemMessage) *airlockv1.SystemMessageInfo
- func SystemSettingsToProto(s dbq.SystemSetting) *airlockv1.SystemSettingsInfo
- func TenantRoleStringToProto(s string) airlockv1.TenantRole
- func TenantToProto(t dbq.Tenant) *airlockv1.Tenant
- func TestCredentialResultToProto(r connsvc.TestResult) *airlockv1.TestCredentialResponse
- func TodosFromJSON(raw []byte) []*airlockv1.TodoItem
- func UserDetailToProto(d userssvc.Detail) *airlockv1.User
- func UserSummaryToProto(u userssvc.Summary) *airlockv1.UserSummary
- func UserToProto(u dbq.User) *airlockv1.User
- func WebhookToProto(wh dbq.ListWebhooksByAgentWithStatusRow, publicURL, agentID string) *airlockv1.WebhookInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func A2ASettingsToProto ¶ added in v0.4.0
func A2ASettingsToProto(s siblingssvc.A2ASettings) *airlockv1.A2ASettings
A2ASettingsToProto maps the per-agent protocol-surface toggles DTO to the wire A2ASettings.
func AddableSiblingToProto ¶ added in v0.4.0
func AddableSiblingToProto(a siblingssvc.Addable) *airlockv1.AddableSiblingInfo
AddableSiblingToProto maps the siblings service Addable DTO to the wire AddableSiblingInfo.
func AgentBuildDetailToProto ¶ added in v0.4.0
func AgentBuildDetailToProto(b dbq.AgentBuild, rollbackTargetSourceRef string) *airlockv1.AgentBuildInfo
AgentBuildDetailToProto maps the full build row (with sol/docker logs) to the wire AgentBuildInfo. rollbackTargetSourceRef is the resolved target row's SourceRef when this build is a rollback, blank otherwise.
func AgentBuildListItemToProto ¶ added in v0.4.0
func AgentBuildListItemToProto(b dbq.ListAgentBuildsByAgentRow, rollbackTargetSourceRef string) *airlockv1.AgentBuildInfo
AgentBuildListItemToProto maps a list row (no log fields) to the wire AgentBuildInfo. rollbackTargetSourceRef is resolved by the caller (the list query doesn't carry it; the handler builds a map keyed by build ID and threads the lookup through).
func AgentModelConfigToProto ¶ added in v0.4.0
func AgentModelConfigToProto(agent dbq.Agent, slots []dbq.AgentModelSlot) *airlockv1.AgentModelConfig
AgentModelConfigToProto packs the agent's per-capability model pins plus its custom model slots into the wire AgentModelConfig.
func AgentToProto ¶ added in v0.4.0
AgentToProto maps an agents row to the wire AgentInfo. Does not set Running or YourAccess — those are layered on by the caller when known (the operator-facing list/detail handlers stamp both; agent-internal lookups leave them blank).
func AnyToListValue ¶
AnyToListValue marshals an arbitrary Go slice to a protobuf ListValue via JSON round-trip.
func AnyToStruct ¶
AnyToStruct marshals an arbitrary Go value to a protobuf Struct via JSON round-trip.
func BridgeFieldsToProto ¶ added in v0.4.0
func BridgeFieldsToProto( id, agentID, ownerPrincipalID pgtype.UUID, typ, name, botUsername, status string, isSystem, isManager bool, managerError string, createdAt, updatedAt pgtype.Timestamptz, ownerEmail, ownerDisplayName pgtype.Text, ) *airlockv1.BridgeInfo
BridgeFieldsToProto packs the union of a Bridge row plus an optional owner join into the wire BridgeInfo. The settings JSONB is decoded via bridgessvc.DecodeSettings so every caller sees the same defaulted view.
func BridgeListItemToProto ¶ added in v0.4.0
func BridgeListItemToProto(item bridgessvc.ListItem) *airlockv1.BridgeInfo
BridgeListItemToProto adapts a bridges service ListItem to the wire BridgeInfo. Same shape as Result but the JOIN's Owner pointer rides alongside the row instead of replacing owner_principal_id.
func BridgeResultToProto ¶ added in v0.4.0
func BridgeResultToProto(res bridgessvc.Result) *airlockv1.BridgeInfo
BridgeResultToProto adapts a bridges service Result (bridge row + optional owner DTO) to the wire BridgeInfo. The Result's Owner field carries the JOIN result for handlers that need the resolved owner email/name; nil-Owner falls back to the row.s owner_principal_id with blank owner-display fields.
func BridgeRowToProto ¶ added in v0.4.0
func BridgeRowToProto(br dbq.Bridge) *airlockv1.BridgeInfo
BridgeRowToProto adapts a bare Bridge row (no owner join) to the wire BridgeInfo.
func BuildMCPAuthURL ¶ added in v0.4.0
BuildMCPAuthURL returns the airlock-hosted URL operators visit to authorize an MCP server. Empty for non-interactive auth modes.
func CatalogModelToProto ¶ added in v0.4.0
func CatalogModelToProto(m catalogsvc.Model) *airlockv1.ModelInfo
CatalogModelToProto maps the catalog service Model DTO to the wire ModelInfo.
func CatalogProviderToProto ¶ added in v0.4.0
func CatalogProviderToProto(p catalogsvc.Provider) *airlockv1.ProviderInfo
CatalogProviderToProto maps the catalog service Provider DTO to the wire ProviderInfo.
func ConnectionDTOToProto ¶ added in v0.4.0
func ConnectionDTOToProto(c connsvc.Connection, publicURL, agentID string) *airlockv1.ConnectionInfo
ConnectionDTOToProto maps the connections service Connection DTO (already stripped of token bytes) to the wire ConnectionInfo. Used by ListConnections on both web and sysagent surfaces.
func ConnectionToProto ¶ added in v0.4.0
func ConnectionToProto(c dbq.ListConnectionNeedsByAgentRow, publicURL, agentID string) *airlockv1.ConnectionInfo
ConnectionToProto projects an agent's connection need (joined to its bound resource, if any) to the operator-visible wire shape: the need slug as the handle, derived booleans (Authorized, HasOAuthApp), the auth-flow start URL, and warnings. The row carries no secret columns, so none can leak. Id is the zero UUID for an unconfigured need. Every consumer that surfaces a connection — web UI handler and the in-airlock system agent — goes through this.
func ConnectionWarnings ¶ added in v0.4.0
ConnectionWarnings is the shared rule set for warning strings shown on a connection card. Exposed so the credentials handler — which builds ConnectionInfo from the connections service DTO (not the raw dbq row) — uses the same warning list as ConnectionToProto.
An expired access token is deliberately NOT a warning: the proxy renews it on demand (oauth.EnsureConnectionToken) so it self-heals on the next call. The only durable risk is having no refresh token to renew from — once that access token lapses the connection truly stops working until re-auth. A provider-revoked grant clears the credentials entirely, which drops authorized to false (card shows "Needs Setup"), handled by line 105.
func ConversationToProto ¶ added in v0.4.0
func ConversationToProto(c dbq.AgentConversation) *airlockv1.ConversationInfo
ConversationToProto maps an agent_conversations row to the wire ConversationInfo, defaulting an empty source to "web" so the frontend can always render a source chip.
AgentMessage rows aren't covered here: their parts JSON may carry S3-keyed media references that need presigned-URL resolution before they're safe to ship to the client. That converter lives in api/conversations.go::messageToProto, alongside the S3 client and logger it depends on.
func CredentialStatusToProto ¶ added in v0.4.0
func CredentialStatusToProto(st connsvc.Status) *airlockv1.CredentialStatusResponse
CredentialStatusToProto packs a connections.Status into the wire CredentialStatusResponse.
func EnvVarToProto ¶ added in v0.4.0
func EnvVarToProto(e connsvc.EnvVar) *airlockv1.EnvVarInfo
EnvVarToProto maps the connections service EnvVar DTO to the wire EnvVarInfo. Value is non-empty only when !is_secret AND configured (the service enforces this).
func ExecEndpointRowToProto ¶ added in v0.4.0
func ExecEndpointRowToProto(ep dbq.AgentExecEndpoint) *airlockv1.ExecEndpointInfo
ExecEndpointRowToProto packs an AgentExecEndpoint row into the wire ExecEndpointInfo. Strips PrivateKeyRef (a secrets-store reference) and the full host-key blob; only the SHA256 fingerprint is exposed so the operator can verify TOFU pinning without leaking the raw key material to clients or the LLM.
func ExecEndpointTestToProto ¶ added in v0.4.0
func ExecEndpointTestToProto(r execsvc.TestResult) *airlockv1.ExecEndpointTestResult
ExecEndpointTestToProto packs the exec-endpoint probe outcome into the wire ExecEndpointTestResult.
func ExecNeedRowToProto ¶ added in v0.4.0
func ExecNeedRowToProto(ep dbq.ListExecNeedsByAgentRow) *airlockv1.ExecEndpointInfo
ExecNeedRowToProto packs an agent's exec-endpoint need (joined to its bound resource, if any) into the wire ExecEndpointInfo. Id is the zero UUID for an unconfigured need; the agent's handle is the need Slug.
func GitCredToProto ¶ added in v0.4.0
func GitCredToProto(c gitcredssvc.Credential) *airlockv1.GitCredential
GitCredToProto maps the gitcredentials service DTO to the wire GitCredential. The service DTO already omits the token bytes; this converter is a pure field projection.
func InboundSiblingToProto ¶ added in v0.4.0
func InboundSiblingToProto(s siblingssvc.Inbound) *airlockv1.InboundSiblingInfo
InboundSiblingToProto maps the siblings service Inbound DTO to the wire InboundSiblingInfo (the reverse-direction address-book entry).
func JSONToListValue ¶ added in v0.4.0
JSONToListValue decodes a JSON array blob into a protobuf ListValue, treating empty / "[]" / "null" as absent.
func JSONToStruct ¶ added in v0.4.0
JSONToStruct decodes a JSON object blob into a protobuf Struct, treating empty / "{}" / "null" as absent.
func MCPServerToProto ¶ added in v0.4.0
func MCPServerToProto(m connsvc.MCPServer, publicURL, agentID string) *airlockv1.MCPServerInfo
MCPServerToProto maps the connections service MCPServer DTO to the wire MCPServerInfo. auth_url is derived from publicURL + agentID + slug; empty for non-interactive auth modes.
func MCPStatusToProto ¶ added in v0.4.0
func MCPStatusToProto(s connsvc.MCPStatus) *airlockv1.MCPStatusInfo
MCPStatusToProto maps the MCPStatus service DTO to the wire MCPStatusInfo. No URLs, no metadata — just configured + name.
func MemberToProto ¶ added in v0.4.0
func MemberToProto(m memberssvc.Member) *airlockv1.AgentMemberInfo
MemberToProto maps the members service DTO to the wire AgentMemberInfo.
func PasskeyToProto ¶ added in v0.4.0
func PasskeyToProto(p passkeyssvc.Passkey) *airlockv1.Passkey
PasskeyToProto maps a service passkey DTO to its wire type.
func PendingSystemToolFromCheckpoint ¶ added in v0.4.0
func PendingSystemToolFromCheckpoint(blob []byte) *airlockv1.PendingSystemTool
PendingSystemToolFromCheckpoint pulls the first pending tool call out of the sol.SuspensionContext JSON blob stored on the conversation row. The confirmation UI is one-call-at-a-time today (matches agent chat); if a gate ever surfaces multiple calls at once we'd extend PendingSystemTool to carry a list.
func PgNumericToFloat ¶ added in v0.4.0
PgNumericToFloat reads a pgtype.Numeric as float64. Returns 0 if the value isn't representable.
func PgTimestampToProto ¶
func PgTimestampToProto(t pgtype.Timestamptz) *timestamppb.Timestamp
func PgUUIDToString ¶
func ProviderCapabilityToProto ¶ added in v0.4.0
func ProviderCapabilityToProto(c catalogsvc.ProviderCapability) *airlockv1.ProviderCapabilityInfo
ProviderCapabilityToProto maps the catalog service capability DTO to the wire ProviderCapabilityInfo.
func ProviderToProto ¶
ProviderToProto converts a dbq.Provider to the proto type. The API key is never included — it's write-once and encrypted at rest; HasApiKey reports only whether a key is configured (the ciphertext column is non-empty).
func RouteToProto ¶ added in v0.4.0
func RouteToProto(r dbq.AgentRoute) *airlockv1.RouteInfo
func RunToProto ¶ added in v0.4.0
RunToProto maps a Run row to the wire RunInfo. The detail flag controls whether heavy fields (input payload, action timeline, stdout log, panic trace) are populated; list endpoints leave them off, detail endpoints turn them on.
func ScheduleToProto ¶ added in v0.4.0
func ScheduleToProto(s dbq.ListSchedulesWithNextFireRow) *airlockv1.ScheduleInfo
ScheduleToProto renders a schedule handler (cron or schedule) with its next pending fire time for the operator-facing schedules list.
func SetupCountsToProto ¶ added in v0.4.0
func SetupCountsToProto(c connsvc.SetupCounts) *airlockv1.SetupCountsInfo
SetupCountsToProto packs the aggregate setup-completeness counters into the wire SetupCountsInfo.
func SiblingToProto ¶ added in v0.4.0
func SiblingToProto(s siblingssvc.Sibling) *airlockv1.SiblingInfo
SiblingToProto maps the siblings service Sibling DTO to the wire SiblingInfo.
func SysConversationToProto ¶ added in v0.4.0
func SysConversationToProto(t dbq.SystemConversation) *airlockv1.SystemConversationInfo
SysConversationToProto maps a system_conversations row to the wire SystemConversationInfo. When the conversation is paused for tool approval the pending_tool field is populated from the saved sol.SuspensionContext checkpoint blob.
func SysMessageToProto ¶ added in v0.4.0
func SysMessageToProto(m dbq.SystemMessage) *airlockv1.SystemMessageInfo
SysMessageToProto maps one system_messages row to the wire SystemMessageInfo. content carries the plain-text display string; parts carries the goai multi-part JSON only when set (empty string when NULL). MessageParts.vue / ToolBadge.vue render system and agent surfaces identically off this shape.
func SystemSettingsToProto ¶ added in v0.4.0
func SystemSettingsToProto(s dbq.SystemSetting) *airlockv1.SystemSettingsInfo
SystemSettingsToProto maps the persisted defaults row to its wire shape: the per-capability (provider FK, bare model name) pairs the agent-create flow prefills from and the settings page edits.
func TenantRoleStringToProto ¶ added in v0.4.0
func TenantRoleStringToProto(s string) airlockv1.TenantRole
TenantRoleStringToProto maps the storage form ("admin"/"manager"/ "user") to the wire enum. Exported so handlers that build proto shapes from service DTOs (not dbq.User rows) can use it without reaching for UserToProto.
func TestCredentialResultToProto ¶ added in v0.4.0
func TestCredentialResultToProto(r connsvc.TestResult) *airlockv1.TestCredentialResponse
TestCredentialResultToProto packs the credential-probe outcome into the wire TestCredentialResponse.
func TodosFromJSON ¶ added in v0.4.0
TodosFromJSON decodes the agent_builds.todos jsonb into wire TodoItems. A malformed or empty blob yields nil (no todos) rather than an error — the todo list is presentational, never load-bearing.
func UserDetailToProto ¶ added in v0.4.0
UserDetailToProto packs the users service Detail DTO into the wire User proto. Distinct from UserToProto, which maps a raw dbq.User row — the service DTO carries the same fields but with stricter types (uuid.UUID vs pgtype.UUID, string vs pgtype.Text).
func UserSummaryToProto ¶ added in v0.4.0
func UserSummaryToProto(u userssvc.Summary) *airlockv1.UserSummary
UserSummaryToProto maps the users Summary DTO to the wire UserSummary. The tenant_role hint rides as a non-proto detail — the slim UserSummary message intentionally carries only id + email + display_name; callers that need the role use User (UserDetailToProto).
func WebhookToProto ¶ added in v0.4.0
func WebhookToProto(wh dbq.ListWebhooksByAgentWithStatusRow, publicURL, agentID string) *airlockv1.WebhookInfo
WebhookToProto masks the verification secret (first/last 4 of >8-char secrets, "***" otherwise) and builds the public ingress URL.
Types ¶
This section is empty.