@nanobpm/nano-coder 1.1.0 → 1.3.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/README.md +56 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -407,7 +407,7 @@ argument: a type-ahead list narrows as you type and Tab completes it.
|
|
|
407
407
|
- `/help` - Show available commands
|
|
408
408
|
- `/compact [--smart|--standard] [focus]` - Summarize older messages with the current model,
|
|
409
409
|
keeping the latest message. `--smart` / `--standard` override `compaction_mode` for this
|
|
410
|
-
compaction (see [Smart compaction](#smart-compaction
|
|
410
|
+
compaction (see [Smart compaction](#smart-compaction)). Optional text tells the
|
|
411
411
|
summary what to focus on. Esc Esc or Ctrl-C cancels
|
|
412
412
|
- `/verbosity [quiet|normal|verbose|debug]` - Show or set how much is printed (see below)
|
|
413
413
|
- `/context` - Show context usage, window, session token totals, AI Credits (GitHub Copilot), auto-compaction state and the loaded instruction files
|
|
@@ -499,6 +499,45 @@ compiler can't check are wrapped in small, commented `@trusted` functions (share
|
|
|
499
499
|
uncommented `@trusted`, raw threads or `__gshared` outside `safeio.d`, or more `@trusted` than
|
|
500
500
|
the budgets in `scripts/` allow. The build uses `-preview=dip1000` and `-preview=nosharedaccess`.
|
|
501
501
|
|
|
502
|
+
Time goes through `nano.clock`: `wallNow`, `monoNow`, `since` and `sleepFor` instead of
|
|
503
|
+
`Clock.currTime`, `MonoTime.currTime`, `StopWatch` and `Thread.sleep`, which check-safe bans
|
|
504
|
+
elsewhere. A test can then install a `FakeClock` (per thread) to pick "now" and make sleeps
|
|
505
|
+
instant. Timeouts and grace periods that tests run into are parameters, so a test passes a
|
|
506
|
+
short one rather than waiting out the production value. The test runner
|
|
507
|
+
(`source/nano/testenv_test.d`) fails a module whose tests take over 1 s, unless
|
|
508
|
+
`scripts/slow-tests` gives it a higher limit and a reason; `NANO_TEST_TIMES=N dub test` lists the
|
|
509
|
+
N slowest modules. `NANO_TEST_JOBS=N` runs modules in parallel (`scripts/ci.sh` uses 4); modules
|
|
510
|
+
that change process-wide state (the cancel flag, environment variables) are listed in
|
|
511
|
+
`scripts/serial-tests` and run alone first.
|
|
512
|
+
|
|
513
|
+
Functions are `pure` wherever they can be: the result depends only on the arguments, with no
|
|
514
|
+
clock, environment, files or global state. Modules that start with `pure:` (parsing, markdown,
|
|
515
|
+
plans, context arithmetic, the status line and others) make up a pure core, and the I/O stays
|
|
516
|
+
in their callers. `pure:` doesn't reach member functions, so `source/nano/pure_core_test.d`
|
|
517
|
+
runs a compile-time audit (`nano.pureaudit`) over those modules. check-safe keeps that list in
|
|
518
|
+
step with the `pure:` modules, and the `pure` count and the number of pure modules can only
|
|
519
|
+
grow (`scripts/pure-floor`, `scripts/pure-module-floor`).
|
|
520
|
+
|
|
521
|
+
The pure core is also strongly pure: no public function takes a `ref`, `out` or other mutable
|
|
522
|
+
argument (the audit fails the build on one), so a call can't change what its caller passed.
|
|
523
|
+
Results come back as values, and so do errors: a function that can fail returns
|
|
524
|
+
`nano.result.Result!(T, E)` (`ok`/`err`, `match`, `map`, `andThen`, `toOption`, and
|
|
525
|
+
`orThrow!(e => new X(e))` for the code that still reports errors by throwing). A missing value is
|
|
526
|
+
`Option!T`. Inside the core, only the shell and TOML parsers throw, to unwind to their own entry
|
|
527
|
+
point, which returns the error. Their exception classes are private, and check-safe caps those
|
|
528
|
+
`throw`s (`scripts/pure-throw-budget`).
|
|
529
|
+
|
|
530
|
+
The agent loop is part of that core too. `nano.turn` is a state machine: `step(state, event)`
|
|
531
|
+
returns the next state and a list of effects. Events are what happened (a call is due, the model
|
|
532
|
+
replied, a call failed, tools ran, a Stop hook ran, compaction finished); effects are what to do
|
|
533
|
+
next (call the model, run the tools, continue a cut-off reply, run the Stop hook, finish). Every
|
|
534
|
+
decision in a turn is made in `step`: the turn cap, stream restarts, the output cap, compacting on
|
|
535
|
+
overflow, continuations, steers, Stop hook blocks and reported outcomes. `Agent.runTurn` only
|
|
536
|
+
carries effects out and feeds the results back in. `source/nano/turn_replay_test.d` replays
|
|
537
|
+
session logs through `step` and checks that each turn asks for what the log shows next and ends
|
|
538
|
+
with the recorded answer. Point `NANO_REPLAY_DIR` at a sessions directory to replay all of its
|
|
539
|
+
turns.
|
|
540
|
+
|
|
502
541
|
## Configuration
|
|
503
542
|
|
|
504
543
|
Create `~/.config/nano-coder/config.toml` (every field is optional). Directories from before the rename (`agentic-harness`, for config and for data such as sessions) are moved to `nano-coder` at startup when the new ones don't exist yet. A symlink is left at the old path so an older nano-coder still finds them. If that compatibility symlink can't be created, a warning is printed and the link is retried on later starts; if the move itself fails, the old directory is used:
|
|
@@ -518,7 +557,7 @@ session_titles = false # ask the model for a few-word title per
|
|
|
518
557
|
# title_model = "openai/gpt-4o-mini" # model for titles (default: the session's model)
|
|
519
558
|
auto_compact = true # summarize automatically when the context fills up
|
|
520
559
|
auto_compact_threshold = 0.8 # fraction of the context window
|
|
521
|
-
compaction_mode = "
|
|
560
|
+
compaction_mode = "smart" # smart | standard (see Smart compaction)
|
|
522
561
|
# context_window = 128000 # override the window (providers can set it too)
|
|
523
562
|
verbosity = "normal" # quiet | normal | verbose | debug (or --verbosity)
|
|
524
563
|
timestamps = true # prefix CLI messages with the local time (HH:MM:SS)
|
|
@@ -972,13 +1011,13 @@ another 10% of the window, so a context that can't shrink isn't summarized on ev
|
|
|
972
1011
|
If summarizing fails, the older messages are dropped with a note. The session log records
|
|
973
1012
|
the new conversation, so `--resume` continues from it.
|
|
974
1013
|
|
|
975
|
-
### Smart compaction
|
|
1014
|
+
### Smart compaction
|
|
976
1015
|
|
|
977
1016
|
A summary is lossy: whatever it leaves out is gone for the agent, even though the session
|
|
978
1017
|
log still has every original message. Smart compaction keeps the whole history reachable.
|
|
979
|
-
It is
|
|
980
|
-
|
|
981
|
-
|
|
1018
|
+
It is the default (`compaction_mode = "smart"`); set `compaction_mode = "standard"` for plain
|
|
1019
|
+
summaries, or override one compaction with `/compact --standard` or `--smart`. It needs a
|
|
1020
|
+
session log, and falls back to a standard summary when `persist_sessions` is off.
|
|
982
1021
|
|
|
983
1022
|
- **Message IDs.** A message's ID is the line of the session log where it was first
|
|
984
1023
|
recorded, shown as `#N`. IDs are stable across compactions and `--resume`.
|
|
@@ -1035,6 +1074,17 @@ makes any change, without having to decide to read them. Block-level `<!-- ... -
|
|
|
1035
1074
|
are removed first. Each file is capped at 32 KiB and the total at 64 KiB; a file over the
|
|
1036
1075
|
limit is named, with a note to read it with `read_file`.
|
|
1037
1076
|
|
|
1077
|
+
**Edits take effect at the next turn.** Before each prompt the files are read again. If what
|
|
1078
|
+
they add to the system prompt has changed (a file was edited, added or removed), the system
|
|
1079
|
+
prompt is rebuilt and a dim `[instruction files changed: ...]` line says so, so there's no
|
|
1080
|
+
need to restart and lose the conversation. Resuming a session (`--resume`) also rebuilds it
|
|
1081
|
+
from the current files. The provider's prompt cache misses once, on the turn after a change.
|
|
1082
|
+
Edits to rules scoped with `paths:` and the files they import are picked up too, as are edits
|
|
1083
|
+
to nested directories' files that already attached (including a file added there). After any
|
|
1084
|
+
change, rules and nested files attach afresh the next time a matching file is touched, so one
|
|
1085
|
+
already in the conversation may appear once more, but never in an old version.
|
|
1086
|
+
ACP sessions (`--acp`) still read the files once, when the session starts.
|
|
1087
|
+
|
|
1038
1088
|
**Imports.** `CLAUDE.md`, `CLAUDE.local.md`, rules and imported files can pull in other files
|
|
1039
1089
|
with `@path`, as in Claude Code: relative to the importing file, `~/` allowed, up to four
|
|
1040
1090
|
levels deep, each file once. Code spans and fenced code blocks are skipped, `\ ` escapes a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/nano-coder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A 4MB coding agent. Run a fleet on your laptop.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"node": ">=18"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@nanobpm/nano-coder-darwin-arm64": "1.
|
|
32
|
-
"@nanobpm/nano-coder-darwin-x64": "1.
|
|
33
|
-
"@nanobpm/nano-coder-linux-arm64": "1.
|
|
34
|
-
"@nanobpm/nano-coder-linux-x64": "1.
|
|
31
|
+
"@nanobpm/nano-coder-darwin-arm64": "1.3.0",
|
|
32
|
+
"@nanobpm/nano-coder-darwin-x64": "1.3.0",
|
|
33
|
+
"@nanobpm/nano-coder-linux-arm64": "1.3.0",
|
|
34
|
+
"@nanobpm/nano-coder-linux-x64": "1.3.0"
|
|
35
35
|
}
|
|
36
36
|
}
|