Files
plugins/packages/agentcompass/package.json
T
Akiiwa d951674164 agentcompass 0.1.0: intent, capability and quota routing as a gateway middleware (#670)
New package @magpie-community/gateway-agentcompass 0.1.0 (akiiwa-games, #670): a gateway middleware that profiles a request and routes `agentcompass` / `agentcompass/*` to a model and effort within the user's own candidateModels. Only `model` and the effort field change; nothing is added to the prompt; no network unless the user sets allowExternalScorer: true plus a URL.

Reviewed at head 3bdea54 (rebased on 7ea6119), after three review rounds.

Run on mote (macOS), at 3bdea54:
- `bun scripts/check.mjs agentcompass`: ok.
- packages/agentcompass `node --test test/router.test.mjs`: 33 pass, 0 fail.
- Every network test passes a mock fetch; the one that doesn't (9.5) replaces globalThis.fetch with a thrower.

Broken by hand, each turned a test red:
- carrier deletes in middleware.js removed: 9.3 and 9.6 red.
- the 400 reject for a virtual model with no candidates replaced by `return undefined`: 9.2 red.
- MAX_NOISE_STRIP_CHARS / MAX_USER_TURN_CHARS set to 1e12: 9.9 red.
- an unclaimed request that carries the key made to return a mutated body: 9.6 red.

Read: the carrier is no longer read from the body (useRouteCarrier, carrierFromBody and the profile branch are gone); DEFAULT_GATEWAY_CANDIDATES is gone; no process.env, no default URL, quotas.json only from an explicit path.

Not tried: the plugin in magpie's real moejs runtime at this head (the review of 9d22371 did that; the changes since are the ones above), and a real gateway with real accounts. Leftover header comments in scorer-live.js, quota.js, catalog.js and allocator.js still say `magpie.hooks`; harmless, to tidy in a later version.
2026-11-04 04:09:20 +08:00

47 lines
1.8 KiB
JSON

{
"name": "@magpie-community/gateway-agentcompass",
"version": "0.1.0",
"description": "Intent, multi-dimensional capability, Model DNA, subscription quota opportunity-cost, and session-affinity routing plugin for Magpie, powered by AgentCompass.",
"type": "module",
"main": "./src/index.js",
"exports": {
".": "./src/index.js",
"./server": "./src/index.js",
"./hooks": "./src/hooks.js",
"./middleware": "./src/middleware.js",
"./allocator": "./src/allocator.js",
"./continuity": "./src/continuity.js",
"./quota": "./src/quota.js",
"./profiler": "./src/profiler-core.js",
"./catalog": "./src/catalog.js"
},
"magpie": {
"name": "AgentCompass",
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGNpcmNsZSBjeD0iMzIiIGN5PSIzMiIgcj0iMjgiIHN0cm9rZT0iIzNCODJGNiIgc3Ryb2tlLXdpZHRoPSI0IiBmaWxsPSIjMEYxNzJBIi8+PGNpcmNsZSBjeD0iMzIiIGN5PSIzMiIgcj0iMjIiIHN0cm9rZT0iIzYwQTVGQSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1kYXNoYXJyYXk9IjMgMyIvPjxwb2x5Z29uIHBvaW50cz0iMzIsMTIgMzgsMzIgMzIsMjggMjYsMzIiIGZpbGw9IiNFRjQ0NDQiLz48cG9seWdvbiBwb2ludHM9IjMyLDUyIDM4LDMyIDMyLDM2IDI2LDMyIiBmaWxsPSIjRTJFOEYwIi8+PGNpcmNsZSBjeD0iMzIiIGN5PSIzMiIgcj0iMy41IiBmaWxsPSIjRjhGQUZDIi8+PC9zdmc+",
"middleware": "./src/middleware.js",
"options": {
"routeAllModels": false,
"injectProtocolEffort": true
}
},
"scripts": {
"test": "node --test test/router.test.mjs"
},
"keywords": [
"magpie",
"magpie-middleware",
"magpie-routing",
"routing",
"load-balancing",
"llm-gateway",
"agentcompass"
],
"homepage": "https://github.com/akiiwa-games/AgentCompass",
"repository": {
"type": "git",
"url": "https://github.com/magpie-community/plugins.git",
"directory": "packages/agentcompass"
},
"license": "MIT"
}