@imenam/mcp-messenger 1.0.28 → 1.0.29

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 CHANGED
@@ -136,11 +136,10 @@ enable_notifications() → retourne immédiatement, ne bloque rien
136
136
  Last step — call the Monitor tool now, with exactly these arguments:
137
137
  command: npx -y @imenam/mcp-messenger --watch box_9f2c4a01b3d7e5f8
138
138
  description: Incoming messenger messages
139
- persistent: true
139
+ timeout_ms: 1800000
140
140
  ```
141
141
 
142
- L'agent recopie ces trois arguments dans l'outil `Monitor` de son hôte, et c'est fini pour la
143
- session. Le veilleur tourne en fond, tient une attente longue sur `/api/wait`, et écrit **une
142
+ L'agent recopie ces trois arguments dans l'outil `Monitor` de son hôte. Le veilleur tourne en fond, tient une attente longue sur `/api/wait`, et écrit **une
144
143
  ligne par message** sur sa sortie standard :
145
144
 
146
145
  ```
@@ -149,6 +148,13 @@ ligne par message** sur sa sortie standard :
149
148
 
150
149
  Chaque ligne réveille l'agent, qui appelle `read_message` s'il décide de traiter le message.
151
150
 
151
+ **Réarmer à l'expiration.** Claude Code arrête tout `Monitor` au bout de 30 minutes au plus,
152
+ quelle que soit la durée demandée, et prévient l'agent. Ce minuteur appartient à l'hôte : le
153
+ veilleur ne peut ni le prolonger ni le remettre à zéro. L'agent relance donc le même appel
154
+ `Monitor` à chaque expiration, sans repasser par `enable_notifications` — la réponse de cet
155
+ outil, les instructions du serveur et le bloc `CLAUDE.md` le lui disent. Le délai de grâce
156
+ décrit plus bas couvre l'intervalle : `whoami` reste à « armed » pendant le réarmement.
157
+
152
158
  **Pourquoi deux appels et pas un.** Armer un réveil, c'est ouvrir un canal vers la boucle de
153
159
  la session hôte. Un serveur MCP ne peut pas le faire seul : `Monitor` est un outil de l'hôte,
154
160
  seul le modèle peut l'appeler. `enable_notifications` fait donc tout le reste — il connaît
@@ -56,6 +56,10 @@ Au démarrage de la session, avant toute autre chose : appeler \`enable_notifica
56
56
  puis armer l'outil \`Monitor\` avec la commande exacte qu'il retourne. Sans cela, aucun
57
57
  message ne parviendra à l'agent — il ne l'apprendra qu'en appelant \`list_messages\`.
58
58
 
59
+ L'hôte arrête le veilleur au bout de 30 minutes au plus. À chaque expiration signalée,
60
+ le réarmer aussitôt avec le même appel \`Monitor\`, sans repasser par
61
+ \`enable_notifications\`.
62
+
59
63
  Une fois le veilleur armé, ne rien attendre : les messages entrants interrompent l'agent
60
64
  d'eux-mêmes, y compris à l'arrêt. \`wait_for_message\` ne sert plus qu'à bloquer
61
65
  volontairement sur une réponse précise.
@@ -39,7 +39,8 @@ Resuming earlier work:
39
39
  Writing:
40
40
  - One message goes to exactly one mailbox, and never to your own. To reach several correspondents, send each one its own message.
41
41
  - Never write a mailbox address in the body of a message. The server attaches the sender and the recipient to every message, and the reader sees them: an address copied by hand adds nothing and misleads as soon as it is stale or mistaken.
42
- - Call \`enable_notifications\` once at the start of the session and arm the watcher it hands you. Until then, no incoming message reaches you.`;
42
+ - Call \`enable_notifications\` once at the start of the session and arm the watcher it hands you. Until then, no incoming message reaches you.
43
+ - The host stops that watcher after 30 minutes at most. Each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good.`;
43
44
  /** Serveur MCP prêt à être branché sur n'importe quel transport (stdio en production, mémoire en test). */
