result

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package result defines the normalized output envelope for all Prism agents.

Index

Constants

View Source
const (
	StatusOK             = "ok"
	StatusError          = "error"
	StatusValidationFail = "validation_fail"
	StatusTimeout        = "timeout"
)

Status values for RunResult.

View Source
const (
	ConfidenceHigh   = "high"
	ConfidenceMedium = "medium"
	ConfidenceLow    = "low"
	ConfidenceNone   = ""
)

Confidence levels that local models may emit.

View Source
const DefaultCompactMaxChars = 400

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Type    string `json:"type,omitempty"` // snippet | url | file | command_output
	Label   string `json:"label,omitempty"`
	Content string `json:"content"`
}

Artifact is an inline data artifact returned by the model.

type DoctorCheck

type DoctorCheck struct {
	Name    string `json:"name"`
	Status  string `json:"status"` // ok | warn | fail
	Message string `json:"message,omitempty"`
}

DoctorCheck holds the result of a single connectivity or config check.

type DoctorResult

type DoctorResult struct {
	OllamaHost string        `json:"ollama_host"`
	AgentDir   string        `json:"agent_dir"`
	SkillsDir  string        `json:"skills_dir"`
	AgentCount int           `json:"agent_count"`
	SkillCount int           `json:"skill_count"`
	Checks     []DoctorCheck `json:"checks"`
	Status     string        `json:"status"` // ok | degraded
}

DoctorResult is the structured output of prism config doctor and the MCP doctor tool.

type Finding

type Finding struct {
	Severity string `json:"severity,omitempty"` // info | warning | error
	Text     string `json:"text"`
}

Finding is one discrete observation or diagnostic item.

type RunResult

type RunResult struct {
	AgentID    string     `json:"agent_id"`
	Model      string     `json:"model"`
	Status     string     `json:"status"`
	Summary    string     `json:"summary"`
	Findings   []Finding  `json:"findings"`
	Artifacts  []Artifact `json:"artifacts"`
	Confidence string     `json:"confidence,omitempty"`
	Usage      Usage      `json:"usage"`

	// SkillsUsed lists the skill names that were attached to this invocation.
	SkillsUsed []string `json:"skills_used,omitempty"`
	// ConstitutionSource identifies how the constitution was resolved:
	// "path" (constitution_path field), "body" (inline spec body), or
	// "legacy" (constitutions/<id>.md fallback).
	ConstitutionSource string `json:"constitution_source,omitempty"`
	// ContextBudget is the context_budget value from the agent spec.
	ContextBudget int `json:"context_budget,omitempty"`
	// PromptSizeEstimate is the estimated character count of the assembled
	// system prompt before it was sent to the model.
	PromptSizeEstimate int `json:"prompt_size_estimate,omitempty"`
	// ContextBudgetExceeded is true when the assembled prompt exceeded the
	// agent's declared context_budget (using ~4 chars/token heuristic).
	ContextBudgetExceeded bool   `json:"context_budget_exceeded,omitempty"`
	PolicyDecision        string `json:"policy_decision,omitempty"`
	PolicyReason          string `json:"policy_reason,omitempty"`
	BundleID              string `json:"bundle_id,omitempty"`
	BundleVersion         string `json:"bundle_version,omitempty"`

	// RawOutput stores the unmodified model response for debugging.
	RawOutput string `json:"raw_output,omitempty"`
	// ValidationError is set when the model output did not conform to the
	// expected schema; the raw output is still preserved.
	ValidationError string `json:"validation_error,omitempty"`
}

RunResult is the normalized envelope returned by every agent invocation. All fields are stable across CLI and MCP adapters so orchestrators can depend on the schema regardless of how they call Prism.

func Error

func Error(agentID, model, message string, dur time.Duration) RunResult

Error constructs an error RunResult.

func ParseAgentOutput

func ParseAgentOutput(raw string, compactMax int) RunResult

ParseAgentOutput extracts structured fields from a model response. Summary is always set to a compact orchestrator-facing string.

func (RunResult) ToJSON

func (r RunResult) ToJSON() ([]byte, error)

ToJSON serializes r to indented JSON.

func (RunResult) ToMarkdown

func (r RunResult) ToMarkdown() string

ToMarkdown renders r as a human-readable Markdown report.

type Usage

type Usage struct {
	PromptTokensEstimate     int   `json:"prompt_tokens_estimate"`
	CompletionTokensEstimate int   `json:"completion_tokens_estimate"`
	DurationMS               int64 `json:"duration_ms"`
}

Usage holds token-count and timing estimates from one agent invocation.

Jump to

Keyboard shortcuts

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