@ours.network/tg-connector 1.0.1-nightly.13 → 1.0.1-nightly.15
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/dist/connector.js +18 -18
- package/package.json +4 -4
package/dist/connector.js
CHANGED
|
@@ -26208,9 +26208,9 @@ var I = 100 * 1024 * 1024;
|
|
|
26208
26208
|
var K = { brokerUrl: "wss://broker1.ours.network", port: 3050, stateDir: E(T(), ".ours"), gcIntervalMs: 36e5, historyMaxBytes: I, apiVisibility: "owner", apiAuthMode: "legacy" };
|
|
26209
26209
|
var $ = "daemon-token";
|
|
26210
26210
|
|
|
26211
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
26211
|
+
// node_modules/@ours.network/sdk/dist/chunk-CJT4XK7F.js
|
|
26212
26212
|
import { homedir as Ie } from "node:os";
|
|
26213
|
-
import { isAbsolute as
|
|
26213
|
+
import { isAbsolute as _e, join as be, resolve as ce } from "node:path";
|
|
26214
26214
|
import { randomBytes as z } from "node:crypto";
|
|
26215
26215
|
import { readFileSync as Se } from "node:fs";
|
|
26216
26216
|
import { homedir as Ae } from "node:os";
|
|
@@ -26384,12 +26384,12 @@ var U = class {
|
|
|
26384
26384
|
if (!u2.ok) throw new L(u2.status);
|
|
26385
26385
|
if (!u2.body || !u2.headers.get("content-type")?.startsWith("text/event-stream")) throw new Error("Invalid resource stream response");
|
|
26386
26386
|
l = u2.body.getReader();
|
|
26387
|
-
let g2 = new TextDecoder("utf-8", { fatal: true }), y2 = "", I2 = 0,
|
|
26387
|
+
let g2 = new TextDecoder("utf-8", { fatal: true }), y2 = "", I2 = 0, _ = false, S2, T2 = -1;
|
|
26388
26388
|
for (; ; ) {
|
|
26389
|
-
let { value:
|
|
26389
|
+
let { value: b2, done: x } = await l.read();
|
|
26390
26390
|
if (c(), x) throw new Error("Resource stream ended before disposal");
|
|
26391
|
-
if (I2 +=
|
|
26392
|
-
for (y2 += g2.decode(
|
|
26391
|
+
if (I2 += b2.byteLength, I2 > 8 * 1024 * 1024) throw new Error("Resource live input exceeds limit");
|
|
26392
|
+
for (y2 += g2.decode(b2, { stream: true }); ; ) {
|
|
26393
26393
|
c();
|
|
26394
26394
|
let w2 = /\r?\n\r?\n/.exec(y2);
|
|
26395
26395
|
if (!w2) break;
|
|
@@ -26404,8 +26404,8 @@ var U = class {
|
|
|
26404
26404
|
let J = A2.kind;
|
|
26405
26405
|
if (!["ready", "committed", "coverage", "resync"].includes(J)) throw new Error("Invalid resource frame kind");
|
|
26406
26406
|
if (S2 !== void 0 && (A2.producerGeneration !== S2 || A2.position < T2)) throw new Error("Resource stream continuity changed");
|
|
26407
|
-
if (S2 = A2.producerGeneration, T2 = A2.position, J === "ready")
|
|
26408
|
-
else if (
|
|
26407
|
+
if (S2 = A2.producerGeneration, T2 = A2.position, J === "ready") _ = true, a(45e3);
|
|
26408
|
+
else if (_) a(45e3);
|
|
26409
26409
|
else if (J !== "resync") throw new Error("Resource mutation before ready");
|
|
26410
26410
|
yield A2, c();
|
|
26411
26411
|
}
|
|
@@ -26690,7 +26690,7 @@ function Te(e2 = process.env) {
|
|
|
26690
26690
|
if (!e2.OURS_CONFIG.trim()) throw new R2("OURS_CONFIG must name a client profile");
|
|
26691
26691
|
return ce(e2.OURS_CONFIG);
|
|
26692
26692
|
}
|
|
26693
|
-
return
|
|
26693
|
+
return be(e2.HOME || Ie(), ".ours-client", "profile.json");
|
|
26694
26694
|
}
|
|
26695
26695
|
function Oe(e2) {
|
|
26696
26696
|
let t = (o) => {
|
|
@@ -26712,7 +26712,7 @@ function Oe(e2) {
|
|
|
26712
26712
|
} catch {
|
|
26713
26713
|
return t("endpoint must equal serverUrl/daemon");
|
|
26714
26714
|
}
|
|
26715
|
-
return typeof n.expectedInstanceId != "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n.expectedInstanceId) ? t("expectedInstanceId must be a lowercase UUID") : typeof n.credentialPath != "string" || !
|
|
26715
|
+
return typeof n.expectedInstanceId != "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n.expectedInstanceId) ? t("expectedInstanceId must be a lowercase UUID") : typeof n.credentialPath != "string" || !_e(n.credentialPath) || ce(n.credentialPath) !== n.credentialPath ? t("credentialPath must be an absolute normalized path") : Object.freeze({ serverUrl: r, endpoint: i, expectedInstanceId: n.expectedInstanceId, credentialPath: n.credentialPath });
|
|
26716
26716
|
}
|
|
26717
26717
|
function le(e2 = process.env) {
|
|
26718
26718
|
let t = Te(e2), n;
|
|
@@ -26881,15 +26881,15 @@ async function X(e2 = {}) {
|
|
|
26881
26881
|
if (o !== void 0) throw new Error("Instance selection cannot use an injected fetch");
|
|
26882
26882
|
let I2 = h2(g2);
|
|
26883
26883
|
if (c !== void 0 && !Array.isArray(c)) throw new Error("Instance selection requires a nonempty capability list");
|
|
26884
|
-
let
|
|
26885
|
-
if (!
|
|
26886
|
-
if (i === "external")
|
|
26887
|
-
else if (
|
|
26884
|
+
let _ = [...c ?? ["external-sessions-v1"]];
|
|
26885
|
+
if (!_.length || _.some((T2) => typeof T2 != "string" || !T2.trim())) throw new Error("Instance selection requires a nonempty capability list");
|
|
26886
|
+
if (i === "external") _.includes("external-sessions-v1") || _.push("external-sessions-v1");
|
|
26887
|
+
else if (_.includes("external-sessions-v1")) throw new Error("External capabilities require explicit sessionMode: external; refusing local-mode fallback");
|
|
26888
26888
|
{
|
|
26889
|
-
let T2 = await globalThis.fetch(m2(I2, "/selection"), { signal: s ? AbortSignal.any([s, AbortSignal.timeout(5e3)]) : AbortSignal.timeout(5e3), redirect: "error" }),
|
|
26890
|
-
if (!T2.ok || !
|
|
26891
|
-
let x =
|
|
26892
|
-
if (!Array.isArray(x) || x.some((w2) => typeof w2 != "string") ||
|
|
26889
|
+
let T2 = await globalThis.fetch(m2(I2, "/selection"), { signal: s ? AbortSignal.any([s, AbortSignal.timeout(5e3)]) : AbortSignal.timeout(5e3), redirect: "error" }), b2 = await P(T2);
|
|
26890
|
+
if (!T2.ok || !b2 || Object.keys(b2).length !== 3 || Object.keys(b2).some((w2) => !["schema", "instanceId", "capabilities"].includes(w2)) || b2.schema !== 1 || b2.instanceId !== a) throw new Error("Daemon instance selection metadata is absent, incompatible or mismatched");
|
|
26891
|
+
let x = b2.capabilities;
|
|
26892
|
+
if (!Array.isArray(x) || x.some((w2) => typeof w2 != "string") || _.some((w2) => !x.includes(w2))) throw new Error("Daemon does not support the required capabilities; refusing local-mode fallback");
|
|
26893
26893
|
}
|
|
26894
26894
|
let S2 = l === void 0 ? y2 : S(l);
|
|
26895
26895
|
if (typeof S2 != "string" || !S2.trim()) throw new Error("Instance selection requires an explicit API token after daemon verification");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/tg-connector",
|
|
3
|
-
"version": "1.0.1-nightly.
|
|
3
|
+
"version": "1.0.1-nightly.15",
|
|
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": "4.1.1-nightly.
|
|
40
|
+
"@ours.network/sdk": "4.1.1-nightly.3",
|
|
41
41
|
"undici": "^7.28.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@ours.network/cli": "3.1.1-nightly.
|
|
44
|
+
"@ours.network/cli": "3.1.1-nightly.3",
|
|
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": "4.1.1-nightly.
|
|
49
|
+
"@ours.network/daemon": "4.1.1-nightly.3"
|
|
50
50
|
}
|
|
51
51
|
}
|