jev

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 4 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 jev adapts one canonical Jev question model onto the tool surfaces of the known Jev MCP servers ("flavors"), which share no tool naming.

Jev is TypeSafe's small-judgment model: it answers typed questions rather than generating text. The canonical primitives follow TypeSafe's own vocabulary (docs.typesafe.ai): a noul is the probability that a statement is true (near 0.5 means uncertain; noul answers carry no confidence), a choice picks one option from a set, and a score is a position on ordered levels. The adapter layer exists because the three servers expose these (and more) under different names and shapes:

  • jkudish (github.com/jkudish/jev-mcp): twelve judgment tools — jev_noul, jev_verify, jev_screen, jev_decide, and nine more
  • jev-use (github.com/shitianfang/jev-use): jev_judge batches the three question types in one call; jev_gate is a PreToolUse permission gate
  • legostin (github.com/legostin/jev-mcp): browser automation driven by Jev — detectable, but its tools are not judgment primitives, so only jev_doctor is probed

The jev_gate name collides across flavors (jkudish: a PR/diff gate; jev-use: a PreToolUse permission gate), so ops map by semantics, never by name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

IsAuthError reports whether err looks like a Jev provider rejecting its API key — an unpaid bill, a rotated key, a 401/402/403 — as opposed to a tool bug or transport failure. It is deliberately a text heuristic (providers surface rejection through free-form tool error text): case-insensitive, numeric codes matched token-bounded (non-alphanumeric delimiters on both sides), phrases matched as substrings. Rate limits are NOT auth-class — a throttled key is still valid — and an empty error never matches.

Types

type Adapter

type Adapter interface {
	// Name is the flavor identifier used in output ("jkudish", "jev-use").
	Name() string

	// Detect reports whether the server's tool inventory matches this
	// flavor's signature.
	Detect(tools []*mcp.Tool) bool

	// Vocabulary lists the flavor's known tool names, so check can report
	// which of the server's jev_* tools the flavor recognizes.
	Vocabulary() []string

	// Supports describes how (or how not) one op maps onto this flavor.
	// When Supported is false, Note names the nearest alternative instead
	// of fabricating one.
	Supports(op OpKind) Support

	// Build produces the tool call for one op. An unsupported op is an
	// error carrying the Supports note.
	Build(op OpKind, q Question) (tool string, args map[string]any, err error)

	// Parse converts a successful (non-isError) tool result into verdicts,
	// enforcing the per-op answer typing: it is the single point where
	// untrusted result JSON becomes typed values, so a nil Answer or a
	// wrong-typed answer is an error here, never a downstream panic.
	Parse(op OpKind, res *mcp.CallToolResult) ([]Verdict, error)

	// Probes lists the flavor's self-test battery: one minimal read-only
	// call per supported tool (or a skip row for a tool that cannot be
	// exercised safely).
	Probes() []Probe
}

Adapter maps the canonical question model onto one flavor's tools. Adapters are stateless values registered in flavors; a new flavor is one file plus one slice entry.

func AdapterFor

func AdapterFor(tools []*mcp.Tool) (adapter Adapter, matched, unmatched []string)

AdapterFor picks the adapter for a server's tool inventory: the first flavor whose signature matches (also-matched flavors are detectable but unreachable by ordering). matched lists the server's jev_* tools the winner recognizes (its Vocabulary ∩ the inventory); unmatched lists every other jev_* tool, so check can suggest calling them directly via tools call. A nil adapter means no known flavor: unmatched then holds every jev_* tool.

type OpKind

type OpKind int

OpKind identifies one canonical operation. The zero value is not a valid op: parsing an unknown op is an error, never a silent default.

const (
	OpKindUnknown OpKind = iota
	OpKindNoul
	OpKindChoice
	OpKindScore
	OpKindVerify
	OpKindScreen
	OpKindGate
)

The canonical operations. Noul, Choice and Score exist on every judgment flavor (the TypeSafe primitives); Verify and Screen are jkudish-only; Gate is the jev-use PreToolUse check.

func (OpKind) MarshalJSON

func (o OpKind) MarshalJSON() ([]byte, error)

MarshalJSON renders the primitive name, mirroring String, so verdicts carry "noul"/"choice"/… instead of ints.

func (OpKind) String

func (o OpKind) String() string

String returns the canonical (TypeSafe) primitive name, used in errors, check output and the JSON document.

func (*OpKind) UnmarshalJSON

func (o *OpKind) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the primitive name back, so the canonical document round-trips; an unknown name is an error, never a silent zero value.

type Probe

type Probe struct {
	Tool       string
	Title      string
	Args       map[string]any
	SkipReason string
}

Probe is one battery entry: either a minimal tool call (Args set) or a reported skip (SkipReason set, Args nil).

type Question

type Question struct {
	Text         string   // the question, proposition, or text to judge
	Purpose      string   // screen: what the text will be used for
	Context      string   // optional shared context/state
	Claims       []string // verify: claim texts
	Evidence     []string // verify: evidence texts; choice: context evidence
	Options      []string // choice: ordered option labels (2–6 on jev_decide)
	Levels       []string // score: ordered level descriptions
	Priorities   string   // choice on jkudish: priorities for jev_decide
	Threshold    float64  // confidence/auto-accept threshold when HasThreshold
	HasThreshold bool

	// Gate (jev-use PreToolUse): the action being gated, verbatim.
	Tool  string
	Input map[string]any
	State string
}

Question is one canonical ask. Build maps it onto a flavor's tool call; fields the target op or flavor does not carry are the caller's business (the CLI warns before dropping them).

type Support

type Support struct {
	Supported bool
	Via       string // the tool the op maps onto, when supported
	Note      string // when unsupported: the nearest alternative, honestly named
}

Support is one op's availability on a flavor.

type Verdict

type Verdict struct {
	Type          OpKind             `json:"type"`
	Answer        any                `json:"answer"` // per Type: float64 (noul, score), string (choice, gate decision, verify verdict, screen action)
	Confidence    *float64           `json:"confidence,omitempty"`
	Probabilities map[string]float64 `json:"probabilities,omitempty"`
	Legend        map[string]string  `json:"legend,omitempty"`
	Label         string             `json:"label,omitempty"`        // jkudish noul classification: likely/unlikely/uncertain
	Reason        string             `json:"reason,omitempty"`       // jev-use escalate reason
	Hint          string             `json:"hint,omitempty"`         // escalate guidance, or a screen recommendation reason
	ReasonCodes   []string           `json:"reason_codes,omitempty"` // jkudish gate/review codes
	SafeToApply   *float64           `json:"safe_to_apply,omitempty"`
	Escalate      bool               `json:"escalate,omitempty"`
}

Verdict is one typed answer. TypeSafe's fields (Answer, Confidence, Probabilities, Legend) are the base; flavor extensions (Label, Reason, Hint, ReasonCodes, SafeToApply) appear only when the server supplied them. A noul verdict has no Confidence (TypeSafe canon: the probability itself carries the uncertainty); Parse never returns a nil Answer.

Jump to

Keyboard shortcuts

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