antenna-fyi 0.6.1 → 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/bin/antenna.js +3 -0
- package/install.js +78 -19
- package/lib/cli.js +11 -1
- package/lib/core.js +14 -0
- package/lib/hermes-plugin/__init__.py +3 -0
- package/lib/hermes-plugin/schemas.py +16 -0
- package/lib/hermes-plugin/tools.py +19 -0
- package/lib/mcp.js +20 -0
- package/package.json +1 -1
package/bin/antenna.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
handleAccept,
|
|
8
8
|
handleCheckin,
|
|
9
9
|
handleMatches,
|
|
10
|
+
handleBind,
|
|
10
11
|
handleSetup,
|
|
11
12
|
handleStatus,
|
|
12
13
|
handleInstallSkill,
|
|
@@ -30,6 +31,8 @@ async function main() {
|
|
|
30
31
|
return handleCheckin(f);
|
|
31
32
|
case "matches":
|
|
32
33
|
return handleMatches(f);
|
|
34
|
+
case "bind":
|
|
35
|
+
return handleBind(f);
|
|
33
36
|
case "serve": {
|
|
34
37
|
const { startMcpServer } = await import("../lib/mcp.js");
|
|
35
38
|
return startMcpServer();
|
package/install.js
CHANGED
|
@@ -1,19 +1,78 @@
|
|
|
1
|
-
// postinstall —
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
// postinstall — auto-detect agent platforms and install
|
|
2
|
+
|
|
3
|
+
import { existsSync, mkdirSync, copyFileSync } from "fs";
|
|
4
|
+
import { join, dirname } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
import { execSync } from "child_process";
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
const home = homedir();
|
|
12
|
+
let installed = [];
|
|
13
|
+
|
|
14
|
+
console.log("\n📡 Antenna — Nearby People Discovery\n");
|
|
15
|
+
|
|
16
|
+
// ── Hermes ────────────────────────────────────────────────────────
|
|
17
|
+
const hermesHome = join(home, ".hermes");
|
|
18
|
+
if (existsSync(hermesHome)) {
|
|
19
|
+
try {
|
|
20
|
+
// Plugin
|
|
21
|
+
const pluginDir = join(hermesHome, "plugins", "antenna");
|
|
22
|
+
const templateDir = join(__dirname, "lib", "hermes-plugin");
|
|
23
|
+
if (!existsSync(pluginDir)) mkdirSync(pluginDir, { recursive: true });
|
|
24
|
+
for (const f of ["plugin.yaml", "__init__.py", "schemas.py", "tools.py"]) {
|
|
25
|
+
const src = join(templateDir, f);
|
|
26
|
+
if (existsSync(src)) copyFileSync(src, join(pluginDir, f));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Skill
|
|
30
|
+
const skillDir = join(hermesHome, "skills", "antenna");
|
|
31
|
+
if (!existsSync(skillDir)) mkdirSync(skillDir, { recursive: true });
|
|
32
|
+
copyFileSync(join(__dirname, "skill", "SKILL.md"), join(skillDir, "SKILL.md"));
|
|
33
|
+
|
|
34
|
+
// Deps
|
|
35
|
+
const hermesAgent = join(hermesHome, "hermes-agent");
|
|
36
|
+
if (existsSync(hermesAgent)) {
|
|
37
|
+
try {
|
|
38
|
+
execSync("uv pip install supabase", { cwd: hermesAgent, stdio: "ignore", timeout: 60_000 });
|
|
39
|
+
} catch {
|
|
40
|
+
try {
|
|
41
|
+
execSync("pip install supabase", { stdio: "ignore", timeout: 60_000 });
|
|
42
|
+
} catch { /* user can install manually */ }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
installed.push("Hermes (Plugin + Skill + deps)");
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.log(` ⚠️ Hermes detected but setup failed: ${e.message}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ── OpenClaw ──────────────────────────────────────────────────────
|
|
53
|
+
const openclawHome = join(home, ".openclaw");
|
|
54
|
+
if (existsSync(openclawHome)) {
|
|
55
|
+
try {
|
|
56
|
+
const skillDir = join(openclawHome, "skills", "antenna");
|
|
57
|
+
if (!existsSync(skillDir)) mkdirSync(skillDir, { recursive: true });
|
|
58
|
+
copyFileSync(join(__dirname, "skill", "SKILL.md"), join(skillDir, "SKILL.md"));
|
|
59
|
+
installed.push("OpenClaw (Skill)");
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.log(` ⚠️ OpenClaw detected but setup failed: ${e.message}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ── Result ────────────────────────────────────────────────────────
|
|
66
|
+
if (installed.length > 0) {
|
|
67
|
+
console.log(" ✅ Auto-configured for: " + installed.join(", "));
|
|
68
|
+
console.log(" Restart your agent to activate.\n");
|
|
69
|
+
} else {
|
|
70
|
+
console.log(" No agent platform detected (~/.hermes or ~/.openclaw).");
|
|
71
|
+
console.log(" You can still use the CLI: antenna help\n");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log(" Quick start:");
|
|
75
|
+
console.log(" antenna setup Create your card");
|
|
76
|
+
console.log(" antenna scan --lat … --lng … Find people");
|
|
77
|
+
console.log(" antenna serve Start MCP server");
|
|
78
|
+
console.log(" antenna help Full usage\n");
|
package/lib/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// antenna CLI command handlers
|
|
2
2
|
|
|
3
|
-
import { scan, getProfile, setProfile, accept, checkMatches, checkin } from "./core.js";
|
|
3
|
+
import { scan, getProfile, setProfile, accept, checkMatches, checkin, createBindToken } from "./core.js";
|
|
4
4
|
import { createInterface } from "readline";
|
|
5
5
|
import { existsSync, mkdirSync, copyFileSync } from "fs";
|
|
6
6
|
import { join, dirname } from "path";
|
|
@@ -106,6 +106,15 @@ export async function handleMatches(f) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
export async function handleBind(f) {
|
|
110
|
+
if (!f.id) return console.error("Usage: antenna bind --id telegram:123");
|
|
111
|
+
const result = await createBindToken({ device_id: f.id });
|
|
112
|
+
console.log("\n🔗 GPS Binding Link:\n");
|
|
113
|
+
console.log(` ${result.url}\n`);
|
|
114
|
+
console.log("Send this to the user. Opening it on their phone will share GPS with their agent.");
|
|
115
|
+
console.log();
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
export async function handleSetup(f) {
|
|
110
119
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
111
120
|
const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
|
|
@@ -276,6 +285,7 @@ Usage:
|
|
|
276
285
|
antenna profile --id telegram:123 [--name Yi --emoji 🦦 --line1 '...']
|
|
277
286
|
antenna accept --id telegram:123 --target telegram:789 [--contact 'WeChat: yi']
|
|
278
287
|
antenna matches --id telegram:123
|
|
288
|
+
antenna bind --id telegram:123
|
|
279
289
|
antenna serve Start MCP server (stdio transport)
|
|
280
290
|
antenna setup Interactive profile setup [--id telegram:123]
|
|
281
291
|
antenna status Show config & status [--id telegram:123]
|
package/lib/core.js
CHANGED
|
@@ -245,3 +245,17 @@ export async function checkMatches({ device_id, supabaseUrl, supabaseKey }) {
|
|
|
245
245
|
message: messages.join(";"),
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
+
|
|
249
|
+
// ─── createBindToken ─────────────────────────────────────────────
|
|
250
|
+
|
|
251
|
+
export async function createBindToken({ device_id, supabaseUrl, supabaseKey }) {
|
|
252
|
+
const sb = getClient(supabaseUrl, supabaseKey);
|
|
253
|
+
const { data, error } = await sb.rpc("create_bind_token", { p_device_id: device_id });
|
|
254
|
+
if (error) throw new Error(error.message);
|
|
255
|
+
const baseUrl = "https://www.antenna.fyi";
|
|
256
|
+
return {
|
|
257
|
+
token: data.token,
|
|
258
|
+
url: `${baseUrl}/locate?token=${data.token}`,
|
|
259
|
+
message: "发送这个链接给用户,在手机浏览器打开即可共享位置。",
|
|
260
|
+
};
|
|
261
|
+
}
|
|
@@ -12,11 +12,13 @@ from .tools import (
|
|
|
12
12
|
handle_accept,
|
|
13
13
|
handle_checkin,
|
|
14
14
|
handle_check_matches,
|
|
15
|
+
handle_bind,
|
|
15
16
|
SCAN_SCHEMA,
|
|
16
17
|
PROFILE_SCHEMA,
|
|
17
18
|
ACCEPT_SCHEMA,
|
|
18
19
|
CHECKIN_SCHEMA,
|
|
19
20
|
CHECK_MATCHES_SCHEMA,
|
|
21
|
+
BIND_SCHEMA,
|
|
20
22
|
)
|
|
21
23
|
import re
|
|
22
24
|
|
|
@@ -28,6 +30,7 @@ def register(ctx):
|
|
|
28
30
|
ctx.register_tool("antenna_accept", ACCEPT_SCHEMA, handle_accept)
|
|
29
31
|
ctx.register_tool("antenna_checkin", CHECKIN_SCHEMA, handle_checkin)
|
|
30
32
|
ctx.register_tool("antenna_check_matches", CHECK_MATCHES_SCHEMA, handle_check_matches)
|
|
33
|
+
ctx.register_tool("antenna_bind", BIND_SCHEMA, handle_bind)
|
|
31
34
|
|
|
32
35
|
# ── Hook: auto-detect location in messages ────────────────────
|
|
33
36
|
def on_pre_llm(messages, **kwargs):
|
|
@@ -115,3 +115,19 @@ CHECK_MATCHES_SCHEMA = {
|
|
|
115
115
|
"required": ["sender_id", "channel"],
|
|
116
116
|
},
|
|
117
117
|
}
|
|
118
|
+
|
|
119
|
+
BIND_SCHEMA = {
|
|
120
|
+
"name": "antenna_bind",
|
|
121
|
+
"description": (
|
|
122
|
+
"Generate a GPS binding link. Send this URL to the user so they can "
|
|
123
|
+
"share their phone's location via the web browser."
|
|
124
|
+
),
|
|
125
|
+
"parameters": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"properties": {
|
|
128
|
+
"sender_id": {"type": "string"},
|
|
129
|
+
"channel": {"type": "string"},
|
|
130
|
+
},
|
|
131
|
+
"required": ["sender_id", "channel"],
|
|
132
|
+
},
|
|
133
|
+
}
|
|
@@ -242,3 +242,22 @@ def handle_check_matches(params: dict) -> str:
|
|
|
242
242
|
"incoming_accepts": inc_only,
|
|
243
243
|
"message": ";".join(msgs),
|
|
244
244
|
})
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
BASE_URL = "https://www.antenna.fyi"
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def handle_bind(params: dict) -> str:
|
|
251
|
+
sb = _sb()
|
|
252
|
+
did = _device_id(params["sender_id"], params["channel"])
|
|
253
|
+
|
|
254
|
+
resp = sb.rpc("create_bind_token", {"p_device_id": did}).execute()
|
|
255
|
+
if not resp.data:
|
|
256
|
+
return _ok({"error": "Failed to create bind token"})
|
|
257
|
+
|
|
258
|
+
token = resp.data.get("token")
|
|
259
|
+
return _ok({
|
|
260
|
+
"token": token,
|
|
261
|
+
"url": f"{BASE_URL}/locate?token={token}",
|
|
262
|
+
"message": "发送这个链接给用户,在手机浏览器打开即可共享位置。",
|
|
263
|
+
})
|
package/lib/mcp.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
accept,
|
|
11
11
|
checkMatches,
|
|
12
12
|
checkin,
|
|
13
|
+
createBindToken,
|
|
13
14
|
deriveDeviceId,
|
|
14
15
|
} from "./core.js";
|
|
15
16
|
|
|
@@ -143,6 +144,25 @@ export async function startMcpServer() {
|
|
|
143
144
|
}
|
|
144
145
|
);
|
|
145
146
|
|
|
147
|
+
// ─── antenna_bind ────────────────────────────────────────────
|
|
148
|
+
|
|
149
|
+
server.tool(
|
|
150
|
+
"antenna_bind",
|
|
151
|
+
"Generate a GPS binding link. Send this to the user so they can share their phone's location via the web.",
|
|
152
|
+
{
|
|
153
|
+
sender_id: z.string().describe("The sender's user ID"),
|
|
154
|
+
channel: z.string().describe("Channel name"),
|
|
155
|
+
},
|
|
156
|
+
async ({ sender_id, channel }) => {
|
|
157
|
+
try {
|
|
158
|
+
const result = await createBindToken({ device_id: deriveDeviceId(sender_id, channel) });
|
|
159
|
+
return jsonResult(result);
|
|
160
|
+
} catch (e) {
|
|
161
|
+
return jsonResult({ error: e.message });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
|
|
146
166
|
const transport = new StdioServerTransport();
|
|
147
167
|
await server.connect(transport);
|
|
148
168
|
}
|