Help us shape the future of Go! Take the 2026 Go Developer Survey

probe

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package probe provides shared capability-probe scaffolding: execution bounded to the probe's owned process group, the deterministic MCP fixture, and probe directory helpers.

Index

Constants

View Source
const (
	// FixtureSubcommand is the hidden al subcommand that serves the fixture.
	FixtureSubcommand = "__probe-mcp-fixture"
	// FixtureToolName is the single harmless tool the probe fixture exposes.
	FixtureToolName = "probe_ping"
	// FixtureToolReply is returned by the fixture tool. It is unique so probe
	// output cannot be confused with any other text.
	FixtureToolReply = "PROBEMCPTOOL33"
	// FixtureMarkerEnvVar names the file the fixture touches when its tool runs.
	// A marker file is stronger evidence than transcript text: it proves the
	// client actually executed the tool rather than describing it.
	FixtureMarkerEnvVar = "AL_PROBE_MCP_MARKER"
	// FixtureInvokedEvidence is the evidence recorded when FixtureInvoked
	// confirms the client executed the fixture tool.
	FixtureInvokedEvidence = "mcp fixture: " + FixtureToolName + " was invoked by the client"
)

Variables

This section is empty.

Functions

func CreateDir added in v1.1.0

func CreateDir(tmpRoot string, provider string, probedAt time.Time) (string, error)

CreateDir creates a unique provider probe directory under tmpRoot, creating tmpRoot first when needed. The returned path is absolute.

func ExitCode added in v1.1.0

func ExitCode(err error) int

ExitCode maps a Run error to the exit code a probe result reports: 124 for cancellation or deadline, the process exit code, or -1 when the process never produced one.

func FixtureInvoked added in v1.1.0

func FixtureInvoked(markerPath string) bool

FixtureInvoked reports whether the marker at markerPath holds exactly the fixture reply, so an absent or unrelated file never counts as an invocation.

func Run

func Run(ctx context.Context, cmd *exec.Cmd) error

Run owns a new process group until all signaling is finished, then reaps its leader once. Callers supply a plain command, output writers and probe context.

func RunMCPFixture added in v1.1.0

func RunMCPFixture(ctx context.Context) error

RunMCPFixture serves a minimal, deterministic MCP server over stdio for capability probes. It completes protocol initialization and exposes exactly one harmless tool, so a failed discovery or tool call is evidence about the client rather than about the fixture.

func WriteOutputs added in v1.1.0

func WriteOutputs(probeDir string, provider string, stdout []byte, stderr []byte) error

WriteOutputs records a provider run's stdout and stderr in probeDir.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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