service

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package service holds the per-domain business-logic layer that sits between HTTP handlers and the database. Handlers parse + serialize; services own authorization gating, sqlc queries, and side effects.

The sentinel errors, their Detail wrapper, and HTTPStatus live in the leaf package apperr so the authz layer can return them without an import cycle; they are re-exported here as service.ErrX for the many callers (and errors.Is checks) that reference them through service.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized = apperr.ErrUnauthorized
	ErrForbidden    = apperr.ErrForbidden
	ErrNotFound     = apperr.ErrNotFound
	ErrConflict     = apperr.ErrConflict
	ErrInvalidInput = apperr.ErrInvalidInput
)

Sentinel errors, re-exported from apperr. Same values, so errors.Is(err, service.ErrForbidden) matches an apperr.ErrForbidden returned by authz.

Functions

func Detail

func Detail(sentinel error, format string, args ...any) error

Detail wraps a sentinel with a printf-style detail message; see apperr.Detail.

func HTTPStatus

func HTTPStatus(err error) int

HTTPStatus maps a service sentinel error to its HTTP status code; see apperr.HTTPStatus.

func ResolveAgent

func ResolveAgent(ctx context.Context, q *dbq.Queries, identifier string) (dbq.Agent, error)

ResolveAgent looks up an agent by either its UUID or its slug. Used by surfaces whose route param is shaped as `{identifier}` — the MCP JSON-RPC entry point and the OAuth Authorization Server endpoints. A2A sibling callers pass the rename-safe UUID; external MCP clients paste a config URL that typically carries the slug. Either form resolves to the same row. This is a lookup, not an authorization gate — callers gate separately via authz.Authorize / authz.Principal.

Types

This section is empty.

Directories

