@nordbyte/nordrelay 0.4.1 → 0.5.1

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.
Files changed (57) hide show
  1. package/.env.example +155 -64
  2. package/README.md +81 -65
  3. package/dist/access-control.js +126 -115
  4. package/dist/agent-updates.js +62 -9
  5. package/dist/bot-rendering.js +838 -0
  6. package/dist/bot-ui.js +1 -0
  7. package/dist/bot.js +342 -2498
  8. package/dist/channel-actions.js +8 -8
  9. package/dist/channel-runtime.js +89 -0
  10. package/dist/config-metadata.js +238 -0
  11. package/dist/config.js +0 -58
  12. package/dist/index.js +8 -0
  13. package/dist/operations.js +63 -9
  14. package/dist/relay-artifact-service.js +126 -0
  15. package/dist/relay-external-activity-monitor.js +216 -0
  16. package/dist/relay-queue-service.js +66 -0
  17. package/dist/relay-runtime-types.js +1 -0
  18. package/dist/relay-runtime.js +96 -354
  19. package/dist/settings-service.js +2 -117
  20. package/dist/support-bundle.js +205 -0
  21. package/dist/telegram-access-commands.js +123 -0
  22. package/dist/telegram-access-middleware.js +129 -0
  23. package/dist/telegram-agent-commands.js +212 -0
  24. package/dist/telegram-artifact-commands.js +139 -0
  25. package/dist/telegram-channel-runtime.js +132 -0
  26. package/dist/telegram-command-menu.js +55 -0
  27. package/dist/telegram-command-types.js +1 -0
  28. package/dist/telegram-diagnostics-command.js +102 -0
  29. package/dist/telegram-general-commands.js +52 -0
  30. package/dist/telegram-operational-commands.js +153 -0
  31. package/dist/telegram-output.js +216 -0
  32. package/dist/telegram-preference-commands.js +198 -0
  33. package/dist/telegram-queue-commands.js +278 -0
  34. package/dist/telegram-support-command.js +53 -0
  35. package/dist/telegram-update-commands.js +93 -0
  36. package/dist/user-management.js +708 -0
  37. package/dist/web-api-contract.js +104 -0
  38. package/dist/web-api-types.js +1 -0
  39. package/dist/web-dashboard-access-routes.js +163 -0
  40. package/dist/web-dashboard-artifact-routes.js +65 -0
  41. package/dist/web-dashboard-assets.js +35 -2
  42. package/dist/web-dashboard-http.js +143 -0
  43. package/dist/web-dashboard-pages.js +257 -0
  44. package/dist/web-dashboard-runtime-routes.js +92 -0
  45. package/dist/web-dashboard-session-routes.js +209 -0
  46. package/dist/web-dashboard-ui.js +14 -14
  47. package/dist/web-dashboard.js +330 -707
  48. package/dist/webui-assets/dashboard.css +989 -0
  49. package/dist/webui-assets/dashboard.js +1750 -0
  50. package/dist/zip-writer.js +83 -0
  51. package/package.json +13 -4
  52. package/plugins/nordrelay/.codex-plugin/plugin.json +1 -1
  53. package/plugins/nordrelay/commands/remote.md +1 -1
  54. package/plugins/nordrelay/scripts/nordrelay.mjs +227 -78
  55. package/plugins/nordrelay/skills/telegram-remote/SKILL.md +1 -1
  56. package/dist/web-dashboard-client.js +0 -275
  57. package/dist/web-dashboard-style.js +0 -9
package/.env.example CHANGED
@@ -1,153 +1,244 @@
1
- # Required: bot token from BotFather.
2
- TELEGRAM_BOT_TOKEN=123456789:replace-me
3
-
4
- # Required: comma-separated Telegram user ids that may administer and use the bot.
5
- # A fresh install only accepts messages from these admin user ids.
6
- TELEGRAM_ADMIN_USER_IDS=123456789
7
-
8
- # Optional role controls. Add non-admin operators or read-only users here.
9
- # Admin user ids are automatically allowed and do not need to be repeated.
10
- TELEGRAM_ALLOWED_USER_IDS=
11
- TELEGRAM_READONLY_USER_IDS=
12
- # Optional granular permission policy per role. Permissions: inspect, sessions,
13
- # prompt, files, settings, auth, admin. Admin always keeps admin permission.
14
- TELEGRAM_ROLE_POLICIES_JSON=
15
-
16
- # Backward-compatible alternative for this connector. Private chat ids usually
17
- # match the Telegram user id; group chat ids may be negative.
18
- TELEGRAM_ALLOWED_CHAT_IDS=
1
+ # NordRelay runtime config example.
2
+ # Access is managed with NordRelay users, groups, linked Telegram identities, and enabled Telegram group chats.
3
+ # Create the first admin with `nordrelay init` or `nordrelay user create-admin`.
19
4
 
