@masons/agent-network 0.4.21 → 0.4.23

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 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AA2B9D,oEAAoE;AACpE,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAQD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,oBAAoB,CAAC,CAAC;IAC9B,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC;IACvD,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IACpE,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IACjE,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CAC/D;AAED,UAAU,sBAAsB;IAC9B,EAAE,EAAE,OAAO,CAAC;CACb;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UA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,qBAAqB,CAAC,CAAC,GAAG,OAAO;IACzC,YAAY,CAAC,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,WAAW,CAAC,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,UAAU,yBAAyB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,mBAAmB,CAAC;IAClC,MAAM,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;IAClD,QAAQ,EAAE,sBAAsB,CAAC;IACjC,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD;AAgQD,eAAO,MAAM,mBAAmB,EAAE,yBAwNjC,CAAC"}
package/dist/channel.js CHANGED
@@ -204,6 +204,10 @@ async function handleAddressedMessage(event, conversationManager, client, ctx) {
204
204
  }
205
205
  finally {
206
206
  client.sendTyping(fromAddress, false);
207
+ // Commit deferred deletions from end_conversation calls made during
208
+ // this dispatch cycle. Must run after text buffer flush so that
209
+ // hasConversation() returns true for the deliver callback (#999).
210
+ conversationManager.commitEndedConversations();
207
211
  }
208
212
  }
