toolbox

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package toolbox contains the small process-level conventions shared by standalone Codefly toolbox plugins.

Index

Constants

View Source
const RedactedValue = "[REDACTED]"
View Source
const RequireBoundAuthorizationEnvironment = "CODEFLY_TOOLBOX_REQUIRE_BOUND_AUTHZ"

RequireBoundAuthorizationEnvironment makes the plugin guard require catalog and exact-request digests on every scoped authorization. Production manager admission sets it after caller-provided environment values.

View Source
const VersionEnvironment = "CODEFLY_TOOLBOX_VERSION"

Variables

This section is empty.

Functions

func DigestCallToolRequest added in v0.2.23

func DigestCallToolRequest(request *toolboxv0.CallToolRequest) (string, error)

DigestCallToolRequest returns a deterministic digest of the exact protobuf request (tool name, structured arguments, and roots).

func Environment

func Environment(key, fallback string) string

Environment returns an environment value or a fallback when it is unset.

func EnvironmentList

func EnvironmentList(key string) []string

EnvironmentList parses a comma-separated environment variable, trimming whitespace and omitting empty entries.

func RedactWithSchema added in v0.2.23

func RedactWithSchema(schema *structpb.Struct, value any) any

RedactWithSchema returns a JSON-shaped copy safe for diagnostics. Schema fields marked writeOnly, x-codefly-sensitive, or with a sensitive x-codefly-classification are replaced. Unknown object fields and values with no schema are redacted fail-closed.

func ValidateArguments added in v0.2.23

func ValidateArguments(schema, arguments *structpb.Struct) error

ValidateArguments compiles the approved JSON Schema and validates arguments. Missing or malformed schemas fail closed: every production tool contract must describe its input, even when that input is an empty object.

func ValidateSchema added in v0.2.23

func ValidateSchema(schema *structpb.Struct) error

ValidateSchema checks only the descriptor contract, without requiring that an empty argument object satisfy fields required at invocation time.

func Version

func Version() string

Version returns the version injected by the host, or the development value used when a toolbox binary is launched directly.

Types

type ApprovedTool added in v0.2.23

type ApprovedTool struct {
	Summary     *toolboxv0.ToolSummary
	Description *toolboxv0.DescribeToolResponse
	Digest      string
	Idempotency IdempotencyClass
}

ApprovedTool is the second discovery phase. Digest binds the toolbox identity, complete summary catalog, and this exact full descriptor.

type CatalogSnapshot added in v0.2.23

type CatalogSnapshot struct {
	Identity  *toolboxv0.IdentityResponse
	Summaries *toolboxv0.ListToolSummariesResponse
	Digest    string
}

CatalogSnapshot is the immutable first phase of toolbox discovery: identity plus lightweight summaries. Full descriptions are deliberately excluded so hosts can fetch and approve only the selected tool immediately before use.

func NewCatalogSnapshot added in v0.2.23

func NewCatalogSnapshot(
	identity *toolboxv0.IdentityResponse,
	summaries *toolboxv0.ListToolSummariesResponse,
) (*CatalogSnapshot, error)

NewCatalogSnapshot validates, canonicalizes, clones, and hashes first-phase discovery. Wire ordering does not affect the digest.

func SnapshotServer added in v0.2.23

func SnapshotServer(ctx context.Context, server toolboxv0.ToolboxServer) (*CatalogSnapshot, error)

SnapshotServer discovers only identity and summaries. Plugin guards and external hosts both call ApproveTool for the selected action, preventing the legacy eager ListTools behavior from creeping back into the host contract.

func (*CatalogSnapshot) ApproveTool added in v0.2.23

func (s *CatalogSnapshot) ApproveTool(name string, description *toolboxv0.DescribeToolResponse) (*ApprovedTool, error)

ApproveTool validates a phase-two descriptor against the phase-one catalog and returns the digest the host must bind into scoped authorization.

func (*CatalogSnapshot) Clone added in v0.2.23

func (s *CatalogSnapshot) Clone() *CatalogSnapshot

Clone returns a deep copy suitable for exposing outside a session.

func (*CatalogSnapshot) HasTool added in v0.2.23

func (s *CatalogSnapshot) HasTool(name string) bool

HasTool reports whether name was present in phase-one discovery.

func (*CatalogSnapshot) ToolNames added in v0.2.23

func (s *CatalogSnapshot) ToolNames() []string

ToolNames returns the canonical sorted catalog names.

type IdempotencyClass added in v0.2.23

type IdempotencyClass string

IdempotencyClass is the closed, host-interpreted ToolSpec idempotency set. Unknown or free-text values can never authorize an automatic retry.

const (
	IdempotencyUnknown       IdempotencyClass = "unknown"
	IdempotencySafe          IdempotencyClass = "idempotent"
	IdempotencySideEffecting IdempotencyClass = "side_effecting"
)

func ParseIdempotency added in v0.2.23

func ParseIdempotency(value string) (IdempotencyClass, error)

ParseIdempotency converts the protocol field into its closed semantic set. Empty remains a supported explicit unknown for existing tool definitions.

Directories

