aiapproval

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package aiapproval contains the ai-approval node: a human-in-the-loop pause. Wired into a flow (typically inside a tool flow ahead of ai-tool-return), it emits an approval request — question + approvalId — on output 2 and waits for a reply message carrying the same approvalId on its input. The pending record lives in the host's context store, so a restart re-driving the hop sees the same approvalId and either keeps waiting or resumes immediately when the decision already landed.

Index

Constants

View Source
const DecisionKey = "aiApproval"

DecisionKey is the message-metadata key the resumed message carries: {approvalId, approved, comment}.

View Source
const ReplyKey = "aiApprovalReply"

ReplyKey is the message-metadata key marking an approval reply: a map with "approvalId" (required), "approved" (bool, default true) and an optional "comment".

View Source
const Type = "ai-approval"

Type is the registered node type id.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalNode

type ApprovalNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

ApprovalNode is the ai-approval executor.

func NewApprovalNode

func NewApprovalNode(node nodestore.NodeInterface, config *Config, host nodebase.NodeHost) *ApprovalNode

NewApprovalNode creates a new ai-approval node.

func (*ApprovalNode) Execute

Execute routes the message: a reply (metadata aiApprovalReply) resolves a pending approval and dies here; anything else is a request — the node emits the approval request on output 2, blocks for the decision and returns the resumed message on output 1.

func (*ApprovalNode) SelectPorts

func (n *ApprovalNode) SelectPorts(input, output nodestore.MessageInterface) []string

SelectPorts kills the reply message after it resolved a pending approval; request-resume messages go to output 1.

type Config

type Config struct {
	// Question is the mustache template rendered against the
	// incoming message — the question asked of the approver. Empty
	// stringifies the payload.
	Question string `json:"question"`
	// TimeoutSeconds bounds the wait; <= 0 waits until the run
	// context ends.
	TimeoutSeconds float64 `json:"timeoutSeconds"`
}

Config holds the ai-approval configuration.

Jump to

Keyboard shortcuts

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