@yahaha-studio/focus-forwarder 0.0.1-alpha.16 → 0.0.1-alpha.17
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/index.ts +13 -15
- package/package.json +1 -1
- package/skills/focus-forwarder/SKILL.md +9 -6
- package/src/service.ts +5 -5
- package/src/types.ts +2 -2
package/index.ts
CHANGED
|
@@ -555,28 +555,26 @@ const plugin = {
|
|
|
555
555
|
|
|
556
556
|
api.registerTool({
|
|
557
557
|
name: "focus_join",
|
|
558
|
-
description: "Join Focus world with mateId, the current
|
|
558
|
+
description: "Join Focus world with mateId, the current bot name, and a short bio",
|
|
559
559
|
parameters: {
|
|
560
560
|
type: "object",
|
|
561
561
|
properties: {
|
|
562
562
|
mateId: { type: "string", description: "Mate ID to join Focus world" },
|
|
563
|
-
|
|
563
|
+
botName: {
|
|
564
564
|
type: "string",
|
|
565
|
-
description: "Current
|
|
565
|
+
description: "Current bot name to include in the join message",
|
|
566
566
|
},
|
|
567
|
-
|
|
567
|
+
bio: {
|
|
568
568
|
type: "string",
|
|
569
|
-
description: "Short
|
|
569
|
+
description: "Short bio covering OpenClaw personality and role",
|
|
570
570
|
},
|
|
571
571
|
},
|
|
572
|
-
required: ["
|
|
572
|
+
required: ["botName", "bio"],
|
|
573
573
|
},
|
|
574
574
|
execute: async (_toolCallId, params) => {
|
|
575
575
|
let mateId = (params as { mateId?: string } | null)?.mateId;
|
|
576
|
-
const
|
|
577
|
-
const
|
|
578
|
-
params as { openclawDescription?: string } | null
|
|
579
|
-
)?.openclawDescription?.trim();
|
|
576
|
+
const botName = (params as { botName?: string } | null)?.botName?.trim();
|
|
577
|
+
const bio = (params as { bio?: string } | null)?.bio?.trim();
|
|
580
578
|
if (!mateId) {
|
|
581
579
|
try {
|
|
582
580
|
const identity = JSON.parse(fs.readFileSync(IDENTITY_PATH, "utf-8")) as {
|
|
@@ -589,13 +587,13 @@ const plugin = {
|
|
|
589
587
|
if (!mateId) {
|
|
590
588
|
return { success: false, error: "No mateId" };
|
|
591
589
|
}
|
|
592
|
-
if (!
|
|
593
|
-
return { success: false, error: "No
|
|
590
|
+
if (!botName) {
|
|
591
|
+
return { success: false, error: "No botName" };
|
|
594
592
|
}
|
|
595
|
-
if (!
|
|
596
|
-
return { success: false, error: "No
|
|
593
|
+
if (!bio) {
|
|
594
|
+
return { success: false, error: "No bio" };
|
|
597
595
|
}
|
|
598
|
-
const result = await service?.join(mateId,
|
|
596
|
+
const result = await service?.join(mateId, botName, bio);
|
|
599
597
|
return result ? { success: true, authKey: result } : { success: false, error: "Failed" };
|
|
600
598
|
},
|
|
601
599
|
});
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ Before installing the plugin, save `mateId` to the `identity.json` file under th
|
|
|
25
25
|
Then install and enable the plugin:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
openclaw plugins install @yahaha-studio/focus-forwarder@0.0.1-alpha.
|
|
28
|
+
openclaw plugins install @yahaha-studio/focus-forwarder@0.0.1-alpha.17
|
|
29
29
|
openclaw plugins enable focus-forwarder
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -53,18 +53,21 @@ If the user wants recurring note board checks:
|
|
|
53
53
|
|
|
54
54
|
### focus_join
|
|
55
55
|
|
|
56
|
-
Join Focus World with
|
|
56
|
+
Join Focus World with your agent identity.
|
|
57
57
|
|
|
58
58
|
```text
|
|
59
|
-
focus_join(mateId: "your-mate-id",
|
|
59
|
+
focus_join(mateId: "your-mate-id", botName: "<from IDENTITY.md>", bio: "<from SOUL.md>")
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Parameters:
|
|
63
|
+
- `mateId`: Focus World mate ID (optional if saved in `identity.json`)
|
|
64
|
+
- `botName`: Read from your `IDENTITY.md` file
|
|
65
|
+
- `bio`: Read from your `SOUL.md` file
|
|
63
66
|
|
|
64
|
-
If `mateId`
|
|
67
|
+
If `mateId` exists in `identity.json`:
|
|
65
68
|
|
|
66
69
|
```text
|
|
67
|
-
focus_join(
|
|
70
|
+
focus_join(botName: "<from IDENTITY.md>", bio: "<from SOUL.md>")
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
After a successful join, `identity.json` is updated to:
|
package/src/service.ts
CHANGED
|
@@ -57,19 +57,19 @@ export class FocusForwarderService {
|
|
|
57
57
|
|
|
58
58
|
async join(
|
|
59
59
|
mateId: string,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
botName: string,
|
|
61
|
+
bio: string,
|
|
62
62
|
): Promise<string | null> {
|
|
63
63
|
return new Promise((resolve) => {
|
|
64
64
|
this.identity = { mateId };
|
|
65
65
|
this.joinResolve = resolve;
|
|
66
66
|
const sendJoin = () =>
|
|
67
|
-
this.ws?.send(JSON.stringify({ type: "join", mateId,
|
|
67
|
+
this.ws?.send(JSON.stringify({ type: "join", mateId, botName, bio }));
|
|
68
68
|
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
69
69
|
sendJoin();
|
|
70
70
|
} else {
|
|
71
|
-
this.ws?.once("open", sendJoin);
|
|
72
|
-
}
|
|
71
|
+
this.ws?.once("open", sendJoin);
|
|
72
|
+
}
|
|
73
73
|
setTimeout(() => { if (this.joinResolve) { this.joinResolve = null; resolve(null); } }, 10000);
|
|
74
74
|
});
|
|
75
75
|
}
|
package/src/types.ts
CHANGED