@decentnetwork/lan 0.1.98 → 0.1.99
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/tun-helper-darwin-amd64 +0 -0
- package/bin/tun-helper-darwin-arm64 +0 -0
- package/bin/tun-helper-linux-amd64 +0 -0
- package/bin/tun-helper-linux-arm64 +0 -0
- package/dist/carrier/peer-manager.d.ts +11 -0
- package/dist/carrier/peer-manager.js +13 -0
- package/dist/cli/commands.d.ts +10 -0
- package/dist/cli/commands.js +12 -0
- package/dist/cli/index.js +4 -1
- package/dist/console/console.js +1011 -0
- package/dist/daemon/ipc.d.ts +8 -1
- package/dist/daemon/ipc.js +4 -0
- package/dist/daemon/server.js +14 -1
- package/dist/types.d.ts +2 -0
- package/dist/ui/desktop/app.js +32 -6
- package/dist/ui/server.js +9 -1
- package/package.json +7 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -16,6 +16,8 @@ export interface PeerManagerOptions {
|
|
|
16
16
|
/** Display name advertised to friends (this node's name, so friend lists show
|
|
17
17
|
* "cn"/"tokyo"/"mac-dev" instead of the generic "@decentnetwork/peer"). */
|
|
18
18
|
nickname?: string;
|
|
19
|
+
/** Status-message / short bio advertised to friends (Carrier USERINFO descr). */
|
|
20
|
+
statusMessage?: string;
|
|
19
21
|
}
|
|
20
22
|
export declare class PeerManager extends EventEmitter {
|
|
21
23
|
private peer;
|
|
@@ -42,6 +44,15 @@ export declare class PeerManager extends EventEmitter {
|
|
|
42
44
|
* removed, false if no such friend existed.
|
|
43
45
|
*/
|
|
44
46
|
removeFriend(userid: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Update our own profile (display name + status-message description) at
|
|
49
|
+
* runtime and re-push it to friends over Carrier. The daemon also persists
|
|
50
|
+
* the name to config.yaml so it survives a restart.
|
|
51
|
+
*/
|
|
52
|
+
setUserInfo(info: {
|
|
53
|
+
name?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
}): void;
|
|
45
56
|
/**
|
|
46
57
|
* Send an outbound friend request to a Carrier address (NOT a bare
|
|
47
58
|
* userid — sendFriendRequest needs the address form because it
|
|
@@ -27,6 +27,7 @@ export class PeerManager extends EventEmitter {
|
|
|
27
27
|
expressNodes: opts.expressNodes,
|
|
28
28
|
expressControlPlaneOnly: opts.expressControlPlaneOnly,
|
|
29
29
|
nickname: opts.nickname,
|
|
30
|
+
statusMessage: opts.statusMessage,
|
|
30
31
|
// Register our IP channel (163) as the SDK's bulk-data stream so it
|
|
31
32
|
// rides a single transport instead of fanning out over UDP + relay +
|
|
32
33
|
// TCP relay (which delivered 3-4 duplicates of every IP packet).
|
|
@@ -93,6 +94,18 @@ export class PeerManager extends EventEmitter {
|
|
|
93
94
|
this.logger.info(`Removed friend ${userid}`);
|
|
94
95
|
return removed;
|
|
95
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Update our own profile (display name + status-message description) at
|
|
99
|
+
* runtime and re-push it to friends over Carrier. The daemon also persists
|
|
100
|
+
* the name to config.yaml so it survives a restart.
|
|
101
|
+
*/
|
|
102
|
+
setUserInfo(info) {
|
|
103
|
+
if (!this.peer) {
|
|
104
|
+
throw new Error("Peer not created. Call create() first.");
|
|
105
|
+
}
|
|
106
|
+
this.peer.setUserInfo(info);
|
|
107
|
+
this.logger.info(`Profile updated (name="${info.name ?? "(unchanged)"}")`);
|
|
108
|
+
}
|
|
96
109
|
/**
|
|
97
110
|
* Send an outbound friend request to a Carrier address (NOT a bare
|
|
98
111
|
* userid — sendFriendRequest needs the address form because it
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -263,6 +263,16 @@ export declare function cmdChatHistory(args: {
|
|
|
263
263
|
peer?: string;
|
|
264
264
|
configDir?: string;
|
|
265
265
|
}): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Launch the interactive terminal UI (TUI). The console is an ink (React-for-CLI)
|
|
268
|
+
* app built separately by esbuild into dist/console/console.js — the .tsx is
|
|
269
|
+
* excluded from the main tsc build, so we import the built bundle at runtime.
|
|
270
|
+
* The specifier is held in a variable so tsc treats it as a dynamic import and
|
|
271
|
+
* doesn't try to resolve the (non-existent) .ts source.
|
|
272
|
+
*/
|
|
273
|
+
export declare function cmdConsole(args: {
|
|
274
|
+
configDir?: string;
|
|
275
|
+
}): Promise<void>;
|
|
266
276
|
export declare function cmdUi(args: {
|
|
267
277
|
port?: number;
|
|
268
278
|
listen?: string;
|
package/dist/cli/commands.js
CHANGED
|
@@ -1108,6 +1108,18 @@ export async function cmdChatHistory(args) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Launch the interactive terminal UI (TUI). The console is an ink (React-for-CLI)
|
|
1113
|
+
* app built separately by esbuild into dist/console/console.js — the .tsx is
|
|
1114
|
+
* excluded from the main tsc build, so we import the built bundle at runtime.
|
|
1115
|
+
* The specifier is held in a variable so tsc treats it as a dynamic import and
|
|
1116
|
+
* doesn't try to resolve the (non-existent) .ts source.
|
|
1117
|
+
*/
|
|
1118
|
+
export async function cmdConsole(args) {
|
|
1119
|
+
const spec = "../console/console.js";
|
|
1120
|
+
const mod = (await import(spec));
|
|
1121
|
+
await mod.runConsole({ configDir: args.configDir });
|
|
1122
|
+
}
|
|
1111
1123
|
export async function cmdUi(args) {
|
|
1112
1124
|
const dir = args.configDir || ConfigLoader.defaultConfigDir();
|
|
1113
1125
|
const config = await ConfigLoader.load(resolve(dir, "config.yaml"));
|
package/dist/cli/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
10
10
|
// Belt-and-braces — also raise it here in case the CLI is run directly
|
|
11
11
|
// (e.g. `node dist/cli/index.js` rather than via dist/index.js).
|
|
12
12
|
EventEmitter.defaultMaxListeners = 100;
|
|
13
|
-
import { cmdInit, cmdIdentityShow, cmdPeersList, cmdIpamAssign, cmdGrant, cmdRevoke, cmdResolve, cmdStatus, cmdUp, cmdAuditLog, cmdFriendRequest, cmdFriendAccept, cmdFriendsList, cmdFriendsPending, cmdFriendsAccept, cmdFriendsReject, cmdProxyEnable, cmdProxyDisable, cmdProxyStatus, cmdProxyAllowHost, cmdProxyRevokeHost, cmdProxyListHosts, cmdProxyUse, cmdProxyRouter, cmdDoraEnable, cmdDoraDisable, cmdDoraStatus, cmdDoraAutofriend, cmdDiag, cmdDoctor, cmdDnsInstall, cmdDnsHosts, cmdServiceInstall, cmdRestart, cmdServiceStatus, cmdServiceRestart, cmdUi, cmdChatSend, cmdChatHistory, cmdFriendRemove, cmdFriendAlias, } from "./commands.js";
|
|
13
|
+
import { cmdInit, cmdIdentityShow, cmdPeersList, cmdIpamAssign, cmdGrant, cmdRevoke, cmdResolve, cmdStatus, cmdUp, cmdAuditLog, cmdFriendRequest, cmdFriendAccept, cmdFriendsList, cmdFriendsPending, cmdFriendsAccept, cmdFriendsReject, cmdProxyEnable, cmdProxyDisable, cmdProxyStatus, cmdProxyAllowHost, cmdProxyRevokeHost, cmdProxyListHosts, cmdProxyUse, cmdProxyRouter, cmdDoraEnable, cmdDoraDisable, cmdDoraStatus, cmdDoraAutofriend, cmdDiag, cmdDoctor, cmdDnsInstall, cmdDnsHosts, cmdServiceInstall, cmdRestart, cmdServiceStatus, cmdServiceRestart, cmdUi, cmdConsole, cmdChatSend, cmdChatHistory, cmdFriendRemove, cmdFriendAlias, } from "./commands.js";
|
|
14
14
|
async function main() {
|
|
15
15
|
await yargs(hideBin(process.argv))
|
|
16
16
|
.scriptName("agentnet")
|
|
@@ -152,6 +152,9 @@ async function main() {
|
|
|
152
152
|
.option("dora-dir", { type: "string", describe: "If this node runs a dora server, its data-dir (to show allocations)" })
|
|
153
153
|
.option("config-dir", { type: "string" }), async (argv) => {
|
|
154
154
|
await cmdUi({ port: argv.port, listen: argv.host ?? argv.listen, doraDir: argv["dora-dir"], configDir: argv["config-dir"] });
|
|
155
|
+
})
|
|
156
|
+
.command("console", "Interactive terminal UI (TUI) — friends list + chat, keyboard-driven (q to quit)", (y) => y.option("config-dir", { type: "string" }), async (argv) => {
|
|
157
|
+
await cmdConsole({ configDir: argv["config-dir"] });
|
|
155
158
|
})
|
|
156
159
|
// Tell the running daemon to re-exec itself with its original argv.
|
|
157
160
|
// The daemon inherits its own uid (root if it was launched as root)
|