tarsclient

package
v0.31.8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServerURL = "http://127.0.0.1:43180"

DefaultServerURL is the fallback API base URL when Config.ServerURL is empty.

Variables

This section is empty.

Functions

func ScanSSELines

func ScanSSELines(r io.Reader, onData func([]byte) error) error

Types

type APIError

type APIError struct {
	Method   string
	Endpoint string
	Status   int
	Code     string
	Message  string
	Body     string
}

func (*APIError) Error

func (e *APIError) Error() string

type AgentDescriptor

type AgentDescriptor struct {
	Name               string   `json:"name"`
	Description        string   `json:"description,omitempty"`
	Enabled            bool     `json:"enabled,omitempty"`
	Kind               string   `json:"kind,omitempty"`
	Source             string   `json:"source,omitempty"`
	Entry              string   `json:"entry,omitempty"`
	Default            bool     `json:"default,omitempty"`
	PolicyMode         string   `json:"policy_mode,omitempty"`
	ToolsAllow         []string `json:"tools_allow,omitempty"`
	ToolsAllowCount    int      `json:"tools_allow_count,omitempty"`
	ToolsDeny          []string `json:"tools_deny,omitempty"`
	ToolsDenyCount     int      `json:"tools_deny_count,omitempty"`
	ToolsRiskMax       string   `json:"tools_risk_max,omitempty"`
	ToolsAllowGroups   []string `json:"tools_allow_groups,omitempty"`
	ToolsAllowPatterns []string `json:"tools_allow_patterns,omitempty"`
	SessionRoutingMode string   `json:"session_routing_mode,omitempty"`
	SessionFixedID     string   `json:"session_fixed_id,omitempty"`
}

type AgentRun

type AgentRun struct {
	RunID              string   `json:"run_id"`
	SessionID          string   `json:"session_id,omitempty"`
	Agent              string   `json:"agent,omitempty"`
	Status             string   `json:"status"`
	Accepted           bool     `json:"accepted"`
	Response           string   `json:"response,omitempty"`
	Error              string   `json:"error,omitempty"`
	DiagnosticCode     string   `json:"diagnostic_code,omitempty"`
	DiagnosticReason   string   `json:"diagnostic_reason,omitempty"`
	PolicyBlockedTool  string   `json:"policy_blocked_tool,omitempty"`
	PolicyAllowedTools []string `json:"policy_allowed_tools,omitempty"`
	PolicyDeniedTools  []string `json:"policy_denied_tools,omitempty"`
	PolicyRiskMax      string   `json:"policy_risk_max,omitempty"`
	CreatedAt          string   `json:"created_at,omitempty"`
	StartedAt          string   `json:"started_at,omitempty"`
	CompletedAt        string   `json:"completed_at,omitempty"`
}

type AgentRuntimeReportChannels added in v0.31.5

type AgentRuntimeReportChannels struct {
	GeneratedAt    string                            `json:"generated_at"`
	ArchiveEnabled bool                              `json:"archive_enabled"`
	Count          int                               `json:"count"`
	Messages       map[string][]ChannelReportMessage `json:"messages"`
}

type AgentRuntimeReportRuns added in v0.31.5

type AgentRuntimeReportRuns struct {
	GeneratedAt    string     `json:"generated_at"`
	ArchiveEnabled bool       `json:"archive_enabled"`
	Count          int        `json:"count"`
	Runs           []AgentRun `json:"runs"`
}

type AgentRuntimeReportSummary added in v0.31.5

type AgentRuntimeReportSummary struct {
	GeneratedAt      string         `json:"generated_at"`
	SummaryEnabled   bool           `json:"summary_enabled"`
	ArchiveEnabled   bool           `json:"archive_enabled"`
	RunsTotal        int            `json:"runs_total"`
	RunsActive       int            `json:"runs_active"`
	RunsByStatus     map[string]int `json:"runs_by_status"`
	ChannelsTotal    int            `json:"channels_total"`
	MessagesTotal    int            `json:"messages_total"`
	MessagesBySource map[string]int `json:"messages_by_source"`
}

type AgentRuntimeStatus added in v0.31.5

