step 5 (partial): strip dropped packages from production code
Removed all references to dropped packages in non-test code.
Zero dropped imports, store refs, or model types remaining.
Major removals:
- scheduler/ package (entire dir) — tasks moved to extension track
- taskutil/ package (entire dir)
- health/ package (entire dir) — provider/tool health
- sandbox/provider_module.go — provider.complete module
- handlers: workflow_entry, workflow_instances, workflow_forms,
workflow_assignments, workflow_monitor, health_admin (6 files)
- auth/session.go, middleware/session_auth.go
- store/{postgres,sqlite}/sessions.go, tasks.go
Rewrites:
- store/{postgres,sqlite}/health.go — kernel-only Prune
(ws_tickets, rate_limit_counters, stale presence)
- handlers/admin.go: 847→467 lines (stripped provider CRUD)
- handlers/teams.go: 520→411 lines (stripped model listing)
- sandbox/runner.go: removed ProviderResolver
- sandbox/workflow_module.go: 216→83 lines (definition-only)
- main.go: 1579→1325 lines (stripped dropped package init)
- pages/pages.go: stripped channel/session lookups
- events/types.go: stripped chat/channel/workspace event routes
- models: stripped stale types, constants, notification types
Store interface cleanup:
- Removed SessionStore, TaskStore from Stores struct
- Stripped workflow assignment methods from WorkflowStore iface
- Stripped assignment methods from PG+SQLite workflow stores
- Updated testhelper.go table list to kernel-only
Migrations: removed 008_tasks.sql (both dialects)
-9665/+69 lines across 51 files.
This commit is contained in:
@@ -369,25 +369,9 @@ type ResourceGrant struct {
|
||||
// ProviderStatus represents the derived health state.
|
||||
|
||||
// AvgLatencyMs returns the average latency, or 0 if no requests.
|
||||
func (w *ProviderHealthWindow) AvgLatencyMs() int {
|
||||
if w.RequestCount == 0 {
|
||||
return 0
|
||||
}
|
||||
return int(w.TotalLatencyMs / int64(w.RequestCount))
|
||||
}
|
||||
|
||||
// ErrorRate returns the error fraction, or 0 if no requests.
|
||||
func (w *ProviderHealthWindow) ErrorRate() float64 {
|
||||
if w.RequestCount == 0 {
|
||||
return 0
|
||||
}
|
||||
return float64(w.ErrorCount) / float64(w.RequestCount)
|
||||
}
|
||||
|
||||
// ProviderHealthSummary is the API response for a provider's current health.
|
||||
// ToolHealthWindow tracks health of built-in tools (web_search, url_fetch, etc.)
|
||||
// in hourly buckets, analogous to ProviderHealthWindow.
|
||||
// ToolHealthSummary is the API response for a tool's health.
|
||||
// CAPABILITY OVERRIDES (v0.22.0)
|
||||
|
||||
// CapabilityOverride is an admin correction for a model's capabilities.
|
||||
|
||||
@@ -28,11 +28,9 @@ var ValidPackageStatuses = map[string]bool{
|
||||
const (
|
||||
ExtPermSecretsRead = "secrets.read"
|
||||
ExtPermNotificationsSend = "notifications.send"
|
||||
ExtPermFiltersPreCompletion = "filters.pre_completion"
|
||||
ExtPermDBRead = "db.read"
|
||||
ExtPermDBWrite = "db.write"
|
||||
ExtPermAPIHTTP = "api.http"
|
||||
ExtPermProviderComplete = "provider.complete" // v0.29.1: LLM completion calls
|
||||
ExtPermFormValidate = "forms.validate" // v0.29.3: form validation hooks
|
||||
ExtPermWorkflowAccess = "workflow.access" // v0.30.2: workflow definition + stage data access
|
||||
ExtPermConnectionsRead = "connections.read" // v0.38.1: extension connection resolution
|
||||
@@ -42,11 +40,9 @@ const (
|
||||
var ValidExtensionPermissions = map[string]bool{
|
||||
ExtPermSecretsRead: true,
|
||||
ExtPermNotificationsSend: true,
|
||||
ExtPermFiltersPreCompletion: true,
|
||||
ExtPermDBRead: true,
|
||||
ExtPermDBWrite: true,
|
||||
ExtPermAPIHTTP: true,
|
||||
ExtPermProviderComplete: true,
|
||||
ExtPermFormValidate: true,
|
||||
ExtPermWorkflowAccess: true,
|
||||
ExtPermConnectionsRead: true,
|
||||
|
||||
@@ -27,7 +27,6 @@ const (
|
||||
NotifTypeKBReady = "kb.ready"
|
||||
NotifTypeKBError = "kb.error"
|
||||
NotifTypeGrantChanged = "grant.changed"
|
||||
NotifTypeMemoryExtracted = "memory.extracted"
|
||||
NotifTypeUserMentioned = "user.mentioned"
|
||||
NotifTypeWorkflowAssign = "workflow.assigned"
|
||||
NotifTypeWorkflowClaimed = "workflow.claimed"
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Task is a scheduled, one-shot, or webhook-triggered job that creates a
|
||||
// service channel and runs a completion (prompt task), instantiates a
|
||||
// workflow, relays a payload without LLM involvement (action task), or
|
||||
// executes a built-in Go function (system task).
|
||||
type Task struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
OwnerID string `json:"owner_id" db:"owner_id"`
|
||||
TeamID *string `json:"team_id,omitempty" db:"team_id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Description string `json:"description" db:"description"`
|
||||
Scope string `json:"scope" db:"scope"` // personal | team | global
|
||||
|
||||
// What to run
|
||||
TaskType string `json:"task_type" db:"task_type"` // prompt | workflow | action | system
|
||||
SystemFunction string `json:"system_function,omitempty" db:"system_function"`
|
||||
PersonaID *string `json:"persona_id,omitempty" db:"persona_id"`
|
||||
ModelID string `json:"model_id" db:"model_id"`
|
||||
SystemPrompt string `json:"system_prompt" db:"system_prompt"`
|
||||
UserPrompt string `json:"user_prompt" db:"user_prompt"`
|
||||
WorkflowID *string `json:"workflow_id,omitempty" db:"workflow_id"`
|
||||
ToolGrants json.RawMessage `json:"tool_grants,omitempty" db:"tool_grants"`
|
||||
|
||||
// Schedule
|
||||
Schedule string `json:"schedule" db:"schedule"` // cron expression, "once", or "webhook"
|
||||
Timezone string `json:"timezone" db:"timezone"`
|
||||
IsActive bool `json:"is_active" db:"is_active"`
|
||||
|
||||
// Webhook trigger (inbound)
|
||||
TriggerToken string `json:"trigger_token,omitempty" db:"trigger_token"`
|
||||
|
||||
// Execution policy
|
||||
MaxTokens int `json:"max_tokens" db:"max_tokens"`
|
||||
MaxToolCalls int `json:"max_tool_calls" db:"max_tool_calls"`
|
||||
MaxWallClock int `json:"max_wall_clock" db:"max_wall_clock"` // seconds
|
||||
OutputMode string `json:"output_mode" db:"output_mode"` // channel | note | webhook
|
||||
OutputChannelID *string `json:"output_channel_id,omitempty" db:"output_channel_id"`
|
||||
WebhookURL string `json:"webhook_url" db:"webhook_url"`
|
||||
WebhookSecret string `json:"webhook_secret,omitempty" db:"webhook_secret"`
|
||||
|
||||
// Provider routing
|
||||
ProviderConfigID *string `json:"provider_config_id,omitempty" db:"provider_config_id"`
|
||||
|
||||
// Notifications
|
||||
NotifyOnComplete bool `json:"notify_on_complete" db:"notify_on_complete"`
|
||||
NotifyOnFailure bool `json:"notify_on_failure" db:"notify_on_failure"`
|
||||
|
||||
// Bookkeeping
|
||||
LastRunAt *time.Time `json:"last_run_at,omitempty" db:"last_run_at"`
|
||||
NextRunAt *time.Time `json:"next_run_at,omitempty" db:"next_run_at"`
|
||||
RunCount int `json:"run_count" db:"run_count"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
// TaskPatch contains optional fields for updating a task.
|
||||
type TaskPatch struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
PersonaID *string `json:"persona_id,omitempty"`
|
||||
ModelID *string `json:"model_id,omitempty"`
|
||||
SystemPrompt *string `json:"system_prompt,omitempty"`
|
||||
UserPrompt *string `json:"user_prompt,omitempty"`
|
||||
WorkflowID *string `json:"workflow_id,omitempty"`
|
||||
ToolGrants *json.RawMessage `json:"tool_grants,omitempty"`
|
||||
Schedule *string `json:"schedule,omitempty"`
|
||||
Timezone *string `json:"timezone,omitempty"`
|
||||
IsActive *bool `json:"is_active,omitempty"`
|
||||
MaxTokens *int `json:"max_tokens,omitempty"`
|
||||
MaxToolCalls *int `json:"max_tool_calls,omitempty"`
|
||||
MaxWallClock *int `json:"max_wall_clock,omitempty"`
|
||||
OutputMode *string `json:"output_mode,omitempty"`
|
||||
OutputChannelID *string `json:"output_channel_id,omitempty"`
|
||||
WebhookURL *string `json:"webhook_url,omitempty"`
|
||||
ProviderConfigID *string `json:"provider_config_id,omitempty"`
|
||||
NotifyOnComplete *bool `json:"notify_on_complete,omitempty"`
|
||||
NotifyOnFailure *bool `json:"notify_on_failure,omitempty"`
|
||||
}
|
||||
|
||||
// TaskRun records a single execution of a task.
|
||||
type TaskRun struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
TaskID string `json:"task_id" db:"task_id"`
|
||||
ChannelID *string `json:"channel_id,omitempty" db:"channel_id"`
|
||||
Status string `json:"status" db:"status"` // queued | running | completed | failed | budget_exceeded | cancelled
|
||||
TriggerPayload string `json:"trigger_payload,omitempty" db:"trigger_payload"`
|
||||
StartedAt time.Time `json:"started_at" db:"started_at"`
|
||||
CompletedAt *time.Time `json:"completed_at,omitempty" db:"completed_at"`
|
||||
TokensUsed int `json:"tokens_used" db:"tokens_used"`
|
||||
ToolCalls int `json:"tool_calls" db:"tool_calls"`
|
||||
WallClock int `json:"wall_clock" db:"wall_clock"` // seconds
|
||||
Error string `json:"error,omitempty" db:"error"`
|
||||
}
|
||||
@@ -57,7 +57,7 @@ type WorkflowStage struct {
|
||||
PersonaID *string `json:"persona_id,omitempty"`
|
||||
AssignmentTeamID *string `json:"assignment_team_id,omitempty"`
|
||||
FormTemplate json.RawMessage `json:"form_template"`
|
||||
StageMode string `json:"stage_mode"` // chat_only | form_only | form_chat | review
|
||||
StageMode string `json:"stage_mode"` // form_only | form_chat | review | custom
|
||||
HistoryMode string `json:"history_mode"` // full | summary | fresh
|
||||
AutoTransition bool `json:"auto_transition"`
|
||||
TransitionRules json.RawMessage `json:"transition_rules"`
|
||||
@@ -69,7 +69,7 @@ type WorkflowStage struct {
|
||||
// ── Stage Mode Constants ────────────────────
|
||||
|
||||
const (
|
||||
StageModeChatOnly = "chat_only"
|
||||
StageModeCustom = "custom"
|
||||
StageModeFormOnly = "form_only"
|
||||
StageModeFormChat = "form_chat"
|
||||
StageModeReview = "review"
|
||||
@@ -77,7 +77,7 @@ const (
|
||||
|
||||
// ValidStageModes is the set of valid stage_mode values.
|
||||
var ValidStageModes = map[string]bool{
|
||||
StageModeChatOnly: true,
|
||||
StageModeCustom: true,
|
||||
StageModeFormOnly: true,
|
||||
StageModeFormChat: true,
|
||||
StageModeReview: true,
|
||||
|
||||
Reference in New Issue
Block a user