blob: 708284b3f920fec9892ad8ffae526150b8a89819 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# Phase 05 — Config swap
**Estimated time:** ~10 minutes
**Touches:** `lib/dispatch/adapter/minimax.rb`.
## Goal
Swap the four configuration constants in `lib/dispatch/adapter/minimax.rb`
so the adapter targets MiniMax instead of Anthropic.
| Constant | Old value | New value |
|---|---|---|
| `DEFAULT_BASE_URL` | `"https://api.anthropic.com"` | `"https://api.minimax.io/anthropic"` |
| `DEFAULT_MODEL` | `"claude-sonnet-4-5-20250929"` (or whatever) | `"MiniMax-M2.7"` |
| `MESSAGES_PATH` | `"/v1/messages"` | `"/v1/messages"` (UNCHANGED) |
| `COUNT_TOKENS_PATH` | `"/v1/messages/count_tokens"` | `"/v1/messages/count_tokens"` (UNCHANGED) |
| `MODELS_PATH` | `"/v1/models"` | `"/v1/models"` (UNCHANGED) |
The path constants stay because MiniMax mirrors the Anthropic SDK's URL
shape. Only the host changes.
## Steps
### 1. Update `DEFAULT_BASE_URL`
Find the constant declaration in `lib/dispatch/adapter/minimax.rb`:
```ruby
DEFAULT_BASE_URL = "https://api.anthropic.com"
```
Change it to:
```ruby
DEFAULT_BASE_URL = "https://api.minimax.io/anthropic"
```
### 2. Update `DEFAULT_MODEL`
Find:
```ruby
DEFAULT_MODEL = "claude-sonnet-4-5-20250929"
```
(The exact string may differ — find whatever the current default is.)
Change it to:
```ruby
DEFAULT_MODEL = "MiniMax-M2.7"
```
### 3. Verify path constants are present
Confirm the gem still defines (do NOT change them):
- `MESSAGES_PATH = "/v1/messages"`
- `COUNT_TOKENS_PATH = "/v1/messages/count_tokens"`
- `MODELS_PATH = "/v1/models"`
If any of these are inlined as strings in method bodies rather than
constants, leave them inlined — do not refactor.
### 4. Update any `DEFAULT_BASE_URL` or `DEFAULT_MODEL` references in specs
Run `grep -rn 'api.anthropic.com\|claude-sonnet-4' spec/`. For every
match in a spec file:
- If the spec is asserting the *old* default value, update the assertion
to the new value.
- If the spec is using the URL/model in a `stub_request` for an
Anthropic-shaped fixture, leave the stub alone for now — fixture work
is in phase 12 and spec retargets are in phases 13–16.
You may NOT delete or weaken any spec to make it pass. Only update
hardcoded references that genuinely must follow the constant rename.
## Acceptance criteria
- `grep -rn 'https://api.anthropic.com' lib/` returns ZERO matches.
- `grep -rn 'claude-sonnet' lib/` returns ZERO matches.
- `DEFAULT_BASE_URL == "https://api.minimax.io/anthropic"` (verified by
`bundle exec ruby -e 'require "./lib/dispatch/adapter/minimax"; \
puts Dispatch::Adapter::MiniMax::DEFAULT_BASE_URL'`).
- `DEFAULT_MODEL == "MiniMax-M2.7"`.
- `bundle exec rubocop --autocorrect-all` exits 0.
## Verification
Run `run_tests` with `project_path=reference/dispatch-adapter-minimax`.
Rubocop must be clean. RSpec failures from fixtures and specs that still
reference Anthropic URLs are acceptable — they're cleaned up in phases
12–16. RSpec failures NOT explainable by Anthropic URL/model references
must be investigated and fixed before calling `ask_for_next_plan`.
|