Adds the Fingerprint page plugin (packages/fingerprint): it checks whether a model behind the local magpie gateway answers like the model it claims to be.
Reviewed at 531ca11f4 (KaranocaVe). Run at that head merged with main 848497c, through mote-run on the Mac mini with Bun 1.4.2:
- bun run rebuild from the committed bun.lock (frozen, --ignore-scripts): typecheck, 30/30 tests, build; diff -r against the committed dist/ is empty.
- HOME=$(mktemp -d) bun test: 3838 pass, 0 fail. bun scripts/check.mjs: exit 0.
- Offline preload refusing every non-loopback fetch/socket: 30/30, nothing refused.
- Broken by hand, each red: ensureDetector() in bootstrap, dropping ttl: Infinity, validating the job after the download.
Maintainer decision: the reference data comes from two third-party hosts (lm.ikale.io, cdn.jsdmirror.com), only on an explicit Download or a valid job, and both are named on the page, in registry.json and the READMEs. It is data used locally to rank candidates and is sent nowhere; the @latest fallback has no pinned hash, so a bad snapshot would rank wrongly, which the page states.
Not on npm yet (E404): magpie installs it from the dist branch until an owner publishes the first version.
87 lines
4.4 KiB
Markdown
87 lines
4.4 KiB
Markdown
# Magpie Fingerprint
|
||
|
||
[简体中文](README.zh-CN.md) · [Magpie](https://github.com/yetone/magpie) · [lm-detector](https://github.com/Ikaleio/lm-detector)
|
||
|
||
Investigate suspected model substitution directly in Magpie. Compare numeric
|
||
response fingerprints across providers or repeat a run after a service changes.
|
||
The page reuses Magpie’s configured models and gateway; the pinned
|
||
`lmfpd-sdk` detector ranks nearby reference-bank models. Rankings are evidence
|
||
for investigation, not proof of model identity.
|
||
|
||

|
||
|
||
- Select up to 24 models across providers, with the same three challenges per batch.
|
||
- Reuse Magpie authentication and native endpoint metadata; optionally pin an account.
|
||
- Follow live sample counts, cancel work, and inspect the actual response route.
|
||
- Compare ranked candidates, including partial and unscorable outcomes.
|
||
- Keep raw replies and data versions in local history; export or copy JSON.
|
||
- Magpie's native page bridge, controls and design tokens; follows the host's theme and language.
|
||
- Compact model lists, keyboard-accessible view tabs, and narrow-screen layouts.
|
||
|
||
## Install
|
||
|
||
Install **Fingerprint** from **Plugins → Discover**, or use the CLI. Requires
|
||
a current Magpie release with `page.service` support and Bun 1.4.2+:
|
||
|
||
```sh
|
||
magpie plugin add @magpie-community/page-fingerprint
|
||
```
|
||
|
||
Open **Fingerprint** in the sidebar, or choose **Fingerprint** from a provider's menu.
|
||
Starting a detection sends three requests per selected model and uses that provider's quota.
|
||
|
||
## Development
|
||
|
||
Run these commands from `packages/fingerprint/`. Source, tests and the built
|
||
`dist/` assets are checked in. Installation and the offline tests do not need
|
||
package downloads: `vendor/lmfpd-sdk` pins the MIT SDK at 0.2.0. Only rebuilding
|
||
the UI and running the type checker require the development dependencies.
|
||
Direct build-tool versions are exact in `package.json`; `bun.lock` fixes the
|
||
complete dependency graph using `registry.npmjs.org`. Builds use Bun 1.4.4.
|
||
There are no install/pack lifecycle scripts. After a source change, rebuild
|
||
and commit the resulting `dist/` files.
|
||
|
||
The standalone project and release history are at
|
||
[KaranocaVe/magpie-fingerprint](https://github.com/KaranocaVe/magpie-fingerprint).
|
||
|
||
```sh
|
||
bun run rebuild
|
||
bun start
|
||
```
|
||
|
||
`rebuild` installs with `--frozen-lockfile --ignore-scripts` in an isolated
|
||
copy, runs typecheck/tests/build, and copies `dist/` back. This avoids Bun
|
||
resolving the parent monorepo's workspaces; its temporary directory is removed
|
||
on completion. In a standalone copy of this package, `bun install
|
||
--frozen-lockfile --registry https://registry.npmjs.org` and `bun run check`
|
||
produce the same build.
|
||
|
||
The plugin page service listens on `3488` by default and uses Magpie's gateway
|
||
at `http://127.0.0.1:3425`. Opening or refreshing the page never downloads
|
||
reference data. **Download reference data** explicitly fetches a fresh snapshot;
|
||
starting a run downloads one only when no usable snapshot is cached. There is
|
||
no background refresh. The default primary source is
|
||
`https://lm.ikale.io/data/`; its fallback is
|
||
`https://cdn.jsdmirror.com/npm/lmfpd-data@latest/`. These hosts see the client's
|
||
IP address. Reference downloads carry no provider credentials, model ids,
|
||
prompts or replies. Only an explicitly started job sends sampling prompts
|
||
through the configured gateway. See [integration.md](integration.md) for gateway
|
||
authentication, `magpie web`, environment variables, local reference sources,
|
||
and the explicit `--demo` fixture.
|
||
|
||
## Scope and limits
|
||
|
||
The first release supports numeric fingerprinting. Each run retains its loaded
|
||
reference snapshot and records its `builtAt` value. The remote reference data
|
||
is not version-pinned or authenticated by a locally pinned hash; the fallback
|
||
uses `@latest`. Runs use three shared challenges per batch, bounded work, and
|
||
cancellation. It records proposed, observed, and failed evidence separately;
|
||
it does not prove provider identity, authenticate a model, or infer hidden
|
||
tokenizers. `--demo` runs an isolated illustrative workflow without model calls.
|
||
|
||
Magpie middleware and protocol adapters still apply. A changed actual provider/model
|
||
invalidates that target's aggregate score. Account pinning is optional; it does not
|
||
turn a routed channel into an upstream identity guarantee. Tokenizer probing is deferred.
|
||
|
||
MIT licensed. Third-party notices are in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|