@ours.network/tg-connector 1.0.1-nightly.4 → 1.0.1-nightly.6

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
@@ -535,3 +535,7 @@ node scripts/check-build-selected.mjs --sdk /artifacts/ours.network-sdk-3.7.2.tg
535
535
  ```
536
536
 
537
537
  For development against the selected, unpublished SDK/CLI sources, see [selected-source development](docs/selected-source-development.md).
538
+
539
+ ### Private Docker gateway listener
540
+
541
+ `OURS_TG_CONTROL_HOST=0.0.0.0` allows the installer nginx gateway to reach the control API over its private Docker network. The default remains `127.0.0.1`. This API has operator authority and no application authentication: never publish its container port or use this setting on an unprotected host. The supported installer gateway authenticates requests using the issued server credential before forwarding them. All containers on that network share the same trust boundary. `ours-tg-connector capabilities` advertises `telegram.gateway-listener-v1` for installer compatibility checks.
package/dist/cli.js CHANGED
@@ -19,6 +19,7 @@ var DEFAULT_CONFIG = {
19
19
  daemonInstanceId: "",
20
20
  daemonCredentialPath: "",
21
21
  controlPort: 3051,
22
+ controlHost: "127.0.0.1",
22
23
  stateDir: resolve(homedir(), ".ours-telegram"),
23
24
  pollTimeoutSec: 30,
24
25
  tgForceIpv4: true,
@@ -106,6 +107,8 @@ function envBool(name) {
106
107
  }
107
108
  function loadConfig() {
108
109
  const file = readFileConfig();
110
+ const controlHost = process.env.OURS_TG_CONTROL_HOST ?? "127.0.0.1";
111
+ if (controlHost !== "127.0.0.1" && controlHost !== "0.0.0.0") throw new Error("OURS_TG_CONTROL_HOST must be 127.0.0.1 or 0.0.0.0");
109
112
  return {
110
113
  // NOTE: no OURS_TG_BROKER_URL any more. The connector does not talk to a
111
114
  // broker — the daemon does. A stale one in a config file is now ignored
@@ -114,6 +117,7 @@ function loadConfig() {
114
117
  daemonStateDir: process.env.OURS_TG_DAEMON_STATE_DIR ?? file.daemonStateDir ?? DEFAULT_CONFIG.daemonStateDir,
115
118
  daemonInstanceId: process.env.OURS_TG_DAEMON_ID ?? file.daemonInstanceId ?? DEFAULT_CONFIG.daemonInstanceId,
116
119
  daemonCredentialPath: process.env.OURS_TG_DAEMON_CREDENTIAL_PATH ?? file.daemonCredentialPath ?? DEFAULT_CONFIG.daemonCredentialPath,
120
+ controlHost,
117
121
  controlPort: envInt("OURS_TG_CONTROL_PORT") ?? file.controlPort ?? DEFAULT_CONFIG.controlPort,
118
122
  stateDir: resolve(process.env.OURS_TG_STATE_DIR ?? file.stateDir ?? DEFAULT_CONFIG.stateDir),
119
123
  pollTimeoutSec: envInt("OURS_TG_POLL_TIMEOUT") ?? file.pollTimeoutSec ?? DEFAULT_CONFIG.pollTimeoutSec,
@@ -686,6 +690,9 @@ function usage() {
686
690
  async function main() {
687
691
  const cmd = process.argv[2] ?? "help";
688
692
  switch (cmd) {
693
+ case "capabilities":
694
+ out(JSON.stringify({ capabilities: ["telegram.gateway-listener-v1"] }));
695
+ return;
689
696
  case "serve":
690
697
  case "run": {
691
698
  fs2.mkdirSync(STATE_DIR, { recursive: true });
package/dist/connector.js CHANGED
@@ -25984,6 +25984,7 @@ var DEFAULT_CONFIG = {
25984
25984
  daemonInstanceId: "",
25985
25985
  daemonCredentialPath: "",
25986
25986
  controlPort: 3051,
25987
+ controlHost: "127.0.0.1",
25987
25988
  stateDir: resolve(homedir(), ".ours-telegram"),
25988
25989
  pollTimeoutSec: 30,
25989
25990
  tgForceIpv4: true,
@@ -26071,6 +26072,8 @@ function envBool(name) {
26071
26072
  }
26072
26073
  function loadConfig() {
26073
26074
  const file = readFileConfig();
26075
+ const controlHost = process.env.OURS_TG_CONTROL_HOST ?? "127.0.0.1";
26076
+ if (controlHost !== "127.0.0.1" && controlHost !== "0.0.0.0") throw new Error("OURS_TG_CONTROL_HOST must be 127.0.0.1 or 0.0.0.0");
26074
26077
  return {
26075
26078
  // NOTE: no OURS_TG_BROKER_URL any more. The connector does not talk to a
26076
26079
  // broker — the daemon does. A stale one in a config file is now ignored
@@ -26079,6 +26082,7 @@ function loadConfig() {
26079
26082
  daemonStateDir: process.env.OURS_TG_DAEMON_STATE_DIR ?? file.daemonStateDir ?? DEFAULT_CONFIG.daemonStateDir,
26080
26083
  daemonInstanceId: process.env.OURS_TG_DAEMON_ID ?? file.daemonInstanceId ?? DEFAULT_CONFIG.daemonInstanceId,
26081
26084
  daemonCredentialPath: process.env.OURS_TG_DAEMON_CREDENTIAL_PATH ?? file.daemonCredentialPath ?? DEFAULT_CONFIG.daemonCredentialPath,
26085
+ controlHost,
26082
26086
  controlPort: envInt("OURS_TG_CONTROL_PORT") ?? file.controlPort ?? DEFAULT_CONFIG.controlPort,
26083
26087
  stateDir: resolve(process.env.OURS_TG_STATE_DIR ?? file.stateDir ?? DEFAULT_CONFIG.stateDir),
26084
26088
  pollTimeoutSec: envInt("OURS_TG_POLL_TIMEOUT") ?? file.pollTimeoutSec ?? DEFAULT_CONFIG.pollTimeoutSec,
@@ -29078,8 +29082,8 @@ function startControlServer() {
29078
29082
  if (!res.headersSent) sendJson(res, 500, { ok: false, error: "internal error" });
29079
29083
  }
29080
29084
  });
29081
- server.listen(CONFIG.controlPort, "127.0.0.1", () => {
29082
- log(`control API on http://127.0.0.1:${CONFIG.controlPort} (POST/GET/DELETE /connections)`);
29085
+ server.listen(CONFIG.controlPort, CONFIG.controlHost, () => {
29086
+ log(`control API on http://${CONFIG.controlHost}:${CONFIG.controlPort} (POST/GET/DELETE /connections)`);
29083
29087
  });