44
45
  export function createMcpServer(client) {
45
46
  const server = new Server({ name: "mcp-messenger", version: APP_VERSION }, { capabilities: { tools: {} }, instructions: INSTRUCTIONS });
@@ -5,6 +5,8 @@ import { rebind } from "./mailbox-registry.js";
5
5
  import { forgetCandidate, getResumeState } from "./resume-state.js";
6
6
  /** Nom publié : l'agent recopie la commande, il n'a pas à connaître de chemin local. */
7
7
  const PACKAGE_NAME = "@imenam/mcp-messenger";
8
+ /** Durée maximale d'un `Monitor` côté hôte : au-delà, l'hôte la ramène à cette valeur. */
9
+ const MONITOR_TIMEOUT_MS = 1_800_000;
8
10
  const FOLDER_HINT = `Folder name. System folders: ${SYSTEM_FOLDERS.join(", ")}. Custom folders come from list_folders.`;
9
11
  export const TOOLS = [
10
12
  {
@@ -217,7 +219,7 @@ export const TOOLS = [
217
219
  },
218
220
  {
219
221
  name: "enable_notifications",
220
- description: "Get notified of incoming messages without waiting for them. Returns immediately: it blocks nothing and starts nothing on its own. It hands you the exact Monitor call to make right after — arming that watcher is what actually delivers notifications, and until you do it no message will reach you. Call this once at the start of a session, before any other work; then just keep working, incoming messages will interrupt you on their own.",
222
+ description: "Get notified of incoming messages without waiting for them. Returns immediately: it blocks nothing and starts nothing on its own. It hands you the exact Monitor call to make right after — arming that watcher is what actually delivers notifications, and until you do it no message will reach you. Call this once at the start of a session, before any other work; then just keep working, incoming messages will interrupt you on their own. The host stops the watcher after 30 minutes at most: re-arm it with the same Monitor call each time it expires.",
221
223
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
222
224
  },
223
225
  {
@@ -522,6 +524,9 @@ export async function callTool(client, name, rawArgs) {
522
524
  `Notifications are already live on mailbox \`${mailbox}\` (watcher armed since ${stats.watcher.since}).`,
523
525
  "Nothing to do: keep working, incoming messages will interrupt you on their own.",
524
526
  "Do not arm a second watcher — you would get every message twice.",
527
+ "Only exception: if the host just told you your watcher expired or stopped, re-arm it",
528
+ `with the same Monitor call (command \`npx -y ${PACKAGE_NAME} --watch ${mailbox}\`,`,
529
+ `timeout_ms ${MONITOR_TIMEOUT_MS}).`,
525
530
  ].join("\n");
526
531
  }
527
532
  const lines = [
@@ -530,11 +535,15 @@ export async function callTool(client, name, rawArgs) {
530
535
  "Last step — call the Monitor tool now, with exactly these arguments:",
531
536
  ` command: npx -y ${PACKAGE_NAME} --watch ${mailbox}`,
532
537
  " description: Incoming messenger messages",
533
- " persistent: true",
538
+ ` timeout_ms: ${MONITOR_TIMEOUT_MS}`,
534
539
  "",
535
540
  "Until that watcher is armed, nothing will reach you: no message will be announced.",
536
541
  "Once it is, keep working normally — each incoming message shows up on its own, even",
537
542
  "while you are idle. One line per message; read it with read_message.",
543
+ "",
544
+ "The host stops every monitor after 30 minutes at most. Each time it tells you this",
545
+ "watcher expired, call Monitor again right away with the same arguments — do not call",
546
+ "enable_notifications again. Skip that and notifications stop for good.",
538
547
  ];
539
548
  if (client.isAttachedElsewhere) {
540
549
  lines.push("", `Note: you are attached to \`${mailbox}\`, not to this session's own mailbox ` +
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.28";
1
+ export declare const APP_VERSION = "1.0.29";
@@ -1,2 +1,2 @@
1
1
  // Généré par scripts/generate-version.js — ne pas modifier à la main.
2
- export const APP_VERSION = "1.0.28";
2
+ export const APP_VERSION = "1.0.29";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imenam/mcp-messenger",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "main": "dist/src/index.js",
5
5
  "scripts": {
6
6
  "test": "npm run build && vitest run",