antenna-fyi 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/bin/antenna.js +3 -0
- 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/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
|
}
|