Documentation
¶
Index ¶
- Constants
- Variables
- func CanonicalMCPServerURL(raw string) (string, error)
- func NewUnavailableVaultAuthSource(repo VaultRuntimeRepository) credentialruntime.AuthSource
- func OpenWebhookSigningSecret(cipher secretcrypto.Cipher, webhookID string, envelope domain.SecretEnvelope) ([]byte, error)
- func ResolveAgentSkillReferences(ctx context.Context, resolver SkillReferenceResolver, ...) ([]domain.SkillReference, error)
- func SkillExpandedBudgetBytes(size int64) (int64, bool)
- func SupportedWebhookEventTypes() []string
- func ToolOutputPath(fileID string) string
- func ValidateMetadata(metadata map[string]any) error
- type AgentListPage
- type AgentListQuery
- type AgentRepository
- type AgentService
- func (s *AgentService) Archive(ctx context.Context, id string) (domain.Agent, error)
- func (s *AgentService) Create(ctx context.Context, a domain.Agent) (domain.Agent, error)
- func (s *AgentService) Get(ctx context.Context, id string) (domain.Agent, error)
- func (s *AgentService) List(ctx context.Context, query AgentListQuery) (AgentListPage, error)
- func (s *AgentService) Update(ctx context.Context, id string, patch domain.AgentPatch) (domain.Agent, error)
- func (s *AgentService) Versions(ctx context.Context, id string, query AgentVersionListQuery) (AgentVersionListPage, error)
- type AgentVersionListPage
- type AgentVersionListQuery
- type BlobCleanupIntent
- type BlobCleanupRepository
- type BlobInfo
- type BlobStore
- type CreateSessionInput
- type CredentialAuthCreateInput
- type CredentialAuthUpdateInput
- type CredentialCreateInput
- type CredentialListPage
- type CredentialListQuery
- type CredentialRefreshValidation
- type CredentialUpdateInput
- type CredentialValidation
- type DeploymentCreateInput
- type DeploymentListBoundary
- type DeploymentListPage
- type DeploymentListQuery
- type DeploymentMemoryReader
- type DeploymentReconciler
- type DeploymentRepository
- type DeploymentRunListBoundary
- type DeploymentRunListPage
- type DeploymentRunListQuery
- type DeploymentScheduleClaim
- type DeploymentService
- func (s *DeploymentService) Archive(ctx context.Context, id string) (domain.Deployment, error)
- func (s *DeploymentService) ClaimDue(ctx context.Context, limit int) ([]DeploymentScheduleClaim, error)
- func (s *DeploymentService) Create(ctx context.Context, input DeploymentCreateInput) (domain.Deployment, error)
- func (s *DeploymentService) Get(ctx context.Context, id string) (domain.Deployment, error)
- func (s *DeploymentService) GetRun(ctx context.Context, id string) (domain.DeploymentRun, error)
- func (s *DeploymentService) List(ctx context.Context, query DeploymentListQuery) (DeploymentListPage, error)
- func (s *DeploymentService) ListRuns(ctx context.Context, query DeploymentRunListQuery) (DeploymentRunListPage, error)
- func (s *DeploymentService) Pause(ctx context.Context, id string) (domain.Deployment, error)
- func (s *DeploymentService) RenewClaim(ctx context.Context, claim DeploymentScheduleClaim) error
- func (s *DeploymentService) Run(ctx context.Context, id string) (domain.DeploymentRun, error)
- func (s *DeploymentService) RunScheduled(ctx context.Context, id string, scheduledAt time.Time) (domain.DeploymentRun, error)
- func (s *DeploymentService) Unpause(ctx context.Context, id string) (domain.Deployment, error)
- func (s *DeploymentService) Update(ctx context.Context, id string, patch domain.DeploymentPatch) (domain.Deployment, error)
- type DeploymentServiceConfig
- type DeploymentSessionCreator
- type DeploymentVaultReader
- type EnvironmentListPage
- type EnvironmentListQuery
- type EnvironmentRepository
- type EnvironmentService
- func (s *EnvironmentService) Archive(ctx context.Context, id string) (domain.Environment, error)
- func (s *EnvironmentService) Create(ctx context.Context, e domain.Environment) (domain.Environment, error)
- func (s *EnvironmentService) Delete(ctx context.Context, id string) error
- func (s *EnvironmentService) Get(ctx context.Context, id string) (domain.Environment, error)
- func (s *EnvironmentService) List(ctx context.Context, query EnvironmentListQuery) (EnvironmentListPage, error)
- func (s *EnvironmentService) Update(ctx context.Context, id string, patch domain.EnvironmentPatch) (domain.Environment, error)
- type EnvironmentWorkListPage
- type EnvironmentWorkListQuery
- type EnvironmentWorkPollInput
- type EnvironmentWorkRepository
- type EnvironmentWorkService
- func (s *EnvironmentWorkService) Ack(ctx context.Context, environmentID, workID string) (domain.EnvironmentWork, error)
- func (s *EnvironmentWorkService) CompleteHealthcheck(ctx context.Context, environmentID, workID string, ...) (domain.EnvironmentWork, error)
- func (s *EnvironmentWorkService) CreateHealthcheck(ctx context.Context, environmentID string) (domain.EnvironmentWork, error)
- func (s *EnvironmentWorkService) Fail(ctx context.Context, environmentID, workID, message string) error
- func (s *EnvironmentWorkService) Get(ctx context.Context, environmentID, workID string) (domain.EnvironmentWork, error)
- func (s *EnvironmentWorkService) Heartbeat(ctx context.Context, environmentID, workID string, expected *string, ...) (domain.EnvironmentWorkHeartbeat, error)
- func (s *EnvironmentWorkService) List(ctx context.Context, environmentID string, query EnvironmentWorkListQuery) (EnvironmentWorkListPage, error)
- func (s *EnvironmentWorkService) Poll(ctx context.Context, environmentID, workerID string, block time.Duration, ...) (*domain.EnvironmentWork, error)
- func (s *EnvironmentWorkService) Stats(ctx context.Context, environmentID string) (domain.EnvironmentWorkQueueStats, error)
- func (s *EnvironmentWorkService) Stop(ctx context.Context, environmentID, workID string, force bool, ...) error
- func (s *EnvironmentWorkService) Update(ctx context.Context, environmentID, workID string, metadata map[string]*string) (domain.EnvironmentWork, error)
- type EventPageBoundary
- type EventQuery
- type FileBlobStore
- type FileDownload
- type FileListPage
- type FileListQuery
- type FileRepository
- type FileService
- func (s *FileService) Delete(ctx context.Context, id string) (domain.File, error)
- func (s *FileService) Download(ctx context.Context, id string) (FileDownload, error)
- func (s *FileService) Get(ctx context.Context, id string) (domain.File, error)
- func (s *FileService) List(ctx context.Context, query FileListQuery) (FileListPage, error)
- func (s *FileService) ReadMessageFile(ctx context.Context, id string) (domain.FileMessageContent, error)
- func (s *FileService) ReadOutcomeRubric(ctx context.Context, id string) (string, error)
- func (s *FileService) Reconcile(ctx context.Context) error
- func (s *FileService) StoreToolOutput(ctx context.Context, sessionID, fileID, text string) error
- func (s *FileService) Upload(ctx context.Context, input FileUploadInput) (domain.File, error)
- type FileUploadInput
- type Frame
- type Hub
- func (h *Hub) CloseSession(sessionID string, terminal domain.Event)
- func (h *Hub) Publish(sessionID string, e domain.Event)
- func (h *Hub) PublishPreview(sessionID string, pf domain.PreviewFrame)
- func (h *Hub) Subscribe(sessionID string, deltaOptIn map[string]bool) (<-chan Frame, func())
- func (h *Hub) SubscribeContext(_ context.Context, sessionID string, deltaOptIn map[string]bool) (<-chan Frame, func(), error)
- type ListPage
- type MemoryCreateInput
- type MemoryListPage
- type MemoryListQuery
- type MemoryRepository
- type MemoryService
- func (s *MemoryService) ArchiveStore(ctx context.Context, id string) (domain.MemoryStore, error)
- func (s *MemoryService) CreateMemory(ctx context.Context, storeID string, input MemoryCreateInput) (domain.Memory, error)
- func (s *MemoryService) CreateStore(ctx context.Context, input MemoryStoreCreateInput) (domain.MemoryStore, error)
- func (s *MemoryService) DeleteMemory(ctx context.Context, storeID, memoryID string, expected *string, ...) (domain.Memory, error)
- func (s *MemoryService) DeleteStore(ctx context.Context, id string) error
- func (s *MemoryService) GetMemory(ctx context.Context, storeID, memoryID string) (domain.Memory, error)
- func (s *MemoryService) GetMemoryVersion(ctx context.Context, storeID, versionID string) (domain.MemoryVersion, error)
- func (s *MemoryService) GetStore(ctx context.Context, id string) (domain.MemoryStore, error)
- func (s *MemoryService) ListMemories(ctx context.Context, storeID string, query MemoryListQuery) (MemoryListPage, error)
- func (s *MemoryService) ListMemoryVersions(ctx context.Context, storeID string, query MemoryVersionListQuery) (MemoryVersionListPage, error)
- func (s *MemoryService) ListStores(ctx context.Context, query MemoryStoreListQuery) (MemoryStoreListPage, error)
- func (s *MemoryService) RedactMemoryVersion(ctx context.Context, storeID, versionID string, actor domain.MemoryActor) (domain.MemoryVersion, error)
- func (s *MemoryService) RuntimeHeads(ctx context.Context, storeID string) ([]domain.Memory, error)
- func (s *MemoryService) SyncRuntimeSnapshot(ctx context.Context, storeID string, baseline []MemoryStoreSyncBaseline, ...) ([]domain.Memory, error)
- func (s *MemoryService) UpdateMemory(ctx context.Context, storeID, memoryID string, input MemoryUpdateInput) (domain.Memory, error)
- func (s *MemoryService) UpdateStore(ctx context.Context, id string, input MemoryStoreUpdateInput) (domain.MemoryStore, error)
- type MemorySessionResourceInput
- type MemoryStoreCreateInput
- type MemoryStoreListPage
- type MemoryStoreListQuery
- type MemoryStoreSyncBaseline
- type MemoryStoreSyncContent
- type MemoryStoreUpdateInput
- type MemoryUpdateInput
- type MemoryVersionListPage
- type MemoryVersionListQuery
- type NullablePatch
- type OAuthRefreshCreateInput
- type OAuthRefreshUpdateInput
- type OAuthTokenEndpointAuthUpdateInput
- type PreparedSessionResource
- type ResourcePageBoundary
- type ScheduledDeploymentRunner
- type SessionListPage
- type SessionPageBoundary
- type SessionSkillMaterializer
- type SessionSkillMountRepository
- type SessionThreadListQuery
- type SessionThreadPageBoundary
- type SessionThreadSkillMountRepository
- type SkillCreateInput
- type SkillListPage
- type SkillListQuery
- type SkillReferenceResolver
- type SkillRepository
- type SkillService
- func (s *SkillService) Create(ctx context.Context, input SkillCreateInput) (domain.Skill, error)
- func (s *SkillService) CreateVersion(ctx context.Context, skillID string, files []SkillUploadFile) (domain.SkillVersion, error)
- func (s *SkillService) Delete(ctx context.Context, id string) (domain.Skill, error)
- func (s *SkillService) DeleteVersion(ctx context.Context, skillID string, version string) (domain.SkillVersion, error)
- func (s *SkillService) Download(ctx context.Context, skillID string, version string) (SkillVersionDownload, error)
- func (s *SkillService) Get(ctx context.Context, id string) (domain.Skill, error)
- func (s *SkillService) GetVersion(ctx context.Context, skillID string, version string) (domain.SkillVersion, error)
- func (s *SkillService) List(ctx context.Context, query SkillListQuery) (SkillListPage, error)
- func (s *SkillService) ListVersions(ctx context.Context, skillID string, query SkillVersionListQuery) (SkillVersionListPage, error)
- func (s *SkillService) Reconcile(ctx context.Context) error
- func (s *SkillService) ResolveSkillReferences(ctx context.Context, references []domain.SkillReference) ([]domain.SkillReference, error)
- type SkillUploadFile
- type SkillVersionDownload
- type SkillVersionListPage
- type SkillVersionListQuery
- type VaultCreateInput
- type VaultListPage
- type VaultListQuery
- type VaultRepository
- type VaultRuntimeRepository
- type VaultService
- func (s *VaultService) ArchiveCredential(ctx context.Context, vaultID, credentialID string) (domain.VaultCredential, error)
- func (s *VaultService) ArchiveVault(ctx context.Context, id string) (domain.Vault, error)
- func (s *VaultService) CreateCredential(ctx context.Context, vaultID string, input CredentialCreateInput) (domain.VaultCredential, error)
- func (s *VaultService) CreateVault(ctx context.Context, input VaultCreateInput) (domain.Vault, error)
- func (s *VaultService) DeleteCredential(ctx context.Context, vaultID, credentialID string) error
- func (s *VaultService) DeleteVault(ctx context.Context, id string) error
- func (s *VaultService) GetCredential(ctx context.Context, vaultID, credentialID string) (domain.VaultCredential, error)
- func (s *VaultService) GetVault(ctx context.Context, id string) (domain.Vault, error)
- func (s *VaultService) ListCredentials(ctx context.Context, vaultID string, query CredentialListQuery) (CredentialListPage, error)
- func (s *VaultService) ListVaults(ctx context.Context, query VaultListQuery) (VaultListPage, error)
- func (s *VaultService) ResolveMCPBearer(ctx context.Context, sessionID string, mcpServerURL string) (credentialruntime.BearerCredential, bool, error)
- func (s *VaultService) UpdateCredential(ctx context.Context, vaultID, credentialID string, input CredentialUpdateInput) (domain.VaultCredential, error)
- func (s *VaultService) UpdateVault(ctx context.Context, id string, input VaultUpdateInput) (domain.Vault, error)
- func (s *VaultService) ValidateMCPOAuthCredential(ctx context.Context, vaultID string, credentialID string) (CredentialValidation, error)
- type VaultServiceConfig
- type VaultUpdateInput
- type WebhookCreateInput
- type WebhookDeliveryRepository
- type WebhookDeliveryResult
- type WebhookDispatcher
- type WebhookHTTPDoer
- type WebhookListPage
- type WebhookListQuery
- type WebhookRepository
- type WebhookSecretResult
- type WebhookService
- func (s *WebhookService) CreateWebhook(ctx context.Context, input WebhookCreateInput) (WebhookSecretResult, error)
- func (s *WebhookService) DeleteWebhook(ctx context.Context, id string) error
- func (s *WebhookService) GetWebhook(ctx context.Context, id string) (domain.Webhook, error)
- func (s *WebhookService) ListWebhooks(ctx context.Context, query WebhookListQuery) (WebhookListPage, error)
- func (s *WebhookService) RegenerateSigningSecret(ctx context.Context, id string) (WebhookSecretResult, error)
- func (s *WebhookService) UpdateWebhook(ctx context.Context, id string, input WebhookUpdateInput) (domain.Webhook, error)
- type WebhookUpdateInput
Constants ¶
const ( DefaultDeploymentListLimit = 20 MaxDeploymentListLimit = 100 DefaultDeploymentRunListLimit = 20 MaxDeploymentRunListLimit = 1000 MaxDeploymentVaults = 50 MaxDeploymentInitialEvents = 50 ScheduleClaimLease = 2 * time.Minute )
const ( DefaultEnvironmentWorkListLimit = 100 MaxEnvironmentWorkListLimit = 1000 // MaxEnvironmentWorkTTLSeconds bounds the time a lost worker can retain a // Session execution lease. Healthy workers extend the lease continuously, // so longer individual TTLs only increase the stale-owner window. MaxEnvironmentWorkTTLSeconds = int64(300) )
const ( DefaultFileListLimit = 20 MaxFileListLimit = 1000 MaxFileBytes int64 = 500 << 20 )
const ( DefaultMemoryStoreListLimit = 20 MaxMemoryStoreListLimit = 100 DefaultMemoryListLimit = 20 MaxMemoryListLimit = 100 MaxFullMemoryListLimit = 20 DefaultMemoryVersionListLimit = 20 MaxMemoryVersionListLimit = 100 MaxMemoriesPerStore = 2000 MaxMemoryContentBytes = 102400 MaxMemoryPathBytes = 1024 )
const ( // The Agent and Agent Version list bounds are documented by Mango's public // API. DefaultAgentListLimit = 20 MaxAgentListLimit = 100 // The Environment list reference documents no default or maximum. Mango // applies its existing general list bounds as a local operational choice. DefaultEnvironmentListLimit = 100 MaxEnvironmentListLimit = 1000 )
const ( // MaxSkillUploadBytes follows the upstream custom Skill requirement that a // complete upload remain below 30 MB. MaxSkillUploadBytes int64 = 30_000_000 MaxSkillFiles int = 1000 )
const ( MaxSessionSkills = 500 MaxSessionSkillBytes = 500 << 20 )
const ( DefaultSkillListLimit = 20 MaxSkillListLimit = 100 DefaultSkillVersionListLimit = 20 MaxSkillVersionListLimit = 1000 )
const ( DefaultVaultListLimit = 20 MaxVaultListLimit = 100 DefaultCredentialListLimit = 20 MaxCredentialListLimit = 100 MaxCredentialsPerVault = 20 )
const ( DefaultWebhookPollInterval = time.Second DefaultWebhookClaimLease = 2 * time.Minute DefaultWebhookHTTPTimeout = 15 * time.Second DefaultWebhookBatchSize = 25 DefaultWebhookRetention = 30 * 24 * time.Hour DefaultWebhookCleanupEvery = time.Hour MaxWebhookDeliveryAttempts = 3 )
const ( DefaultWebhookListLimit = 20 MaxWebhookListLimit = 100 MaxWebhooksPerWorkspace = 100 MaxWebhookURLBytes = 2048 MaxWebhookEventTypes = 64 )
const DefaultSessionThreadListLimit = 1000
const MaxToolOutputBytes = 32 << 20
const ToolOutputDirectory = ".mango-tool-results"
const UploadLeaseDuration = time.Minute
UploadLeaseDuration is measured by PostgreSQL, not an API process's clock. Each public upload has a unique immutable resource identity and one writer.
Variables ¶
var ErrBlobNotWritten = errors.New("blob write did not start")
ErrBlobNotWritten positively identifies failure before any remote write. Other storage errors may mean the caller stopped waiting for a commit.
var ErrBlobTooLarge = errors.New("blob exceeds maximum size")
ErrBlobTooLarge lets a streaming blob implementation stop after one byte beyond MaxFileBytes without buffering the complete upload.
var ErrUploadLeaseLost = errors.New("upload ownership was lost")
ErrUploadLeaseLost is a definite ownership failure, distinct from an uncertain completion response that may already have committed.
Functions ¶
func CanonicalMCPServerURL ¶
CanonicalMCPServerURL is the single identity function used for stored MCP credential keys and, in the runtime PR, for MCP server lookup. It rejects plaintext transport and URL features that could redirect credentials to a different authority.
func NewUnavailableVaultAuthSource ¶
func NewUnavailableVaultAuthSource(repo VaultRuntimeRepository) credentialruntime.AuthSource
func OpenWebhookSigningSecret ¶
func OpenWebhookSigningSecret( cipher secretcrypto.Cipher, webhookID string, envelope domain.SecretEnvelope, ) ([]byte, error)
func ResolveAgentSkillReferences ¶
func ResolveAgentSkillReferences( ctx context.Context, resolver SkillReferenceResolver, references []domain.SkillReference, ) ([]domain.SkillReference, error)
ResolveAgentSkillReferences validates Mango's current Skill union and delegates custom Version lookup when the effective list is non-empty.
func SkillExpandedBudgetBytes ¶
SkillExpandedBudgetBytes validates the exact sandbox footprint used for Session admission against the per-bundle limit.
func SupportedWebhookEventTypes ¶
func SupportedWebhookEventTypes() []string
func ToolOutputPath ¶
func ValidateMetadata ¶
ValidateMetadata exposes the shared public-resource metadata contract to alternate control-plane service wiring.
Types ¶
type AgentListPage ¶
type AgentListQuery ¶
type AgentListQuery struct {
CreatedAtGte *time.Time
CreatedAtLte *time.Time
IncludeArchived bool
After *ResourcePageBoundary
Limit int
}
AgentListQuery is deliberately distinct from EnvironmentListQuery because the two public endpoints expose different filters.
type AgentRepository ¶
type AgentRepository interface {
PutVersion(context.Context, domain.Agent) error
UpdateVersion(
context.Context,
string,
func(domain.Agent) (domain.Agent, bool, error),
) (domain.Agent, error)
Archive(context.Context, string, time.Time) (domain.Agent, error)
Latest(context.Context, string) (domain.Agent, error)
GetVersion(context.Context, string, int) (domain.Agent, error)
Versions(context.Context, string, AgentVersionListQuery) (AgentVersionListPage, error)
ListLatest(context.Context, AgentListQuery) (AgentListPage, error)
}
AgentRepository is the persistence boundary for versioned Agent resources. The application service owns validation and timestamps; the repository owns atomic version allocation and lifecycle concurrency.
type AgentService ¶
type AgentService struct {
// contains filtered or unexported fields
}
func NewAgentService ¶
func NewAgentService( repo AgentRepository, ids domain.IDGenerator, clock domain.Clock, skillResolvers ...SkillReferenceResolver, ) *AgentService
func (*AgentService) List ¶
func (s *AgentService) List(ctx context.Context, query AgentListQuery) (AgentListPage, error)
func (*AgentService) Update ¶
func (s *AgentService) Update(ctx context.Context, id string, patch domain.AgentPatch) (domain.Agent, error)
func (*AgentService) Versions ¶
func (s *AgentService) Versions( ctx context.Context, id string, query AgentVersionListQuery, ) (AgentVersionListPage, error)
type AgentVersionListPage ¶
type AgentVersionListQuery ¶
AgentVersionListQuery pages forward through one Agent's immutable version history. Versions are returned in ascending numeric order.
type BlobCleanupIntent ¶
BlobCleanupIntent survives removal or reuse of the upload's metadata row. Revision fences an older cleanup acknowledgement from a newer late write.
type BlobCleanupRepository ¶
type BlobCleanupRepository interface {
RetainBlobCleanup(context.Context, string, bool) (BlobCleanupIntent, error)
TouchBlobCleanup(context.Context, BlobCleanupIntent) error
ListBlobCleanup(context.Context) ([]BlobCleanupIntent, error)
RemoveBlobCleanup(context.Context, BlobCleanupIntent) error
}
type BlobInfo ¶
func ComputeBlobInfo ¶
ComputeBlobInfo is shared by blob implementations and test doubles.
type BlobStore ¶
type BlobStore interface {
Put(context.Context, string, string, io.Reader, int64) (BlobInfo, error)
Open(context.Context, string) (io.ReadCloser, error)
Delete(context.Context, string) error
}
BlobStore is intentionally small so S3-compatible storage can back Files and immutable Skill archives without leaking provider types into the application or HTTP layers.
type CreateSessionInput ¶
type CreateSessionInput struct {
AgentID string
AgentVersion *int
Overrides *domain.AgentOverrides
EnvironmentID string
Title string
Metadata map[string]any
InitialEvents []domain.EventDraft
MemoryResources []MemorySessionResourceInput
VaultIDs []string
Budget *domain.SessionBudget
DeploymentID *string
DeploymentRun *domain.DeploymentRun
}
CreateSessionInput is the storage-independent command accepted by the control-plane session service.
type CredentialAuthUpdateInput ¶
type CredentialAuthUpdateInput struct {
Type string
Token NullablePatch[string]
AccessToken NullablePatch[string]
ExpiresAt NullablePatch[time.Time]
Refresh NullablePatch[OAuthRefreshUpdateInput]
}
type CredentialCreateInput ¶
type CredentialCreateInput struct {
DisplayName *string
Metadata map[string]string
Auth CredentialAuthCreateInput
}
type CredentialListPage ¶
type CredentialListPage struct {
Credentials []domain.VaultCredential
HasNext bool
}
type CredentialListQuery ¶
type CredentialListQuery struct {
IncludeArchived bool
After *ResourcePageBoundary
Limit int
}
type CredentialRefreshValidation ¶
type CredentialRefreshValidation struct {
Status credentialruntime.OAuthRefreshStatus `json:"status"`
HTTPResponse *credentialruntime.HTTPResponse `json:"http_response"`
}
type CredentialUpdateInput ¶
type CredentialUpdateInput struct {
DisplayName NullablePatch[string]
Metadata NullablePatch[map[string]*string]
Auth *CredentialAuthUpdateInput
}
type CredentialValidation ¶
type CredentialValidation struct {
CredentialID string
VaultID string
ValidatedAt time.Time
HasRefreshToken bool
Status credentialruntime.Verdict
MCPProbe *credentialruntime.MCPProbeFailure
Refresh *CredentialRefreshValidation
}
type DeploymentCreateInput ¶
type DeploymentCreateInput struct {
AgentID string
AgentVersion *int
EnvironmentID string
Name string
Description string
InitialEvents []domain.EventDraft
Resources []domain.DeploymentResource
VaultIDs []string
Budget *domain.SessionBudget
Metadata map[string]string
Schedule *domain.DeploymentSchedule
}
type DeploymentListBoundary ¶
type DeploymentListPage ¶
type DeploymentListPage struct {
Deployments []domain.Deployment
HasMore bool
}
type DeploymentListQuery ¶
type DeploymentMemoryReader ¶
type DeploymentReconciler ¶
type DeploymentReconciler struct {
// contains filtered or unexported fields
}
func NewDeploymentReconciler ¶
func NewDeploymentReconciler(runner ScheduledDeploymentRunner) *DeploymentReconciler
func (*DeploymentReconciler) Run ¶
func (r *DeploymentReconciler) Run(ctx context.Context) error
Run claims due cron occurrences through PostgreSQL and creates their Sessions. Token-fenced claims are renewed during admission and scheduled run rows are unique per occurrence, so multiple worker replicas can run this loop safely and a crashed worker is retried without exposing duplicate successful Sessions.
type DeploymentRepository ¶
type DeploymentRepository interface {
Create(context.Context, domain.Deployment) (domain.Deployment, error)
Get(context.Context, string) (domain.Deployment, error)
Update(
context.Context,
string,
func(domain.Deployment) (domain.Deployment, bool, error),
) (domain.Deployment, error)
List(context.Context, DeploymentListQuery) (DeploymentListPage, error)
CreateRun(context.Context, domain.DeploymentRun) (domain.DeploymentRun, error)
GetRun(context.Context, string) (domain.DeploymentRun, error)
GetScheduledRun(context.Context, string, time.Time) (domain.DeploymentRun, error)
ListRuns(context.Context, DeploymentRunListQuery) (DeploymentRunListPage, error)
ClaimDue(context.Context, time.Time, time.Time, string, int) ([]DeploymentScheduleClaim, error)
RenewScheduleClaim(context.Context, string, time.Time, string, time.Time) error
CompleteSchedule(
context.Context,
string,
time.Time,
time.Time,
[]time.Time,
) error
}
type DeploymentRunListPage ¶
type DeploymentRunListPage struct {
Runs []domain.DeploymentRun
HasMore bool
}
type DeploymentRunListQuery ¶
type DeploymentScheduleClaim ¶
type DeploymentService ¶
type DeploymentService struct {
// contains filtered or unexported fields
}
func NewDeploymentService ¶
func NewDeploymentService(config DeploymentServiceConfig) *DeploymentService
func (*DeploymentService) Archive ¶
func (s *DeploymentService) Archive(ctx context.Context, id string) (domain.Deployment, error)
func (*DeploymentService) ClaimDue ¶
func (s *DeploymentService) ClaimDue( ctx context.Context, limit int, ) ([]DeploymentScheduleClaim, error)
func (*DeploymentService) Create ¶
func (s *DeploymentService) Create( ctx context.Context, input DeploymentCreateInput, ) (domain.Deployment, error)
func (*DeploymentService) Get ¶
func (s *DeploymentService) Get(ctx context.Context, id string) (domain.Deployment, error)
func (*DeploymentService) GetRun ¶
func (s *DeploymentService) GetRun(ctx context.Context, id string) (domain.DeploymentRun, error)
func (*DeploymentService) List ¶
func (s *DeploymentService) List( ctx context.Context, query DeploymentListQuery, ) (DeploymentListPage, error)
func (*DeploymentService) ListRuns ¶
func (s *DeploymentService) ListRuns( ctx context.Context, query DeploymentRunListQuery, ) (DeploymentRunListPage, error)
func (*DeploymentService) Pause ¶
func (s *DeploymentService) Pause(ctx context.Context, id string) (domain.Deployment, error)
func (*DeploymentService) RenewClaim ¶
func (s *DeploymentService) RenewClaim( ctx context.Context, claim DeploymentScheduleClaim, ) error
func (*DeploymentService) Run ¶
func (s *DeploymentService) Run( ctx context.Context, id string, ) (domain.DeploymentRun, error)
func (*DeploymentService) RunScheduled ¶
func (s *DeploymentService) RunScheduled( ctx context.Context, id string, scheduledAt time.Time, ) (domain.DeploymentRun, error)
func (*DeploymentService) Unpause ¶
func (s *DeploymentService) Unpause(ctx context.Context, id string) (domain.Deployment, error)
func (*DeploymentService) Update ¶
func (s *DeploymentService) Update( ctx context.Context, id string, patch domain.DeploymentPatch, ) (domain.Deployment, error)
type DeploymentServiceConfig ¶
type DeploymentServiceConfig struct {
Repository DeploymentRepository
Agents AgentRepository
Environments EnvironmentRepository
Sessions DeploymentSessionCreator
Memory DeploymentMemoryReader
Vaults DeploymentVaultReader
IDGenerator domain.IDGenerator
Clock domain.Clock
}
type DeploymentVaultReader ¶
type EnvironmentListPage ¶
type EnvironmentListPage struct {
Environments []domain.Environment
HasNext bool
}
type EnvironmentListQuery ¶
type EnvironmentListQuery struct {
IncludeArchived bool
After *ResourcePageBoundary
Limit int
}
EnvironmentListQuery exposes only the parameters documented for GET /v1/environments: include_archived, limit, and page.
type EnvironmentRepository ¶
type EnvironmentRepository interface {
Put(context.Context, domain.Environment) error
Update(context.Context, domain.Environment) (domain.Environment, error)
Archive(context.Context, string, time.Time) (domain.Environment, error)
Get(context.Context, string) (domain.Environment, error)
List(context.Context, EnvironmentListQuery) (EnvironmentListPage, error)
DeleteIfUnreferenced(context.Context, string) error
}
EnvironmentRepository is the persistence boundary for Environment resources. DeleteIfUnreferenced must make the delete/reference check atomic.
type EnvironmentService ¶
type EnvironmentService struct {
// contains filtered or unexported fields
}
func NewEnvironmentService ¶
func NewEnvironmentService( env EnvironmentRepository, ids domain.IDGenerator, clock domain.Clock, ) *EnvironmentService
func (*EnvironmentService) Archive ¶
func (s *EnvironmentService) Archive(ctx context.Context, id string) (domain.Environment, error)
func (*EnvironmentService) Create ¶
func (s *EnvironmentService) Create(ctx context.Context, e domain.Environment) (domain.Environment, error)
func (*EnvironmentService) Delete ¶
func (s *EnvironmentService) Delete(ctx context.Context, id string) error
func (*EnvironmentService) Get ¶
func (s *EnvironmentService) Get(ctx context.Context, id string) (domain.Environment, error)
func (*EnvironmentService) List ¶
func (s *EnvironmentService) List( ctx context.Context, query EnvironmentListQuery, ) (EnvironmentListPage, error)
func (*EnvironmentService) Update ¶
func (s *EnvironmentService) Update( ctx context.Context, id string, patch domain.EnvironmentPatch, ) (domain.Environment, error)
type EnvironmentWorkListPage ¶
type EnvironmentWorkListPage struct {
Work []domain.EnvironmentWork
HasNext bool
}
type EnvironmentWorkListQuery ¶
type EnvironmentWorkListQuery struct {
After *ResourcePageBoundary
Limit int
}
type EnvironmentWorkRepository ¶
type EnvironmentWorkRepository interface {
CreateHealthcheck(context.Context, string) (domain.EnvironmentWork, error)
CompleteHealthcheck(context.Context, string, string, domain.EnvironmentWorkResult) (domain.EnvironmentWork, error)
GetWork(context.Context, string, string) (domain.EnvironmentWork, error)
UpdateWorkMetadata(context.Context, string, string, map[string]*string) (domain.EnvironmentWork, error)
ListWork(context.Context, string, EnvironmentWorkListQuery) (EnvironmentWorkListPage, error)
PollWork(context.Context, string, EnvironmentWorkPollInput) (*domain.EnvironmentWork, error)
AckWork(context.Context, string, string) (domain.EnvironmentWork, error)
HeartbeatWork(context.Context, string, string, *string, *int64) (domain.EnvironmentWorkHeartbeat, error)
FailWork(context.Context, string, string, string) error
StopWork(context.Context, string, string, bool, *string) error
WorkStats(context.Context, string) (domain.EnvironmentWorkQueueStats, error)
}
type EnvironmentWorkService ¶
type EnvironmentWorkService struct {
// contains filtered or unexported fields
}
EnvironmentWorkService exposes Mango's self-hosted Environment worker protocol over the same durable Session ledger used by the managed runtime.
func NewEnvironmentWorkService ¶
func NewEnvironmentWorkService( repository EnvironmentWorkRepository, environments EnvironmentRepository, ) *EnvironmentWorkService
func (*EnvironmentWorkService) Ack ¶
func (s *EnvironmentWorkService) Ack( ctx context.Context, environmentID, workID string, ) (domain.EnvironmentWork, error)
func (*EnvironmentWorkService) CompleteHealthcheck ¶
func (s *EnvironmentWorkService) CompleteHealthcheck(ctx context.Context, environmentID, workID string, result domain.EnvironmentWorkResult) (domain.EnvironmentWork, error)
func (*EnvironmentWorkService) CreateHealthcheck ¶
func (s *EnvironmentWorkService) CreateHealthcheck(ctx context.Context, environmentID string) (domain.EnvironmentWork, error)
func (*EnvironmentWorkService) Fail ¶
func (s *EnvironmentWorkService) Fail( ctx context.Context, environmentID, workID, message string, ) error
func (*EnvironmentWorkService) Get ¶
func (s *EnvironmentWorkService) Get( ctx context.Context, environmentID, workID string, ) (domain.EnvironmentWork, error)
func (*EnvironmentWorkService) Heartbeat ¶
func (s *EnvironmentWorkService) Heartbeat( ctx context.Context, environmentID, workID string, expected *string, desiredTTL *int64, ) (domain.EnvironmentWorkHeartbeat, error)
func (*EnvironmentWorkService) List ¶
func (s *EnvironmentWorkService) List( ctx context.Context, environmentID string, query EnvironmentWorkListQuery, ) (EnvironmentWorkListPage, error)
func (*EnvironmentWorkService) Stats ¶
func (s *EnvironmentWorkService) Stats( ctx context.Context, environmentID string, ) (domain.EnvironmentWorkQueueStats, error)
type EventPageBoundary ¶
EventPageBoundary is the complete key carried by an opaque List Events cursor. ProcessedAt is nil for events that have not been processed yet; Sequence is the deterministic tie-breaker for equal (including nil) timestamps.
type EventQuery ¶
type EventQuery struct {
// ThreadID selects one Thread ledger. Empty means the primary Thread, which
// is the public Session event surface.
ThreadID string
Boundary *EventPageBoundary
Limit int
Desc bool
Types []string
ProcessedAtGt *time.Time
ProcessedAtGte *time.Time
ProcessedAtLt *time.Time
ProcessedAtLte *time.Time
}
EventQuery expresses the public List Events filters. Mango retains the created_at query name from its original surface but applies those filters, ordering, and pagination to the event processed_at value.
type FileBlobStore ¶
type FileBlobStore = BlobStore
FileBlobStore preserves the original Files application boundary name for callers while the underlying store is shared with other blob-backed resources.
type FileDownload ¶
type FileDownload struct {
File domain.File
Body io.ReadCloser
}
type FileListPage ¶
type FileListQuery ¶
type FileRepository ¶
type FileRepository interface {
BlobCleanupRepository
BeginUpload(context.Context, domain.File) error
CompleteUpload(context.Context, string, BlobInfo) (domain.File, error)
RenewUpload(context.Context, string) error
ReleaseUpload(context.Context, string, string, bool) error
Get(context.Context, string) (domain.File, error)
List(context.Context, FileListQuery) (FileListPage, error)
BeginDelete(context.Context, string) (domain.File, error)
RemoveIncomplete(context.Context, string) error
ListIncomplete(context.Context) ([]domain.File, error)
ClaimIncomplete(context.Context, string) (domain.File, bool, error)
}
FileRepository owns workspace-scoped metadata and lifecycle intents. BeginUpload must commit before blob I/O; CompleteUpload is the only transition that makes a file visible. Get returns only ready Files, and BeginDelete hides a file before object deletion begins.
type FileService ¶
type FileService struct {
// contains filtered or unexported fields
}
func NewFileService ¶
func NewFileService( repo FileRepository, blobs FileBlobStore, ids domain.IDGenerator, clock domain.Clock, ) *FileService
func (*FileService) Download ¶
func (s *FileService) Download(ctx context.Context, id string) (FileDownload, error)
func (*FileService) List ¶
func (s *FileService) List(ctx context.Context, query FileListQuery) (FileListPage, error)
func (*FileService) ReadMessageFile ¶
func (s *FileService) ReadMessageFile( ctx context.Context, id string, ) (domain.FileMessageContent, error)
ReadMessageFile returns a bounded, integrity-checked snapshot for a user.message document source. Generic application/octet-stream is accepted so generic uploads and source files without a registered media type can still be projected after their bytes pass UTF-8 validation.
func (*FileService) ReadOutcomeRubric ¶
ReadOutcomeRubric validates an immutable File for use as model input. Admission reads stay bounded to the largest valid UTF-8 encoding of the documented character limit, independently of the binary download endpoint.
func (*FileService) Reconcile ¶
func (s *FileService) Reconcile(ctx context.Context) error
Reconcile atomically claims ended/expired uploads and unfinished deletes. Listing alone is not authority to delete: another process may still own the upload or may have completed it since the list was read.
func (*FileService) StoreToolOutput ¶
func (s *FileService) StoreToolOutput(ctx context.Context, sessionID, fileID, text string) error
StoreToolOutput publishes a journaled MCP receipt as a regular File. The ID is allocated before receipt persistence; only storage is retried. Session association pins bytes until Session deletion and constrains Work-token reads.
func (*FileService) Upload ¶
func (s *FileService) Upload(ctx context.Context, input FileUploadInput) (domain.File, error)
type FileUploadInput ¶
type Frame ¶
type Frame struct {
Event *domain.Event
Preview *domain.PreviewFrame
}
Frame is the unit delivered to a stream subscriber. Exactly one of Event or Preview is non-nil. Event carries a persisted event (delivered to every subscriber); Preview carries a stream-only preview frame (delivered only to subscribers that opted in for its event type). Preview frames are never persisted and never appear in event history.
The Event/Preview pointees MUST be treated as read-only by consumers: a single Publish/PublishPreview sends the same Frame (and thus the same inner pointer) to every matching subscriber, so mutating through the pointer would race and corrupt other subscribers' view. Copy before mutating if ever needed.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) CloseSession ¶
CloseSession publishes a final event and closes every subscriber atomically.
func (*Hub) PublishPreview ¶
func (h *Hub) PublishPreview(sessionID string, pf domain.PreviewFrame)
PublishPreview delivers a stream-only preview frame to subscribers that opted in for its event type. Preview frames are never persisted. Subscribers that did not opt in for f.EventType are skipped entirely (they see no frame). The slow-consumer drop policy still applies to opted-in subscribers.
func (*Hub) Subscribe ¶
Subscribe registers a subscriber for a session. deltaOptIn selects which event types this subscriber wants preview frames for; a nil/empty map means preview frames are never delivered to it. Persisted events are always delivered regardless of deltaOptIn.
func (*Hub) SubscribeContext ¶
func (h *Hub) SubscribeContext( _ context.Context, sessionID string, deltaOptIn map[string]bool, ) (<-chan Frame, func(), error)
SubscribeContext adapts the process-local Hub to the HTTP stream boundary. Subscription has no fallible setup; request cancellation remains owned by the handler and cleanup uses the returned cancel function.
type ListPage ¶
type ListPage struct {
AgentID string
AgentVersion *int
CreatedAtGt *time.Time
CreatedAtGte *time.Time
CreatedAtLt *time.Time
CreatedAtLte *time.Time
IncludeArchived bool
Statuses []domain.Status
DeploymentID *string
MemoryStoreID *string
Boundary *SessionPageBoundary
Limit int
Desc bool
}
ListPage describes a keyset-paginated session query.
type MemoryCreateInput ¶
type MemoryCreateInput struct {
Path string
Content string
Actor domain.MemoryActor
}
type MemoryListPage ¶
type MemoryListPage struct {
Items []domain.MemoryListItem
HasNext bool
}
type MemoryListQuery ¶
type MemoryRepository ¶
type MemoryRepository interface {
CreateStore(context.Context, domain.MemoryStore) (domain.MemoryStore, error)
GetStore(context.Context, string) (domain.MemoryStore, error)
UpdateStore(context.Context, string, MemoryStoreUpdateInput, domain.Clock) (domain.MemoryStore, error)
ListStores(context.Context, MemoryStoreListQuery) (MemoryStoreListPage, error)
ArchiveStore(context.Context, string, domain.Clock) (domain.MemoryStore, error)
DeleteStore(context.Context, string) error
CreateMemory(context.Context, domain.Memory, domain.MemoryVersion) (domain.Memory, error)
GetMemory(context.Context, string, string) (domain.Memory, error)
ListMemoryHeads(context.Context, string, string) ([]domain.Memory, error)
UpdateMemory(context.Context, string, string, MemoryUpdateInput, string, domain.Clock) (domain.Memory, error)
DeleteMemory(context.Context, string, string, *string, domain.MemoryActor, string, domain.Clock) (domain.Memory, error)
GetMemoryVersion(context.Context, string, string) (domain.MemoryVersion, error)
ListMemoryVersions(context.Context, string, MemoryVersionListQuery) (MemoryVersionListPage, error)
RedactMemoryVersion(context.Context, string, string, domain.MemoryActor, domain.Clock) (domain.MemoryVersion, error)
SyncMemoryStore(context.Context, string, []MemoryStoreSyncBaseline, []MemoryStoreSyncContent, domain.MemoryActor, domain.IDGenerator, domain.Clock) ([]domain.Memory, error)
}
type MemoryService ¶
type MemoryService struct {
// contains filtered or unexported fields
}
func NewMemoryService ¶
func NewMemoryService(repo MemoryRepository, ids domain.IDGenerator, clock domain.Clock) *MemoryService
func (*MemoryService) ArchiveStore ¶
func (s *MemoryService) ArchiveStore(ctx context.Context, id string) (domain.MemoryStore, error)
func (*MemoryService) CreateMemory ¶
func (s *MemoryService) CreateMemory(ctx context.Context, storeID string, input MemoryCreateInput) (domain.Memory, error)
func (*MemoryService) CreateStore ¶
func (s *MemoryService) CreateStore(ctx context.Context, input MemoryStoreCreateInput) (domain.MemoryStore, error)
func (*MemoryService) DeleteMemory ¶
func (s *MemoryService) DeleteMemory(ctx context.Context, storeID, memoryID string, expected *string, actor domain.MemoryActor) (domain.Memory, error)
func (*MemoryService) DeleteStore ¶
func (s *MemoryService) DeleteStore(ctx context.Context, id string) error
func (*MemoryService) GetMemoryVersion ¶
func (s *MemoryService) GetMemoryVersion(ctx context.Context, storeID, versionID string) (domain.MemoryVersion, error)
func (*MemoryService) GetStore ¶
func (s *MemoryService) GetStore(ctx context.Context, id string) (domain.MemoryStore, error)
func (*MemoryService) ListMemories ¶
func (s *MemoryService) ListMemories(ctx context.Context, storeID string, query MemoryListQuery) (MemoryListPage, error)
func (*MemoryService) ListMemoryVersions ¶
func (s *MemoryService) ListMemoryVersions(ctx context.Context, storeID string, query MemoryVersionListQuery) (MemoryVersionListPage, error)
func (*MemoryService) ListStores ¶
func (s *MemoryService) ListStores(ctx context.Context, query MemoryStoreListQuery) (MemoryStoreListPage, error)
func (*MemoryService) RedactMemoryVersion ¶
func (s *MemoryService) RedactMemoryVersion(ctx context.Context, storeID, versionID string, actor domain.MemoryActor) (domain.MemoryVersion, error)
func (*MemoryService) RuntimeHeads ¶
RuntimeHeads returns the complete canonical snapshot used to populate a Session mount. It intentionally bypasses public pagination while preserving the Store existence check in the repository.
func (*MemoryService) SyncRuntimeSnapshot ¶
func (s *MemoryService) SyncRuntimeSnapshot( ctx context.Context, storeID string, baseline []MemoryStoreSyncBaseline, current []MemoryStoreSyncContent, actor domain.MemoryActor, ) ([]domain.Memory, error)
SyncRuntimeSnapshot atomically persists all file changes made by one sandbox tool against the baseline that was last published to that sandbox.
func (*MemoryService) UpdateMemory ¶
func (s *MemoryService) UpdateMemory(ctx context.Context, storeID, memoryID string, input MemoryUpdateInput) (domain.Memory, error)
func (*MemoryService) UpdateStore ¶
func (s *MemoryService) UpdateStore(ctx context.Context, id string, input MemoryStoreUpdateInput) (domain.MemoryStore, error)
type MemoryStoreCreateInput ¶
type MemoryStoreListPage ¶
type MemoryStoreListPage struct {
Stores []domain.MemoryStore
HasNext bool
}
type MemoryStoreListQuery ¶
type MemoryStoreSyncBaseline ¶
type MemoryStoreSyncContent ¶
type MemoryStoreUpdateInput ¶
type MemoryUpdateInput ¶
type MemoryUpdateInput struct {
Path *string
Content *string
ExpectedContentSHA *string
Actor domain.MemoryActor
}
type MemoryVersionListPage ¶
type MemoryVersionListPage struct {
Versions []domain.MemoryVersion
HasNext bool
}
type MemoryVersionListQuery ¶
type NullablePatch ¶
NullablePatch preserves the three states used by nullable update fields: omitted (Present=false), explicit JSON null (Present=true, Value=nil), and a concrete value. A pointer alone cannot distinguish omission from null.
func PatchNull ¶
func PatchNull[T any]() NullablePatch[T]
func PatchValue ¶
func PatchValue[T any](value T) NullablePatch[T]
type OAuthRefreshCreateInput ¶
type OAuthRefreshUpdateInput ¶
type OAuthRefreshUpdateInput struct {
RefreshToken NullablePatch[string]
Scope NullablePatch[string]
TokenEndpointAuth *OAuthTokenEndpointAuthUpdateInput
}
type OAuthTokenEndpointAuthUpdateInput ¶
type OAuthTokenEndpointAuthUpdateInput struct {
Type string
ClientSecret NullablePatch[string]
}
type PreparedSessionResource ¶
type PreparedSessionResource struct {
Resource domain.SessionResource
}
type ResourcePageBoundary ¶
ResourcePageBoundary is the last (created_at, id) pair returned by a forward-only resource page.
type SessionListPage ¶
type SessionPageBoundary ¶
type SessionSkillMaterializer ¶
type SessionSkillMaterializer struct {
// contains filtered or unexported fields
}
SessionSkillMaterializer validates and reads immutable custom Skill archives for model-context injection. The external worker independently prepares the same pinned bundles in its own workspace.
func NewSessionSkillMaterializer ¶
func NewSessionSkillMaterializer( skills SessionSkillMountRepository, blobs BlobStore, ) *SessionSkillMaterializer
func (*SessionSkillMaterializer) LoadSkillInstructions ¶
func (m *SessionSkillMaterializer) LoadSkillInstructions( ctx context.Context, version domain.SkillVersion, ) ([]byte, error)
LoadSkillInstructions reads the immutable SKILL.md directly from Mango's canonical bundle. The orchestration layer owns the Agent loop, so activating a Skill must not require reverse access to the worker's filesystem. The worker independently materializes the same pinned bundle for later read/bash access to supporting files.
func (*SessionSkillMaterializer) SupportsSkillRuntime ¶
func (m *SessionSkillMaterializer) SupportsSkillRuntime() bool
SupportsSkillRuntime reports whether immutable Skill instructions can load.
type SessionSkillMountRepository ¶
type SessionSkillMountRepository interface {
SessionSkillsForRuntime(context.Context, string) ([]domain.SkillVersion, error)
}
SessionSkillMountRepository exposes the immutable Version metadata retained by a Session's relational pins.
type SessionThreadListQuery ¶
type SessionThreadListQuery struct {
Limit int
Boundary *SessionThreadPageBoundary
Statuses []domain.Status
}
type SkillCreateInput ¶
type SkillCreateInput struct {
DisplayTitle *string
Files []SkillUploadFile
}
type SkillListPage ¶
type SkillListQuery ¶
type SkillListQuery struct {
Source string
After *ResourcePageBoundary
Limit int
}
type SkillReferenceResolver ¶
type SkillReferenceResolver interface {
ResolveSkillReferences(
context.Context,
[]domain.SkillReference,
) ([]domain.SkillReference, error)
}
SkillReferenceResolver resolves request-time aliases to immutable custom Skill Versions. The Agent and Session services share this boundary so every persisted public snapshot contains concrete Version identifiers.
type SkillRepository ¶
type SkillRepository interface {
BlobCleanupRepository
BeginSkill(context.Context, domain.Skill, domain.SkillVersion) error
BeginVersion(context.Context, domain.SkillVersion) error
CompleteVersion(context.Context, string, string, string, BlobInfo) (domain.Skill, domain.SkillVersion, error)
RenewUpload(context.Context, string, string, string) error
ReleaseUpload(context.Context, string, string, string, bool) error
GetSkill(context.Context, string) (domain.Skill, error)
ListSkills(context.Context, SkillListQuery) (SkillListPage, error)
GetVersion(context.Context, string, string) (domain.SkillVersion, error)
ListVersions(context.Context, string, SkillVersionListQuery) (SkillVersionListPage, error)
BeginDeleteVersion(context.Context, string, string) (domain.SkillVersion, error)
RemoveIncompleteVersion(context.Context, string, string, string) error
ListIncompleteVersions(context.Context) ([]domain.SkillVersion, error)
ClaimIncompleteVersion(context.Context, string, string) (domain.SkillVersion, bool, error)
DeleteEmptySkill(context.Context, string) error
DeleteSkill(context.Context, string) (domain.Skill, error)
}
SkillRepository owns metadata and durable object-store lifecycle intents. Begin operations commit before blob I/O; CompleteVersion is the visibility boundary for an immutable archive.
type SkillService ¶
type SkillService struct {
// contains filtered or unexported fields
}
func NewSkillService ¶
func NewSkillService( repo SkillRepository, blobs BlobStore, ids domain.IDGenerator, clock domain.Clock, ) *SkillService
func (*SkillService) Create ¶
func (s *SkillService) Create(ctx context.Context, input SkillCreateInput) (domain.Skill, error)
func (*SkillService) CreateVersion ¶
func (s *SkillService) CreateVersion( ctx context.Context, skillID string, files []SkillUploadFile, ) (domain.SkillVersion, error)
func (*SkillService) DeleteVersion ¶
func (s *SkillService) DeleteVersion( ctx context.Context, skillID string, version string, ) (domain.SkillVersion, error)
func (*SkillService) Download ¶
func (s *SkillService) Download( ctx context.Context, skillID string, version string, ) (SkillVersionDownload, error)
func (*SkillService) GetVersion ¶
func (s *SkillService) GetVersion( ctx context.Context, skillID string, version string, ) (domain.SkillVersion, error)
func (*SkillService) List ¶
func (s *SkillService) List(ctx context.Context, query SkillListQuery) (SkillListPage, error)
func (*SkillService) ListVersions ¶
func (s *SkillService) ListVersions( ctx context.Context, skillID string, query SkillVersionListQuery, ) (SkillVersionListPage, error)
func (*SkillService) ResolveSkillReferences ¶
func (s *SkillService) ResolveSkillReferences( ctx context.Context, references []domain.SkillReference, ) ([]domain.SkillReference, error)
ResolveSkillReferences replaces omitted or "latest" aliases with concrete ready custom Skill Versions. Agent and Session persistence therefore never depends on a mutable latest-version pointer.
type SkillUploadFile ¶
type SkillVersionDownload ¶
type SkillVersionDownload struct {
Version domain.SkillVersion
Body io.ReadCloser
}
type SkillVersionListPage ¶
type SkillVersionListPage struct {
Versions []domain.SkillVersion
HasNext bool
}
type SkillVersionListQuery ¶
type SkillVersionListQuery struct {
After *ResourcePageBoundary
Limit int
}
type VaultCreateInput ¶
type VaultListPage ¶
type VaultListQuery ¶
type VaultListQuery struct {
IncludeArchived bool
After *ResourcePageBoundary
Limit int
}
type VaultRepository ¶
type VaultRepository interface {
CreateVault(context.Context, domain.Vault) (domain.Vault, error)
GetVault(context.Context, string) (domain.Vault, error)
UpdateVault(context.Context, string, VaultUpdateInput, domain.Clock) (domain.Vault, error)
ListVaults(context.Context, VaultListQuery) (VaultListPage, error)
ArchiveVault(context.Context, string, domain.Clock) (domain.Vault, error)
DeleteVault(context.Context, string) error
CreateCredential(context.Context, domain.VaultCredential, int) (domain.VaultCredential, error)
GetCredential(context.Context, string, string) (domain.VaultCredential, error)
UpdateCredential(context.Context, string, string, func(domain.VaultCredential) (domain.VaultCredential, bool, error)) (domain.VaultCredential, error)
ListCredentials(context.Context, string, CredentialListQuery) (CredentialListPage, error)
ArchiveCredential(context.Context, string, string, domain.Clock) (domain.VaultCredential, error)
DeleteCredential(context.Context, string, string) error
}
type VaultRuntimeRepository ¶
type VaultService ¶
type VaultService struct {
// contains filtered or unexported fields
}
func NewVaultService ¶
func NewVaultService(config VaultServiceConfig) *VaultService
func (*VaultService) ArchiveCredential ¶
func (s *VaultService) ArchiveCredential(ctx context.Context, vaultID, credentialID string) (domain.VaultCredential, error)
func (*VaultService) ArchiveVault ¶
func (*VaultService) CreateCredential ¶
func (s *VaultService) CreateCredential(ctx context.Context, vaultID string, input CredentialCreateInput) (domain.VaultCredential, error)
func (*VaultService) CreateVault ¶
func (s *VaultService) CreateVault(ctx context.Context, input VaultCreateInput) (domain.Vault, error)
func (*VaultService) DeleteCredential ¶
func (s *VaultService) DeleteCredential(ctx context.Context, vaultID, credentialID string) error
func (*VaultService) DeleteVault ¶
func (s *VaultService) DeleteVault(ctx context.Context, id string) error
func (*VaultService) GetCredential ¶
func (s *VaultService) GetCredential(ctx context.Context, vaultID, credentialID string) (domain.VaultCredential, error)
func (*VaultService) ListCredentials ¶
func (s *VaultService) ListCredentials(ctx context.Context, vaultID string, query CredentialListQuery) (CredentialListPage, error)
func (*VaultService) ListVaults ¶
func (s *VaultService) ListVaults(ctx context.Context, query VaultListQuery) (VaultListPage, error)
func (*VaultService) ResolveMCPBearer ¶
func (s *VaultService) ResolveMCPBearer( ctx context.Context, sessionID string, mcpServerURL string, ) (credentialruntime.BearerCredential, bool, error)
ResolveMCPBearer returns the first matching credential according to the Session's immutable Vault order. Credential plaintext exists only for this call and is never returned through the control-plane API.
func (*VaultService) UpdateCredential ¶
func (s *VaultService) UpdateCredential(ctx context.Context, vaultID, credentialID string, input CredentialUpdateInput) (domain.VaultCredential, error)
func (*VaultService) UpdateVault ¶
func (s *VaultService) UpdateVault(ctx context.Context, id string, input VaultUpdateInput) (domain.Vault, error)
func (*VaultService) ValidateMCPOAuthCredential ¶
func (s *VaultService) ValidateMCPOAuthCredential( ctx context.Context, vaultID string, credentialID string, ) (CredentialValidation, error)
ValidateMCPOAuthCredential live-probes an OAuth credential and, when the current access token is expired or rejected, attempts the configured refresh exchange before probing once more. Successful refreshes are persisted so the next Session resolution observes the rotated token.
type VaultServiceConfig ¶
type VaultServiceConfig struct {
Repository VaultRepository
Cipher secretcrypto.Cipher
IDGenerator domain.IDGenerator
Clock domain.Clock
OAuthRefresher credentialruntime.OAuthRefresher
MCPValidator credentialruntime.MCPValidator
}
type VaultUpdateInput ¶
type VaultUpdateInput struct {
DisplayName NullablePatch[string]
Metadata NullablePatch[map[string]*string]
}
type WebhookCreateInput ¶
type WebhookDeliveryRepository ¶
type WebhookDeliveryRepository interface {
ClaimWebhookDeliveries(
context.Context, time.Time, time.Time, string, int,
) ([]domain.WebhookDelivery, error)
CompleteWebhookDelivery(context.Context, WebhookDeliveryResult) (bool, error)
CleanupWebhookEvents(context.Context, time.Time, int) (int64, error)
}
type WebhookDeliveryResult ¶
type WebhookDispatcher ¶
type WebhookDispatcher struct {
// contains filtered or unexported fields
}
func NewWebhookDispatcher ¶
func NewWebhookDispatcher( repo WebhookDeliveryRepository, cipher secretcrypto.Cipher, client WebhookHTTPDoer, ids domain.IDGenerator, clock domain.Clock, ) *WebhookDispatcher
type WebhookListPage ¶
type WebhookListQuery ¶
type WebhookListQuery struct {
After *ResourcePageBoundary
Limit int
}
type WebhookRepository ¶
type WebhookRepository interface {
CreateWebhook(context.Context, domain.Webhook, int) (domain.Webhook, error)
GetWebhook(context.Context, string) (domain.Webhook, error)
UpdateWebhook(context.Context, string, func(domain.Webhook) (domain.Webhook, bool, error)) (domain.Webhook, error)
ListWebhooks(context.Context, WebhookListQuery) (WebhookListPage, error)
DeleteWebhook(context.Context, string) error
}
type WebhookSecretResult ¶
type WebhookService ¶
type WebhookService struct {
// contains filtered or unexported fields
}
func NewWebhookService ¶
func NewWebhookService( repo WebhookRepository, cipher secretcrypto.Cipher, ids domain.IDGenerator, clock domain.Clock, ) *WebhookService
func (*WebhookService) CreateWebhook ¶
func (s *WebhookService) CreateWebhook( ctx context.Context, input WebhookCreateInput, ) (WebhookSecretResult, error)
func (*WebhookService) DeleteWebhook ¶
func (s *WebhookService) DeleteWebhook(ctx context.Context, id string) error
func (*WebhookService) GetWebhook ¶
func (*WebhookService) ListWebhooks ¶
func (s *WebhookService) ListWebhooks( ctx context.Context, query WebhookListQuery, ) (WebhookListPage, error)
func (*WebhookService) RegenerateSigningSecret ¶
func (s *WebhookService) RegenerateSigningSecret( ctx context.Context, id string, ) (WebhookSecretResult, error)
func (*WebhookService) UpdateWebhook ¶
func (s *WebhookService) UpdateWebhook( ctx context.Context, id string, input WebhookUpdateInput, ) (domain.Webhook, error)
type WebhookUpdateInput ¶
type WebhookUpdateInput struct {
URL *string
EventTypes *[]string
Status *domain.WebhookStatus
}
Source Files
¶
- agent_service.go
- blob_cleanup.go
- blob_upload_lease.go
- deployment_reconciler.go
- deployment_service.go
- environment_service.go
- environment_work.go
- event_query.go
- file_service.go
- memory_service.go
- metadata.go
- repositories.go
- resource_list.go
- session_skill_materializer.go
- session_thread.go
- session_types.go
- skill_bundle.go
- skill_reference.go
- skill_service.go
- stream.go
- tool_output.go
- vault_oauth.go
- vault_service.go
- webhook_dispatcher.go
- webhook_service.go