type AgentRuntimeStatus struct {
	Enabled                    bool   `json:"enabled"`
	Version                    int64  `json:"version"`
	RunsTotal                  int    `json:"runs_total"`
	RunsActive                 int    `json:"runs_active"`
	AgentsCount                int    `json:"agents_count"`
	AgentsWatchEnabled         bool   `json:"agents_watch_enabled"`
	AgentsReloadVersion        int64  `json:"agents_reload_version"`
	ChannelsLocalEnabled       bool   `json:"channels_local_enabled"`
	ChannelsWebhookEnabled     bool   `json:"channels_webhook_enabled"`
	ChannelsTelegramEnabled    bool   `json:"channels_telegram_enabled"`
	PersistenceEnabled         bool   `json:"persistence_enabled"`
	RunsPersistenceEnabled     bool   `json:"runs_persistence_enabled"`
	ChannelsPersistenceEnabled bool   `json:"channels_persistence_enabled"`
	RestoreOnStartup           bool   `json:"restore_on_startup"`
	PersistenceDir             string `json:"persistence_dir,omitempty"`
	RunsRestored               int    `json:"runs_restored"`
	ChannelsRestored           int    `json:"channels_restored"`
	LastPersistAt              string `json:"last_persist_at,omitempty"`
	LastRestoreAt              string `json:"last_restore_at,omitempty"`
	LastRestoreError           string `json:"last_restore_error,omitempty"`
	AgentsLastReloadAt         string `json:"agents_last_reload_at,omitempty"`
}

type Approval

type Approval struct {
	ID          string      `json:"id"`
	Type        string      `json:"type"`
	Status      string      `json:"status"`
	RequestedAt string      `json:"requested_at,omitempty"`
	UpdatedAt   string      `json:"updated_at,omitempty"`
	ReviewedAt  string      `json:"reviewed_at,omitempty"`
	Plan        CleanupPlan `json:"plan"`
	Note        string      `json:"note,omitempty"`
}

type ChannelReportMessage

type ChannelReportMessage struct {
	ID        string `json:"id"`
	ChannelID string `json:"channel_id"`
	Source    string `json:"source"`
	Direction string `json:"direction"`
	Text      string `json:"text"`
	Timestamp string `json:"timestamp"`
}

type ChatEvent

type ChatEvent struct {
	Type              string `json:"type"`
	Text              string `json:"text"`
	Error             string `json:"error"`
	SessionID         string `json:"session_id"`
	Message           string `json:"message"`
	Phase             string `json:"phase"`
	ToolName          string `json:"tool_name"`
	ToolCallID        string `json:"tool_call_id"`
	ToolArgsPreview   string `json:"tool_args_preview"`
	ToolResultPreview string `json:"tool_result_preview"`
	SkillName         string `json:"skill_name"`
	SkillReason       string `json:"skill_reason"`
}

type ChatRequest

type ChatRequest struct {
	Message   string `json:"message"`
	SessionID string `json:"session_id,omitempty"`
}

type ChatResult

type ChatResult struct {
	SessionID string
	Assistant string
}

type CleanupApplyResult

type CleanupApplyResult struct {
	ApprovalID   string   `json:"approval_id"`
	DeletedCount int      `json:"deleted_count"`
	DeletedBytes int64    `json:"deleted_bytes"`
	Errors       []string `json:"errors,omitempty"`
}

type CleanupCandidate

type CleanupCandidate struct {
	Path      string `json:"path"`
	SizeBytes int64  `json:"size_bytes"`
	Reason    string `json:"reason,omitempty"`
}

type CleanupPlan

