demoseed

package
v0.330.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 18 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 demoseed fills a public DEMO muster with invented content, for app store reviewers, testers and screenshots: per-user tasks, agents in running, error and pending states, tool-call transcripts, and, on a schedule, questions from those agents. No real agent runs; every row is fixture text. docs/demo.md is the operator's guide.

muster server demo-seed reset                 empty the demo content
muster server demo-seed ensure                seed every user who has none
muster server demo-seed ask                   ensure, then a question for every user with none open

🔴 IT REFUSES ANY DATABASE WHOSE NAME DOES NOT END IN "_demo". reset truncates every task, agent and question on the server, so pointing it at a real deployment by accident would empty everyone's board. Check is the guard; there is no override flag. It is modelled on e2e/seed (and its "_e2e" guard, e2edb).

🔴 THE SEEDED AGENTS HOLD NO TOKEN, SO NOTHING OUTSIDE CAN ACT AS THEM. ask raises their questions IN-PROCESS: it builds the server's own application from the server's configuration (internal/cmd/server, demoSeedTools) and runs attention_ask and notify_owner through the same tool dispatch a gateway agent's turn uses (api.Server.KickoffTurnTools), so the Attention item and the push go through muster's real code and its own VAPID keys. The agent door (POST /mcp), and with it the connector store, is not needed.

Index

Constants

View Source
const (
	// DatabaseSuffix is what a demo database's name ends in.
	DatabaseSuffix = "_demo"
)

Variables

This section is empty.

Functions

func Check

func Check(dsn string) error

Check is nil only when dsn names a database whose name ends in DatabaseSuffix, as pgx resolves the name.

🔴 IT ASKS PGX WHICH DATABASE THE DSN NAMES, NEVER THE URL'S PATH: pgx honours `?dbname=` over the path, and a key=value DSN has no path (the same reasoning as e2edb.Check).

func Main

func Main(args []string, getenv func(string) string, stdout, stderr io.Writer, tools ToolsFactory) int

Main is `muster server demo-seed …`: it returns the process's exit code. The guard runs before anything connects.

tools builds ask's in-process tool dispatch from the server's configuration (internal/cmd/server passes it); it is called only for ask.

Types

type Seeder

type Seeder struct {
	DSN string
	Out io.Writer
	// Pool is the application pool (row-level security applies to it).
	Pool *pgxpool.Pool
	// Tools is ask's in-process tool dispatch (ToolRunner); Rand picks
	// questions; NotifyChance is the probability of a notify_owner push
	// alongside a question.
	Tools        ToolRunner
	Rand         *rand.Rand
	NotifyChance float64
	// Watch: after raising questions, ask keeps every open demo question's
	// agent waiting for its answer (attention_wait) until it is answered or
	// expires, so an answer is READ by the agent and never left queued for a
	// delivery this server cannot make (no agent gateway). Main sets it.
	Watch bool
	// contains filtered or unexported fields
}

Seeder runs the three subcommands against one database.

func (*Seeder) Ask

func (s *Seeder) Ask(ctx context.Context) (int, error)

Ask first runs Ensure (so a person invited since the last run gets a board), then raises one invented question for every person who has a seeded running agent and no open question from any agent: attention_ask, run IN-PROCESS as one of those agents through the server's own tool dispatch (Tools), so the Attention item, its push and its log line are exactly a real agent's. Now and then (NotifyChance) the same agent also sends a notify_owner push. It returns how many questions it raised; a person whose call fails is reported and skipped.

func (*Seeder) Ensure

func (s *Seeder) Ensure(ctx context.Context) (int, error)

Ensure seeds every enabled person who has no demo content (no anchor agent). It returns how many it seeded.

func (*Seeder) Reset

func (s *Seeder) Reset(ctx context.Context) error

Reset empties the demo content. It runs on its own connection as the login role (the database owner), as e2e/seed's truncate does: TRUNCATE ignores row-level security, so the application role is not granted it.

type ToolRunner

type ToolRunner func(ctx context.Context, a agents.Agent) (dispatch func(name, args string) string, ok bool)

ToolRunner is the server's own tool dispatch for agent a: the function that runs one of a's muster tools in-process, acting as a's owner, or ok false when the server runs no tools for a. internal/cmd/server builds it from api.Server.KickoffTurnTools, the path a gateway agent's turn takes.

type ToolsFactory

type ToolsFactory func(ctx context.Context) (ToolRunner, func(), error)

ToolsFactory builds a ToolRunner from the server's configuration, and the cleanup that waits for its pushes and closes what it opened. Main calls it for ask only, after the guard.

Jump to

Keyboard shortcuts

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