micro-models-agent 0.61.1 → 0.63.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,32 @@ All notable changes to Micro Models Agent (MMA) will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.63.0] - 2026-09-17
8
+
9
+ ### Added
10
+ - **REPL `/provider add`**: add a provider without leaving the agent. Mirrors `mma provider add` — `/provider add <name> [--url <url>] [--key <key>] [--priority <n>] [--context-window <n>] [--rpm <n>] [--parallel <n>]`. Seeds the legacy provider into `provider.entries` on first use, saves the config and hot-reloads the agent; switch with `/provider use <name>`. `/provider` autocompletion now includes `add`; i18n `repl.provider_add_missing_value`, `repl.provider_switch_hint` (en+ru).
11
+
12
+ ### Changed
13
+ - **Subcommand dispatch via handler maps** (new architecture rule #17): `/provider`, `/model` and `/skill` (`src/cli/repl-commands.ts`) and `SkillNameProvider.complete` (`src/cli/completer.ts`) now resolve subcommands through a `Record<string, handler>` map instead of `if (subcmd === …)` chains.
14
+
15
+ ## [0.62.0] - 2026-09-17
16
+
17
+ ### Added
18
+ - **Prompt-cache awareness (cloud + local)**: every provider declares its cache behavior via a new `CacheCapability` (`ProviderCapabilities.cache`, overridable per entry with `provider.entries[].cache`). The OpenAI-compatible provider now sends the right request hints per backend — `cache_prompt` (llama.cpp), `prompt_cache_key` (OpenAI), `session_id` (OpenRouter sticky routing) — while `x-opencode-session` is gated by `sessionHeader` (legacy behavior preserved when no capability is set). `parseCacheUsage` (`src/llm/cache-usage.ts`) normalizes response formats (OpenAI/LM Studio/llama.cpp/vLLM/OpenRouter/Zen/Go, DeepSeek, Anthropic, Ollama) into `Chunk.usage.cache`.
19
+ - **Cache metrics & savings**: `ModelPrice.cachedInput`/`cacheWrite`, `calculateCostDetailed` and `CostTracker.saved` bill cached reads at the cached rate and report the savings; builtin cached-read prices for MiniMax/GLM. A client-side prefix monitor (`src/core/agent/prefix-monitor.ts`) classifies why a cacheable prefix broke (`system`/`tools`/`history`/`volatile`) even when the provider reports nothing.
20
+ - **Cache display**: a single footer line (`Cache: 87% hit · saved $0.42`, or `Prefix stable: 93% · broke: tool set`) in the REPL, single-run result and `--json` (`cache`); `mma session show <id>` aggregates `llm_usage` into token totals and cache hit rate.
21
+ - **Streaming usage**: OpenAI-compatible streaming requests now send `stream_options: { include_usage: true }` (new `CacheCapability.requestStreamUsage`, on by default for OpenAI-shaped providers), so backends that only report usage in the final chunk — LM Studio, vLLM, OpenAI, OpenRouter — return real token counts (and `cached_tokens` where available) instead of the local chars/4 estimate.
22
+ - **`mma usage`**: shows the active provider's balance/usage. OpenRouter is supported (`GET /key` for per-key usage/limit, plus `GET /credits` for account balance when a management key is configured); other providers report that they do not expose an API balance (OpenCode Zen/Go show it in the web dashboard).
23
+
24
+ ### Changed
25
+ - **Code comments are Russian** (new architecture rule #15).
26
+ - **Cross-platform rule** (new architecture rule #16): processes/paths/shell/FS code must work on Windows, macOS and Linux (no `mklink`, no `npx` for local tools, quote paths, skip-not-fail tests when an OS lacks a primitive).
27
+
28
+ ### Fixed
29
+ - **One-shot subcommands hung when piped**: `mma session show <id> | cat` never exited because `bootstrap()` fired the background startup health check, which spawns an LSP/npx child that `process.exit` does not reap — the orphan kept the stdout pipe open. Subcommands never run an agent, so `setOneShotMode` now skips that check (detected in `main.ts` before `program.parse`). The recursive `postAction → process.exit(0)` hook (nested subcommands previously never fired it) is kept, and the startup check's `npx tsc` fallback now uses the local tsc.
30
+ - **Prefix-cache line false alarm**: the footer treated the first iteration (`cause: unknown`, ratio 0) and normal history appends (`cause: none`) as a broken prefix. It now shows `Prefix stable …` only for a real break (`system`/`tools`/`history`/`volatile`) and surfaces the most recent such break even if later iterations are stable again.
31
+ - **TypeScript checks were slow and unreliable**: syntax/type checks shelled out to `npx tsc`, which on Windows takes 5–13s (and tries the network without a local `typescript`), tripping test timeouts and stalling writes. New `resolveTscCommand` (`src/modules/lsp/project-root.ts`) runs the nearest local `tsc` via the current runtime (`process.execPath`), used by `verifier.ts`, `lint-on-write.ts` and `audit-runners.ts`; when no local tsc exists the check is skipped fast instead of hanging. The nested-project verifier test now links TypeScript with a cross-platform `symlinkSync(..., "junction")` instead of Windows-only `mklink`, and `bash.test.ts` resets the leaked grace window between tests.
32
+
7
33
  ## [0.61.1] - 2026-09-16
8
34
 
9
35
  ### Fixed
package/dist/i18n/en.json CHANGED
@@ -494,7 +494,9 @@
494
494
  "repl.provider_list": "List configured providers or hot-swap the active one",
495
495
  "repl.provider_current": "Current provider",
496
496
  "repl.provider_set": "Provider set to: {name}",
497
- "repl.provider_usage": "/provider list - show entries (* = active, prio = fallback order) | /provider use <name> - switch without restart",
497
+ "repl.provider_usage": "/provider list - show entries (* = active, prio = fallback order) | /provider use <name> - switch without restart | /provider add <name> [--url <url>] [--key <key>] [--priority <n>] [--context-window <n>] [--rpm <n>] [--parallel <n>] - add to config",
498
+ "repl.provider_add_missing_value": "Missing value for {flag}",
499
+ "repl.provider_switch_hint": "Switch to it with: /provider use {name}",
498
500
  "repl.model_list": "List models of the active provider or switch the model",
499
501
  "repl.model_current": "Current model",
500
502
  "repl.model_set": "Model set to: {name}",
@@ -712,6 +714,25 @@
712
714
  "repl.cost": "Total cost: {cost}",
713
715
  "repl.cost_breakdown": "By provider: {breakdown}",
714
716
  "repl.tokens": "Tokens used: {tokens}",
717
+ "repl.cache": "Cache: {hit}% hit · saved {saved}",
718
+ "repl.cache_nosave": "Cache: {hit}% hit",
719
+ "repl.prefix": "Prefix stable: {stable}% · broke: {cause}",
720
+ "cache.cause.system": "system prompt",
721
+ "cache.cause.tools": "tool set",
722
+ "cache.cause.history": "history",
723
+ "cache.cause.volatile": "volatile content",
724
+ "cache.cause.unknown": "unknown",
725
+ "cli.session_usage": "API usage: {prompt} prompt + {completion} completion = {total} tokens",
726
+ "cli.session_cache": "Cache: {hit}% hit ({cached} cached / {uncached} uncached)",
727
+ "cli.usage": "Show provider balance/usage (OpenRouter)",
728
+ "cli.usage_unsupported": "Provider \"{provider}\" does not expose an API balance. Only OpenRouter does; OpenCode Zen/Go show it in the web dashboard.",
729
+ "cli.usage_no_key": "No API key configured for the active provider.",
730
+ "cli.usage_error": "Failed to fetch balance: {error}",
731
+ "cli.usage_key_usage": "Key usage: {usage}",
732
+ "cli.usage_key_limit": "Key limit: {limit} · remaining {remaining}",
733
+ "cli.usage_balance": "Balance: {balance}",
734
+ "cli.usage_account": "Account: {credits} purchased · {used} used",
735
+ "cli.usage_empty": "No balance information returned.",
715
736
  "repl.ctrl_c_interrupt": "\n[Ctrl+C] Stopping agent... (press again to force)",
716
737
  "exec.stop_directive": "STOP. Step {stepId} (\"{description}\") took {iterations} iterations with no progress. DO NOT continue this step. Immediately call: plan update step={stepId} status=done (if code works despite warnings) OR plan update step={stepId} status=skipped note=\"reason\". Do NOT make any other tool calls before updating the plan.",
717
738
  "exec.test_runner_fail": "[test-runner] {framework}: {failed} test(s) FAILING, {passed} passing — do NOT mark verification steps as done while tests fail. Investigate the failures, fix the code, then re-run the tests.",
package/dist/i18n/ru.json CHANGED
@@ -488,7 +488,9 @@
488
488
  "repl.provider_list": "Список настроенных провайдеров или горячая смена активного",
489
489
  "repl.provider_current": "Текущий провайдер",
490
490
  "repl.provider_set": "Провайдер установлен: {name}",
491
- "repl.provider_usage": "/provider list — записи (* = активный, prio = порядок fallback) | /provider use <имя> — смена без перезапуска",
491
+ "repl.provider_usage": "/provider list — записи (* = активный, prio = порядок fallback) | /provider use <имя> — смена без перезапуска | /provider add <имя> [--url <url>] [--key <ключ>] [--priority <n>] [--context-window <n>] [--rpm <n>] [--parallel <n>] — добавить в конфиг",
492
+ "repl.provider_add_missing_value": "Нет значения для {flag}",
493
+ "repl.provider_switch_hint": "Переключитесь на него: /provider use {name}",
492
494
  "repl.model_list": "Список моделей активного провайдера или смена модели",
493
495
  "repl.model_current": "Текущая модель",
494
496
  "repl.model_set": "Модель установлена: {name}",
@@ -712,6 +714,25 @@
712
714
  "repl.cost": "Итого потрачено: {cost}",
713
715
  "repl.cost_breakdown": "По провайдерам: {breakdown}",
714
716
  "repl.tokens": "Потрачено токенов: {tokens}",
717
+ "repl.cache": "Кеш: {hit}% попаданий · сэкономлено {saved}",
718
+ "repl.cache_nosave": "Кеш: {hit}% попаданий",
719
+ "repl.prefix": "Префикс стабилен: {stable}% · сломалось: {cause}",
720
+ "cache.cause.system": "системный промпт",
721
+ "cache.cause.tools": "набор инструментов",
722
+ "cache.cause.history": "история",
723
+ "cache.cause.volatile": "волатильное содержимое",
724
+ "cache.cause.unknown": "неизвестно",
725
+ "cli.session_usage": "API-использование: {prompt} prompt + {completion} completion = {total} токенов",
726
+ "cli.session_cache": "Кеш: {hit}% попаданий ({cached} из кеша / {uncached} новых)",
727
+ "cli.usage": "Показать баланс/расход провайдера (OpenRouter)",
728
+ "cli.usage_unsupported": "Провайдер \"{provider}\" не отдаёт баланс по API. Это умеет только OpenRouter; OpenCode Zen/Go показывают его в веб-дашборде.",
729
+ "cli.usage_no_key": "Для активного провайдера не настроен API-ключ.",
730
+ "cli.usage_error": "Не удалось получить баланс: {error}",
731
+ "cli.usage_key_usage": "Расход по ключу: {usage}",
732
+ "cli.usage_key_limit": "Лимит ключа: {limit} · осталось {remaining}",
733
+ "cli.usage_balance": "Баланс: {balance}",
734
+ "cli.usage_account": "Аккаунт: куплено {credits} · израсходовано {used}",
735
+ "cli.usage_empty": "Провайдер не вернул данных о балансе.",
715
736
  "repl.ctrl_c_interrupt": "\n[Ctrl+C] Остановка агента... (ещё раз — принудительно)",
716
737
  "exec.stop_directive": "STOP. Step {stepId} (\"{description}\") took {iterations} iterations with no progress. DO NOT continue this step. Immediately call: plan update step={stepId} status=done (if code works despite warnings) OR plan update step={stepId} status=skipped note=\"reason\". Do NOT make any other tool calls before updating the plan.",
717
738
  "exec.test_runner_fail": "[test-runner] {framework}: {failed} test(s) FAILING, {passed} passing — do NOT mark verification steps as done while tests fail. Investigate the failures, fix the code, then re-run the tests.",