adaptive-memory-multi-model-router 2.16.2 → 2.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.github/CODEOWNERS +2 -0
  2. package/.github/FUNDING.yml +7 -1
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +56 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +41 -0
  5. package/.github/workflows/pages.yml +1 -1
  6. package/CHANGELOG.md +15 -8
  7. package/CONTRIBUTING.md +109 -25
  8. package/README.md +131 -219
  9. package/data/jev-distill.jsonl +320 -0
  10. package/dist/routing/jev/jevRouter.d.ts +49 -0
  11. package/dist/routing/jev/jevRouter.js +231 -0
  12. package/dist/routing/jev/jevRouter.js.map +1 -0
  13. package/dist/routing/jev/optionAttention.d.ts +63 -0
  14. package/dist/routing/jev/optionAttention.js +158 -0
  15. package/dist/routing/jev/optionAttention.js.map +1 -0
  16. package/dist/routing/jev/remote.d.ts +14 -0
  17. package/dist/routing/jev/remote.js +55 -0
  18. package/dist/routing/jev/remote.js.map +1 -0
  19. package/dist/routing/jev/types.d.ts +71 -0
  20. package/dist/routing/jev/types.js +19 -0
  21. package/dist/routing/jev/types.js.map +1 -0
  22. package/dist/routing/jev/weights/jev-router-weights.json +1 -0
  23. package/dist/server/modelMapper.js +18 -0
  24. package/dist/server/modelMapper.js.map +1 -1
  25. package/docs/assets/og-banner.svg +193 -0
  26. package/docs/index.html +1523 -465
  27. package/docs-site/index.html +1427 -563
  28. package/package.json +29 -20
  29. package/python/pyproject.toml +1 -1
  30. package/src/cli/setupWizard.ts +4 -2
  31. package/src/routing/jev/jevRouter.ts +251 -0
  32. package/src/routing/jev/optionAttention.ts +186 -0
  33. package/src/routing/jev/remote.ts +50 -0
  34. package/src/routing/jev/types.ts +79 -0
  35. package/src/routing/jev/weights/jev-router-weights.json +1 -0
  36. package/src/server/modelMapper.ts +17 -0
  37. package/tests/routing/jev.test.ts +110 -0
  38. package/tools/calibrate_temp.py +81 -0
  39. package/tools/distill.mjs +143 -0
  40. package/tools/train_jev.py +213 -0
  41. package/dist/cli/tui.d.ts +0 -6
  42. package/dist/cli/tui.js.map +0 -1
  43. package/dist/routing/shadowSampler.d.ts.map +0 -1
  44. /package/{ARCHITECTURE.md → archive/ARCHITECTURE.md} +0 -0
  45. /package/{ENTERPRISE_INTEGRATIONS.md → archive/ENTERPRISE_INTEGRATIONS.md} +0 -0
  46. /package/{MANIFESTO.md → archive/MANIFESTO.md} +0 -0
  47. /package/{README_ja.md → archive/README_ja.md} +0 -0
  48. /package/{README_zh.md → archive/README_zh.md} +0 -0
  49. /package/{SECURITY.md → archive/SECURITY.md} +0 -0
  50. /package/{TECHNICAL_README.md → archive/TECHNICAL_README.md} +0 -0
  51. /package/{TODO_BROWSER_AUTOMATION.md → archive/TODO_BROWSER_AUTOMATION.md} +0 -0
  52. /package/{AGENT_COUNCIL_FINDINGS.md → archive/campaign/AGENT_COUNCIL_FINDINGS.md} +0 -0
  53. /package/{AUDIT_REPORT.md → archive/campaign/AUDIT_REPORT.md} +0 -0
  54. /package/{CONTRIBUTORS.md → archive/campaign/CONTRIBUTORS.md} +0 -0
  55. /package/{IMPROVEMENT_PLAN.md → archive/campaign/IMPROVEMENT_PLAN.md} +0 -0
  56. /package/{INTEGRATION_PROGRESS.md → archive/campaign/INTEGRATION_PROGRESS.md} +0 -0
  57. /package/{CAMPAIGN_SUMMARY.md → archive/launch/CAMPAIGN_SUMMARY.md} +0 -0
  58. /package/{LANDING.md → archive/launch/LANDING.md} +0 -0
  59. /package/{LAUNCH-PAIN-DRIVEN.md → archive/launch/LAUNCH-PAIN-DRIVEN.md} +0 -0
  60. /package/{LAUNCH.md → archive/launch/LAUNCH.md} +0 -0
  61. /package/{LAUNCH_CHECKLIST.md → archive/launch/LAUNCH_CHECKLIST.md} +0 -0
  62. /package/{LAUNCH_SNAPSHOT.md → archive/launch/LAUNCH_SNAPSHOT.md} +0 -0
  63. /package/{REDESIGN.md → archive/launch/REDESIGN.md} +0 -0
  64. /package/{HEALTH_REPORT.md → archive/research/HEALTH_REPORT.md} +0 -0
  65. /package/{OPPORTUNITIES_100.md → archive/research/OPPORTUNITIES_100.md} +0 -0
  66. /package/{POPULARITY_BOOSTERS.md → archive/research/POPULARITY_BOOSTERS.md} +0 -0
  67. /package/{PR_STATUS_REPORT.md → archive/research/PR_STATUS_REPORT.md} +0 -0
  68. /package/{research-log.md → archive/research/research-log.md} +0 -0
  69. /package/{RELEASE_v2.16.0.md → archive/submissions/RELEASE_v2.16.0.md} +0 -0
  70. /package/{RUNKIT.md → archive/submissions/RUNKIT.md} +0 -0
  71. /package/{SUBMISSIONS.md → archive/submissions/SUBMISSIONS.md} +0 -0
  72. /package/{a3m-integrations-summary.md → archive/submissions/a3m-integrations-summary.md} +0 -0
  73. /package/{discoverability-diagnosis.md → archive/submissions/discoverability-diagnosis.md} +0 -0
