agentplatform

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvAPIURL         = "OPENASE_API_URL"
	EnvAgentToken     = "OPENASE_AGENT_TOKEN" // #nosec G101 -- environment variable key name, not a credential
	EnvProjectID      = "OPENASE_PROJECT_ID"
	EnvTicketID       = "OPENASE_TICKET_ID"
	EnvConversationID = "OPENASE_CONVERSATION_ID"
	EnvPrincipalKind  = "OPENASE_PRINCIPAL_KIND"
	EnvAgentScopes    = "OPENASE_AGENT_SCOPES"
)
View Source
const TokenPrefix = "ase_agent_"

Variables

View Source
var ErrNotFound = errors.New("agent platform record not found")

Functions

func BuildCapabilityContract

func BuildCapabilityContract(input RuntimeContractInput) string

func BuildEnvironment

func BuildEnvironment(apiURL string, token string, projectID uuid.UUID, ticketID uuid.UUID) []string

func BuildRuntimeEnvironment

func BuildRuntimeEnvironment(input RuntimeContractInput) []string

func DefaultAgentScopes

func DefaultAgentScopes() []string

func SupportedAgentScopes

func SupportedAgentScopes() []string

Types

type AgentPrincipal

type AgentPrincipal struct {
	ID        uuid.UUID
	Name      string
	ProjectID uuid.UUID
}

type Claims

type Claims struct {
	TokenID        uuid.UUID
	PrincipalKind  PrincipalKind
	PrincipalID    uuid.UUID
	PrincipalName  string
	AgentID        uuid.UUID
	ProjectID      uuid.UUID
	TicketID       uuid.UUID
	ConversationID uuid.UUID
	Scopes         []string
	ExpiresAt      time.Time
}

func (Claims) CreatedBy

func (c Claims) CreatedBy() string

func (Claims) HasScope

func (c Claims) HasScope(scope Scope) bool

func (Claims) IsProjectConversation

func (c Claims) IsProjectConversation() bool

func (Claims) IsTicketAgent

func (c Claims) IsTicketAgent() bool

type CreateTokenRecord

type CreateTokenRecord struct {
	AgentID        *uuid.UUID
	ProjectID      uuid.UUID
	TicketID       *uuid.UUID
	ConversationID *uuid.UUID
	PrincipalKind  PrincipalKind
	PrincipalID    uuid.UUID
	PrincipalName  string
	TokenHash      string
	Scopes         []string
	ExpiresAt      time.Time
}

type IssueInput

type IssueInput struct {
	PrincipalKind  PrincipalKind
	PrincipalID    uuid.UUID
	PrincipalName  string
	AgentID        uuid.UUID
	ProjectID      uuid.UUID
	TicketID       uuid.UUID
	ConversationID uuid.UUID
	Scopes         []string
	ScopeWhitelist ScopeWhitelist
	TTL            time.Duration
}

type IssuedToken

type IssuedToken struct {
	Token          string
	PrincipalKind  PrincipalKind
	PrincipalID    uuid.UUID
	PrincipalName  string
	ProjectID      uuid.UUID
	TicketID       uuid.UUID
	ConversationID uuid.UUID
	Scopes         []string
	ExpiresAt      time.Time
}

type PrincipalKind

type PrincipalKind string
const (
	PrincipalKindTicketAgent         PrincipalKind = "ticket_agent"
	PrincipalKindProjectConversation PrincipalKind = "project_conversation"
)

type ProjectConversationPrincipal

type ProjectConversationPrincipal struct {
	ID             uuid.UUID
	Name           string
	ProjectID      uuid.UUID
	ConversationID uuid.UUID
}

type ProjectTokenInventory

type ProjectTokenInventory struct {
	ActiveTokenCount  int
	ExpiredTokenCount int
	LastIssuedAt      *time.Time
	LastUsedAt        *time.Time
	DefaultScopes     []string
	PrivilegedScopes  []string
}

type RuntimeContractInput

type RuntimeContractInput struct {
	PrincipalKind  PrincipalKind
	ProjectID      uuid.UUID
	TicketID       uuid.UUID
	ConversationID uuid.UUID
	APIURL         string
	Token          string
	Scopes         []string
}

func (RuntimeContractInput) String