type CleanupPlan struct {
	ApprovalID string             `json:"approval_id"`
	CreatedAt  string             `json:"created_at,omitempty"`
	TotalBytes int64              `json:"total_bytes"`
	Candidates []CleanupCandidate `json:"candidates"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *Client

func (*Client) AgentRuntimeReload added in v0.31.5

func (c *Client) AgentRuntimeReload(ctx context.Context) (AgentRuntimeStatus, error)

func (*Client) AgentRuntimeReportChannels added in v0.31.5

func (c *Client) AgentRuntimeReportChannels(ctx context.Context, limit int) (AgentRuntimeReportChannels, error)

func (*Client) AgentRuntimeReportRuns added in v0.31.5

func (c *Client) AgentRuntimeReportRuns(ctx context.Context, limit int) (AgentRuntimeReportRuns, error)

func (*Client) AgentRuntimeReportSummary added in v0.31.5

func (c *Client) AgentRuntimeReportSummary(ctx context.Context) (AgentRuntimeReportSummary, error)

func (*Client) AgentRuntimeRestart added in v0.31.5

func (c *Client) AgentRuntimeRestart(ctx context.Context) (AgentRuntimeStatus, error)

func (*Client) AgentRuntimeStatus added in v0.31.5

func (c *Client) AgentRuntimeStatus(ctx context.Context) (AgentRuntimeStatus, error)

func (*Client) ApplyCleanup

func (c *Client) ApplyCleanup(ctx context.Context, approvalID string) (CleanupApplyResult, error)

func (*Client) ApproveCleanup

func (c *Client) ApproveCleanup(ctx context.Context, approvalID string) error

func (*Client) ApproveTelegramPairing

func (c *Client) ApproveTelegramPairing(ctx context.Context, code string) (TelegramPairingAllowed, error)

func (*Client) CancelRun

func (c *Client) CancelRun(ctx context.Context, runID string) (AgentRun, error)

func (*Client) Compact

func (c *Client) Compact(ctx context.Context, sessionID string) (CompactInfo, error)

func (*Client) CompactWithOptions added in v0.10.2

func (c *Client) CompactWithOptions(ctx context.Context, req CompactRequest) (CompactInfo, error)

func (*Client) CreateCleanupPlan

func (c *Client) CreateCleanupPlan(ctx context.Context) (CleanupPlan, error)

func (*Client) CreateCronJob

func (c *Client) CreateCronJob(ctx context.Context, schedule, prompt string) (CronJob, error)

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, title string) (SessionSummary, error)

func (*Client) DeleteCronJob

func (c *Client) DeleteCronJob(ctx context.Context, jobID string) error

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body any, out any) error

func (*Client) ExportSession

func (c *Client) ExportSession(ctx context.Context, sessionID string) (string, error)

func (*Client) GetCronJob

func (c *Client) GetCronJob(ctx context.Context, jobID string) (CronJob, error)

func (*Client) GetEventHistory

func (c *Client) GetEventHistory(ctx context.Context, limit int) (EventsHistoryInfo, error)

func (*Client) GetHistory

func (c *Client) GetHistory(ctx context.Context, sessionID string) ([]SessionMessage, error)

func (*Client) GetRun

func (c *Client) GetRun(ctx context.Context, runID string) (AgentRun, error)

func (*Client) GetUsageLimits

func (c *Client) GetUsageLimits(ctx context.Context) (UsageLimits, error)

func (*Client) GetUsageSignals added in v0.31.6

func (c *Client) GetUsageSignals(ctx context.Context, period string) (UsageSignalSummary, error)

func (*Client) GetUsageSummary

func (c *Client) GetUsageSummary(ctx context.Context, period string, groupBy string) (UsageSummary, UsageLimits, UsageLimitStatus, error)

func (*Client) Healthz

func (c *Client) Healthz(ctx context.Context) (HealthInfo, error)

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context) ([]AgentDescriptor, error)

func (*Client) ListApprovals

func (c *Client) ListApprovals(ctx context.Context) ([]Approval, error)

func (*Client) ListCronJobs

func (c *Client) ListCronJobs(ctx context.Context) ([]CronJob, error)

func (*Client) ListCronRuns

func (c *Client) ListCronRuns(ctx context.Context, jobID string, limit int) ([]CronRunRecord, error)

func (*Client) ListMCPServers

func (c *Client) ListMCPServers(ctx context.Context) ([]MCPServerInfo, error)

func (*Client) ListMCPTools

func (c *Client) ListMCPTools(ctx context.Context) ([]MCPToolInfo, error)

func (*Client) ListPlugins

func (c *Client) ListPlugins(ctx context.Context) ([]PluginDef, error)

func (*Client) ListRuns

func (c *Client) ListRuns(ctx context.Context, limit int) ([]AgentRun, error)

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context) ([]SessionSummary, error)

func (*Client) ListSkills

func (c *Client) ListSkills(ctx context.Context) ([]SkillDef, error)

func (*Client) MarkEventsRead

func (c *Client) MarkEventsRead(ctx context.Context, lastID int64) (EventsReadInfo, error)

func (*Client) Models

func (c *Client) Models(ctx context.Context) (ModelsInfo, error)

func (*Client) OpsStatus

func (c *Client) OpsStatus(ctx context.Context) (OpsStatus, error)

func (*Client) Providers

func (c *Client) Providers(ctx context.Context) (ProvidersInfo, error)

func (*Client) PulseRunOnce added in v0.25.0

func (c *Client) PulseRunOnce(ctx context.Context) (PulseInfo, error)

PulseRunOnce triggers a single pulse watchdog tick on the server and returns the resulting tick outcome. Replaces the previous HeartbeatRunOnce call — heartbeat has been removed.

func (*Client) RejectCleanup

func (c *Client) RejectCleanup(ctx context.Context, approvalID string) error

func (*Client) ReloadExtensions

func (c *Client) ReloadExtensions(ctx context.Context) (ExtensionsReloadInfo, error)

func (*Client) RunCronJob

func (c *Client) RunCronJob(ctx context.Context, jobID string) (string, error)

func (*Client) SearchSessions

func (c *Client) SearchSessions(ctx context.Context, keyword string) ([]SessionSummary, error)

func (*Client) SpawnRun

func (c *Client) SpawnRun(ctx context.Context, req SpawnRequest) (AgentRun, error)

func (*Client) Status

func (c *Client) Status(ctx context.Context) (StatusInfo, error)

func (*Client) StreamChat

func (c *Client) StreamChat(ctx context.Context, req ChatRequest, onStatus func(ChatEvent), onDelta func(string)) (ChatResult, error)

func (*Client) StreamEvents

func (c *Client) StreamEvents(ctx context.Context, onEvent func(NotificationMessage), onError func(error))

func (*Client) StreamSSE

func (c *Client) StreamSSE(ctx context.Context, method, path string, body any, onData func([]byte) error) error

func (*Client) TelegramPairings

func (c *Client) TelegramPairings(ctx context.Context) (TelegramPairingsInfo, error)

func (*Client) UpdateCronJobEnabled

func (c *Client) UpdateCronJobEnabled(ctx context.Context, jobID string, enabled bool) (CronJob, error)

func (*Client) UpdateUsageLimits

func (c *Client) UpdateUsageLimits(ctx context.Context, req UsageLimits) (UsageLimits, error)

func (*Client) Whoami

func (c *Client) Whoami(ctx context.Context) (WhoamiInfo, error)

type CompactInfo

type CompactInfo struct {
	Message string `json:"message"`
}

type CompactRequest added in v0.10.2

type CompactRequest struct {
	SessionID        string `json:"session_id"`
	KeepRecent       int    `json:"keep_recent,omitempty"`
	KeepRecentTokens int    `json:"keep_recent_tokens,omitempty"`
	Instructions     string `json:"instructions,omitempty"`
}

type Config

type Config struct {
	ServerURL     string
	APIToken      string
	AdminAPIToken string
	HTTPClient    *http.Client
}

type CronJob

type CronJob struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Prompt         string `json:"prompt"`
	Schedule       string `json:"schedule"`
	Enabled        bool   `json:"enabled"`
	DeleteAfterRun bool   `json:"delete_after_run,omitempty"`
	SessionID      string `json:"session_id,omitempty"`
	SessionTarget  string `json:"session_target,omitempty"`
	WakeMode       string `json:"wake_mode,omitempty"`
	DeliveryMode   string `json:"delivery_mode,omitempty"`
	LastRunAt      string `json:"last_run_at,omitempty"`
	LastRunError   string `json:"last_run_error,omitempty"`
}

type CronRunRecord

type CronRunRecord struct {
	JobID    string `json:"job_id"`
	RanAt    string `json:"ran_at"`
	Response string `json:"response,omitempty"`
	Error    string `json:"error,omitempty"`
}

type EventsHistoryInfo

type EventsHistoryInfo struct {
	Items []NotificationMessage `json:"items"`
	// UnreadCount is based on all retained notification history on server side,
	// not only on this paged Items slice.
	UnreadCount int   `json:"unread_count"`
	ReadCursor  int64 `json:"read_cursor"`
	LastID      int64 `json:"last_id"`
}

type EventsReadInfo

type EventsReadInfo struct {
	Acknowledged bool  `json:"acknowledged"`
	ReadCursor   int64 `json:"read_cursor"`
	UnreadCount  int   `json:"unread_count"`
}

type ExtensionsReloadInfo

type ExtensionsReloadInfo struct {
	Reloaded              bool  `json:"reloaded"`
	Version               int64 `json:"version,omitempty"`
	Skills                int   `json:"skills,omitempty"`
	Plugins               int   `json:"plugins,omitempty"`
	MCPCount              int   `json:"mcp_count,omitempty"`
	AgentRuntimeRefreshed bool  `json:"agentruntime_refreshed,omitempty"`
	AgentRuntimeAgents    int   `json:"agentruntime_agents,omitempty"`
}

type HealthInfo

type HealthInfo struct {
	OK        bool   `json:"ok"`
	Component string `json:"component,omitempty"`
	Time      string `json:"time,omitempty"`
}

type MCPServerInfo

type MCPServerInfo struct {
	Name      string `json:"name"`
	Command   string `json:"command,omitempty"`
	URL       string `json:"url,omitempty"`
	Transport string `json:"transport,omitempty"`
	Source    string `json:"source,omitempty"`
	AuthMode  string `json:"auth_mode,omitempty"`
	Connected bool   `json:"connected"`
	ToolCount int    `json:"tool_count"`
	Error     string `json:"error,omitempty"`
}

type MCPToolInfo

type MCPToolInfo struct {
	Server      string `json:"server"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type ModelsInfo

type ModelsInfo struct {
	Provider     string   `json:"provider"`
	CurrentModel string   `json:"current_model"`
	Source       string   `json:"source"`
	Stale        bool     `json:"stale"`
	FetchedAt    string   `json:"fetched_at,omitempty"`
	ExpiresAt    string   `json:"expires_at,omitempty"`
	Models       []string `json:"models"`
	Warning      string   `json:"warning,omitempty"`
}

type NotificationMessage

type NotificationMessage struct {
	ID        int64  `json:"id,omitempty"`
	Type      string `json:"type"`
	Category  string `json:"category"`
	Severity  string `json:"severity"`
	Title     string `json:"title"`
	Message   string `json:"message"`
	Timestamp string `json:"timestamp"`
	JobID     string `json:"job_id,omitempty"`
	SessionID string `json:"session_id,omitempty"`
	OpenPath  string `json:"open_path,omitempty"`
}

type OpsStatus

type OpsStatus struct {
	Timestamp       string  `json:"timestamp"`
	DiskTotalBytes  uint64  `json:"disk_total_bytes"`
	DiskFreeBytes   uint64  `json:"disk_free_bytes"`
	DiskUsedPercent float64 `json:"disk_used_percent"`
	ProcessCount    int     `json:"process_count"`
}

type PluginDef

type PluginDef struct {
	SchemaVersion         int            `json:"schema_version,omitempty"`
	ID                    string         `json:"id"`
	Name                  string         `json:"name,omitempty"`
	Version               string         `json:"version,omitempty"`
	Description           string         `json:"description,omitempty"`
	Source                string         `json:"source,omitempty"`
	RootDir               string         `json:"root_dir,omitempty"`
	DefaultProjectProfile string         `json:"default_project_profile,omitempty"`
	SupportedOS           []string       `json:"supported_os,omitempty"`
	SupportedArch         []string       `json:"supported_arch,omitempty"`
	Requires              PluginRequires `json:"requires,omitempty"`
	Policies              PluginPolicies `json:"policies,omitempty"`
}

type PluginPolicies added in v0.11.0

type PluginPolicies struct {
	ToolsAllow []string `json:"tools_allow,omitempty"`
	ToolsDeny  []string `json:"tools_deny,omitempty"`
}

type PluginRequires added in v0.11.0

type PluginRequires struct {
	Bins []string `json:"bins,omitempty"`
	Env  []string `json:"env,omitempty"`
}

type ProviderInfo

type ProviderInfo struct {
	ID                 string `json:"id"`
	SupportsLiveModels bool   `json:"supports_live_models"`
}

type ProvidersInfo

type ProvidersInfo struct {
	CurrentProvider string         `json:"current_provider"`
	CurrentModel    string         `json:"current_model"`
	AuthMode        string         `json:"auth_mode"`
	Providers       []ProviderInfo `json:"providers"`
}

type PulseInfo added in v0.25.0

type PulseInfo struct {
	Skipped         bool   `json:"skipped,omitempty"`
	SkipReason      string `json:"skip_reason,omitempty"`
	DeciderInvoked  bool   `json:"decider_invoked,omitempty"`
	NotifyDelivered bool   `json:"notify_delivered,omitempty"`
	AutofixAttempt  string `json:"autofix_attempt,omitempty"`
	AutofixOK       bool   `json:"autofix_ok,omitempty"`
	Err             string `json:"err,omitempty"`
}

PulseInfo summarizes the result of a pulse tick triggered via the /v1/pulse/run-once endpoint. Fields mirror the server-side pulse.TickOutcome with JSON field names aligned to that struct.

type SessionMessage

type SessionMessage struct {
	Role      string `json:"role"`
	Content   string `json:"content"`
	Timestamp string `json:"timestamp,omitempty"`
}

type SessionSummary

type SessionSummary struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

type SkillDef

type SkillDef struct {
	Name          string `json:"name"`
	Description   string `json:"description,omitempty"`
	UserInvocable bool   `json:"user_invocable"`
	Source        string `json:"source,omitempty"`
	RuntimePath   string `json:"runtime_path,omitempty"`
}

type SpawnRequest

type SpawnRequest struct {
	SessionID string `json:"session_id,omitempty"`
	Title     string `json:"title,omitempty"`
	Message   string `json:"message"`
	Agent     string `json:"agent,omitempty"`
}

SpawnRequest is the API payload for POST /v1/agent/runs. CLI parsing types (for example, spawnCommand) stay in internal/tarsclient.

type StatusInfo

type StatusInfo struct {
	WorkspaceDir  string `json:"workspace_dir"`
	SessionCount  int    `json:"session_count"`
	MainSessionID string `json:"main_session_id,omitempty"`
	AuthRole      string `json:"auth_role,omitempty"`
}

type TelegramPairingAllowed

type TelegramPairingAllowed struct {
	UserID     int64  `json:"user_id"`
	ChatID     string `json:"chat_id"`
	Username   string `json:"username,omitempty"`
	ApprovedAt string `json:"approved_at"`
}

type TelegramPairingPending

type TelegramPairingPending struct {
	Code      string `json:"code"`
	UserID    int64  `json:"user_id"`
	ChatID    string `json:"chat_id"`
	Username  string `json:"username,omitempty"`
	CreatedAt string `json:"created_at"`
	ExpiresAt string `json:"expires_at"`
}

type TelegramPairingsInfo

type TelegramPairingsInfo struct {
	DMPolicy       string                   `json:"dm_policy"`
	PollingEnabled bool                     `json:"polling_enabled"`
	Pending        []TelegramPairingPending `json:"pending"`
	Allowed        []TelegramPairingAllowed `json:"allowed"`
}

type UsageLimitStatus

type UsageLimitStatus struct {
	Exceeded bool    `json:"exceeded"`
	Mode     string  `json:"mode"`
	Period   string  `json:"period,omitempty"`
	SpentUSD float64 `json:"spent_usd,omitempty"`
	LimitUSD float64 `json:"limit_usd,omitempty"`
}

type UsageLimits

type UsageLimits struct {
	DailyUSD   float64 `json:"daily_usd"`
	WeeklyUSD  float64 `json:"weekly_usd"`
	MonthlyUSD float64 `json:"monthly_usd"`
	Mode       string  `json:"mode"`
}

type UsageSignalRow added in v0.31.6

type UsageSignalRow struct {
	Name       string            `json:"name"`
	Source     string            `json:"source,omitempty"`
	Count      int               `json:"count"`
	Dimensions map[string]string `json:"dimensions,omitempty"`
	FirstAt    string            `json:"first_at,omitempty"`
	LastAt     string            `json:"last_at,omitempty"`
}

type UsageSignalSummary added in v0.31.6

type UsageSignalSummary struct {
	Period     string           `json:"period"`
	TotalCount int              `json:"total_count"`
	Rows       []UsageSignalRow `json:"rows"`
}

type UsageSummary

type UsageSummary struct {
	Period          string            `json:"period"`
	GroupBy         string            `json:"group_by"`
	TotalCalls      int               `json:"total_calls"`
	TotalCostUSD    float64           `json:"total_cost_usd"`
	TotalInput      int               `json:"total_input_tokens"`
	TotalOutput     int               `json:"total_output_tokens"`
	TotalCached     int               `json:"total_cached_tokens"`
	TotalCacheRead  int               `json:"total_cache_read_tokens"`
	TotalCacheWrite int               `json:"total_cache_write_tokens"`
	Rows            []UsageSummaryRow `json:"rows"`
}

type UsageSummaryRow

type UsageSummaryRow struct {
	Key              string  `json:"key"`
	Calls            int     `json:"calls"`
	CostUSD          float64 `json:"cost_usd"`
	InputTokens      int     `json:"input_tokens"`
	OutputTokens     int     `json:"output_tokens"`
	CachedTokens     int     `json:"cached_tokens"`
	CacheReadTokens  int     `json:"cache_read_tokens"`
	CacheWriteTokens int     `json:"cache_write_tokens"`
}

type WhoamiInfo

type WhoamiInfo struct {
	Authenticated bool   `json:"authenticated"`
	AuthRole      string `json:"auth_role,omitempty"`
	IsAdmin       bool   `json:"is_admin,omitempty"`
	AuthMode      string `json:"auth_mode,omitempty"`
}

Jump to

Keyboard shortcuts

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