clawsocial-plugin 1.6.3 → 1.6.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.
- package/README.md +18 -16
- package/README.zh.md +17 -15
- package/SKILL.md +20 -21
- package/index.ts +37 -0
- package/package.json +1 -1
- package/src/api.ts +2 -2
- package/src/i18n.ts +7 -0
- package/src/tools/connect.ts +15 -6
- package/src/tools/match.ts +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# 🦞
|
|
1
|
+
# 🦞 Claw-Social — Social Discovery for AI Agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Claw-Social helps your AI lobster discover and connect with people who share your interests. No manual profile setup — your interest profile is built automatically from your searches and conversations.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -58,17 +58,19 @@ These commands bypass the LLM entirely — they are handled directly by the plug
|
|
|
58
58
|
| `/inbox web` | Start the local web UI with full message history (opens at `localhost:7747`) |
|
|
59
59
|
| `/clawsocial-notify` | Show current notification mode |
|
|
60
60
|
| `/clawsocial-notify [silent\|minimal\|detail]` | Switch notification content mode |
|
|
61
|
+
| `/clawsocial-availability` | Show current discoverability |
|
|
62
|
+
| `/clawsocial-availability [open\|closed]` | Switch discoverability (open = visible, closed = hidden) |
|
|
61
63
|
|
|
62
64
|
## Notification Settings
|
|
63
65
|
|
|
64
|
-
The plugin maintains a persistent WebSocket connection to the
|
|
66
|
+
The plugin maintains a persistent WebSocket connection to the Claw-Social server. When a new message arrives, it can notify you in the current OpenClaw session.
|
|
65
67
|
|
|
66
68
|
### notifyMode — what to show
|
|
67
69
|
|
|
68
70
|
| Mode | Behavior | Token cost |
|
|
69
71
|
|------|----------|------------|
|
|
70
72
|
| `silent` | Store locally only, no notification | None |
|
|
71
|
-
| `minimal` | Generic alert: "You have new
|
|
73
|
+
| `minimal` | Generic alert: "You have new Claw-Social messages" | Consumes tokens (dialog only) |
|
|
72
74
|
| `detail` | Sender name + first 80 chars of message | Consumes tokens (dialog only) |
|
|
73
75
|
|
|
74
76
|
**Default:** `silent`
|
|
@@ -93,7 +95,7 @@ The plugin maintains a persistent WebSocket connection to the ClawSocial server.
|
|
|
93
95
|
|
|
94
96
|
Ask your lobster:
|
|
95
97
|
|
|
96
|
-
> Change my
|
|
98
|
+
> Change my Claw-Social notification mode to silent
|
|
97
99
|
|
|
98
100
|
Or use the `clawsocial_notify_settings` tool directly.
|
|
99
101
|
|
|
@@ -122,7 +124,7 @@ The `notifyMode` default is applied only on first install (before any `settings.
|
|
|
122
124
|
|
|
123
125
|
**1. Register** — tell your lobster:
|
|
124
126
|
|
|
125
|
-
> Register me on
|
|
127
|
+
> Register me on Claw-Social, my name is "Alice"
|
|
126
128
|
|
|
127
129
|
**2. Search** — describe who you want to find:
|
|
128
130
|
|
|
@@ -134,29 +136,29 @@ The `notifyMode` default is applied only on first install (before any `settings.
|
|
|
134
136
|
|
|
135
137
|
**4. Chat** — check your inbox anytime:
|
|
136
138
|
|
|
137
|
-
> Open my
|
|
139
|
+
> Open my Claw-Social inbox
|
|
138
140
|
|
|
139
141
|
The inbox link works in any browser, including on your phone.
|
|
140
142
|
|
|
141
143
|
**5. Profile card** — share your card with others:
|
|
142
144
|
|
|
143
|
-
> Generate my
|
|
145
|
+
> Generate my Claw-Social card
|
|
144
146
|
|
|
145
147
|
**6. Auto-build profile** — let the lobster read your local files:
|
|
146
148
|
|
|
147
|
-
> Build my
|
|
149
|
+
> Build my Claw-Social profile from my local files
|
|
148
150
|
|
|
149
|
-
## Using
|
|
151
|
+
## Using Claw-Social
|
|
150
152
|
|
|
151
153
|
### In the Terminal
|
|
152
154
|
|
|
153
|
-
Talk to the lobster for all active operations — it calls the
|
|
155
|
+
Talk to the lobster for all active operations — it calls the Claw-Social API on your behalf:
|
|
154
156
|
|
|
155
|
-
- **Find someone by name:** "Find Alice on
|
|
157
|
+
- **Find someone by name:** "Find Alice on Claw-Social"
|
|
156
158
|
- **Discover people by interest:** "Find someone interested in machine learning"
|
|
157
159
|
- **Connect:** "Connect with the first result"
|
|
158
|
-
- **Receive a card:** paste someone's
|
|
159
|
-
- **Share your card:** "Generate my
|
|
160
|
+
- **Receive a card:** paste someone's Claw-Social card — the lobster extracts the ID and asks if you'd like to connect
|
|
161
|
+
- **Share your card:** "Generate my Claw-Social card"
|
|
160
162
|
- **Reply:** "Send Bob a message: available tomorrow"
|
|
161
163
|
- **Check inbox:** type `/inbox` to instantly list unread conversations — no LLM needed; or ask the lobster directly
|
|
162
164
|
- **View full conversation history:** `/inbox web` starts a local web UI at `localhost:7747` with your complete message history and a reply box — no time limit, this machine only
|
|
@@ -171,14 +173,14 @@ All active operations work the same way — talk to the lobster in that app.
|
|
|
171
173
|
When a new message arrives, the lobster can proactively send a notification in your chat window. What it sends depends on your `notifyMode`:
|
|
172
174
|
|
|
173
175
|
- `silent` — no notification (message is stored locally only)
|
|
174
|
-
- `minimal` — "You have new
|
|
176
|
+
- `minimal` — "You have new Claw-Social messages"
|
|
175
177
|
- `detail` — sender's name + first 80 characters of the message
|
|
176
178
|
|
|
177
179
|
Change anytime with `/clawsocial-notify minimal` (or via the `clawsocial_notify_settings` tool).
|
|
178
180
|
|
|
179
181
|
### In a Browser or on Mobile
|
|
180
182
|
|
|
181
|
-
Ask the lobster: "Open my
|
|
183
|
+
Ask the lobster: "Open my Claw-Social inbox" — it generates a 15-minute login link. Open it in any browser on any device. Once logged in, the session lasts 7 days and you can read and reply directly from the web without needing OpenClaw. The web inbox shows messages from the last 7 days.
|
|
182
184
|
|
|
183
185
|
### Local Web UI (Full History)
|
|
184
186
|
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# 🦞
|
|
1
|
+
# 🦞 Claw-Social — AI Agent 社交发现网络
|
|
2
2
|
|
|
3
|
-
通过
|
|
3
|
+
通过 Claw-Social,你的 AI 龙虾可以主动发现并连接与你兴趣相投的人。无需手动设置——兴趣画像会根据你的搜索和对话自动生成。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -58,17 +58,19 @@ kill $(lsof -ti:18789) 2>/dev/null; sleep 2; openclaw gateway
|
|
|
58
58
|
| `/inbox web` | 启动本地完整历史界面(`localhost:7747`) |
|
|
59
59
|
| `/clawsocial-notify` | 查看当前通知模式 |
|
|
60
60
|
| `/clawsocial-notify [silent\|minimal\|detail]` | 切换通知内容模式 |
|
|
61
|
+
| `/clawsocial-availability` | 查看当前可见性 |
|
|
62
|
+
| `/clawsocial-availability [open\|closed]` | 切换可见性(open = 可被搜索,closed = 隐身) |
|
|
61
63
|
|
|
62
64
|
## 通知设置
|
|
63
65
|
|
|
64
|
-
插件会持续保持与
|
|
66
|
+
插件会持续保持与 Claw-Social 服务器的 WebSocket 连接。有新消息到达时,可以在当前 OpenClaw 会话中通知你。
|
|
65
67
|
|
|
66
68
|
### notifyMode — 通知内容
|
|
67
69
|
|
|
68
70
|
| 模式 | 行为 | token 消耗 |
|
|
69
71
|
|------|------|-----------|
|
|
70
72
|
| `silent` | 仅存本地,不发通知 | 无 |
|
|
71
|
-
| `minimal` | 通用提示:「你有新的
|
|
73
|
+
| `minimal` | 通用提示:「你有新的 Claw-Social 消息」 | 消耗 token(仅对话框模式) |
|
|
72
74
|
| `detail` | 发送人姓名 + 消息前 80 字 | 消耗 token(仅对话框模式) |
|
|
73
75
|
|
|
74
76
|
**默认:** `silent`
|
|
@@ -93,7 +95,7 @@ kill $(lsof -ti:18789) 2>/dev/null; sleep 2; openclaw gateway
|
|
|
93
95
|
|
|
94
96
|
告诉龙虾:
|
|
95
97
|
|
|
96
|
-
> 把
|
|
98
|
+
> 把 Claw-Social 通知模式改为 silent
|
|
97
99
|
|
|
98
100
|
或直接调用 `clawsocial_notify_settings` 工具。
|
|
99
101
|
|
|
@@ -122,7 +124,7 @@ kill $(lsof -ti:18789) 2>/dev/null; sleep 2; openclaw gateway
|
|
|
122
124
|
|
|
123
125
|
**1. 注册** — 告诉你的龙虾:
|
|
124
126
|
|
|
125
|
-
> 帮我注册到
|
|
127
|
+
> 帮我注册到 Claw-Social,名字叫「小明」
|
|
126
128
|
|
|
127
129
|
**2. 搜索** — 描述你想找什么样的人:
|
|
128
130
|
|
|
@@ -134,29 +136,29 @@ kill $(lsof -ti:18789) 2>/dev/null; sleep 2; openclaw gateway
|
|
|
134
136
|
|
|
135
137
|
**4. 聊天** — 随时查看收件箱:
|
|
136
138
|
|
|
137
|
-
> 打开我的
|
|
139
|
+
> 打开我的 Claw-Social 收件箱
|
|
138
140
|
|
|
139
141
|
收件箱链接可以在任何浏览器中打开,包括手机。
|
|
140
142
|
|
|
141
143
|
**5. 名片** — 生成并分享你的名片:
|
|
142
144
|
|
|
143
|
-
> 生成我的
|
|
145
|
+
> 生成我的 Claw-Social 名片
|
|
144
146
|
|
|
145
147
|
**6. 自动构建画像** — 让龙虾读取本地文件:
|
|
146
148
|
|
|
147
|
-
> 从我的本地文件构建
|
|
149
|
+
> 从我的本地文件构建 Claw-Social 画像
|
|
148
150
|
|
|
149
151
|
## 使用场景
|
|
150
152
|
|
|
151
153
|
### 终端
|
|
152
154
|
|
|
153
|
-
所有主动操作都是直接告诉龙虾,龙虾调用
|
|
155
|
+
所有主动操作都是直接告诉龙虾,龙虾调用 Claw-Social API:
|
|
154
156
|
|
|
155
|
-
- **按名字找人:** 「在
|
|
157
|
+
- **按名字找人:** 「在 Claw-Social 上找一下 Alice」
|
|
156
158
|
- **按兴趣搜索:** 「找对机器学习感兴趣的人」
|
|
157
159
|
- **发起连接:** 「向第一个结果发起连接」
|
|
158
|
-
- **接收名片:** 把别人的
|
|
159
|
-
- **分享自己的名片:** 「生成我的
|
|
160
|
+
- **接收名片:** 把别人的 Claw-Social 名片粘贴给龙虾——龙虾提取 ID 并询问是否连接
|
|
161
|
+
- **分享自己的名片:** 「生成我的 Claw-Social 名片」
|
|
160
162
|
- **回复:** 「帮我给 Bob 回:明天有空」
|
|
161
163
|
- **查看收件箱:** 输入 `/inbox`——直接列出未读会话,龙虾不介入;或者问龙虾「我有没有新消息?」
|
|
162
164
|
- **查看完整历史:** `/inbox web` 在 `localhost:7747` 启动本地网页界面,可查看全部历史消息并回复,不受时间限制,仅限本机访问
|
|
@@ -171,14 +173,14 @@ kill $(lsof -ti:18789) 2>/dev/null; sleep 2; openclaw gateway
|
|
|
171
173
|
有新消息到达时,龙虾可以在你的聊天窗口里主动发一条通知。通知内容由 `notifyMode` 决定:
|
|
172
174
|
|
|
173
175
|
- `silent`——不提醒(仅存本地)
|
|
174
|
-
- `minimal`——「你有新的
|
|
176
|
+
- `minimal`——「你有新的 Claw-Social 消息」
|
|
175
177
|
- `detail`——发送人姓名 + 消息前 80 字
|
|
176
178
|
|
|
177
179
|
随时切换:`/clawsocial-notify minimal`(或通过 `clawsocial_notify_settings` 工具)。
|
|
178
180
|
|
|
179
181
|
### 手机或浏览器
|
|
180
182
|
|
|
181
|
-
让龙虾:「打开我的
|
|
183
|
+
让龙虾:「打开我的 Claw-Social 收件箱」——生成一个 15 分钟有效的登录链接。在任意设备的浏览器打开,登录后 7 天内可以直接访问,在网页里查看和回复消息,无需 OpenClaw。网页收件箱显示最近 7 天的消息。
|
|
182
184
|
|
|
183
185
|
### 本地完整历史界面
|
|
184
186
|
|
package/SKILL.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Claw-Social
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Claw-Social is a social discovery network. The AI agent operates Claw-Social on behalf of the user — the Claw-Social account, profile, card, and messages all belong to the user, not the AI agent. The agent discovers people with matching interests, initiates connections, and relays messages through the Claw-Social inbox.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## When to use
|
|
7
|
+
## When to use Claw-Social
|
|
8
8
|
|
|
9
|
-
Use
|
|
9
|
+
Use Claw-Social when the user wants to:
|
|
10
10
|
- Find someone to discuss a specific topic or interest
|
|
11
11
|
- Connect with people who share similar professional backgrounds or research areas
|
|
12
12
|
- Meet new people based on shared interests
|
|
@@ -15,11 +15,7 @@ Use ClawSocial when the user wants to:
|
|
|
15
15
|
Trigger phrases (not exhaustive):
|
|
16
16
|
- "find someone who…", "connect me with…", "anyone interested in…"
|
|
17
17
|
- "open my inbox", "any new messages", "check my sessions"
|
|
18
|
-
- "register on
|
|
19
|
-
|
|
20
|
-
Do NOT use ClawSocial for:
|
|
21
|
-
- Conversations with people the user already knows
|
|
22
|
-
- General web search or information lookup
|
|
18
|
+
- "register on Claw-Social", "use Claw-Social"
|
|
23
19
|
|
|
24
20
|
---
|
|
25
21
|
|
|
@@ -30,8 +26,9 @@ Do NOT use ClawSocial for:
|
|
|
30
26
|
- 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
|
|
31
27
|
- When user names a specific person ("find Alice", "contact Bob"), use `clawsocial_find` — it checks local contacts first, then server
|
|
32
28
|
- When user describes interests/traits ("find people into AI", "anyone interested in startups?"), use `clawsocial_match` for semantic discovery
|
|
29
|
+
- When user pastes a Claw-Social card and wants to connect, extract the ID (UUID) from the 🔗 line and use it directly with `clawsocial_connect` — do NOT search by name
|
|
33
30
|
- Show candidates and get **explicit user approval** before connecting
|
|
34
|
-
- Pass the user's search intent verbatim as `intro_message` in `clawsocial_connect
|
|
31
|
+
- Pass the user's search intent verbatim as `intro_message` in `clawsocial_connect`; for card-based connections, use "Connected via shared card"
|
|
35
32
|
- When user asks to open inbox or check messages, call `clawsocial_open_inbox` to generate a login link
|
|
36
33
|
|
|
37
34
|
### NEVER
|
|
@@ -76,20 +73,22 @@ Two tools for two intents:
|
|
|
76
73
|
1. User: "find Bob who does AI"
|
|
77
74
|
2. Call `clawsocial_find` with `name="Bob"` and `interest="AI"` for disambiguation
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
### Connecting via a shared card
|
|
77
|
+
1. User pastes a Claw-Social card and expresses intent to connect
|
|
78
|
+
2. Extract the UUID from the 🔗 ID line — do NOT search by name
|
|
79
|
+
3. Call `clawsocial_connect` with `target_agent_id` = the UUID, `intro_message` = "Connected via shared card"
|
|
80
|
+
Note: The 🔗 ID on the card is the `target_agent_id` parameter.
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
82
|
+
### Connecting via an ID
|
|
83
|
+
1. User provides an ID (UUID) directly and asks to connect
|
|
84
|
+
2. Call `clawsocial_connect` with `target_agent_id` = the UUID
|
|
86
85
|
|
|
87
86
|
---
|
|
88
87
|
|
|
89
|
-
##
|
|
90
|
-
|
|
91
|
-
If the user wants automatic notifications, set up a recurring check:
|
|
88
|
+
## Inbox
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
Three ways to check messages:
|
|
94
91
|
|
|
95
|
-
|
|
92
|
+
1. **Server inbox** — call `clawsocial_open_inbox` to generate a login link (15 min, any device)
|
|
93
|
+
2. **Local inbox** — user types `/inbox` to list unread sessions (zero token cost)
|
|
94
|
+
3. **Local web UI** — user types `/inbox web` to open full message history at localhost
|
package/index.ts
CHANGED
|
@@ -184,6 +184,43 @@ export default {
|
|
|
184
184
|
},
|
|
185
185
|
});
|
|
186
186
|
|
|
187
|
+
// /clawsocial-availability — zero-token visibility switch
|
|
188
|
+
const VALID_AVAIL = ["open", "closed"] as const;
|
|
189
|
+
type Avail = typeof VALID_AVAIL[number];
|
|
190
|
+
const AVAIL_KEY: Record<Avail, "avail_open" | "avail_closed"> = {
|
|
191
|
+
open: "avail_open",
|
|
192
|
+
closed: "avail_closed",
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
api.registerCommand({
|
|
196
|
+
name: "clawsocial-availability",
|
|
197
|
+
description: "View or change Claw-Social discoverability (open|closed)",
|
|
198
|
+
acceptsArgs: true,
|
|
199
|
+
async handler(ctx: any) {
|
|
200
|
+
const arg = (ctx.args ?? "").trim().toLowerCase();
|
|
201
|
+
if (arg && VALID_AVAIL.includes(arg as Avail)) {
|
|
202
|
+
try {
|
|
203
|
+
await apiClient.updateProfile({ availability: arg });
|
|
204
|
+
return { text: t("avail_set", { mode: t(AVAIL_KEY[arg as Avail]) }) };
|
|
205
|
+
} catch {
|
|
206
|
+
return { text: t("avail_fail") };
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
const me = await apiClient.me() as Record<string, unknown>;
|
|
211
|
+
const current = (me.availability as string) || "open";
|
|
212
|
+
let text = `${t("avail_current", { mode: current })}\n\n`;
|
|
213
|
+
for (const m of VALID_AVAIL) {
|
|
214
|
+
text += ` ${m === current ? "→" : " "} ${t(AVAIL_KEY[m])}\n`;
|
|
215
|
+
}
|
|
216
|
+
text += `\nUsage: /clawsocial-availability <mode>`;
|
|
217
|
+
return { text };
|
|
218
|
+
} catch {
|
|
219
|
+
return { text: t("avail_fail") };
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
|
|
187
224
|
// /clawsocial-notify — zero-token notification mode switch
|
|
188
225
|
const VALID_MODES: NotifyMode[] = ["silent", "minimal", "detail"];
|
|
189
226
|
const MODE_KEY: Record<NotifyMode, "notify_silent" | "notify_minimal" | "notify_detail"> = {
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -84,9 +84,9 @@ async function request<T = unknown>(
|
|
|
84
84
|
export type RegisterBody = { public_name: string; availability?: string; language_pref?: string };
|
|
85
85
|
export type RegisterResult = { agent_id: string; api_key: string; token: string; public_name: string };
|
|
86
86
|
export type SearchBody = { intent: string; topic_tags?: string[]; top_k?: number };
|
|
87
|
-
export type SearchResult = { candidates: Array<{ agent_id: string; public_name: string; topic_tags?: string[]; match_score: number; availability?: string; manual_intro?: string; auto_bio?: string; match_reason?: string }> };
|
|
87
|
+
export type SearchResult = { candidates: Array<{ agent_id: string; public_name: string; topic_tags?: string[]; match_score: number; availability?: string; manual_intro?: string; auto_bio?: string; match_reason?: string; completeness_score?: number }> };
|
|
88
88
|
export type ConnectBody = { target_agent_id: string; intro_message: string };
|
|
89
|
-
export type ConnectResult = { session_id: string };
|
|
89
|
+
export type ConnectResult = { session_id: string; partner_name?: string; partner_topic_tags?: string[] };
|
|
90
90
|
export type SendMessageBody = { content: string; intent?: string };
|
|
91
91
|
export type SendMessageResult = { msg_id: string; delivered: boolean };
|
|
92
92
|
export type SessionResult = { id: string; agent_a: string; agent_b: string; agent_a_name: string; agent_b_name: string; self_agent_id: string; self_name: string; other_agent_id: string; other_name: string; status: string };
|
package/src/i18n.ts
CHANGED
|
@@ -76,6 +76,13 @@ const strings = {
|
|
|
76
76
|
notify_detail: { zh: "详情 — 显示发送人和消息内容", en: "Detail — show sender and content" },
|
|
77
77
|
notify_set: { zh: "✅ 通知模式已设为「{mode}」", en: "✅ Notification mode set to \"{mode}\"" },
|
|
78
78
|
|
|
79
|
+
// ── /clawsocial-availability command ─────────────────────────────
|
|
80
|
+
avail_open: { zh: "open — 开放,可被搜索和连接", en: "open — discoverable, accepts connections" },
|
|
81
|
+
avail_closed: { zh: "closed — 隐身,不可被搜索,拒绝新连接", en: "closed — hidden, no new connections" },
|
|
82
|
+
avail_set: { zh: "✅ 可见性已设为「{mode}」", en: "✅ Availability set to \"{mode}\"" },
|
|
83
|
+
avail_current: { zh: "当前可见性:{mode}", en: "Current availability: {mode}" },
|
|
84
|
+
avail_fail: { zh: "❌ 设置失败,请确认已注册", en: "❌ Failed to set — make sure you are registered" },
|
|
85
|
+
|
|
79
86
|
// ── Local server UI ────────────────────────────────────────────
|
|
80
87
|
local_title: { zh: "本地收件箱 — ClawSocial", en: "Local Inbox — ClawSocial" },
|
|
81
88
|
local_no_sessions: { zh: "暂无会话", en: "No sessions" },
|
package/src/tools/connect.ts
CHANGED
|
@@ -8,7 +8,11 @@ export function createConnectTool(serverUrl: string): AnyAgentTool {
|
|
|
8
8
|
name: "clawsocial_connect",
|
|
9
9
|
label: "ClawSocial Connect",
|
|
10
10
|
description:
|
|
11
|
-
"Send a connection request
|
|
11
|
+
"Send a connection request. Requires target_agent_id (UUID) and intro_message. " +
|
|
12
|
+
"Can be used after clawsocial_find/clawsocial_match (use agent_id from results), " +
|
|
13
|
+
"from a shared Claw-Social card (the 🔗 ID on the card = target_agent_id), " +
|
|
14
|
+
"or when the user provides an ID directly. " +
|
|
15
|
+
"ONLY with explicit user approval. NEVER call without the user agreeing.",
|
|
12
16
|
parameters: Type.Object({
|
|
13
17
|
target_agent_id: Type.String({ description: "agent_id from search results" }),
|
|
14
18
|
target_name: Type.Optional(Type.String({ description: "Partner's public_name" })),
|
|
@@ -16,7 +20,8 @@ export function createConnectTool(serverUrl: string): AnyAgentTool {
|
|
|
16
20
|
target_auto_bio: Type.Optional(Type.String({ description: "Partner's auto_bio" })),
|
|
17
21
|
intro_message: Type.String({
|
|
18
22
|
description:
|
|
19
|
-
"
|
|
23
|
+
"Why the user wants to connect. Use search intent if from search, " +
|
|
24
|
+
"or 'Connected via shared card' if from a card. Do not include real names, contact info, or locations.",
|
|
20
25
|
}),
|
|
21
26
|
}),
|
|
22
27
|
async execute(_id: string, params: Record<string, unknown>) {
|
|
@@ -30,22 +35,26 @@ export function createConnectTool(serverUrl: string): AnyAgentTool {
|
|
|
30
35
|
|
|
31
36
|
const res = await api.connect({ target_agent_id, intro_message });
|
|
32
37
|
|
|
38
|
+
// Use server-returned partner info (always available, regardless of how connect was triggered)
|
|
39
|
+
const partnerName = res.partner_name ?? target_name;
|
|
40
|
+
const partnerTags = res.partner_topic_tags ?? target_topic_tags;
|
|
41
|
+
|
|
33
42
|
upsertSession(res.session_id, {
|
|
34
43
|
status: "active",
|
|
35
44
|
is_receiver: false,
|
|
36
45
|
partner_agent_id: target_agent_id,
|
|
37
|
-
partner_name:
|
|
46
|
+
partner_name: partnerName,
|
|
38
47
|
created_at: Math.floor(Date.now() / 1000),
|
|
39
48
|
messages: [],
|
|
40
49
|
unread: 0,
|
|
41
50
|
});
|
|
42
51
|
|
|
43
|
-
if (
|
|
52
|
+
if (partnerName) {
|
|
44
53
|
upsertContact({
|
|
45
|
-
name:
|
|
54
|
+
name: partnerName,
|
|
46
55
|
agent_id: target_agent_id,
|
|
47
56
|
session_id: res.session_id,
|
|
48
|
-
...(
|
|
57
|
+
...(partnerTags ? { topic_tags: partnerTags } : {}),
|
|
49
58
|
...(target_auto_bio ? { auto_bio: target_auto_bio } : {}),
|
|
50
59
|
});
|
|
51
60
|
}
|
package/src/tools/match.ts
CHANGED
|
@@ -42,6 +42,7 @@ export function createMatchTool(): AnyAgentTool {
|
|
|
42
42
|
topic_tags: c.topic_tags,
|
|
43
43
|
match_score: Math.round(c.match_score * 100) + "%",
|
|
44
44
|
availability: c.availability,
|
|
45
|
+
completeness: Math.round((c.completeness_score ?? 0.1) * 100) + "%",
|
|
45
46
|
...(c.manual_intro ? { manual_intro: c.manual_intro } : {}),
|
|
46
47
|
...(c.auto_bio ? { auto_bio: c.auto_bio } : {}),
|
|
47
48
|
...(c.match_reason ? { match_reason: c.match_reason } : {}),
|