Documentation
¶
Overview ¶
Package stats counts magpie's users: once a day a running magpie tells PostHog it is in use, under an id made up on this computer, with its version and system, and, unless the user turned that part off, which agents, providers and models it is used with, by their built-in ids (Usage): a provider of the user's own is only "custom". No names, URLs, accounts, keys, prompts or usage go. With that part, usemagpie.ai is told which of the plugins Discover lists are installed here, for Discover's counts (plugins.go), and which routing groups shared there were imported here, for its gallery's (groupshare.Report). Settings → Privacy turns it off, and so do DO_NOT_TRACK=1 and MAGPIE_NO_STATS=1; a build from source never sends it.
Index ¶
- Constants
- func Host() string
- func InstallID() (string, error)
- func Like(ctx context.Context, name string, on bool) (int, error)
- func Off() bool
- func Run(version, what string)
- func Send(ctx context.Context, version, what string, now time.Time) error
- func Site() string
- type Board
- type Counts
- type Usage
Constants ¶
const Key = "phc_nyDyYyrUTRGvNq5U7FBesCyM2j4GdKeqGp8ko7DBerTC"
Key is the Magpie project's key on PostHog: it can send events there and read nothing, so it is safe in the app.
Variables ¶
This section is empty.
Functions ¶
func Host ¶
func Host() string
Host takes the events; MAGPIE_STATS_HOST points them elsewhere, for testing.
func Like ¶
Like likes the plugin Discover keys name, or takes the like back, under this computer's id; the answer is its likes now. The page lets only a plugin installed here be liked (gui), and the like says it is.
func Run ¶
func Run(version, what string)
Run sends the day's event while magpie runs, as what ("app", "serve"): at start, and then whenever a new day (UTC) has begun. Only releases send it, unless MAGPIE_STATS_HOST is set.
Types ¶
type Board ¶
type Board struct {
Plugins map[string]Counts `json:"plugins"`
Servers map[string]Counts `json:"servers"`
}
Board is what usemagpie.ai counts: each plugin's, by Discover's key, and each MCP server's, by its market id.
type Counts ¶
Counts is what usemagpie.ai says of each plugin: the computers that had it in the last seven days, and its likes.
type Usage ¶ added in v0.1.1118
type Usage struct {
Agents []string // the agents connected to magpie: claude, codex
Providers []string // the providers on: deepseek, codex (a subscription), plugin:kiro
Models []string // the models the connected agents are set to: deepseek/deepseek-v4, custom, group
Groups int // routing groups shown
}
Usage is what the day's event says magpie is used with, when the user shares it: built-in ids only. A provider of the user's own is "custom", and so is a model on one; a plugin no one knows is "plugin".