@@ -0,0 +1,2 @@
1
+ # Default owner for all files
2
+ * @Das-rebel
@@ -1,2 +1,8 @@
1
- # These are supported funding model platforms
2
1
  github: Das-rebel
2
+ patreon: # Replace with a Patreon username
3
+ ko_fi: # Replace with a Ko-fi username
4
+ tidelift: npm/adaptive-memory-multi-model-router
5
+ community_bridge: # Replace with Community Bridge project slug e.g. lightning
6
+ liberapay: # Replace with Liberapay username
7
+ open_collective: # Replace with Open Collective username
8
+ custom: ["https://opencollective.com/a3m-router"]
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: 🐛 Bug Report
3
+ about: Something isn't working as expected
4
+ title: "[Bug] "
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+
11
+ A clear description of the bug. What did you expect vs what actually happened?
12
+
13
+ ## Steps to Reproduce
14
+
15
+ 1. Go to '...'
16
+ 2. Run `...`
17
+ 3. See error
18
+
19
+ ```bash
20
+ # Paste relevant command output
21
+ npx a3m-router route "..."
22
+ node test.js
23
+ ```
24
+
25
+ ## Expected Behavior
26
+
27
+ What should happen.
28
+
29
+ ## Actual Behavior
30
+
31
+ What actually happens — include error messages, stack traces.
32
+
33
+ ## Environment
34
+
35
+ - **OS**: (e.g., macOS 14, Ubuntu 24.04)
36
+ - **Node.js version**: (e.g., 22.x)
37
+ - **a3m-router version**: (e.g., 2.16.3 — run `npm show adaptive-memory-multi-model-router version`)
38
+ - **Provider**: (which provider were you routing to?)
39
+
40
+ ## Relevant Logs
41
+
42
+ ```log
43
+ # paste relevant log output here
44
+ ```
45
+
46
+ ## Additional Context
47
+
48
+ Anything else that might help diagnose the issue.
49
+
50
+ ## Changelog Entry
51
+
52
+ One-liner for the changelog (if this bug fix is worth noting):
53
+
54
+ ```
55
+ - fix: short description
56
+ ```
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: ✨ Feature Request
3
+ about: Suggest a new capability
4
+ title: "[Feature] "
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Problem or Opportunity
10
+
11
+ Describe the problem you're trying to solve, or the gap in the current capability.
12
+
13
+ ## Proposed Solution
14
+
15
+ Describe your proposed solution. Include code sketches if relevant.
16
+
17
+ ```typescript
18
+ // How the API might look
19
+ const result = router.route({
20
+ model: "auto",
21
+ // new option described here
22
+ })
23
+ ```
24
+
25
+ ## Alternatives Considered
26
+
27
+ What other approaches did you consider and why did you reject them?
28
+
29
+ ## Additional Context
30
+
31
+ - Related discussions, issues, or PRs
32
+ - Would this break backward compatibility?
33
+ - Any dependencies or provider requirements?
34
+
35
+ ## Changelog Entry
36
+
37
+ One-liner for the changelog:
38
+
39
+ ```
40
+ - feat: short description
41
+ ```
@@ -30,7 +30,7 @@ jobs:
30
30
  - name: Upload artifact
