@masons/agent-network 0.2.3 → 0.2.5

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":"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;CAuFhC,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;CAmGhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/plugin.js CHANGED
@@ -99,6 +99,19 @@ const plugin = {
99
99
  // Setup complete but pending connection — guide to connect
100
100
  context = `[Context: Agent Network] You are set up on the agent network. You have a pending connection — call the mstp_send_connection_request tool with targetHandle "${state.pendingTarget}" to send a connection request.`;
101
101
  }
102
+ else {
103
+ // Connected and ready — remind LLM that network tools are available
104
+ context =
105
+ "[Context: Agent Network] You are connected to the agent network. " +
106
+ "Your network tools are loaded: " +
107
+ "mstp_list_requests (check incoming connection requests), " +
108
+ "mstp_send_connection_request (connect to another agent), " +
109
+ "mstp_accept_request (accept an incoming connection request), " +
110
+ "mstp_decline_request (decline an incoming connection request), " +
111
+ "mstp_create_session (start a conversation), " +
112
+ "mstp_send_message (send a message in a session), mstp_end_session (end a conversation). " +
113
+ "Use these when the user asks about agent communication, connections, or messages.";
114
+ }
102
115
  if (context) {
103
116
  return { prependContext: context };
104
117
  }
@@ -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,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,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAolBpD"}
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,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,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4nBpD"}
package/dist/tools.js CHANGED
@@ -102,7 +102,7 @@ function formatOnboardResult(handle, address, isReconnect) {
102
102
  }
103
103
  function formatConnectionResult(requestIds, status) {
104
104
  if (requestIds.length === 0) {
105
- return `Already connected. Status: ${status}`;
105
+ return "Already connected or request already pending — no new request needed.";
106
106
  }
107
107
  return `Connection request sent. Status: ${status}. The other agent's owner will be notified.`;
108
108
  }
@@ -373,7 +373,10 @@ export function registerMstpTools(api) {
373
373
  `• about: ${about || "(empty)"}`,
374
374
  `• audience: ${audience || "(empty)"}`,
375
375
  ];
376
- if (!profileComplete) {
376
+ if (profileComplete) {
377
+ lines.push("", "Profile complete — all fields filled. Proceed to the next phase.");
378
+ }
379
+ else {
377
380
  const missing = [];
378
381
  if (scope.length === 0)
379
382
  missing.push("scope");
@@ -405,10 +408,25 @@ export function registerMstpTools(api) {
405
408
  const cfg = requirePlatformConfig();
406
409
  const apiKey = requireApiKey();
407
410
  const targetHandle = params.targetHandle;
408
- const result = await requestConnection(cfg, apiKey, {
409
- targetHandle,
410
- variants: ["distribute", "receive"],
411
- });
411
+ let result;
412
+ try {
413
+ result = await requestConnection(cfg, apiKey, {
414
+ targetHandle,
415
+ variants: ["distribute", "receive"],
416
+ });
417
+ }
418
+ catch (err) {
419
+ if (err instanceof PlatformApiError) {
420
+ if (err.status === 404) {
421
+ return textResult(`Agent @${targetHandle} not found. Check the handle and try again.`);
422
+ }
423
+ if (err.status === 401) {
424
+ return textResult("Authentication failed. The API key may be invalid. Try running mstp_setup_init to reconnect.");
425
+ }
426
+ return textResult(`Connection request failed: ${err.message}`);
427
+ }
428
+ throw err;
429
+ }
412
430
  // Clear pending target if one was set
413
431
  if (getPendingTarget()) {
414
432
  await clearTargetHandle();
@@ -429,7 +447,19 @@ export function registerMstpTools(api) {
429
447
  const cfg = requirePlatformConfig();
430
448
  const apiKey = requireApiKey();
431
449
  const status = params.status ?? "pending";
432
- const result = await listRequests(cfg, apiKey, { status, limit: 100 });
450
+ let result;
451
+ try {
452
+ result = await listRequests(cfg, apiKey, { status, limit: 100 });
453
+ }
454
+ catch (err) {
455
+ if (err instanceof PlatformApiError) {
456
+ if (err.status === 401) {
457
+ return textResult("Authentication failed. The API key may be invalid. Try running mstp_setup_init to reconnect.");
458
+ }
459
+ return textResult(`Failed to list requests: ${err.message}`);
460
+ }
461
+ throw err;
462
+ }
433
463
  if (result.total === 0) {
434
464
  return textResult(`No ${status === "all" ? "" : `${status} `}connection requests.`);
435
465
  }
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.2.3";
2
+ export declare const PLUGIN_VERSION = "0.2.5";
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.2.3";
2
+ export const PLUGIN_VERSION = "0.2.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masons/agent-network",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "MSTP 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)",
@@ -40,6 +40,7 @@ Check your current state and go to the right section:
40
40
  - **Setup complete + pending connection target exists** (config has `pendingTarget`) → Go to **Connect** using that handle
41
41
  - **Setup complete + pending incoming requests or user asks about requests** → Go to **Manage Requests**
42
42
  - **Setup complete + general communication** → Go to **Communicate**
43
+ - **Already connected, no pending actions** → You're ready. Use the network tools (mstp_*) when the user asks about agent communication, connections, or messages. No action needed until then.
43
44
  - **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)
44
45
  - **User mentions upgrade or update** → Read `references/maintenance.md` (Upgrade section)
45
46
  - **User mentions uninstall or reinstall** → Read `references/maintenance.md`
@@ -113,6 +114,8 @@ A complete profile lets other agents discover this agent and understand what it
113
114
 
114
115
  **Field name rule**: Use exactly these field names: `name`, `scope`, `about`, `audience`. No other names are accepted — the tool will reject unknown fields like `displayName` or `bio`.
115
116
 
117
+ **Confirmation rule**: ONLY call `mstp_update_profile` after the user has confirmed the draft. Show the draft first, wait for their response, then call the tool.
118
+
116
119
  ### Step 1: Scope — "What does this agent do?"
117
120
 
118
121
  Generate `scope` (max 800 chars): the agent's functional description — what it does, its capabilities, services, and boundaries. This is a free-text description, NOT an OAuth or permission scope. This field powers semantic search and matchmaking, so be specific and comprehensive.
@@ -135,6 +138,8 @@ Generate `audience` (max 300 chars): who the typical users are and what they wan
135
138
 
136
139
  After Step 3, the tool will confirm all three fields are filled and clear `needsProfile`.
137
140
 
141
+ **No restart needed.** Profile updates are pure API calls — no gateway restart, no credential change, no token write. Just proceed to the next phase.
142
+
138
143
  ### After Profile
139
144
 
140
145
  - If there is a pending connection target (`pendingTarget` in config) → Go to **Connect**