jsontool

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 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

Spice Agent JSON Tool

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

The extension validates a bounded JSON document, rejects duplicate object keys and excessive depth or node counts, and returns its top-level kind, exact byte size, node count, depth, and SHA-256. 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-json/autoconfigure"

Run the released Spice generator. The generated application receives json.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

Overview

Package jsontool provides the deterministic json.inspect Spice Agent tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifest

func Manifest() spicestarter.Manifest

Manifest returns exact compatibility and review metadata.

Types

type JSONInspection

type JSONInspection struct {
	Kind   string `json:"kind"`
	Bytes  int    `json:"bytes"`
	Nodes  int    `json:"nodes"`
	Depth  int    `json:"depth"`
	SHA256 string `json:"sha256"`
}

JSONInspection is a deterministic, immutable description of one JSON document.

func NewJSONInspection

func NewJSONInspection(document, kind string, nodes, depth int) JSONInspection

NewJSONInspection constructs the exact-document inspection result.

type JSONInspectionRequest

type JSONInspectionRequest struct {
	Document string `json:"document"`
}

JSONInspectionRequest is the strict model-visible input for json.inspect.

type JSONInspector

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

JSONInspector implements the deterministic read-only json.inspect tool.

func NewJSONInspector

func NewJSONInspector() (*JSONInspector, error)

NewJSONInspector constructs the extension tool and validates its public definition.

func (*JSONInspector) Definition

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

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

func (*JSONInspector) Execute

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

Execute validates one call and returns deterministic JSON metadata.

Directories

Path Synopsis
Package autoconfigure contributes the fallback tool only through an explicit blank import.
Package autoconfigure contributes the fallback tool 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