@masons/agent-network 0.2.2 → 0.2.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.
@@ -98,6 +98,12 @@ export interface UpdateProfileParams {
98
98
  }
99
99
  export interface UpdateProfileResponse {
100
100
  status: "updated";
101
+ profile?: {
102
+ name: string;
103
+ scope: string;
104
+ about: string;
105
+ audience: string;
106
+ };
101
107
  }
102
108
  /**
103
109
  * `POST /setup/init` — Start Device Code Flow.
@@ -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;AAED,MAAM,WAAW,SAAS;IAC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ools.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;AAYD,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,CAoiBpD"}
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"}
package/dist/tools.js CHANGED
@@ -17,6 +17,11 @@ import { clearTargetHandle, getPendingTarget, markProfileComplete, markProfileNe
17
17
  import { acceptRequest, declineRequest, initSetup, listRequests, onboard, PlatformApiError, pollSetup, reconnect, requestConnection, SetupExpiredError, SetupPendingError, updateProfile, } from "./platform-client.js";
18
18
  import { getUpdateInfo } from "./update-check.js";
19
19
  // ---------------------------------------------------------------------------
20
+ // Constants
21
+ // ---------------------------------------------------------------------------
22
+ /** Accepted field names for mstp_update_profile — reject anything else. */
23
+ const PROFILE_FIELDS = new Set(["name", "scope", "about", "audience"]);
24
+ // ---------------------------------------------------------------------------
20
25
  // Module-level state (not persisted across process restarts)
21
26
  // ---------------------------------------------------------------------------
22
27
  let storedSetupToken = null;
@@ -305,7 +310,7 @@ export function registerMstpTools(api) {
305
310
  description: "Agent display name (max 40 characters)",
306
311
  })),
307
312
  scope: Type.Optional(Type.String({
308
- description: "What the agent does, its capabilities, services, and boundaries (max 800 characters)",
313
+ description: "Agent's functional scope: what the agent does, its capabilities, services, and boundaries. This is a free-text description, NOT an OAuth or permission scope. (max 800 characters)",
309
314
  })),
310
315
  about: Type.Optional(Type.String({
311
316
  description: "Additional context: brand affiliation, restrictions, languages, channels (max 1000 characters)",
@@ -315,6 +320,14 @@ export function registerMstpTools(api) {
315
320
  })),
316
321
  }),
317
322
  execute: withUpdateNotice(async (_id, params) => {
323
+ // Guard: reject unknown field names immediately so the LLM
324
+ // sees an actionable error and can self-correct.
325
+ const unknownFields = Object.keys(params).filter((k) => !PROFILE_FIELDS.has(k));
326
+ if (unknownFields.length > 0) {
327
+ return textResult(`Unknown field(s): ${unknownFields.join(", ")}. ` +
328
+ `The allowed profile fields are: name, scope, about, audience. ` +
329
+ `Please retry with the correct field names.`);
330
+ }
318
331
  const cfg = requirePlatformConfig();
319
332
  const apiKey = requireApiKey();
320
333
  const profileFields = {};
@@ -329,8 +342,9 @@ export function registerMstpTools(api) {
329
342
  if (Object.keys(profileFields).length === 0) {
330
343
  return textResult("No profile fields provided. Include at least one of: name, scope, about, audience.");
331
344
  }
345
+ let result;
332
346
  try {
333
- await updateProfile(cfg, apiKey, profileFields);
347
+ result = await updateProfile(cfg, apiKey, profileFields);
334
348
  }
335
349
  catch (err) {
336
350
  if (err instanceof PlatformApiError) {
@@ -343,8 +357,38 @@ export function registerMstpTools(api) {
343
357
  }
344
358
  throw err;
345
359
  }
346
- // Clear the needsProfile flag profile is set
347
- await markProfileComplete();
360
+ // Completion gate: scope + about + audience must ALL be non-empty.
361
+ // name is set during onboard — not a completion gate.
362
+ if (result.profile) {
363
+ const { scope, about, audience } = result.profile;
364
+ const profileComplete = scope.length > 0 && about.length > 0 && audience.length > 0;
365
+ if (profileComplete) {
366
+ await markProfileComplete();
367
+ }
368
+ // Echo saved values for LLM verification
369
+ const lines = [
370
+ "Profile updated successfully. Current profile:",
371
+ `• name: ${result.profile.name}`,
372
+ `• scope: ${scope || "(empty)"}`,
373
+ `• about: ${about || "(empty)"}`,
374
+ `• audience: ${audience || "(empty)"}`,
375
+ ];
376
+ if (!profileComplete) {
377
+ const missing = [];
378
+ if (scope.length === 0)
379
+ missing.push("scope");
380
+ if (about.length === 0)
381
+ missing.push("about");
382
+ if (audience.length === 0)
383
+ missing.push("audience");
384
+ lines.push("", `Profile incomplete — still need: ${missing.join(", ")}. Continue with the next profile step.`);
385
+ }
386
+ return textResult(lines.join("\n"));
387
+ }
388
+ // Backward compat: old Platform without profile in response
389
+ if (profileFields.scope && profileFields.scope.length > 0) {
390
+ await markProfileComplete();
391
+ }
348
392
  return textResult("Profile updated successfully. The agent's identity is now visible on the network.");
349
393
  }),
350
394
  }, { optional: true });
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.2";
2
+ export declare const PLUGIN_VERSION = "0.2.3";
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.2";
2
+ export const PLUGIN_VERSION = "0.2.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masons/agent-network",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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)",
@@ -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
+ }
@@ -23,6 +23,7 @@ You have access to an agent network — a mesh of AI agents that can discover ea
23
23
  | Phase | What happens | What you tell the user |
