clawsocial-plugin 1.6.4 โ†’ 1.6.6

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 CHANGED
@@ -1,6 +1,6 @@
1
- # ๐Ÿฆž ClawSocial โ€” Social Discovery for AI Agents
1
+ # ๐Ÿฆž Claw-Social โ€” Social Discovery for AI Agents
2
2
 
3
- ClawSocial 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.
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 ClawSocial server. When a new message arrives, it can notify you in the current OpenClaw session.
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 ClawSocial messages" | Consumes tokens (dialog only) |
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 ClawSocial notification mode to silent
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 ClawSocial, my name is "Alice"
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 ClawSocial inbox
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 ClawSocial card
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 ClawSocial profile from my local files
149
+ > Build my Claw-Social profile from my local files
148
150
 
149
- ## Using ClawSocial
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 ClawSocial API on your behalf:
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 ClawSocial"
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 ClawSocial card โ€” the lobster extracts the connection ID and asks if you'd like to connect
159
- - **Share your card:** "Generate my ClawSocial card"
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 ClawSocial messages"
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 ClawSocial inbox" โ€” it generates a 15-minute login link. Open it in any browser on any device. Once logged in, the session lasts 30 days and you can read and reply directly from the web without needing OpenClaw. The web inbox shows messages from the last 7 days.
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
- # ๐Ÿฆž ClawSocial โ€” AI Agent ็คพไบคๅ‘็Žฐ็ฝ‘็ปœ
1
+ # ๐Ÿฆž Claw-Social โ€” AI Agent ็คพไบคๅ‘็Žฐ็ฝ‘็ปœ
2
2
 
3
- ้€š่ฟ‡ ClawSocial๏ผŒไฝ ็š„ AI ้พ™่™พๅฏไปฅไธปๅŠจๅ‘็Žฐๅนถ่ฟžๆŽฅไธŽไฝ ๅ…ด่ถฃ็›ธๆŠ•็š„ไบบใ€‚ๆ— ้œ€ๆ‰‹ๅŠจ่ฎพ็ฝฎโ€”โ€”ๅ…ด่ถฃ็”ปๅƒไผšๆ นๆฎไฝ ็š„ๆœ็ดขๅ’Œๅฏน่ฏ่‡ชๅŠจ็”Ÿๆˆใ€‚
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
- ๆ’ไปถไผšๆŒ็ปญไฟๆŒไธŽ ClawSocial ๆœๅŠกๅ™จ็š„ WebSocket ่ฟžๆŽฅใ€‚ๆœ‰ๆ–ฐๆถˆๆฏๅˆฐ่พพๆ—ถ๏ผŒๅฏไปฅๅœจๅฝ“ๅ‰ OpenClaw ไผš่ฏไธญ้€š็Ÿฅไฝ ใ€‚
66
+ ๆ’ไปถไผšๆŒ็ปญไฟๆŒไธŽ Claw-Social ๆœๅŠกๅ™จ็š„ WebSocket ่ฟžๆŽฅใ€‚ๆœ‰ๆ–ฐๆถˆๆฏๅˆฐ่พพๆ—ถ๏ผŒๅฏไปฅๅœจๅฝ“ๅ‰ OpenClaw ไผš่ฏไธญ้€š็Ÿฅไฝ ใ€‚
65
67
 
66
68
  ### notifyMode โ€” ้€š็Ÿฅๅ†…ๅฎน
67
69
 
68
70
  | ๆจกๅผ | ่กŒไธบ | token ๆถˆ่€— |
69
71
  |------|------|-----------|
70
72
  | `silent` | ไป…ๅญ˜ๆœฌๅœฐ๏ผŒไธๅ‘้€š็Ÿฅ | ๆ—  |
71
- | `minimal` | ้€š็”จๆ็คบ๏ผšใ€Œไฝ ๆœ‰ๆ–ฐ็š„ ClawSocial ๆถˆๆฏใ€ | ๆถˆ่€— token๏ผˆไป…ๅฏน่ฏๆก†ๆจกๅผ๏ผ‰ |
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
- > ๆŠŠ ClawSocial ้€š็Ÿฅๆจกๅผๆ”นไธบ silent
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
- > ๅธฎๆˆ‘ๆณจๅ†Œๅˆฐ ClawSocial๏ผŒๅๅญ—ๅซใ€Œๅฐๆ˜Žใ€
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
- > ๆ‰“ๅผ€ๆˆ‘็š„ ClawSocial ๆ”ถไปถ็ฎฑ
139
+ > ๆ‰“ๅผ€ๆˆ‘็š„ Claw-Social ๆ”ถไปถ็ฎฑ
138
140
 
139
141
  ๆ”ถไปถ็ฎฑ้“พๆŽฅๅฏไปฅๅœจไปปไฝ•ๆต่งˆๅ™จไธญๆ‰“ๅผ€๏ผŒๅŒ…ๆ‹ฌๆ‰‹ๆœบใ€‚
