adaptive-memory-multi-model-router 2.14.16 → 2.14.18
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.
- package/.a3m-vault.json +23 -0
- package/.github/workflows/ci.yml +253 -5
- package/.publish-tick +1 -1
- package/AGENT_COUNCIL_FINDINGS.md +142 -0
- package/LAUNCH_CHECKLIST.md +141 -0
- package/README.md +15 -17
- package/README.md.bak +836 -0
- package/articles/CHINESE_SUBMISSIONS_READY.md +322 -0
- package/articles/DEVTO_READY.md +255 -0
- package/articles/HN_POST_READY.md +137 -0
- package/articles/INDIEHACKERS_READY.md +120 -0
- package/articles/NEWSLETTER_SEND_NOW.md +259 -0
- package/articles/PRODUCTHUNT_READY.md +106 -0
- package/articles/REDDIT_SUBMISSION_READY.md +348 -0
- package/articles/TWEET_STORM_READY.md +165 -0
- package/benchmark-results.json +45 -43
- package/council-votes/architecture-vote.md +121 -0
- package/council-votes/coverage-vote.md +93 -0
- package/dist/cost/costTracker.d.ts +109 -44
- package/dist/cost/costTracker.js +321 -98
- package/dist/cost/costTracker.js.map +1 -1
- package/dist/ensemble.d.ts +21 -0
- package/dist/ensemble.js +85 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +12 -4
- package/dist/routing/advancedRouter.d.ts +38 -43
- package/dist/routing/advancedRouter.js +394 -408
- package/dist/routing/advancedRouter.js.map +1 -1
- package/dist/routing/providers/providerConfig.d.ts +49 -0
- package/dist/routing/providers/providerConfig.js +883 -0
- package/dist/routing/routing/advancedRouter.d.ts +62 -0
- package/dist/routing/routing/advancedRouter.js +447 -0
- package/dist/routing/utils/tokenUtils.d.ts +52 -0
- package/dist/routing/utils/tokenUtils.js +129 -0
- package/dist/server/proxyServer.d.ts +1 -1
- package/dist/tui/dashboard.js +66 -2
- package/dist/tui/dashboard.js.map +1 -1
- package/dist/utils/tokenUtils.d.ts +48 -1
- package/dist/utils/tokenUtils.js +117 -4
- package/dist/utils/tokenUtils.js.map +1 -1
- package/docs/CITATIONS.md +2 -2
- package/docs/GEO_STATUS.md +43 -157
- package/docs/ai-plugin.json +4 -4
- package/docs/llms.txt +21 -27
- package/docs/sitemap.xml +14 -20
- package/package.json +2 -2
- package/research-log.md +49 -0
- package/sitemap.xml +57 -0
- package/src/cost/costTracker.ts +576 -0
- package/src/ensemble.ts +103 -0
- package/src/index.ts +13 -3
- package/src/routing/advancedRouter.ts +536 -0
- package/src/tui/dashboard.ts +76 -3
- package/src/utils/tokenUtils.ts +142 -4
- package/test-council/1-structure-tests.test.js +353 -0
- package/test-council/1-structure-tests.test.ts +353 -0
- package/test-council/2-edge-case-tests.test.ts +361 -0
- package/test-council/3-performance-tests.test.ts +669 -0
- package/test-council/4-integration-tests.test.ts +391 -0
- package/test-council/5-agent-council-eval.test.ts +413 -0
- package/test-council/AGENT_COUNCIL_ARCHITECTURE.md +349 -0
- package/test-council/TEST_COUNCIL_REPORT.md +201 -0
- package/test-council/agents/edge-case-agent.ts +363 -0
- package/test-council/agents/performance-agent.ts +426 -0
- package/test-council/agents/structure-agent.ts +227 -0
- package/test-council/council.md +183 -0
- package/tests/security/guardrailEngine.test.ts +700 -0
- package/docs/.well-known/ai-plugin.json +0 -16
- package/research/PUBLISH_LOG.md +0 -3
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# A3M Router Test Council
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The A3M Router Test Council is a multi-agent testing approach inspired by the agent council pattern used in production LLM systems. Instead of a single monolithic test suite, we use **3 specialist agents**, each evaluating the codebase from a distinct perspective.
|
|
6
|
+
|
|
7
|
+
## Why Agent Council?
|
|
8
|
+
|
|
9
|
+
Traditional testing treats all tests equally. A council approach recognizes that:
|
|
10
|
+
|
|
11
|
+
1. **Different aspects of code quality require different testing strategies**
|
|
12
|
+
2. **Specialized agents can find issues a general test would miss**
|
|
13
|
+
3. **Council decisions are more robust than single-agent decisions**
|
|
14
|
+
|
|
15
|
+
## The 3 Specialist Agents
|
|
16
|
+
|
|
17
|
+
### 1. Structure Agent (`1-structure-tests.ts`)
|
|
18
|
+
|
|
19
|
+
**Focus:** Code architecture, type safety, and export validation
|
|
20
|
+
|
|
21
|
+
**Specialization:**
|
|
22
|
+
- Verifies all exports are present and correctly typed
|
|
23
|
+
- Validates provider configuration structure
|
|
24
|
+
- Checks model profile completeness
|
|
25
|
+
- Ensures class instantiation works
|
|
26
|
+
- Validates enum and constant values
|
|
27
|
+
|
|
28
|
+
**Key Questions:**
|
|
29
|
+
- Are all public APIs exported correctly?
|
|
30
|
+
- Do model profiles have required fields?
|
|
31
|
+
- Are provider configs valid?
|
|
32
|
+
- Do class constructors work?
|
|
33
|
+
|
|
34
|
+
**Example Findings:**
|
|
35
|
+
- Missing required fields in provider config
|
|
36
|
+
- Inconsistent type definitions
|
|
37
|
+
- Invalid enum values
|
|
38
|
+
- Missing method exports
|
|
39
|
+
|
|
40
|
+
### 2. Edge-Case Agent (`2-edge-case-tests.ts`)
|
|
41
|
+
|
|
42
|
+
**Focus:** Boundary conditions, error handling, and invalid inputs
|
|
43
|
+
|
|
44
|
+
**Specialization:**
|
|
45
|
+
- Tests empty and null inputs
|
|
46
|
+
- Validates extremely long inputs
|
|
47
|
+
- Checks unknown/invalid models
|
|
48
|
+
- Tests missing API key handling
|
|
49
|
+
- Verifies concurrent request safety
|
|
50
|
+
- Tests special characters and unicode
|
|
51
|
+
- Validates error recovery
|
|
52
|
+
|
|
53
|
+
**Key Questions:**
|
|
54
|
+
- What happens with empty strings?
|
|
55
|
+
- How does the system handle null inputs?
|
|
56
|
+
- What about 10,000 word queries?
|
|
57
|
+
- Does concurrent access cause race conditions?
|
|
58
|
+
- Are special characters handled safely?
|
|
59
|
+
|
|
60
|
+
**Example Findings:**
|
|
61
|
+
- Null pointer exceptions on empty inputs
|
|
62
|
+
- Buffer overflow on very long queries
|
|
63
|
+
- Race conditions in shared state
|
|
64
|
+
- Missing error boundaries
|
|
65
|
+
|
|
66
|
+
### 3. Performance Agent (`3-performance-tests.ts`)
|
|
67
|
+
|
|
68
|
+
**Focus:** Latency, throughput, and scalability
|
|
69
|
+
|
|
70
|
+
**Specialization:**
|
|
71
|
+
- Benchmarks token counting (< 1ms target)
|
|
72
|
+
- Measures route decision latency (< 5ms target)
|
|
73
|
+
- Tests memory tree operations
|
|
74
|
+
- Validates cost estimation accuracy
|
|
75
|
+
- Measures batch routing throughput
|
|
76
|
+
- Tests concurrent operation performance
|
|
77
|
+
|
|
78
|
+
**Key Questions:**
|
|
79
|
+
- Is token counting fast enough?
|
|
80
|
+
- Can we route 100 queries per second?
|
|
81
|
+
- Do memory operations scale?
|
|
82
|
+
- Is cost estimation accurate?
|
|
83
|
+
- Are operations deterministic?
|
|
84
|
+
|
|
85
|
+
**Example Findings:**
|
|
86
|
+
- Token counting too slow for real-time use
|
|
87
|
+
- Memory tree operations don't scale
|
|
88
|
+
- Inconsistent results under load
|
|
89
|
+
- Cost calculation drift over time
|
|
90
|
+
|
|
91
|
+
## Supporting Test Files
|
|
92
|
+
|
|
93
|
+
### 4. Integration Tests (`4-integration-tests.ts`)
|
|
94
|
+
|
|
95
|
+
**Focus:** Full pipeline workflows across components
|
|
96
|
+
|
|
97
|
+
**Tests:**
|
|
98
|
+
- Extract features → Route → Return structure
|
|
99
|
+
- Memory tree add → search → verify
|
|
100
|
+
- Cost tracker add → verify total
|
|
101
|
+
- Provider register → get → deregister
|
|
102
|
+
- Cross-component workflows
|
|
103
|
+
|
|
104
|
+
### 5. Cost Model Tests (`5-cost-model-tests.ts`)
|
|
105
|
+
|
|
106
|
+
**Focus:** Financial accuracy and budget enforcement
|
|
107
|
+
|
|
108
|
+
**Tests:**
|
|
109
|
+
- MODEL_COSTS matches actual provider pricing
|
|
110
|
+
- estimateCost accuracy across tiers (free/cheap/mid/premium)
|
|
111
|
+
- Cost comparison between models is correct
|
|
112
|
+
- Budget enforcer respects limits
|
|
113
|
+
- CostTracker calculations match expected values
|
|
114
|
+
|
|
115
|
+
## How the Council Evaluates
|
|
116
|
+
|
|
117
|
+
Each agent runs independently and reports:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Agent: Structure
|
|
121
|
+
✅ All exports present
|
|
122
|
+
✅ Provider configs valid
|
|
123
|
+
❌ MODEL_PROFILES missing context_window field
|
|
124
|
+
✅ Class instantiation works
|
|
125
|
+
|
|
126
|
+
Result: 47/48 passed
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The council **passes** only if **all agents pass**. This ensures:
|
|
130
|
+
- No single aspect degrades
|
|
131
|
+
- Issues in any dimension are caught
|
|
132
|
+
- Overall system quality is maintained
|
|
133
|
+
|
|
134
|
+
## Success Criteria
|
|
135
|
+
|
|
136
|
+
For the council to pass, we require:
|
|
137
|
+
|
|
138
|
+
| Agent | Metric | Target |
|
|
139
|
+
|-------|--------|--------|
|
|
140
|
+
| Structure | Tests passed | 100% |
|
|
141
|
+
| Edge-Case | Tests passed | 100% |
|
|
142
|
+
| Performance | Latency targets met | 100% |
|
|
143
|
+
| Integration | Pipeline tests passed | 100% |
|
|
144
|
+
| Cost Model | Cost accuracy | 100% |
|
|
145
|
+
|
|
146
|
+
## Running the Council
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Run all tests
|
|
150
|
+
node test-council/1-structure-tests.ts
|
|
151
|
+
node test-council/2-edge-case-tests.ts
|
|
152
|
+
node test-council/3-performance-tests.ts
|
|
153
|
+
node test-council/4-integration-tests.ts
|
|
154
|
+
node test-council/5-cost-model-tests.ts
|
|
155
|
+
|
|
156
|
+
# Or use the test runner
|
|
157
|
+
./test-council/run-all.sh
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Design Principles
|
|
161
|
+
|
|
162
|
+
1. **Independence**: Each test file runs standalone
|
|
163
|
+
2. **Isolation**: Tests don't depend on each other
|
|
164
|
+
3. **Clear reporting**: Pass/fail with actionable messages
|
|
165
|
+
4. **Focused scope**: Each agent has clear responsibilities
|
|
166
|
+
5. **Realistic inputs**: Tests use real-world query patterns
|
|
167
|
+
|
|
168
|
+
## Evolution
|
|
169
|
+
|
|
170
|
+
The council pattern can be extended:
|
|
171
|
+
|
|
172
|
+
- **Security Agent**: Input sanitization, injection attacks
|
|
173
|
+
- **Reliability Agent**: Network failure simulation
|
|
174
|
+
- **Scalability Agent**: Load testing with 1000+ concurrent users
|
|
175
|
+
- **Compatibility Agent**: Node.js version, dependency conflicts
|
|
176
|
+
|
|
177
|
+
## Credits
|
|
178
|
+
|
|
179
|
+
Inspired by:
|
|
180
|
+
- Ensemble methods in machine learning
|
|
181
|
+
- Agent councils in production LLM systems (Mixtral, GPT-4)
|
|
182
|
+
- Test-driven development principles
|
|
183
|
+
- Separation of concerns in software architecture
|