20
- # Optional explicit override. Keep false for private bots.
21
- TELEGRAM_ALLOW_ANY_CHAT=false
5
+ # Telegram
6
+ # Required Telegram bot and transport settings.
7
+ # BotFather token.
8
+ TELEGRAM_BOT_TOKEN=123456789:replace-me
9
+ # polling or webhook.
10
+ # Options: polling, webhook
11
+ TELEGRAM_TRANSPORT=polling
12
+ # Public base URL for webhook mode.
13
+ TELEGRAM_WEBHOOK_URL=
14
+ # Local webhook bind host.
15
+ TELEGRAM_WEBHOOK_HOST=127.0.0.1
16
+ # Local webhook bind port.
17
+ TELEGRAM_WEBHOOK_PORT=8080
18
+ # Webhook request path.
19
+ TELEGRAM_WEBHOOK_PATH=/telegram/webhook
20
+ # Optional Telegram webhook secret token.
21
+ TELEGRAM_WEBHOOK_SECRET=
22
22
 
23
+ # Agents
23
24
  # Agent access. Codex is enabled by default; Pi, Hermes, OpenClaw, and Claude Code are opt-in.
24
- # Pi requires the `pi` CLI from https://pi.dev/ on the host. Hermes uses
25
- # the Hermes API Server (`hermes gateway` with API_SERVER_ENABLED=true).
26
- # OpenClaw uses the OpenClaw Gateway WebSocket RPC endpoint.
27
- # Claude Code uses the Claude Agent SDK and the host `claude` CLI when present.
25
+ # Allow Codex sessions.
28
26
  NORDRELAY_CODEX_ENABLED=true
27
+ # Allow Pi sessions.
29
28
  NORDRELAY_PI_ENABLED=false
29
+ # Allow Hermes sessions through the Hermes API Server.
30
30
  NORDRELAY_HERMES_ENABLED=false
31
+ # Allow OpenClaw sessions through the OpenClaw Gateway.
31
32
  NORDRELAY_OPENCLAW_ENABLED=false
33
+ # Allow Claude Code sessions through the Claude Agent SDK.
32
34
  NORDRELAY_CLAUDE_CODE_ENABLED=false
35
+ # codex, pi, hermes, openclaw, or claude-code.
36
+ # Options: codex, pi, hermes, openclaw, claude-code
33
37
  NORDRELAY_DEFAULT_AGENT=codex
34
38
 
35
- # Codex defaults for newly created or reattached Telegram sessions.
39
+ # Codex
40
+ # Codex defaults for newly created or reattached sessions.
41
+ # Optional Codex SDK API key.
36
42
  CODEX_API_KEY=
43
+ # Optional explicit Codex executable path.
37
44
  CODEX_CLI_PATH=
45
+ # Force SDK-bundled CLI instead of host CLI.
38
46
  CODEX_USE_BUNDLED_CLI=false
47
+ # Default model for new Codex threads.
39
48
  CODEX_MODEL=
49
+ # Local state sync interval.
40
50
  CODEX_SYNC_INTERVAL_MS=10000
51
+ # External CLI busy polling interval.
52
+ CODEX_EXTERNAL_BUSY_CHECK_MS=5000
53
+ # External CLI stale timeout.
54
+ CODEX_EXTERNAL_BUSY_STALE_MS=300000
55
+ # read-only, workspace-write, or danger-full-access.
56
+ # Options: read-only, workspace-write, danger-full-access
41
57
  CODEX_SANDBOX_MODE=workspace-write
58
+ # never, on-request, on-failure, or untrusted.
59
+ # Options: never, on-request, on-failure, untrusted
42
60
  CODEX_APPROVAL_POLICY=never
