@ours.network/tg-connector 0.5.0 → 0.5.1-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.
Files changed (96) hide show
  1. package/README.md +92 -153
  2. package/dist/cli.js +91 -117
  3. package/dist/connector.js +1861 -1911
  4. package/docs/voice-message-contract.md +8 -2
  5. package/package.json +4 -5
  6. package/dist/mufl_code/ED9CAFA60E1A0884E2CBC8E71BA8A137488A14763C57587D25AEC4BAD7F58C81.muflo +0 -0
  7. package/dist/mufl_code/actor.mu +0 -1937
  8. package/dist/mufl_code/config.mufl +0 -27
  9. package/dist/mufl_code/core/COMMERCIAL-LICENCE.md +0 -25
  10. package/dist/mufl_code/core/COMPATIBILITY.md +0 -221
  11. package/dist/mufl_code/core/CONTRIBUTING.md +0 -37
  12. package/dist/mufl_code/core/LICENSE +0 -98
  13. package/dist/mufl_code/core/NOTIFICATIONS_CONTRACT.md +0 -290
  14. package/dist/mufl_code/core/README.md +0 -91
  15. package/dist/mufl_code/core/SECURITY.md +0 -40
  16. package/dist/mufl_code/core/TRADEMARKS.md +0 -24
  17. package/dist/mufl_code/core/a2a_capabilities.mm +0 -449
  18. package/dist/mufl_code/core/a2a_cluster.mm +0 -601
  19. package/dist/mufl_code/core/a2a_control.mm +0 -90
  20. package/dist/mufl_code/core/a2a_messaging.mm +0 -4817
  21. package/dist/mufl_code/core/a2a_monitoring.mm +0 -94
  22. package/dist/mufl_code/core/a2a_notification_integration.mm +0 -144
  23. package/dist/mufl_code/core/a2a_notifications.mm +0 -1127
  24. package/dist/mufl_code/core/a2a_protocol.mm +0 -246
  25. package/dist/mufl_code/core/a2a_versions.mm +0 -801
  26. package/dist/mufl_code/core/config.mufl +0 -29
  27. package/dist/mufl_code/core/docs/.vitepress/config.mts +0 -58
  28. package/dist/mufl_code/core/docs/citations.json +0 -688
  29. package/dist/mufl_code/core/docs/guide/01-vendor-the-core.md +0 -50
  30. package/dist/mufl_code/core/docs/guide/02-configure-and-compile.md +0 -100
  31. package/dist/mufl_code/core/docs/guide/03-wire-the-host.md +0 -154
  32. package/dist/mufl_code/core/docs/guide/04-connect-and-message.md +0 -156
  33. package/dist/mufl_code/core/docs/guide/05-test-your-app.md +0 -75
  34. package/dist/mufl_code/core/docs/guide/index.md +0 -63
  35. package/dist/mufl_code/core/docs/how-it-works/capabilities-and-control.md +0 -77
  36. package/dist/mufl_code/core/docs/how-it-works/cluster.md +0 -65
  37. package/dist/mufl_code/core/docs/how-it-works/identity.md +0 -56
  38. package/dist/mufl_code/core/docs/how-it-works/invites-and-contacts.md +0 -76
  39. package/dist/mufl_code/core/docs/how-it-works/messaging.md +0 -55
  40. package/dist/mufl_code/core/docs/how-it-works/monitoring-and-config.md +0 -72
  41. package/dist/mufl_code/core/docs/how-it-works/overview.md +0 -45
  42. package/dist/mufl_code/core/docs/how-it-works/versioning.md +0 -116
  43. package/dist/mufl_code/core/docs/index.md +0 -27
  44. package/dist/mufl_code/core/docs/package-lock.json +0 -3467
  45. package/dist/mufl_code/core/docs/package.json +0 -15
  46. package/dist/mufl_code/core/docs/reference/contributing.md +0 -26
  47. package/dist/mufl_code/core/docs/reference/glossary.md +0 -108
  48. package/dist/mufl_code/core/docs/reference/implementations.md +0 -23
  49. package/dist/mufl_code/core/docs/reference/modules.md +0 -19
  50. package/dist/mufl_code/core/docs/scripts/check-citations.mjs +0 -36
  51. package/dist/mufl_code/core/docs/scripts/check-denylist.mjs +0 -30
  52. package/dist/mufl_code/core/docs/scripts/gen-llms.mjs +0 -32
  53. package/dist/mufl_code/core/docs/workflows/cluster.md +0 -89
  54. package/dist/mufl_code/core/docs/workflows/contact-exchange.md +0 -60
  55. package/dist/mufl_code/core/docs/workflows/contact-restore.md +0 -60
  56. package/dist/mufl_code/core/docs/workflows/control-verbs.md +0 -70
  57. package/dist/mufl_code/core/docs/workflows/index.md +0 -57
  58. package/dist/mufl_code/core/docs/workflows/introductions.md +0 -60
  59. package/dist/mufl_code/core/docs/workflows/messaging.md +0 -75
  60. package/dist/mufl_code/core/docs/workflows/monitoring.md +0 -84
  61. package/dist/mufl_code/core/docs/workflows/notifications.md +0 -109
  62. package/dist/mufl_code/core/release-notes/0.1.md +0 -60
  63. package/dist/mufl_code/core/release-notes/0.3.md +0 -22
  64. package/dist/mufl_code/core/release-notes/0.4.md +0 -97
  65. package/dist/mufl_code/core/tests/README.md +0 -83
  66. package/dist/mufl_code/core/tests/compat/README.md +0 -82
  67. package/dist/mufl_code/core/tests/compat/compat.mjs +0 -245
  68. package/dist/mufl_code/core/tests/compat/compat_peer.mjs +0 -146
  69. package/dist/mufl_code/core/tests/compat/run_compat.sh +0 -96
  70. package/dist/mufl_code/core/tests/corpus.mjs +0 -139
  71. package/dist/mufl_code/core/tests/corpus_actor.mu +0 -242
  72. package/dist/mufl_code/core/tests/fatcompile_actor.mu +0 -52
  73. package/dist/mufl_code/core/tests/mig.mjs +0 -805
  74. package/dist/mufl_code/core/tests/mig_actor.mu +0 -518
  75. package/dist/mufl_code/core/tests/migapp.mjs +0 -431
  76. package/dist/mufl_code/core/tests/migapp_actor.mu +0 -294
  77. package/dist/mufl_code/core/tests/mufl_semantics/run.sh +0 -69
  78. package/dist/mufl_code/core/tests/mufl_semantics/t11_three_version.mufl +0 -47
  79. package/dist/mufl_code/core/tests/mufl_semantics/t2_extra_fields.mufl +0 -11
  80. package/dist/mufl_code/core/tests/mufl_semantics/t7_runtime.mufl +0 -30
  81. package/dist/mufl_code/core/tests/mufl_semantics/t9_passthrough.mufl +0 -19
  82. package/dist/mufl_code/core/tests/mufl_semantics/t_str_order.mufl +0 -19
  83. package/dist/mufl_code/core/tests/notif.mjs +0 -755
  84. package/dist/mufl_code/core/tests/notif_actor.mu +0 -450
  85. package/dist/mufl_code/core/tests/protocol_container.mm +0 -18
  86. package/dist/mufl_code/core/tests/run.sh +0 -65
  87. package/dist/mufl_code/core/tests/run_corpus.sh +0 -51
  88. package/dist/mufl_code/core/tests/run_fatcompile.sh +0 -40
  89. package/dist/mufl_code/core/tests/run_mig.sh +0 -51
  90. package/dist/mufl_code/core/tests/run_migapp.sh +0 -51
  91. package/dist/mufl_code/core/tests/run_notif.sh +0 -57
  92. package/dist/mufl_code/core/tests/test.mjs +0 -750
  93. package/dist/mufl_code/core/tests/test_actor.mu +0 -564
  94. package/dist/mufl_code/core/tests/test_common.mjs +0 -93
  95. package/dist/mufl_code/core/version.mm +0 -24
  96. package/dist/mufl_code/protocol_container.mm +0 -18
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
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
- brokerUrl: "wss://broker1.ours.network",
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.brokerUrl === "string") out2.brokerUrl = parsed.brokerUrl;
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
- brokerUrl: process.env.OURS_TG_BROKER_URL ?? file.brokerUrl ?? DEFAULT_CONFIG.brokerUrl,
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,52 @@ 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
+ function xmlText(value) {
144
+ return String(value).replace(/[&<>"']/g, (character) => ({
145
+ "&": "&amp;",
146
+ "<": "&lt;",
147
+ ">": "&gt;",
148
+ '"': "&quot;",
149
+ "'": "&apos;"
150
+ })[character]);
151
+ }
152
+ function launchdPlist(input) {
153
+ const envEntries = Object.entries(input.env).map(([key, value]) => ` <key>${xmlText(key)}</key><string>${xmlText(value)}</string>`).join("\n");
154
+ return `<?xml version="1.0" encoding="UTF-8"?>
155
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
156
+ <plist version="1.0">
157
+ <dict>
158
+ <key>Label</key><string>${xmlText(input.label)}</string>
159
+ <key>ProgramArguments</key>
160
+ <array>
161
+ <string>${xmlText(input.execPath)}</string>
162
+ <string>${xmlText(input.self)}</string>
163
+ <string>serve</string>
164
+ </array>
165
+ <key>EnvironmentVariables</key>
166
+ <dict>
167
+ ${envEntries}
168
+ </dict>
169
+ <key>RunAtLoad</key><true/>
170
+ <key>KeepAlive</key><true/>
171
+ <key>StandardOutPath</key><string>${xmlText(input.logPath)}</string>
172
+ <key>StandardErrorPath</key><string>${xmlText(input.logPath)}</string>
173
+ </dict>
174
+ </plist>
175
+ `;
176
+ }
177
+
126
178
  // src/routing.ts