Path Synopsis
Package agents owns the agent-lifecycle business logic: create, configure, build/upgrade/rollback, start/stop/suspend, list/get detail, and the per-agent git-remote bindings.
Package agents owns the agent-lifecycle business logic: create, configure, build/upgrade/rollback, start/stop/suspend, list/get detail, and the per-agent git-remote bindings.
Package agentstorage owns authorization and canonical resolution for paths supplied through user, run, and MCP surfaces.
Package agentstorage owns authorization and canonical resolution for paths supplied through user, run, and MCP surfaces.
Package bridges owns the chat-platform-integration lifecycle: create / list / update / delete a bridge row plus the corresponding poller goroutine and per-bridge driver state.
Package bridges owns the chat-platform-integration lifecycle: create / list / update / delete a bridge row plus the corresponding poller goroutine and per-bridge driver state.
Package catalog owns the read-only provider/model catalog and the per-provider capability matrix the Settings UI renders.
Package catalog owns the read-only provider/model catalog and the per-provider capability matrix the Settings UI renders.
Package connections owns reusable connection and MCP credentials, their need-aware OAuth lifecycle, agent env vars, and aggregate setup status.
Package connections owns reusable connection and MCP credentials, their need-aware OAuth lifecycle, agent env vars, and aggregate setup status.
Package connectorartifacts owns operator access to same-repository connector builds and the cross-replica retention sweep for their object storage.
Package connectorartifacts owns operator access to same-repository connector builds and the cross-replica retention sweep for their object storage.
Package connectordirectories authorizes and dispatches connector directory operations and owns direct agent-storage transfer finalization.
Package connectordirectories authorizes and dispatches connector directory operations and owns direct agent-storage transfer finalization.
Package connectorjobs owns durable connector command dispatch, delivery leases, progress, cancellation, completion, and cross-replica waiting.
Package connectorjobs owns durable connector command dispatch, delivery leases, progress, cancellation, completion, and cross-replica waiting.
Package connectormaintenance reconciles durable connector lifecycle state.
Package connectormaintenance reconciles durable connector lifecycle state.
Package connectororchestration owns static target groups and persisted multi-target connector command orchestration.
Package connectororchestration owns static target groups and persisted multi-target connector command orchestration.
Package connectors owns connector interface contracts, readiness, grants, and operator-visible connector resources.
Package connectors owns connector interface contracts, readiness, grants, and operator-visible connector resources.
Package conversations owns the read/list/delete + topic-subscription lifecycle of web conversation threads.
Package conversations owns the read/list/delete + topic-subscription lifecycle of web conversation threads.
Package gitcredentials owns the per-user git PAT credential surface (list / create / delete).
Package gitcredentials owns the per-user git PAT credential surface (list / create / delete).
Package grants owns model entitlements ((provider, model) -> principal).
Package grants owns model entitlements ((provider, model) -> principal).
Package hosts owns host enrollment, authentication, inventory, connector ownership, and durable host management work.
Package hosts owns host enrollment, authentication, inventory, connector ownership, and durable host management work.
Package identity owns the per-user mapping from airlock users to external chat-platform user IDs (telegram).
Package identity owns the per-user mapping from airlock users to external chat-platform user IDs (telegram).
Package integrations provides authenticated development-time access to an agent's bound connections and MCP servers.
Package integrations provides authenticated development-time access to an agent's bound connections and MCP servers.
Package jobs owns durable background-job acceptance and lifecycle access.
Package jobs owns durable background-job acceptance and lifecycle access.
Package managedbots owns the Telegram Bot API "Managed Bots" create-flow's session correlation: airlock UI button → manager-bot deep link → user creates a bot in Telegram → the manager bridge's poll loop receives ManagedBotCreated → bridge row inserted.
Package managedbots owns the Telegram Bot API "Managed Bots" create-flow's session correlation: airlock UI button → manager-bot deep link → user creates a bot in Telegram → the manager bridge's poll loop receives ManagedBotCreated → bridge row inserted.
Package members owns add/list/remove of agent_grants rows — the per-agent sharing list.
Package members owns add/list/remove of agent_grants rows — the per-agent sharing list.
Package models owns the per-agent model configuration: the eight capability overrides (build/exec/stt/vision/tts/image_gen/embedding/ search), each a (provider FK, bare model name) pair, plus the declared model slots and their per-slot assignments.
Package models owns the per-agent model configuration: the eight capability overrides (build/exec/stt/vision/tts/image_gen/embedding/ search), each a (provider FK, bare model name) pair, plus the declared model slots and their per-slot assignments.
Package needs owns the agent-need → resource lifecycle for connections and MCP servers: instantiating a resource from a need's declared shape, binding an existing resource to a need, and listing the resources that could satisfy a need.
Package needs owns the agent-need → resource lifecycle for connections and MCP servers: instantiating a resource from a need's declared shape, binding an existing resource to a need, and listing the resources that could satisfy a need.
Package passkeys owns the per-user WebAuthn surface: registering, listing, renaming, and deleting the caller's own passkeys, plus setting and removing the caller's password.
Package passkeys owns the per-user WebAuthn surface: registering, listing, renaming, and deleting the caller's own passkeys, plus setting and removing the caller's password.
Package providers owns configured LLM provider rows, optional encrypted API keys, confirmed endpoint-specific models, and model discovery.
Package providers owns configured LLM provider rows, optional encrypted API keys, confirmed endpoint-specific models, and model discovery.
Package resources owns the per-user inventory and management surface for reusable resources.
Package resources owns the per-user inventory and management surface for reusable resources.
Package runs owns the list / get / log / cancel operations for the runs table.
Package runs owns the list / get / log / cancel operations for the runs table.
Package settings owns the single-row system_settings table: the tenant-wide locale and default (provider FK, bare model name) pairs.
Package settings owns the single-row system_settings table: the tenant-wide locale and default (provider FK, bare model name) pairs.
Package siblings is the per-agent "address book" of other agents a parent agent's LLM may reach via A2A MCP.
Package siblings is the per-agent "address book" of other agents a parent agent's LLM may reach via A2A MCP.
Package usage serves read-only rollups over the llm_usage spend ledger for the admin Usage view: a window summary plus per-agent and per-model breakdowns.
Package usage serves read-only rollups over the llm_usage spend ledger for the admin Usage view: a window summary plus per-agent and per-model breakdowns.
Package users owns the tenant-wide user directory: reads (List / ListDetail / Get / Lookup) at TenantUserView, self-service display-name updates at TenantSelfProfileUpdate, and admin mutators (Create / UpdateRole / Delete) at TenantUserManage.
Package users owns the tenant-wide user directory: reads (List / ListDetail / Get / Lookup) at TenantUserView, self-service display-name updates at TenantSelfProfileUpdate, and admin mutators (Create / UpdateRole / Delete) at TenantUserManage.

Jump to

Keyboard shortcuts

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