askcontract

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProvider = "openai"
	DefaultModel    = "gpt-5.3-codex-spark"

	OpenAIBaseURL       = "https://api.openai.com/v1"
	OpenRouterBaseURL   = "https://openrouter.ai/api/v1"
	GeminiOpenAIBaseURL = "https://generativelanguage.googleapis.com/v1beta/openai/"
)

Variables

This section is empty.

Functions

func GenerationResponseSchema added in v0.2.1

func GenerationResponseSchema() json.RawMessage

func NormalizeProvider added in v0.2.2

func NormalizeProvider(provider string) string

func ProviderDefaultEndpoint added in v0.2.2

func ProviderDefaultEndpoint(provider string) string

func ProviderDefaultModel added in v0.2.2

func ProviderDefaultModel(provider string) string

func SelectionUsesBuilders added in v0.2.1

func SelectionUsesBuilders(selection DraftSelection) bool

Types

type ArtifactContract added in v0.2.0

type ArtifactContract struct {
	Kind         string `json:"kind,omitempty"`
	ProducerPath string `json:"producerPath,omitempty"`
	ConsumerPath string `json:"consumerPath,omitempty"`
	Description  string `json:"description,omitempty"`
}

type AuthoringBrief added in v0.2.0

type AuthoringBrief struct {
	RouteIntent              string   `json:"routeIntent,omitempty"`
	TargetScope              string   `json:"targetScope,omitempty"`
	TargetPaths              []string `json:"targetPaths,omitempty"`
	AnchorPaths              []string `json:"anchorPaths,omitempty"`
	AllowedCompanionPaths    []string `json:"allowedCompanionPaths,omitempty"`
	DisallowedExpansionPaths []string `json:"disallowedExpansionPaths,omitempty"`
	ModeIntent               string   `json:"modeIntent,omitempty"`
	Connectivity             string   `json:"connectivity,omitempty"`
	CompletenessTarget       string   `json:"completenessTarget,omitempty"`
	Topology                 string   `json:"topology,omitempty"`
	NodeCount                int      `json:"nodeCount,omitempty"`
	PlatformFamily           string   `json:"platformFamily,omitempty"`
	EscapeHatchMode          string   `json:"escapeHatchMode,omitempty"`
	RequiredCapabilities     []string `json:"requiredCapabilities,omitempty"`
}

type AuthoringProgram added in v0.2.1

type AuthoringProgram struct {
	Platform     ProgramPlatform     `json:"platform,omitempty"`
	Artifacts    ProgramArtifacts    `json:"artifacts,omitempty"`
	Cluster      ProgramCluster      `json:"cluster,omitempty"`
	Verification ProgramVerification `json:"verification,omitempty"`
}

func (AuthoringProgram) Value added in v0.2.1

func (p AuthoringProgram) Value(path string) (any, bool)

type ClassificationResponse

type ClassificationResponse struct {
	Route             string               `json:"route"`
	Confidence        float64              `json:"confidence"`
	Reason            string               `json:"reason"`
	Target            ClassificationTarget `json:"target"`
	GenerationAllowed *bool                `json:"generationAllowed,omitempty"`
	ReviewStyle       string               `json:"reviewStyle,omitempty"`
}

func ParseClassification

func ParseClassification(raw string) (ClassificationResponse, error)

type ClassificationTarget

type ClassificationTarget struct {
	Kind string `json:"kind,omitempty"`
	Path string `json:"path,omitempty"`
	Name string `json:"name,omitempty"`
}

type ComponentDocument added in v0.2.1

type ComponentDocument struct {
	Steps []WorkflowStep `json:"steps"`
}

type CriticResponse

type CriticResponse struct {
	Blocking       []string `json:"blocking"`
	Advisory       []string `json:"advisory"`
	MissingFiles   []string `json:"missingFiles"`
	InvalidImports []string `json:"invalidImports"`
	CoverageGaps   []string `json:"coverageGaps"`
	RequiredFixes  []string `json:"requiredFixes"`
}

type DraftBuilderSelection added in v0.2.1

type DraftBuilderSelection struct {
	ID        string         `json:"id"`
	Overrides map[string]any `json:"overrides,omitempty"`
}

type DraftPhaseSelection added in v0.2.1

type DraftPhaseSelection struct {
	Name    string         `json:"name"`
	Imports []PhaseImport  `json:"imports,omitempty"`
	Steps   []WorkflowStep `json:"steps,omitempty"`
}

type DraftSelection added in v0.2.1

type DraftSelection struct {
	Patterns []string               `json:"patterns,omitempty"`
	Targets  []DraftTargetSelection `json:"targets,omitempty"`
	Vars     map[string]any         `json:"vars,omitempty"`
}

type DraftTargetSelection added in v0.2.1

