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