@masons/agent-network 0.3.1 → 0.3.3
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 +10 -0
- package/dist/connector-client.d.ts.map +1 -1
- package/dist/connector-client.js +21 -2
- package/dist/platform-client.d.ts +14 -0
- package/dist/platform-client.d.ts.map +1 -1
- package/dist/platform-client.js +14 -0
- package/dist/tools.d.ts +4 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +34 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -11
- package/skills/agent-network/SKILL.md +12 -1
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAa9D,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,GAA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C,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;AAwDD,eAAO,MAAM,mBAAmB,EAAE,yBA2MjC,CAAC"}
|
package/dist/channel.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import createDebug from "debug";
|
|
2
3
|
import { clearConnectorClient, extractNetworkConfig, initConnectorClient, initToolConfig, } from "./config.js";
|
|
3
4
|
import { ConnectorClient } from "./connector-client.js";
|
|
4
5
|
import { checkForUpdate } from "./update-check.js";
|
|
6
|
+
const dbg = createDebug("agent-network:channel");
|
|
5
7
|
// --- Sender identity ---
|
|
6
8
|
/**
|
|
7
9
|
* Use sessionId as the sender identifier for OpenClaw routing.
|
|
@@ -103,11 +105,13 @@ export const agentNetworkChannel = {
|
|
|
103
105
|
const sent = state.client.sendMessage(ctx.recipient, ctx.text, {
|
|
104
106
|
contentType: "text",
|
|
105
107
|
});
|
|
108
|
+
dbg("sendText sessionId=%s contentLength=%d sent=%s", ctx.recipient, ctx.text.length, sent);
|
|
106
109
|
return { ok: sent };
|
|
107
110
|
},
|
|
108
111
|
},
|
|
109
112
|
gateway: {
|
|
110
113
|
async startAccount(ctx) {
|
|
114
|
+
dbg("starting account %s", ctx.accountId);
|
|
111
115
|
const { connectorUrl, token } = ctx.account;
|
|
112
116
|
const client = new ConnectorClient(connectorUrl, token);
|
|
113
117
|
const state = {
|
|
@@ -117,6 +121,7 @@ export const agentNetworkChannel = {
|
|
|
117
121
|
accounts.set(ctx.accountId, state);
|
|
118
122
|
// --- Inbound message routing ---
|
|
119
123
|
client.on("message_received", (event) => {
|
|
124
|
+
dbg("routing inbound message sessionId=%s contentLength=%d", event.sessionId, event.content.length);
|
|
120
125
|
const senderId = deriveSenderId(event);
|
|
121
126
|
const envelope = {
|
|
122
127
|
channelId: "agent-network",
|
|
@@ -135,12 +140,14 @@ export const agentNetworkChannel = {
|
|
|
135
140
|
});
|
|
136
141
|
// --- Session lifecycle ---
|
|
137
142
|
client.on("session_created", (event) => {
|
|
143
|
+
dbg("session created sessionId=%s direction=%s", event.sessionId, event.direction);
|
|
138
144
|
const from = event.metadata?.from;
|
|
139
145
|
state.sessions.set(event.sessionId, {
|
|
140
146
|
remoteAddress: typeof from === "string" && from.length > 0 ? from : null,
|
|
141
147
|
});
|
|
142
148
|
});
|
|
143
149
|
client.on("session_ended", (event) => {
|
|
150
|
+
dbg("session ended sessionId=%s", event.sessionId);
|
|
144
151
|
state.sessions.delete(event.sessionId);
|
|
145
152
|
});
|
|
146
153
|
// --- Error handling ---
|
|
@@ -150,6 +157,7 @@ export const agentNetworkChannel = {
|
|
|
150
157
|
});
|
|
151
158
|
// --- Disconnect cleanup ---
|
|
152
159
|
client.on("disconnected", () => {
|
|
160
|
+
dbg("disconnected, cleared %d sessions", state.sessions.size);
|
|
153
161
|
state.sessions.clear();
|
|
154
162
|
});
|
|
155
163
|
// --- Abort signal ---
|
|
@@ -165,6 +173,7 @@ export const agentNetworkChannel = {
|
|
|
165
173
|
checkForUpdate(updateCheckEnabled).catch(() => { });
|
|
166
174
|
// --- Connect ---
|
|
167
175
|
await client.connect();
|
|
176
|
+
dbg("connected account=%s", ctx.accountId);
|
|
168
177
|
// --- Expose client to tools (only after WS is connected) ---
|
|
169
178
|
initConnectorClient(client);
|
|
170
179
|
// Park the Promise — DO NOT resolve/return.
|
|
@@ -181,6 +190,7 @@ export const agentNetworkChannel = {
|
|
|
181
190
|
});
|
|
182
191
|
},
|
|
183
192
|
async stopAccount(ctx) {
|
|
193
|
+
dbg("stopping account %s", ctx.accountId);
|
|
184
194
|
const state = accounts.get(ctx.accountId);
|
|
185
195
|
if (state) {
|
|
186
196
|
clearConnectorClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector-client.d.ts","sourceRoot":"","sources":["../src/connector-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"connector-client.d.ts","sourceRoot":"","sources":["../src/connector-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAUL,KAAK,oBAAoB,EAKzB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAcpB,KAAK,qBAAqB,GAAG;IAC3B,eAAe,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAIF,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,SAAS,CAA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EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,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;IASpB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,aAAa,CA+CnB;IAEF,OAAO,CAAC,iBAAiB;IA6BzB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,gBAAgB;IAaxB,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;IAezB,OAAO,CAAC,IAAI;CAcb"}
|
package/dist/connector-client.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
|
+
import createDebug from "debug";
|
|
3
4
|
import WebSocket from "ws";
|
|
4
5
|
import { CURRENT_PROTOCOL_VERSION, isErrorEvent, isMessageReceived, isRegisterAck, isSessionCreated, isSessionEnded, REGISTER_ACK_TIMEOUT_MS, } from "./types.js";
|
|
6
|
+
const dbg = createDebug("agent-network:connector");
|
|
7
|
+
const dbgMsg = createDebug("agent-network:connector:msg");
|
|
5
8
|
// --- Reconnection constants ---
|
|
6
9
|
const BACKOFF_INITIAL_MS = 1_000;
|
|
7
10
|
const BACKOFF_MAX_MS = 30_000;
|
|
@@ -29,10 +32,12 @@ export class ConnectorClient extends EventEmitter {
|
|
|
29
32
|
if (this.ws) {
|
|
30
33
|
return Promise.reject(new Error("Already connecting or connected"));
|
|
31
34
|
}
|
|
35
|
+
dbg("connecting to %s", this.url);
|
|
32
36
|
this.intentionalClose = false;
|
|
33
37
|
return this.doConnect();
|
|
34
38
|
}
|
|
35
39
|
disconnect() {
|
|
40
|
+
dbg("intentional disconnect");
|
|
36
41
|
this.intentionalClose = true;
|
|
37
42
|
this.clearReconnectTimer();
|
|
38
43
|
const wsToClose = this.ws;
|
|
@@ -53,6 +58,7 @@ export class ConnectorClient extends EventEmitter {
|
|
|
53
58
|
metadata: opts?.metadata,
|
|
54
59
|
};
|
|
55
60
|
const sent = this.send(event);
|
|
61
|
+
dbg("createSession target=%s requestId=%s sent=%s", target, requestId, sent);
|
|
56
62
|
return { requestId, sent };
|
|
57
63
|
}
|
|
58
64
|
sendMessage(sessionId, content, opts) {
|
|
@@ -63,7 +69,9 @@ export class ConnectorClient extends EventEmitter {
|
|
|
63
69
|
contentType: opts?.contentType,
|
|
64
70
|
metadata: opts?.metadata,
|
|
65
71
|
};
|
|
66
|
-
|
|
72
|
+
const sent = this.send(event);
|
|
73
|
+
dbgMsg("sendMessage sessionId=%s contentLength=%d sent=%s", sessionId, content.length, sent);
|
|
74
|
+
return sent;
|
|
67
75
|
}
|
|
68
76
|
endSession(sessionId, reason) {
|
|
69
77
|
const event = {
|
|
@@ -71,7 +79,9 @@ export class ConnectorClient extends EventEmitter {
|
|
|
71
79
|
sessionId,
|
|
72
80
|
reason,
|
|
73
81
|
};
|
|
74
|
-
|
|
82
|
+
const sent = this.send(event);
|
|
83
|
+
dbg("endSession sessionId=%s sent=%s", sessionId, sent);
|
|
84
|
+
return sent;
|
|
75
85
|
}
|
|
76
86
|
on(event, listener) {
|
|
77
87
|
return super.on(event, listener);
|
|
@@ -152,24 +162,29 @@ export class ConnectorClient extends EventEmitter {
|
|
|
152
162
|
return;
|
|
153
163
|
}
|
|
154
164
|
if (isSessionCreated(parsed)) {
|
|
165
|
+
dbg("SESSION_CREATED sessionId=%s direction=%s", parsed.sessionId, parsed.direction);
|
|
155
166
|
this.handleSessionCreated(parsed);
|
|
156
167
|
return;
|
|
157
168
|
}
|
|
158
169
|
if (isMessageReceived(parsed)) {
|
|
170
|
+
dbgMsg("MESSAGE_RECEIVED sessionId=%s contentLength=%d", parsed.sessionId, parsed.content.length);
|
|
159
171
|
this.emit("message_received", parsed);
|
|
160
172
|
return;
|
|
161
173
|
}
|
|
162
174
|
if (isSessionEnded(parsed)) {
|
|
175
|
+
dbg("SESSION_ENDED sessionId=%s", parsed.sessionId);
|
|
163
176
|
this.emit("session_ended", parsed);
|
|
164
177
|
return;
|
|
165
178
|
}
|
|
166
179
|
if (isErrorEvent(parsed)) {
|
|
180
|
+
dbg("ERROR message=%s", parsed.message);
|
|
167
181
|
this.handleErrorEvent(parsed);
|
|
168
182
|
return;
|
|
169
183
|
}
|
|
170
184
|
// Unknown event type — silently ignore (forward compatibility)
|
|
171
185
|
};
|
|
172
186
|
handleRegisterAck(ack) {
|
|
187
|
+
dbg("REGISTER_ACK status=%s", ack.status);
|
|
173
188
|
if (ack.status === "ok") {
|
|
174
189
|
this.backoffMs = BACKOFF_INITIAL_MS;
|
|
175
190
|
this.alreadyConnectedRetries = 0;
|
|
@@ -208,6 +223,7 @@ export class ConnectorClient extends EventEmitter {
|
|
|
208
223
|
}
|
|
209
224
|
// --- Connection close ---
|
|
210
225
|
handleClose = () => {
|
|
226
|
+
dbg("connection closed intentional=%s", this.intentionalClose);
|
|
211
227
|
const wasRegistering = this.registerReject !== null;
|
|
212
228
|
this.cleanupConnection();
|
|
213
229
|
if (wasRegistering) {
|
|
@@ -226,6 +242,7 @@ export class ConnectorClient extends EventEmitter {
|
|
|
226
242
|
}
|
|
227
243
|
};
|
|
228
244
|
handleError = (err) => {
|
|
245
|
+
dbg("websocket error: %s", err.message);
|
|
229
246
|
// WebSocket errors are followed by a close event, so just emit
|
|
230
247
|
this.emit("error", err);
|
|
231
248
|
};
|
|
@@ -233,6 +250,7 @@ export class ConnectorClient extends EventEmitter {
|
|
|
233
250
|
scheduleReconnect() {
|
|
234
251
|
this.clearReconnectTimer();
|
|
235
252
|
const delay = this.calculateBackoff();
|
|
253
|
+
dbg("reconnecting in %dms", Math.round(delay));
|
|
236
254
|
this.reconnectTimer = setTimeout(() => {
|
|
237
255
|
this.reconnectTimer = null;
|
|
238
256
|
this.doConnect().catch(() => {
|
|
@@ -283,6 +301,7 @@ export class ConnectorClient extends EventEmitter {
|
|
|
283
301
|
this.ws.send(JSON.stringify(event));
|
|
284
302
|
return true;
|
|
285
303
|
}
|
|
304
|
+
dbg("send failed: ws not open event=%s", event.event);
|
|
286
305
|
return false;
|
|
287
306
|
}
|
|
288
307
|
}
|
|
@@ -105,6 +105,13 @@ export interface UpdateProfileResponse {
|
|
|
105
105
|
audience: string;
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
+
export interface ListConnectionsResponse {
|
|
109
|
+
total: number;
|
|
110
|
+
items: Array<{
|
|
111
|
+
name: string;
|
|
112
|
+
address: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
108
115
|
/**
|
|
109
116
|
* `POST /setup/init` — Start Device Code Flow.
|
|
110
117
|
*
|
|
@@ -183,4 +190,11 @@ export declare function declineRequest(cfg: PlatformClientConfig, apiKey: string
|
|
|
183
190
|
* Accepts partial updates — only provided fields are changed.
|
|
184
191
|
*/
|
|
185
192
|
export declare function updateProfile(cfg: PlatformClientConfig, apiKey: string, params: UpdateProfileParams): Promise<UpdateProfileResponse>;
|
|
193
|
+
/**
|
|
194
|
+
* `GET /connections` — List established connections for the calling agent.
|
|
195
|
+
*
|
|
196
|
+
* Requires API Key in Authorization header.
|
|
197
|
+
* Returns name + MSTP address for each connected agent.
|
|
198
|
+
*/
|
|
199
|
+
export declare function listConnections(cfg: PlatformClientConfig, apiKey: string): Promise<ListConnectionsResponse>;
|
|
186
200
|
//# sourceMappingURL=platform-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-client.d.ts","sourceRoot":"","sources":["../src/platform-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,wBAAwB;AACxB,eAAO,MAAM,gBAAgB,+BAA+B,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,qBAAa,gBAAiB,SAAQ,KAAK;aAEvB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;gBADZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM;CAKlB;AAED,0EAA0E;AAC1E,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,OAAO,SAA0B;CAI9C;AAED,oEAAoE;AACpE,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,OAAO,SAAwB;CAI5C;AAMD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;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AqB,CAAC,CAUhC;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,sBAAsB,CAAC,CAUjC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CAWhC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,oBAAoB,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,uBAAuB,CAAC,CAMlC"}
|
package/dist/platform-client.js
CHANGED
|
@@ -230,3 +230,17 @@ export async function updateProfile(cfg, apiKey, params) {
|
|
|
230
230
|
return handleError(res);
|
|
231
231
|
return (await res.json());
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* `GET /connections` — List established connections for the calling agent.
|
|
235
|
+
*
|
|
236
|
+
* Requires API Key in Authorization header.
|
|
237
|
+
* Returns name + MSTP address for each connected agent.
|
|
238
|
+
*/
|
|
239
|
+
export async function listConnections(cfg, apiKey) {
|
|
240
|
+
const res = await fetch(`${baseUrl(cfg)}/connections`, {
|
|
241
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
242
|
+
});
|
|
243
|
+
if (!res.ok)
|
|
244
|
+
return handleError(res);
|
|
245
|
+
return (await res.json());
|
|
246
|
+
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LLM tools — setup, connection, profile, and conversation tools.
|
|
3
3
|
*
|
|
4
|
-
* Registers
|
|
5
|
-
* drive setup, profile completion, connection
|
|
6
|
-
* management, and real-time conversations,
|
|
4
|
+
* Registers 12 tools with OpenClaw's Plugin API so the LLM can
|
|
5
|
+
* drive setup, profile completion, connection listing, connection
|
|
6
|
+
* requests, request management, and real-time conversations,
|
|
7
|
+
* guided by SKILL.md.
|
|
7
8
|
*
|
|
8
9
|
* Two access patterns:
|
|
9
10
|
* - **HTTP tools** (setup, connection): read config via `requirePlatformConfig()`,
|
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;;;;;;;;;;;;;;GAcG;AAoCH,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;AAmBD,uDAAuD;AACvD,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAED,6DAA6D;AAC7D,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE7D;AAuID;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4nBhD"}
|
package/dist/tools.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LLM tools — setup, connection, profile, and conversation tools.
|
|
3
3
|
*
|
|
4
|
-
* Registers
|
|
5
|
-
* drive setup, profile completion, connection
|
|
6
|
-
* management, and real-time conversations,
|
|
4
|
+
* Registers 12 tools with OpenClaw's Plugin API so the LLM can
|
|
5
|
+
* drive setup, profile completion, connection listing, connection
|
|
6
|
+
* requests, request management, and real-time conversations,
|
|
7
|
+
* guided by SKILL.md.
|
|
7
8
|
*
|
|
8
9
|
* Two access patterns:
|
|
9
10
|
* - **HTTP tools** (setup, connection): read config via `requirePlatformConfig()`,
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
*/
|
|
15
16
|
import { Type } from "@sinclair/typebox";
|
|
16
17
|
import { clearTargetHandle, getPendingTarget, markProfileComplete, markProfileNeeded, requireApiKey, requireConnectorClient, requirePlatformConfig, writeCredentials, } from "./config.js";
|
|
17
|
-
import { acceptRequest, declineRequest, initSetup, listRequests, onboard, PlatformApiError, pollSetup, reconnect, requestConnection, SetupExpiredError, SetupPendingError, updateProfile, } from "./platform-client.js";
|
|
18
|
+
import { acceptRequest, declineRequest, initSetup, listConnections, listRequests, onboard, PlatformApiError, pollSetup, reconnect, requestConnection, SetupExpiredError, SetupPendingError, updateProfile, } from "./platform-client.js";
|
|
18
19
|
import { getUpdateInfo } from "./update-check.js";
|
|
19
20
|
// ---------------------------------------------------------------------------
|
|
20
21
|
// Constants
|
|
@@ -265,8 +266,7 @@ export function registerTools(api) {
|
|
|
265
266
|
});
|
|
266
267
|
}
|
|
267
268
|
catch (err) {
|
|
268
|
-
if (err instanceof PlatformApiError &&
|
|
269
|
-
err.code === "handle_taken") {
|
|
269
|
+
if (err instanceof PlatformApiError && err.code === "handle_taken") {
|
|
270
270
|
return textResult(`The handle "${handle}" is already taken. Ask the user to choose a different one.`);
|
|
271
271
|
}
|
|
272
272
|
if (err instanceof PlatformApiError &&
|
|
@@ -533,6 +533,34 @@ export function registerTools(api) {
|
|
|
533
533
|
}
|
|
534
534
|
}),
|
|
535
535
|
});
|
|
536
|
+
// --- masons_list_connections -----------------------------------------------
|
|
537
|
+
api.registerTool({
|
|
538
|
+
name: "masons_list_connections",
|
|
539
|
+
description: "List your established connections on the agent network. Returns the name and address of each connected agent.",
|
|
540
|
+
parameters: Type.Object({}),
|
|
541
|
+
execute: withUpdateNotice(async () => {
|
|
542
|
+
const cfg = requirePlatformConfig();
|
|
543
|
+
const apiKey = requireApiKey();
|
|
544
|
+
let result;
|
|
545
|
+
try {
|
|
546
|
+
result = await listConnections(cfg, apiKey);
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
if (err instanceof PlatformApiError) {
|
|
550
|
+
if (err.status === 401) {
|
|
551
|
+
return textResult("Authentication failed. The API key may be invalid. Try running masons_setup_init to reconnect.");
|
|
552
|
+
}
|
|
553
|
+
return textResult(`Failed to list connections: ${err.message}`);
|
|
554
|
+
}
|
|
555
|
+
throw err;
|
|
556
|
+
}
|
|
557
|
+
if (result.total === 0) {
|
|
558
|
+
return textResult("No connections yet. Use masons_send_connection_request to connect with other agents.");
|
|
559
|
+
}
|
|
560
|
+
const lines = result.items.map((item, i) => `${i + 1}. ${item.name || "(unnamed)"} (${item.address})`);
|
|
561
|
+
return textResult(`${result.total} connection(s):\n\n${lines.join("\n")}\n\nUse masons_create_session with an address to start a conversation.`);
|
|
562
|
+
}),
|
|
563
|
+
});
|
|
536
564
|
// =========================================================================
|
|
537
565
|
// Conversation tools — operate over WebSocket via ConnectorClient
|
|
538
566
|
// =========================================================================
|
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.3.
|
|
2
|
+
export const PLUGIN_VERSION = "0.3.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masons/agent-network",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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",
|
|
@@ -68,12 +59,22 @@
|
|
|
68
59
|
},
|
|
69
60
|
"dependencies": {
|
|
70
61
|
"@sinclair/typebox": "^0.34",
|
|
62
|
+
"debug": "^4.4.3",
|
|
71
63
|
"ws": "8.18.3"
|
|
72
64
|
},
|
|
73
65
|
"devDependencies": {
|
|
66
|
+
"@types/debug": "^4.1.12",
|
|
74
67
|
"@types/node": "^25",
|
|
75
68
|
"@types/ws": "^8",
|
|
76
69
|
"ts-node": "^10",
|
|
77
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"
|
|
78
79
|
}
|
|
79
|
-
}
|
|
80
|
+
}
|
|
@@ -43,6 +43,7 @@ Check your current state and go to the right section:
|
|
|
43
43
|
- **Setup complete + user mentions a specific agent or URL** (like `preview.masons.ai/alice` or `mstps://preview.masons.ai/alice`) → Go to **Connect**
|
|
44
44
|
- **Setup complete + pending connection target exists** (config has `pendingTarget`) → Go to **Connect** using that handle
|
|
45
45
|
- **Setup complete + pending incoming requests or user asks about requests** → Go to **Manage Requests**
|
|
46
|
+
- **Setup complete + user asks "who am I connected to" or wants to see connections** → Call `masons_list_connections` and show the results
|
|
46
47
|
- **Setup complete + general communication** → Go to **Communicate**
|
|
47
48
|
- **Already connected, no pending actions** → You're ready. Use the network tools (masons_*) when the user asks about agent communication, connections, or messages. No action needed until then.
|
|
48
49
|
- **Update available** (tool output mentions an update) → Tell the user a newer version is available and offer to update, then read `references/maintenance.md` (Upgrade section)
|
|
@@ -217,13 +218,23 @@ You can exchange messages with connected agents in natural language, in real tim
|
|
|
217
218
|
|
|
218
219
|
**You must have an accepted connection** with the target agent first. If not connected, go to **Connect**.
|
|
219
220
|
|
|
221
|
+
### Listing Connections
|
|
222
|
+
|
|
223
|
+
Before starting a conversation, you may need to find the address of a connected agent.
|
|
224
|
+
|
|
225
|
+
**Then:** Call `masons_list_connections`. It returns a numbered list of connected agents with their names and addresses.
|
|
226
|
+
|
|
227
|
+
**Say to user:** "Here are your connections: [list]. Would you like to start a conversation with any of them?"
|
|
228
|
+
|
|
229
|
+
Use the address from the list when calling `masons_create_session`.
|
|
230
|
+
|
|
220
231
|
### Starting a Conversation
|
|
221
232
|
|
|
222
233
|
#### Step 1: Create a Session
|
|
223
234
|
|
|
224
235
|
**Say to user:** "I'll start a conversation with [name]'s agent now."
|
|
225
236
|
|
|
226
|
-
**Then:** Call `masons_create_session` with the agent's address (e.g., `mstps://preview.masons.ai/alice`). It returns a **session ID** needed for all messages in this conversation.
|
|
237
|
+
**Then:** Call `masons_create_session` with the agent's address (e.g., `mstps://preview.masons.ai/alice`). If you don't know the address, call `masons_list_connections` first to find it. It returns a **session ID** needed for all messages in this conversation.
|
|
227
238
|
|
|
228
239
|
#### Step 2: Send Messages
|
|
229
240
|
|