# Jiva v0.3.42 — Provider-Agnostic Architecture & Developer Experience

**Release Date:** March 28, 2026
**Branch:** `develop`

---

## Highlights

- **Any OpenAI-compatible provider** — Krutrim, Groq, Sarvam, or custom endpoint, all via one `ModelClient`
- **Revamped `jiva setup`** — provider selection wizard with per-provider presets
- **Sarvam-105B** first-class support as a reasoning model
- **Conversation type awareness** — chat and code sessions are stored and filtered separately; code sessions remember their workspace
- **Agent stop** — Ctrl+C (CLI) or `POST /api/chat/stop` / WebSocket `stop` message gracefully halts a running turn
- **Code mode resilience** — tool-call JSON parse failures no longer break the agent loop early
- Three Worker / Session-Manager bug fixes

---

## New Features

### Provider-Agnostic Model Client
`KrutrimModel` → `ModelClient`, `KrutrimConfig` → `ModelClientConfig`. All provider behaviour is config-driven. Old names remain as deprecated re-exports.

New config fields: `reasoningEffortStrategy` (`api_param` | `system_prompt` | `both`), `defaultMaxTokens`, `includeReasoning`.

### Provider-Aware Setup Wizard
`jiva setup` presents a provider menu (Krutrim, Groq, Sarvam, OpenAI-Compatible). Selecting a provider fills in endpoint, model name, harmony format, and reasoning strategy automatically. API keys asked once per provider.

See [`docs/guides/CONFIGURATION.md`](../guides/CONFIGURATION.md) for provider presets and config schema.

### Sarvam-105B Support
Full support as a reasoning model: `reasoning_content` field normalised, `defaultMaxTokens: 8192` auto-set by wizard to prevent token-budget exhaustion.

See [`docs/guides/SARVAM-105B_CALLING_GUIDE.md`](../guides/SARVAM-105B_CALLING_GUIDE.md).

### Conversation Type Awareness
Conversations are tagged `type: 'chat'` or `type: 'code'`. `/list` and `/load` show only the sessions relevant to the current mode. Code sessions remember their workspace directory — loading one in code mode automatically switches the workspace and restarts LSP.

Existing conversations with no type field are treated as `chat` for backward compatibility.

### Agent Stop
A running agent turn can now be stopped cooperatively (finishes the current model call, then exits cleanly):

| Interface | How |
|-----------|-----|
| CLI (any mode) | **Ctrl+C** once while agent is running |
| HTTP REST | `POST /api/chat/stop` |
| HTTP WebSocket | `{ "type": "stop" }` message |

See [`docs/deployment/HTTP_API.md`](../deployment/HTTP_API.md).

---

## Bug Fixes

### Code Mode: Tool-Call JSON Parse Errors No Longer Break the Loop
`tool_use_failed` / `Failed to parse tool call arguments as JSON` errors are now tracked by a dedicated counter (`consecutiveToolCallErrors`, max 6) separate from the generic API error counter (max 3). The loop no longer breaks early after 3 tool-call corrections. After 6 consecutive failures a strategy-reset message is injected.

### Worker Agent: Context-Overflow Death Spiral Fixed
Retry loop now detects `context_length_exceeded` and equivalent errors, breaks immediately, and attempts lightweight synthesis instead of growing the context with each retry.

### HTTP Session Manager: `useHarmonyFormat` No Longer Hardcoded
Previously always `true` for reasoning models; now reads from config, defaults to `false`.

### HTTP Session Manager: `defaultModel` Fallback
Falls back to `defaultModel` when `model` is absent in config JSON.

---

## New Documentation

| File | Description |
|------|-------------|
| [`docs/deployment/HTTP_API.md`](../deployment/HTTP_API.md) | Full HTTP REST + WebSocket API reference |
| [`docs/guides/SARVAM-105B_CALLING_GUIDE.md`](../guides/SARVAM-105B_CALLING_GUIDE.md) | Sarvam-105B integration guide |

---

## Breaking Changes
None. All renamed exports (`KrutrimModel`, `KrutrimConfig`, `createKrutrimModel`) remain as deprecated aliases.

## Upgrade

```bash
npm install -g jiva-core@0.3.42
jiva setup   # optional: re-run wizard to pick a provider preset
```
