core

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 43 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

prism_drift — the delivery half of the stale-context loop.

Fuse records what each merge changed (.git/fuse/drift.json, evidence half); Prism's session tracker knows what this agent has actually been shown. prism_drift intersects the two worlds: it re-checks every tracked file against the working tree and reports, symbol by symbol, where the ground shifted under the agent — with merge provenance when a Fuse merge caused it. Context-delivering tools also append a one-line warning as soon as any tracked file goes stale, so the agent learns mid-task, not at merge time.

Package core is Prism's engine: the prism_* tools, the compact gateway's argument decoding, and the text renderers every surface shares. The transports call Handler: internal/mcp (JSON-RPC over stdio, through Handler.CallTool), internal/cli and internal/httpapi.

Index

Constants

View Source
const (
	// ImpactRequiredFor lists the changes whose correctness depends on every
	// declaration and caller, so they start with an impact check.
	ImpactRequiredFor = "a rename, a signature change, or a change to an override or public contract"

	// ImpactOptionalFor names the edits that stay inside one body and can
	// proceed from the source already read.
	ImpactOptionalFor = "a local body-only edit"
)

The one statement of when change_impact is required. The installed steering block (internal/cli) and both MCP instruction strings are built from these constants, so no surface can demand more or less than another.

Found 2026-10-17 (Codex review of 86 paired runs): the steering block told agents to run change_impact before editing "any other symbol whose callers you have not enumerated", while the MCP instructions called it optional for a local body-only edit. Codex followed the blanket rule (eight impact calls on seven bug tasks) and Claude, reading the MCP text, made none on 41. The early trigger for contract changes is the part that was measured to work (impact before the first edit 0/4 -> 4/4 on rename tasks, cost flat on 2026-10-12) and is kept; the blanket obligation is what goes.

View Source
const CLISteeringMarker = "no MCP server is registered"

CLISteeringMarker is the phrase every CLI-interface steering block carries (internal/cli builds its block from it). A current CLI block names no MCP tool, so without it a repository set up for the CLI read as legacy and the migration warning could never be cleared by `prism init`.

View Source
const CompactReadLimit = compactReadLimit

CompactReadLimit is the most lines one compact read range returns.

View Source
const SourceLineSep = "→"

SourceLineSep separates a delivered line's number from its source text. It was a tab, Read-style. On a tab-indented file the delimiter tab reads as indentation, and agents put the wrong number of tabs into an Edit old_string: ~20 turns of od -c archaeology in ddtb4dv8 (2026-09-03), and 5 failed edits on chi tree.go in both arms 2026-10-02..09 even with a note explaining the delimiter. A visible separator leaves every whitespace character after it as source, so no note is needed.

Variables

This section is empty.

Functions

func APIDiffText

func APIDiffText(r *APIDiffResult) string

APIDiffText renders the result for a terminal or an agent.

func CompactImpactTextTo

func CompactImpactTextTo(text string, budget int) string

CompactImpactTextTo applies the same site-preserving steps against a caller's budget: the CLI uses a smaller one under hosts that cut shell output sooner.

func CompactToolSchemas

func CompactToolSchemas() []map[string]any

CompactToolSchemas exposes the six primary operations through one MCP tool. It avoids top-level composition keywords because older MCP hosts have dropped tools carrying oneOf even when the JSON Schema is valid. The selected legacy handler remains the operation-specific authority.

func DispatchableTools

func DispatchableTools() []string

DispatchableTools returns every tool name Invoke can route — the single source of truth for surfaces that expose tools by name (the HTTP server). The httpapi route list was maintained by hand and drifted so far that six tools 404'd for months; anything that needs "all tools" derives from this.

func FeedbackPath

func FeedbackPath(root string) string

FeedbackPath is where feedback records are appended, one JSON per line.

func FormatImpactExtrasText

func FormatImpactExtrasText(out map[string]any) string

FormatImpactExtrasText renders the change_impact additions shared by the MCP text form and the CLI: the test-only signal, re-export sites, and the related-but-not-affected group.

