@ours.network/tg-connector 0.1.5 → 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
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
# ours-tg-connector —
|
|
1
|
+
# ours-tg-connector — put your AI agents in Telegram
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
**Let people talk to your agents from a Telegram chat, group, or forum topic —
|
|
4
|
+
and let your agents reply, send files, even understand voice notes.** One
|
|
5
|
+
Telegram bot can proxy **many chats at once — each chat (or forum topic) wired to
|
|
6
|
+
its own agent** over an end-to-end-encrypted channel, all on a single shared poll
|
|
7
|
+
loop.
|
|
6
8
|
|
|
7
9
|
```
|
|
8
10
|
┌──────── one bot token ────────┐
|
|
@@ -314,6 +316,10 @@ Precedence per field: **env var > `config.json` > default**. The config file is
|
|
|
314
316
|
| control port | `OURS_TG_CONTROL_PORT` | `3051` (localhost only) |
|
|
315
317
|
| state dir | `OURS_TG_STATE_DIR` | `~/.ours-telegram` |
|
|
316
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) |
|
|
317
323
|
| attachment cap | `OURS_TG_ATTACHMENT_MAX_BYTES` | `10485760` (10 MB; larger inbound media forwarded as a metadata-only stub) |
|
|
318
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) |
|
|
319
325
|
| STT enabled | `OURS_TG_STT_ENABLED` | `false` (master switch for voice transcription; off ⇒ byte-identical to today) |
|
|
@@ -360,10 +366,13 @@ Once bound, the messenger can pull the manifest, render the config form, and pus
|
|
|
360
366
|
changes (`get_manifest` / `get_config` / `set_config`). Config verbs are gated:
|
|
361
367
|
only the bound control plane may read or write the configuration.
|
|
362
368
|
|
|
363
|
-
##
|
|
369
|
+
## Learn more
|
|
364
370
|
|
|
365
|
-
-
|
|
366
|
-
|
|
371
|
+
- **How it works — the protocol, in depth:** the shared agent-to-agent core and
|
|
372
|
+
wire format is documented in
|
|
373
|
+
**[ours-mufl-core](https://github.com/adapt-toolkit/ours-mufl-core)**.
|
|
374
|
+
- **The whole project:** [ours.network](https://ours.network) ·
|
|
375
|
+
[umbrella repo](https://github.com/adapt-toolkit/ours-network)
|
|
367
376
|
|
|
368
377
|
## Support ours.network
|
|
369
378
|
|
|
@@ -371,6 +380,8 @@ ours.network is built by a small, independent team who believe agents — and th
|
|
|
371
380
|
|
|
372
381
|
We're at the alpha stage: we have a clear roadmap and, if this stage proves itself, proper funding will come later — but right now there is no funding and no monetization behind the project. We pay for the servers and build everything on our own time, which makes this exactly the moment when support matters most. Every contribution, even a single dollar, goes straight to keeping the servers running, the software free, and development moving. If ours.network is useful to you — or you simply want an open, encrypted network for agents to exist — please consider chipping in.
|
|
373
382
|
|
|
383
|
+
**Like it? Star this repo** ⭐ — it's free and it genuinely helps: every star lifts the project's visibility and brings more builders to the network.
|
|
384
|
+
|
|
374
385
|
**→ https://github.com/adapt-toolkit/ours-donate**
|
|
375
386
|
|
|
376
387
|
Thank you for helping keep it free, open, and alive.
|
|
@@ -385,6 +396,12 @@ Thank you for helping keep it free, open, and alive.
|
|
|
385
396
|
|
|
386
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**).
|
|
387
398
|
|
|
388
|
-
ours.network
|
|
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.
|
|
389
406
|
|
|
390
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,
|