Documentation
¶
Index ¶
- Variables
- func DefineComponent(ctx context.Context, srv *datly.Service) (*repository.Component, error)
- func DefineDeleteComponent(ctx context.Context, srv *datly.Service) (*repository.Component, error)
- type DeleteHandler
- type DeleteInput
- type DeleteOutput
- type Handler
- type Input
- type MutableRunView
- func (r *MutableRunView) SetAgentID(v string)
- func (r *MutableRunView) SetAttempt(v int)
- func (r *MutableRunView) SetCheckpointData(v string)
- func (r *MutableRunView) SetCheckpointMessageID(v string)
- func (r *MutableRunView) SetCheckpointResponseID(v string)
- func (r *MutableRunView) SetCompletedAt(v time.Time)
- func (r *MutableRunView) SetCondition(v RunPatchCondition)
- func (r *MutableRunView) SetConversationID(v string)
- func (r *MutableRunView) SetConversationKind(v string)
- func (r *MutableRunView) SetCreatedAt(v time.Time)
- func (r *MutableRunView) SetEffectiveUserID(v string)
- func (r *MutableRunView) SetErrorCode(v string)
- func (r *MutableRunView) SetErrorMessage(v string)
- func (r *MutableRunView) SetHeartbeatIntervalSec(v int)
- func (r *MutableRunView) SetId(v string)
- func (r *MutableRunView) SetIteration(v int)
- func (r *MutableRunView) SetLastHeartbeatAt(v time.Time)
- func (r *MutableRunView) SetLeaseOwner(v string)
- func (r *MutableRunView) SetLeaseUntil(v time.Time)
- func (r *MutableRunView) SetMaxIterations(v int)
- func (r *MutableRunView) SetModel(v string)
- func (r *MutableRunView) SetModelProvider(v string)
- func (r *MutableRunView) SetPreconditionPassed(v int)
- func (r *MutableRunView) SetPreconditionRanAt(v time.Time)
- func (r *MutableRunView) SetPreconditionResult(v string)
- func (r *MutableRunView) SetResumedFromRunID(v string)
- func (r *MutableRunView) SetScheduleID(v string)
- func (r *MutableRunView) SetScheduledFor(v time.Time)
- func (r *MutableRunView) SetSecurityContext(v string)
- func (r *MutableRunView) SetStartedAt(v time.Time)
- func (r *MutableRunView) SetStatus(v string)
- func (r *MutableRunView) SetTurnID(v string)
- func (r *MutableRunView) SetUpdatedAt(v time.Time)
- func (r *MutableRunView) SetUsageCompletionTokens(v int)
- func (r *MutableRunView) SetUsageCost(v float64)
- func (r *MutableRunView) SetUsagePromptTokens(v int)
- func (r *MutableRunView) SetUsageTotalTokens(v int)
- func (r *MutableRunView) SetUserCredURL(v string)
- func (r *MutableRunView) SetWorkerHost(v string)
- func (r *MutableRunView) SetWorkerID(v string)
- func (r *MutableRunView) SetWorkerPID(v int)
- type MutableRunViewOption
- type MutableRunViews
- type Output
- type RunHas
- type RunPatchCondition
Constants ¶
This section is empty.
Variables ¶
var FS embed.FS
var PathURI = "/v1/api/agently/run"
Functions ¶
func DefineComponent ¶
func DefineDeleteComponent ¶
Types ¶
type DeleteHandler ¶
type DeleteHandler struct{}
type DeleteInput ¶
type DeleteInput struct {
Rows []*MutableRunView `parameter:",kind=body,in=data"`
}
type DeleteOutput ¶
type Input ¶
type Input struct {
Runs []*MutableRunView `parameter:",kind=body,in=data"`
CurIDs *struct{ Values []string } `parameter:",kind=param,in=Runs,dataType=run/write.MutableRunViews" codec:"structql,uri=sql/cur_ids.sql"`
Cur []*MutableRunView `parameter:",kind=view,in=Cur" view:"Cur" sql:"uri=sql/cur_run.sql"`
CurByID map[string]*MutableRunView
}
type MutableRunView ¶
type MutableRunView struct {
Id string `sqlx:"id,primaryKey" validate:"required"`
TurnID *string `sqlx:"turn_id" json:",omitempty"`
ScheduleID *string `sqlx:"schedule_id" json:",omitempty"`
ConversationID *string `sqlx:"conversation_id" json:",omitempty"`
ConversationKind *string `sqlx:"conversation_kind" json:",omitempty"`
Attempt *int `sqlx:"attempt" json:",omitempty"`
ResumedFromRunID *string `sqlx:"resumed_from_run_id" json:",omitempty"`
Status string `sqlx:"status" validate:"required"`
ErrorCode *string `sqlx:"error_code" json:",omitempty"`
ErrorMessage *string `sqlx:"error_message" json:",omitempty"`
Iteration *int `sqlx:"iteration" json:",omitempty"`
MaxIterations *int `sqlx:"max_iterations" json:",omitempty"`
CheckpointResponseID *string `sqlx:"checkpoint_response_id" json:",omitempty"`
CheckpointMessageID *string `sqlx:"checkpoint_message_id" json:",omitempty"`
CheckpointData *string `sqlx:"checkpoint_data" json:",omitempty"`
AgentID *string `sqlx:"agent_id" json:",omitempty"`
ModelProvider *string `sqlx:"model_provider" json:",omitempty"`
Model *string `sqlx:"model" json:",omitempty"`
WorkerID *string `sqlx:"worker_id" json:",omitempty"`
WorkerPID *int `sqlx:"worker_pid" json:",omitempty"`
WorkerHost *string `sqlx:"worker_host" json:",omitempty"`
LeaseOwner *string `sqlx:"lease_owner" json:",omitempty"`
LeaseUntil *time.Time `sqlx:"lease_until" json:",omitempty"`
LastHeartbeatAt *time.Time `sqlx:"last_heartbeat_at" json:",omitempty"`
SecurityContext *string `sqlx:"security_context" json:",omitempty"`
UserCredURL *string `sqlx:"user_cred_url" json:",omitempty"`
EffectiveUserID *string `sqlx:"effective_user_id" json:",omitempty"`
AuthAuthority *string `sqlx:"auth_authority" json:",omitempty"`
AuthAudience *string `sqlx:"auth_audience" json:",omitempty"`
HeartbeatIntervalSec *int `sqlx:"heartbeat_interval_sec" json:",omitempty"`
ScheduledFor *time.Time `sqlx:"scheduled_for" json:",omitempty"`
PreconditionRanAt *time.Time `sqlx:"precondition_ran_at" json:",omitempty"`
PreconditionPassed *int `sqlx:"precondition_passed" json:",omitempty"`
PreconditionResult *string `sqlx:"precondition_result" json:",omitempty"`
UsagePromptTokens *int `sqlx:"usage_prompt_tokens" json:",omitempty"`
UsageCompletionTokens *int `sqlx:"usage_completion_tokens" json:",omitempty"`
UsageTotalTokens *int `sqlx:"usage_total_tokens" json:",omitempty"`
UsageCost *float64 `sqlx:"usage_cost" json:",omitempty"`
CreatedAt *time.Time `sqlx:"created_at" json:",omitempty"`
UpdatedAt *time.Time `sqlx:"updated_at" json:",omitempty"`
StartedAt *time.Time `sqlx:"started_at" json:",omitempty"`
CompletedAt *time.Time `sqlx:"completed_at" json:",omitempty"`
Has *RunHas `setMarker:"true" format:"-" sqlx:"-" diff:"-" json:"-"`
// Condition, when set, turns this sparse update into an atomic
// compare-and-set (see RunPatchCondition). It is not a column.
Condition *RunPatchCondition `sqlx:"-" diff:"-" json:",omitempty"`
}
func NewMutableRunView ¶
func NewMutableRunView(opts ...MutableRunViewOption) *MutableRunView
func (*MutableRunView) SetAgentID ¶
func (r *MutableRunView) SetAgentID(v string)
func (*MutableRunView) SetAttempt ¶
func (r *MutableRunView) SetAttempt(v int)
func (*MutableRunView) SetCheckpointData ¶
func (r *MutableRunView) SetCheckpointData(v string)
func (*MutableRunView) SetCheckpointMessageID ¶
func (r *MutableRunView) SetCheckpointMessageID(v string)
func (*MutableRunView) SetCheckpointResponseID ¶
func (r *MutableRunView) SetCheckpointResponseID(v string)
func (*MutableRunView) SetCompletedAt ¶
func (r *MutableRunView) SetCompletedAt(v time.Time)
func (*MutableRunView) SetCondition ¶ added in v0.1.50
func (r *MutableRunView) SetCondition(v RunPatchCondition)
SetCondition attaches expected-value criteria so the PATCH only applies when the stored run still matches them.
func (*MutableRunView) SetConversationID ¶
func (r *MutableRunView) SetConversationID(v string)
func (*MutableRunView) SetConversationKind ¶
func (r *MutableRunView) SetConversationKind(v string)
func (*MutableRunView) SetCreatedAt ¶
func (r *MutableRunView) SetCreatedAt(v time.Time)
func (*MutableRunView) SetEffectiveUserID ¶
func (r *MutableRunView) SetEffectiveUserID(v string)
func (*MutableRunView) SetErrorCode ¶
func (r *MutableRunView) SetErrorCode(v string)
func (*MutableRunView) SetErrorMessage ¶
func (r *MutableRunView) SetErrorMessage(v string)
func (*MutableRunView) SetHeartbeatIntervalSec ¶ added in v0.1.8
func (r *MutableRunView) SetHeartbeatIntervalSec(v int)
func (*MutableRunView) SetId ¶
func (r *MutableRunView) SetId(v string)
func (*MutableRunView) SetIteration ¶
func (r *MutableRunView) SetIteration(v int)
func (*MutableRunView) SetLastHeartbeatAt ¶
func (r *MutableRunView) SetLastHeartbeatAt(v time.Time)
func (*MutableRunView) SetLeaseOwner ¶
func (r *MutableRunView) SetLeaseOwner(v string)
func (*MutableRunView) SetLeaseUntil ¶
func (r *MutableRunView) SetLeaseUntil(v time.Time)
func (*MutableRunView) SetMaxIterations ¶
func (r *MutableRunView) SetMaxIterations(v int)
func (*MutableRunView) SetModel ¶
func (r *MutableRunView) SetModel(v string)
func (*MutableRunView) SetModelProvider ¶
func (r *MutableRunView) SetModelProvider(v string)
func (*MutableRunView) SetPreconditionPassed ¶
func (r *MutableRunView) SetPreconditionPassed(v int)
func (*MutableRunView) SetPreconditionRanAt ¶
func (r *MutableRunView) SetPreconditionRanAt(v time.Time)
func (*MutableRunView) SetPreconditionResult ¶
func (r *MutableRunView) SetPreconditionResult(v string)
func (*MutableRunView) SetResumedFromRunID ¶
func (r *MutableRunView) SetResumedFromRunID(v string)
func (*MutableRunView) SetScheduleID ¶
func (r *MutableRunView) SetScheduleID(v string)
func (*MutableRunView) SetScheduledFor ¶
func (r *MutableRunView) SetScheduledFor(v time.Time)
func (*MutableRunView) SetSecurityContext ¶
func (r *MutableRunView) SetSecurityContext(v string)
func (*MutableRunView) SetStartedAt ¶
func (r *MutableRunView) SetStartedAt(v time.Time)
func (*MutableRunView) SetStatus ¶
func (r *MutableRunView) SetStatus(v string)
func (*MutableRunView) SetTurnID ¶
func (r *MutableRunView) SetTurnID(v string)
func (*MutableRunView) SetUpdatedAt ¶
func (r *MutableRunView) SetUpdatedAt(v time.Time)
func (*MutableRunView) SetUsageCompletionTokens ¶
func (r *MutableRunView) SetUsageCompletionTokens(v int)
func (*MutableRunView) SetUsageCost ¶
func (r *MutableRunView) SetUsageCost(v float64)
func (*MutableRunView) SetUsagePromptTokens ¶
func (r *MutableRunView) SetUsagePromptTokens(v int)
func (*MutableRunView) SetUsageTotalTokens ¶
func (r *MutableRunView) SetUsageTotalTokens(v int)
func (*MutableRunView) SetUserCredURL ¶
func (r *MutableRunView) SetUserCredURL(v string)
func (*MutableRunView) SetWorkerHost ¶
func (r *MutableRunView) SetWorkerHost(v string)
func (*MutableRunView) SetWorkerID ¶
func (r *MutableRunView) SetWorkerID(v string)
func (*MutableRunView) SetWorkerPID ¶
func (r *MutableRunView) SetWorkerPID(v int)
type MutableRunViewOption ¶
type MutableRunViewOption func(*MutableRunView)
func WithRunConversationID ¶
func WithRunConversationID(v string) MutableRunViewOption
func WithRunID ¶
func WithRunID(v string) MutableRunViewOption
func WithRunIteration ¶
func WithRunIteration(v int) MutableRunViewOption
func WithRunStatus ¶
func WithRunStatus(v string) MutableRunViewOption
func WithRunTurnID ¶
func WithRunTurnID(v string) MutableRunViewOption
type MutableRunViews ¶
type MutableRunViews struct {
Runs []*MutableRunView
}
func NewMutableRunViews ¶
func NewMutableRunViews(rows ...*MutableRunView) *MutableRunViews
type Output ¶
type Output struct {
response.Status `parameter:",kind=output,in=status" anonymous:"true"`
Data []*MutableRunView `parameter:",kind=body"`
Violations []*validator.Violation `parameter:",kind=transient"`
}
type RunHas ¶
type RunHas struct {
Id bool
TurnID bool
ScheduleID bool
ConversationID bool
ConversationKind bool
Attempt bool
ResumedFromRunID bool
Status bool
ErrorCode bool
ErrorMessage bool
Iteration bool
MaxIterations bool
CheckpointResponseID bool
CheckpointMessageID bool
CheckpointData bool
AgentID bool
ModelProvider bool
Model bool
WorkerID bool
WorkerPID bool
WorkerHost bool
LeaseOwner bool
LeaseUntil bool
LastHeartbeatAt bool
HeartbeatIntervalSec bool
SecurityContext bool
UserCredURL bool
EffectiveUserID bool
ScheduledFor bool
PreconditionRanAt bool
PreconditionPassed bool
PreconditionResult bool
UsagePromptTokens bool
UsageCompletionTokens bool
UsageTotalTokens bool
UsageCost bool
CreatedAt bool
UpdatedAt bool
StartedAt bool
CompletedAt bool
}
type RunPatchCondition ¶ added in v0.1.50
type RunPatchCondition struct {
// Status is the expected current run status (required for claim shapes).
Status string `json:",omitempty"`
// LeaseOwner is the expected current lease owner. nil means "no owner
// criterion" (legacy rows with NULL lease_owner); it must be combined
// with Status and Attempt.
LeaseOwner *string `json:",omitempty"`
// Attempt is the expected current attempt.
Attempt *int `json:",omitempty"`
}
RunPatchCondition adds expected-value criteria to a sparse run PATCH row.
When a MutableRunView carries a condition, the handler issues one atomic UPDATE whose WHERE clause matches the run id plus every supplied expected value. Zero affected rows means another owner or state change won and no column is written. Rows without a condition behave exactly as before.
Criteria are equality-only because the sqlx update builder derives the WHERE clause from primary-key tagged columns. Heartbeats rotate lease_owner, so comparing the observed owner atomically defeats a concurrent renewal.