@wolpertingerlabs/drawlatch 1.0.0-alpha.15.0 → 1.0.0-alpha.15.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.
@@ -1493,34 +1493,8 @@ export function createApp(options = {}) {
1493
1493
  });
1494
1494
  return app;
1495
1495
  }
1496
- // ── Tunnel readiness probe ───────────────────────────────────────────────
1497
- /**
1498
- * Wait for the tunnel to be fully connected by probing its /health endpoint.
1499
- *
1500
- * cloudflared emits the tunnel URL before the QUIC connection is fully
1501
- * established. Services like Trello validate the callback URL at registration
1502
- * time, so we need to wait until the tunnel is actually reachable.
1503
- */
1504
- async function waitForTunnelReady(tunnelUrl, timeoutMs) {
1505
- const start = Date.now();
1506
- while (Date.now() - start < timeoutMs) {
1507
- try {
1508
- const resp = await fetch(`${tunnelUrl}/health`, {
1509
- method: 'GET',
1510
- signal: AbortSignal.timeout(2000),
1511
- });
1512
- if (resp.ok) {
1513
- console.log('[remote] Tunnel connectivity verified');
1514
- return;
1515
- }
1516
- }
1517
- catch {
1518
- // Tunnel not ready yet — retry
1519
- }
1520
- await new Promise((r) => setTimeout(r, 500));
1521
- }
1522
- console.warn('[remote] Tunnel readiness probe timed out — webhook registration may fail');
1523
- }
1496
+ // waitForTunnelReady is now exported from tunnel.ts — imported dynamically
1497
+ // alongside startTunnel in the tunnel startup block below.
1524
1498
  // ── Start ──────────────────────────────────────────────────────────────────
1525
1499
  export function main() {
1526
1500
  console.log('[remote] Starting drawlatch server...');
@@ -1565,7 +1539,7 @@ export function main() {
1565
1539
  // process.env.DRAWLATCH_TUNNEL_URL is available during secret resolution.
1566
1540
  if (useTunnel) {
1567
1541
  try {
1568
- const { startTunnel } = await import('./tunnel.js');
1542
+ const { startTunnel, waitForTunnelReady } = await import('./tunnel.js');
1569
1543
  const tunnel = await startTunnel({ port, host });
1570
1544
  stopTunnel = tunnel.stop;
1571
1545
  process.env.DRAWLATCH_TUNNEL_URL = tunnel.url;
@@ -37,4 +37,17 @@ export declare function isCloudflaredAvailable(): Promise<boolean>;
37
37
  * emit a URL within the configured timeout.
38
38
  */
39
39
  export declare function startTunnel(options: TunnelOptions): Promise<TunnelResult>;
40
+ /**
41
+ * Wait for a tunnel to be fully connected by probing a URL through it.
42
+ *
43
+ * cloudflared emits the tunnel URL before the QUIC connection is fully
44
+ * established. Services like Trello validate the callback URL at registration
45
+ * time, so callers should wait until the tunnel is actually reachable before
46
+ * starting webhook ingestors.
47
+ *
48
+ * @param tunnelUrl The public tunnel URL to probe (e.g. https://abc.trycloudflare.com).
49
+ * @param timeoutMs How long to wait before giving up (default: 10 000 ms).
50
+ * @param probePath Path to probe on the tunnel (default: "/health").
51
+ */
52
+ export declare function waitForTunnelReady(tunnelUrl: string, timeoutMs?: number, probePath?: string): Promise<void>;
40
53
  //# sourceMappingURL=tunnel.d.ts.map
@@ -113,4 +113,37 @@ export async function startTunnel(options) {
113
113
  }
114
114
  });
115
115
  }
116
+ // ── Tunnel readiness probe ──────────────────────────────────────────────
117
+ /**
118
+ * Wait for a tunnel to be fully connected by probing a URL through it.
119
+ *
120
+ * cloudflared emits the tunnel URL before the QUIC connection is fully
121
+ * established. Services like Trello validate the callback URL at registration
122
+ * time, so callers should wait until the tunnel is actually reachable before
123
+ * starting webhook ingestors.
124
+ *
125
+ * @param tunnelUrl The public tunnel URL to probe (e.g. https://abc.trycloudflare.com).
126
+ * @param timeoutMs How long to wait before giving up (default: 10 000 ms).
127
+ * @param probePath Path to probe on the tunnel (default: "/health").
128
+ */
129
+ export async function waitForTunnelReady(tunnelUrl, timeoutMs = 10_000, probePath = '/health') {
130
+ const start = Date.now();
131
+ while (Date.now() - start < timeoutMs) {
132
+ try {
133
+ const resp = await fetch(`${tunnelUrl}${probePath}`, {
134
+ method: 'GET',
135
+ signal: AbortSignal.timeout(2000),
136
+ });
137
+ if (resp.ok) {
138
+ log.info('Tunnel connectivity verified');
139
+ return;
140
+ }
141
+ }
142
+ catch {
143
+ // Tunnel not ready yet — retry
144
+ }
145
+ await new Promise((r) => setTimeout(r, 500));
146
+ }
147
+ log.warn('Tunnel readiness probe timed out — webhook registration may fail');
148
+ }
116
149
  //# sourceMappingURL=tunnel.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolpertingerlabs/drawlatch",
3
- "version": "1.0.0-alpha.15.0",
3
+ "version": "1.0.0-alpha.15.2",
4
4
  "description": "Encrypted MCP proxy with mutual authentication. Local MCP server forwards requests through an encrypted channel to a remote secrets-holding server.",
5
5
  "type": "module",
6
6
  "main": "./dist/mcp/server.js",