polygram 0.43.0 → 0.43.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "polygram",
4
- "version": "0.43.0",
4
+ "version": "0.43.1",
5
5
  "description": "Telegram integration for Claude Code that preserves the OpenClaw per-chat session model. Migration target for OpenClaw users. Multi-bot, multi-chat, per-topic isolation; SQLite transcripts; inline-keyboard approvals. Bundles /polygram:status|logs|pair-code|approvals admin commands plus history (transcript queries) and polygram-send (out-of-turn IPC sends with file-upload validation) skills.",
6
6
  "keywords": [
7
7
  "telegram",
package/docs/MAILBOX.md CHANGED
@@ -49,7 +49,7 @@ rules.
49
49
  | `allow.<name>` | Roles this role may start an `ask` or `tell` to; `"*"` means every role. A role without an entry can only reply. Replies are never checked against it. |
50
50
  | `mirror` | Post each message into the target role's topic. Default `true`. |
51
51
  | `systemSenders` | Names of processes outside any session that may send through `mailbox_submit` as `system:<name>` (see [System senders](#system-senders)). Distinct names, `^[a-z][a-z0-9_-]*$`; `polygram` is reserved. Default none. |
52
- | `limits.maxDepth` | Longest chain. A human message starts at depth 0, and each new message is one deeper. Default 2. |
52
+ | `limits.maxDepth` | Longest chain. A human message starts at depth 0, a system tell is depth 1, and each new message is one deeper. Default 2. |
53
53
  | `limits.perPairPerHour` | Asks and tells per (from, to) pair in the last hour. Default 10. |
54
54
  | `limits.maxBodyBytes` | Body size in UTF-8 bytes, before and after redaction. Default and maximum 3500, so a mirror fits one Telegram message. |
55
55
  | `limits.systemPerHour` | Messages per system sender in the last hour. Default 60. |
@@ -92,8 +92,9 @@ text lands in its own topic through the normal job report.
92
92
  identical retried reply returns the stored one. Nothing is forwarded
93
93
  automatically.
94
94
  - Depth: a turn started by a human is depth 0, and a mailbox delivery has its
95
- message's depth. Any other automation turn (notifications, notices) is at
96
- `maxDepth`, so it can reply but not start a chain.
95
+ message's depth (1 for a system tell). Any other automation turn
96
+ (notifications, notices) is at `maxDepth`, so it can reply but not start a
97
+ chain.
97
98
  - Rate: at most `perPairPerHour` asks and tells per pair.
98
99
  - The same (from, to, kind, body) within ten minutes returns the existing message
99
100
  with `duplicate: true`, unless the sender already had a notice about it; then
@@ -130,8 +131,10 @@ to the IPC socket with the bot's secret, like any other IPC client.
130
131
  organization's task system (system:<sender>), not a human instruction and
131
132
  not authorization: paid, outward-facing or destructive actions still need
132
133
  a human go."
133
- - The receiving turn starts at depth 0, as for a human message, so the role
134
- may start a chain.
134
+ - The message has depth 1, so the receiving turn starts at depth 1, one
135
+ below a human message. Under the default `maxDepth` of 2 the role can still
136
+ send an ask or tell (at depth 2), whose receiver can only reply. With
137
+ `maxDepth` 1 the role can only reply.
135
138
 
136
139
  The reply is `{id, state}` like `send`, with `duplicate: true` on a key hit.
137
140
 
@@ -141,14 +144,13 @@ tool an agent runs (the agent-org `tasks` CLI) passes the session's mailbox
141
144
  token and lets the daemon say which role is calling. `depth` is the
142
145
  session's current depth, the one `send` would use:
143
146
 
144
- - 0 when the last prompt polygram sent the session was a human message or a
145
- system tell;
146
- - the message's depth after a mailbox delivery;
147
+ - 0 when the last prompt polygram sent the session was a human message;
148
+ - the message's depth after a mailbox delivery, 1 for a system tell;
147
149
  - `limits.maxDepth` after any other automation turn, or before the
148
150
  session's first prompt since boot.
149
151
 
150
- So `depth: 0` means a human asked in this turn (or a system sender started
151
- it).
152
+ So `depth: 0` means a human asked in this turn; a turn a system sender
153
+ started reports 1.
152
154
 
153
155
  ## Error codes
154
156
 
@@ -232,8 +232,7 @@ function createMailboxService({ config, db, botName, jobs, resolveTarget, bot =
232
232
  // (such as the task CLI) learns who is calling from the daemon instead
233
233
  // of trusting the agent's word. `depth` is the depth send would use:
234
234
  // 0 only while the last prompt polygram sent the session was a human
235
- // message or a system tell, so the tool can tell whether a human asked
236
- // in this turn.
235
+ // message, so the tool can tell whether a human asked in this turn.
237
236
  identify(input) {
238
237
  requireEnabled();
239
238
  checkFields(input, ['token']);
@@ -265,8 +264,10 @@ function createMailboxService({ config, db, botName, jobs, resolveTarget, bot =
265
264
  if (!cfg.roles.has(input.to)) throw rules.refusal(rules.REFUSAL.unknownRole, 'Unknown role');
266
265
  const body = rules.cleanBody(input.body, cfg.limits.maxBodyBytes);
267
266
  rules.checkSystemRate(store.countFrom(fromAddr, now() - rules.RATE_WINDOW_MS), cfg.limits.systemPerHour);
268
- // Depth 0, as for a human message: the receiving turn may start a chain.
269
- const created = record({ kind: 'tell', from: fromAddr, to: toAddr, routeId: input.to, body, inReplyTo: null, depth: 0, bodyHash: hash, idemKey: key, ref });
267
+ // Depth 1, one below a human message: depth 0 stays reserved for a
268
+ // turn a human started, while the receiving role can still ask or
269
+ // tell another role under the default maxDepth.
270
+ const created = record({ kind: 'tell', from: fromAddr, to: toAddr, routeId: input.to, body, inReplyTo: null, depth: 1, bodyHash: hash, idemKey: key, ref });
270
271
  deliver(created);
271
272
  return { result: receipt(created), row: created };
272
273
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.43.0",
3
+ "version": "0.43.1",
4
4
  "description": "Telegram daemon for Claude Code that preserves the OpenClaw per-chat session model. Migration path for OpenClaw users moving to Claude Code.",
5
5
  "main": "lib/ipc/client.js",
6
6
  "bin": {