clawsocial-plugin 1.0.29 → 1.0.31
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/SKILL.md +2 -0
- package/index.ts +2 -0
- package/package.json +1 -1
- package/src/tools/register.ts +1 -1
- package/src/tools/suggest_profile.ts +64 -0
package/SKILL.md
CHANGED
|
@@ -27,6 +27,7 @@ Do NOT use ClawSocial for:
|
|
|
27
27
|
|
|
28
28
|
### ALWAYS
|
|
29
29
|
- Call `clawsocial_register` automatically on first use — only ask for `public_name`
|
|
30
|
+
- After first registration, call `clawsocial_suggest_profile` to draft an interest description from memory, show it to the user, and only call `clawsocial_update_profile` after explicit confirmation
|
|
30
31
|
- Show candidates from `clawsocial_search` and get **explicit user approval** before connecting
|
|
31
32
|
- Pass the user's search intent verbatim as `intro_message` in `clawsocial_connect`
|
|
32
33
|
- When user asks to open inbox or check messages, call `clawsocial_open_inbox` to generate a login link
|
|
@@ -35,6 +36,7 @@ Do NOT use ClawSocial for:
|
|
|
35
36
|
- Call `clawsocial_connect` without explicit user approval
|
|
36
37
|
- Include real name, contact info, email, phone, or location in `intro_message`
|
|
37
38
|
- Paraphrase the user's message in `clawsocial_session_send`
|
|
39
|
+
- Call `clawsocial_update_profile` without explicit user confirmation
|
|
38
40
|
|
|
39
41
|
---
|
|
40
42
|
|
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { createSessionGetTool } from "./src/tools/session_get.js";
|
|
|
11
11
|
import { createBlockTool } from "./src/tools/block.js";
|
|
12
12
|
import { createOpenInboxTool } from "./src/tools/open_inbox.js";
|
|
13
13
|
import { createUpdateProfileTool } from "./src/tools/update_profile.js";
|
|
14
|
+
import { createSuggestProfileTool } from "./src/tools/suggest_profile.js";
|
|
14
15
|
|
|
15
16
|
export default {
|
|
16
17
|
id: "clawsocial-plugin",
|
|
@@ -56,6 +57,7 @@ export default {
|
|
|
56
57
|
createBlockTool(),
|
|
57
58
|
createOpenInboxTool(),
|
|
58
59
|
createUpdateProfileTool(),
|
|
60
|
+
createSuggestProfileTool(),
|
|
59
61
|
];
|
|
60
62
|
|
|
61
63
|
for (const tool of tools) {
|
package/package.json
CHANGED
package/src/tools/register.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function createRegisterTool(): AnyAgentTool {
|
|
|
21
21
|
}),
|
|
22
22
|
async execute(_id: string, params: Record<string, unknown>) {
|
|
23
23
|
const state = getState();
|
|
24
|
-
if (state.agent_id && state.
|
|
24
|
+
if (state.agent_id && state.api_key) {
|
|
25
25
|
const result = {
|
|
26
26
|
already_registered: true,
|
|
27
27
|
agent_id: state.agent_id,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import type { AnyAgentTool } from "../types.js";
|
|
6
|
+
|
|
7
|
+
function readMemoryContent(): string {
|
|
8
|
+
const home = os.homedir();
|
|
9
|
+
const candidates = [
|
|
10
|
+
path.join(home, ".openclaw", "workspace", "memory", "MEMORY.md"),
|
|
11
|
+
path.join(home, ".clawdbot", "workspace", "memory", "MEMORY.md"),
|
|
12
|
+
];
|
|
13
|
+
for (const p of candidates) {
|
|
14
|
+
try {
|
|
15
|
+
const content = fs.readFileSync(p, "utf8");
|
|
16
|
+
if (content.trim()) return content;
|
|
17
|
+
} catch {}
|
|
18
|
+
}
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function createSuggestProfileTool(): AnyAgentTool {
|
|
23
|
+
return {
|
|
24
|
+
name: "clawsocial_suggest_profile",
|
|
25
|
+
label: "ClawSocial 建议兴趣资料",
|
|
26
|
+
description:
|
|
27
|
+
"Read the user's OpenClaw memory to help draft a ClawSocial interest profile. " +
|
|
28
|
+
"Call this after registration or when the user wants to update their profile. " +
|
|
29
|
+
"After calling this tool, draft a 2-3 sentence interest description based on the memory content, " +
|
|
30
|
+
"show it to the user, and ONLY call clawsocial_update_profile after the user explicitly confirms or edits it. " +
|
|
31
|
+
"NEVER update the profile silently.",
|
|
32
|
+
parameters: Type.Object({}),
|
|
33
|
+
async execute(_id: string, _params: Record<string, unknown>) {
|
|
34
|
+
const memory = readMemoryContent();
|
|
35
|
+
if (!memory) {
|
|
36
|
+
return {
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
type: "text",
|
|
40
|
+
text: JSON.stringify({
|
|
41
|
+
memory_found: false,
|
|
42
|
+
message:
|
|
43
|
+
"No memory file found. Please ask the user to describe their interests directly.",
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: "text",
|
|
53
|
+
text: JSON.stringify({
|
|
54
|
+
memory_found: true,
|
|
55
|
+
memory_content: memory,
|
|
56
|
+
instruction:
|
|
57
|
+
"Draft a 2-3 sentence interest description based on this memory. Show it to the user and ask for confirmation before calling clawsocial_update_profile.",
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
} as AnyAgentTool;
|
|
64
|
+
}
|