43
-
44
- # Optional extra launch profiles for /launch_profiles.
45
- # Example: [{"id":"review","label":"Review","sandboxMode":"workspace-write","approvalPolicy":"on-request"}]
61
+ # Additional launch profile definitions.
46
62
  CODEX_LAUNCH_PROFILES_JSON=
63
+ # Launch profile ID used by default.
47
64
  CODEX_DEFAULT_LAUNCH_PROFILE=default
65
+ # Expose danger-full-access profiles.
48
66
  ENABLE_UNSAFE_LAUNCH_PROFILES=false
49
67
 
50
- # Pi coding agent defaults. PI_DEFAULT_MODEL accepts Pi model patterns such as
51
- # openai-codex/gpt-5.5. PI_DEFAULT_THINKING: off, minimal, low, medium, high, xhigh.
68
+ # Pi
69
+ # Pi coding agent defaults.
70
+ # Optional Pi executable path.
52
71
  PI_CLI_PATH=
72
+ # Optional Pi session directory.
53
73
  PI_SESSION_DIR=
74
+ # Default Pi model slug.
54
75
  PI_DEFAULT_MODEL=
76
+ # off, minimal, low, medium, high, or xhigh.
77
+ # Options: off, minimal, low, medium, high, xhigh
55
78
  PI_DEFAULT_THINKING=medium
79
+ # default, readonly, no-tools, offline, or safe-offline.
80
+ # Options: default, readonly, no-tools, offline, safe-offline
56
81
  PI_DEFAULT_PROFILE=default
57
82
 
58
- # Hermes Agent defaults. HERMES_DEFAULT_REASONING: none, minimal, low,
59
- # medium, high, xhigh. HERMES_API_KEY must match API_SERVER_KEY when the
60
- # Hermes API Server is protected.
83
+ # Hermes
84
+ # Hermes Agent defaults. Hermes uses the Hermes API Server.
85
+ # Optional Hermes executable path.
61
86
  HERMES_CLI_PATH=
87
+ # Optional Hermes home directory. Defaults to ~/.hermes.
62
88
  HERMES_HOME=
89
+ # Optional explicit Hermes state.db path.
63
90
  HERMES_STATE_DB_PATH=
91
+ # Hermes API Server base URL.
64
92
  HERMES_API_BASE_URL=http://127.0.0.1:8642
93
+ # Bearer token for the Hermes API Server.
65
94
  HERMES_API_KEY=
95
+ # Default model label sent to Hermes API runs.
66
96
  HERMES_DEFAULT_MODEL=
97
+ # none, minimal, low, medium, high, or xhigh.
98
+ # Options: none, minimal, low, medium, high, xhigh
67
99
  HERMES_DEFAULT_REASONING=
100
+ # default, safe, readonly, or yolo.
101
+ # Options: default, safe, readonly, yolo
68
102
  HERMES_DEFAULT_PROFILE=default
69
103
 
70
- # OpenClaw Agent defaults. OPENCLAW_DEFAULT_THINKING: off, minimal, low,
71
- # medium, high, xhigh. Gateway token/password are optional unless your
72
- # OpenClaw Gateway requires shared-secret authentication.
104
+ # OpenClaw
105
+ # OpenClaw Agent defaults. OpenClaw uses the OpenClaw Gateway WebSocket RPC endpoint.
106
+ # Optional OpenClaw executable path.
73
107
  OPENCLAW_CLI_PATH=
108
+ # OpenClaw Gateway WebSocket URL.
74
109
  OPENCLAW_GATEWAY_URL=ws://127.0.0.1:18789
110
+ # Shared-secret token for the OpenClaw Gateway.
75
111
  OPENCLAW_GATEWAY_TOKEN=
112
+ # Shared-secret password for the OpenClaw Gateway.
76
113
  OPENCLAW_GATEWAY_PASSWORD=
114
+ # Configured OpenClaw agent id, for example main or work.
77
115
  OPENCLAW_AGENT_ID=main
116
+ # Optional OpenClaw home directory. Defaults to ~/.openclaw.
78
117
  OPENCLAW_HOME=
118
+ # Optional OpenClaw state directory.
79
119
  OPENCLAW_STATE_DIR=
120
+ # Default OpenClaw model id.
80
121
  OPENCLAW_DEFAULT_MODEL=