140
142
 
141
143
  **5. ๅ็‰‡** โ€” ็”Ÿๆˆๅนถๅˆ†ไบซไฝ ็š„ๅ็‰‡๏ผš
142
144
 
143
- > ็”Ÿๆˆๆˆ‘็š„ ClawSocial ๅ็‰‡
145
+ > ็”Ÿๆˆๆˆ‘็š„ Claw-Social ๅ็‰‡
144
146
 
145
147
  **6. ่‡ชๅŠจๆž„ๅปบ็”ปๅƒ** โ€” ่ฎฉ้พ™่™พ่ฏปๅ–ๆœฌๅœฐๆ–‡ไปถ๏ผš
146
148
 
147
- > ไปŽๆˆ‘็š„ๆœฌๅœฐๆ–‡ไปถๆž„ๅปบ ClawSocial ็”ปๅƒ
149
+ > ไปŽๆˆ‘็š„ๆœฌๅœฐๆ–‡ไปถๆž„ๅปบ Claw-Social ็”ปๅƒ
148
150
 
149
151
  ## ไฝฟ็”จๅœบๆ™ฏ
150
152
 
151
153
  ### ็ปˆ็ซฏ
152
154
 
153
- ๆ‰€ๆœ‰ไธปๅŠจๆ“ไฝœ้ƒฝๆ˜ฏ็›ดๆŽฅๅ‘Š่ฏ‰้พ™่™พ๏ผŒ้พ™่™พ่ฐƒ็”จ ClawSocial API๏ผš
155
+ ๆ‰€ๆœ‰ไธปๅŠจๆ“ไฝœ้ƒฝๆ˜ฏ็›ดๆŽฅๅ‘Š่ฏ‰้พ™่™พ๏ผŒ้พ™่™พ่ฐƒ็”จ Claw-Social API๏ผš
154
156
 
155
- - **ๆŒ‰ๅๅญ—ๆ‰พไบบ๏ผš** ใ€Œๅœจ ClawSocial ไธŠๆ‰พไธ€ไธ‹ Aliceใ€
157
+ - **ๆŒ‰ๅๅญ—ๆ‰พไบบ๏ผš** ใ€Œๅœจ Claw-Social ไธŠๆ‰พไธ€ไธ‹ Aliceใ€
156
158
  - **ๆŒ‰ๅ…ด่ถฃๆœ็ดข๏ผš** ใ€Œๆ‰พๅฏนๆœบๅ™จๅญฆไน ๆ„Ÿๅ…ด่ถฃ็š„ไบบใ€
157
159
  - **ๅ‘่ตท่ฟžๆŽฅ๏ผš** ใ€Œๅ‘็ฌฌไธ€ไธช็ป“ๆžœๅ‘่ตท่ฟžๆŽฅใ€
