instar 1.3.164 → 1.3.166

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAqwDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkwPtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAqwDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6xPtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -8852,6 +8852,36 @@ export async function startServer(options) {
8852
8852
  }
8853
8853
  };
8854
8854
  console.log(pc.green(' SessionRouter wired (L4) — inert until rollout stage advances past dark'));
8855
+ // bug #7: tokenless-standby outbound Telegram relay. TelegramAdapter.sendToTopic
8856
+ // only invokes this when the adapter has NO bot token (a pool standby serving a
8857
+ // session moved to it); a token-holding router never calls it. It relays the send
8858
+ // to the Telegram-OWNING lease holder's /telegram/reply, so a moved session's
8859
+ // replies reach the user without the standby ever sending on the shared bot
8860
+ // (preserving the single-Telegram-owner invariant — the 409-conflict guard).
8861
+ if (telegram) {
8862
+ telegram.outboundRelay = async (topicId, text, opts) => {
8863
+ const holder = coordinator.getSyncStatus().leaseHolder;
8864
+ if (!holder || holder === meshSelfId)
8865
+ return null; // we ARE the owner, or none known
8866
+ const url = peerUrl(holder);
8867
+ if (!url)
8868
+ return null;
8869
+ try {
8870
+ const resp = await fetch(`${url}/telegram/reply/${topicId}`, {
8871
+ method: 'POST',
8872
+ headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${config.authToken}` },
8873
+ body: JSON.stringify({ text, ...(opts?.silent ? { silent: true } : {}) }),
8874
+ });
8875
+ if (!resp.ok)
8876
+ return null;
8877
+ const j = (await resp.json().catch(() => ({})));
8878
+ return { messageId: j.messageId ?? 0, topicId };
8879
+ }
8880
+ catch {
8881
+ return null; // relay unreachable → sendToTopic surfaces the failure
8882
+ }
8883
+ };
8884
+ }
8855
8885
  // ── L4 transfer-by-nickname activation: the "move/run this on <nickname>"
8856
8886
  // trigger. The recognizer + planner are pure units; this wires them to the
8857
8887
  // pin store + ownership so a recognized command pins the topic to the named