127
179
  function looksLikeBotToken(s) {
128
180
  return /^\d+:[A-Za-z0-9_-]+$/.test(s);
@@ -204,7 +256,7 @@ async function cmdStart() {
204
256
  });
205
257
  child.unref();
206
258
  if (!child.pid) {
207
- err("failed to spawn the daemon.");
259
+ err("failed to spawn the connector.");
208
260
  process.exit(1);
209
261
  }
210
262
  fs2.writeFileSync(PID_PATH, String(child.pid));
@@ -212,11 +264,11 @@ async function cmdStart() {
212
264
  const ready = await waitForPort(PORT);
213
265
  if (ready) {
214
266
  out(`up on ${BASE}`);
215
- out(` broker: ${CONFIG.brokerUrl}`);
267
+ out(` daemon: ${CONFIG.daemonUrl || "(default selection)"}`);
216
268
  out(` state: ${STATE_DIR}`);
217
269
  out(` logs: ${LOG_PATH}`);
218
270
  } else {
219
- err(`daemon started (pid ${child.pid}) but control port ${PORT} did not open within 30s \u2014 check ${LOG_PATH}.`);
271
+ err(`connector started (pid ${child.pid}) but control port ${PORT} did not open within 30s \u2014 check ${LOG_PATH}.`);
220
272
  process.exit(1);
221
273
  }
222
274
  }