122
+ # off, minimal, low, medium, high, or xhigh.
123
+ # Options: off, minimal, low, medium, high, xhigh
81
124
  OPENCLAW_DEFAULT_THINKING=
125
+ # default, safe, readonly, local, or deliver.
126
+ # Options: default, safe, readonly, local, deliver
82
127
  OPENCLAW_DEFAULT_PROFILE=default
83
128
 
84
- # Claude Code defaults. CLAUDE_CODE_DEFAULT_EFFORT: off, low, medium, high,
85
- # xhigh. CLAUDE_CODE_CLI_PATH is optional; NordRelay uses `claude` on PATH or
86
- # the Claude Agent SDK bundled runtime.
129
+ # Claude Code
130
+ # Claude Code defaults. NordRelay uses the Claude Agent SDK and the host claude CLI when present.
131
+ # Optional Claude Code executable path. Defaults to claude on PATH or the SDK bundled runtime.
87
132
  CLAUDE_CODE_CLI_PATH=
133
+ # Optional Claude config directory. Defaults to ~/.claude.
88
134
  CLAUDE_CONFIG_DIR=
135
+ # Default Claude Code model alias or model id.
89
136
  CLAUDE_CODE_DEFAULT_MODEL=
137
+ # off, low, medium, high, or xhigh.
138
+ # Options: off, low, medium, high, xhigh
90
139
  CLAUDE_CODE_DEFAULT_EFFORT=
140
+ # default, accept-edits, plan, readonly, no-tools, or bypass-permissions.
141
+ # Options: default, accept-edits, plan, readonly, no-tools, bypass-permissions
91
142
  CLAUDE_CODE_DEFAULT_PROFILE=default
143
+ # Maximum agentic turns for each Claude Code prompt.
92
144
  CLAUDE_CODE_MAX_TURNS=100
93
145
 
94
- # Telegram output controls.
146
+ # Operations
147
+ # Runtime output, logging, update, and Telegram behavior controls.
148
+ # text or json.
149
+ # Options: text, json
95
150
  CONNECTOR_LOG_FORMAT=text
151
+ # all, summary, errors-only, or none.
152
+ # Options: all, summary, errors-only, none
96
153
  TOOL_VERBOSITY=summary
154
+ # Append per-turn token usage.
97
155
  SHOW_TURN_TOKEN_USAGE=false
156
+ # Allow /login and /logout.
98
157
  ENABLE_TELEGRAM_LOGIN=true
158
+ # Send Telegram reactions.
99
159
  ENABLE_TELEGRAM_REACTIONS=false
160
+ # Minimum send interval.
100
161
  TELEGRAM_RATE_LIMIT_MIN_INTERVAL_MS=80
162
+ # Minimum edit interval.
101
163
  TELEGRAM_EDIT_MIN_INTERVAL_MS=1200
102
- TELEGRAM_TRANSPORT=polling
103
- TELEGRAM_WEBHOOK_URL=
104
- TELEGRAM_WEBHOOK_HOST=127.0.0.1
105
- TELEGRAM_WEBHOOK_PORT=8080
106
- TELEGRAM_WEBHOOK_PATH=/telegram/webhook
107
- TELEGRAM_WEBHOOK_SECRET=
164
+ # off, status, final, or full.
165
+ # Options: off, status, final, full
108
166
  TELEGRAM_CLI_MIRROR_MODE=status
167
+ # Minimum mirrored edit interval.
109
168
  TELEGRAM_CLI_MIRROR_MIN_UPDATE_MS=4000
169
+ # off, minimal, or all.
170
+ # Options: off, minimal, all
110
171
  TELEGRAM_NOTIFY_MODE=minimal
172
+ # HH-HH or blank.
111
173
  TELEGRAM_QUIET_HOURS=
174
+ # Additional comma-separated regex patterns.
112
175
  TELEGRAM_REDACT_PATTERNS=
176
+ # auto, npm, or git.
177
+ # Options: auto, npm, git
178
+ NORDRELAY_UPDATE_METHOD=
179
+
180
+ # Artifacts
181
+ # File, artifact, and retention controls.
182
+ # Max inbound/outbound file size.
113
183
  MAX_FILE_SIZE=20971520
