pi-session-mail 0.1.0 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,99 @@ follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.1] - 2026-10-02
10
+
11
+ ### Fixed
12
+
13
+ - `/mailbox` refuses with `mailbox: this session has no mailbox address; the
14
+ mailbox is off` when this session's mailbox is off (an unusable session id,
15
+ or a mail root it cannot create). Before, it showed the session id as the
16
+ address, failed a send with a raw error, and still pruned.
17
+
18
+ ## [0.2.0] - 2026-10-02
19
+
20
+ ### Added
21
+
22
+ - Mailbox folders of closed sessions are pruned. At session start, a folder is
23
+ removed when its session is not running, nothing is waiting in its `new/`
24
+ and its last activity (the newest change to the folder or its boxes) is
25
+ older than `pruneAfterDays` days, 30 unless `session-mail.json` sets it. An
26
+ invalid `pruneAfterDays` means 30, with a warning like `hopLimit`'s.
27
+ Pruning a folder removes its read mail (`cur/`) and its sent copies
28
+ (`sent/`) as well. Unread mail, a running session's folder, this session's
29
+ folder and `running/` are never removed, nor is anything that is not a real
30
+ folder named like an address. A folder is moved aside before it is removed,
31
+ so mail that arrives at that moment is put back, not lost.
32
+ - `/mailbox prune` removes every such folder at once, whatever its age, so a
33
+ closed session with no unread mail loses its folder, `cur/` and `sent/`
34
+ included, even if it closed a minute ago. It says
35
+ `Removed <N> mailbox folders of closed sessions`. `/mailbox prune <text>` is
36
+ still a message to a session named `prune`.
37
+ - A running record holds `started`, a token for its process's start time. A
38
+ record whose process id now belongs to a process that started at another
39
+ time counts as not running, so a crashed session no longer stays listed once
40
+ the operating system reuses its process id. Records without `started`
41
+ (written by 0.1.0), and platforms where the start time cannot be read, are
42
+ still judged by process id alone.
43
+ - The README states the minimum Pi version: 0.80.4 or later, tested with 1.0.0.
44
+ - The README says that mail can be lost on a power failure (nothing calls
45
+ `fsync`), that the mail root must be on a local filesystem, not NFS, and
46
+ that `awaiting` counts requests and asks.
47
+ - The README has a Compatibility section naming the stable contracts: the
48
+ hooks and their payloads, the `[mailbox]` lines, the mail root path, the
49
+ envelope fields, kinds and statuses, the tool and command names, and the
50
+ `session-mail.json` keys. Changing any of them needs a minor version while
51
+ the package is at 0.x and a major version from 1.0 on.
52
+ - Private vulnerability reporting is enabled, so the advisory form linked from
53
+ `SECURITY.md` works.
54
+ - A session warns at start when its own address folder grants group or other
55
+ permission, naming the folder and the `chmod 700` that fixes it. The folder
56
+ is not changed.
57
+ - A session whose state directory cannot be written warns
58
+ `mailbox: mailbox is off: <reason>` at start and runs without an address,
59
+ watcher or timer, instead of failing with a raw error and starting half-way.
60
+
61
+ ### Changed
62
+
63
+ - Settings warnings (`session-mail.json`) are shown once per distinct problem
64
+ per session, not once per session: a file with both keys invalid gives two
65
+ warnings, and a file edited to a different problem warns again. The warning
66
+ for an unreadable, invalid or non-object file now also names the pruning
67
+ fallback (30 days). A broken file now warns at session start, not at the
68
+ first send.
69
+ - **Contract change:** a `message:send` emitted during a run now carries that
70
+ run's hop count instead of 0, so two models delegating to each other through
71
+ an extension no longer escape the hop limit. Emitted while idle it still
72
+ carries 0. It is never refused at send time; the receiving side refuses
73
+ past the limit as a loop, as before.
74
+ - **Contract change:** an envelope with a `kind` this version does not know
75
+ is read as `message`: it is delivered, wakes the session and expects no
76
+ answer. The original value is not kept. Before, it was set aside with a
77
+ warning; the test that pinned that now covers only a bad hop count.
78
+ - Envelopes, in `new/` and in `sent/`, are written with mode `0600`; they were
79
+ `0644` under the usual umask.
80
+ - A mail root that already existed with looser permissions is set to `0700` at
81
+ session start, when this user can change it; a root this user cannot change
82
+ is still used as it is.
83
+ - Releases are published by the release workflow, with npm provenance, only
84
+ after lint, typecheck and tests pass on Node 22.19 and 24 and a smoke test
85
+ loads the packed package in Pi 1.0.0.
86
+ - The package entry is now `src/index.ts`; the sources moved into `src/`.
87
+ - A send writes the sender's `sent/` copy first and removes it when delivery
88
+ fails, so a thrown error means nothing was delivered; a failed delivery also
89
+ no longer leaves a file in the recipient's `tmp/`.
90
+ - A `*.json` name in `cur/` or `sent/` that is not a regular file is skipped
91
+ instead of read, so a planted FIFO or directory cannot hang a session.
92
+ - An envelope naming more than 50 requests in `in_reply_to` is set aside with a
93
+ warning.
94
+ - A reply quotes its requests from one listing of `sent/`, not one listing per
95
+ id.
96
+ - The `[mailbox]` label replaces control characters (C0 with tab included,
97
+ DEL, C1, and the separators U+2028 and U+2029) with spaces in the envelope id, the ids it
98
+ answers, its status, the sender's name and working directory, and the paths
99
+ it names, so a forged value cannot start a line that passes for a
100
+ `[mailbox]` line. The label text is otherwise unchanged.
101
+
9
102
  ## [0.1.0] - 2026-10-02
10
103
 
11
104
  The first public release. Before this repository the package lived in its
@@ -18,5 +111,7 @@ author's dotfiles; the changes below are against that copy.
18
111
  - CI on Node 22.19 and 24: lint, typecheck, tests, and a check of the
19
112
  published file list.
20
113
 
21
- [Unreleased]: https://github.com/gvanderclay/pi-session-mail/compare/v0.1.0...HEAD
114
+ [Unreleased]: https://github.com/gvanderclay/pi-session-mail/compare/v0.2.1...HEAD
115
+ [0.2.1]: https://github.com/gvanderclay/pi-session-mail/compare/v0.2.0...v0.2.1
116
+ [0.2.0]: https://github.com/gvanderclay/pi-session-mail/compare/v0.1.0...v0.2.0
22
117
  [0.1.0]: https://github.com/gvanderclay/pi-session-mail/releases/tag/v0.1.0