Documentation
¶
Index ¶
- Constants
- Variables
- func GetAutoFillOp() ops.RegisterableOp
- func GetOp() ops.RegisterableOp
- type APIFieldType
- type APIFormField
- type APIOption
- type Artifact
- type Config
- type FieldType
- type FieldValidation
- type FormContext
- type FormField
- type FormResponse
- type GlobPattern
- type Input
- type InputCancelSignal
- type InputForm
- type InputRequestSignal
- type InputResponseSignal
- type InputTimeoutSignal
- type InputWorkflowParams
- type InputWorkflowResult
- type LinearScale
- type Option
- type Output
- type PendingInput
- type Runtime
- func (r *Runtime) Cancel(ctx context.Context, projectID string, jobID string, reason string) error
- func (r *Runtime) GetDetails(ctx context.Context, projectID string, jobID string) (*UserInputDetails, error)
- func (r *Runtime) ListPendingInputs(ctx context.Context, projectID string) ([]PendingInput, error)
- func (r *Runtime) SSEManager() ops.SSEManager
- func (r *Runtime) SubmitResponse(ctx context.Context, projectID string, jobID string, output FormResponse) error
- type SSEEvent
- type SimpleSSEManager
- type UserInputDetails
- type UserResponseSignal
Constants ¶
const ( APIFieldTypeCheckboxes = openapi.FieldTypeCheckboxes APIFieldTypeLinearScale = openapi.FieldTypeLinearScale )
Variables ¶
var ErrInputNotPending = errors.New("input is not pending for job")
Functions ¶
func GetAutoFillOp ¶
func GetAutoFillOp() ops.RegisterableOp
GetAutoFillOp registers the op that echoes a pre-filled input response.
func GetOp ¶
func GetOp() ops.RegisterableOp
Types ¶
type APIFieldType ¶
APIFieldType is the generated transport enum for form fields.
type APIFormField ¶
APIFormField is the generated transport shape used by user-input clients.
type Artifact ¶
type Artifact struct {
Path string `json:"path" validate:"required" jsonschema:"required,description=Path to artifact file"`
}
Artifact represents a static artifact reference
type Config ¶
type Config struct {
// Single question format
Question string `json:"question,omitempty" validate:"required_without=Fields" jsonschema:"description=Question to ask the user"`
Type FieldType `` /* 269-byte string literal not displayed */
Options []Option `` /* 194-byte string literal not displayed */
Scale *LinearScale `` /* 126-byte string literal not displayed */
// Multi-field format
Title string `json:"title,omitempty" jsonschema:"description=Form title"`
Fields []FormField `json:"fields,omitempty" validate:"omitempty,min=1,dive" jsonschema:"description=Form fields"`
Context FormContext `json:"context,omitempty" jsonschema:"description=Form context and artifacts"`
// Optional auto-fill response
Output *Output `json:"autofill,omitempty" jsonschema:"description=Optional auto-fill output response"`
}
Config represents the configuration for the input activity
type FieldType ¶
type FieldType string
FieldType represents the type of form field
const ( FieldTypeShortAnswer FieldType = "short_answer" FieldTypeParagraphText FieldType = "paragraph_text" FieldTypeMultipleChoice FieldType = "multiple_choice" FieldTypeCheckboxes FieldType = "checkboxes" FieldTypeDropdown FieldType = "dropdown" FieldTypeLinearScale FieldType = "linear_scale" FieldTypeMultipleChoiceGrid FieldType = "multiple_choice_grid" FieldTypeCheckboxGrid FieldType = "checkbox_grid" FieldTypeDate FieldType = "date" FieldTypeTime FieldType = "time" FieldTypeFileUpload FieldType = "file_upload" )
type FieldValidation ¶
type FieldValidation struct {
MinLength int `json:"min_length,omitempty" jsonschema:"minimum=0,description=Minimum length for text fields"`
MaxLength int `json:"max_length,omitempty" jsonschema:"minimum=1,description=Maximum length for text fields"`
Pattern string `json:"pattern,omitempty" jsonschema:"description=Regex pattern for validation"`
Min int `json:"min,omitempty" jsonschema:"description=Minimum value for numeric fields"`
Max int `json:"max,omitempty" jsonschema:"description=Maximum value for numeric fields"`
}
FieldValidation represents validation rules for a form field
type FormContext ¶
type FormContext struct {
Artifacts []Artifact `json:"artifacts,omitempty" jsonschema:"description=Static artifact references"`
ArtifactsFromOutput string `json:"artifacts_from_output,omitempty" jsonschema:"description=Reference to artifacts from previous activity output"`
ArtifactsGlob []GlobPattern `json:"artifacts_glob,omitempty" jsonschema:"description=Glob patterns for artifact discovery"`
}
FormContext represents context information for the form
type FormField ¶
type FormField struct {
ID string `json:"id" validate:"required" jsonschema:"required,description=Unique field identifier"`
Type FieldType `` /* 355-byte string literal not displayed */
Question string `json:"question" validate:"required" jsonschema:"required,description=Field question or label"`
Required bool `json:"required,omitempty" jsonschema:"description=Whether field is required"`
Placeholder string `json:"placeholder,omitempty" jsonschema:"description=Placeholder text"`
Options []Option `` /* 194-byte string literal not displayed */
Scale *LinearScale `` /* 126-byte string literal not displayed */
Validation FieldValidation `json:"validation,omitempty" jsonschema:"description=Field validation rules"`
}
FormField represents a single field in a multi-field form
type FormResponse ¶
type FormResponse = openapi.FormResponse
FormResponse represents the user's response to a form (OpenAPI-generated type).
type GlobPattern ¶
type GlobPattern struct {
Pattern string `json:"pattern" validate:"required" jsonschema:"required,description=Glob pattern for matching files"`
}
GlobPattern represents a glob pattern for artifact discovery
type Input ¶
type Input struct {
Form Config `json:"form,omitempty" validate:"required" jsonschema:"description=Form formuration"`
}
Input represents the inputs passed to the input activity
type InputCancelSignal ¶
type InputCancelSignal struct {
ActivityID string `json:"activity_id"`
ResponseID string `json:"response_id"`
Reason string `json:"reason"`
}
InputCancelSignal represents a signal to cancel a pending input request
type InputForm ¶
type InputForm struct {
// Single question fields
Question string `json:"question,omitempty" jsonschema:"description=Single question text"`
Type FieldType `` /* 169-byte string literal not displayed */
Options []Option `json:"options,omitempty" jsonschema:"description=Options for single choice field"`
Scale *LinearScale `json:"scale,omitempty" jsonschema:"description=Configuration for linear scale fields"`
// Multi-field form
Title string `json:"title,omitempty" jsonschema:"description=Form title"`
Fields []FormField `json:"fields,omitempty" jsonschema:"description=Form fields for multi-field form"`
// Common fields
Context FormContext `json:"context,omitempty" jsonschema:"description=Form context and artifacts"`
Output *Output `json:"output,omitempty" jsonschema:"description=Optional auto-fill output response"`
Timeout time.Duration `json:"timeout,omitempty" jsonschema:"default=300,description=Timeout in seconds"`
}
InputForm represents the complete form structure
type InputRequestSignal ¶
type InputRequestSignal struct {
ActivityID string `json:"activity_id"`
WorkflowID string `json:"workflow_id"`
Form InputForm `json:"form"`
Timeout time.Duration `json:"timeout"`
}
InputRequestSignal represents a signal sent by the activity to request user input
type InputResponseSignal ¶
type InputResponseSignal struct {
ActivityID string `json:"activity_id"`
ResponseID string `json:"response_id"`
FormResponse FormResponse `json:"form_response"`
UserID string `json:"user_id"`
RespondedAt time.Time `json:"responded_at"`
}
InputResponseSignal represents a signal sent when user submits form
type InputTimeoutSignal ¶
type InputTimeoutSignal struct {
ActivityID string `json:"activity_id"`
ResponseID string `json:"response_id"`
TimedOutAt time.Time `json:"timed_out_at"`
}
InputTimeoutSignal represents a signal sent when input request times out
type InputWorkflowParams ¶
type InputWorkflowParams struct {
ID string `json:"id"`
Form InputForm `json:"form"`
Timeout time.Duration `json:"timeout"`
BoxID string `json:"box_id"`
ActivityID string `json:"activity_id"`
}
InputWorkflowParams represents parameters for the input collection workflow
type InputWorkflowResult ¶
type InputWorkflowResult struct {
FormResponse map[string]interface{} `json:"form_response"`
UserID string `json:"user_id"`
Metadata map[string]interface{} `json:"metadata"`
}
InputWorkflowResult represents the result of the input collection workflow
type LinearScale ¶
type LinearScale struct {
Min int `json:"min" validate:"required,gte=0,lte=10" jsonschema:"required,minimum=0,maximum=10,description=Minimum scale value"`
Max int `json:"max" validate:"required,gte=1,lte=10" jsonschema:"required,minimum=1,maximum=10,description=Maximum scale value"`
MinLabel string `json:"min_label,omitempty" jsonschema:"description=Label for minimum value"`
MaxLabel string `json:"max_label,omitempty" jsonschema:"description=Label for maximum value"`
}
LinearScale represents configuration for linear scale fields
type Option ¶
type Option struct {
Value string `json:"value" validate:"required" jsonschema:"required,description=Option value"`
Label string `json:"label,omitempty" jsonschema:"description=Optional display label"`
}
Option represents a choice option for fields like multiple choice, dropdown, etc.
type Output ¶
type Output struct {
Response interface{} `json:"response,omitempty" jsonschema:"description=User response for single question"`
Fields map[string]interface{} `json:"fields,omitempty" jsonschema:"description=User responses for multi-field form"`
UserID string `json:"user_id,omitempty" jsonschema:"description=ID of user who responded"`
Metadata map[string]interface{} `json:"metadata,omitempty" jsonschema:"description=Additional metadata"`
}
Output represents the output from the input activity
type PendingInput ¶
type PendingInput = openapi.PendingInput
PendingInput represents a pending input request (OpenAPI-generated type).
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(ctl workflowctl.WorkflowControl, sse ops.SSEManager) (*Runtime, error)
func NewRuntimeFromDeps ¶
func NewRuntimeFromDeps(deps ops.ServiceDependencies2) (*Runtime, error)
func (*Runtime) GetDetails ¶
func (*Runtime) ListPendingInputs ¶
func (*Runtime) SSEManager ¶
func (r *Runtime) SSEManager() ops.SSEManager
func (*Runtime) SubmitResponse ¶
type SimpleSSEManager ¶
type SimpleSSEManager struct {
// contains filtered or unexported fields
}
SimpleSSEManager is a basic implementation of SSEManager
func NewSimpleSSEManager ¶
func NewSimpleSSEManager() *SimpleSSEManager
NewSimpleSSEManager creates a new SSE manager
func (*SimpleSSEManager) Broadcast ¶
func (m *SimpleSSEManager) Broadcast(event ops.SSEEvent)
Broadcast sends an event to all connected clients
func (*SimpleSSEManager) ClearBuffer ¶
func (m *SimpleSSEManager) ClearBuffer()
ClearBuffer clears the event buffer
func (*SimpleSSEManager) GetClients ¶
func (m *SimpleSSEManager) GetClients() int
GetClients returns the number of connected clients
func (*SimpleSSEManager) Subscribe ¶
func (m *SimpleSSEManager) Subscribe(clientID string) <-chan ops.SSEEvent
Subscribe adds a client and returns their event channel
func (*SimpleSSEManager) Unsubscribe ¶
func (m *SimpleSSEManager) Unsubscribe(clientID string)
Unsubscribe removes a client
type UserInputDetails ¶
type UserInputDetails = openapi.UserInputDetails
UserInputDetails describes a pending input request in a transport-agnostic shape.