@nordbyte/nordrelay 0.2.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 (45) hide show
  1. package/.env.example +88 -0
  2. package/Dockerfile +19 -0
  3. package/LICENSE +21 -0
  4. package/README.md +749 -0
  5. package/dist/access-control.js +146 -0
  6. package/dist/agent-factory.js +22 -0
  7. package/dist/agent.js +57 -0
  8. package/dist/artifacts.js +515 -0
  9. package/dist/attachments.js +69 -0
  10. package/dist/bot-preferences.js +146 -0
  11. package/dist/bot-ui.js +161 -0
  12. package/dist/bot.js +4520 -0
  13. package/dist/codex-auth.js +150 -0
  14. package/dist/codex-cli.js +79 -0
  15. package/dist/codex-config.js +50 -0
  16. package/dist/codex-launch.js +109 -0
  17. package/dist/codex-session.js +591 -0
  18. package/dist/codex-state.js +573 -0
  19. package/dist/config.js +385 -0
  20. package/dist/context-key.js +23 -0
  21. package/dist/error-messages.js +73 -0
  22. package/dist/format.js +121 -0
  23. package/dist/index.js +140 -0
  24. package/dist/logger.js +27 -0
  25. package/dist/operations.js +133 -0
  26. package/dist/persistence.js +65 -0
  27. package/dist/pi-cli.js +19 -0
  28. package/dist/pi-rpc.js +158 -0
  29. package/dist/pi-session.js +573 -0
  30. package/dist/pi-state.js +226 -0
  31. package/dist/prompt-store.js +241 -0
  32. package/dist/redaction.js +47 -0
  33. package/dist/session-format.js +191 -0
  34. package/dist/session-registry.js +195 -0
  35. package/dist/telegram-rate-limit.js +136 -0
  36. package/dist/voice.js +373 -0
  37. package/dist/workspace-policy.js +41 -0
  38. package/docker-compose.yml +17 -0
  39. package/launchd/start.sh +8 -0
  40. package/package.json +69 -0
  41. package/plugins/nordrelay/.codex-plugin/plugin.json +48 -0
  42. package/plugins/nordrelay/assets/nordrelay.svg +5 -0
  43. package/plugins/nordrelay/commands/remote.md +33 -0
  44. package/plugins/nordrelay/scripts/nordrelay.mjs +396 -0
  45. package/plugins/nordrelay/skills/telegram-remote/SKILL.md +26 -0
package/.env.example ADDED
@@ -0,0 +1,88 @@
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=
19
+
20
+ # Optional explicit override. Keep false for private bots.
21
+ TELEGRAM_ALLOW_ANY_CHAT=false
22
+
23
+ # Agent access. Codex is enabled by default; Pi is opt-in and requires the
24
+ # `pi` CLI from https://pi.dev/ on the host.
25
+ NORDRELAY_CODEX_ENABLED=true
26
+ NORDRELAY_PI_ENABLED=false
27
+ NORDRELAY_DEFAULT_AGENT=codex
28
+
29
+ # Codex defaults for newly created or reattached Telegram sessions.
30
+ CODEX_API_KEY=
31
+ CODEX_CLI_PATH=
32
+ CODEX_USE_BUNDLED_CLI=false
33
+ CODEX_MODEL=
34
+ CODEX_SYNC_INTERVAL_MS=10000
35
+ CODEX_SANDBOX_MODE=workspace-write
36
+ CODEX_APPROVAL_POLICY=never
37
+
38
+ # Optional extra launch profiles for /launch_profiles.
39
+ # Example: [{"id":"review","label":"Review","sandboxMode":"workspace-write","approvalPolicy":"on-request"}]
40
+ CODEX_LAUNCH_PROFILES_JSON=
41
+ CODEX_DEFAULT_LAUNCH_PROFILE=default
42
+ ENABLE_UNSAFE_LAUNCH_PROFILES=false
43
+
44
+ # Pi coding agent defaults. PI_DEFAULT_MODEL accepts Pi model patterns such as
45
+ # openai-codex/gpt-5.5. PI_DEFAULT_THINKING: off, minimal, low, medium, high, xhigh.
46
+ PI_CLI_PATH=
47
+ PI_SESSION_DIR=
48
+ PI_DEFAULT_MODEL=
49
+ PI_DEFAULT_THINKING=medium
50
+
51
+ # Telegram output controls.
52
+ CONNECTOR_LOG_FORMAT=text
53
+ TOOL_VERBOSITY=summary
54
+ SHOW_TURN_TOKEN_USAGE=false
55
+ ENABLE_TELEGRAM_LOGIN=true
56
+ ENABLE_TELEGRAM_REACTIONS=false
57
+ TELEGRAM_RATE_LIMIT_MIN_INTERVAL_MS=80
58
+ TELEGRAM_EDIT_MIN_INTERVAL_MS=1200
59
+ TELEGRAM_CLI_MIRROR_MODE=status
60
+ TELEGRAM_CLI_MIRROR_MIN_UPDATE_MS=4000
61
+ TELEGRAM_NOTIFY_MODE=minimal
62
+ TELEGRAM_QUIET_HOURS=
63
+ TELEGRAM_REDACT_PATTERNS=
64
+ MAX_FILE_SIZE=20971520
65
+ ARTIFACT_RETENTION_DAYS=7
66
+ ARTIFACT_MAX_TURNS=30
67
+ ARTIFACT_MAX_INBOX_DIRS=30
68
+ ARTIFACT_IGNORE_DIRS=
69
+ ARTIFACT_IGNORE_GLOBS=
70
+ TELEGRAM_AUTO_SEND_ARTIFACTS=false
71
+
72
+ # Optional workspace guardrails. Leave WORKSPACE_ALLOWED_ROOTS empty to allow
73
+ # all workspaces discovered from enabled agent state.
74
+ WORKSPACE_ALLOWED_ROOTS=
75
+ WORKSPACE_WARN_ROOTS=
76
+
77
+ # Optional voice transcription fallback. Local parakeet-coreml is used first
78
+ # when installed; OpenAI Whisper is used when OPENAI_API_KEY is set.
79
+ OPENAI_API_KEY=
80
+ VOICE_PREFERRED_BACKEND=auto
81
+ VOICE_DEFAULT_LANGUAGE=
82
+ VOICE_TRANSCRIBE_ONLY=false
83
+ FASTER_WHISPER_PYTHON=.venv/bin/python
84
+ FASTER_WHISPER_MODEL=base
85
+ FASTER_WHISPER_DEVICE=cpu
86
+ FASTER_WHISPER_COMPUTE_TYPE=int8
87
+ FASTER_WHISPER_LANGUAGE=
88
+ FASTER_WHISPER_TIMEOUT_MS=600000
package/Dockerfile ADDED
@@ -0,0 +1,19 @@
1
+ FROM node:22-alpine
2
+
3
+ RUN apk add --no-cache git bash
4
+
5
+ WORKDIR /app
6
+
7
+ COPY package.json package-lock.json* ./
8
+ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
9
+
10
+ COPY . .
11
+ RUN npm run build
12
+
13
+ RUN adduser -D -u 1001 nordrelay \
14
+ && mkdir -p /workspace /home/nordrelay/.codex \
15
+ && chown -R nordrelay:nordrelay /workspace /home/nordrelay
16
+
17
+ USER nordrelay
18
+
19
+ CMD ["node", "dist/index.js"]
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ricardo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.