stats

package
v0.1.4187 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 19 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 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). 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

View Source
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

func Like(ctx context.Context, name string, on bool) (int, error)

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 Off

func Off() bool

Off reports whether the user said not to send it.

func PluginCounts

func PluginCounts(ctx context.Context) (map[string]Counts, error)

PluginCounts asks usemagpie.ai each plugin's counts, by Discover's key.

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.

func Send

func Send(ctx context.Context, version, what string, now time.Time) error

Send sends the event for now's day, unless it went already or the user turned it off.

func Site

func Site() string

Site takes the day's plugins and the likes; MAGPIE_SITE_HOST points them elsewhere, for testing.

Types

type Counts

type Counts struct {
	Users int `json:"users,omitempty"`
	Likes int `json:"likes,omitempty"`
}

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".

Jump to

Keyboard shortcuts

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