type DraftTargetSelection struct {
	Path     string                  `json:"path"`
	Kind     string                  `json:"kind,omitempty"`
	Builders []DraftBuilderSelection `json:"builders,omitempty"`
	Phases   []DraftPhaseSelection   `json:"phases,omitempty"`
	Steps    []WorkflowStep          `json:"steps,omitempty"`
	Vars     map[string]any          `json:"vars,omitempty"`
}

type EvidenceEntity added in v0.2.1

type EvidenceEntity struct {
	Name string `json:"name"`
	Kind string `json:"kind,omitempty"`
}

type EvidencePlan added in v0.2.1

type EvidencePlan struct {
	Decision                string           `json:"decision"`
	Reason                  string           `json:"reason,omitempty"`
	FreshnessSensitive      bool             `json:"freshnessSensitive,omitempty"`
	InstallEvidence         bool             `json:"installEvidence,omitempty"`
	CompatibilityEvidence   bool             `json:"compatibilityEvidence,omitempty"`
	TroubleshootingEvidence bool             `json:"troubleshootingEvidence,omitempty"`
	Entities                []EvidenceEntity `json:"entities,omitempty"`
}

func ParseEvidencePlan added in v0.2.1

func ParseEvidencePlan(raw string) (EvidencePlan, error)

type ExecutionModel added in v0.2.0

type ExecutionModel struct {
	ArtifactContracts    []ArtifactContract    `json:"artifactContracts,omitempty"`
	SharedStateContracts []SharedStateContract `json:"sharedStateContracts,omitempty"`
	RoleExecution        RoleExecutionModel    `json:"roleExecution,omitempty"`
	Verification         VerificationStrategy  `json:"verification,omitempty"`
	ApplyAssumptions     []string              `json:"applyAssumptions,omitempty"`
}

type GeneratedDocument added in v0.2.1

type GeneratedDocument struct {
	Path       string                  `json:"path"`
	Kind       string                  `json:"kind,omitempty"`
	Action     string                  `json:"action,omitempty"`
	Workflow   *WorkflowDocument       `json:"workflow,omitempty"`
	Component  *ComponentDocument      `json:"component,omitempty"`
	Vars       map[string]any          `json:"vars,omitempty"`
	Edits      []StructuredEditAction  `json:"edits,omitempty"`
	Transforms []RefineTransformAction `json:"transforms,omitempty"`
}

func CompileDraftSelection added in v0.2.1

func CompileDraftSelection(selection DraftSelection) []GeneratedDocument

type GeneratedFile

type GeneratedFile struct {
	Path    string `json:"path"`
	Content string `json:"content"`
	Delete  bool   `json:"delete,omitempty"`
}

type GenerationResponse

type GenerationResponse struct {
	Summary   string              `json:"summary"`
	Review    []string            `json:"review"`
	Files     []GeneratedFile     `json:"-"`
	Documents []GeneratedDocument `json:"documents,omitempty"`
	Selection *DraftSelection     `json:"selection,omitempty"`
	Program   *AuthoringProgram   `json:"-"`
}

func ParseGeneration

func ParseGeneration(raw string) (GenerationResponse, error)

type InfoResponse

type InfoResponse struct {
	Summary         string   `json:"summary"`
	Answer          string   `json:"answer"`
	Suggestions     []string `json:"suggestions"`
	Findings        []string `json:"findings"`
	SuggestedChange []string `json:"suggestedChanges"`
}

func ParseInfo

func ParseInfo(raw string) InfoResponse

type JudgeResponse added in v0.2.0

type JudgeResponse struct {
	Summary             string   `json:"summary"`
	Blocking            []string `json:"blocking"`
	Advisory            []string `json:"advisory"`
	MissingCapabilities []string `json:"missingCapabilities"`
	SuggestedFixes      []string `json:"suggestedFixes"`
}

func ParseJudge added in v0.2.0

func ParseJudge(raw string) (JudgeResponse, error)

type PhaseImport added in v0.2.1

type PhaseImport struct {
	Path string `json:"path"`
	When string `json:"when,omitempty"`
}

func (*PhaseImport) UnmarshalJSON added in v0.2.2

func (p *PhaseImport) UnmarshalJSON(data []byte) error

type PlanClarification added in v0.2.1

type PlanClarification struct {
	ID                 string   `json:"id"`
	Question           string   `json:"question"`
	Kind               string   `json:"kind,omitempty"`
	Reason             string   `json:"reason,omitempty"`
	Decision           string   `json:"decision,omitempty"`
	Options            []string `json:"options,omitempty"`
	RecommendedDefault string   `json:"recommendedDefault,omitempty"`
	Answer             string   `json:"answer,omitempty"`
	BlocksGeneration   bool     `json:"blocksGeneration,omitempty"`
	Affects            []string `json:"affects,omitempty"`
}

