← Catalog

@pi-in-go/pigpen-pi-typesafe-api

Typed Go API for extension authors, a port of pi-typesafe's library half: one admission rule, request and spend caps, key store and auth state, judgment backends (TypeSafe, OpenRouter, Command Code, custom endpoint, own model), Ask, batchi…

PackagePigpen

Install

Install with PiG

pig install npm:@pi-in-go/pigpen-pi-typesafe-api
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package. This one is published by the PiG project from the Pigpen repository; that is not a verification claim.

Pi manifest JSON

The pi field of package.json.

{}

README

Written by the package's publisher, shown as published in version 0.1.2 (README.md). PiG does not review it.

pi-typesafe-api (typed Go API)

The library half of the pi-typesafe port: what an extension author imports to ask Jev typed questions safely. Go module github.com/MichaelKinsy/pigpen/components/pi-typesafe-api, package pitypesafe, over the shared client components/typesafe. A consumer extension's go.mod requires it at v0.0.0 (no replace) and its directory has a go.work with use ( . ../../../pi-typesafe-api ../../../typesafe ).

client, err := pitypesafe.New(pitypesafe.Options{MaxRequests: 5, MaxUSDPerDay: 1}) // key: TYPESAFE_API_KEY, else the login store
answer := pitypesafe.Ask(ctx, client, typesafe.SystemOneRequest{
	State: typesafe.Text("I was charged twice."),
	Questions: typesafe.Questions{typesafe.Ask("billing", typesafe.Noul("Is this about billing?"))},
}, pitypesafe.AskOptions{Timeout: 5 * time.Second})
if !answer.OK { /* answer.ErrorCode == pitypesafe.CodeBudget: stop asking; never an error value */ }
PieceWhere
Admission (PrepareEvaluationRequest: normalize model near-misses, validate, byte budget), EvaluationSchemaschema.go, evaluation_schema.json
Client with request budget, day caps, ledger, auth recording (New, Evaluate, EvaluateRaw, ListModels, GetSpend)client.go, usage.go, auth.go
Backends: typesafe, openrouter, commandcode, a caller-supplied endpoint, and ownmodelbackends.go
Key store, key situations, AgentDir (PiG's directory)credentials.go
Ask, EvaluateMany, EvaluateAll, ChunkRequest, FanOutask.go, batch.go
Calibration kit (Calibrate, Replay, AUC, ...)calibrate.go
Own model on the PiG SDK's model accesshostmodel/
Hidden-input key prompt, LoginWithPrompt, EnsureAPIKeyui/

Where content goes. TypeSafe, OpenRouter, Command Code and custom-endpoint backends send it to that host (BackendHost names it for consent text); the ownmodel backend sends it to the provider of the model PiG is configured with. A key for one backend is never sent to another. Credit and license: CREDITS.md. Mapping: port/PORT.md.