feedback

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package feedback wires the public submit_feedback MCP tool to the existing ailang-messages topology — Firestore-backed inbox + Pub/Sub notification — so submissions appear in `ailang messages list --inbox public-feedback` alongside everything else the team triages.

The MCP server runs in Cloud Run with AILANG_STORAGE=gcp, AILANG_CLOUD_PROJECT, and roles/pubsub.publisher on ailang-messages (granted in ailang-multivac/terraform/cloud_run_mcp.tf). Locally, set AILANG_STORAGE=gcp + AILANG_CLOUD_PROJECT to test against a real Firestore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(req Request) error

Validate runs the input checks without touching GCP. Useful for callers that want to validate before paying the publisher init cost (e.g. the MCP tool handler returns validation errors even when AILANG_STORAGE != gcp).

Types

type FieldError

type FieldError struct {
	Code   string
	Field  string
	Detail string
}

FieldError is a structured validation error so the MCP tool can return {error, field} envelopes the AILANG-side schema documents.

func (*FieldError) Error

func (e *FieldError) Error() string

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

Publisher holds the lazily-initialized clients.

func Get

func Get(ctx context.Context) (*Publisher, error)

Get returns the process-wide Publisher, initializing it on first use. Returns the same error on every subsequent call if init failed — caller should surface it as a 5xx-equivalent error envelope, not retry forever.

func (*Publisher) Submit

func (p *Publisher) Submit(ctx context.Context, req Request) (*Result, error)

Submit validates the request, writes the message to Firestore, and publishes a notification on the ailang-messages topic. Returns ticket_id (the Firestore message_id) on success.

Validation errors return *FieldError so the caller can convert to a structured {error, field} JSON envelope. Publish/store errors are wrapped generically.

type Request

type Request struct {
	Title         string
	Body          string
	Category      string
	AILangVersion string
	Snippet       string // optional
	Contact       string // optional

	// Package routes feedback to a specific package's inbox (pkg:<vendor>/<name>)
	// instead of the default public-feedback inbox. Empty = general AILANG feedback.
	// Format: vendor/name (e.g. "sunholo/auth"). Validated against packageRe.
	Package string

	// AutoDispatch hints to the cloud coordinator that the user explicitly
	// authorizes the package's autonomous agent to act on this submission.
	// Default false — feedback files in the inbox for human/agent triage.
	// Today, package agents use pkg-update.md (release-sync template); a
	// dedicated pkg-feedback.md template is planned but not yet wired, so
	// auto-dispatch=true on a pkg:* inbox today would trigger a release-sync
	// workflow on a bug report (wrong). Surface as an attribute on the
	// Pub/Sub notification so the coordinator can filter when ready.
	AutoDispatch bool
}

Request is the public-facing input shape for submit_feedback.

type Result

type Result struct {
	TicketID string `json:"ticket_id"`
	QueuedAt string `json:"queued_at"`
	Status   string `json:"status"`
}

Result is what we hand back to the agent.

Jump to

Keyboard shortcuts

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