209
213
  catch (err) {
@@ -23,6 +23,20 @@ export interface ConversationEntry {
23
23
  address: string;
24
24
  lastMessageAt: number;
25
25
  initiatedBy: "local" | "remote";
26
+ /**
27
+ * Deferred deletion flag (#999).
28
+ *
29
+ * When `masons_end_conversation` runs during a dispatch cycle, the entry
30
+ * is marked `ended` but NOT removed from the Map. This keeps
31
+ * `hasConversation()` returning true so the deliver callback can still
32
+ * flush buffered text from the same LLM turn.
33
+ *
34
+ * Call `commitEndedConversations()` after the dispatch cycle completes
35
+ * to actually remove ended entries.
36
+ *
37
+ * @see https://github.com/MASONS-ai/masons.ai/issues/999
38
+ */
39
+ ended?: boolean;
26
40
  }
27
41
  export interface ConversationSummary {
28
42
  contact: string;
@@ -68,17 +82,41 @@ export declare class ConversationManager {
68
82
  /**
69
83
  * Check if a conversation entry exists for a contact.
70
84
  *
71
- * Used by the deliver callback to detect post-end straggler text:
72
- * endConversation() deletes the entry, so its absence signals that
73
- * the LLM called masons_end_conversation during this dispatch.
85
+ * Returns true for entries that are marked `ended` but not yet committed —
86
+ * this allows the deliver callback to flush buffered text from the same
87
+ * dispatch cycle as end_conversation (#999).
88
+ *
89
+ * Straggler text from *subsequent* dispatch cycles is still suppressed
90
+ * because `commitEndedConversations()` removes entries between cycles.
74
91
  */
75
92
  hasConversation(contact: string): boolean;
76
93
  /**
77
- * End the conversation with a contact.
78
- * Removes the conversation entry. No END_SESSION needed — the Connector
79
- * manages connection lifecycle (idle timeout).
94
+ * Mark the conversation with a contact as ended (deferred deletion).
95
+ *
96
+ * The entry is NOT removed immediately — it is flagged `ended` and stays
97
+ * in the Map until `commitEndedConversations()` is called after the
98
+ * current dispatch cycle completes. This prevents the "last-message-
99
+ * before-close" race where the dispatcher executes end_conversation
100
+ * before flushing buffered text (#999).
101
+ *
102
+ * No END_SESSION needed — the Connector manages connection lifecycle
103
+ * (idle timeout).
80
104
  */
81
105
  endConversation(contact: string): void;
106
+ /**
107
+ * Remove all conversations marked as `ended`.
108
+ *
109
+ * Call this after the dispatch cycle completes (in the `finally` block
110
+ * of `handleAddressedMessage`). Deferred deletion ensures that text
111
+ * buffered in the same dispatch cycle as end_conversation is delivered
112
+ * before the entry disappears.
113
+ *
114
+ * Pattern: React 18 batched updates / Qt `deleteLater()` — mutations
115
+ * during a dispatch cycle are committed only when the cycle ends.
116
+ *
117
+ * @see https://github.com/MASONS-ai/masons.ai/issues/999
118
+ */
119
+ commitEndedConversations(): void;
82
120
  /**
83
121
  * Resolve a contact (handle, MSTP address, or passport address) to a
84
122
  * routable address.
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-manager.d.ts","sourceRoot":"","sources":["../src/conversation-manager.ts"],"names":[],"mappings":"AAAA;;;;;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AS1D;;;;;;;;;;OAUG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA0CjE;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKvD;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAaxD;;;;OAIG;IACH,iBAAiB,IAAI,mBAAmB,EAAE;IAc1C;;;;;;;;;OASG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKzC;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAWtC;;;;;;;;;;;;OAYG;IACH,wBAAwB,IAAI,IAAI;IAiBhC;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAoBvC;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAQtC,OAAO,CAAC,uBAAuB;IAyB/B,0CAA0C;IAC1C,gBAAgB,IAAI,IAAI;CAGzB"}
@@ -122,7 +122,7 @@ export class ConversationManager {
122
122
  result.push({
123
123
  contact: entry.contact,
124
124
  address: entry.address,
125
- active: true,
125
+ active: !entry.ended,
126
126
  lastMessageAt: entry.lastMessageAt,
127
127
  initiatedBy: entry.initiatedBy,
128
128
  });
@@ -132,23 +132,64 @@ export class ConversationManager {
132
132
  /**
133
133
  * Check if a conversation entry exists for a contact.
134
134
  *
135
- * Used by the deliver callback to detect post-end straggler text:
136
- * endConversation() deletes the entry, so its absence signals that
137
- * the LLM called masons_end_conversation during this dispatch.
135
+ * Returns true for entries that are marked `ended` but not yet committed —
136
+ * this allows the deliver callback to flush buffered text from the same
137
+ * dispatch cycle as end_conversation (#999).
138
+ *
139
+ * Straggler text from *subsequent* dispatch cycles is still suppressed
140
+ * because `commitEndedConversations()` removes entries between cycles.
138
141
  */
139
142
  hasConversation(contact) {
140
143
  const address = this.resolveAddress(contact);
141
144
  return this.conversations.has(address);
142
145
  }
143
146
  /**
144
- * End the conversation with a contact.
145
- * Removes the conversation entry. No END_SESSION needed — the Connector
146
- * manages connection lifecycle (idle timeout).
147
+ * Mark the conversation with a contact as ended (deferred deletion).
148
+ *
149
+ * The entry is NOT removed immediately — it is flagged `ended` and stays
150
+ * in the Map until `commitEndedConversations()` is called after the
151
+ * current dispatch cycle completes. This prevents the "last-message-
152
+ * before-close" race where the dispatcher executes end_conversation
153
+ * before flushing buffered text (#999).
154
+ *
155
+ * No END_SESSION needed — the Connector manages connection lifecycle
156
+ * (idle timeout).
147
157
  */
148
158
  endConversation(contact) {
149
159
  const address = this.resolveAddress(contact);
150
- this.conversations.delete(address);
151
- dbg("endConversation contact=%s address=%s", contact, address);
160
+ const entry = this.conversations.get(address);
161
+ if (entry) {
162
+ entry.ended = true;
163
+ dbg("endConversation (deferred) contact=%s address=%s", contact, address);
164
+ }
165
+ else {
166
+ dbg("endConversation (no-op) contact=%s address=%s", contact, address);
167
+ }
168
+ }
169
+ /**
170
+ * Remove all conversations marked as `ended`.
171
+ *
172
+ * Call this after the dispatch cycle completes (in the `finally` block
173
+ * of `handleAddressedMessage`). Deferred deletion ensures that text
174
+ * buffered in the same dispatch cycle as end_conversation is delivered
175
+ * before the entry disappears.
176
+ *
177
+ * Pattern: React 18 batched updates / Qt `deleteLater()` — mutations
178
+ * during a dispatch cycle are committed only when the cycle ends.
179
+ *
180
+ * @see https://github.com/MASONS-ai/masons.ai/issues/999
181
+ */
182
+ commitEndedConversations() {
183
+ let count = 0;
184
+ for (const [address, entry] of this.conversations) {
185
+ if (entry.ended) {
186
+ this.conversations.delete(address);
187
+ count++;
188
+ }
189
+ }
190
+ if (count > 0) {
191
+ dbg("commitEndedConversations removed=%d", count);
192
+ }
152
193
  }
153
194
  // -------------------------------------------------------------------------
154
195
  // Contact resolution
@@ -210,6 +251,7 @@ export class ConversationManager {
210
251
  const entry = this.conversations.get(address);
211
252
  if (entry) {
212
253
  entry.lastMessageAt = Date.now();
254
+ entry.ended = false; // Clear deferred deletion on re-registration
213
255
  }
214
256
  }
215
257
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AA0HA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC;CACnE;AAED,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;kBA4BI,iBAAiB;CAsWhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AA0HA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC;CACnE;AAED,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;kBA4BI,iBAAiB;CAuVhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/plugin.js CHANGED
@@ -281,29 +281,20 @@ const plugin = {
281
281
  if (turnIsOwner) {
282
282
  // Owner visiting via Passport — no routing warning needed.
283
283
  // The LLM's text reply goes to the owner (the visitor IS the owner).
284
- // Drain pending notes: owner is here, deliver them directly.
285
- const notes = ownerNotesQueue.drain();
286
- const notesBlock = notes.length > 0
287
- ? "\n\nPending updates from the agent network:\n" +
288
- notes
289
- .map((n) => {
290
- const fromStr = n.from ? `@${n.from}` : "agent";
291
- const timeStr = formatTimeAgo(n.timestamp);
292
- const preview = n.content.length > 100
293
- ? `${n.content.slice(0, 100)}...`
294
- : n.content;
295
- return `• ${fromStr} (${timeStr}): "${preview}"`;
296
- })
297
- .join("\n")
298
- : "";
284
+ //
285
+ // DO NOT drain ownerNotesQueue here (#986). Notes are meant for
286
+ // non-Passport channels (Telegram/Feishu) where the owner can act
287
+ // on them e.g., identity linking notifications require the owner
288
+ // to provide their Telegram ID, which only makes sense on Telegram.
289
+ // Draining here would consume notifications on the same turn that
290
+ // generated them, leaving nothing for the target channel.
299
291
  dynamicContext =
300
292
  "[Agent Network — Owner via Passport] Your owner (Principal) is talking to you " +
301
293
  "via Passport (your public web chat page where visitors can reach you). " +
302
294
  "This IS your owner — respond naturally, no need to ask who they are. " +
303
295
  "Your text reply goes directly to your owner. " +
304
296
  "You can share information freely — no information boundary applies. " +
305
- "Do NOT use masons_note_for_owner — your owner is right here." +
306
- notesBlock;
297
+ "Do NOT use masons_note_for_owner — your owner is right here.";
307
298
  }
308
299
  else {
309
300
  // Turn triggered by a remote agent/stranger — routing warning +
@@ -326,8 +317,8 @@ const plugin = {
326
317
  const sentMsgs = sentMessageBuffer.getRecent(turnSender);
327
318
  if (sentMsgs.length > 0) {
328
319
  const lines = sentMsgs.map((m) => {
329
- const preview = m.content.length > 100
330
- ? `${m.content.slice(0, 100)}...`
320
+ const preview = m.content.length > 500
321
+ ? `${m.content.slice(0, 500)}...`
331
322
  : m.content;
332
323
  return `• (${formatTimeAgo(m.timestamp)}): "${preview}"`;
333
324
  });
@@ -345,10 +336,7 @@ const plugin = {
345
336
  const lines = notes.map((n) => {
346
337
  const fromStr = n.from ? `@${n.from}` : "agent";
347
338
  const timeStr = formatTimeAgo(n.timestamp);
348
- const preview = n.content.length > 100
349
- ? `${n.content.slice(0, 100)}...`
350
- : n.content;
351
- return `• ${fromStr} (${timeStr}): "${preview}"`;
339
+ return `• ${fromStr} (${timeStr}): "${n.content}"`;
352
340
  });
353
341
  dynamicContext =
354
342
  "[Agent Network — Updates]\n" +
@@ -29,7 +29,7 @@ export declare class SentMessageBuffer {
29
29
  /** Messages older than this are evicted. */
30
30
  static readonly TTL_MS: number;
31
31
  /** Max content length stored per message. Longer content is truncated at record time. */
32
- static readonly MAX_CONTENT_LENGTH = 500;
32
+ static readonly MAX_CONTENT_LENGTH = 1000;
33
33
  /**
34
34
  * Record an outgoing message to a contact.
35
35
  * Called by `masons_send_message` after successful send.
@@ -1 +1 @@
1
- {"version":3,"file":"sent-message-buffer.d.ts","sourceRoot":"","sources":["../src/sent-message-buffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAoC;IAEnD,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,eAAe,KAAK;IACpC,4CAA4C;IAC5C,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAkB;IACxC,yFAAyF;IACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,OAAO;IAEzC;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IA2B9C;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAoBzC;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAMD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
1
+ {"version":3,"file":"sent-message-buffer.d.ts","sourceRoot":"","sources":["../src/sent-message-buffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAoC;IAEnD,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,eAAe,KAAK;IACpC,4CAA4C;IAC5C,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAsB;IAC5C,yFAAyF;IACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,QAAQ;IAE1C;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IA2B9C;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAoBzC;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAMD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
@@ -24,9 +24,9 @@ export class SentMessageBuffer {
24
24
  /** Max messages retained per contact. */
25
25
  static MAX_PER_CONTACT = 5;
26
26
  /** Messages older than this are evicted. */
27
- static TTL_MS = 30 * 60 * 1000; // 30 minutes
27
+ static TTL_MS = 2 * 60 * 60 * 1000; // 2 hours
28
28
  /** Max content length stored per message. Longer content is truncated at record time. */
29
- static MAX_CONTENT_LENGTH = 500;
29
+ static MAX_CONTENT_LENGTH = 1000;
30
30
  /**
31
31
  * Record an outgoing message to a contact.
32
32
  * Called by `masons_send_message` after successful send.
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Plugin version — must match package.json. Validated by prepublishOnly. */
2
- export declare const PLUGIN_VERSION = "0.4.21";
2
+ export declare const PLUGIN_VERSION = "0.4.23";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Plugin version — must match package.json. Validated by prepublishOnly. */
2
- export const PLUGIN_VERSION = "0.4.21";
2
+ export const PLUGIN_VERSION = "0.4.23";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masons/agent-network",
3
- "version": "0.4.21",
3
+ "version": "0.4.23",
4
4
  "description": "MASONS plugin for OpenClaw — connect your agent to the agent network",
5
5
  "license": "MIT",
6
6
  "author": "MASONS.ai <hello@masons.ai> (https://masons.ai)",
@@ -4,6 +4,10 @@ description: "Connects to the agent network through MASONS and enables real-time
4
4
  metadata:
5
5
  openclaw:
6
6
  emoji: "🌐"
7
+ homepage: "https://masons.ai"
8
+ requires:
9
+ config:
10
+ - "channels.agent-network.accounts.default.token"
7
11
  ---
8
12
 
9
13
  # Agent Network