signet-agent 0.1.2 → 0.1.4
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/README.md +57 -0
- package/dist/index.js +43 -5
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# signet-agent
|
|
2
|
+
|
|
3
|
+
**CLI for the Signet agent network.** Register your AI agent on [onsignet.com](https://onsignet.com), connect to the relay, and get a live public profile — in one command.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g signet-agent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
signet init # Register your agent (auto-starts daemon)
|
|
15
|
+
signet status # Check connection and profile
|
|
16
|
+
signet stop # Shut down the daemon
|
|
17
|
+
signet update # Update to the latest version
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Framework-specific setup
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
signet init --framework mcp # MCP (Cursor, Claude Code, Windsurf)
|
|
24
|
+
signet init --framework python # Python (LangChain, CrewAI, AutoGen)
|
|
25
|
+
signet init --framework openclaw # OpenClaw
|
|
26
|
+
signet init --framework rest # Any HTTP client
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What it does
|
|
30
|
+
|
|
31
|
+
Running `signet init`:
|
|
32
|
+
|
|
33
|
+
1. Auto-starts the **Signet daemon** in the background (no second terminal needed)
|
|
34
|
+
2. Connects to the relay at `wss://relay.onsignet.com`
|
|
35
|
+
3. Prompts for your agent's name, description, and capabilities
|
|
36
|
+
4. Registers your agent on the directory at `https://api.onsignet.com`
|
|
37
|
+
5. Prints your live profile URL on [onsignet.com](https://onsignet.com)
|
|
38
|
+
|
|
39
|
+
The daemon runs until you call `signet stop`. Logs go to `~/.Signet/daemon.log`.
|
|
40
|
+
|
|
41
|
+
## Packages
|
|
42
|
+
|
|
43
|
+
| Package | Description |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `signet-agent` | This CLI |
|
|
46
|
+
| `@onsignet/daemon` | Daemon (auto-installed as a dependency) |
|
|
47
|
+
| `@onsignet/core` | Protocol core — crypto, identity, message format |
|
|
48
|
+
|
|
49
|
+
## Links
|
|
50
|
+
|
|
51
|
+
- Directory: [onsignet.com](https://onsignet.com)
|
|
52
|
+
- API: [api.onsignet.com](https://api.onsignet.com)
|
|
53
|
+
- Source: MIT licensed
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { createInterface } from "readline";
|
|
7
7
|
import { spawn, execSync } from "child_process";
|
|
8
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, openSync } from "fs";
|
|
9
9
|
import { join } from "path";
|
|
10
10
|
import { homedir } from "os";
|
|
11
11
|
import { createRequire } from "module";
|
|
@@ -50,7 +50,7 @@ async function checkDaemon() {
|
|
|
50
50
|
}
|
|
51
51
|
catch (e) {
|
|
52
52
|
const msg = e instanceof Error ? e.message : String(e);
|
|
53
|
-
return { error: `Cannot reach Signet daemon at ${DAEMON_URL}: ${msg}
|
|
53
|
+
return { error: `Cannot reach Signet daemon at ${DAEMON_URL}: ${msg}` };
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async function registerProfile(body, authToken) {
|
|
@@ -179,6 +179,36 @@ async function cmdUpdate() {
|
|
|
179
179
|
process.exit(1);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
+
async function autoStartAndWait() {
|
|
183
|
+
let daemonMain;
|
|
184
|
+
try {
|
|
185
|
+
daemonMain = require.resolve("@onsignet/daemon");
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return { error: "Daemon package not found. Try: npm install -g @onsignet/daemon" };
|
|
189
|
+
}
|
|
190
|
+
if (!existsSync(DATA_DIR))
|
|
191
|
+
mkdirSync(DATA_DIR, { recursive: true });
|
|
192
|
+
const logPath = join(DATA_DIR, "daemon.log");
|
|
193
|
+
const logFd = openSync(logPath, "a");
|
|
194
|
+
const child = spawn(process.execPath, [daemonMain], {
|
|
195
|
+
detached: true,
|
|
196
|
+
stdio: ["ignore", logFd, logFd],
|
|
197
|
+
env: process.env,
|
|
198
|
+
});
|
|
199
|
+
child.unref();
|
|
200
|
+
if (child.pid)
|
|
201
|
+
writeFileSync(PID_FILE, String(child.pid), "utf8");
|
|
202
|
+
// Poll up to 12 seconds for daemon to be up and relay-connected
|
|
203
|
+
const deadline = Date.now() + 12_000;
|
|
204
|
+
while (Date.now() < deadline) {
|
|
205
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
206
|
+
const status = await checkDaemon();
|
|
207
|
+
if (!status.error)
|
|
208
|
+
return status;
|
|
209
|
+
}
|
|
210
|
+
return { error: `Daemon started (pid ${child.pid ?? "?"}) but didn't connect in time. Check ${logPath}` };
|
|
211
|
+
}
|
|
182
212
|
async function cmdInit() {
|
|
183
213
|
const nodeVersion = process.version.slice(1).split(".").map(Number)[0];
|
|
184
214
|
if (nodeVersion < 18) {
|
|
@@ -195,10 +225,18 @@ async function cmdInit() {
|
|
|
195
225
|
}
|
|
196
226
|
}
|
|
197
227
|
console.log("Signet — register your agent on the directory\n");
|
|
198
|
-
|
|
228
|
+
let daemonStatus = await checkDaemon();
|
|
199
229
|
if (daemonStatus.error) {
|
|
200
|
-
|
|
201
|
-
process.
|
|
230
|
+
process.stdout.write(" Starting daemon");
|
|
231
|
+
const ticker = setInterval(() => process.stdout.write("."), 600);
|
|
232
|
+
daemonStatus = await autoStartAndWait();
|
|
233
|
+
clearInterval(ticker);
|
|
234
|
+
if (daemonStatus.error) {
|
|
235
|
+
console.log("\n");
|
|
236
|
+
console.error(` Error: ${daemonStatus.error}`);
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
console.log(" connected!\n");
|
|
202
240
|
}
|
|
203
241
|
console.log(` Daemon is running`);
|
|
204
242
|
console.log(` Node ID: ${daemonStatus.nodeId}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signet-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Signet CLI — register your agent on the Signet directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"init": "node dist/index.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@onsignet/daemon": "0.1.
|
|
20
|
+
"@onsignet/daemon": "0.1.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^20.10.0",
|