@ours.network/tg-connector 0.3.2 → 0.3.3-nightly.2
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 -35
- package/dist/cli.js +27 -75
- package/dist/connector.js +53220 -8213
- package/docs/voice-message-contract.md +8 -2
- package/package.json +3 -5
- package/dist/mufl_code/8A84AD8E225F186F666D3EAB2AFF777A4B9BB1B9C7CCF45CF364497EF16CF3E5.muflo +0 -0
- package/dist/mufl_code/actor.mu +0 -1833
- package/dist/mufl_code/config.mufl +0 -27
- package/dist/mufl_code/core/COMMERCIAL-LICENCE.md +0 -25
- package/dist/mufl_code/core/COMPATIBILITY.md +0 -221
- package/dist/mufl_code/core/CONTRIBUTING.md +0 -37
- package/dist/mufl_code/core/LICENSE +0 -98
- package/dist/mufl_code/core/NOTIFICATIONS_CONTRACT.md +0 -290
- package/dist/mufl_code/core/README.md +0 -91
- package/dist/mufl_code/core/SECURITY.md +0 -40
- package/dist/mufl_code/core/TRADEMARKS.md +0 -24
- package/dist/mufl_code/core/a2a_capabilities.mm +0 -449
- package/dist/mufl_code/core/a2a_cluster.mm +0 -601
- package/dist/mufl_code/core/a2a_control.mm +0 -90
- package/dist/mufl_code/core/a2a_messaging.mm +0 -4817
- package/dist/mufl_code/core/a2a_monitoring.mm +0 -94
- package/dist/mufl_code/core/a2a_notification_integration.mm +0 -144
- package/dist/mufl_code/core/a2a_notifications.mm +0 -1127
- package/dist/mufl_code/core/a2a_protocol.mm +0 -246
- package/dist/mufl_code/core/a2a_versions.mm +0 -801
- package/dist/mufl_code/core/config.mufl +0 -29
- package/dist/mufl_code/core/docs/.vitepress/config.mts +0 -58
- package/dist/mufl_code/core/docs/citations.json +0 -688
- package/dist/mufl_code/core/docs/guide/01-vendor-the-core.md +0 -50
- package/dist/mufl_code/core/docs/guide/02-configure-and-compile.md +0 -100
- package/dist/mufl_code/core/docs/guide/03-wire-the-host.md +0 -154
- package/dist/mufl_code/core/docs/guide/04-connect-and-message.md +0 -156
- package/dist/mufl_code/core/docs/guide/05-test-your-app.md +0 -75
- package/dist/mufl_code/core/docs/guide/index.md +0 -63
- package/dist/mufl_code/core/docs/how-it-works/capabilities-and-control.md +0 -77
- package/dist/mufl_code/core/docs/how-it-works/cluster.md +0 -65
- package/dist/mufl_code/core/docs/how-it-works/identity.md +0 -56
- package/dist/mufl_code/core/docs/how-it-works/invites-and-contacts.md +0 -76
- package/dist/mufl_code/core/docs/how-it-works/messaging.md +0 -55
- package/dist/mufl_code/core/docs/how-it-works/monitoring-and-config.md +0 -72
- package/dist/mufl_code/core/docs/how-it-works/overview.md +0 -45
- package/dist/mufl_code/core/docs/how-it-works/versioning.md +0 -116
- package/dist/mufl_code/core/docs/index.md +0 -27
- package/dist/mufl_code/core/docs/package-lock.json +0 -3467
- package/dist/mufl_code/core/docs/package.json +0 -15
- package/dist/mufl_code/core/docs/reference/contributing.md +0 -26
- package/dist/mufl_code/core/docs/reference/glossary.md +0 -108
- package/dist/mufl_code/core/docs/reference/implementations.md +0 -23
- package/dist/mufl_code/core/docs/reference/modules.md +0 -19
- package/dist/mufl_code/core/docs/scripts/check-citations.mjs +0 -36
- package/dist/mufl_code/core/docs/scripts/check-denylist.mjs +0 -30
- package/dist/mufl_code/core/docs/scripts/gen-llms.mjs +0 -32
- package/dist/mufl_code/core/docs/workflows/cluster.md +0 -89
- package/dist/mufl_code/core/docs/workflows/contact-exchange.md +0 -60
- package/dist/mufl_code/core/docs/workflows/contact-restore.md +0 -60
- package/dist/mufl_code/core/docs/workflows/control-verbs.md +0 -70
- package/dist/mufl_code/core/docs/workflows/index.md +0 -57
- package/dist/mufl_code/core/docs/workflows/introductions.md +0 -60
- package/dist/mufl_code/core/docs/workflows/messaging.md +0 -75
- package/dist/mufl_code/core/docs/workflows/monitoring.md +0 -84
- package/dist/mufl_code/core/docs/workflows/notifications.md +0 -109
- package/dist/mufl_code/core/release-notes/0.1.md +0 -60
- package/dist/mufl_code/core/release-notes/0.3.md +0 -22
- package/dist/mufl_code/core/release-notes/0.4.md +0 -97
- package/dist/mufl_code/core/tests/README.md +0 -83
- package/dist/mufl_code/core/tests/compat/README.md +0 -82
- package/dist/mufl_code/core/tests/compat/compat.mjs +0 -245
- package/dist/mufl_code/core/tests/compat/compat_peer.mjs +0 -146
- package/dist/mufl_code/core/tests/compat/run_compat.sh +0 -96
- package/dist/mufl_code/core/tests/corpus.mjs +0 -139
- package/dist/mufl_code/core/tests/corpus_actor.mu +0 -242
- package/dist/mufl_code/core/tests/fatcompile_actor.mu +0 -52
- package/dist/mufl_code/core/tests/mig.mjs +0 -805
- package/dist/mufl_code/core/tests/mig_actor.mu +0 -518
- package/dist/mufl_code/core/tests/migapp.mjs +0 -431
- package/dist/mufl_code/core/tests/migapp_actor.mu +0 -294
- package/dist/mufl_code/core/tests/mufl_semantics/run.sh +0 -69
- package/dist/mufl_code/core/tests/mufl_semantics/t11_three_version.mufl +0 -47
- package/dist/mufl_code/core/tests/mufl_semantics/t2_extra_fields.mufl +0 -11
- package/dist/mufl_code/core/tests/mufl_semantics/t7_runtime.mufl +0 -30
- package/dist/mufl_code/core/tests/mufl_semantics/t9_passthrough.mufl +0 -19
- package/dist/mufl_code/core/tests/mufl_semantics/t_str_order.mufl +0 -19
- package/dist/mufl_code/core/tests/notif.mjs +0 -755
- package/dist/mufl_code/core/tests/notif_actor.mu +0 -450
- package/dist/mufl_code/core/tests/protocol_container.mm +0 -18
- package/dist/mufl_code/core/tests/run.sh +0 -65
- package/dist/mufl_code/core/tests/run_corpus.sh +0 -51
- package/dist/mufl_code/core/tests/run_fatcompile.sh +0 -40
- package/dist/mufl_code/core/tests/run_mig.sh +0 -51
- package/dist/mufl_code/core/tests/run_migapp.sh +0 -51
- package/dist/mufl_code/core/tests/run_notif.sh +0 -57
- package/dist/mufl_code/core/tests/test.mjs +0 -750
- package/dist/mufl_code/core/tests/test_actor.mu +0 -564
- package/dist/mufl_code/core/tests/test_common.mjs +0 -93
- package/dist/mufl_code/core/version.mm +0 -24
- package/dist/mufl_code/protocol_container.mm +0 -18
package/README.md
CHANGED
|
@@ -200,8 +200,15 @@ added for provenance:
|
|
|
200
200
|
}
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
-
- **Opt-in
|
|
204
|
-
|
|
203
|
+
- **Opt-in, and it covers THIS PROCESS ONLY.** Off by default
|
|
204
|
+
(`sttEnabled:false`), which means *the connector* sends no audio to a
|
|
205
|
+
speech-to-text provider. It does **not** mean the audio is never transcribed:
|
|
206
|
+
the connector is a client of an ours daemon, and **the daemon runs its own
|
|
207
|
+
speech-to-text** when the receiving side pulls a voice note — under
|
|
208
|
+
configuration this connector's operator does not control and may not know
|
|
209
|
+
exists. When the connector was its own host, `sttEnabled:false` did cover the
|
|
210
|
+
whole path; attached, it no longer can. Turn it on and supply a key to
|
|
211
|
+
transcribe here as well (see [Configuration](#configuration)).
|
|
205
212
|
- **No transcoding.** Telegram voice is **OGG/Opus**, which OpenAI-compatible
|
|
206
213
|
transcription endpoints accept directly — the connector adds **no ffmpeg** and no
|
|
207
214
|
new dependency (just built-in `fetch`).
|
|
@@ -255,9 +262,11 @@ npm install
|
|
|
255
262
|
npm run build
|
|
256
263
|
```
|
|
257
264
|
|
|
258
|
-
Requires Node ≥ 20
|
|
259
|
-
|
|
260
|
-
|
|
265
|
+
Requires Node ≥ 20, and **an ours daemon already running on this box** — the
|
|
266
|
+
connector attaches to it over `/api/v1` and drives it through
|
|
267
|
+
[`@ours.network/sdk`](https://www.npmjs.com/package/@ours.network/sdk). It runs
|
|
268
|
+
no engine of its own: there is no native ADAPT SDK and no MUFL packet here, so
|
|
269
|
+
nothing beyond `npm install` is resolved at runtime.
|
|
261
270
|
|
|
262
271
|
## Usage
|
|
263
272
|
|
|
@@ -330,7 +339,8 @@ Precedence per field: **env var > `config.json` > default**. The config file is
|
|
|
330
339
|
|
|
331
340
|
| field | env var | default |
|
|
332
341
|
|----------------|---------------------------|-------------------------------------------------|
|
|
333
|
-
|
|
|
342
|
+
| daemon URL | `OURS_TG_DAEMON_URL` | `''` (the SDK's own default selection) |
|
|
343
|
+
| daemon state dir | `OURS_TG_DAEMON_STATE_DIR` | `''` (the SDK's own default selection) |
|
|
334
344
|
| control port | `OURS_TG_CONTROL_PORT` | `3051` (localhost only) |
|
|
335
345
|
| state dir | `OURS_TG_STATE_DIR` | `~/.ours-telegram` |
|
|
336
346
|
| poll timeout | `OURS_TG_POLL_TIMEOUT` | `30` (seconds, Telegram long-poll) |
|
|
@@ -340,7 +350,7 @@ Precedence per field: **env var > `config.json` > default**. The config file is
|
|
|
340
350
|
| retry backoff | `OURS_TG_FETCH_RETRY_BASE_MS` | `300` (base delay between those retries; grows exponentially with jitter) |
|
|
341
351
|
| attachment cap | `OURS_TG_ATTACHMENT_MAX_BYTES` | `10485760` (10 MB; larger inbound media forwarded as a metadata-only stub) |
|
|
342
352
|
| 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) |
|
|
343
|
-
| STT enabled | `OURS_TG_STT_ENABLED` | `false` (
|
|
353
|
+
| STT enabled | `OURS_TG_STT_ENABLED` | `false` (whether **this connector** transcribes voice; the attached daemon runs its own STT regardless — see [Voice](#voice-messages--speech-to-text)) |
|
|
344
354
|
| STT API key | `OURS_TG_STT_API_KEY` | `''` (secret; env preferred — masked if placed in `config.json`, never logged) |
|
|
345
355
|
| STT base URL | `OURS_TG_STT_BASE_URL` | `https://api.openai.com/v1` (OpenAI-compatible endpoint root; e.g. `https://api.groq.com/openai/v1` or a self-hosted whisper server) |
|
|
346
356
|
| STT model | `OURS_TG_STT_MODEL` | `whisper-1` (e.g. `whisper-large-v3-turbo` on Groq) |
|
|
@@ -353,36 +363,18 @@ Precedence per field: **env var > `config.json` > default**. The config file is
|
|
|
353
363
|
The control API is bound to `127.0.0.1` and unauthenticated — it manages bot
|
|
354
364
|
tokens, so do not expose the control port off-host.
|
|
355
365
|
|
|
356
|
-
## Control plane (
|
|
366
|
+
## Control plane (removed)
|
|
357
367
|
|
|
358
|
-
|
|
359
|
-
ours messenger
|
|
360
|
-
channel
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
368
|
+
The connector used to be a **managed node**: it advertised an app manifest
|
|
369
|
+
(`network.ours.telegram-connector`) and the ours messenger could bind to it over
|
|
370
|
+
the a2a_control channel and edit the allowed chat id and denial message live.
|
|
371
|
+
That is gone — messenger manageability was removed by ruling, and with it the
|
|
372
|
+
`cp_invite` and `bind_proxy` commands, the `get_manifest` / `get_config` /
|
|
373
|
+
`set_config` verbs, and the bind ceremony.
|
|
364
374
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
(The bot token is *not* CP-configurable: the messenger strips secret-field values
|
|
369
|
-
on save, so the token stays set at connection creation.)
|
|
370
|
-
|
|
371
|
-
Bind it once:
|
|
372
|
-
|
|
373
|
-
```sh
|
|
374
|
-
# 1. add the messenger as a contact of the bridge node
|
|
375
|
-
ours-tg-connector cp_invite supportbot
|
|
376
|
-
# → paste the invite into the messenger (add contact / add node)
|
|
377
|
-
|
|
378
|
-
# 2. start the bind ceremony for that contact; read out the 6-digit code
|
|
379
|
-
ours-tg-connector bind_proxy supportbot <messenger-contact-name-or-cid>
|
|
380
|
-
# → enter the code in the messenger Control Panel (out-of-band, 5 min, 3 tries)
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
Once bound, the messenger can pull the manifest, render the config form, and push
|
|
384
|
-
changes (`get_manifest` / `get_config` / `set_config`). Config verbs are gated:
|
|
385
|
-
only the bound control plane may read or write the configuration.
|
|
375
|
+
A route is configured when it is created (`add_new_connection`) and changed by
|
|
376
|
+
removing it and adding it back. There is no live reconfiguration path, and
|
|
377
|
+
nothing to bind.
|
|
386
378
|
|
|
387
379
|
## Learn more
|
|
388
380
|
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'node:module'; const require =
|
|
2
|
+
import { createRequire as __tgCreateRequire } from 'node:module'; const require = __tgCreateRequire(import.meta.url);
|
|
3
3
|
|
|
4
4
|
// src/cli.ts
|
|
5
5
|
import { spawn, spawnSync } from "node:child_process";
|
|
@@ -14,7 +14,8 @@ import * as fs from "node:fs";
|
|
|
14
14
|
import { homedir } from "node:os";
|
|
15
15
|
import { resolve, join, dirname } from "node:path";
|
|
16
16
|
var DEFAULT_CONFIG = {
|
|
17
|
-
|
|
17
|
+
daemonUrl: "",
|
|
18
|
+
daemonStateDir: "",
|
|
18
19
|
controlPort: 3051,
|
|
19
20
|
stateDir: resolve(homedir(), ".ours-telegram"),
|
|
20
21
|
pollTimeoutSec: 30,
|
|
@@ -54,7 +55,8 @@ function readFileConfig() {
|
|
|
54
55
|
return {};
|
|
55
56
|
}
|
|
56
57
|
const out2 = {};
|
|
57
|
-
if (typeof parsed.
|
|
58
|
+
if (typeof parsed.daemonUrl === "string") out2.daemonUrl = parsed.daemonUrl;
|
|
59
|
+
if (typeof parsed.daemonStateDir === "string") out2.daemonStateDir = resolve(parsed.daemonStateDir);
|
|
58
60
|
if (typeof parsed.controlPort === "number" && Number.isFinite(parsed.controlPort)) out2.controlPort = parsed.controlPort;
|
|
59
61
|
if (typeof parsed.stateDir === "string") out2.stateDir = resolve(parsed.stateDir);
|
|
60
62
|
if (typeof parsed.pollTimeoutSec === "number" && Number.isFinite(parsed.pollTimeoutSec)) {
|
|
@@ -101,7 +103,11 @@ function envBool(name) {
|
|
|
101
103
|
function loadConfig() {
|
|
102
104
|
const file = readFileConfig();
|
|
103
105
|
return {
|
|
104
|
-
|
|
106
|
+
// NOTE: no OURS_TG_BROKER_URL any more. The connector does not talk to a
|
|
107
|
+
// broker — the daemon does. A stale one in a config file is now ignored
|
|
108
|
+
// rather than half-honoured.
|
|
109
|
+
daemonUrl: process.env.OURS_TG_DAEMON_URL ?? file.daemonUrl ?? DEFAULT_CONFIG.daemonUrl,
|
|
110
|
+
daemonStateDir: process.env.OURS_TG_DAEMON_STATE_DIR ?? file.daemonStateDir ?? DEFAULT_CONFIG.daemonStateDir,
|
|
105
111
|
controlPort: envInt("OURS_TG_CONTROL_PORT") ?? file.controlPort ?? DEFAULT_CONFIG.controlPort,
|
|
106
112
|
stateDir: resolve(process.env.OURS_TG_STATE_DIR ?? file.stateDir ?? DEFAULT_CONFIG.stateDir),
|
|
107
113
|
pollTimeoutSec: envInt("OURS_TG_POLL_TIMEOUT") ?? file.pollTimeoutSec ?? DEFAULT_CONFIG.pollTimeoutSec,
|
|
@@ -123,6 +129,18 @@ function loadConfig() {
|
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
131
|
|
|
132
|
+
// src/service-definition.ts
|
|
133
|
+
function serviceEnvironment(config, stateDir) {
|
|
134
|
+
const env = {
|
|
135
|
+
OURS_TG_CONTROL_PORT: String(config.controlPort),
|
|
136
|
+
OURS_TG_STATE_DIR: stateDir,
|
|
137
|
+
OURS_TG_POLL_TIMEOUT: String(config.pollTimeoutSec)
|
|
138
|
+
};
|
|
139
|
+
if (config.daemonUrl) env.OURS_TG_DAEMON_URL = config.daemonUrl;
|
|
140
|
+
if (config.daemonStateDir) env.OURS_TG_DAEMON_STATE_DIR = config.daemonStateDir;
|
|
141
|
+
return env;
|
|
142
|
+
}
|
|
143
|
+
|
|
126
144
|
// src/routing.ts
|
|
127
145
|
function looksLikeBotToken(s) {
|
|
128
146
|
return /^\d+:[A-Za-z0-9_-]+$/.test(s);
|
|
@@ -212,7 +230,7 @@ async function cmdStart() {
|
|
|
212
230
|
const ready = await waitForPort(PORT);
|
|
213
231
|
if (ready) {
|
|
214
232
|
out(`up on ${BASE}`);
|
|
215
|
-
out(`
|
|
233
|
+
out(` daemon: ${CONFIG.daemonUrl || "(default selection)"}`);
|
|
216
234
|
out(` state: ${STATE_DIR}`);
|
|
217
235
|
out(` logs: ${LOG_PATH}`);
|
|
218
236
|
} else {
|
|
@@ -257,7 +275,7 @@ async function cmdStatus() {
|
|
|
257
275
|
out("ours-tg-connector: running");
|
|
258
276
|
if (pid) out(` pid: ${pid}`);
|
|
259
277
|
out(` url: ${BASE} ${up ? "(reachable)" : "(port not answering!)"}`);
|
|
260
|
-
out(`
|
|
278
|
+
out(` daemon: ${CONFIG.daemonUrl || "(default selection)"}`);
|
|
261
279
|
out(` state: ${STATE_DIR}`);
|
|
262
280
|
out(` logs: ${LOG_PATH}`);
|
|
263
281
|
if (up) {
|
|
@@ -458,54 +476,6 @@ async function cmdListConnections() {
|
|
|
458
476
|
}
|
|
459
477
|
}
|
|
460
478
|
}
|
|
461
|
-
async function cmdCpInvite(name) {
|
|
462
|
-
if (!name) {
|
|
463
|
-
err("cp_invite requires a connection name.");
|
|
464
|
-
process.exit(1);
|
|
465
|
-
}
|
|
466
|
-
if (!await portOpen(PORT)) {
|
|
467
|
-
err("daemon not running \u2014 start it first.");
|
|
468
|
-
process.exit(1);
|
|
469
|
-
}
|
|
470
|
-
const res = await fetch(`${BASE}/connections/${encodeURIComponent(name)}/cp-invite`, { method: "POST" });
|
|
471
|
-
const body = await res.json();
|
|
472
|
-
if (!body.ok || !body.invite) {
|
|
473
|
-
err(`cp_invite failed: ${body.error ?? `HTTP ${res.status}`}`);
|
|
474
|
-
process.exit(1);
|
|
475
|
-
}
|
|
476
|
-
out("");
|
|
477
|
-
out(`Add the messenger control plane as a contact of "${name}".`);
|
|
478
|
-
out("Paste this invite into the messenger (add contact / add node):");
|
|
479
|
-
out("");
|
|
480
|
-
out(body.invite);
|
|
481
|
-
out("");
|
|
482
|
-
out(`Once it is a contact, bind it: ours-tg-connector bind_proxy ${name} <contact-name-or-cid>`);
|
|
483
|
-
}
|
|
484
|
-
async function cmdBindProxy(name, contact) {
|
|
485
|
-
if (!name || !contact) {
|
|
486
|
-
err("bind_proxy requires <connection-name> <contact-name-or-cid>.");
|
|
487
|
-
process.exit(1);
|
|
488
|
-
}
|
|
489
|
-
if (!await portOpen(PORT)) {
|
|
490
|
-
err("daemon not running \u2014 start it first.");
|
|
491
|
-
process.exit(1);
|
|
492
|
-
}
|
|
493
|
-
const res = await fetch(`${BASE}/connections/${encodeURIComponent(name)}/bind`, {
|
|
494
|
-
method: "POST",
|
|
495
|
-
headers: { "Content-Type": "application/json" },
|
|
496
|
-
body: JSON.stringify({ contact })
|
|
497
|
-
});
|
|
498
|
-
const body = await res.json();
|
|
499
|
-
if (!body.ok || !body.code) {
|
|
500
|
-
err(`bind_proxy failed: ${body.error ?? `HTTP ${res.status}`}`);
|
|
501
|
-
process.exit(1);
|
|
502
|
-
}
|
|
503
|
-
out("");
|
|
504
|
-
out(`Verification code: ${body.code}`);
|
|
505
|
-
out("");
|
|
506
|
-
out("Enter it in the messenger Control Panel within 5 minutes (3 attempts).");
|
|
507
|
-
out("Do NOT send it over ours \u2014 it must travel out-of-band (this terminal counts).");
|
|
508
|
-
}
|
|
509
479
|
async function cmdRemoveConnection(name) {
|
|
510
480
|
if (!name) {
|
|
511
481
|
err("remove_connection requires a connection name.");
|
|
@@ -535,14 +505,7 @@ function run(cmd, args) {
|
|
|
535
505
|
const r = spawnSync(cmd, args, { stdio: "inherit" });
|
|
536
506
|
return r.status === 0;
|
|
537
507
|
}
|
|
538
|
-
|
|
539
|
-
return {
|
|
540
|
-
OURS_TG_BROKER_URL: CONFIG.brokerUrl,
|
|
541
|
-
OURS_TG_CONTROL_PORT: String(CONFIG.controlPort),
|
|
542
|
-
OURS_TG_STATE_DIR: STATE_DIR,
|
|
543
|
-
OURS_TG_POLL_TIMEOUT: String(CONFIG.pollTimeoutSec)
|
|
544
|
-
};
|
|
545
|
-
}
|
|
508
|
+
var serviceEnv = () => serviceEnvironment(CONFIG, STATE_DIR);
|
|
546
509
|
function installSystemd() {
|
|
547
510
|
const unitPath = systemdUnitPath();
|
|
548
511
|
fs2.mkdirSync(dirname2(unitPath), { recursive: true });
|
|
@@ -675,10 +638,6 @@ function usage() {
|
|
|
675
638
|
out(" list_connections list configured routes grouped by bot");
|
|
676
639
|
out(" remove_connection <name> delete a route and its state");
|
|
677
640
|
out("");
|
|
678
|
-
out(" control plane (ours messenger):");
|
|
679
|
-
out(" cp_invite <name> print an invite to add the messenger as a contact");
|
|
680
|
-
out(" bind_proxy <name> <contact> start binding the messenger as control plane (prints a 6-digit code)");
|
|
681
|
-
out("");
|
|
682
641
|
out(" start start the daemon in the background");
|
|
683
642
|
out(" stop stop the running daemon");
|
|
684
643
|
out(" restart stop then start");
|
|
@@ -690,7 +649,8 @@ function usage() {
|
|
|
690
649
|
out("");
|
|
691
650
|
out("Config precedence (per field): env var > config.json > default.");
|
|
692
651
|
out(" config.json: OURS_TG_CONFIG, else ~/.ours-telegram/config.json");
|
|
693
|
-
out(" env:
|
|
652
|
+
out(" env: OURS_TG_DAEMON_URL + OURS_TG_DAEMON_STATE_DIR (both, or neither), OURS_TG_CONTROL_PORT (3051),");
|
|
653
|
+
out(" OURS_TG_STATE_DIR, OURS_TG_POLL_TIMEOUT (30)");
|
|
694
654
|
}
|
|
695
655
|
async function main() {
|
|
696
656
|
const cmd = process.argv[2] ?? "help";
|
|
@@ -741,14 +701,6 @@ async function main() {
|
|
|
741
701
|
case "remove":
|
|
742
702
|
await cmdRemoveConnection(process.argv[3]);
|
|
743
703
|
break;
|
|
744
|
-
case "cp_invite":
|
|
745
|
-
case "cp-invite":
|
|
746
|
-
await cmdCpInvite(process.argv[3]);
|
|
747
|
-
break;
|
|
748
|
-
case "bind_proxy":
|
|
749
|
-
case "bind-proxy":
|
|
750
|
-
await cmdBindProxy(process.argv[3], process.argv[4]);
|
|
751
|
-
break;
|
|
752
704
|
case "start":
|
|
753
705
|
await cmdStart();
|
|
754
706
|
break;
|