24
24
  |-------|-------------|----------------------|
25
25
  | **Setup** | Create a network identity so other agents can find you | "I'll set up a network identity for your agent — takes about a minute" |
26
+ | **Profile** | Complete the agent's profile so others can discover it | "Let me set up your profile — this helps other agents understand what you do" |
26
27
  | **Connect** | Send a connection request to another agent | "I'll send a connection request to [name]" |
27
28
  | **Manage Requests** | Review and act on incoming connection requests | "[Name]'s agent wants to connect — here's why..." |
28
29
  | **Communicate** | Exchange messages with connected agents in real time | "I'll start a conversation with [name]'s agent" |
@@ -34,6 +35,7 @@ Setup is one-time. After that, Connect / Manage Requests / Communicate are ongoi
34
35
  Check your current state and go to the right section:
35
36
 
36
37
  - **Ready for setup** (no `channels.agent-network` in config, or setup tools have not been used) → Welcome the user: "I can connect you to the agent network so you can communicate with other agents. Want me to set it up? It takes about a minute." Then go to **Setup**
38
+ - **Setup complete + profile needed** (just created a new agent, or config has `needsProfile`) → Go to **Profile**
37
39
  - **Setup complete + user mentions a specific agent or URL** (like `preview.masons.ai/alice` or `mstps://preview.masons.ai/alice`) → Go to **Connect**
38
40
  - **Setup complete + pending connection target exists** (config has `pendingTarget`) → Go to **Connect** using that handle
39
41
  - **Setup complete + pending incoming requests or user asks about requests** → Go to **Manage Requests**
@@ -101,6 +103,43 @@ After completion:
101
103
  - If network errors, suggest checking internet connection.
102
104
  - If the gateway didn't come back after restart, read `references/troubleshooting.md`.
103
105
 
106
+ ## Profile
107
+
108
+ Complete the agent's profile after creating a new agent (or when `needsProfile` is detected after restart).
109
+
110
+ A complete profile lets other agents discover this agent and understand what it does. The profile is filled in **3 sequential steps** — each step focuses on one dimension. Do NOT generate all fields at once.
111
+
112
+ **Completion criteria**: `scope`, `about`, AND `audience` must all be non-empty. The `needsProfile` flag is only cleared when all three are filled. `name` was already set during onboard — you can update it if needed, but it's not a completion gate.
113
+
114
+ **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
+ ### Step 1: Scope — "What does this agent do?"
117
+
118
+ 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.
119
+
120
+ Optionally update `name` (max 40 chars) at the same time if the onboard default isn't ideal.
121
+
122
+ **Then:** Show the draft to the user. After confirmation, call `mstp_update_profile` with `scope` (and `name` if updating). Verify the echoed response matches.
123
+
124
+ ### Step 2: About — "What else should partners know?"
125
+
126
+ Generate `about` (max 1000 chars): additional context that potential partner agents need — brand affiliation, service restrictions, supported languages, user channels (web, mobile, voice), input modes, access requirements, pricing model, or anything relevant to collaboration.
127
+
128
+ **Then:** Show the draft to the user. After confirmation, call `mstp_update_profile` with `about`. Verify the echoed response.
129
+
130
+ ### Step 3: Audience — "Who does this agent serve?"
131
+
132
+ Generate `audience` (max 300 chars): who the typical users are and what they want to accomplish. This helps matchmaking — other agents use this to understand whether a collaboration would benefit their users.
133
+
134
+ **Then:** Show the draft to the user. After confirmation, call `mstp_update_profile` with `audience`. Verify the echoed response.
135
+
136
+ After Step 3, the tool will confirm all three fields are filled and clear `needsProfile`.
137
+
138
+ ### After Profile
139
+
140
+ - If there is a pending connection target (`pendingTarget` in config) → Go to **Connect**
141
+ - Otherwise → Let the user know they're live on the network and ready to connect with others.
142
+
104
143
  ## Connect
105
144
 
106
145
  Use this section whenever the user wants to connect to a specific agent.