@neuraiproject/neurai-depin-terminal 1.0.1 → 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 +27 -8
- package/dist/index.cjs +143 -188
- package/package.json +11 -10
- 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/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
|
@@ -6,7 +6,7 @@ Terminal client for Neurai DePIN messaging with full-screen interface.
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- ✅ Full-screen terminal interface with
|
|
9
|
+
- ✅ Full-screen terminal interface with charsm
|
|
10
10
|
- ✅ Simple configuration via `config.json`
|
|
11
11
|
- ✅ **Encrypted private key storage** with AES-256-GCM encryption
|
|
12
12
|
- ✅ Automatic broadcast to all token holders
|
|
@@ -110,7 +110,7 @@ The application will display a full-screen interface with:
|
|
|
110
110
|
```
|
|
111
111
|
┌────────────────────────────────────────────────────────────┐
|
|
112
112
|
│ Neurai DePIN | RPC: localhost:19001 | ● Connected │
|
|
113
|
-
│ Token: MYTOKEN | NXXXabc...xyz | Last
|
|
113
|
+
│ Token: MYTOKEN | NXXXabc...xyz | Last check: 10:23:45 │
|
|
114
114
|
├────────────────────────────────────────────────────────────┤
|
|
115
115
|
│ │
|
|
116
116
|
│ [10:20:15] NXXXdef...123: Hello world │
|
|
@@ -119,7 +119,7 @@ The application will display a full-screen interface with:
|
|
|
119
119
|
│ │
|
|
120
120
|
│ │
|
|
121
121
|
├────────────────────────────────────────────────────────────┤
|
|
122
|
-
│ > Type message... (Enter: Send |
|
|
122
|
+
│ > Type message... (Enter: Send | Esc: Quit) │
|
|
123
123
|
└────────────────────────────────────────────────────────────┘
|
|
124
124
|
```
|
|
125
125
|
|
|
@@ -131,23 +131,41 @@ The application will display a full-screen interface with:
|
|
|
131
131
|
|
|
132
132
|
**Components:**
|
|
133
133
|
|
|
134
|
-
- **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
|
|
135
135
|
- **Message area**: Shows received and sent messages (scrollable with arrow keys)
|
|
136
136
|
- **Input area**: Type your message here
|
|
137
137
|
|
|
138
138
|
### Keyboard Shortcuts
|
|
139
139
|
|
|
140
140
|
- **Enter** or **Ctrl+S**: Send message
|
|
141
|
-
- **
|
|
141
|
+
- **Escape** or **Ctrl+C**: Exit application
|
|
142
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.
|
|
143
160
|
|
|
144
161
|
## How It Works
|
|
145
162
|
|
|
146
163
|
1. **Startup**: Application loads configuration and connects to RPC server
|
|
147
164
|
2. **Polling**: Every 10 seconds (configurable) checks for new messages in the DePIN pool
|
|
148
165
|
3. **Reception**: Messages are automatically decrypted and displayed on screen
|
|
149
|
-
4. **Sending**:
|
|
150
|
-
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
|
|
151
169
|
|
|
152
170
|
## Architecture
|
|
153
171
|
|
|
@@ -163,7 +181,7 @@ src/
|
|
|
163
181
|
│ ├── MessagePoller.js # Automatic polling
|
|
164
182
|
│ └── MessageSender.js # Broadcast sending
|
|
165
183
|
├── ui/
|
|
166
|
-
│ └──
|
|
184
|
+
│ └── CharsmUI.js # Charsm interface
|
|
167
185
|
└── lib/
|
|
168
186
|
└── depinMsgLoader.js # IIFE bundle loader
|
|
169
187
|
```
|
|
@@ -187,6 +205,7 @@ Verify that:
|
|
|
187
205
|
- Your address owns the configured DePIN token
|
|
188
206
|
- Other token holders exist with revealed public keys
|
|
189
207
|
- The RPC server supports DePIN methods (`depinreceivemsg`, `depinsubmitmsg`)
|
|
208
|
+
- The RPC server supports `listdepinaddresses` for recipient discovery
|
|
190
209
|
|
|
191
210
|
### Error: "No recipients found with revealed public key"
|
|
192
211
|
|