@nanobpm/nano-coder 0.14.0 → 0.15.1

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.
Files changed (2) hide show
  1. package/README.md +57 -5
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -102,8 +102,8 @@ instead of guessing from the stop reason: `blocked` means the model needs help (
102
102
  escalation). Redelivering the input returns the same outcome. See [Outcomes](#outcomes).
103
103
 
104
104
  **Slash commands work via ACP too:**
105
- - `/compact [focus]` - summarizes the conversation; the result has `compacted`, `before`,
106
- `after`, `tokensBefore`, `tokensAfter`, `summarized` and `fallback`
105
+ - `/compact [--smart|--standard] [focus]` - summarizes the conversation; the result has
106
+ `compacted`, `before`, `after`, `tokensBefore`, `tokensAfter`, `summarized`, `mode` and `fallback`
107
107
  - `/settings` - returns current settings as JSON
108
108
  - `/tools` - lists registered tools
109
109
  - `/plan` - returns `plan` (JSON) and `text` (the rendered plan)
@@ -273,8 +273,10 @@ argument set (`/model`, `/mode`, `/verbosity`) get the same treatment for their
273
273
  argument: a type-ahead list narrows as you type and Tab completes it.
274
274
 
275
275
  - `/help` - Show available commands
276
- - `/compact [focus]` - Summarize older messages with the current model, keeping the latest
277
- message. Optional text tells the summary what to focus on. Esc Esc or Ctrl-C cancels
276
+ - `/compact [--smart|--standard] [focus]` - Summarize older messages with the current model,
277
+ keeping the latest message. `--smart` / `--standard` override `compaction_mode` for this
278
+ compaction (see [Smart compaction](#smart-compaction-experimental)). Optional text tells the
279
+ summary what to focus on. Esc Esc or Ctrl-C cancels
278
280
  - `/verbosity [quiet|normal|verbose|debug]` - Show or set how much is printed (see below)
279
281
  - `/context` - Show context usage, window, session token totals, AI Credits (GitHub Copilot), auto-compaction state and the loaded instruction files
280
282
  - `/settings` - Interactive settings menu:
@@ -284,7 +286,7 @@ argument: a type-ahead list narrows as you type and Tab completes it.
284
286
  written with mode 0600) and default model
285
287
  - temperature, max tokens, system prompt
286
288
  - **Turn cap** (`max_iterations`): LLM calls per input; normal mode asks before stopping
287
- - **Context**: auto-compaction on/off, threshold, context-window override
289
+ - **Context**: auto-compaction on/off, threshold, compaction mode, context-window override
288
290
  - **Verbosity**
289
291
  - **Save to config file**: writes only the keys you changed into the config file
290
292
  (`--config` or `~/.config/nano-coder/config.toml`), keeping comments and
@@ -338,6 +340,7 @@ persist_sessions = true
338
340
  # session_dir = "/path/to/sessions" # default: <platform data dir>/nano-coder/sessions
339
341
  auto_compact = true # summarize automatically when the context fills up
340
342
  auto_compact_threshold = 0.8 # fraction of the context window
343
+ compaction_mode = "standard" # standard | smart (experimental, see Smart compaction)
341
344
  # context_window = 128000 # override the window (providers can set it too)
342
345
  verbosity = "normal" # quiet | normal | verbose | debug (or --verbosity)
343
346
  timestamps = true # prefix CLI messages with the local time (HH:MM:SS)
@@ -450,6 +453,22 @@ which becomes `openai` if it was `mock`.
450
453
  List a provider's models with `--list-models <provider>` (OpenAI-compatible endpoints and
451
454
  `github-copilot`).
452
455
 
456
+ ### Local servers on another machine (macOS)
457
+
458
+ macOS Local Network privacy can block nano-coder from reaching a model server on your
459
+ LAN (e.g. `http://192.168.0.141:8888/v1` or `http://merlin.local:11434/v1`). Requests fail
460
+ with `tcp connect error … No route to host (os error 65)`, while `curl` to the same URL
461
+ works. `localhost` is not affected.
462
+
463
+ - Allow it in **System Settings → Privacy & Security → Local Network**. The prompt and the
464
+ entry go to the app that launched nano-coder (your terminal, or the editor running it over
465
+ ACP). A locally built binary is unsigned, so macOS may treat each rebuild as a new app and
466
+ ask again.
467
+ - Or forward a local port, which needs no permission:
468
+ `ssh -N -L 18888:localhost:8888 user@192.168.0.141` (or `socat
469
+ TCP-LISTEN:18888,bind=127.0.0.1,fork TCP:192.168.0.141:8888`), then set
470
+ `base_url = "http://127.0.0.1:18888/v1"`.
471
+
453
472
  ### GitHub Copilot (unofficial)
454
473
 
455
474
  The `github-copilot` provider uses a GitHub Copilot subscription by authenticating **as the
@@ -565,6 +584,37 @@ another 10% of the window, so a context that can't shrink isn't summarized on ev
565
584
  If summarizing fails, the older messages are dropped with a note. The session log records
566
585
  the new conversation, so `--resume` continues from it.
567
586
 
587
+ ### Smart compaction (experimental)
588
+
589
+ A summary is lossy: whatever it leaves out is gone for the agent, even though the session
590
+ log still has every original message. Smart compaction keeps the whole history reachable.
591
+ It is off by default (`compaction_mode = "standard"`); try it on one compaction with
592
+ `/compact --smart`, or set `compaction_mode = "smart"` to use it for auto-compaction too.
593
+ It needs a session log, and falls back to a standard summary when `persist_sessions` is off.
594
+
595
+ - **Message IDs.** A message's ID is the line of the session log where it was first
596
+ recorded, shown as `#N`. IDs are stable across compactions and `--resume`.
597
+ - **Citing summary.** The summarizer sees each message labelled `[#N]` and is asked to cite
598
+ `(#N)` for details whose exact text may matter (errors, commands, outputs, the user's
599
+ wording) instead of copying them. The summary ends with the range it covers and a note
600
+ that the originals can be retrieved. Tool results clipped at compaction point at their ID.
601
+ - **History tools.** Once a smart summary is in the context, the agent gets two tools
602
+ over the current session's log (and only that one):
603
+ - `history_search(pattern, role?, before?, after?, limit?)` - case-insensitive regex (or
604
+ plain text) search, newest first, one `#N role name (time): snippet` line per match.
605
+ Earlier history lookups are not searched.
606
+ - `history_read(id, max_output_length?)` - one message in full, bounded like other tool
607
+ output (the whole is spilled to a file when it is longer).
608
+ Before a smart compaction the tools are not offered, so they cost nothing.
609
+
610
+ To judge whether it helps, the log records each compaction's `mode`, `model` and the
611
+ `summarized` line range (on the `replace` record), and each turn's `history_calls` (on
612
+ `turn_end`). `/context` shows the mode and this session's history-tool use.
613
+ `scripts/compaction-report.py [SESSION_DIR]` tabulates compacted sessions by model and mode:
614
+ compactions, turns after the first compaction, turns that used the history tools, and
615
+ reported outcomes. `eval/compaction/` has a harness that compares the two modes across
616
+ providers and models on synthetic or forked real sessions (see its README). See [#29](https://github.com/nanobpm/nano-coder/issues/29) for the design.
617
+
568
618
  ## Project Instructions
569
619
 
570
620
  When a session starts, the harness looks for instruction files in every directory from the
@@ -682,6 +732,8 @@ Resume a session with `--resume <id>` or ACP `session/load`.
682
732
  Record times and each message's `timestamp` are RFC 3339 with the local UTC offset
683
733
  (for example `2026-09-24T13:02:12.44+12:00`). Older logs with UTC times still load.
684
734
 
735
+ - Truncated tool output is kept whole in `<session_dir>/<id>.spill/`, so the paths in the
736
+ log stay valid after the process exits (temporary directory when sessions are not persisted).
685
737
  - An unsupported format version is an explicit error on resume.
686
738
  - Only records ending in a newline count as committed. A half-written last line from a
687
739
  crash is discarded and truncated before the next write.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanobpm/nano-coder",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "A 6MB coding agent. Run a fleet on your laptop.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "node": ">=18"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@nanobpm/nano-coder-darwin-arm64": "0.14.0",
35
- "@nanobpm/nano-coder-darwin-x64": "0.14.0",
36
- "@nanobpm/nano-coder-linux-arm64": "0.14.0",
37
- "@nanobpm/nano-coder-linux-x64": "0.14.0"
34
+ "@nanobpm/nano-coder-darwin-arm64": "0.15.1",
35
+ "@nanobpm/nano-coder-darwin-x64": "0.15.1",
36
+ "@nanobpm/nano-coder-linux-arm64": "0.15.1",
37
+ "@nanobpm/nano-coder-linux-x64": "0.15.1"
38
38
  }
39
39
  }