Documentation
¶
Overview ¶
Package contracts is the root of garm's generated tool contracts.
It is a separate Go module, and now a separate repository, on purpose. A tool service depends on this module and on garmtool, and on nothing else: the boundary is what stops a tool importing toolplane and attempting the governance chain locally — a second, unreviewed implementation of a policy that already ran before the request crossed NATS.
The second reason is weight. This module requires three things. The command line tool it was extracted from requires eleven, including an S3 client and a CLI framework, and every consumer of a message type used to inherit them.
It is not published to a registry. Consume it at a git tag:
go get github.com/garm-ai/contracts@v0.1.0
Package garm embeds the contract this repository publishes.
The annotations are vendored into a consumer's tree by `garm init` rather than fetched from a registry. That is deliberate: a registry is one more thing an enterprise build has to be allowed to reach, and the annotations are small, stable, and worth reading by the people writing tool schemas against them.
The bytes here are the same bytes `garm init` writes, verbatim and with no added header, so a later drift check is a byte comparison rather than a parse.
Index ¶
Constants ¶
const AnnotationSchemaVersion = 1
AnnotationSchemaVersion is the version of the garm.tool.v1 vocabulary this build speaks, stamped into every catalogue it produces.
garm.tool.v1 only. The sibling vocabularies — garm.agent.v1, garm.card.v1, garm.meta.v1 — are read by the runner and never by the daemon, so a change to them is not a change to what a daemon must understand and never bumps this. cmd/garm's catalogue tests hold that line.
A daemon reads the current version and the two previous and refuses anything outside that window at boot. It is an integer rather than a semver because the only question asked of it is "can this binary read that catalogue", and a range check wants a number.
Bump it when a change to the annotations means an older daemon would misread a declaration — not when a field is added that an older daemon can safely ignore.
const VendoredAgentAnnotationsPath = "third_party/proto/garm/agent/v1/agent.proto"
VendoredAgentAnnotationsPath is where AgentAnnotationsProto belongs in a consumer's tree.
The same third_party module as the tool annotations, for the same reason: every module in a buf v2 workspace is an input, so annotations under proto/ would have Go generated for them, and two packages registering one proto file panic at init. The tail of the path is part of the contract — an import of "garm/agent/v1/agent.proto" has to resolve.
const VendoredAnnotationsPath = "third_party/proto/garm/tool/v1/tool.proto"
VendoredAnnotationsPath is where AnnotationsProto belongs in a consumer's tree.
Under third_party rather than beside your own protos, and that is not cosmetic: every module in a buf v2 workspace is an input, so annotations living under proto/ get Go generated for them — output that is never usable, because the real one is in this module's contracts package and two packages registering one proto file panic at init.
The tail of the path is part of the contract: an import of "garm/tool/v1/tool.proto" has to resolve, so only the root is a choice.
const VendoredCardAnnotationsPath = "third_party/proto/garm/card/v1/card.proto"
VendoredCardAnnotationsPath is where CardAnnotationsProto belongs in a consumer's tree. Same module, same reasoning as the two above; an import of "garm/card/v1/card.proto" has to resolve.
const VendoredMetaAnnotationsPath = "third_party/proto/garm/meta/v1/meta.proto"
VendoredMetaAnnotationsPath is where MetaAnnotationsProto belongs in a consumer's tree; an import of "garm/meta/v1/meta.proto" has to resolve.
Variables ¶
var AgentAnnotationsProto []byte
AgentAnnotationsProto is proto/garm/agent/v1/agent.proto, exactly as published.
var AnnotationsProto []byte
AnnotationsProto is proto/garm/tool/v1/tool.proto, exactly as published.
var CardAnnotationsProto []byte
CardAnnotationsProto is proto/garm/card/v1/card.proto, exactly as published: the card vocabulary and the result_card / task_card / card_role templates an author declares beside a tool or an agent.
var MetaAnnotationsProto []byte
MetaAnnotationsProto is proto/garm/meta/v1/meta.proto, exactly as published: the owner annotation a service or method carries.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audit is the durable, separately-retained half of the record.
|
Package audit is the durable, separately-retained half of the record. |
|
Package callctx encodes the InvocationContext for the NATS hop.
|
Package callctx encodes the InvocationContext for the NATS hop. |
|
Package cards synthesises the three card endpoints every tool serves.
|
Package cards synthesises the three card endpoints every tool serves. |
|
garm
|
|
|
Package grant computes what a human approved.
|
Package grant computes what a human approved. |
|
Package grants is the part of grant verification that is contract logic rather than daemon policy.
|
Package grants is the part of grant verification that is contract logic rather than daemon policy. |
|
Package ledger is the shape of a governed call's record.
|
Package ledger is the shape of a governed call's record. |
|
Package toolpolicy resolves what a principal may see, from annotations on the schema.
|
Package toolpolicy resolves what a principal may see, from annotations on the schema. |
|
redact
Package redact turns a denied field value into what the caller may see.
|
Package redact turns a denied field value into what the caller may see. |
|
Package wire is how a route becomes a NATS address.
|
Package wire is how a route becomes a NATS address. |