func FormatImpactHeaderNotesText

func FormatImpactHeaderNotesText(out map[string]any) string

FormatImpactHeaderNotesText renders the notes that change how the whole result must be read (an inherited anchor, a signature-selected overload); they go directly under the header line.

func FormatImpactRelaySitesText

func FormatImpactRelaySitesText(out map[string]any) string

FormatImpactRelaySitesText renders the canonical bounded site inventory for both MCP and CLI text delivery. Keeping this in one place prevents either surface from silently losing the copy instruction or changing its shape.

func FormatMemberImpactText

func FormatMemberImpactText(out map[string]any) (string, bool)

func FormatWorkspaceConsumersText

func FormatWorkspaceConsumersText(out map[string]any) string

FormatWorkspaceConsumersText renders the linked-repository section of a change-impact answer: the call sites found there, then what was searched.

func GenericText

func GenericText(v any) string

GenericText renders v as indented "key: value" lines.

func LegacyProjectWarning

func LegacyProjectWarning(root string) string

LegacyProjectWarning performs a small, read-only scan of project metadata so a harness that reopens an old repository learns how to migrate before its first tool call. Explicit prism init remains the only migration writer.

func NoGraphLanguage

func NoGraphLanguage(ext string) string

NoGraphLanguage names the language of a code file extension Grove has no graph for, or "".

func PrismInstallationWarning

func PrismInstallationWarning(runningPath, runningVersion string) string

PrismInstallationWarning returns a user-facing diagnostic when distinct Prism executables on this machine report different release versions. Init uses it before writing MCP registrations; the server uses it after startup to catch configurations that still pin an older executable.

func RenderAnswerText

func RenderAnswerText(m map[string]any) string

RenderAnswerText renders any answer as text: the shape-specific forms below, else indented key/value lines. Never JSON (CON-02).

func RenderFallbackText

func RenderFallbackText(tool string, m map[string]any) string

RenderFallbackText is the CLI's text for an answer RenderToolText declined. A tool with its own renderer gets that renderer over the fields it knows, then every other field as key/value lines, so the text form and the MCP form come from one renderer and nothing is dropped. Without one, or when even the known fields do not render, the answer is printed as key/value lines (the task ops keep their shape-specific forms). Never JSON.

func RenderLookupText

func RenderLookupText(out any) (string, bool)

RenderLookupText shares MCP's lookup rendering, including batches, with the CLI. Unknown shapes return false so callers can retain the complete JSON.

func RenderSearchText

func RenderSearchText(out any) (string, bool)

RenderSearchText shares MCP's lossless, merged search rendering with the CLI. Unknown shapes return false so callers can retain the complete JSON result.

func TestPlanTargets

func TestPlanTargets(out any) []string

TestPlanTargets turns a test-plan answer into one target per line in each runner's own addressing (GAP-06): the focused and transitive tiers, not the run-for-safety set. Targets, never command lines: Prism does not hand agents ready-to-run commands.

go:     ./internal/session -run '^(TestTracker|TestDrift)$'
python: tests/test_shapes.py::TestShape::test_area
java:   ShapeTest#testArea
rust:   shapes::tests::area
other:  the test file

func ToolSchemas

func ToolSchemas() []map[string]any

ToolSchemas returns the schema list for tools/list.

Types

type APIChange

type APIChange struct {
	Kind      string   `json:"kind"` // removed, signature, unexported, renamed, interface-member, identity, added
	Symbol    string   `json:"symbol"`
	File      string   `json:"file"`
	Line      int      `json:"line,omitempty"`
	Before    string   `json:"before,omitempty"`
	After     string   `json:"after,omitempty"`
	Consumers []string `json:"consumers,omitempty"` // in-repo callers, capped
	More      int      `json:"moreConsumers,omitempty"`
}

APIChange is one exported symbol that changed.

type APIDiffOptions added in v2.0.1

type APIDiffOptions struct {
	// IncludeUntracked compares files git does not track. Off by default:
	// scratch scripts and local notes in the working tree are not the API a
	// release publishes.
	IncludeUntracked bool
}

