@neuraiproject/neurai-depin-terminal 1.0.0 → 2.0.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/README.md +37 -8
- package/dist/index.cjs +143 -184
- package/package.json +12 -12
- package/src/config/ConfigManager.js +43 -26
- package/src/constants.js +18 -5
- package/src/domain/messageTypes.js +26 -0
- package/src/errors.js +17 -0
- package/src/index.js +129 -30
- package/src/messaging/MessagePoller.js +132 -3
- package/src/messaging/MessageSender.js +99 -41
- package/src/messaging/MessageStore.js +26 -0
- package/src/messaging/RecipientDirectory.js +186 -0
- package/src/ui/CharsmUI.js +690 -0
- package/src/ui/RecipientSelector.js +114 -0
- package/src/ui/TabManager.js +162 -0
- package/src/ui/render.js +173 -0
- package/src/utils.js +304 -43
- package/src/wallet/WalletManager.js +5 -6
- package/src/ui/TerminalUI.js +0 -272
- package/src/ui/components/ErrorOverlay.js +0 -99
- package/src/ui/components/InputBox.js +0 -63
- package/src/ui/components/MessageBox.js +0 -51
- package/src/ui/components/StatusBar.js +0 -32
- package/src/ui/components/TopBar.js +0 -63
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Terminal client for Neurai DePIN messaging with full-screen interface.
|
|
4
4
|
|
|
5
|
+
<div align="center"><img src="img/terminal-chat.png" alt="Terminal Chat"></div>
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
|
-
- ✅ Full-screen terminal interface with
|
|
9
|
+
- ✅ Full-screen terminal interface with charsm
|
|
8
10
|
- ✅ Simple configuration via `config.json`
|
|
9
11
|
- ✅ **Encrypted private key storage** with AES-256-GCM encryption
|
|
10
12
|
- ✅ Automatic broadcast to all token holders
|
|
@@ -47,6 +49,8 @@ When you run the application for the first time, an interactive wizard will star
|
|
|
47
49
|
npm start
|
|
48
50
|
```
|
|
49
51
|
|
|
52
|
+
<div align="center"><img src="img/start-terminal.png" alt="Terminal Chat"></div>
|
|
53
|
+
|
|
50
54
|
The wizard will ask you for:
|
|
51
55
|
|
|
52
56
|
1. **RPC Server**: DePIN RPC server URL (required)
|
|
@@ -106,7 +110,7 @@ The application will display a full-screen interface with:
|
|
|
106
110
|
```
|
|
107
111
|
┌────────────────────────────────────────────────────────────┐
|
|
108
112
|
│ Neurai DePIN | RPC: localhost:19001 | ● Connected │
|
|
109
|
-
│ Token: MYTOKEN | NXXXabc...xyz | Last
|
|
113
|
+
│ Token: MYTOKEN | NXXXabc...xyz | Last check: 10:23:45 │
|
|
110
114
|
├────────────────────────────────────────────────────────────┤
|
|
111
115
|
│ │
|
|
112
116
|
│ [10:20:15] NXXXdef...123: Hello world │
|
|
@@ -115,29 +119,53 @@ The application will display a full-screen interface with:
|
|
|
115
119
|
│ │
|
|
116
120
|
│ │
|
|
117
121
|
├────────────────────────────────────────────────────────────┤
|
|
118
|
-
│ > Type message... (Enter: Send |
|
|
122
|
+
│ > Type message... (Enter: Send | Esc: Quit) │
|
|
119
123
|
└────────────────────────────────────────────────────────────┘
|
|
120
124
|
```
|
|
121
125
|
|
|
126
|
+
<div align="center"><img src="img/terminal-chat.png" alt="Terminal Chat"></div>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<div align="center"><img src="img/web-wallet.png" alt="Terminal Chat"></div>
|
|
130
|
+
|
|
131
|
+
|
|
122
132
|
**Components:**
|
|
123
133
|
|
|
124
|
-
- **Top bar**: Shows RPC connection status, configured token, address and last
|
|
134
|
+
- **Top bar**: Shows RPC connection status, configured token, address and last check time
|
|
125
135
|
- **Message area**: Shows received and sent messages (scrollable with arrow keys)
|
|
126
136
|
- **Input area**: Type your message here
|
|
127
137
|
|
|
128
138
|
### Keyboard Shortcuts
|
|
129
139
|
|
|
130
140
|
- **Enter** or **Ctrl+S**: Send message
|
|
131
|
-
- **
|
|
141
|
+
- **Escape** or **Ctrl+C**: Exit application
|
|
132
142
|
- **Up/Down arrows**: Scroll in message area
|
|
143
|
+
- **Ctrl+Left / Ctrl+Right**: Switch tabs
|
|
144
|
+
- **Ctrl+W**: Close active private tab
|
|
145
|
+
|
|
146
|
+
### Private Messages
|
|
147
|
+
|
|
148
|
+
Send a private message by starting the line with `@` and the destination address:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
@NxxxRecipientAddress Hello, this is a private message.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Messages without the `@address` prefix are sent as group/broadcast messages.
|
|
155
|
+
Typing `@` at the start opens a recipient list you can navigate with arrow keys and select with Enter (Esc to close).
|
|
156
|
+
The recipient list is cached and refreshed every 60 seconds to keep selection fast.
|
|
157
|
+
Private conversations appear as tabs named after the sender (e.g. `abc...xyz`). New private messages are marked with an asterisk.
|
|
158
|
+
The Group tab always shows only group messages.
|
|
159
|
+
Sending a private message opens its tab automatically.
|
|
133
160
|
|
|
134
161
|
## How It Works
|
|
135
162
|
|
|
136
163
|
1. **Startup**: Application loads configuration and connects to RPC server
|
|
137
164
|
2. **Polling**: Every 10 seconds (configurable) checks for new messages in the DePIN pool
|
|
138
165
|
3. **Reception**: Messages are automatically decrypted and displayed on screen
|
|
139
|
-
4. **Sending**:
|
|
140
|
-
5. **
|
|
166
|
+
4. **Sending**: Messages without a prefix are sent to **all token holders with a revealed pubkey** (broadcast). To send a private message, use `@address message`.
|
|
167
|
+
5. **Recipients**: Eligible recipients are fetched via `listdepinaddresses` and cached locally (refreshed every 60 seconds)
|
|
168
|
+
6. **Privacy**: If the server has a privacy layer configured (`depinpoolpkey`), messages are additionally encrypted
|
|
141
169
|
|
|
142
170
|
## Architecture
|
|
143
171
|
|
|
@@ -153,7 +181,7 @@ src/
|
|
|
153
181
|
│ ├── MessagePoller.js # Automatic polling
|
|
154
182
|
│ └── MessageSender.js # Broadcast sending
|
|
155
183
|
├── ui/
|
|
156
|
-
│ └──
|
|
184
|
+
│ └── CharsmUI.js # Charsm interface
|
|
157
185
|
└── lib/
|
|
158
186
|
└── depinMsgLoader.js # IIFE bundle loader
|
|
159
187
|
```
|
|
@@ -177,6 +205,7 @@ Verify that:
|
|
|
177
205
|
- Your address owns the configured DePIN token
|
|
178
206
|
- Other token holders exist with revealed public keys
|
|
179
207
|
- The RPC server supports DePIN methods (`depinreceivemsg`, `depinsubmitmsg`)
|
|
208
|
+
- The RPC server supports `listdepinaddresses` for recipient discovery
|
|
180
209
|
|
|
181
210
|
### Error: "No recipients found with revealed public key"
|
|
182
211
|
|