discovery

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 8 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 discovery starts one read-only agent session in the repo that names the sources a map should be built from, each with a kind and a reason. It has no appetite and no circuit breaker: init is never bounded (design 10 Q6). The session may read and search the repo's files and never writes. Checking what it names is gather's job, not this package's.

Index

Constants

View Source
const MaxNamed = 200

MaxNamed is how many sources a session may name; gather refuses the rest.

Variables

This section is empty.

Functions

func Prompt

func Prompt() string

Prompt returns everything the session starts from: the discovery skill and nothing else. It says what to look for, never where: the session is given no paths, because finding where a repo keeps its prior art is its job.

Types

type Result

type Result struct {
	Sources []Source
	Model   string
	Tokens  adapter.Tokens
	// Malformed counts the entries, or the whole reply, that could not be
	// read as a source; they are dropped.
	Malformed int
}

Result is what a session ended with.

func Run

func Run(ctx context.Context, s Session) (Result, error)

Run starts the session and parses what it names. An agent that cannot be resolved or a session that fails is an error; a reply that names nothing readable is not.

type Session

type Session struct {
	// Agent resolves the agent to run.
	Agent func() (adapter.Adapter, error)
	// Root is the repo's root, where the session runs.
	Root string
	// Progress, when set, receives one line before the session starts.
	Progress io.Writer
}

Session is how a discovery session is run.

type Source

type Source struct {
	Path, Kind, Reason string
}

Source is one source the session names.

func Parse

func Parse(text string) (sources []Source, malformed int)

Parse reads the sources from the last fenced json block of a reply. An entry with no path or no reason is dropped and counted in malformed; a reply with no readable block counts as one malformed and names nothing.

Jump to

Keyboard shortcuts

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