APIDiffOptions adjusts what APIDiff compares.

type APIDiffResult

type APIDiffResult struct {
	Base       string      `json:"base"`
	Verdict    string      `json:"verdict"` // breaking, additions-only, compatible
	Semver     string      `json:"semver"`  // advice only
	Breaking   []APIChange `json:"breaking,omitempty"`
	Added      []APIChange `json:"added,omitempty"`
	Unverified []string    `json:"unverified,omitempty"`
	// SkippedUntracked counts files git does not track that were left out
	// (APIDiffOptions.IncludeUntracked brings them in).
	SkippedUntracked int `json:"skippedUntracked,omitempty"`
}

APIDiffResult is the verdict and the changes behind it.

type ArchCheckRequest

type ArchCheckRequest struct {
	Depth        int
	IncludeTests bool
	Strict       bool
	Deny         []string
}

ArchCheckRequest validates architecture rules.

func (ArchCheckRequest) Args

func (r ArchCheckRequest) Args() map[string]any

func (ArchCheckRequest) Tool

func (ArchCheckRequest) Tool() string

type CallPathRequest

type CallPathRequest struct{ From, To string }

CallPathRequest finds a call path between two symbols.

func (CallPathRequest) Args

func (r CallPathRequest) Args() map[string]any

func (CallPathRequest) Tool

func (CallPathRequest) Tool() string

type CallersRequest

type CallersRequest struct {
	Name  string
	Depth int
	File  string
}

CallersRequest lists transitive callers.

func (CallersRequest) Args

func (r CallersRequest) Args() map[string]any

func (CallersRequest) Tool

func (CallersRequest) Tool() string

type ChangeImpactDiffRequest

type ChangeImpactDiffRequest struct{ Base string }

ChangeImpactDiffRequest is change-impact over a diff.

func (ChangeImpactDiffRequest) Args

func (r ChangeImpactDiffRequest) Args() map[string]any

func (ChangeImpactDiffRequest) Tool

type ChangeImpactRequest

type ChangeImpactRequest struct {
	Query string
	File  string
}

ChangeImpactRequest lists every site a change to a symbol touches.

func (ChangeImpactRequest) Args

func (r ChangeImpactRequest) Args() map[string]any

func (ChangeImpactRequest) Tool

func (ChangeImpactRequest) Tool() string

type CompactReadFilesRequest

type CompactReadFilesRequest struct {
	Files    []string
	From, To []int
}