31
31
  uses: actions/upload-pages-artifact@v3
32
32
  with:
33
- path: '.'
33
+ path: 'docs'
34
34
 
35
35
  - name: Deploy to GitHub Pages
36
36
  id: deployment
package/CHANGELOG.md CHANGED
@@ -2,17 +2,24 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.16.3] — 2026-09-19
6
+
5
7
  ### Added
6
- - Docker + docker-compose deployment
7
- - MCP server for AI agent integration
8
- - LangChain LLM integration with A3M Router
9
- - Gradio demo on HuggingFace Space
10
- - GitHub Pages documentation site
11
- - CI/CD badges and community health files
12
- - Posting directory with 30+ platforms for A3M discovery
8
+ - **`model="jev-auto"`** — System One single-pass routing head: option-attention engine in pure TypeScript, zero extra dependencies, ~2ms warm latency, 97.8% agreement with heuristic router, calibrated per-choice probabilities, dynamic option sets for unseen providers, confidence guard (p<0.22 auto-fallback)
9
+ - `npm run jev:distill` + `npm run jev:train` pipeline — distills training data and trains the Jev decision head from real traffic
10
+ - Remote Jev backend support via `A3M_JEV_URL` env var (openjev-sglang or api.typesafe.ai)
11
+ - imprint Jev head (Python/numpy, ~0.5ms/decision) — gates cascade compression, cross-compatible weights with a3m-router
12
+
13
+ ### Fixed
14
+ - CI `npm ci` failure: restored `package-lock.json` (deleted by git add -A in da2ae95)
15
+ - CI MODULE_NOT_FOUND: force-tracked `dist/routing/jev/` (was gitignored but needed for CI's node test.js against committed dist)
16
+ - Lazy guarded import in modelMapper.ts — graceful fallback when jev weights unavailable
17
+ - Repo About description: removed circular "DEPRECATED → adaptive-memory-multi-model-router" (repo redirects to itself)
13
18
 
14
19
  ### Changed
15
- - Cleanup removed 4 unused deps, fixed 0 vulns, deduplicated
20
+ - `dist/` Jev files now properly tracked for CI compatibility
21
+ - README restructured: TOC, architecture diagram, prominent Jev feature section, cleaner quick-start flow
22
+ - CONTRIBUTING.md rewritten with real project structure, test commands, PR checklist
16
23
 
17
24
  ## [2.16.0] — 2026-08-12
18
25
 
package/CONTRIBUTING.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Contributing to A3M Router
2
2
 
3
- Thanks for helping build the fastest-growing open-source LLM router! 🚀
3
+ Thanks for helping build the open-source LLM router! 🚀
4
4
 
5
5
  ## Quick Setup
6
6
 
@@ -11,40 +11,124 @@ npm install
11
11
  npm run build
12
12
  ```
13
13
 
14
+ ## Running Tests
15
+
16
+ ```bash
17
+ # All tests
18
+ npm test # or: npx vitest run tests/
19
+
20
+ # Routing engine tests
21
+ npx vitest run tests/routing/
22
+
23
+ # Jev engine tests
24
+ npx vitest run tests/routing/jev.test.ts
25
+
26
+ # Provider tests
27
+ node test/provider-test.js
28
+
29
+ # Quick smoke test
30
+ node test.js
31
+ ```
32
+
14
33
  ## Project Structure
15
34
 
16
35
  ```
17
36
  src/
18
- ├── providers/ # 47+ LLM provider configurations
19
- ├── routing/ # UCB1 + MCTS routing engine
20
- ├── cache/ # Semantic deduplication cache
21
- ├── proxy/ # OpenAI-compatible proxy server
22
- └── tui/ # Terminal UI overlay
37
+ ├── routing/
38
+ │ ├── advancedRouter.ts # Main heuristic router (System 2)
39
+ │ ├── jev/ # Jev System One decision head
40
+ │ │ ├── jevRouter.ts # Entry point
41
+ │ │ ├── optionAttention.ts # Single-pass option-attention math
42
+ │ │ ├── weights/ # Trained weights (git-tracked dist/)
43
+ │ │ └── types.ts
44
+ │ └── routeQuery.ts # Provider scoring + selection
45
+ ├── providers/
46
+ │ └── providerConfig.ts # 80+ provider configs + tier definitions
47
+ ├── server/
48
+ │ ├── modelMapper.ts # model="auto" / model="jev-auto" dispatcher
49
+ │ └── proxyServer.ts # OpenAI-compatible proxy server
50
+ ├── cache/
51
+ │ └── semanticCache.ts # Embedding-based deduplication
52
+ └── cli.ts # CLI entry point
53
+
54
+ tests/
55
+ ├── routing/jev.test.ts # Jev engine unit tests
56
+ ├── routing/advancedRouter.test.ts
57
+ └── integration/
23
58
  ```
24
59
 
25
- ## Development
60
+ ## Adding a New Provider
26
61
 
27
- ```bash
28
- npm run build # Compile TypeScript
29
- npm test # Run tests
30
- node dist/tui/dashboard.js # Launch TUI
31
- ```
62
+ 1. Add the provider config to `src/providers/providerConfig.ts`:
63
+ ```typescript
64
+ export const MY_PROVIDER: Provider = {
65
+ name: "my-provider",
66
+ apiKeyEnvVar: "MY_PROVIDER_API_KEY",
67
+ endpoint: "https://api.my-provider.ai/v1",
68
+ supports: ["chat", "Completions"],
69
+ tier: "cheap", // free | cheap | mid | premium
70
+ region: "us-east",
71
+ };
72
+ ```
73
+
74
+ 2. Add to the provider registry:
75
+ ```typescript
76
+ export const PROVIDERS: Record<string, Provider> = {
77
+ // ...existing
78
+ "my-provider": MY_PROVIDER,
79
+ };
80
+ ```
81
+
82
+ 3. Run tests:
83
+ ```bash
84
+ node test/provider-test.js # basic connectivity
85
+ npx a3m-router providers list # verify it appears
86
+ ```
87
+
88
+ ## Adding a Routing Engine (e.g., a new Jev variant)
89
+
90
+ 1. Create `src/routing/myEngine/`
91
+ 2. Implement the engine interface:
92
+ ```typescript
93
+ export interface RouteResult {
94
+ primary_model: string; // "provider/model-name"
95
+ confidence: number; // 0–1
96
+ 备选?: string; // fallback provider/model
97
+ }
98
+ export function routeQuery(prompt: string): RouteResult { ... }
99
+ ```
100
+ 3. Wire it into `src/server/modelMapper.ts` under the new model name
101
+ 4. Add tests in `tests/routing/myEngine.test.ts`
102
+ 5. Document in this README under "Two Routing Modes"
32
103
 
33
- ## PR Guidelines
104
+ ## Code Style
105
+
106
+ - **TypeScript strict mode** — no `any`, full type coverage
107
+ - **ES2022** target, CommonJS output
108
+ - 2-space indent, single quotes
109
+ - Run `npx tsc --noEmit` before committing
110
+
111
+ ## Commit Conventions
112
+
113
+ ```
114
+ feat(provider): add Cloudflare Workers AI support
115
+ fix(jev): guard against empty option set
116
+ chore: bump vitest to 3.x
117
+ docs: rewrite Quick Start section
118
+ ```
34
119
 
35
- - Keep the package under 20KB (no ML deps)
36
- - Add provider configs in `src/providers/`
37
- - Route logic in `src/routing/`
38
- - TUI changes in `src/tui/`
39
- - Update CHANGELOG.md
120
+ ## Pull Request Checklist
40
121
 
41
- ## Adding a Provider
122
+ - [ ] `npm run build` passes locally
123
+ - [ ] `npx vitest run tests/` — all tests green
124
+ - [ ] `node test.js` — smoke test passes
125
+ - [ ] New provider/engine has tests
126
+ - [ ] README updated if adding new features
42
127
 
43
- 1. Add config in `src/providers/providerConfig.ts`
44
- 2. Set tier: `free` / `cheap` / `mid` / `premium`
45
- 3. Add to `PROVIDER_TIERS` map
46
- 4. PR with latency benchmarks
128
+ ---
47
129
 
48
- ## Questions?
130
+ ## Getting Help
49
131
 
50
- Open an issue or reach out on [GitHub Discussions](https://github.com/Das-rebel/a3m-router/discussions).
132
+ - 💬 [GitHub Discussions](https://github.com/Das-rebel/a3m-router/discussions)
133
+ - 🐛 [Issue Tracker](https://github.com/Das-rebel/a3m-router/issues)
134
+ - 📖 [docs/](docs/) for architecture and API reference