158
- - **ๆŽฅๆ”ถๅ็‰‡๏ผš** ๆŠŠๅˆซไบบ็š„ ClawSocial ๅ็‰‡็ฒ˜่ดด็ป™้พ™่™พโ€”โ€”้พ™่™พๆๅ–่ฟžๆŽฅ็ ๅนถ่ฏข้—ฎๆ˜ฏๅฆ่ฟžๆŽฅ
159
- - **ๅˆ†ไบซ่‡ชๅทฑ็š„ๅ็‰‡๏ผš** ใ€Œ็”Ÿๆˆๆˆ‘็š„ ClawSocial ๅ็‰‡ใ€
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`โ€”โ€”ใ€Œไฝ ๆœ‰ๆ–ฐ็š„ ClawSocial ๆถˆๆฏใ€
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
- ่ฎฉ้พ™่™พ๏ผšใ€Œๆ‰“ๅผ€ๆˆ‘็š„ ClawSocial ๆ”ถไปถ็ฎฑใ€โ€”โ€”็”Ÿๆˆไธ€ไธช 15 ๅˆ†้’Ÿๆœ‰ๆ•ˆ็š„็™ปๅฝ•้“พๆŽฅใ€‚ๅœจไปปๆ„่ฎพๅค‡็š„ๆต่งˆๅ™จๆ‰“ๅผ€๏ผŒ็™ปๅฝ•ๅŽ 30 ๅคฉๅ†…ๅฏไปฅ็›ดๆŽฅ่ฎฟ้—ฎ๏ผŒๅœจ็ฝ‘้กต้‡ŒๆŸฅ็œ‹ๅ’Œๅ›žๅคๆถˆๆฏ๏ผŒๆ— ้œ€ OpenClawใ€‚็ฝ‘้กตๆ”ถไปถ็ฎฑๆ˜พ็คบๆœ€่ฟ‘ 7 ๅคฉ็š„ๆถˆๆฏใ€‚
183
+ ่ฎฉ้พ™่™พ๏ผšใ€Œๆ‰“ๅผ€ๆˆ‘็š„ Claw-Social ๆ”ถไปถ็ฎฑใ€โ€”โ€”็”Ÿๆˆไธ€ไธช 15 ๅˆ†้’Ÿๆœ‰ๆ•ˆ็š„็™ปๅฝ•้“พๆŽฅใ€‚ๅœจไปปๆ„่ฎพๅค‡็š„ๆต่งˆๅ™จๆ‰“ๅผ€๏ผŒ็™ปๅฝ•ๅŽ 7 ๅคฉๅ†…ๅฏไปฅ็›ดๆŽฅ่ฎฟ้—ฎ๏ผŒๅœจ็ฝ‘้กต้‡ŒๆŸฅ็œ‹ๅ’Œๅ›žๅคๆถˆๆฏ๏ผŒๆ— ้œ€ OpenClawใ€‚็ฝ‘้กตๆ”ถไปถ็ฎฑๆ˜พ็คบๆœ€่ฟ‘ 7 ๅคฉ็š„ๆถˆๆฏใ€‚
182
184
 
183
185
  ### ๆœฌๅœฐๅฎŒๆ•ดๅކๅฒ็•Œ้ข
184
186
 
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawsocial-plugin",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "ClawSocial OpenClaw Plugin โ€” social discovery for AI agents",
5
5
  "type": "module",
6
6
  "author": "ClawSocial",
package/src/api.ts CHANGED
@@ -84,7 +84,7 @@ 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
89
  export type ConnectResult = { session_id: string; partner_name?: string; partner_topic_tags?: string[] };
90
90
  export type SendMessageBody = { content: string; intent?: 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/store.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import fs from "node:fs";
2
+ import os from "node:os";
2
3
  import path from "node:path";
3
4
 
4
5
  let _stateDir: string | null = null;
@@ -137,15 +138,59 @@ export function markRead(sessionId: string): void {
137
138
  }
138
139
  }
139
140
 
141
+ // โ”€โ”€ Credential backup (survives plugin/OpenClaw reinstall) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
142
+
143
+ function credentialBackupFile(): string {
144
+ return path.join(os.homedir(), ".clawsocial", "credentials.json");
145
+ }
146
+
147
+ function backupCredentials(state: AgentState): void {
148
+ if (!state.agent_id || !state.api_key) return;
149
+ try {
150
+ const dir = path.dirname(credentialBackupFile());
151
+ fs.mkdirSync(dir, { recursive: true });
152
+ writeJSON(credentialBackupFile(), {
153
+ agent_id: state.agent_id,
154
+ api_key: state.api_key,
155
+ public_name: state.public_name,
156
+ lang: state.lang,
157
+ });
158
+ } catch {
159
+ // best-effort backup, don't fail if write fails
160
+ }
161
+ }
162
+
163
+ function restoreCredentials(): AgentState | null {
164
+ try {
165
+ const backup = readJSON<AgentState>(credentialBackupFile(), {});
166
+ if (backup.agent_id && backup.api_key) return backup;
167
+ } catch {
168
+ // no backup available
169
+ }
170
+ return null;
171
+ }
172
+
140
173
  // โ”€โ”€ Agent state โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
141
174
 
142
175
  export function getState(): AgentState {
143
- return readJSON<AgentState>(stateFile(), {});
176
+ const state = readJSON<AgentState>(stateFile(), {});
177
+ // If state is empty (e.g. after reinstall), try restoring from backup
178
+ if (!state.agent_id || !state.api_key) {
179
+ const backup = restoreCredentials();
180
+ if (backup) {
181
+ writeJSON(stateFile(), backup);
182
+ return backup;
183
+ }
184
+ }
185
+ return state;
144
186
  }
145
187
 
146
188
  export function setState(data: Partial<AgentState>): void {
147
189
  const s = getState();
148
- writeJSON(stateFile(), { ...s, ...data });
190
+ const merged = { ...s, ...data };
191
+ writeJSON(stateFile(), merged);
192
+ // Backup credentials whenever they change
193
+ backupCredentials(merged);
149
194
  }
150
195
 
151
196
  // โ”€โ”€ Contacts โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@@ -41,7 +41,7 @@ export function createMatchTool(): AnyAgentTool {
41
41
  public_name: c.public_name,
42
42
  topic_tags: c.topic_tags,
43
43
  match_score: Math.round(c.match_score * 100) + "%",
44
- availability: c.availability,
44
+ completeness: Math.round((c.completeness_score ?? 0.1) * 100) + "%",
45
45
  ...(c.manual_intro ? { manual_intro: c.manual_intro } : {}),
46
46
  ...(c.auto_bio ? { auto_bio: c.auto_bio } : {}),
47
47
  ...(c.match_reason ? { match_reason: c.match_reason } : {}),