type PlanCriticFinding added in v0.2.0

type PlanCriticFinding struct {
	Code        workflowissues.Code     `json:"code"`
	Severity    workflowissues.Severity `json:"severity"`
	Message     string                  `json:"message"`
	Path        string                  `json:"path,omitempty"`
	Recoverable bool                    `json:"recoverable,omitempty"`
}

type PlanCriticResponse added in v0.2.0

type PlanCriticResponse struct {
	Summary          string              `json:"summary"`
	Blocking         []string            `json:"blocking"`
	Advisory         []string            `json:"advisory"`
	MissingContracts []string            `json:"missingContracts"`
	SuggestedFixes   []string            `json:"suggestedFixes"`
	Findings         []PlanCriticFinding `json:"findings,omitempty"`
}

func ParsePlanCritic added in v0.2.0

func ParsePlanCritic(raw string) (PlanCriticResponse, error)

type PlanFile

type PlanFile struct {
	Path    string `json:"path"`
	Kind    string `json:"kind"`
	Action  string `json:"action"`
	Purpose string `json:"purpose"`
}

type PlanResponse

type PlanResponse struct {
	Version                 int                 `json:"version"`
	Request                 string              `json:"request"`
	Intent                  string              `json:"intent"`
	Complexity              string              `json:"complexity"`
	AuthoringBrief          AuthoringBrief      `json:"authoringBrief,omitempty"`
	AuthoringProgram        AuthoringProgram    `json:"authoringProgram,omitempty"`
	ExecutionModel          ExecutionModel      `json:"executionModel,omitempty"`
	OfflineAssumption       string              `json:"offlineAssumption,omitempty"`
	NeedsPrepare            bool                `json:"needsPrepare,omitempty"`
	ArtifactKinds           []string            `json:"artifactKinds,omitempty"`
	VarsRecommendation      []string            `json:"varsRecommendation,omitempty"`
	ComponentRecommendation []string            `json:"componentRecommendation,omitempty"`
	Blockers                []string            `json:"blockers"`
	TargetOutcome           string              `json:"targetOutcome"`
	Assumptions             []string            `json:"assumptions"`
	OpenQuestions           []string            `json:"openQuestions"`
	Clarifications          []PlanClarification `json:"clarifications,omitempty"`
	EntryScenario           string              `json:"entryScenario"`
	Files                   []PlanFile          `json:"files"`
	ValidationChecklist     []string            `json:"validationChecklist"`
}

func ParsePlan

func ParsePlan(raw string) (PlanResponse, error)

func ParsePlanPartial added in v0.2.1

func ParsePlanPartial(raw string) (PlanResponse, error)

type PostProcessResponse added in v0.2.0

type PostProcessResponse struct {
	Summary                  string   `json:"summary"`
	Blocking                 []string `json:"blocking"`
	Advisory                 []string `json:"advisory"`
	UpgradeCandidates        []string `json:"upgradeCandidates"`
	ReviseFiles              []string `json:"reviseFiles"`
	PreserveFiles            []string `json:"preserveFiles"`
	RequiredEdits            []string `json:"requiredEdits"`
	VerificationExpectations []string `json:"verificationExpectations"`
	SuggestedFixes           []string `json:"suggestedFixes"`
}

func ParsePostProcess added in v0.2.0

func ParsePostProcess(raw string) (PostProcessResponse, error)

type ProgramArtifacts added in v0.2.1

type ProgramArtifacts struct {
	Packages         []string `json:"packages,omitempty"`
	Images           []string `json:"images,omitempty"`
	PackageOutputDir string   `json:"packageOutputDir,omitempty"`
	ImageOutputDir   string   `json:"imageOutputDir,omitempty"`
}

type ProgramCluster added in v0.2.1

type ProgramCluster struct {
	JoinFile          string `json:"joinFile,omitempty"`
	PodCIDR           string `json:"podCIDR,omitempty"`
	KubernetesVersion string `json:"kubernetesVersion,omitempty"`
	CriSocket         string `json:"criSocket,omitempty"`
	RoleSelector      string `json:"roleSelector,omitempty"`
	ControlPlaneCount int    `json:"controlPlaneCount,omitempty"`
	WorkerCount       int    `json:"workerCount,omitempty"`
}

type ProgramPlatform added in v0.2.1

type ProgramPlatform struct {
	Family       string `json:"family,omitempty"`
	Release      string `json:"release,omitempty"`
	RepoType     string `json:"repoType,omitempty"`
	BackendImage string `json:"backendImage,omitempty"`
}

type ProgramVerification added in v0.2.1