29084
29088
  let shuttingDown = false;
29085
29089
  const shutdown = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ours.network/tg-connector",
3
- "version": "1.0.1-nightly.4",
3
+ "version": "1.0.1-nightly.6",
4
4
  "description": "Bridge Telegram bots to ours.network agents \u2014 attaches to an already-running ours daemon and bridges one Telegram chat/topic to one agent per route. Run `ours-tg-connector add_new_connection`.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-Apache-2.0",
@@ -37,15 +37,15 @@
37
37
  "test:v1-lifecycle": "node tests/v1-lifecycle.integration.mjs cli"
38
38
  },
39
39
  "dependencies": {
40
- "@ours.network/sdk": "3.8.1-nightly.10",
40
+ "@ours.network/sdk": "3.8.1-nightly.11",
41
41
  "undici": "^7.28.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@ours.network/cli": "2.8.1-nightly.8",
44
+ "@ours.network/cli": "2.8.1-nightly.9",
45
45
  "@types/node": "^20.14.0",
46
46
  "esbuild": "^0.24.2",
47
47
  "tsx": "^4.19.0",
48
48
  "typescript": "^5.5.4",
49
- "@ours.network/daemon": "3.8.1-nightly.2"
49
+ "@ours.network/daemon": "3.8.1-nightly.3"
50
50
  }
51
51
  }