@ours.network/tg-connector 0.1.6 → 0.1.7

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 CHANGED
@@ -316,6 +316,10 @@ Precedence per field: **env var > `config.json` > default**. The config file is
316
316
  | control port | `OURS_TG_CONTROL_PORT` | `3051` (localhost only) |
317
317
  | state dir | `OURS_TG_STATE_DIR` | `~/.ours-telegram` |
318
318
  | poll timeout | `OURS_TG_POLL_TIMEOUT` | `30` (seconds, Telegram long-poll) |
319
+ | force IPv4 | `OURS_TG_FORCE_IPV4` | `true` (pin Telegram requests to the IPv4 A record via a dedicated undici dispatcher — avoids the intermittent `fetch failed` when IPv6 is configured but unreachable; set `0`/`false` to restore Node default resolution) |
320
+ | connect timeout | `OURS_TG_CONNECT_TIMEOUT_MS` | `10000` (bound a stalled TCP/TLS connect so a bad address fails fast, not after ~30s) |
321
+ | fetch retries | `OURS_TG_FETCH_RETRIES` | `3` (transient-error retries for transactional calls — `sendMessage`/`sendDocument`/`getFile`/download — so one `fetch failed` doesn't drop a message; `getUpdates` runs its own backoff) |
322
+ | retry backoff | `OURS_TG_FETCH_RETRY_BASE_MS` | `300` (base delay between those retries; grows exponentially with jitter) |
319
323
  | attachment cap | `OURS_TG_ATTACHMENT_MAX_BYTES` | `10485760` (10 MB; larger inbound media forwarded as a metadata-only stub) |
320
324
  | outbound file cap | `OURS_TG_OUTBOUND_FILE_MAX_BYTES` | `52428800` (50 MB; a larger file from a contact is skipped + logged — Telegram's `sendDocument` limit) |
321
325
  | STT enabled | `OURS_TG_STT_ENABLED` | `false` (master switch for voice transcription; off ⇒ byte-identical to today) |
@@ -392,6 +396,12 @@ Thank you for helping keep it free, open, and alive.
392
396
 
393
397
  The FSL permits any use **except a Competing Use** — broadly, offering a commercial product or service that substitutes for, or provides substantially the same functionality as, ours.network. Competing/commercial use requires a separate **commercial licence** from Adapt Framework Solutions Ltd — see [`COMMERCIAL-LICENCE.md`](./COMMERCIAL-LICENCE.md) (contact: **license@adaptframework.solutions**).
394
398
 
395
- **Built on Adapt.** ours.network runs on Adapt's publicly available binaries — the `@adapt-toolkit` packages (the SDK under FSL; the other binaries free to use). Adapt's own source code (its C++ core) is not open yet — it will be opened later.
399
+ **Built on Adapt.** ours.network runs on ADAPT, a framework we've spent eight years building. ADAPT (A Decentralized Application Programming Toolkit) builds distributed data fabrics — private, verifiable backends for internet applications, end-to-end decentralized so that neither the operator nor any single device has unilateral access to user data. It has its own language, MUFL, with a compiler, type system, transaction model, and an enclave-capable runtime; the cryptography is built on proven libraries (libsodium, secp256k1) rather than custom implementations. Architecture, language and SDK reference: [docs.adaptframework.solutions](https://docs.adaptframework.solutions).
400
+
401
+ **Not a black box.** Much of the stack is already open and inspectable. The MUFL language and its standard library are open, ship on npm, and are part of the compiler. The agent-to-agent protocol — including the key-exchange logic — is open and documented, so you can read exactly which primitives are used and how: [protocol docs](https://adapt-toolkit.github.io/ours-mufl-core/). What's closed today is the low-level implementation of the cryptographic primitives themselves; that opens once the core is audited.
402
+
403
+ **Security by design, on three layers.** Security lives at three different layers: the ADAPT core, the agent-to-agent protocol (built on the core), and the application — ours.network's MCP server (built on the protocol). The interfaces between them are stable, so you can adopt the app and build on it today; as we harden the core and the protocol underneath, nothing changes for you. You inherit security by design instead of re-implementing it per app.
404
+
405
+ **Audit status.** The core has not yet had an independent security audit. We're raising funding to commission one from a recognized firm and prove these guarantees, and we'll open-source the full core once it passes. Until then it's source-available and documented, but not independently audited — run anything critical on it at your own risk.
396
406
 
397
407
  Copyright 2026 Adapt Framework Solutions Ltd.
package/dist/cli.js CHANGED
@@ -18,6 +18,10 @@ var DEFAULT_CONFIG = {
18
18
  controlPort: 3051,
19
19
  stateDir: resolve(homedir(), ".ours-telegram"),
20
20
  pollTimeoutSec: 30,
21
+ tgForceIpv4: true,
22
+ tgConnectTimeoutMs: 1e4,
23
+ tgFetchRetries: 3,
24
+ tgFetchRetryBaseMs: 300,
21
25
  attachmentMaxBytes: 10 * 1024 * 1024,
22
26
  // 10 MB (encoded ≈ 13.5 MB; under Telegram's 20 MB bot-API download limit)
23
27
  outboundFileMaxBytes: 50 * 1024 * 1024,
@@ -56,6 +60,16 @@ function readFileConfig() {
56
60
  if (typeof parsed.pollTimeoutSec === "number" && Number.isFinite(parsed.pollTimeoutSec)) {
57
61
  out2.pollTimeoutSec = parsed.pollTimeoutSec;
58
62
  }
63
+ if (typeof parsed.tgForceIpv4 === "boolean") out2.tgForceIpv4 = parsed.tgForceIpv4;
64
+ if (typeof parsed.tgConnectTimeoutMs === "number" && Number.isFinite(parsed.tgConnectTimeoutMs)) {
65
+ out2.tgConnectTimeoutMs = parsed.tgConnectTimeoutMs;
66
+ }
67
+ if (typeof parsed.tgFetchRetries === "number" && Number.isFinite(parsed.tgFetchRetries)) {
68
+ out2.tgFetchRetries = parsed.tgFetchRetries;
69
+ }
70
+ if (typeof parsed.tgFetchRetryBaseMs === "number" && Number.isFinite(parsed.tgFetchRetryBaseMs)) {
71
+ out2.tgFetchRetryBaseMs = parsed.tgFetchRetryBaseMs;
72
+ }
59
73
  if (typeof parsed.attachmentMaxBytes === "number" && Number.isFinite(parsed.attachmentMaxBytes)) {
60
74
  out2.attachmentMaxBytes = parsed.attachmentMaxBytes;
61
75
  }
@@ -91,6 +105,10 @@ function loadConfig() {
91
105
  controlPort: envInt("OURS_TG_CONTROL_PORT") ?? file.controlPort ?? DEFAULT_CONFIG.controlPort,
92
106
  stateDir: resolve(process.env.OURS_TG_STATE_DIR ?? file.stateDir ?? DEFAULT_CONFIG.stateDir),
93
107
  pollTimeoutSec: envInt("OURS_TG_POLL_TIMEOUT") ?? file.pollTimeoutSec ?? DEFAULT_CONFIG.pollTimeoutSec,
108
+ tgForceIpv4: envBool("OURS_TG_FORCE_IPV4") ?? file.tgForceIpv4 ?? DEFAULT_CONFIG.tgForceIpv4,
109
+ tgConnectTimeoutMs: envInt("OURS_TG_CONNECT_TIMEOUT_MS") ?? file.tgConnectTimeoutMs ?? DEFAULT_CONFIG.tgConnectTimeoutMs,
110
+ tgFetchRetries: envInt("OURS_TG_FETCH_RETRIES") ?? file.tgFetchRetries ?? DEFAULT_CONFIG.tgFetchRetries,
111
+ tgFetchRetryBaseMs: envInt("OURS_TG_FETCH_RETRY_BASE_MS") ?? file.tgFetchRetryBaseMs ?? DEFAULT_CONFIG.tgFetchRetryBaseMs,
94
112
  attachmentMaxBytes: envInt("OURS_TG_ATTACHMENT_MAX_BYTES") ?? file.attachmentMaxBytes ?? DEFAULT_CONFIG.attachmentMaxBytes,
95
113
  outboundFileMaxBytes: envInt("OURS_TG_OUTBOUND_FILE_MAX_BYTES") ?? file.outboundFileMaxBytes ?? DEFAULT_CONFIG.outboundFileMaxBytes,
96
114
  sttEnabled: envBool("OURS_TG_STT_ENABLED") ?? file.sttEnabled ?? DEFAULT_CONFIG.sttEnabled,