type ProgramVerification struct {
	ExpectedNodeCount         int    `json:"expectedNodeCount,omitempty"`
	ExpectedReadyCount        int    `json:"expectedReadyCount,omitempty"`
	ExpectedControlPlaneReady int    `json:"expectedControlPlaneReady,omitempty"`
	FinalVerificationRole     string `json:"finalVerificationRole,omitempty"`
	Interval                  string `json:"interval,omitempty"`
	Timeout                   string `json:"timeout,omitempty"`
}

type ProviderClient added in v0.2.2

type ProviderClient interface {
	Generate(ctx context.Context, req ProviderRequest) (ProviderResponse, error)
}

type ProviderRequest added in v0.2.2

type ProviderRequest struct {
	Kind                     string
	Provider                 string
	Model                    string
	APIKey                   string
	OAuthToken               string
	AccountID                string
	Endpoint                 string
	SystemPrompt             string
	Prompt                   string
	ResponseSchema           json.RawMessage
	ResponseSchemaName       string
	Tools                    []ProviderToolDefinition
	ToolChoiceRequired       bool
	DisableParallelToolCalls bool
	MaxRetries               int
	Timeout                  time.Duration
}

type ProviderResponse added in v0.2.2

type ProviderResponse struct {
	Content   string
	ToolCalls []ProviderToolCall
}

type ProviderToolCall added in v0.2.2

type ProviderToolCall struct {
	ID        string
	Name      string
	Arguments json.RawMessage
}

type ProviderToolDefinition added in v0.2.2

type ProviderToolDefinition struct {
	Name        string
	Description string
	Parameters  json.RawMessage
}

type RefineTransformAction added in v0.2.1

type RefineTransformAction struct {
	Type      string `json:"type"`
	Candidate string `json:"candidate,omitempty"`
	RawPath   string `json:"rawPath,omitempty"`
	VarName   string `json:"varName,omitempty"`
	VarsPath  string `json:"varsPath,omitempty"`
	Path      string `json:"path,omitempty"`
	Value     any    `json:"value,omitempty"`
}

type RoleExecutionModel added in v0.2.0

type RoleExecutionModel struct {
	RoleSelector      string `json:"roleSelector,omitempty"`
	ControlPlaneFlow  string `json:"controlPlaneFlow,omitempty"`
	WorkerFlow        string `json:"workerFlow,omitempty"`
	PerNodeInvocation bool   `json:"perNodeInvocation,omitempty"`
}

type SharedStateContract added in v0.2.0

type SharedStateContract struct {
	Name              string   `json:"name,omitempty"`
	ProducerPath      string   `json:"producerPath,omitempty"`
	ConsumerPaths     []string `json:"consumerPaths,omitempty"`
	AvailabilityModel string   `json:"availabilityModel,omitempty"`
	Description       string   `json:"description,omitempty"`
}

type StructuredEditAction added in v0.2.1

type StructuredEditAction struct {
	Op           string         `json:"op"`
	RawPath      string         `json:"rawPath"`
	Path         string         `json:"path,omitempty"`
	StepID       string         `json:"stepId,omitempty"`
	TargetStepID string         `json:"targetStepId,omitempty"`
	Target       map[string]any `json:"target,omitempty"`
	Value        any            `json:"value,omitempty"`
}

type VerificationStrategy added in v0.2.0

type VerificationStrategy struct {
	BootstrapPhase            string `json:"bootstrapPhase,omitempty"`
	FinalPhase                string `json:"finalPhase,omitempty"`
	FinalVerificationRole     string `json:"finalVerificationRole,omitempty"`
	ExpectedNodeCount         int    `json:"expectedNodeCount,omitempty"`
	ExpectedControlPlaneReady int    `json:"expectedControlPlaneReady,omitempty"`
}

type WorkflowDocument added in v0.2.1

type WorkflowDocument struct {
	Version string          `json:"version"`
	Vars    map[string]any  `json:"vars,omitempty"`
	Phases  []WorkflowPhase `json:"phases,omitempty"`
	Steps   []WorkflowStep  `json:"steps,omitempty"`
}

type WorkflowPhase added in v0.2.1

type WorkflowPhase struct {
	Name           string         `json:"name"`
	MaxParallelism int            `json:"maxParallelism,omitempty"`
	Imports        []PhaseImport  `json:"imports,omitempty"`
	Steps          []WorkflowStep `json:"steps,omitempty"`
}

type WorkflowStep added in v0.2.1

type WorkflowStep struct {
	ID            string            `json:"id"`
	APIVersion    string            `json:"apiVersion,omitempty"`
	Kind          string            `json:"kind"`
	Metadata      map[string]any    `json:"metadata,omitempty"`
	When          string            `json:"when,omitempty"`
	ParallelGroup string            `json:"parallelGroup,omitempty"`
	Register      map[string]string `json:"register,omitempty"`
	Retry         int               `json:"retry,omitempty"`
	Timeout       string            `json:"timeout,omitempty"`
	Spec          map[string]any    `json:"spec"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL