Commit 448383c
refactor: remove Responses API, consolidate to Chat Completions (#272)
* fix: strip reasoning from LLM responses and persist assistant messages reliably
- Filter out `type: "reasoning"` output items from NEAR AI Responses API
parsing so chain-of-thought never reaches the UI (nearai.rs)
- Rewrite clean_response with regex-based tag stripping that is
code-aware (preserves tags inside fenced blocks and inline backticks),
supports 9+ tag names (think, thought, reasoning, reflection, etc.),
handles <final> extraction, pipe-delimited tags, and case/whitespace
tolerance (reasoning.rs)
- Add Reasoning::complete() helper so all non-agentic LLM call sites
(summarize, suggest, heartbeat, compaction) get automatic response
cleaning; thread SafetyLayer through to those callers
- Change persist_turn from fire-and-forget tokio::spawn to awaited async
so both user and assistant messages are written before returning,
preventing data loss on shutdown/restart
- Pass input_count through seed_response_chain so response chaining
delta calculation is accurate after thread hydration on restart
- Make NearAiResponse.usage optional and preserve response_id in alt
response path for chaining continuity
- Persist session token to DB during onboarding wizard so runtime
loads it without legacy-key fallback; suppress spurious warning on
fresh installs
- Fix dev tool double-registration when builder already registers them
- Load dotenv/ironclaw env for doctor and status subcommands
- Reduce startup log noise (demote info→debug for skills, remove
redundant info lines)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Nudge to not loop over tools continuesly
* refactor: remove Responses API, consolidate NEAR AI to Chat Completions only
The Responses API provider (nearai.rs, 1278 lines) added significant complexity
(response chaining state machine, delta message calculation, previous_response_id
persistence) for marginal benefit. This consolidates to the Chat Completions API
only, upgrading NearAiChatProvider with dual auth (session token + API key) and
401 retry for session token renewal.
- Delete src/llm/nearai.rs (Responses API provider)
- Upgrade nearai_chat.rs with SessionManager, dual auth, flexible list_models
- Remove response_id from CompletionResponse and ToolCompletionResponse
- Remove seed_response_chain/get_response_chain_id from LlmProvider trait
- Remove response chain persistence from agent (thread_ops, session)
- Remove NearAiApiMode enum and NEARAI_API_MODE config
- Clean up all wrapper providers (retry, circuit_breaker, failover, cache)
- Update documentation (CLAUDE.md, .env.example)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: runtime log level control via gateway UI and URL parameter
Add server-side log level switching using tracing_subscriber::reload::Layer
so the EnvFilter can be swapped at runtime without restarting. Expose via
GET/PUT /api/logs/level endpoints, a "Server: LEVEL" dropdown in the logs
toolbar, and a ?log_level=debug URL parameter for one-click activation.
Also applies cargo fmt to pre-existing files (llm/, tests/).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7df356c commit 448383c
38 files changed
Lines changed: 1319 additions & 1773 deletions
File tree
- benchmarks/src
- src
- agent
- channels/web
- static
- config
- llm
- setup
- skills
- worker
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
| 123 | + | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
| |||
339 | 338 | | |
340 | 339 | | |
341 | 340 | | |
342 | | - | |
343 | | - | |
344 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
345 | 344 | | |
346 | | - | |
| 345 | + | |
347 | 346 | | |
348 | | - | |
349 | 347 | | |
350 | 348 | | |
351 | 349 | | |
| |||
408 | 406 | | |
409 | 407 | | |
410 | 408 | | |
411 | | - | |
| 409 | + | |
412 | 410 | | |
413 | | - | |
414 | | - | |
415 | | - | |
| 411 | + | |
416 | 412 | | |
417 | 413 | | |
418 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | 185 | | |
187 | 186 | | |
188 | 187 | | |
| |||
196 | 195 | | |
197 | 196 | | |
198 | 197 | | |
199 | | - | |
200 | 198 | | |
201 | 199 | | |
202 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | 361 | | |
366 | 362 | | |
367 | 363 | | |
| |||
373 | 369 | | |
374 | 370 | | |
375 | 371 | | |
| 372 | + | |
376 | 373 | | |
377 | 374 | | |
378 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
| |||
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
298 | | - | |
299 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
300 | 302 | | |
301 | | - | |
| 303 | + | |
302 | 304 | | |
303 | 305 | | |
304 | 306 | | |
| |||
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
345 | | - | |
346 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
347 | 350 | | |
348 | | - | |
| 351 | + | |
349 | 352 | | |
350 | 353 | | |
351 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
41 | | - | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
234 | | - | |
235 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
115 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| |||
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
146 | 166 | | |
147 | 167 | | |
148 | 168 | | |
| |||
162 | 182 | | |
163 | 183 | | |
164 | 184 | | |
165 | | - | |
166 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
167 | 188 | | |
168 | 189 | | |
169 | 190 | | |
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
173 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
174 | 203 | | |
175 | 204 | | |
176 | 205 | | |
| |||
799 | 828 | | |
800 | 829 | | |
801 | 830 | | |
802 | | - | |
803 | 831 | | |
804 | 832 | | |
805 | 833 | | |
| |||
813 | 841 | | |
814 | 842 | | |
815 | 843 | | |
816 | | - | |
817 | 844 | | |
818 | 845 | | |
819 | 846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| |||
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
261 | | - | |
| 265 | + | |
| 266 | + | |
262 | 267 | | |
263 | 268 | | |
264 | 269 | | |
265 | 270 | | |
266 | | - | |
| 271 | + | |
267 | 272 | | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
| 276 | + | |
280 | 277 | | |
281 | 278 | | |
282 | 279 | | |
| |||
355 | 352 | | |
356 | 353 | | |
357 | 354 | | |
| 355 | + | |
358 | 356 | | |
359 | 357 | | |
360 | | - | |
| 358 | + | |
361 | 359 | | |
362 | 360 | | |
363 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | 188 | | |
193 | 189 | | |
194 | 190 | | |
| |||
205 | 201 | | |
206 | 202 | | |
207 | 203 | | |
208 | | - | |
209 | 204 | | |
210 | 205 | | |
211 | 206 | | |
| |||
222 | 217 | | |
223 | 218 | | |
224 | 219 | | |
225 | | - | |
226 | 220 | | |
227 | 221 | | |
228 | 222 | | |
| |||
863 | 857 | | |
864 | 858 | | |
865 | 859 | | |
866 | | - | |
867 | 860 | | |
868 | 861 | | |
869 | 862 | | |
| |||
873 | 866 | | |
874 | 867 | | |
875 | 868 | | |
876 | | - | |
877 | 869 | | |
878 | 870 | | |
879 | 871 | | |
| |||
0 commit comments