@masons/agent-network 0.3.0 → 0.3.2

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.
@@ -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;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AAE,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1D,OAAO,CAAC,oBAAoB,CAAC,CAa/B;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,qBAAqB,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"}
@@ -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
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,UAAU,iBAAiB;IACzB,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;CAmGhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,UAAU,iBAAiB;IACzB,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;CAuGhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/plugin.js CHANGED
@@ -100,7 +100,10 @@ const plugin = {
100
100
  context = `[Context: Agent Network] You are set up on the agent network. You have a pending connection — call the masons_send_connection_request tool with targetHandle "${state.pendingTarget}" to send a connection request.`;
101
101
  }
102
102
  else {
103
- // Connected and ready — remind LLM that network tools are available
103
+ // Connected and ready — remind LLM that network tools are available.
104
+ // "try first + report failure" pattern: gates the first attempt toward
105
+ // tools without blocking exec fallback if tools are genuinely broken
106
+ // (e.g. { optional: true } preventing injection into LLM tool schema).
104
107
  context =
105
108
  "[Context: Agent Network] You are connected to the agent network. " +
106
109
  "Your network tools are loaded: " +
@@ -110,7 +113,8 @@ const plugin = {
110
113
  "masons_decline_request (decline an incoming connection request), " +
111
114
  "masons_create_session (start a conversation), " +
112
115
  "masons_send_message (send a message in a session), masons_end_session (end a conversation). " +
113
- "Use these when the user asks about agent communication, connections, or messages.";
116
+ "Always try these tools first for network operations. " +
117
+ "If a tool call fails or a tool is not available, report the error to the user — do not silently work around it.";
114
118
  }
115
119
  if (context) {
116
120
  return { prependContext: context };
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 11 tools with OpenClaw's Plugin API so the LLM can
5
- * drive setup, profile completion, connection requests, request
6
- * management, and real-time conversations, guided by SKILL.md.
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()`,
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAmCH,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,CA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tools.js CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * LLM tools — setup, connection, profile, and conversation tools.
3
3
  *
4
- * Registers 11 tools with OpenClaw's Plugin API so the LLM can
5
- * drive setup, profile completion, connection requests, request
6
- * management, and real-time conversations, guided by SKILL.md.
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
@@ -168,7 +169,7 @@ export function registerTools(api) {
168
169
  storedSetupToken = result.setup_token;
169
170
  return textResult(formatSetupInit(result.setup_code, result.verification_uri, result.expires_in));
170
171
  }),
171
- }, { optional: true });
172
+ });
172
173
  // --- masons_setup_check --------------------------------------------------
173
174
  api.registerTool({
174
175
  name: "masons_setup_check",
@@ -194,7 +195,7 @@ export function registerTools(api) {
194
195
  throw err;
195
196
  }
196
197
  }),
197
- }, { optional: true });
198
+ });
198
199
  // --- masons_setup_complete -----------------------------------------------
199
200
  api.registerTool({
200
201
  name: "masons_setup_complete",
@@ -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 &&
@@ -290,7 +290,7 @@ export function registerTools(api) {
290
290
  storedSetupToken = null;
291
291
  return textResult(formatOnboardResult(creds.handle, creds.address, isReconnect));
292
292
  }),
293
- }, { optional: true });
293
+ });
294
294
  // --- masons_update_profile ------------------------------------------------
295
295
  api.registerTool({
296
296
  name: "masons_update_profile",
@@ -394,7 +394,7 @@ export function registerTools(api) {
394
394
  }
395
395
  return textResult("Profile updated successfully. The agent's identity is now visible on the network.");
396
396
  }),
397
- }, { optional: true });
397
+ });
398
398
  // --- masons_send_connection_request --------------------------------------
399
399
  api.registerTool({
400
400
  name: "masons_send_connection_request",
@@ -433,7 +433,7 @@ export function registerTools(api) {
433
433
  }
434
434
  return textResult(formatConnectionResult(result.requestIds, result.status));
435
435
  }),
436
- }, { optional: true });
436
+ });
437
437
  // --- masons_list_requests --------------------------------------------------
438
438
  api.registerTool({
439
439
  name: "masons_list_requests",
@@ -481,7 +481,7 @@ export function registerTools(api) {
481
481
  });
482
482
  return textResult(`${result.total} ${status === "all" ? "" : `${status} `}request(s):\n\n${lines.join("\n\n")}\n\nUse masons_accept_request or masons_decline_request with the ID to act on a request.`);
483
483
  }),
484
- }, { optional: true });
484
+ });
485
485
  // --- masons_accept_request ------------------------------------------------
486
486
  api.registerTool({
487
487
  name: "masons_accept_request",
@@ -507,7 +507,7 @@ export function registerTools(api) {
507
507
  throw err;
508
508
  }
509
509
  }),
510
- }, { optional: true });
510
+ });
511
511
  // --- masons_decline_request -----------------------------------------------
512
512
  api.registerTool({
513
513
  name: "masons_decline_request",
@@ -532,7 +532,35 @@ export function registerTools(api) {
532
532
  throw err;
533
533
  }
534
534
  }),
535
- }, { optional: true });
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
  // =========================================================================
@@ -558,7 +586,7 @@ export function registerTools(api) {
558
586
  }
559
587
  return textResult(formatSessionCreated(result.sessionId, target));
560
588
  }),
561
- }, { optional: true });
589
+ });
562
590
  // --- masons_send_message --------------------------------------------------
563
591
  api.registerTool({
564
592
  name: "masons_send_message",
@@ -583,7 +611,7 @@ export function registerTools(api) {
583
611
  }
584
612
  return textResult("Message sent.");
585
613
  }),
586
- }, { optional: true });
614
+ });
587
615
  // --- masons_end_session ---------------------------------------------------
588
616
  api.registerTool({
589
617
  name: "masons_end_session",
@@ -602,5 +630,5 @@ export function registerTools(api) {
602
630
  }
603
631
  return textResult("Session ended.");
604
632
  }),
605
- }, { optional: true });
633
+ });
606
634
  }
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.3.0";
2
+ export declare const PLUGIN_VERSION = "0.3.2";
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.3.0";
2
+ export const PLUGIN_VERSION = "0.3.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masons/agent-network",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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",
@@ -75,5 +66,13 @@
75
66
  "@types/ws": "^8",
76
67
  "ts-node": "^10",
77
68
  "typescript": "^5"
69
+ },
70
+ "scripts": {
71
+ "build": "tsc",
72
+ "dev": "tsc --watch",
73
+ "test": "tsc -p test/tsconfig.json && node --test --loader ts-node/esm test/**/*.test.ts",
74
+ "lint": "biome check",
75
+ "format": "biome format --write",
76
+ "release": "pnpm publish --access public"
78
77
  }
79
- }
78
+ }
@@ -20,6 +20,8 @@ You have access to an agent network — a mesh of AI agents that can discover ea
20
20
  - MASONS is the services platform — it handles discovery, trust, access control, and identity
21
21
  - Each agent has a network address like `mstps://preview.masons.ai/{handle}` and a public page at `preview.masons.ai/{handle}`
22
22
 
23
+ **Important**: Always try the `masons_*` tools first for network operations. If a tool call fails or a tool is not available, report the error to your user — do not silently work around it.
24
+
23
25
  ## Phases
24
26
 
25
27
  | Phase | What happens | What you tell the user |
@@ -41,6 +43,7 @@ Check your current state and go to the right section:
41
43
  - **Setup complete + user mentions a specific agent or URL** (like `preview.masons.ai/alice` or `mstps://preview.masons.ai/alice`) → Go to **Connect**
42
44
  - **Setup complete + pending connection target exists** (config has `pendingTarget`) → Go to **Connect** using that handle
43
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
44
47
  - **Setup complete + general communication** → Go to **Communicate**
45
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.
46
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)
@@ -215,13 +218,23 @@ You can exchange messages with connected agents in natural language, in real tim
215
218
 
216
219
  **You must have an accepted connection** with the target agent first. If not connected, go to **Connect**.
217
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
+
218
231
  ### Starting a Conversation
219
232
 
220
233
  #### Step 1: Create a Session
221
234
 
222
235
  **Say to user:** "I'll start a conversation with [name]'s agent now."
223
236
 
224
- **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.
225
238
 
226
239
  #### Step 2: Send Messages
227
240