texttool

package module
v0.1.0-preview.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

Spice Agent Text Tool

github.com/spice-framework/spice-agent-tool-text is a separately versioned clean-room extension for Spice Agent. It contributes the deterministic, read-only text.inspect tool.

The extension is deliberately small: it reports byte, Unicode rune, whitespace-delimited word, line, and SHA-256 metadata for a bounded UTF-8 string. It performs no I/O and declares no Agent capabilities.

Configure

Import the extension explicitly in a Spice application:

import _ "github.com/spice-framework/spice-agent-tool-text/autoconfigure"

Run the released Spice generator. The generated application receives text.inspect through the ordinary map[string]tool.Tool; importing the module alone never activates it.

Verify

make fast
make check
make verify
make benchmark
make cleanroom

All normal verification runs with GOWORK=off, the committed vendor tree, and no module proxy. make cleanroom exercises install, configure, debug, test, package, and delete boundaries in repository-external temporary directories.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifest

func Manifest() spicestarter.Manifest

Manifest returns exact compatibility and activation metadata.

This package function is required by the Spice starter-manifest protocol.

Types

type TextInspection

type TextInspection struct {
	Bytes  int    `json:"bytes"`
	Runes  int    `json:"runes"`
	Words  int    `json:"words"`
	Lines  int    `json:"lines"`
	SHA256 string `json:"sha256"`
}

TextInspection is a deterministic, immutable summary of one UTF-8 string.

func NewTextInspection

func NewTextInspection(text string) TextInspection

NewTextInspection constructs the canonical summary for text.

type TextInspectionRequest

type TextInspectionRequest struct {
	Text string `json:"text"`
}

TextInspectionRequest is the strict model-visible input for text.inspect.

type TextInspector

type TextInspector struct {
	// contains filtered or unexported fields
}

TextInspector implements the deterministic read-only text.inspect tool.

func NewTextInspector

func NewTextInspector() (*TextInspector, error)

NewTextInspector constructs the extension tool and validates its public definition.

func (*TextInspector) Definition

func (inspector *TextInspector) Definition() tool.Definition

Definition returns a defensive copy of the model-visible contract.

func (*TextInspector) Execute

func (inspector *TextInspector) Execute(
	ctx context.Context,
	call tool.Call,
	_ tool.Reporter,
) (tool.Result, error)

Execute validates one call and returns deterministic text metadata.

Directories

Path Synopsis
Package autoconfigure contributes text.inspect only through an explicit blank import.
Package autoconfigure contributes text.inspect only through an explicit blank import.
internal
qualitygate command

Jump to

Keyboard shortcuts

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