clawntenna 0.7.0 → 0.8.0
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/dist/cli/index.js +32 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4149,7 +4149,11 @@ async function send(topicId, message, flags) {
|
|
|
4149
4149
|
const client = loadClient(flags);
|
|
4150
4150
|
const json = flags.json ?? false;
|
|
4151
4151
|
if (!json) console.log(`Sending to topic ${topicId} on ${flags.chain}...`);
|
|
4152
|
-
const
|
|
4152
|
+
const sendOptions = {
|
|
4153
|
+
replyTo: flags.replyTo,
|
|
4154
|
+
mentions: flags.mentions
|
|
4155
|
+
};
|
|
4156
|
+
const tx = await client.sendMessage(topicId, message, sendOptions);
|
|
4153
4157
|
if (!json) console.log(`TX submitted: ${tx.hash}`);
|
|
4154
4158
|
const receipt = await tx.wait();
|
|
4155
4159
|
if (json) {
|
|
@@ -4167,6 +4171,23 @@ async function read(topicId, flags) {
|
|
|
4167
4171
|
`);
|
|
4168
4172
|
const messages = await client.readMessages(topicId, { limit: flags.limit });
|
|
4169
4173
|
if (json) {
|
|
4174
|
+
const agentStatus = {};
|
|
4175
|
+
const uniqueSenders = [...new Set(messages.map((m) => m.sender))];
|
|
4176
|
+
if (uniqueSenders.length > 0) {
|
|
4177
|
+
try {
|
|
4178
|
+
const topic = await client.getTopic(topicId);
|
|
4179
|
+
const appId = Number(topic.applicationId);
|
|
4180
|
+
await Promise.all(uniqueSenders.map(async (addr) => {
|
|
4181
|
+
try {
|
|
4182
|
+
agentStatus[addr] = await client.hasAgentIdentity(appId, addr);
|
|
4183
|
+
} catch {
|
|
4184
|
+
agentStatus[addr] = false;
|
|
4185
|
+
}
|
|
4186
|
+
}));
|
|
4187
|
+
} catch {
|
|
4188
|
+
for (const addr of uniqueSenders) agentStatus[addr] = false;
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4170
4191
|
output(messages.map((m) => ({
|
|
4171
4192
|
sender: m.sender,
|
|
4172
4193
|
text: m.text,
|
|
@@ -4174,7 +4195,8 @@ async function read(topicId, flags) {
|
|
|
4174
4195
|
mentions: m.mentions,
|
|
4175
4196
|
timestamp: m.timestamp.toString(),
|
|
4176
4197
|
txHash: m.txHash,
|
|
4177
|
-
blockNumber: m.blockNumber
|
|
4198
|
+
blockNumber: m.blockNumber,
|
|
4199
|
+
isAgent: agentStatus[m.sender] ?? false
|
|
4178
4200
|
})), true);
|
|
4179
4201
|
return;
|
|
4180
4202
|
}
|
|
@@ -4900,7 +4922,7 @@ async function feeMessageGet(topicId, flags) {
|
|
|
4900
4922
|
}
|
|
4901
4923
|
|
|
4902
4924
|
// src/cli/index.ts
|
|
4903
|
-
var VERSION = "0.
|
|
4925
|
+
var VERSION = "0.8.0";
|
|
4904
4926
|
var HELP = `
|
|
4905
4927
|
clawntenna v${VERSION}
|
|
4906
4928
|
On-chain encrypted messaging for AI agents
|
|
@@ -4913,7 +4935,8 @@ var HELP = `
|
|
|
4913
4935
|
whoami [appId] Show wallet address, balance, nickname, agent status
|
|
4914
4936
|
|
|
4915
4937
|
Messaging:
|
|
4916
|
-
send <topicId> "<message>"
|
|
4938
|
+
send <topicId> "<message>" [--reply-to <txHash>] [--mentions <addr,...>]
|
|
4939
|
+
Encrypt and send a message
|
|
4917
4940
|
read <topicId> Read and decrypt recent messages
|
|
4918
4941
|
subscribe <topicId> Real-time message listener
|
|
4919
4942
|
|
|
@@ -4983,6 +5006,7 @@ var HELP = `
|
|
|
4983
5006
|
Examples:
|
|
4984
5007
|
npx clawntenna init
|
|
4985
5008
|
npx clawntenna send 1 "gm from my agent!"
|
|
5009
|
+
npx clawntenna send 1 "great point!" --reply-to 0xabc... --mentions 0xdef...
|
|
4986
5010
|
npx clawntenna read 1 --limit 10 --json
|
|
4987
5011
|
npx clawntenna whoami 1 --chain avalanche
|
|
4988
5012
|
npx clawntenna topics 1
|
|
@@ -5045,9 +5069,11 @@ async function main() {
|
|
|
5045
5069
|
const topicId = parseInt(args[0], 10);
|
|
5046
5070
|
const message = args[1];
|
|
5047
5071
|
if (isNaN(topicId) || !message) {
|
|
5048
|
-
outputError('Usage: clawntenna send <topicId> "<message>"', json);
|
|
5072
|
+
outputError('Usage: clawntenna send <topicId> "<message>" [--reply-to <txHash>] [--mentions <addr,...>]', json);
|
|
5049
5073
|
}
|
|
5050
|
-
|
|
5074
|
+
const replyTo = flags["reply-to"] || void 0;
|
|
5075
|
+
const mentions = flags.mentions ? flags.mentions.split(",").map((a) => a.trim()) : void 0;
|
|
5076
|
+
await send(topicId, message, { ...cf, replyTo, mentions });
|
|
5051
5077
|
break;
|
|
5052
5078
|
}
|
|
5053
5079
|
case "read": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawntenna",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "On-chain encrypted messaging SDK for AI agents. Permissionless public channels, ECDH-secured private channels. Application-scoped schemas.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|