@botcord/botcord 0.3.4 → 0.3.6-beta.20260413082920
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 +6 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -1
- package/skills/botcord/SKILL.md +78 -379
- package/skills/botcord-account/SKILL.md +172 -0
- package/skills/botcord-messaging/SKILL.md +188 -0
- package/skills/botcord-payment/SKILL.md +90 -0
- package/skills/botcord-social/SKILL.md +106 -0
- package/src/client.ts +101 -8
- package/src/commands/bind.ts +4 -3
- package/src/commands/uninstall.ts +129 -0
- package/src/constants.ts +1 -1
- package/src/credentials.ts +19 -146
- package/src/crypto.ts +1 -155
- package/src/hub-url.ts +1 -41
- package/src/inbound.ts +1 -10
- package/src/onboarding-hook.ts +106 -35
- package/src/session-key.ts +1 -59
- package/src/tools/account.ts +16 -32
- package/src/tools/api.ts +112 -0
- package/src/tools/bind.ts +11 -36
- package/src/tools/coin-format.ts +19 -0
- package/src/tools/contacts.ts +26 -37
- package/src/tools/directory.ts +9 -30
- package/src/tools/messaging.ts +25 -40
- package/src/tools/payment.ts +44 -43
- package/src/tools/register.ts +5 -4
- package/src/tools/reset-credential.ts +6 -5
- package/src/tools/room-context.ts +34 -35
- package/src/tools/rooms.ts +36 -42
- package/src/tools/subscription.ts +34 -43
- package/src/tools/tool-result.ts +10 -3
- package/src/tools/topics.ts +17 -31
- package/src/types.ts +3 -256
package/src/types.ts
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
export type BotCordSignature = {
|
|
4
|
-
alg: "ed25519";
|
|
5
|
-
key_id: string;
|
|
6
|
-
value: string; // base64
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type MessageType =
|
|
10
|
-
| "message"
|
|
11
|
-
| "ack"
|
|
12
|
-
| "result"
|
|
13
|
-
| "error"
|
|
14
|
-
| "contact_request"
|
|
15
|
-
| "contact_request_response"
|
|
16
|
-
| "contact_removed"
|
|
17
|
-
| "system";
|
|
18
|
-
|
|
19
|
-
export type BotCordMessageEnvelope = {
|
|
20
|
-
v: string;
|
|
21
|
-
msg_id: string;
|
|
22
|
-
ts: number;
|
|
23
|
-
from: string;
|
|
24
|
-
to: string;
|
|
25
|
-
type: MessageType;
|
|
26
|
-
reply_to: string | null;
|
|
27
|
-
ttl_sec: number;
|
|
28
|
-
topic?: string | null;
|
|
29
|
-
goal?: string | null;
|
|
30
|
-
payload: Record<string, unknown>;
|
|
31
|
-
payload_hash: string;
|
|
32
|
-
sig: BotCordSignature;
|
|
33
|
-
mentions?: string[] | null;
|
|
34
|
-
};
|
|
1
|
+
// Re-export all protocol types from shared package
|
|
2
|
+
export * from "@botcord/protocol-core";
|
|
35
3
|
|
|
4
|
+
// Plugin-specific types (not shared)
|
|
36
5
|
// Account config in openclaw.json channels.botcord
|
|
37
6
|
export type BotCordAccountConfig = {
|
|
38
7
|
enabled?: boolean;
|
|
@@ -52,225 +21,3 @@ export type BotCordAccountConfig = {
|
|
|
52
21
|
};
|
|
53
22
|
|
|
54
23
|
export type BotCordChannelConfig = BotCordAccountConfig;
|
|
55
|
-
|
|
56
|
-
// Inbox poll response
|
|
57
|
-
export type SourceType = "agent" | "dashboard_user_chat";
|
|
58
|
-
|
|
59
|
-
export type InboxMessage = {
|
|
60
|
-
hub_msg_id: string;
|
|
61
|
-
envelope: BotCordMessageEnvelope;
|
|
62
|
-
text?: string;
|
|
63
|
-
room_id?: string;
|
|
64
|
-
room_name?: string;
|
|
65
|
-
room_rule?: string | null;
|
|
66
|
-
room_member_count?: number;
|
|
67
|
-
room_member_names?: string[];
|
|
68
|
-
my_role?: string;
|
|
69
|
-
my_can_send?: boolean;
|
|
70
|
-
topic?: string;
|
|
71
|
-
topic_id?: string;
|
|
72
|
-
goal?: string;
|
|
73
|
-
mentioned?: boolean;
|
|
74
|
-
source_type?: SourceType;
|
|
75
|
-
source_user_id?: string | null;
|
|
76
|
-
source_user_name?: string | null;
|
|
77
|
-
source_session_kind?: string | null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type InboxPollResponse = {
|
|
81
|
-
messages: InboxMessage[];
|
|
82
|
-
count: number;
|
|
83
|
-
has_more: boolean;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// Hub API response types
|
|
87
|
-
export type SendResponse = {
|
|
88
|
-
queued: boolean;
|
|
89
|
-
hub_msg_id: string;
|
|
90
|
-
status: string;
|
|
91
|
-
topic_id?: string;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export type RoomInfo = {
|
|
95
|
-
room_id: string;
|
|
96
|
-
name: string;
|
|
97
|
-
description?: string;
|
|
98
|
-
rule?: string | null;
|
|
99
|
-
visibility: "private" | "public";
|
|
100
|
-
join_policy: "invite_only" | "open";
|
|
101
|
-
required_subscription_product_id?: string | null;
|
|
102
|
-
max_members?: number | null;
|
|
103
|
-
default_send: boolean;
|
|
104
|
-
default_invite?: boolean;
|
|
105
|
-
slow_mode_seconds?: number | null;
|
|
106
|
-
member_count: number;
|
|
107
|
-
created_at: string;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export type AgentInfo = {
|
|
111
|
-
agent_id: string;
|
|
112
|
-
display_name?: string;
|
|
113
|
-
bio?: string;
|
|
114
|
-
message_policy: string;
|
|
115
|
-
endpoints: Array<{ url: string; state: string }>;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export type ContactInfo = {
|
|
119
|
-
contact_agent_id: string;
|
|
120
|
-
display_name?: string;
|
|
121
|
-
created_at: string;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export type ContactRequestInfo = {
|
|
125
|
-
request_id: string;
|
|
126
|
-
from_agent_id: string;
|
|
127
|
-
to_agent_id: string;
|
|
128
|
-
state: "pending" | "accepted" | "rejected";
|
|
129
|
-
created_at: string;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// File upload response (mirrors hub/schemas.py FileUploadResponse)
|
|
133
|
-
export type FileUploadResponse = {
|
|
134
|
-
file_id: string;
|
|
135
|
-
url: string;
|
|
136
|
-
original_filename: string;
|
|
137
|
-
content_type: string;
|
|
138
|
-
size_bytes: number;
|
|
139
|
-
expires_at: string; // ISO 8601
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// Attachment metadata included in message payloads
|
|
143
|
-
export type MessageAttachment = {
|
|
144
|
-
filename: string;
|
|
145
|
-
url: string;
|
|
146
|
-
content_type?: string;
|
|
147
|
-
size_bytes?: number;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// Wallet types (mirrors hub wallet schemas)
|
|
151
|
-
|
|
152
|
-
export type WalletSummary = {
|
|
153
|
-
agent_id: string;
|
|
154
|
-
asset_code: string;
|
|
155
|
-
available_balance_minor: string;
|
|
156
|
-
locked_balance_minor: string;
|
|
157
|
-
total_balance_minor: string;
|
|
158
|
-
updated_at: string;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export type WalletTransaction = {
|
|
162
|
-
tx_id: string;
|
|
163
|
-
type: "topup" | "withdrawal" | "transfer";
|
|
164
|
-
status: "pending" | "processing" | "completed" | "failed" | "cancelled";
|
|
165
|
-
asset_code: string;
|
|
166
|
-
amount_minor: string;
|
|
167
|
-
fee_minor: string;
|
|
168
|
-
from_agent_id: string | null;
|
|
169
|
-
to_agent_id: string | null;
|
|
170
|
-
reference_type: string | null;
|
|
171
|
-
reference_id: string | null;
|
|
172
|
-
idempotency_key: string | null;
|
|
173
|
-
metadata_json: string | null;
|
|
174
|
-
created_at: string;
|
|
175
|
-
updated_at: string;
|
|
176
|
-
completed_at: string | null;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export type WalletLedgerEntry = {
|
|
180
|
-
entry_id: string;
|
|
181
|
-
tx_id: string;
|
|
182
|
-
agent_id: string;
|
|
183
|
-
asset_code: string;
|
|
184
|
-
direction: "debit" | "credit";
|
|
185
|
-
amount_minor: string;
|
|
186
|
-
balance_after_minor: string;
|
|
187
|
-
created_at: string;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export type WalletLedgerResponse = {
|
|
191
|
-
entries: WalletLedgerEntry[];
|
|
192
|
-
next_cursor: string | null;
|
|
193
|
-
has_more: boolean;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export type TopupResponse = {
|
|
197
|
-
topup_id: string;
|
|
198
|
-
tx_id: string | null;
|
|
199
|
-
agent_id: string;
|
|
200
|
-
asset_code: string;
|
|
201
|
-
amount_minor: string;
|
|
202
|
-
status: string;
|
|
203
|
-
channel: string;
|
|
204
|
-
created_at: string;
|
|
205
|
-
completed_at: string | null;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export type WithdrawalResponse = {
|
|
209
|
-
withdrawal_id: string;
|
|
210
|
-
tx_id: string | null;
|
|
211
|
-
agent_id: string;
|
|
212
|
-
asset_code: string;
|
|
213
|
-
amount_minor: string;
|
|
214
|
-
fee_minor: string;
|
|
215
|
-
status: string;
|
|
216
|
-
destination_type: string | null;
|
|
217
|
-
review_note: string | null;
|
|
218
|
-
created_at: string;
|
|
219
|
-
reviewed_at: string | null;
|
|
220
|
-
completed_at: string | null;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export type BillingInterval = "week" | "month";
|
|
224
|
-
|
|
225
|
-
export type SubscriptionProductStatus = "active" | "archived";
|
|
226
|
-
|
|
227
|
-
export type SubscriptionStatus = "active" | "past_due" | "cancelled";
|
|
228
|
-
|
|
229
|
-
export type SubscriptionChargeAttemptStatus = "pending" | "succeeded" | "failed";
|
|
230
|
-
|
|
231
|
-
export type SubscriptionProduct = {
|
|
232
|
-
product_id: string;
|
|
233
|
-
owner_agent_id: string;
|
|
234
|
-
name: string;
|
|
235
|
-
description: string;
|
|
236
|
-
asset_code: string;
|
|
237
|
-
amount_minor: string;
|
|
238
|
-
billing_interval: BillingInterval;
|
|
239
|
-
status: SubscriptionProductStatus;
|
|
240
|
-
created_at: string;
|
|
241
|
-
updated_at: string;
|
|
242
|
-
archived_at: string | null;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export type Subscription = {
|
|
246
|
-
subscription_id: string;
|
|
247
|
-
product_id: string;
|
|
248
|
-
subscriber_agent_id: string;
|
|
249
|
-
provider_agent_id: string;
|
|
250
|
-
asset_code: string;
|
|
251
|
-
amount_minor: string;
|
|
252
|
-
billing_interval: BillingInterval;
|
|
253
|
-
status: SubscriptionStatus;
|
|
254
|
-
current_period_start: string;
|
|
255
|
-
current_period_end: string;
|
|
256
|
-
next_charge_at: string;
|
|
257
|
-
cancel_at_period_end: boolean;
|
|
258
|
-
cancelled_at: string | null;
|
|
259
|
-
last_charged_at: string | null;
|
|
260
|
-
last_charge_tx_id: string | null;
|
|
261
|
-
consecutive_failed_attempts: number;
|
|
262
|
-
created_at: string;
|
|
263
|
-
updated_at: string;
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
export type SubscriptionChargeAttempt = {
|
|
267
|
-
attempt_id: string;
|
|
268
|
-
subscription_id: string;
|
|
269
|
-
billing_cycle_key: string;
|
|
270
|
-
status: SubscriptionChargeAttemptStatus;
|
|
271
|
-
scheduled_at: string;
|
|
272
|
-
attempted_at: string | null;
|
|
273
|
-
tx_id: string | null;
|
|
274
|
-
failure_reason: string | null;
|
|
275
|
-
created_at: string;
|
|
276
|
-
};
|