Documentation
¶
Overview ¶
Package backend exposes K-brain's canonical session and Agent runtime over HTTP.
Index ¶
- type BackendHook
- type BackendHookRunner
- type CronApplyInput
- type CronApplyResponse
- type CronHTTPRequest
- type CronModelRef
- type CronOperation
- type CronRunNowResponse
- type CronRunRecord
- type CronSnapshot
- type CronTask
- type Factory
- type HookOperation
- type HookRequest
- type HookStore
- type HookType
- type HooksApplyInput
- type HooksApplyResponse
- type HooksSnapshot
- type MemoryRuntimeFactory
- type Options
- type ProviderUsageResult
- type ProviderUsageService
- type Server
- type SettingsStore
- type UsageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendHook ¶
type BackendHook struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Event string `json:"event"`
Enabled bool `json:"enabled"`
Type HookType `json:"type"`
Script string `json:"script,omitempty"`
Requests []HookRequest `json:"requests,omitempty"`
TimeoutMS int `json:"timeoutMs,omitempty"`
}
type BackendHookRunner ¶
type BackendHookRunner struct {
// contains filtered or unexported fields
}
func NewBackendHookRunner ¶
func NewBackendHookRunner(store *HookStore) *BackendHookRunner
func (*BackendHookRunner) Scope ¶
func (r *BackendHookRunner) Scope(ctx context.Context, conversationID, runID, cwd string, warn func(BackendHook, string, error)) func(string)
Scope snapshots configuration once; event replay never invokes this callback.
type CronApplyInput ¶
type CronApplyInput struct {
BaseRevision uint64 `json:"baseRevision"`
Ops []CronOperation `json:"ops"`
}
type CronApplyResponse ¶
type CronApplyResponse struct {
Status string `json:"status"`
Cron CronSnapshot `json:"cron"`
}
type CronHTTPRequest ¶
type CronModelRef ¶
type CronOperation ¶
type CronRunNowResponse ¶
type CronRunRecord ¶
type CronRunRecord struct {
SessionID string `json:"sessionId,omitempty"`
RunID string `json:"runId,omitempty"`
Counted bool `json:"counted"`
ID string `json:"id"`
TaskID string `json:"taskId"`
State string `json:"state"`
Success bool `json:"success"`
StartedAt int64 `json:"startedAt"`
FinishedAt *int64 `json:"finishedAt,omitempty"`
DurationMs uint64 `json:"durationMs"`
ExitCode *int `json:"exitCode,omitempty"`
Output string `json:"output"`
TerminationReason string `json:"terminationReason,omitempty"`
}
type CronSnapshot ¶
type CronTask ¶
type CronTask struct {
ID string `json:"id"`
// SessionID binds prompt tasks to one durable canonical conversation.
SessionID string `json:"sessionId,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Cron string `json:"cron"`
Enabled bool `json:"enabled"`
RemainingExecutions *uint64 `json:"remainingExecutions,omitempty"`
TimeoutSeconds uint64 `json:"timeoutSeconds"`
Type string `json:"type"`
Script string `json:"script,omitempty"`
Requests []CronHTTPRequest `json:"requests,omitempty"`
Prompt string `json:"prompt,omitempty"`
SelectedModel *CronModelRef `json:"selectedModel,omitempty"`
Reasoning string `json:"reasoning,omitempty"`
Workdir string `json:"workdir,omitempty"`
LastError string `json:"lastError,omitempty"`
}
type HookOperation ¶
type HookRequest ¶
type HookStore ¶
type HookStore struct {
// contains filtered or unexported fields
}
func NewHookStore ¶
func (*HookStore) Apply ¶
func (s *HookStore) Apply(in HooksApplyInput) (HooksApplyResponse, error)
func (*HookStore) Snapshot ¶
func (s *HookStore) Snapshot() HooksSnapshot
type HooksApplyInput ¶
type HooksApplyInput struct {
BaseRevision uint64 `json:"baseRevision"`
Ops []HookOperation `json:"ops"`
}
type HooksApplyResponse ¶
type HooksApplyResponse struct {
Status string `json:"status"`
Hooks HooksSnapshot `json:"hooks"`
}
type HooksSnapshot ¶
type HooksSnapshot struct {
Revision uint64 `json:"revision"`
Hooks []BackendHook `json:"hooks"`
}
type MemoryRuntimeFactory ¶
type Options ¶
type Options struct {
Store *session.Store
Factory Factory
EventDir string
Token string
Models []protocol.ModelRef
DefaultCWD string
Settings *SettingsStore
Prompts *resources.PromptStore
MemoryRoot string
MemoryStore *memory.Store
MemoryRuntimeFactory MemoryRuntimeFactory
MemoryOrganizerInterval time.Duration
QuestionTimeout time.Duration
MCP *mcp.LiveManager
MCPCredentialBridge mcp.CredentialBridge
}
type ProviderUsageResult ¶
type ProviderUsageService ¶
type ProviderUsageService struct {
// contains filtered or unexported fields
}
func NewProviderUsageService ¶
func NewProviderUsageService(settings *SettingsStore) *ProviderUsageService
func (*ProviderUsageService) ProviderExists ¶
func (s *ProviderUsageService) ProviderExists(id string) bool
func (*ProviderUsageService) Query ¶
func (s *ProviderUsageService) Query(ctx context.Context, providerID string, refresh bool) ProviderUsageResult
func (*ProviderUsageService) Test ¶
func (s *ProviderUsageService) Test(ctx context.Context, providerID string, draft usageConfig) ProviderUsageResult
type SettingsStore ¶
type SettingsStore struct {
// contains filtered or unexported fields
}
SettingsStore publishes immutable snapshots only after persistence succeeds.
func NewSettingsStore ¶
func (*SettingsStore) Revision ¶
func (s *SettingsStore) Revision() uint64
func (*SettingsStore) Snapshot ¶
func (s *SettingsStore) Snapshot() *config.Config
type UsageData ¶
type UsageData struct {
PlanName string `json:"planName,omitempty"`
Extra string `json:"extra,omitempty"`
IsValid *bool `json:"isValid,omitempty"`
InvalidMessage string `json:"invalidMessage,omitempty"`
Total *float64 `json:"total,omitempty"`
Used *float64 `json:"used,omitempty"`
Remaining *float64 `json:"remaining,omitempty"`
Unit string `json:"unit,omitempty"`
}
Source Files
¶
- checkpoint.go
- checkpoint_import.go
- client_tools.go
- compact.go
- computer.go
- cron_canonical.go
- cron_handler.go
- cron_manager.go
- cron_store.go
- cron_tool.go
- cron_types.go
- cron_validate.go
- history.go
- history_import.go
- history_import_repair.go
- history_search.go
- hooks.go
- hooks_handler.go
- mcp.go
- memory.go
- memory_organizer.go
- planning.go
- planning_cron.go
- prompts.go
- provider_secrets.go
- provider_usage.go
- provider_usage_http.go
- questions.go
- run_lookup.go
- run_options.go
- run_start.go
- server.go
- settings.go
- settings_provider.go
- settings_public.go
- skills_http.go
- terminal_http.go
- text.go
- trajectory.go
- trajectory_details.go
- trajectory_history.go
- trajectory_recording.go
Click to show internal directories.
Click to hide internal directories.