CompactReadFilesRequest reads several files from their first line, one compact window each (the gateway's ranges form). From and To, when set, are each file's inclusive line range (0 = from its first line / up to the read window): `prism read a.go:10-40 b.go:5`.

func (CompactReadFilesRequest) Args

func (r CompactReadFilesRequest) Args() map[string]any

func (CompactReadFilesRequest) Tool

type CompactReadRequest

type CompactReadRequest struct {
	File             string
	From, To         int // 0 = unset
	IncludeSensitive bool
}

CompactReadRequest is a read through the compact gateway's window rules (at most CompactReadLimit lines).

func (CompactReadRequest) Args

func (r CompactReadRequest) Args() map[string]any

func (CompactReadRequest) Tool

func (CompactReadRequest) Tool() string

type CompactRequest

type CompactRequest struct{ Turns []map[string]any }

CompactRequest compacts a conversation's turns.

func (CompactRequest) Args

func (r CompactRequest) Args() map[string]any

func (CompactRequest) Tool

func (CompactRequest) Tool() string

type CrossEdge

type CrossEdge struct {
	From      CrossEnd    `json:"from"`
	To        CrossEnd    `json:"to"`
	Direction string      `json:"direction"`
	Weight    int         `json:"weight"`
	Evidence  string      `json:"evidence"` // resolved | import-scoped
	Sites     []CrossSite `json:"sites,omitempty"`
}

CrossEdge is the references from one component to another across the boundary. Direction: "uses" (this repository uses the other) or "used by".

type CrossEnd

type CrossEnd struct {
	Repo      string `json:"repo,omitempty"`
	Component string `json:"component"`
}

CrossEnd is one end of a cross edge: a component of a repository ("" is this one).

func (CrossEnd) Label

func (e CrossEnd) Label() string

Label is how the map prints an end: "grove:pkg/grove", or the bare component for this repository.

type CrossRepo

type CrossRepo struct {
	Repos    []CrossRepoInfo `json:"repos"`
	Edges    []CrossEdge     `json:"edges"`
	Coverage string          `json:"coverage"`
	// Unlinked counts this repository's references into packages no linked
	// or uploaded repository declares: not drawn.
	UnlinkedRefs     int `json:"unlinkedRefs"`
	UnlinkedPackages int `json:"unlinkedPackages"`
}

CrossRepo is the part of a component map that crosses the repository boundary: edges between this repository's components and those of its linked repositories and of repositories uploaded to the link server. docs/design/cross-repo-map.md.

type CrossRepoInfo

type CrossRepoInfo struct {
	ID     string `json:"id"`
	Source string `json:"source"` // checkout | clone | server
	Commit string `json:"commit,omitempty"`
	Ref    string `json:"ref,omitempty"`
	State  string `json:"state"` // read | stale | unread
	Note   string `json:"note,omitempty"`
}

CrossRepoInfo is one other repository the map read (or could not).

type CrossSite

type CrossSite struct {
	File   string `json:"file"`
	Line   int    `json:"line"`
	Text   string `json:"text,omitempty"`
	Symbol string `json:"symbol"` // the referenced symbol's name
}

CrossSite is one reference behind a cross edge.

type CyclesRequest

type CyclesRequest struct {
	Depth        int
	IncludeTests bool
}

CyclesRequest lists dependency cycles.

func (CyclesRequest) Args

func (r CyclesRequest) Args() map[string]any

func (CyclesRequest) Tool

func (CyclesRequest) Tool() string

type DeadCodeRequest

type DeadCodeRequest struct{ Roots []string }

DeadCodeRequest lists unreachable symbols.

func (DeadCodeRequest) Args

func (r DeadCodeRequest) Args() map[string]any

func (DeadCodeRequest) Tool

func (DeadCodeRequest) Tool() string

type DriftReport

type DriftReport struct {
	CheckedFiles int         `json:"checkedFiles"`
	ChangedFiles int         `json:"changedFiles"`
	Warning      string      `json:"warning,omitempty"`
	Files        []FileDrift `json:"files,omitempty"`
}

DriftReport is the prism_drift response.

type DriftSymbol

type DriftSymbol struct {
	Name         string `json:"name"`
	Change       string `json:"change"` // added | removed | changed | renamed
	NewSignature string `json:"newSignature,omitempty"`
	// RenamedTo carries the new name when Change is "renamed" (Grove pairs a
	// removed symbol with an added one whose body matches modulo its name).
	RenamedTo string `json:"renamedTo,omitempty"`
	// Breaking marks exported symbols that were removed, renamed, or
	// re-signatured — the changes that break callers of the old contract.
	Breaking bool `json:"breaking,omitempty"`
}

DriftSymbol is one symbol-level change under the agent's feet.

type EdgesRequest

type EdgesRequest struct {
	Name, Direction string
	Kinds           []string
}

EdgesRequest lists a symbol's graph edges.

func (EdgesRequest) Args

func (r EdgesRequest) Args() map[string]any

func (EdgesRequest) Tool

func (EdgesRequest) Tool() string

type FeedbackEntry

type FeedbackEntry struct {
	Tool      string `json:"tool"`
	QueryID   string `json:"queryId,omitempty"`
	Rating    int    `json:"rating"`
	Notes     string `json:"notes,omitempty"`
	Timestamp string `json:"timestamp"`
}

FeedbackEntry is one user rating of a tool response.

type FeedbackRequest

type FeedbackRequest struct {
	ToolName, QueryID, Notes string
	Rating                   int
}

FeedbackRequest records a rating of a tool answer.

func (FeedbackRequest) Args

func (r FeedbackRequest) Args() map[string]any

func (FeedbackRequest) Tool

func (FeedbackRequest) Tool() string

type FileDrift

type FileDrift struct {
	File   string `json:"file"`
	Status string `json:"status"` // changed | deleted
	// Origin is "merge" when a recorded Fuse merge touched this file,
	// otherwise "edit" (any other writer: another agent, the user, a tool).
	Origin  string        `json:"origin"`
	Symbols []DriftSymbol `json:"symbols,omitempty"`
	// MergeDetails carries Fuse's symbol-precise drift record entries for
	// this file (old → new signatures, renames), when available.
	MergeDetails []FuseDriftSymbol `json:"mergeDetails,omitempty"`
}

FileDrift reports one tracked file that no longer matches what was delivered.

type FuseDriftSymbol

type FuseDriftSymbol struct {
	QualifiedName string `json:"qualifiedName"`
	Change        string `json:"change"`
	OldSignature  string `json:"oldSignature,omitempty"`
	NewSignature  string `json:"newSignature,omitempty"`
	RenamedFrom   string `json:"renamedFrom,omitempty"`
}

FuseDriftSymbol mirrors fuse's drift record symbol entries (subset).

type Handler

type Handler struct {
	Cfg     *config.Config
	Root    string
	Grove   *grove.Client
	Session *session.Tracker
	Ledger  *session.Ledger
	// Workspace is the set of other repositories linked to Root, or nil.
	Workspace *workspace.Workspace
	// contains filtered or unexported fields
}

Handler holds the shared backend state used by the prism_* tools.

func NewHandler

func NewHandler(cfg *config.Config, root string, client *grove.Client) *Handler

NewHandler constructs a handler with sensible defaults.

func NewHandlerWithLedger

func NewHandlerWithLedger(cfg *config.Config, root string, client *grove.Client, ledger *session.Ledger) *Handler

NewHandlerWithLedger constructs a handler and optionally reuses an existing ledger.

func NewHandlerWithReady

func NewHandlerWithReady(cfg *config.Config, root string, client *grove.Client, readyCh <-chan struct{}) *Handler

NewHandlerWithReady constructs a handler that defers the Grove connection. readyCh must be closed by the caller once Grove is reachable and indexed; Invoke will block until then (or until its own 60-second timeout fires).

func (*Handler) APIDiff

func (h *Handler) APIDiff(ctx context.Context, base string) (*APIDiffResult, error)

APIDiff compares the exported symbols of every tracked file changed since base, and the package identity its manifests declare.

func (*Handler) APIDiffWith added in v2.0.1

func (h *Handler) APIDiffWith(ctx context.Context, base string, opts APIDiffOptions) (*APIDiffResult, error)

APIDiffWith is APIDiff with options.

func (*Handler) CallTool

func (h *Handler) CallTool(ctx context.Context, compact bool, name string, args map[string]any) (ToolAnswer, error)

CallTool answers one tool call the way the MCP server delivers it: the compact "prism" envelope is expanded, the tool runs, and its result is rendered as text with path notes, the stale-context warning and the installation note attached. compact selects the compact gateway's routing and wording. The error is a malformed call (an unknown op or field), which the transport reports as invalid params; the JSON-RPC layer around this is internal/mcp (ENG-01 step 3).

func (*Handler) CrossRepoMap

func (h *Handler) CrossRepoMap(ctx context.Context, depth, maxSites int, includeTests bool) (*CrossRepo, error)

CrossRepoMap computes the cross-repository edges at a map depth. nil when no workspace or server is configured.

func (*Handler) Do

func (h *Handler) Do(r Request) (any, error)

Do runs a typed request.

func (*Handler) Invoke

func (h *Handler) Invoke(name string, args map[string]any) (out any, err error)

Invoke routes a tools/call to the right handler.

func (*Handler) InvokeCompactReadText

func (h *Handler) InvokeCompactReadText(args map[string]any) (any, string, bool, error)

InvokeCompactReadText applies the compact MCP read window and note before rendering. CLI text reads use this path so a requested file/range yields the same evidence as the compact gateway, including its 240-line limit.

func (*Handler) InvokeContext

func (h *Handler) InvokeContext(parent context.Context, name string, args map[string]any) (out any, err error)

InvokeContext is Invoke under a caller's context: the MCP server cancels it when the client sends notifications/cancelled (SEC-06).

func (*Handler) LinkedSearchTail

func (h *Handler) LinkedSearchTail(ctx context.Context, args map[string]any) string

LinkedSearchTail is what an ordinary text-format search ends with when repositories are linked: with repo=all the matches in each, otherwise one line with how many each holds. It keeps the answer the size it was while saying the other repositories were not listed. "" without a workspace.

func (*Handler) RenderCompactSearchText

func (h *Handler) RenderCompactSearchText(ctx context.Context, out map[string]any, args map[string]any) (string, bool)

RenderCompactSearchText is the canonical compact search renderer shared by MCP and CLI. Bodies were attached by the search itself (attachSearchBodies); this only renders. The ctx and args parameters are kept for the callers.

func (*Handler) RenderToolText

func (h *Handler) RenderToolText(compact bool, tool string, args map[string]any, out any) (string, bool)

RenderToolText is the one text renderer for a tool result. The MCP server and the CLI's --format text both call it, so an agent sees the same answer through either transport: same layout, same edit sites, same wording. rendered=false means the shape is not covered and the caller falls back to JSON. compact selects the compact gateway's tool wording ("op=read", not "prism_read").

func (*Handler) StaleContextWarning

func (h *Handler) StaleContextWarning() string

StaleContextWarning is the cheap per-call probe: hash-compare the most recently delivered files and return a one-line warning when any changed. Empty string means the working set is fresh. No index refresh, no graph access — just N small file reads.

type LinkedRepo

type LinkedRepo struct {
	ID     string       `json:"id"`
	Path   string       `json:"path,omitempty"`   // display path of a checkout or clone
	Source string       `json:"source"`           // checkout | clone | server
	Commit string       `json:"commit,omitempty"` // server: the uploaded commit
	Ref    string       `json:"ref,omitempty"`
	Pin    string       `json:"pin,omitempty"`
	State  string       `json:"state"` // resolved | name-matched | unread
	Note   string       `json:"note,omitempty"`
	Sites  []LinkedSite `json:"sites"`
}

LinkedRepo is one linked repository's (or uploaded repository's) answer.

