@masons/agent-network 0.4.16 → 0.4.18
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.map +1 -1
- package/dist/channel.js +156 -195
- package/dist/connector-client.d.ts +46 -24
- package/dist/connector-client.d.ts.map +1 -1
- package/dist/connector-client.js +127 -76
- package/dist/conversation-manager.d.ts +40 -33
- package/dist/conversation-manager.d.ts.map +1 -1
- package/dist/conversation-manager.js +103 -80
- package/dist/environment-context.d.ts +45 -0
- package/dist/environment-context.d.ts.map +1 -0
- package/dist/environment-context.js +81 -0
- package/dist/handle-utils.d.ts +16 -0
- package/dist/handle-utils.d.ts.map +1 -0
- package/dist/handle-utils.js +25 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/owner-session-state.d.ts +11 -18
- package/dist/owner-session-state.d.ts.map +1 -1
- package/dist/owner-session-state.js +17 -26
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +32 -4
- package/dist/tools.d.ts +1 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +2 -33
- package/dist/types.d.ts +57 -58
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -33
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -11
package/dist/plugin.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { agentNetworkChannel } from "./channel.js";
|
|
5
5
|
import { configureInteractive } from "./cli-setup.js";
|
|
6
6
|
import { detectPendingState, getConversationManager, getStateCacheGeneration, initPluginRuntime, } from "./config.js";
|
|
7
|
+
import { getAgentIdentity, getOwnerHandle, getOwnerIdentity, } from "./environment-context.js";
|
|
7
8
|
import { ownerNotesQueue } from "./owner-notes.js";
|
|
8
9
|
import { consumeCurrentTurnIsOwner } from "./owner-session-state.js";
|
|
9
10
|
import { sentMessageBuffer } from "./sent-message-buffer.js";
|
|
@@ -43,7 +44,7 @@ const MAX_INTERACTIONS = 5;
|
|
|
43
44
|
*
|
|
44
45
|
* Returns undefined if no interactions exist or CM is not available.
|
|
45
46
|
*/
|
|
46
|
-
function buildInteractionContext(channelId, turnSender) {
|
|
47
|
+
function buildInteractionContext(channelId, turnSender, ownerHandle) {
|
|
47
48
|
const cm = getConversationManager();
|
|
48
49
|
if (!cm)
|
|
49
50
|
return undefined;
|
|
@@ -60,9 +61,12 @@ function buildInteractionContext(channelId, turnSender) {
|
|
|
60
61
|
: "[Active interactions]";
|
|
61
62
|
const lines = sorted.map((c) => {
|
|
62
63
|
const who = `@${c.contact}`;
|
|
64
|
+
// Tag owner interactions so the LLM knows which contact is the owner (#969).
|
|
65
|
+
const isOwner = !!ownerHandle && c.contact.toLowerCase() === ownerHandle.toLowerCase();
|
|
66
|
+
const ownerTag = isOwner ? " (your owner)" : "";
|
|
63
67
|
const initiated = c.initiatedBy === "local" ? "you initiated" : "they initiated";
|
|
64
68
|
const when = formatTimeAgo(c.lastMessageAt);
|
|
65
|
-
return `• ${who} — ${initiated} — last activity ${when}`;
|
|
69
|
+
return `• ${who}${ownerTag} — ${initiated} — last activity ${when}`;
|
|
66
70
|
});
|
|
67
71
|
const isNetworkTurn = channelId === "agent-network";
|
|
68
72
|
if (isNetworkTurn && turnSender) {
|
|
@@ -298,7 +302,7 @@ const plugin = {
|
|
|
298
302
|
"your owner (Principal) will NOT see it. To report something to your owner, " +
|
|
299
303
|
"call masons_note_for_owner.";
|
|
300
304
|
// Append interaction space snapshot if active interactions exist.
|
|
301
|
-
const interactionCtx = buildInteractionContext(channelId, turnSender);
|
|
305
|
+
const interactionCtx = buildInteractionContext(channelId, turnSender, getOwnerHandle());
|
|
302
306
|
if (interactionCtx) {
|
|
303
307
|
dynamicContext += `\n\n${interactionCtx}`;
|
|
304
308
|
}
|
|
@@ -342,7 +346,7 @@ const plugin = {
|
|
|
342
346
|
}
|
|
343
347
|
// Append interaction space on owner turns too (#873).
|
|
344
348
|
// Gives the agent awareness of active network interactions.
|
|
345
|
-
const interactionCtx = buildInteractionContext(channelId, null);
|
|
349
|
+
const interactionCtx = buildInteractionContext(channelId, null, getOwnerHandle());
|
|
346
350
|
if (interactionCtx) {
|
|
347
351
|
dynamicContext = dynamicContext
|
|
348
352
|
? `${dynamicContext}\n\n${interactionCtx}`
|
|
@@ -350,6 +354,30 @@ const plugin = {
|
|
|
350
354
|
}
|
|
351
355
|
}
|
|
352
356
|
}
|
|
357
|
+
// --- Identity preamble (#969) ---
|
|
358
|
+
// Inject agent + owner identity into dynamic context so the LLM knows
|
|
359
|
+
// who it is and who its owner is on the network. Goes into dynamicContext
|
|
360
|
+
// (not TOOL_CONTEXT) because identity is per-agent.
|
|
361
|
+
if (state.hasCredentials) {
|
|
362
|
+
const envAgent = getAgentIdentity();
|
|
363
|
+
const envOwner = getOwnerIdentity();
|
|
364
|
+
if (envAgent) {
|
|
365
|
+
let identityLine = `[Identity] You are @${envAgent.handle}`;
|
|
366
|
+
if (envAgent.name)
|
|
367
|
+
identityLine += ` (${envAgent.name})`;
|
|
368
|
+
identityLine += " on the agent network.";
|
|
369
|
+
if (envOwner) {
|
|
370
|
+
identityLine += ` Your owner is @${envOwner.handle}`;
|
|
371
|
+
if (envOwner.displayName) {
|
|
372
|
+
identityLine += ` (${envOwner.displayName})`;
|
|
373
|
+
}
|
|
374
|
+
identityLine += ".";
|
|
375
|
+
}
|
|
376
|
+
dynamicContext = dynamicContext
|
|
377
|
+
? `${identityLine}\n\n${dynamicContext}`
|
|
378
|
+
: identityLine;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
353
381
|
// Post-upgrade verification: if an update is still available after
|
|
354
382
|
// a gateway restart, the previous upgrade attempt may have failed.
|
|
355
383
|
const updateInfo = getUpdateInfo();
|
package/dist/tools.d.ts
CHANGED
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
* Session Abstraction (#741):
|
|
16
16
|
* - `masons_send_message(to, content)` — sends via ConversationManager
|
|
17
17
|
* - `masons_end_conversation(contact)` — ends via ConversationManager
|
|
18
|
-
*
|
|
19
|
-
* - `masons_end_session` — DEPRECATED SHIM (one release cycle)
|
|
18
|
+
* (Deprecated shims masons_create_session and masons_end_session have been removed.)
|
|
20
19
|
*/
|
|
21
20
|
interface ToolContent {
|
|
22
21
|
content: Array<{
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA4CH,UAAU,WAAW;IACnB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CACP,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3B;AAED,UAAU,OAAO;IACf,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACzE;AA0CD,uDAAuD;AACvD,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAsFD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAszBhD"}
|
package/dist/tools.js
CHANGED
|
@@ -15,15 +15,14 @@
|
|
|
15
15
|
* Session Abstraction (#741):
|
|
16
16
|
* - `masons_send_message(to, content)` — sends via ConversationManager
|
|
17
17
|
* - `masons_end_conversation(contact)` — ends via ConversationManager
|
|
18
|
-
*
|
|
19
|
-
* - `masons_end_session` — DEPRECATED SHIM (one release cycle)
|
|
18
|
+
* (Deprecated shims masons_create_session and masons_end_session have been removed.)
|
|
20
19
|
*/
|
|
21
20
|
import { tmpdir } from "node:os";
|
|
22
21
|
import { Type } from "@sinclair/typebox";
|
|
23
22
|
import { clearTargetHandle, getOpenClawHome, getPendingTarget, isProfileNeeded, markProfileComplete, markProfileNeeded, requireApiKey, requireConversationManager, requirePlatformConfig, writeCredentials, } from "./config.js";
|
|
24
23
|
import { ownerNotesQueue } from "./owner-notes.js";
|
|
25
|
-
import { sentMessageBuffer } from "./sent-message-buffer.js";
|
|
26
24
|
import { acceptRequest, declineRequest, getConnectionStatus, initSetup, listConnections, listRequests, onboard, PlatformApiError, pollSetup, reconnect, requestConnection, SetupExpiredError, SetupPendingError, updateProfile, } from "./platform-client.js";
|
|
25
|
+
import { sentMessageBuffer } from "./sent-message-buffer.js";
|
|
27
26
|
import { fetchLatestVersion, getPluginVersion, getUpdateInfo, } from "./update-check.js";
|
|
28
27
|
// ---------------------------------------------------------------------------
|
|
29
28
|
// Constants
|
|
@@ -750,34 +749,4 @@ export function registerTools(api) {
|
|
|
750
749
|
].join("\n"));
|
|
751
750
|
},
|
|
752
751
|
});
|
|
753
|
-
// =========================================================================
|
|
754
|
-
// DEPRECATED SHIMS — kept for one release cycle for backward compatibility
|
|
755
|
-
// =========================================================================
|
|
756
|
-
// --- masons_create_session (DEPRECATED) -----------------------------------
|
|
757
|
-
api.registerTool({
|
|
758
|
-
name: "masons_create_session",
|
|
759
|
-
description: "[DEPRECATED — sessions are now automatic. Use masons_send_message directly.] Start a conversation with another Agent.",
|
|
760
|
-
parameters: Type.Object({
|
|
761
|
-
target: Type.String({
|
|
762
|
-
description: "Network address of the agent (e.g. mstps://preview.masons.ai/alice)",
|
|
763
|
-
}),
|
|
764
|
-
}),
|
|
765
|
-
// Intentionally ignores params — this shim just redirects the LLM to the new tool.
|
|
766
|
-
execute: withUpdateNotice(async () => {
|
|
767
|
-
return textResult("Sessions are now managed automatically. Use masons_send_message with the agent's handle or address to send a message — the session will be created automatically.");
|
|
768
|
-
}),
|
|
769
|
-
}, { optional: true });
|
|
770
|
-
// --- masons_end_session (DEPRECATED) --------------------------------------
|
|
771
|
-
api.registerTool({
|
|
772
|
-
name: "masons_end_session",
|
|
773
|
-
description: "[DEPRECATED — use masons_end_conversation instead.] End a conversation session.",
|
|
774
|
-
parameters: Type.Object({
|
|
775
|
-
sessionId: Type.String({
|
|
776
|
-
description: "Session ID of the session to end",
|
|
777
|
-
}),
|
|
778
|
-
}),
|
|
779
|
-
execute: withUpdateNotice(async () => {
|
|
780
|
-
return textResult("This tool is deprecated. Use masons_end_conversation with the agent's handle instead.");
|
|
781
|
-
}),
|
|
782
|
-
}, { optional: true });
|
|
783
752
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,89 +1,88 @@
|
|
|
1
|
-
export declare const CURRENT_PROTOCOL_VERSION =
|
|
1
|
+
export declare const CURRENT_PROTOCOL_VERSION = 2;
|
|
2
2
|
export declare const REGISTER_ACK_TIMEOUT_MS = 15000;
|
|
3
|
+
export declare const SEND_ACK_TIMEOUT_MS = 15000;
|
|
3
4
|
export interface RegisterEvent {
|
|
4
5
|
event: "REGISTER";
|
|
5
6
|
token: string;
|
|
6
7
|
protocolVersion: number;
|
|
7
8
|
clientVersion?: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
requestId: string;
|
|
12
|
-
target: string;
|
|
13
|
-
secret?: string;
|
|
14
|
-
metadata?: Record<string, unknown>;
|
|
15
|
-
}
|
|
16
|
-
export interface SendMessageEvent {
|
|
10
|
+
/** Send a message directly to a routable address. */
|
|
11
|
+
export interface AddressedSendEvent {
|
|
17
12
|
event: "SEND_MESSAGE";
|
|
18
|
-
|
|
13
|
+
messageId: string;
|
|
14
|
+
to: string;
|
|
19
15
|
content: string;
|
|
20
|
-
contentType
|
|
16
|
+
contentType: string;
|
|
21
17
|
metadata?: Record<string, unknown>;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
/** Send a typing indicator to a routable address. */
|
|
20
|
+
export interface AddressedTypingEvent {
|
|
21
|
+
event: "TYPING";
|
|
22
|
+
to: string;
|
|
23
|
+
isTyping: boolean;
|
|
27
24
|
}
|
|
28
|
-
|
|
25
|
+
/** Acknowledge delivery of stored messages up to a timestamp. */
|
|
26
|
+
export interface AddressedDeliveryAckEvent {
|
|
29
27
|
event: "DELIVERY_ACK";
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
export interface TypingStartEvent {
|
|
33
|
-
event: "TYPING_START";
|
|
34
|
-
sessionId: string;
|
|
28
|
+
upTo: string;
|
|
35
29
|
}
|
|
36
|
-
export interface TypingStopEvent {
|
|
37
|
-
event: "TYPING_STOP";
|
|
38
|
-
sessionId: string;
|
|
39
|
-
}
|
|
40
|
-
export type PluginToConnectorEvent = RegisterEvent | CreateSessionEvent | SendMessageEvent | EndSessionEvent | DeliveryAckEvent | TypingStartEvent | TypingStopEvent;
|
|
41
30
|
export interface RegisterAckEvent {
|
|
42
31
|
event: "REGISTER_ACK";
|
|
43
32
|
status: "ok" | "error";
|
|
44
33
|
reason?: string;
|
|
45
34
|
protocolVersion: number;
|
|
35
|
+
/** Agent identity — present when Connector supports environment context (#969). */
|
|
36
|
+
agent?: {
|
|
37
|
+
handle: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
};
|
|
40
|
+
/** Owner identity — present when agent has a bound owner with a MASONS account. */
|
|
41
|
+
owner?: {
|
|
42
|
+
handle: string;
|
|
43
|
+
displayName?: string;
|
|
44
|
+
};
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Delivery confirmation for a sent message.
|
|
48
|
+
*
|
|
49
|
+
* Plugins MUST treat unknown `status` values as successful delivery
|
|
50
|
+
* (forward compatibility).
|
|
51
|
+
*/
|
|
52
|
+
export interface SendAckEvent {
|
|
53
|
+
event: "SEND_ACK";
|
|
54
|
+
messageId: string;
|
|
55
|
+
status: "delivered" | "stored" | "queued";
|
|
54
56
|
}
|
|
55
|
-
|
|
57
|
+
/** Message received from a routable address. */
|
|
58
|
+
export interface AddressedMessageEvent {
|
|
56
59
|
event: "MESSAGE_RECEIVED";
|
|
57
|
-
|
|
60
|
+
from: string;
|
|
58
61
|
content: string;
|
|
59
62
|
contentType: string;
|
|
60
|
-
metadata
|
|
63
|
+
metadata: Record<string, unknown>;
|
|
64
|
+
/** ISO 8601. Present when message was stored and delivered later. */
|
|
65
|
+
sentAt?: string;
|
|
61
66
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
/** Notification that stored messages have been delivered. */
|
|
68
|
+
export interface DeliveryPendingEvent {
|
|
69
|
+
event: "DELIVERY_PENDING";
|
|
70
|
+
count: number;
|
|
71
|
+
upTo: string;
|
|
66
72
|
}
|
|
67
|
-
|
|
73
|
+
/** Structured error with machine-readable code. */
|
|
74
|
+
export interface StructuredErrorEvent {
|
|
68
75
|
event: "ERROR";
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
messageId?: string;
|
|
77
|
+
to?: string;
|
|
78
|
+
code: string;
|
|
71
79
|
message: string;
|
|
72
80
|
}
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
mailboxSessionId: string;
|
|
76
|
-
recipientSessionId: string;
|
|
77
|
-
messageCount: number;
|
|
78
|
-
}
|
|
79
|
-
export type ConnectorToPluginEvent = RegisterAckEvent | SessionCreatedEvent | MessageReceivedEvent | SessionEndedEvent | ErrorEvent | FlushCompleteEvent;
|
|
81
|
+
export type PluginToConnectorEvent = RegisterEvent | AddressedSendEvent | AddressedTypingEvent | AddressedDeliveryAckEvent;
|
|
82
|
+
export type ConnectorToPluginEvent = RegisterAckEvent | SendAckEvent | AddressedMessageEvent | DeliveryPendingEvent | StructuredErrorEvent;
|
|
80
83
|
export declare function isRegisterAck(data: unknown): data is RegisterAckEvent;
|
|
81
|
-
export declare function
|
|
82
|
-
export declare function
|
|
83
|
-
export declare function
|
|
84
|
-
export declare function
|
|
85
|
-
export declare function isFlushComplete(data: unknown): data is FlushCompleteEvent;
|
|
86
|
-
export declare function isDeliveryAck(data: unknown): data is DeliveryAckEvent;
|
|
87
|
-
export declare function isTypingStartEvent(data: unknown): data is TypingStartEvent;
|
|
88
|
-
export declare function isTypingStopEvent(data: unknown): data is TypingStopEvent;
|
|
84
|
+
export declare function isSendAck(data: unknown): data is SendAckEvent;
|
|
85
|
+
export declare function isAddressedMessage(data: unknown): data is AddressedMessageEvent;
|
|
86
|
+
export declare function isDeliveryPending(data: unknown): data is DeliveryPendingEvent;
|
|
87
|
+
export declare function isStructuredError(data: unknown): data is StructuredErrorEvent;
|
|
89
88
|
//# 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;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types.js
CHANGED
|
@@ -2,53 +2,38 @@
|
|
|
2
2
|
// Must stay wire-compatible with the Connector service.
|
|
3
3
|
// Independently defined — this package does not depend on Connector code.
|
|
4
4
|
// --- Constants ---
|
|
5
|
-
export const CURRENT_PROTOCOL_VERSION =
|
|
5
|
+
export const CURRENT_PROTOCOL_VERSION = 2;
|
|
6
6
|
export const REGISTER_ACK_TIMEOUT_MS = 15_000;
|
|
7
|
-
|
|
7
|
+
export const SEND_ACK_TIMEOUT_MS = 15_000;
|
|
8
|
+
// ==========================================================================
|
|
9
|
+
// Type guards
|
|
10
|
+
// ==========================================================================
|
|
8
11
|
function isObject(data) {
|
|
9
12
|
return typeof data === "object" && data !== null;
|
|
10
13
|
}
|
|
11
14
|
export function isRegisterAck(data) {
|
|
12
15
|
return isObject(data) && data.event === "REGISTER_ACK";
|
|
13
16
|
}
|
|
14
|
-
export function
|
|
17
|
+
export function isSendAck(data) {
|
|
15
18
|
return (isObject(data) &&
|
|
16
|
-
data.event === "
|
|
17
|
-
typeof data.
|
|
19
|
+
data.event === "SEND_ACK" &&
|
|
20
|
+
typeof data.messageId === "string");
|
|
18
21
|
}
|
|
19
|
-
export function
|
|
22
|
+
export function isAddressedMessage(data) {
|
|
20
23
|
return (isObject(data) &&
|
|
21
24
|
data.event === "MESSAGE_RECEIVED" &&
|
|
22
|
-
typeof data.
|
|
25
|
+
typeof data.from === "string" &&
|
|
23
26
|
typeof data.content === "string");
|
|
24
27
|
}
|
|
25
|
-
export function
|
|
28
|
+
export function isDeliveryPending(data) {
|
|
26
29
|
return (isObject(data) &&
|
|
27
|
-
data.event === "
|
|
28
|
-
typeof data.
|
|
30
|
+
data.event === "DELIVERY_PENDING" &&
|
|
31
|
+
typeof data.count === "number" &&
|
|
32
|
+
typeof data.upTo === "string");
|
|
29
33
|
}
|
|
30
|
-
export function
|
|
31
|
-
return (isObject(data) && data.event === "ERROR" && typeof data.message === "string");
|
|
32
|
-
}
|
|
33
|
-
export function isFlushComplete(data) {
|
|
34
|
-
return (isObject(data) &&
|
|
35
|
-
data.event === "FLUSH_COMPLETE" &&
|
|
36
|
-
typeof data.mailboxSessionId === "string" &&
|
|
37
|
-
typeof data.recipientSessionId === "string" &&
|
|
38
|
-
typeof data.messageCount === "number");
|
|
39
|
-
}
|
|
40
|
-
export function isDeliveryAck(data) {
|
|
41
|
-
return (isObject(data) &&
|
|
42
|
-
data.event === "DELIVERY_ACK" &&
|
|
43
|
-
typeof data.mailboxSessionId === "string");
|
|
44
|
-
}
|
|
45
|
-
export function isTypingStartEvent(data) {
|
|
46
|
-
return (isObject(data) &&
|
|
47
|
-
data.event === "TYPING_START" &&
|
|
48
|
-
typeof data.sessionId === "string");
|
|
49
|
-
}
|
|
50
|
-
export function isTypingStopEvent(data) {
|
|
34
|
+
export function isStructuredError(data) {
|
|
51
35
|
return (isObject(data) &&
|
|
52
|
-
data.event === "
|
|
53
|
-
typeof data.
|
|
36
|
+
data.event === "ERROR" &&
|
|
37
|
+
typeof data.code === "string" &&
|
|
38
|
+
typeof data.message === "string");
|
|
54
39
|
}
|
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.18";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masons/agent-network",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
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)",
|
|
@@ -19,15 +19,6 @@
|
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsc",
|
|
24
|
-
"dev": "tsc --watch",
|
|
25
|
-
"test": "tsc -p test/tsconfig.json && node --test --loader ts-node/esm test/**/*.test.ts",
|
|
26
|
-
"lint": "biome check",
|
|
27
|
-
"format": "biome format --write",
|
|
28
|
-
"prepublishOnly": "bash scripts/check-version.sh && npm run build && npm run test",
|
|
29
|
-
"release": "pnpm publish --access public"
|
|
30
|
-
},
|
|
31
22
|
"files": [
|
|
32
23
|
"dist/",
|
|
33
24
|
"openclaw.plugin.json",
|
|
@@ -77,5 +68,13 @@
|
|
|
77
68
|
"@types/ws": "^8",
|
|
78
69
|
"ts-node": "^10",
|
|
79
70
|
"typescript": "^5"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsc",
|
|
74
|
+
"dev": "tsc --watch",
|
|
75
|
+
"test": "tsc -p test/tsconfig.json && node --test --loader ts-node/esm test/**/*.test.ts",
|
|
76
|
+
"lint": "biome check",
|
|
77
|
+
"format": "biome format --write",
|
|
78
|
+
"release": "pnpm publish --access public"
|
|
80
79
|
}
|
|
81
|
-
}
|
|
80
|
+
}
|