@masons/agent-network 0.2.1 → 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.
- package/dist/config.d.ts +20 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -2
- package/dist/platform-client.d.ts +23 -0
- package/dist/platform-client.d.ts.map +1 -1
- package/dist/platform-client.js +19 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +12 -2
- package/dist/tools.d.ts +4 -4
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +174 -19
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/agent-network/SKILL.md +39 -0
package/dist/config.d.ts
CHANGED
|
@@ -104,12 +104,32 @@ export declare function writeTargetHandle(handle: string): Promise<void>;
|
|
|
104
104
|
* within the same session (since `initToolConfig()` only runs at startup).
|
|
105
105
|
*/
|
|
106
106
|
export declare function clearTargetHandle(): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Mark that this agent needs profile completion.
|
|
109
|
+
*
|
|
110
|
+
* Called after onboard (new agent creation) — the agent has an empty profile.
|
|
111
|
+
* The before_agent_start hook reads this to inject profile generation context.
|
|
112
|
+
*/
|
|
113
|
+
export declare function markProfileNeeded(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Mark that profile completion is done.
|
|
116
|
+
*
|
|
117
|
+
* Called after successful mstp_update_profile — clears the needsProfile flag
|
|
118
|
+
* so the before_agent_start hook no longer injects profile context on restart.
|
|
119
|
+
*
|
|
120
|
+
* Note: unlike clearTargetHandle, this only writes to disk — there is no
|
|
121
|
+
* module-level variable for needsProfile. The before_agent_start hook is
|
|
122
|
+
* one-shot (hasInjectedContinuity flag), so stale reads are not a concern.
|
|
123
|
+
*/
|
|
124
|
+
export declare function markProfileComplete(): Promise<void>;
|
|
107
125
|
/** Pending state detected from config file — used for restart continuity. */
|
|
108
126
|
export interface PendingState {
|
|
109
127
|
/** Whether valid credentials exist (connectorUrl + token) */
|
|
110
128
|
hasCredentials: boolean;
|
|
111
129
|
/** Pending connection target handle, or null if none */
|
|
112
130
|
pendingTarget: string | null;
|
|
131
|
+
/** Whether the agent needs profile completion (new agent, empty profile) */
|
|
132
|
+
needsProfile: boolean;
|
|
113
133
|
}
|
|
114
134
|
/**
|
|
115
135
|
* Detect pending state by reading config file directly.
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAuB9B;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAMhC;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAkBjE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAOjE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAMD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,oBAAoB,CAE5D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CAOxD;AAMD,+EAA+E;AAC/E,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAgDD,MAAM,WAA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ACH,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CAOxD;AAMD,+EAA+E;AAC/E,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAgDD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrE;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQvD;AAMD;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKvD;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKzD;AAMD,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,cAAc,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,4EAA4E;IAC5E,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CAyBhE;AAMD,uDAAuD;AACvD,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
|
package/dist/config.js
CHANGED
|
@@ -238,6 +238,37 @@ export async function clearTargetHandle() {
|
|
|
238
238
|
// Update module-level var — deliberate exception to read/write separation
|
|
239
239
|
storedPendingTarget = null;
|
|
240
240
|
}
|
|
241
|
+
// ---------------------------------------------------------------------------
|
|
242
|
+
// Profile state (set after onboard, cleared after profile update)
|
|
243
|
+
// ---------------------------------------------------------------------------
|
|
244
|
+
/**
|
|
245
|
+
* Mark that this agent needs profile completion.
|
|
246
|
+
*
|
|
247
|
+
* Called after onboard (new agent creation) — the agent has an empty profile.
|
|
248
|
+
* The before_agent_start hook reads this to inject profile generation context.
|
|
249
|
+
*/
|
|
250
|
+
export async function markProfileNeeded() {
|
|
251
|
+
const config = await readConfig();
|
|
252
|
+
const mstp = ensureMstpSection(config);
|
|
253
|
+
mstp.needsProfile = true;
|
|
254
|
+
await persistConfig(config);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Mark that profile completion is done.
|
|
258
|
+
*
|
|
259
|
+
* Called after successful mstp_update_profile — clears the needsProfile flag
|
|
260
|
+
* so the before_agent_start hook no longer injects profile context on restart.
|
|
261
|
+
*
|
|
262
|
+
* Note: unlike clearTargetHandle, this only writes to disk — there is no
|
|
263
|
+
* module-level variable for needsProfile. The before_agent_start hook is
|
|
264
|
+
* one-shot (hasInjectedContinuity flag), so stale reads are not a concern.
|
|
265
|
+
*/
|
|
266
|
+
export async function markProfileComplete() {
|
|
267
|
+
const config = await readConfig();
|
|
268
|
+
const mstp = ensureMstpSection(config);
|
|
269
|
+
delete mstp.needsProfile;
|
|
270
|
+
await persistConfig(config);
|
|
271
|
+
}
|
|
241
272
|
/**
|
|
242
273
|
* Detect pending state by reading config file directly.
|
|
243
274
|
*
|
|
@@ -249,7 +280,7 @@ export async function detectPendingState() {
|
|
|
249
280
|
const config = await readConfig();
|
|
250
281
|
const mstpCfg = extractMstpConfig(config);
|
|
251
282
|
if (!mstpCfg) {
|
|
252
|
-
return { hasCredentials: false, pendingTarget: null };
|
|
283
|
+
return { hasCredentials: false, pendingTarget: null, needsProfile: false };
|
|
253
284
|
}
|
|
254
285
|
const accounts = mstpCfg.accounts;
|
|
255
286
|
const defaultAccount = accounts?.default;
|
|
@@ -258,7 +289,9 @@ export async function detectPendingState() {
|
|
|
258
289
|
typeof defaultAccount?.connectorUrl === "string" &&
|
|
259
290
|
defaultAccount.connectorUrl !== "";
|
|
260
291
|
const pendingTarget = typeof mstpCfg.pendingTarget === "string" ? mstpCfg.pendingTarget : null;
|
|
261
|
-
|
|
292
|
+
// needsProfile is explicitly true only when set by onboard flow
|
|
293
|
+
const needsProfile = mstpCfg.needsProfile === true;
|
|
294
|
+
return { hasCredentials, pendingTarget, needsProfile };
|
|
262
295
|
}
|
|
263
296
|
// ---------------------------------------------------------------------------
|
|
264
297
|
// Test-only reset (prefix _ = internal)
|
|
@@ -37,6 +37,7 @@ export interface PollSetupResponse {
|
|
|
37
37
|
status: "authorized";
|
|
38
38
|
setup_token: string;
|
|
39
39
|
expires_in: number;
|
|
40
|
+
agent_id: string | null;
|
|
40
41
|
}
|
|
41
42
|
export interface AgentInfo {
|
|
42
43
|
id: string;
|
|
@@ -89,6 +90,21 @@ export interface AcceptRequestResponse {
|
|
|
89
90
|
export interface DeclineRequestResponse {
|
|
90
91
|
status: "declined";
|
|
91
92
|
}
|
|
93
|
+
export interface UpdateProfileParams {
|
|
94
|
+
name?: string;
|
|
95
|
+
scope?: string;
|
|
96
|
+
about?: string;
|
|
97
|
+
audience?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface UpdateProfileResponse {
|
|
100
|
+
status: "updated";
|
|
101
|
+
profile?: {
|
|
102
|
+
name: string;
|
|
103
|
+
scope: string;
|
|
104
|
+
about: string;
|
|
105
|
+
audience: string;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
92
108
|
/**
|
|
93
109
|
* `POST /setup/init` — Start Device Code Flow.
|
|
94
110
|
*
|
|
@@ -160,4 +176,11 @@ export declare function acceptRequest(cfg: PlatformClientConfig, apiKey: string,
|
|
|
160
176
|
* Requires API Key in Authorization header.
|
|
161
177
|
*/
|
|
162
178
|
export declare function declineRequest(cfg: PlatformClientConfig, apiKey: string, requestId: string): Promise<DeclineRequestResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* `PATCH /me/profile` — Update the calling agent's profile.
|
|
181
|
+
*
|
|
182
|
+
* Requires API Key in Authorization header.
|
|
183
|
+
* Accepts partial updates — only provided fields are changed.
|
|
184
|
+
*/
|
|
185
|
+
export declare function updateProfile(cfg: PlatformClientConfig, apiKey: string, params: UpdateProfileParams): Promise<UpdateProfileResponse>;
|
|
163
186
|
//# 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;
|
|
1
|
+
{"version":3,"file":"platform-client.d.ts","sourceRoot":"","sources":["../src/platform-client.ts"],"names":[],"mappings":"AAA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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"}
|
package/dist/platform-client.js
CHANGED
|
@@ -211,3 +211,22 @@ export async function declineRequest(cfg, apiKey, requestId) {
|
|
|
211
211
|
return handleError(res);
|
|
212
212
|
return (await res.json());
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* `PATCH /me/profile` — Update the calling agent's profile.
|
|
216
|
+
*
|
|
217
|
+
* Requires API Key in Authorization header.
|
|
218
|
+
* Accepts partial updates — only provided fields are changed.
|
|
219
|
+
*/
|
|
220
|
+
export async function updateProfile(cfg, apiKey, params) {
|
|
221
|
+
const res = await fetch(`${baseUrl(cfg)}/me/profile`, {
|
|
222
|
+
method: "PATCH",
|
|
223
|
+
headers: {
|
|
224
|
+
"Content-Type": "application/json",
|
|
225
|
+
Authorization: `Bearer ${apiKey}`,
|
|
226
|
+
},
|
|
227
|
+
body: JSON.stringify(params),
|
|
228
|
+
});
|
|
229
|
+
if (!res.ok)
|
|
230
|
+
return handleError(res);
|
|
231
|
+
return (await res.json());
|
|
232
|
+
}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/plugin.js
CHANGED
|
@@ -80,14 +80,24 @@ const plugin = {
|
|
|
80
80
|
if (!state.hasCredentials) {
|
|
81
81
|
// Just installed, no credentials yet — guide to setup
|
|
82
82
|
context =
|
|
83
|
-
"[Context: Agent Network] You recently installed the agent network plugin. Your user wants to connect to the agent network.
|
|
83
|
+
"[Context: Agent Network] You recently installed the agent network plugin. Your user wants to connect to the agent network. Call the mstp_setup_init tool to begin the setup process.";
|
|
84
84
|
if (state.pendingTarget) {
|
|
85
85
|
context += ` After setup, send a connection request to @${state.pendingTarget} — they invited your user to join.`;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
else if (state.needsProfile) {
|
|
89
|
+
// Agent created but profile is empty — guide to profile completion
|
|
90
|
+
context =
|
|
91
|
+
"[Context: Agent Network] You are set up on the agent network, but your agent's profile is empty. " +
|
|
92
|
+
"Generate a profile based on what you know about the user and their agent, then show it to the user for confirmation. " +
|
|
93
|
+
"Once confirmed, call mstp_update_profile with all four fields (name, scope, about, audience).";
|
|
94
|
+
if (state.pendingTarget) {
|
|
95
|
+
context += ` After completing the profile, send a connection request to @${state.pendingTarget} — they invited your user to join.`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
88
98
|
else if (state.pendingTarget) {
|
|
89
99
|
// Setup complete but pending connection — guide to connect
|
|
90
|
-
context = `[Context: Agent Network] You are set up on the agent network. You have a pending connection —
|
|
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.`;
|
|
91
101
|
}
|
|
92
102
|
if (context) {
|
|
93
103
|
return { prependContext: context };
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LLM tools — setup, connection, and conversation tools.
|
|
2
|
+
* LLM tools — setup, connection, profile, and conversation tools.
|
|
3
3
|
*
|
|
4
|
-
* Registers
|
|
5
|
-
* drive setup, connection requests, request
|
|
6
|
-
* real-time conversations, guided by SKILL.md.
|
|
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.
|
|
7
7
|
*
|
|
8
8
|
* Two access patterns:
|
|
9
9
|
* - **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;;;;;;;;;;;;;GAaG;
|
|
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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LLM tools — setup, connection, and conversation tools.
|
|
2
|
+
* LLM tools — setup, connection, profile, and conversation tools.
|
|
3
3
|
*
|
|
4
|
-
* Registers
|
|
5
|
-
* drive setup, connection requests, request
|
|
6
|
-
* real-time conversations, guided by SKILL.md.
|
|
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.
|
|
7
7
|
*
|
|
8
8
|
* Two access patterns:
|
|
9
9
|
* - **HTTP tools** (setup, connection): read config via `requirePlatformConfig()`,
|
|
@@ -13,10 +13,15 @@
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
import { Type } from "@sinclair/typebox";
|
|
16
|
-
import { clearTargetHandle, getPendingTarget, requireApiKey, requireConnectorClient, requirePlatformConfig, writeCredentials, } from "./config.js";
|
|
17
|
-
import { acceptRequest, declineRequest, initSetup,
|
|
16
|
+
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
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;
|
|
@@ -91,7 +96,8 @@ function formatOnboardResult(handle, address, isReconnect) {
|
|
|
91
96
|
`Agent created successfully!`,
|
|
92
97
|
`Handle: ${handle}`,
|
|
93
98
|
`Address: ${address}`,
|
|
94
|
-
"
|
|
99
|
+
"",
|
|
100
|
+
"IMPORTANT: This agent's profile is empty. Before proceeding with post-setup steps, use mstp_update_profile to generate and set up the agent's profile. This helps other agents understand what this agent does and enables better matchmaking.",
|
|
95
101
|
].join("\n");
|
|
96
102
|
}
|
|
97
103
|
function formatConnectionResult(requestIds, status) {
|
|
@@ -192,11 +198,11 @@ export function registerMstpTools(api) {
|
|
|
192
198
|
// --- mstp_setup_complete -----------------------------------------------
|
|
193
199
|
api.registerTool({
|
|
194
200
|
name: "mstp_setup_complete",
|
|
195
|
-
description: "Complete MSTP setup.
|
|
201
|
+
description: "Complete MSTP setup. Reconnects to the agent selected in browser, or creates a new agent identity if none was selected.",
|
|
196
202
|
parameters: Type.Object({
|
|
197
|
-
handle: Type.String({
|
|
198
|
-
description: "
|
|
199
|
-
}),
|
|
203
|
+
handle: Type.Optional(Type.String({
|
|
204
|
+
description: "Handle for a new agent (3-15 chars, lowercase letters, numbers, hyphens, underscores). Only needed when creating a new agent — not needed if the user selected an existing agent in the browser.",
|
|
205
|
+
})),
|
|
200
206
|
name: Type.Optional(Type.String({ description: "Display name for the agent" })),
|
|
201
207
|
}),
|
|
202
208
|
execute: withUpdateNotice(async (_id, params) => {
|
|
@@ -204,19 +210,59 @@ export function registerMstpTools(api) {
|
|
|
204
210
|
if (!storedSetupToken) {
|
|
205
211
|
throw new Error("No setup in progress. Use mstp_setup_init first.");
|
|
206
212
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
// Poll to get authorization result (includes agent_id from browser selection)
|
|
214
|
+
let pollResult;
|
|
215
|
+
try {
|
|
216
|
+
pollResult = await pollSetup(cfg, storedSetupToken);
|
|
217
|
+
}
|
|
218
|
+
catch (err) {
|
|
219
|
+
if (err instanceof SetupPendingError) {
|
|
220
|
+
return textResult("Not yet authorized. Ask the user if they completed authorization in their browser.");
|
|
221
|
+
}
|
|
222
|
+
if (err instanceof SetupExpiredError) {
|
|
223
|
+
storedSetupToken = null;
|
|
224
|
+
return textResult("Setup session expired. Use mstp_setup_init to get a new code.");
|
|
225
|
+
}
|
|
226
|
+
throw err;
|
|
227
|
+
}
|
|
228
|
+
const agentId = pollResult.agent_id;
|
|
211
229
|
let creds;
|
|
212
230
|
let isReconnect = false;
|
|
213
|
-
if (
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
if (agentId) {
|
|
232
|
+
// Browser selected an existing agent — reconnect directly
|
|
233
|
+
try {
|
|
234
|
+
creds = await reconnect(cfg, storedSetupToken, agentId);
|
|
235
|
+
isReconnect = true;
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
if (err instanceof PlatformApiError) {
|
|
239
|
+
if (err.status === 404) {
|
|
240
|
+
storedSetupToken = null;
|
|
241
|
+
return textResult("The selected agent was not found — it may have been deleted. Use mstp_setup_init to restart the setup process.");
|
|
242
|
+
}
|
|
243
|
+
if (err.status === 403) {
|
|
244
|
+
storedSetupToken = null;
|
|
245
|
+
return textResult("The selected agent doesn't match the authorized session. This may indicate a configuration issue. Use mstp_setup_init to restart the setup process.");
|
|
246
|
+
}
|
|
247
|
+
if (err.status === 401) {
|
|
248
|
+
storedSetupToken = null;
|
|
249
|
+
return textResult("Setup session expired. Use mstp_setup_init to get a new code.");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
throw err;
|
|
253
|
+
}
|
|
216
254
|
}
|
|
217
255
|
else {
|
|
256
|
+
// No agent selected (user chose "create new" or had 0 agents) — onboard
|
|
257
|
+
const handle = params.handle;
|
|
258
|
+
if (!handle) {
|
|
259
|
+
return textResult("No existing agent was selected. Please provide a handle to create a new agent. Call mstp_setup_complete with a handle parameter.");
|
|
260
|
+
}
|
|
218
261
|
try {
|
|
219
|
-
creds = await onboard(cfg, storedSetupToken, {
|
|
262
|
+
creds = await onboard(cfg, storedSetupToken, {
|
|
263
|
+
handle,
|
|
264
|
+
name: params.name,
|
|
265
|
+
});
|
|
220
266
|
}
|
|
221
267
|
catch (err) {
|
|
222
268
|
if (err instanceof PlatformApiError &&
|
|
@@ -227,16 +273,125 @@ export function registerMstpTools(api) {
|
|
|
227
273
|
err.code === "invalid_handle") {
|
|
228
274
|
return textResult(`The handle "${handle}" is not valid. It must be 3-15 lowercase letters, numbers, hyphens, or underscores.`);
|
|
229
275
|
}
|
|
276
|
+
if (err instanceof PlatformApiError && err.status === 401) {
|
|
277
|
+
storedSetupToken = null;
|
|
278
|
+
return textResult("Setup session expired. Use mstp_setup_init to get a new code.");
|
|
279
|
+
}
|
|
230
280
|
throw err;
|
|
231
281
|
}
|
|
232
282
|
}
|
|
233
283
|
// Write credentials to config file — signal to Host
|
|
234
284
|
await writeCredentials({ connectorUrl: creds.connectorUrl, token: creds.token }, cfg.apiHost);
|
|
285
|
+
// New agent → mark that profile completion is needed
|
|
286
|
+
if (!isReconnect) {
|
|
287
|
+
await markProfileNeeded();
|
|
288
|
+
}
|
|
235
289
|
// Clear setup token — flow is complete
|
|
236
290
|
storedSetupToken = null;
|
|
237
291
|
return textResult(formatOnboardResult(creds.handle, creds.address, isReconnect));
|
|
238
292
|
}),
|
|
239
293
|
}, { optional: true });
|
|
294
|
+
// --- mstp_update_profile ------------------------------------------------
|
|
295
|
+
api.registerTool({
|
|
296
|
+
name: "mstp_update_profile",
|
|
297
|
+
description: [
|
|
298
|
+
"Update this agent's profile on the network. Use this after creating a new agent to establish its identity.",
|
|
299
|
+
"Generate all four fields based on what you know about the user and their agent, using the guidance below:",
|
|
300
|
+
"",
|
|
301
|
+
"• name (max 40 chars): A recognizable name. Examples: TravelPlanner, MarketAnalyzer, ContentStudio",
|
|
302
|
+
"• scope (max 800 chars): What does the Agent do? What capabilities or services does it provide? What problems does it solve? Be specific about boundaries.",
|
|
303
|
+
"• about (max 1000 chars): Anything else relevant to partnerships? Brand affiliation, service restrictions, languages, user channels, input modes, access requirements.",
|
|
304
|
+
"• audience (max 300 chars): Who are the typical users? What do they want to accomplish?",
|
|
305
|
+
"",
|
|
306
|
+
"Show the generated profile to the user for confirmation before calling this tool. If the user requests changes, apply them and call again.",
|
|
307
|
+
].join("\n"),
|
|
308
|
+
parameters: Type.Object({
|
|
309
|
+
name: Type.Optional(Type.String({
|
|
310
|
+
description: "Agent display name (max 40 characters)",
|
|
311
|
+
})),
|
|
312
|
+
scope: Type.Optional(Type.String({
|
|
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)",
|
|
314
|
+
})),
|
|
315
|
+
about: Type.Optional(Type.String({
|
|
316
|
+
description: "Additional context: brand affiliation, restrictions, languages, channels (max 1000 characters)",
|
|
317
|
+
})),
|
|
318
|
+
audience: Type.Optional(Type.String({
|
|
319
|
+
description: "Target users and what they want to accomplish (max 300 characters)",
|
|
320
|
+
})),
|
|
321
|
+
}),
|
|
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
|
+
}
|
|
331
|
+
const cfg = requirePlatformConfig();
|
|
332
|
+
const apiKey = requireApiKey();
|
|
333
|
+
const profileFields = {};
|
|
334
|
+
if (typeof params.name === "string")
|
|
335
|
+
profileFields.name = params.name;
|
|
336
|
+
if (typeof params.scope === "string")
|
|
337
|
+
profileFields.scope = params.scope;
|
|
338
|
+
if (typeof params.about === "string")
|
|
339
|
+
profileFields.about = params.about;
|
|
340
|
+
if (typeof params.audience === "string")
|
|
341
|
+
profileFields.audience = params.audience;
|
|
342
|
+
if (Object.keys(profileFields).length === 0) {
|
|
343
|
+
return textResult("No profile fields provided. Include at least one of: name, scope, about, audience.");
|
|
344
|
+
}
|
|
345
|
+
let result;
|
|
346
|
+
try {
|
|
347
|
+
result = await updateProfile(cfg, apiKey, profileFields);
|
|
348
|
+
}
|
|
349
|
+
catch (err) {
|
|
350
|
+
if (err instanceof PlatformApiError) {
|
|
351
|
+
if (err.status === 401) {
|
|
352
|
+
return textResult("Authentication failed. The API key may be invalid. Try running mstp_setup_init to reconnect.");
|
|
353
|
+
}
|
|
354
|
+
if (err.status === 422) {
|
|
355
|
+
return textResult(`Validation error: ${err.message}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
throw err;
|
|
359
|
+
}
|
|
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
|
+
}
|
|
392
|
+
return textResult("Profile updated successfully. The agent's identity is now visible on the network.");
|
|
393
|
+
}),
|
|
394
|
+
}, { optional: true });
|
|
240
395
|
// --- mstp_send_connection_request --------------------------------------
|
|
241
396
|
api.registerTool({
|
|
242
397
|
name: "mstp_send_connection_request",
|
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.2.
|
|
2
|
+
export const PLUGIN_VERSION = "0.2.3";
|
package/package.json
CHANGED
|
@@ -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.
|