type LinkedSite

type LinkedSite struct {
	File     string `json:"file"`
	Line     int    `json:"line"`
	Col      int    `json:"col,omitempty"`
	Text     string `json:"text,omitempty"`
	From     string `json:"from,omitempty"`   // enclosing symbol
	Evidence string `json:"evidence"`         // resolved | implements | import-scoped | name-match
	Detail   string `json:"detail,omitempty"` // the interface, for implements
	Test     bool   `json:"test,omitempty"`
}

linkedAnswer is what the other repositories say about a change set. LinkedSite is one site in another repository, as structured data for the graph explorer and JSON clients (the text lines say the same).

type LookupRequest

type LookupRequest struct {
	Names  []string // one name is sent as a string, several as a list
	AsList bool     // send even one name as a list (the batch answer shape)
	Fields []string
	Repo   string
	File   string
}

LookupRequest returns symbol bodies by name.

func (LookupRequest) Args

func (r LookupRequest) Args() map[string]any

func (LookupRequest) Tool

func (LookupRequest) Tool() string

type MapRequest

type MapRequest struct {
	Depth, MaxSites  int
	Component        string
	ExpandFrom       string // with ExpandTo: one edge's evidence
	ExpandTo         string
	IncludeTests     bool
	IncludeAuxiliary bool
	// NoRepos leaves out the edges to and from other repositories.
	NoRepos bool
}