184
+ # Days before pruning.
114
185
  ARTIFACT_RETENTION_DAYS=7
186
+ # Maximum artifact turns retained.
115
187
  ARTIFACT_MAX_TURNS=30
188
+ # Maximum inbox dirs retained.
116
189
  ARTIFACT_MAX_INBOX_DIRS=30
190
+ # Extra ignored dirs or relative paths.
117
191
  ARTIFACT_IGNORE_DIRS=
192
+ # Extra ignored glob patterns.
118
193
  ARTIFACT_IGNORE_GLOBS=
194
+ # Automatically send artifact files.
119
195
  TELEGRAM_AUTO_SEND_ARTIFACTS=false
120
196
 
121
- # State and team controls. Use sqlite for a single-file state database when
122
- # better-sqlite3 is available; json keeps separate human-readable files.
197
+ # Workspace
198
+ # State and workspace guardrails.
199
+ # Restrict selectable workspaces.
200
+ WORKSPACE_ALLOWED_ROOTS=
201
+ # Warn for broad workspace roots.
202
+ WORKSPACE_WARN_ROOTS=
203
+ # json or sqlite.
204
+ # Options: json, sqlite
123
205
  NORDRELAY_STATE_BACKEND=json
206
+ # Retained audit events.
124
207
  NORDRELAY_AUDIT_MAX_EVENTS=1000
208
+ # Write-lock TTL.
125
209
  NORDRELAY_SESSION_LOCK_TTL_MS=1800000
210
+ # NPM version cache TTL.
126
211
  NORDRELAY_VERSION_CACHE_TTL_MS=3600000
127
212
 
128
- # Local WebUI dashboard. Binding to 0.0.0.0 requires either token auth or
129
- # basic auth; startup fails without one of these credentials.
130
- NORDRELAY_DASHBOARD_HOST=127.0.0.1
131
- NORDRELAY_DASHBOARD_PORT=31878
132
- NORDRELAY_DASHBOARD_TOKEN=
133
- NORDRELAY_DASHBOARD_USER=
134
- NORDRELAY_DASHBOARD_PASSWORD=
135
- NORDRELAY_ENV_FILE=
136
-
137
- # Optional workspace guardrails. Leave WORKSPACE_ALLOWED_ROOTS empty to allow
138
- # all workspaces discovered from enabled agent state.
139
- WORKSPACE_ALLOWED_ROOTS=
140
- WORKSPACE_WARN_ROOTS=
141
-
142
- # Optional voice transcription fallback. Local parakeet-coreml is used first
143
- # when installed; OpenAI Whisper is used when OPENAI_API_KEY is set.
213
+ # Voice
214
+ # Optional voice transcription settings.
215
+ # Whisper fallback API key.
144
216
  OPENAI_API_KEY=
217
+ # auto, parakeet, faster-whisper, or openai.
218
+ # Options: auto, parakeet, faster-whisper, openai
145
219
  VOICE_PREFERRED_BACKEND=auto
220
+ # Default transcription language.
146
221
  VOICE_DEFAULT_LANGUAGE=
222
+ # Do not send voice transcripts as prompts.
147
223
  VOICE_TRANSCRIBE_ONLY=false
224
+ # Python executable.
148
225
  FASTER_WHISPER_PYTHON=.venv/bin/python
226
+ # Model name.
149
227
  FASTER_WHISPER_MODEL=base
228
+ # cpu, cuda, etc.
150
229
  FASTER_WHISPER_DEVICE=cpu
230
+ # int8, float16, etc.
151
231
  FASTER_WHISPER_COMPUTE_TYPE=int8
232
+ # Fixed transcription language.
152
233
  FASTER_WHISPER_LANGUAGE=
234
+ # Transcription timeout.
153
235
  FASTER_WHISPER_TIMEOUT_MS=600000
236
+
237
+ # Dashboard
238
+ # Local WebUI dashboard. User login is required for every page, API route, SSE stream, artifact download, and health endpoint.
239
+ # WebUI bind host.
240
+ NORDRELAY_DASHBOARD_HOST=127.0.0.1
241
+ # WebUI bind port.
242
+ NORDRELAY_DASHBOARD_PORT=31878
243
+ # Optional explicit env-file path used by the CLI wrapper and dashboard.
244
+ NORDRELAY_ENV_FILE=