109 lines
3.8 KiB
Go
109 lines
3.8 KiB
Go
package sourceagent
|
|
|
|
import "time"
|
|
|
|
const SchemaVersion = 1
|
|
|
|
type Agent struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Enabled bool `json:"enabled"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
LastSeen time.Time `json:"last_seen,omitempty"`
|
|
LastError string `json:"last_error,omitempty"`
|
|
Version string `json:"version,omitempty"`
|
|
TaskCount int `json:"task_count,omitempty"`
|
|
}
|
|
|
|
type Task struct {
|
|
ID string `json:"id"`
|
|
AgentID string `json:"agent_id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
URL string `json:"url"`
|
|
Enabled bool `json:"enabled"`
|
|
PollInterval string `json:"poll_interval"`
|
|
Categories []string `json:"categories,omitempty"`
|
|
MaxItems int `json:"max_items,omitempty"`
|
|
Config map[string]string `json:"config,omitempty"`
|
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
|
}
|
|
|
|
type RemoteConfig struct {
|
|
SchemaVersion int `json:"schema_version"`
|
|
Agent Agent `json:"agent"`
|
|
Tasks []Task `json:"tasks"`
|
|
IssuedAt time.Time `json:"issued_at"`
|
|
}
|
|
|
|
type Document struct {
|
|
ExternalID string `json:"external_id,omitempty"`
|
|
URL string `json:"url"`
|
|
CanonicalURL string `json:"canonical_url,omitempty"`
|
|
Title string `json:"title"`
|
|
PublishedAt time.Time `json:"published_at,omitempty"`
|
|
DiscoveredAt time.Time `json:"discovered_at,omitempty"`
|
|
Language string `json:"language,omitempty"`
|
|
ContentType string `json:"content_type,omitempty"`
|
|
Text string `json:"text"`
|
|
ContentSHA256 string `json:"content_sha256,omitempty"`
|
|
SourceName string `json:"source_name,omitempty"`
|
|
SourceBaseURL string `json:"source_base_url,omitempty"`
|
|
Categories []string `json:"categories,omitempty"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type IngestBatch struct {
|
|
SchemaVersion int `json:"schema_version"`
|
|
AgentID string `json:"agent_id,omitempty"`
|
|
TaskID string `json:"task_id"`
|
|
Documents []Document `json:"documents"`
|
|
}
|
|
|
|
type IngestResult struct {
|
|
Accepted int `json:"accepted"`
|
|
Duplicates int `json:"duplicates"`
|
|
Rejected int `json:"rejected"`
|
|
BatchID string `json:"batch_id"`
|
|
}
|
|
|
|
type Heartbeat struct {
|
|
AgentID string `json:"agent_id,omitempty"`
|
|
Version string `json:"version,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
LastRunAt time.Time `json:"last_run_at,omitempty"`
|
|
LastError string `json:"last_error,omitempty"`
|
|
TasksChecked int `json:"tasks_checked,omitempty"`
|
|
Documents int `json:"documents,omitempty"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type InboxDocument struct {
|
|
ID string `json:"id"`
|
|
AgentID string `json:"agent_id"`
|
|
TaskID string `json:"task_id"`
|
|
Document Document `json:"document"`
|
|
Status string `json:"status"`
|
|
Relevance float64 `json:"relevance,omitempty"`
|
|
MatchedNodeID string `json:"matched_node_id,omitempty"`
|
|
ReceivedAt time.Time `json:"received_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type InboxStats struct {
|
|
Total int `json:"total"`
|
|
Received int `json:"received"`
|
|
Processing int `json:"processing"`
|
|
Candidate int `json:"candidate"`
|
|
Archived int `json:"archived"`
|
|
Used int `json:"used"`
|
|
}
|
|
|
|
type ScoredDocument struct {
|
|
InboxDocument
|
|
QueryScore float64 `json:"query_score"`
|
|
}
|