Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeSchemaHash ¶
ComputeSchemaHash reads a file and returns its BLAKE3 hash as a hex string. Returns empty string on error to simplify binding logic.
func Initialize ¶
func Initialize(name, version, typeStr string)
Initialize sets up the agent identity.
func SendEvent ¶
func SendEvent(agentID, state, message string)
SendEvent reports one lifecycle transition.
TYPED, and that is GAPI-DIV-087's whole content. It used to take a JSON STRING, unmarshal it into a map, pluck event/id/state/run_id by key and rebuild a LifecycleStatus - a value encoded, decoded and re-encoded before it left the process, with the event name extracted and then discarded. The caller now passes what it means.
THE CALLER SETS THE STATE. The Python runner used to pass one on two of its eight notifications, so six transitions reached the supervisor with an empty state and were dropped on arrival.
func SetSchemaHash ¶
func SetSchemaHash(hash string)
SetSchemaHash sets the schema hash for the agent.
func StartHeartbeat ¶
func StartHeartbeat(agentID string)
StartHeartbeat reports liveness on a fixed cadence.
The JSON this used to build with fmt.Sprintf had NO ESCAPING, so an agent id containing a quote emitted malformed JSON every five seconds (GAPI-DIV-087). A typed message cannot be malformed by its own contents, which is the point: the defect class disappears rather than being fixed case by case.
Types ¶
type ChannelManager ¶
type ChannelManager struct {
// contains filtered or unexported fields
}
ChannelManager manages a string channel for native communication between Go and Python. It is designed to be exposed via gopy.
func NewChannelManager ¶
func NewChannelManager() *ChannelManager
NewChannelManager creates a new manager.
func (*ChannelManager) Receive ¶
func (m *ChannelManager) Receive(timeoutSeconds int) (string, error)
Receive blocks until a message is received or timeout. Returns the message and an error. If the channel is closed, returns error "channel closed". If timeout occurs, returns error "timeout".
func (*ChannelManager) Send ¶
func (m *ChannelManager) Send(msg string)
Send sends a message to the channel. It is safe to call from multiple goroutines (or Python threads).