MapRequest is the component-level architecture map.

func (MapRequest) Args

func (r MapRequest) Args() map[string]any

func (MapRequest) Tool

func (MapRequest) Tool() string

type MissingImplementationsRequest

type MissingImplementationsRequest struct{ Query, File, Signature string }

MissingImplementationsRequest lists implementers lacking a member.

func (MissingImplementationsRequest) Args

func (MissingImplementationsRequest) Tool

type NodeRequest

type NodeRequest struct{ Name, File string }

NodeRequest shows one symbol or file with its neighbours.

func (NodeRequest) Args

func (r NodeRequest) Args() map[string]any

func (NodeRequest) Tool

func (NodeRequest) Tool() string

type QueryRequest

type QueryRequest struct {
	Terms    []string
	Limit    int // always sent
	Delivery string
	MaxFiles int
	Profile  string
	Include  []string
}

QueryRequest gathers related implementations, callers and tests around explicit anchors.

func (QueryRequest) Args

func (r QueryRequest) Args() map[string]any

func (QueryRequest) Tool

func (QueryRequest) Tool() string

type ReadRequest

type ReadRequest struct {
	File             string
	Offset, Limit    int // 1-based first line and line count; 0 = unset
	IncludeSensitive bool
}

ReadRequest reads one file or a line window of it.