func (i RuntimeContractInput) String() string

type Scope

type Scope string
const (
	ScopeTicketsCreate                 Scope = "tickets.create"
	ScopeTicketsList                   Scope = "tickets.list"
	ScopeTicketsReportUsage            Scope = "tickets.report_usage"
	ScopeTicketsUpdateSelf             Scope = "tickets.update.self"
	ScopeProjectsUpdate                Scope = "projects.update"
	ScopeProjectsAddRepo               Scope = "projects.add_repo"
	ScopeActivityRead                  Scope = "activity.read"
	ScopeReposCreate                   Scope = "repos.create"
	ScopeReposRead                     Scope = "repos.read"
	ScopeReposUpdate                   Scope = "repos.update"
	ScopeReposDelete                   Scope = "repos.delete"
	ScopeScheduledJobsList             Scope = "scheduled_jobs.list"
	ScopeScheduledJobsCreate           Scope = "scheduled_jobs.create"
	ScopeScheduledJobsUpdate           Scope = "scheduled_jobs.update"
	ScopeScheduledJobsDelete           Scope = "scheduled_jobs.delete"
	ScopeScheduledJobsTrigger          Scope = "scheduled_jobs.trigger"
	ScopeSkillsList                    Scope = "skills.list"
	ScopeSkillsRead                    Scope = "skills.read"
	ScopeSkillsCreate                  Scope = "skills.create"
	ScopeSkillsImport                  Scope = "skills.import"
	ScopeSkillsRefresh                 Scope = "skills.refresh"
	ScopeSkillsUpdate                  Scope = "skills.update"
	ScopeSkillsDelete                  Scope = "skills.delete"
	ScopeSkillsEnable                  Scope = "skills.enable"
	ScopeSkillsDisable                 Scope = "skills.disable"
	ScopeSkillsBind                    Scope = "skills.bind"
	ScopeSkillsRefine                  Scope = "skills.refine"
	ScopeStatusesList                  Scope = "statuses.list"
	ScopeStatusesCreate                Scope = "statuses.create"
	ScopeStatusesUpdate                Scope = "statuses.update"
	ScopeStatusesDelete                Scope = "statuses.delete"
	ScopeStatusesReset                 Scope = "statuses.reset"
	ScopeTicketRepoScopesList          Scope = "ticket_repo_scopes.list"
	ScopeTicketRepoScopesCreate        Scope = "ticket_repo_scopes.create"
	ScopeTicketRepoScopesUpdate        Scope = "ticket_repo_scopes.update"
	ScopeTicketRepoScopesDelete        Scope = "ticket_repo_scopes.delete"
	ScopeWorkflowsList                 Scope = "workflows.list"
	ScopeWorkflowsRead                 Scope = "workflows.read"
	ScopeWorkflowsCreate               Scope = "workflows.create"
	ScopeWorkflowsUpdate               Scope = "workflows.update"
	ScopeWorkflowsDelete               Scope = "workflows.delete"
	ScopeWorkflowsHarnessRead          Scope = "workflows.harness.read"
	ScopeWorkflowsHarnessHistoryRead   Scope = "workflows.harness.history.read"
	ScopeWorkflowsHarnessUpdate        Scope = "workflows.harness.update"
	ScopeWorkflowsHarnessValidate      Scope = "workflows.harness.validate"
	ScopeWorkflowsHarnessVariablesRead Scope = "workflows.harness.variables.read"
)

type ScopeGroup

type ScopeGroup struct {
	Category string   `json:"category"`
	Scopes   []string `json:"scopes"`
}

type ScopeSet

type ScopeSet []Scope

type ScopeWhitelist

type ScopeWhitelist struct {
	Configured bool
	Scopes     []string
}

type StoredTokenRecord

type StoredTokenRecord struct {
	TokenID        uuid.UUID
	AgentID        *uuid.UUID
	ProjectID      uuid.UUID
	TicketID       *uuid.UUID
	ConversationID *uuid.UUID
	PrincipalKind  PrincipalKind
	PrincipalID    uuid.UUID
	PrincipalName  string
	Scopes         []string
	ExpiresAt      time.Time
	LastUsedAt     *time.Time
}

Jump to

Keyboard shortcuts

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