@@ -257,7 +309,7 @@ async function cmdStatus() {
257
309
  out("ours-tg-connector: running");
258
310
  if (pid) out(` pid: ${pid}`);
259
311
  out(` url: ${BASE} ${up ? "(reachable)" : "(port not answering!)"}`);
260
- out(` broker: ${CONFIG.brokerUrl}`);
312
+ out(` daemon: ${CONFIG.daemonUrl || "(default selection)"}`);
261
313
  out(` state: ${STATE_DIR}`);
262
314
  out(` logs: ${LOG_PATH}`);
263
315
  if (up) {
@@ -269,12 +321,12 @@ async function cmdStatus() {
269
321
  }
270
322
  }
271
323
  }
272
- async function ensureDaemon() {
324
+ async function ensureConnector() {
273
325
  if (await portOpen(PORT)) return;
274
- out("daemon not running \u2014 starting it\u2026");
326
+ out("connector not running \u2014 starting it\u2026");
275
327
  await cmdStart();
276
328
  if (!await portOpen(PORT)) {
277
- err("daemon did not come up; aborting.");
329
+ err("connector did not come up; aborting.");
278
330
  process.exit(1);
279
331
  }
280
332
  }
@@ -305,7 +357,7 @@ async function cmdAddBot(argv) {
305
357
  err(" ours-tg-connector add_bot --name supportbot --bot-token 123456:ABC...");
306
358
  process.exit(1);
307
359
  }
308
- await ensureDaemon();
360
+ await ensureConnector();
309
361
  let res;
310
362
  try {
311
363
  res = await fetch(`${BASE}/bots`, {
@@ -314,7 +366,7 @@ async function cmdAddBot(argv) {
314
366
  body: JSON.stringify({ name, botToken: token })
315
367
  });
316
368
  } catch (e) {
317
- err(`failed to reach the daemon control API: ${String(e)}`);
369
+ err(`failed to reach the connector control API: ${String(e)}`);
318
370
  process.exit(1);
319
371
  }
320
372
  const body = await res.json();
@@ -328,7 +380,7 @@ async function cmdAddBot(argv) {
328
380
  }
329
381
  async function cmdListBots() {
330
382
  if (!await portOpen(PORT)) {
331
- out("daemon not running \u2014 no live bots. (Persisted ones load on `start`.)");
383
+ out("connector not running \u2014 no live bots. (Persisted ones load on `start`.)");
332
384
  return;
333
385
  }
334
386
  const res = await fetch(`${BASE}/bots`);
@@ -351,7 +403,7 @@ async function cmdRemoveBot(name) {
351
403
  process.exit(1);
352
404
  }
353
405
  if (!await portOpen(PORT)) {
354
- err("daemon not running \u2014 start it first to remove a bot.");
406
+ err("connector not running \u2014 start it first to remove a bot.");
355
407
  process.exit(1);
356
408
  }
357
409
  const res = await fetch(`${BASE}/bots/${encodeURIComponent(name)}`, { method: "DELETE" });
@@ -389,7 +441,7 @@ async function cmdAddConnection(argv) {
389
441
  err('add_new_connection --payload-mode must be "plain" or "envelope"');
390
442
  process.exit(1);
391
443
  }
392
- await ensureDaemon();
444
+ await ensureConnector();
393
445
  let res;
394
446
  try {
395
447
  res = await fetch(`${BASE}/connections`, {
@@ -398,7 +450,7 @@ async function cmdAddConnection(argv) {
398
450
  body: JSON.stringify({ name, botName, chatId, threadId, label, bio, payloadMode })
399
451
  });
400
452
  } catch (e) {
401
- err(`failed to reach the daemon control API: ${String(e)}`);
453
+ err(`failed to reach the connector control API: ${String(e)}`);
402
454
  process.exit(1);
403
455
  }
404
456
  const body = await res.json();
@@ -427,7 +479,7 @@ async function cmdAddConnection(argv) {
427
479
  }
428
480
  async function cmdListConnections() {
429
481
  if (!await portOpen(PORT)) {
430
- out("daemon not running \u2014 no live connections. (Persisted ones load on `start`.)");
482
+ out("connector not running \u2014 no live connections. (Persisted ones load on `start`.)");
431
483
  return;
432
484
  }
433
485
  const res = await fetch(`${BASE}/connections`);
@@ -458,70 +510,26 @@ async function cmdListConnections() {
458
510
  }
459
511
  }
460
512
  }
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
513
  async function cmdRemoveConnection(name) {
510
514
  if (!name) {
511
515
  err("remove_connection requires a connection name.");
512
516
  process.exit(1);
513
517
  }
514
518
  if (!await portOpen(PORT)) {
515
- err("daemon not running \u2014 start it first to remove a live connection.");
519
+ err("connector not running \u2014 start it first to remove a live connection.");
516
520
  process.exit(1);
517
521
  }
518
522
  const res = await fetch(`${BASE}/connections/${encodeURIComponent(name)}`, { method: "DELETE" });
519
523
  const body = await res.json();
520
524
  if (!body.ok) {
521
- err(`remove_connection failed: ${body.error ?? `HTTP ${res.status}`}`);
525
+ if (body.removed) {
526
+ err(`Removed connection "${body.removed}" locally, but its daemon identity was left behind: ${body.error ?? `HTTP ${res.status}`}`);
527
+ } else {
528
+ err(`remove_connection failed: ${body.error ?? `HTTP ${res.status}`}`);
529
+ }
522
530
  process.exit(1);
523
531
  }
524
- out(`Removed connection "${name}" and its state.`);
532
+ out(`Removed connection "${name}", its state, and its name-listed daemon identity.`);
525
533
  }
526
534
  var SYSTEMD_UNIT = "ours-telegram.service";
527
535
  var LAUNCHD_LABEL = "solutions.adaptframework.ours-telegram";
@@ -535,14 +543,7 @@ function run(cmd, args) {
535
543
  const r = spawnSync(cmd, args, { stdio: "inherit" });
536
544
  return r.status === 0;
537
545
  }
538
- function serviceEnv() {
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
- }
546
+ var serviceEnv = () => serviceEnvironment(CONFIG, STATE_DIR);
546
547
  function installSystemd() {
547
548
  const unitPath = systemdUnitPath();
548
549
  fs2.mkdirSync(dirname2(unitPath), { recursive: true });
@@ -596,29 +597,13 @@ function installLaunchd() {
596
597
  const plistPath = launchdPlistPath();
597
598
  fs2.mkdirSync(dirname2(plistPath), { recursive: true });
598
599
  const env = serviceEnv();
599
- const envEntries = Object.entries(env).map(([k, v]) => ` <key>${k}</key><string>${v}</string>`).join("\n");
600
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
601
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
602
- <plist version="1.0">
603
- <dict>
604
- <key>Label</key><string>${LAUNCHD_LABEL}</string>
605
- <key>ProgramArguments</key>
606
- <array>
607
- <string>${process.execPath}</string>
608
- <string>${SELF}</string>
609
- <string>serve</string>
610
- </array>
611
- <key>EnvironmentVariables</key>
612
- <dict>
613
- ${envEntries}
614
- </dict>
615
- <key>RunAtLoad</key><true/>
616
- <key>KeepAlive</key><true/>
617
- <key>StandardOutPath</key><string>${LOG_PATH}</string>
618
- <key>StandardErrorPath</key><string>${LOG_PATH}</string>
619
- </dict>
620
- </plist>
621
- `;
600
+ const plist = launchdPlist({
601
+ label: LAUNCHD_LABEL,
602
+ execPath: process.execPath,
603
+ self: SELF,
604
+ logPath: LOG_PATH,
605
+ env
606
+ });
622
607
  fs2.writeFileSync(plistPath, plist);
623
608
  out(`wrote ${plistPath}`);
624
609
  run("launchctl", ["unload", plistPath]);
@@ -675,22 +660,19 @@ function usage() {
675
660
  out(" list_connections list configured routes grouped by bot");
676
661
  out(" remove_connection <name> delete a route and its state");
677
662
  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
- out(" start start the daemon in the background");
683
- out(" stop stop the running daemon");
663
+ out(" start start the connector in the background");
664
+ out(" stop stop the running connector");
684
665
  out(" restart stop then start");
685
- out(" status show whether the daemon is running");
686
- out(" serve run the daemon in the foreground (used by start; handy for debugging)");
666
+ out(" status show whether the connector is running");
667
+ out(" serve run the connector in the foreground (used by start; handy for debugging)");
687
668
  out("");
688
669
  out(" install-service install + start a boot-persistent service (systemd/launchd)");
689
670
  out(" uninstall-service stop + remove that service");
690
671
  out("");
691
672
  out("Config precedence (per field): env var > config.json > default.");
692
673
  out(" config.json: OURS_TG_CONFIG, else ~/.ours-telegram/config.json");
693
- out(" env: OURS_TG_BROKER_URL, OURS_TG_CONTROL_PORT (3051), OURS_TG_STATE_DIR, OURS_TG_POLL_TIMEOUT (30)");
674
+ out(" env: OURS_TG_DAEMON_URL + OURS_TG_DAEMON_STATE_DIR (both, or neither), OURS_TG_CONTROL_PORT (3051),");
675
+ out(" OURS_TG_STATE_DIR, OURS_TG_POLL_TIMEOUT (30)");
694
676
  }
695
677
  async function main() {
696
678
  const cmd = process.argv[2] ?? "help";
@@ -741,14 +723,6 @@ async function main() {
741
723
  case "remove":
742
724
  await cmdRemoveConnection(process.argv[3]);
743
725
  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
726
  case "start":
753
727
  await cmdStart();
754
728
  break;