Path Synopsis
Package bash is the codefly Bash toolbox — the only sanctioned path for running shell commands across the codefly stack.
Package bash is the codefly Bash toolbox — the only sanctioned path for running shell commands across the codefly stack.
cli
Package cli is a reusable toolbox that turns any single CLI binary into a codefly tool.
Package cli is a reusable toolbox that turns any single CLI binary into a codefly tool.
cmd/cli-toolbox command
Command cli-toolbox is the standalone binary form of the reusable single-CLI toolbox.
Command cli-toolbox is the standalone binary form of the reusable single-CLI toolbox.
Package codefly implements the toolbox contract for inspecting a codefly workspace — modules, services, and layout — as typed RPCs.
Package codefly implements the toolbox contract for inspecting a codefly workspace — modules, services, and layout — as typed RPCs.
cmd/codefly-toolbox command
Command codefly-toolbox is the standalone binary form of the codefly workspace-inspection toolbox.
Command codefly-toolbox is the standalone binary form of the codefly workspace-inspection toolbox.
Package conformance provides the canonical Toolbox protocol fixture and the reusable host harness that certifies a toolbox implementation.
Package conformance provides the canonical Toolbox protocol fixture and the reusable host harness that certifies a toolbox implementation.
cmd/conformance-toolbox command
Command conformance-toolbox runs the deterministic Toolbox conformance fixture as a real agent process through the standard secure startup helper.
Command conformance-toolbox runs the deterministic Toolbox conformance fixture as a real agent process through the standard secure startup helper.
host
Package host is the CLI-independent external-host conformance harness for Codefly Toolboxes.
Package host is the CLI-independent external-host conformance harness for Codefly Toolboxes.
git
Package git is the codefly Git toolbox: every git operation an agent might want to perform, exposed as typed Tool RPCs through the codefly.services.toolbox.v0 contract.
Package git is the codefly Git toolbox: every git operation an agent might want to perform, exposed as typed Tool RPCs through the codefly.services.toolbox.v0 contract.
cmd/git-toolbox command
Command git-toolbox is the standalone binary form of the codefly git toolbox.
Command git-toolbox is the standalone binary form of the codefly git toolbox.
Package github implements the codefly toolbox contract for GitHub — pure Go via the google/go-github SDK (no `gh` binary, matching the toolbox convention that git/docker/web are all SDK clients, not CLI shell-outs).
Package github implements the codefly toolbox contract for GitHub — pure Go via the google/go-github SDK (no `gh` binary, matching the toolbox convention that git/docker/web are all SDK clients, not CLI shell-outs).
cmd/github-toolbox command
Command github-toolbox is the standalone binary form of the codefly github toolbox.
Command github-toolbox is the standalone binary form of the codefly github toolbox.
Package lang defines the conventional language toolbox: the stable set of tool names every language plugin (python, go, rust, ...) exposes through the unified Toolbox contract.
Package lang defines the conventional language toolbox: the stable set of tool names every language plugin (python, go, rust, ...) exposes through the unified Toolbox contract.
cmd/fake-lang-toolbox command
Command fake-lang-toolbox is a TEST-ONLY language plugin used by the round-trip integration test in core/toolbox/lang.
Command fake-lang-toolbox is a TEST-ONLY language plugin used by the round-trip integration test in core/toolbox/lang.
Package launch bridges resources.Toolbox manifests to running host.Plugin processes.
Package launch bridges resources.Toolbox manifests to running host.Plugin processes.
cmd/network-victim-toolbox command
Command network-victim-toolbox is a TEST-ONLY plugin used by the end-to-end sandbox-enforcement tests in core/toolbox/launch.
Command network-victim-toolbox is a TEST-ONLY plugin used by the end-to-end sandbox-enforcement tests in core/toolbox/launch.
Package linear implements the codefly toolbox contract for Linear via its GraphQL API.
Package linear implements the codefly toolbox contract for Linear via its GraphQL API.
cmd/linear-toolbox command
Command linear-toolbox is the standalone binary form of the codefly linear toolbox.
Command linear-toolbox is the standalone binary form of the codefly linear toolbox.
Package mcp transcodes between the codefly toolbox v0 contract (Connect-RPC over gRPC) and the Model Context Protocol (JSON-RPC 2.0 over stdio).
Package mcp transcodes between the codefly toolbox v0 contract (Connect-RPC over gRPC) and the Model Context Protocol (JSON-RPC 2.0 over stdio).
Package mcprev is the reverse-direction MCP transcoder: wraps an MCP server (speaking JSON-RPC over stdio) and exposes it as a codefly Toolbox gRPC server.
Package mcprev is the reverse-direction MCP transcoder: wraps an MCP server (speaking JSON-RPC over stdio) and exposes it as a codefly Toolbox gRPC server.
Package policyguard wraps a toolboxv0.ToolboxServer with policy decision point (PDP) enforcement.
Package policyguard wraps a toolboxv0.ToolboxServer with policy decision point (PDP) enforcement.
Package registry holds the shared "tool definition" type each codefly toolbox uses to declare its callable surface ONCE and project to whichever response shape the host requested:
Package registry holds the shared "tool definition" type each codefly toolbox uses to declare its callable surface ONCE and project to whichever response shape the host requested:
Package respond holds the small set of response-shaping helpers that every toolbox.Toolbox implementation needs: extract arguments from a CallToolRequest, build error / structured / content responses, and bake JSON-Schema constants into the proto Struct shape.
Package respond holds the small set of response-shaping helpers that every toolbox.Toolbox implementation needs: extract arguments from a CallToolRequest, build error / structured / content responses, and bake JSON-Schema constants into the proto Struct shape.
Package session is the supported host-side Toolbox lifecycle: validate a manifest, launch one guarded process, approve its catalog, authorize exact requests, invoke them, emit redacted audit events, and clean up.
Package session is the supported host-side Toolbox lifecycle: validate a manifest, launch one guarded process, approve its catalog, authorize exact requests, invoke them, emit redacted audit events, and clean up.

Jump to

Keyboard shortcuts

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