@masons/agent-network 0.4.22 → 0.4.24
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/dist/channel.d.ts +3 -2
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +11 -5
- package/dist/connector-client.d.ts +2 -1
- package/dist/connector-client.d.ts.map +1 -1
- package/dist/connector-client.js +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +20 -38
- package/dist/sent-message-buffer.d.ts +1 -1
- package/dist/sent-message-buffer.d.ts.map +1 -1
- package/dist/sent-message-buffer.js +2 -2
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/channel.d.ts
CHANGED
|
@@ -19,11 +19,12 @@ interface ChannelConfigAdapter<T> {
|
|
|
19
19
|
isEnabled?(account: T, cfg: Record<string, unknown>): boolean;
|
|
20
20
|
}
|
|
21
21
|
interface OutboundDeliveryResult {
|
|
22
|
-
|
|
22
|
+
channel: string;
|
|
23
|
+
messageId: string;
|
|
23
24
|
}
|
|
24
25
|
interface ChannelOutboundContext {
|
|
25
26
|
text: string;
|
|
26
|
-
|
|
27
|
+
to: string;
|
|
27
28
|
accountId: string;
|
|
28
29
|
}
|
|
29
30
|
interface ChannelOutboundAdapter {
|
package/dist/channel.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"channel.d.ts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AG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACzE;AAED,UAAU,qBAAqB,CAAC,CAAC,GAAG,OAAO;IACzC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAuDD,UAAU,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;AAsQD,eAAO,MAAM,mBAAmB,EAAE,yBAwNjC,CAAC"}
|
package/dist/channel.js
CHANGED
|
@@ -177,6 +177,9 @@ async function handleAddressedMessage(event, conversationManager, client, ctx) {
|
|
|
177
177
|
storePath,
|
|
178
178
|
sessionKey,
|
|
179
179
|
ctx: msgCtx,
|
|
180
|
+
onRecordError: (err) => {
|
|
181
|
+
console.error(`[agent-network:${ctx.accountId}] session record error:`, err);
|
|
182
|
+
},
|
|
180
183
|
});
|
|
181
184
|
// Typing: address-based
|
|
182
185
|
client.sendTyping(fromAddress, true);
|
|
@@ -273,14 +276,17 @@ export const agentNetworkChannel = {
|
|
|
273
276
|
outbound: {
|
|
274
277
|
deliveryMode: "direct",
|
|
275
278
|
async sendText(ctx) {
|
|
276
|
-
// ctx.
|
|
279
|
+
// ctx.to is the routable address (senderId from inbound dispatch).
|
|
277
280
|
// ConversationManager.send() handles address resolution transparently.
|
|
278
281
|
const state = accounts.get(ctx.accountId);
|
|
279
282
|
if (!state)
|
|
280
|
-
return {
|
|
281
|
-
const result = await state.conversationManager.send(ctx.
|
|
282
|
-
dbg("sendText
|
|
283
|
-
return {
|
|
283
|
+
return { channel: "agent-network", messageId: "" };
|
|
284
|
+
const result = await state.conversationManager.send(ctx.to, ctx.text);
|
|
285
|
+
dbg("sendText to=%s status=%s contentLength=%d", ctx.to, result.status, ctx.text.length);
|
|
286
|
+
return {
|
|
287
|
+
channel: "agent-network",
|
|
288
|
+
messageId: `an:${randomUUID()}`,
|
|
289
|
+
};
|
|
284
290
|
},
|
|
285
291
|
},
|
|
286
292
|
gateway: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
|
-
import { type AddressedMessageEvent, type DeliveryPendingEvent, type SendAckEvent, type StructuredErrorEvent } from "./types.js";
|
|
2
|
+
import { type AddressedMessageEvent, type DeliveryPendingEvent, type DeliveryStatusEvent, type SendAckEvent, type StructuredErrorEvent } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Error with machine-readable `code` from Connector structured errors.
|
|
5
5
|
* Thrown by `send()` when the Connector responds with ERROR { code }.
|
|
@@ -13,6 +13,7 @@ type ConnectorClientEvents = {
|
|
|
13
13
|
message_received: (event: AddressedMessageEvent) => void;
|
|
14
14
|
send_ack: (event: SendAckEvent) => void;
|
|
15
15
|
delivery_pending: (event: DeliveryPendingEvent) => void;
|
|
16
|
+
delivery_status: (event: DeliveryStatusEvent) => void;
|
|
16
17
|
structured_error: (event: StructuredErrorEvent) => void;
|
|
17
18
|
error: (error: Error) => void;
|
|
18
19
|
connected: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector-client.d.ts","sourceRoot":"","sources":["../src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EAAE,KAAK,IAAI,GAAG,IAAI;IAK1E,GAAG,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACvC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,GACjC,IAAI;IACP,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI;IAKzE,IAAI,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACxC,KAAK,EAAE,CAAC,EACR,GAAG,IAAI,EAAE,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;IACV,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO;IAOzD,OAAO,CAAC,SAAS;IAmBjB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,aAAa,CAgBnB;IAEF,6CAA6C;IAC7C,OAAO,CAAC,iBAAiB;IAsCzB,OAAO,CAAC,iBAAiB;IAkDzB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAUrB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,WAAW,CAqBjB;IAEF,OAAO,CAAC,WAAW,CAIjB;IAIF,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,iBAAiB;IAqBzB,wCAAwC;IACxC,OAAO,CAAC,SAAS;CAclB"}
|
package/dist/connector-client.js
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from "node:events";
|
|
|
3
3
|
import createDebug from "debug";
|
|
4
4
|
import WebSocket from "ws";
|
|
5
5
|
import { setEnvironmentContext } from "./environment-context.js";
|
|
6
|
-
import { CURRENT_PROTOCOL_VERSION, isAddressedMessage, isDeliveryPending, isRegisterAck, isSendAck, isStructuredError, REGISTER_ACK_TIMEOUT_MS, SEND_ACK_TIMEOUT_MS, } from "./types.js";
|
|
6
|
+
import { CURRENT_PROTOCOL_VERSION, isAddressedMessage, isDeliveryPending, isDeliveryStatus, isRegisterAck, isSendAck, isStructuredError, REGISTER_ACK_TIMEOUT_MS, SEND_ACK_TIMEOUT_MS, } from "./types.js";
|
|
7
7
|
import { PLUGIN_VERSION } from "./version.js";
|
|
8
8
|
const dbg = createDebug("agent-network:connector");
|
|
9
9
|
const dbgMsg = createDebug("agent-network:connector:msg");
|
|
@@ -216,6 +216,11 @@ export class ConnectorClient extends EventEmitter {
|
|
|
216
216
|
this.emit("delivery_pending", parsed);
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
|
+
if (isDeliveryStatus(parsed)) {
|
|
220
|
+
dbg("DELIVERY_STATUS messageId=%s status=%s", parsed.messageId, parsed.status);
|
|
221
|
+
this.emit("delivery_status", parsed);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
219
224
|
if (isStructuredError(parsed)) {
|
|
220
225
|
dbg("ERROR code=%s message=%s", parsed.code, parsed.message);
|
|
221
226
|
this.handleStructuredError(parsed);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AUTHORIZED_TOKEN_TTL_MS, SETUP_CODE_CHARSET, SETUP_CODE_LENGTH, SETUP_CODE_TTL_MS, } from "./constants.js";
|
|
2
2
|
export type { AgentNetworkAccount } from "./config-schema.js";
|
|
3
|
-
export type { AddressedMessageEvent, DeliveryPendingEvent, RegisterAckEvent, SendAckEvent, StructuredErrorEvent, } from "./types.js";
|
|
3
|
+
export type { AddressedMessageEvent, DeliveryPendingEvent, DeliveryStatusEvent, RegisterAckEvent, SendAckEvent, StructuredErrorEvent, } from "./types.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAIxB,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAIxB,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -14,16 +14,16 @@ declare const plugin: {
|
|
|
14
14
|
name: string;
|
|
15
15
|
description: string;
|
|
16
16
|
configSchema: {
|
|
17
|
-
type:
|
|
17
|
+
type: string;
|
|
18
18
|
additionalProperties: boolean;
|
|
19
19
|
properties: {
|
|
20
20
|
apiHost: {
|
|
21
|
-
type:
|
|
21
|
+
type: string;
|
|
22
22
|
description: string;
|
|
23
23
|
default: string;
|
|
24
24
|
};
|
|
25
25
|
updateCheck: {
|
|
26
|
-
type:
|
|
26
|
+
type: string;
|
|
27
27
|
description: string;
|
|
28
28
|
default: boolean;
|
|
29
29
|
};
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AA4HA,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;;;;;;;;;;;;;;;;;;;;;kBAaI,iBAAiB;CAyVhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// OpenClaw Plugin entry point.
|
|
2
2
|
// Loaded by OpenClaw Gateway via the "openclaw.extensions" field in package.json.
|
|
3
3
|
// NOT imported by index.ts to avoid pulling ws/typebox into Next.js app bundles.
|
|
4
|
+
import pluginManifest from "../openclaw.plugin.json" with { type: "json" };
|
|
4
5
|
import { agentNetworkChannel } from "./channel.js";
|
|
5
6
|
import { configureInteractive } from "./cli-setup.js";
|
|
6
7
|
import { detectPendingState, getConversationManager, getDmScope, getStateCacheGeneration, initPluginRuntime, } from "./config.js";
|
|
@@ -97,23 +98,8 @@ const plugin = {
|
|
|
97
98
|
// configSchema MUST be on the plugin export object (not just openclaw.plugin.json).
|
|
98
99
|
// Gateway validates user config via AJV against this schema BEFORE calling register().
|
|
99
100
|
// Missing configSchema → register() is never called (silent skip, no error logged).
|
|
100
|
-
//
|
|
101
|
-
configSchema:
|
|
102
|
-
type: "object",
|
|
103
|
-
additionalProperties: false,
|
|
104
|
-
properties: {
|
|
105
|
-
apiHost: {
|
|
106
|
-
type: "string",
|
|
107
|
-
description: "MASONS Platform API host",
|
|
108
|
-
default: "preview-platform.masons.ai",
|
|
109
|
-
},
|
|
110
|
-
updateCheck: {
|
|
111
|
-
type: "boolean",
|
|
112
|
-
description: "Check for plugin updates on startup (default: true)",
|
|
113
|
-
default: true,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
},
|
|
101
|
+
// Imported from openclaw.plugin.json — single source of truth.
|
|
102
|
+
configSchema: pluginManifest.configSchema,
|
|
117
103
|
register(api) {
|
|
118
104
|
// Capture runtime for inbound message dispatch (Pathway 1: module-level singleton).
|
|
119
105
|
// api.runtime is the full PluginRuntime (includes .channel for routing/reply/session).
|
|
@@ -281,26 +267,20 @@ const plugin = {
|
|
|
281
267
|
if (turnIsOwner) {
|
|
282
268
|
// Owner visiting via Passport — no routing warning needed.
|
|
283
269
|
// The LLM's text reply goes to the owner (the visitor IS the owner).
|
|
284
|
-
//
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const timeStr = formatTimeAgo(n.timestamp);
|
|
292
|
-
return `• ${fromStr} (${timeStr}): "${n.content}"`;
|
|
293
|
-
})
|
|
294
|
-
.join("\n")
|
|
295
|
-
: "";
|
|
270
|
+
//
|
|
271
|
+
// DO NOT drain ownerNotesQueue here (#986). Notes are meant for
|
|
272
|
+
// non-Passport channels (Telegram/Feishu) where the owner can act
|
|
273
|
+
// on them — e.g., identity linking notifications require the owner
|
|
274
|
+
// to provide their Telegram ID, which only makes sense on Telegram.
|
|
275
|
+
// Draining here would consume notifications on the same turn that
|
|
276
|
+
// generated them, leaving nothing for the target channel.
|
|
296
277
|
dynamicContext =
|
|
297
278
|
"[Agent Network — Owner via Passport] Your owner (Principal) is talking to you " +
|
|
298
279
|
"via Passport (your public web chat page where visitors can reach you). " +
|
|
299
280
|
"This IS your owner — respond naturally, no need to ask who they are. " +
|
|
300
281
|
"Your text reply goes directly to your owner. " +
|
|
301
282
|
"You can share information freely — no information boundary applies. " +
|
|
302
|
-
"Do NOT use masons_note_for_owner — your owner is right here."
|
|
303
|
-
notesBlock;
|
|
283
|
+
"Do NOT use masons_note_for_owner — your owner is right here.";
|
|
304
284
|
}
|
|
305
285
|
else {
|
|
306
286
|
// Turn triggered by a remote agent/stranger — routing warning +
|
|
@@ -323,8 +303,8 @@ const plugin = {
|
|
|
323
303
|
const sentMsgs = sentMessageBuffer.getRecent(turnSender);
|
|
324
304
|
if (sentMsgs.length > 0) {
|
|
325
305
|
const lines = sentMsgs.map((m) => {
|
|
326
|
-
const preview = m.content.length >
|
|
327
|
-
? `${m.content.slice(0,
|
|
306
|
+
const preview = m.content.length > 500
|
|
307
|
+
? `${m.content.slice(0, 500)}...`
|
|
328
308
|
: m.content;
|
|
329
309
|
return `• (${formatTimeAgo(m.timestamp)}): "${preview}"`;
|
|
330
310
|
});
|
|
@@ -409,11 +389,13 @@ const plugin = {
|
|
|
409
389
|
// Use prependSystemContext for stable tool awareness (KV-cacheable).
|
|
410
390
|
// Use prependContext for dynamic setup state.
|
|
411
391
|
//
|
|
412
|
-
//
|
|
413
|
-
//
|
|
414
|
-
//
|
|
415
|
-
//
|
|
416
|
-
//
|
|
392
|
+
// Workaround for OpenClaw issue #59546: prependSystemContext is silently
|
|
393
|
+
// ignored in the gateway reply path (confirmed in v2026.4.1, still open).
|
|
394
|
+
// To ensure tool awareness is never lost for gateway-mode users, we
|
|
395
|
+
// include TOOL_CONTEXT in both prependSystemContext (for KV-cache benefit
|
|
396
|
+
// on desktop) and prependContext (as fallback for gateway mode).
|
|
397
|
+
// Cost: ~434 tokens duplicated per turn on desktop OpenClaw.
|
|
398
|
+
// Remove this duplication once #59546 is fixed upstream.
|
|
417
399
|
const systemContext = state.hasCredentials ? TOOL_CONTEXT : undefined;
|
|
418
400
|
if (systemContext && dynamicContext) {
|
|
419
401
|
return {
|
|
@@ -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 =
|
|
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,
|
|
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 =
|
|
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 =
|
|
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/types.d.ts
CHANGED
|
@@ -78,11 +78,20 @@ export interface StructuredErrorEvent {
|
|
|
78
78
|
code: string;
|
|
79
79
|
message: string;
|
|
80
80
|
}
|
|
81
|
+
/** Delivery status notification for a stored message. */
|
|
82
|
+
export interface DeliveryStatusEvent {
|
|
83
|
+
event: "DELIVERY_STATUS";
|
|
84
|
+
messageId: string;
|
|
85
|
+
status: "delivered";
|
|
86
|
+
/** ISO 8601 — when the delivery occurred. */
|
|
87
|
+
deliveredAt?: string;
|
|
88
|
+
}
|
|
81
89
|
export type PluginToConnectorEvent = RegisterEvent | AddressedSendEvent | AddressedTypingEvent | AddressedDeliveryAckEvent;
|
|
82
|
-
export type ConnectorToPluginEvent = RegisterAckEvent | SendAckEvent | AddressedMessageEvent | DeliveryPendingEvent | StructuredErrorEvent;
|
|
90
|
+
export type ConnectorToPluginEvent = RegisterAckEvent | SendAckEvent | AddressedMessageEvent | DeliveryPendingEvent | DeliveryStatusEvent | StructuredErrorEvent;
|
|
83
91
|
export declare function isRegisterAck(data: unknown): data is RegisterAckEvent;
|
|
84
92
|
export declare function isSendAck(data: unknown): data is SendAckEvent;
|
|
85
93
|
export declare function isAddressedMessage(data: unknown): data is AddressedMessageEvent;
|
|
86
94
|
export declare function isDeliveryPending(data: unknown): data is DeliveryPendingEvent;
|
|
95
|
+
export declare function isDeliveryStatus(data: unknown): data is DeliveryStatusEvent;
|
|
87
96
|
export declare function isStructuredError(data: unknown): data is StructuredErrorEvent;
|
|
88
97
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAC9C,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAQ1C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,QAAQ,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,iEAAiE;AACjE,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd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SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,iBAAiB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,MAAM,sBAAsB,GAC9B,aAAa,GACb,kBAAkB,GAClB,oBAAoB,GACpB,yBAAyB,CAAC;AAE9B,MAAM,MAAM,sBAAsB,GAC9B,gBAAgB,GAChB,YAAY,GACZ,qBAAqB,GACrB,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,CAAC;AAUzB,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAErE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,YAAY,CAM7D;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,qBAAqB,CAO/B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAO7E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,mBAAmB,CAO3E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAO7E"}
|
package/dist/types.js
CHANGED
|
@@ -31,6 +31,12 @@ export function isDeliveryPending(data) {
|
|
|
31
31
|
typeof data.count === "number" &&
|
|
32
32
|
typeof data.upTo === "string");
|
|
33
33
|
}
|
|
34
|
+
export function isDeliveryStatus(data) {
|
|
35
|
+
return (isObject(data) &&
|
|
36
|
+
data.event === "DELIVERY_STATUS" &&
|
|
37
|
+
typeof data.messageId === "string" &&
|
|
38
|
+
typeof data.status === "string");
|
|
39
|
+
}
|
|
34
40
|
export function isStructuredError(data) {
|
|
35
41
|
return (isObject(data) &&
|
|
36
42
|
data.event === "ERROR" &&
|
package/dist/version.d.ts
CHANGED
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.
|
|
2
|
+
export const PLUGIN_VERSION = "0.4.24";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masons/agent-network",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.24",
|
|
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)",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"masons"
|
|
14
14
|
],
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=20"
|
|
16
|
+
"node": ">=20.10"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"publishConfig": {
|