You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
5.1 KiB
140 lines
5.1 KiB
package server
|
|
|
|
import "time"
|
|
|
|
type envelope map[string]any
|
|
|
|
type user struct {
|
|
ID string `json:"id"`
|
|
Email string `json:"email"`
|
|
Name string `json:"name"`
|
|
Scopes []string `json:"scopes,omitempty"`
|
|
}
|
|
|
|
type session struct {
|
|
Token string
|
|
UserID string
|
|
UpstreamKey string
|
|
User user
|
|
CreatedAt time.Time
|
|
ExpiresAt time.Time
|
|
}
|
|
|
|
type authSessionView struct {
|
|
User user `json:"user"`
|
|
SessionKey string `json:"session_key,omitempty"`
|
|
UpstreamKeyMasked string `json:"upstream_key_masked,omitempty"`
|
|
}
|
|
|
|
type skill struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Tags []string `json:"tags"`
|
|
Version string `json:"version"`
|
|
InputSchema map[string]any `json:"input_schema,omitempty"`
|
|
OutputSchema map[string]any `json:"output_schema,omitempty"`
|
|
ModelType string `json:"model_type"`
|
|
RouteKey string `json:"route_key,omitempty"`
|
|
EstimatedDurationS int `json:"estimated_duration_s"`
|
|
}
|
|
|
|
type jobError struct {
|
|
Code string `json:"code,omitempty"`
|
|
Message string `json:"message,omitempty"`
|
|
Details map[string]any `json:"details,omitempty"`
|
|
}
|
|
|
|
type resultRef struct {
|
|
Kind string `json:"kind"`
|
|
URL string `json:"url,omitempty"`
|
|
DataURL string `json:"data_url,omitempty"`
|
|
LocalPath string `json:"local_path,omitempty"`
|
|
MediaID string `json:"media_id,omitempty"`
|
|
Filename string `json:"filename,omitempty"`
|
|
ContentType string `json:"content_type,omitempty"`
|
|
SizeBytes int64 `json:"size_bytes,omitempty"`
|
|
Visibility string `json:"visibility,omitempty"`
|
|
SHA256 string `json:"sha256,omitempty"`
|
|
StorageStatus string `json:"storage_status,omitempty"`
|
|
}
|
|
|
|
type job struct {
|
|
JobID string `json:"job_id"`
|
|
Status string `json:"status"`
|
|
SkillID string `json:"skill_id,omitempty"`
|
|
ModelID string `json:"model_id,omitempty"`
|
|
RouteKey string `json:"route_key,omitempty"`
|
|
Input map[string]any `json:"input,omitempty"`
|
|
ProjectID string `json:"project_id,omitempty"`
|
|
Priority string `json:"priority,omitempty"`
|
|
IdempotencyKey string `json:"idempotency_key,omitempty"`
|
|
CreatedAt string `json:"created_at,omitempty"`
|
|
StartedAt string `json:"started_at,omitempty"`
|
|
FinishedAt string `json:"finished_at,omitempty"`
|
|
ArtifactIDs []string `json:"artifact_ids,omitempty"`
|
|
Error *jobError `json:"error,omitempty"`
|
|
Usage map[string]any `json:"usage,omitempty"`
|
|
UserID string `json:"user_id,omitempty"`
|
|
ExecMode string `json:"exec_mode,omitempty"`
|
|
NewAPITaskID string `json:"newapi_task_id,omitempty"`
|
|
SessionID string `json:"-"`
|
|
ResultRefs []resultRef `json:"-"`
|
|
UpstreamKey string `json:"-"`
|
|
}
|
|
|
|
type logEntry struct {
|
|
TS string `json:"ts"`
|
|
Level string `json:"level"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
type artifact struct {
|
|
ID string `json:"id"`
|
|
JobID string `json:"job_id"`
|
|
ProjectID string `json:"project_id,omitempty"`
|
|
MediaID string `json:"media_id,omitempty"`
|
|
Filename string `json:"filename"`
|
|
ContentType string `json:"content_type"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
CreatedAt string `json:"created_at"`
|
|
ExpiresAt string `json:"expires_at"`
|
|
URL string `json:"url,omitempty"`
|
|
Visibility string `json:"visibility,omitempty"`
|
|
SHA256 string `json:"sha256,omitempty"`
|
|
StorageStatus string `json:"storage_status,omitempty"`
|
|
SourceSkillID string `json:"source_skill_id,omitempty"`
|
|
SourceModelID string `json:"source_model_id,omitempty"`
|
|
SourceRouteKey string `json:"source_route_key,omitempty"`
|
|
SourceInput map[string]any `json:"source_input,omitempty"`
|
|
PromptText string `json:"prompt_text,omitempty"`
|
|
Usage map[string]any `json:"usage,omitempty"`
|
|
Ref resultRef `json:"-"`
|
|
}
|
|
|
|
type media struct {
|
|
ID string `json:"id"`
|
|
ArtifactID string `json:"artifact_id,omitempty"`
|
|
ProjectID string `json:"project_id,omitempty"`
|
|
Filename string `json:"filename"`
|
|
ContentType string `json:"content_type"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
CreatedAt string `json:"created_at"`
|
|
URL string `json:"url"`
|
|
Visibility string `json:"visibility,omitempty"`
|
|
SHA256 string `json:"sha256,omitempty"`
|
|
}
|
|
|
|
type project struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type model struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Provider string `json:"provider"`
|
|
Capabilities []string `json:"capabilities"`
|
|
Pricing map[string]any `json:"pricing"`
|
|
}
|
|
|