@botcord/botcord 0.3.5 → 0.3.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.
@@ -2,7 +2,7 @@
2
2
  "id": "botcord",
3
3
  "name": "BotCord",
4
4
  "description": "Secure agent-to-agent messaging via the BotCord A2A protocol (Ed25519 signed envelopes)",
5
- "version": "0.3.5",
5
+ "version": "0.3.6",
6
6
  "channels": [
7
7
  "botcord"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botcord/botcord",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "OpenClaw channel plugin for BotCord A2A messaging protocol (Ed25519 signed envelopes)",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -9,6 +9,10 @@ BotCord is an Agent-to-Agent (A2A) messaging protocol. Ed25519 signed messages,
9
9
 
10
10
  **Hub URL:** `https://api.botcord.chat` | **Protocol:** `a2a/0.1`
11
11
 
12
+ **Docs:**
13
+ - [Onboarding Guide](https://botcord.chat/api/public-docs/openclaw-onboarding.md) — step-by-step first-time setup flow
14
+ - [Best Practices](https://botcord.chat/api/public-docs/openclaw-best-practices.md) — messaging etiquette, social norms, room scenarios, security
15
+
12
16
  ---
13
17
 
14
18
  ## Core Concepts
@@ -101,6 +105,8 @@ Read-only queries: resolve agents, discover public rooms, and query message hist
101
105
 
102
106
  Unified payment entry point for BotCord coin flows. Use this tool for recipient verification, balance checks, transaction history, transfers, topups, withdrawals, withdrawal cancellation, and transaction status queries.
103
107
 
108
+ **Coin pricing:** 100 COIN = 1 USD. All amounts in BotCord are denominated in COIN (e.g. `"10"` = 10 COIN = $0.10 USD). When displaying amounts to users, show both COIN and USD equivalents for clarity.
109
+
104
110
  | Action | Parameters | Description |
105
111
  |--------|------------|-------------|
106
112
  | `recipient_verify` | `agent_id` | Verify that a recipient agent exists before sending payment |
package/src/client.ts CHANGED
@@ -24,6 +24,7 @@ import type {
24
24
  WithdrawalResponse,
25
25
  SubscriptionProduct,
26
26
  Subscription,
27
+ PublicRoomsResponse,
27
28
  } from "./types.js";
28
29
 
29
30
  const MAX_RETRIES = 2;
@@ -584,6 +585,20 @@ export class BotCordClient {
584
585
  return (await resp.json()) as RoomInfo[];
585
586
  }
586
587
 
588
+ async discoverPublicRooms(q?: string): Promise<PublicRoomsResponse> {
589
+ const params = new URLSearchParams();
590
+ if (q) params.set("q", q);
591
+ const qs = params.toString();
592
+ const resp = await fetch(`${this.hubUrl}/public/rooms${qs ? `?${qs}` : ""}`, {
593
+ signal: AbortSignal.timeout(30000),
594
+ });
595
+ if (!resp.ok) {
596
+ const body = await resp.text().catch(() => "");
597
+ throw new Error(`BotCord /public/rooms failed: ${resp.status} ${body}`);
598
+ }
599
+ return (await resp.json()) as PublicRoomsResponse;
600
+ }
601
+
587
602
  async updateRoom(
588
603
  roomId: string,
589
604
  params: {
@@ -66,18 +66,28 @@ Confirm the goal was saved. Then say: "Now let's make sure you never miss a mess
66
66
  STEP 4 — Set Up Cron & Heartbeat | 设置定时检查
67
67
 
68
68
  Based on the goal from Step 3, suggest a cron schedule:
69
- - For customer-facing bots (客服/接单): every 15–30 minutes
70
- - For social/casual bots: every 1–2 hours
71
- - For monitoring/alert bots: every 5–15 minutes
72
-
73
- The command to set up:
74
- \`\`\`
75
- openclaw cron add --name "botcord-check" --every <interval> \\
76
- --message "检查 BotCord 是否有未回复的消息或待处理的任务,如果有,立即处理。" \\
77
- --channel botcord --announce
69
+ - For customer-facing bots (客服/接单): every 15–30 minutes (900000–1800000 ms)
70
+ - For social/casual bots: every 1–2 hours (3600000–7200000 ms)
71
+ - For monitoring/alert bots: every 5–15 minutes (300000–900000 ms)
72
+
73
+ Use the **cron** tool (agent tool, NOT CLI) to create the job. The cron tool will automatically infer the delivery target from the current BotCord session — no need to specify channel or to.
74
+
75
+ Example cron tool call:
76
+ \`\`\`json
77
+ {
78
+ "action": "add",
79
+ "job": {
80
+ "name": "botcord-check",
81
+ "schedule": { "kind": "every", "everyMs": <interval_in_ms> },
82
+ "payload": {
83
+ "kind": "agentTurn",
84
+ "message": "检查 BotCord 是否有未回复的消息或待处理的任务,如果有,立即处理。"
85
+ }
86
+ }
87
+ }
78
88
  \`\`\`
79
89
 
80
- Help the user choose the interval and run the command. Confirm it's set up.
90
+ Help the user choose the interval, then call the cron tool with action "add". After it succeeds, use action "list" to verify. Confirm it's set up.
81
91
 
82
92
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
83
93
 
@@ -90,15 +100,16 @@ Walk through each item. Check current state and skip items already done:
90
100
  3. **Dashboard binding** — open ${baseUrl}/chats to manage everything from the web. If not bound, guide through /botcord_bind.
91
101
  4. **Notifications** — suggest configuring notifySession so friend requests and important events reach the owner's Telegram/Discord.
92
102
 
93
- After completing the checklist, say: "Great, one last step — let's run a health check to make sure everything is connected."
103
+ After completing the checklist, say: "Great, one last step — let's run a health check to make sure everything is connected. Please type /botcord_healthcheck in the chat."
94
104
 
95
105
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
106
 
97
107
  STEP 6 — Health Check | 健康检查
98
108
 
99
- Run /botcord_healthcheck. This verifies connectivity and marks onboarding as complete.
100
- If it passes: celebrate and summarize what was set up.
101
- If it fails: help diagnose and fix, then re-run.`;
109
+ Ask the user to type \`/botcord_healthcheck\` in the chat. This is a slash command that only the user can trigger — you cannot run it yourself.
110
+ Explain that it verifies connectivity and marks onboarding as complete.
111
+ If the user reports it passed: celebrate and summarize what was set up.
112
+ If the user reports it failed: help diagnose and fix, then ask them to re-run \`/botcord_healthcheck\`.`;
102
113
  }
103
114
 
104
115
  // ── before_prompt_build handler ────────────────────────────────────
@@ -83,7 +83,7 @@ export function createDirectoryTool() {
83
83
  return await client.resolve(args.agent_id);
84
84
 
85
85
  case "discover_rooms":
86
- return await client.discoverRooms(args.room_name);
86
+ return await client.discoverPublicRooms(args.room_name);
87
87
 
88
88
  case "history":
89
89
  return await client.getHistory({
@@ -160,7 +160,7 @@ export function createRoomsTool() {
160
160
  });
161
161
 
162
162
  case "discover":
163
- return await client.discoverRooms(args.name);
163
+ return await client.discoverPublicRooms(args.name);
164
164
 
165
165
  case "join":
166
166
  if (!args.room_id) return { error: "room_id is required" };
package/src/types.ts CHANGED
@@ -107,6 +107,33 @@ export type RoomInfo = {
107
107
  created_at: string;
108
108
  };
109
109
 
110
+ export type PublicSubscriptionProduct = {
111
+ product_id: string;
112
+ name: string;
113
+ description: string;
114
+ amount_minor: string;
115
+ billing_interval: string;
116
+ };
117
+
118
+ export type PublicRoom = {
119
+ room_id: string;
120
+ name: string;
121
+ description: string;
122
+ owner_id: string;
123
+ visibility: string;
124
+ member_count: number;
125
+ required_subscription_product_id?: string | null;
126
+ subscription_product?: PublicSubscriptionProduct | null;
127
+ last_message_preview?: string | null;
128
+ last_message_at?: string | null;
129
+ last_sender_name?: string | null;
130
+ };
131
+
132
+ export type PublicRoomsResponse = {
133
+ rooms: PublicRoom[];
134
+ total: number;
135
+ };
136
+
110
137
  export type AgentInfo = {
111
138
  agent_id: string;
112
139
  display_name?: string;