@beeuni/agent-tunnel 0.1.1 → 0.1.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/dist/agent-cli.js CHANGED
@@ -4036,6 +4036,10 @@ function verifyMessageSignature(signingKey, payload, nonce, signature) {
4036
4036
 
4037
4037
  // src/agent/agent.ts
4038
4038
  var AGENT_VERSION = agentTunnelVersion();
4039
+ function openRelaySocket(url) {
4040
+ const RelaySocket = WebSocket;
4041
+ return new RelaySocket(url, { headers: { "User-Agent": `beeuni-agent-tunnel/${AGENT_VERSION}` } });
4042
+ }
4039
4043
  var AUTH_REJECTED_CLOSE_CODES = [4001, 4003];
4040
4044
  var RELAY_FAULT_4001_REASONS = new Set(["auth timeout", "authentication error", "authentication response failed"]);
4041
4045
  function isCredentialRejection(code, reason = "") {
@@ -4137,7 +4141,7 @@ class TunnelAgent {
4137
4141
  this.connectStartedAt = this.now();
4138
4142
  this.setStatus("connecting");
4139
4143
  try {
4140
- this.ws = new WebSocket(new URL(wsUrl));
4144
+ this.ws = openRelaySocket(new URL(wsUrl).href);
4141
4145
  this.setupWsHandlers();
4142
4146
  } catch (err) {
4143
4147
  log(`${c.red}✗${c.reset}`, `Connection failed`);
@@ -5677,17 +5681,17 @@ function probeCredentials(config, options = {}) {
5677
5681
  return new Promise((resolve3) => {
5678
5682
  let socket;
5679
5683
  try {
5680
- socket = new WebSocket(new URL(buildTunnelWsUrl(config)));
5684
+ socket = openRelaySocket(new URL(buildTunnelWsUrl(config)).href);
5681
5685
  } catch {
5682
5686
  resolve3("unreachable");
5683
5687
  return;
5684
5688
  }
5685
5689
  const settle = (result) => {
5686
5690
  clearTimeout(timer);
5691
+ resolve3(result);
5687
5692
  try {
5688
5693
  socket.close(1000, "probe complete");
5689
5694
  } catch {}
5690
- resolve3(result);
5691
5695
  };
5692
5696
  const timer = setTimeout(() => settle("unreachable"), options.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS);
5693
5697
  socket.addEventListener("open", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeuni/agent-tunnel",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Tunnel relay between cloud AI agents and local machines — server relay, local agent, client SDK, JSON-RPC, HMAC signing",