func (ReadRequest) Args

func (r ReadRequest) Args() map[string]any

func (ReadRequest) Tool

func (ReadRequest) Tool() string

type ReferencesRequest

type ReferencesRequest struct{ Name, File, Kind string }

ReferencesRequest lists the uses of a name.

func (ReferencesRequest) Args

func (r ReferencesRequest) Args() map[string]any

func (ReferencesRequest) Tool

func (ReferencesRequest) Tool() string

type RenamePlanRequest

type RenamePlanRequest struct {
	Query, NewName, File string
	AllowCollision       bool
}

RenamePlanRequest plans a rename.

func (RenamePlanRequest) Args

func (r RenamePlanRequest) Args() map[string]any

func (RenamePlanRequest) Tool

func (RenamePlanRequest) Tool() string

type Request

type Request interface {
	Tool() string
	Args() map[string]any
}

Request is one tool call.

type ResolveRequest

type ResolveRequest struct{ Name string }

ResolveRequest lists the declarations a name could mean.

func (ResolveRequest) Args

func (r ResolveRequest) Args() map[string]any

func (ResolveRequest) Tool

func (ResolveRequest) Tool() string

type SearchRequest

type SearchRequest struct {
	Terms             []string // one term is sent as a string, several as a list
	Limit             *int     // nil = the default response budget
	Scope             string
	Regex             bool
	Case              string
	Word              bool
	NoDefaultExcludes bool
	IncludeSensitive  bool
	Paths, Globs      []string
	FilesOnly         bool
	IncludeBodies     *bool // nil = the default
	Exhaustive        bool
	RollupOnly        bool
	Context           *int // nil = unset; 0 is a valid explicit value
	Repo              string
}

SearchRequest searches symbol names and source text.

func (SearchRequest) Args

func (r SearchRequest) Args() map[string]any

func (SearchRequest) Tool

func (SearchRequest) Tool() string

type TestPlanRequest

type TestPlanRequest struct {
	Base     string
	Coverage []string
}

TestPlanRequest lists the tests a working-tree change affects.

func (TestPlanRequest) Args

func (r TestPlanRequest) Args() map[string]any

func (TestPlanRequest) Tool

func (TestPlanRequest) Tool() string

type ToolAnswer

type ToolAnswer struct {
	Texts   []string
	IsError bool
}

ToolAnswer is one tool call's reply as the text blocks a client shows the model. IsError marks a tool failure, which the model reads as a result.

type VerifyRequest

type VerifyRequest struct {
	Base           string
	Strict         bool
	RemovedSymbols []string
}

VerifyRequest reviews a diff for missed sites, or checks removed names.

func (VerifyRequest) Args

func (r VerifyRequest) Args() map[string]any

func (VerifyRequest) Tool

func (VerifyRequest) Tool() string

Source Files

Jump to

Keyboard shortcuts

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