@workos/quickstudy 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workos/quickstudy",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "An open-source, company-agnostic eval harness for measuring whether coding agents can complete real integration tasks, across an agent x feature x framework x surface matrix.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ export const EMBEDDED_BUILD_INFO: {
9
9
  // (the `x-release-please-version` marker anchors the replacement). It is
10
10
  // restored as-is after a binary build (scripts/build-binary.ts), so the
11
11
  // committed source `--version` stays in lockstep with package.json.
12
- version: "0.6.0", // x-release-please-version
12
+ version: "0.6.1", // x-release-please-version
13
13
  revision: null,
14
14
  dirty: null,
15
15
  sourceHash: null,
@@ -534,13 +534,28 @@ function dialUpstream(client: Socket, host: string, port: number, ready: (upstre
534
534
  });
535
535
  }
536
536
 
537
- /** Bidirectional tunnel wiring shared by CONNECT and plain forwards. */
537
+ /**
538
+ * Bidirectional tunnel wiring shared by CONNECT and plain forwards.
539
+ *
540
+ * \`pipe()\` already ends the destination once the source ends — after the
541
+ * buffered bytes have flushed. Destroying the client on the upstream's
542
+ * \`close\` threw that buffer away: an upstream that closes right after a
543
+ * large response (a registry tarball) left the client with a truncated body
544
+ * and an ECONNRESET, so \`npm install\` through the proxy failed at random.
545
+ * So the upstream's close only ENDS the client (flush, then FIN). The other
546
+ * direction stays a destroy: a client that is gone will never read what the
547
+ * upstream still has to say, and a merely ended upstream would sit paused
548
+ * and half-open until the origin gave up.
549
+ */
538
550
  function pipeBoth(client: Socket, upstream: Socket): void {
539
551
  client.pipe(upstream);
540
552
  upstream.pipe(client);
541
- client.on("close", () => upstream.destroy());
542
- upstream.on("close", () => client.destroy());
543
553
  client.on("error", () => upstream.destroy());
554
+ upstream.on("error", () => client.destroy());
555
+ client.on("close", () => upstream.destroy());
556
+ upstream.on("close", () => {
557
+ if (!client.writableEnded) client.end();
558
+ });
544
559
  }
545
560
 
546
561
  /** CONNECT host:port — the HTTPS path. The tunnel is opaque to the proxy. */
@@ -252,13 +252,28 @@ function dialUpstream(client: Socket, host: string, port: number, ready: (upstre
252
252
  });
253
253
  }
254
254
 
255
- /** Bidirectional tunnel wiring shared by CONNECT and plain forwards. */
255
+ /**
256
+ * Bidirectional tunnel wiring shared by CONNECT and plain forwards.
257
+ *
258
+ * `pipe()` already ends the destination once the source ends — after the
259
+ * buffered bytes have flushed. Destroying the client on the upstream's
260
+ * `close` threw that buffer away: an upstream that closes right after a
261
+ * large response (a registry tarball) left the client with a truncated body
262
+ * and an ECONNRESET, so `npm install` through the proxy failed at random.
263
+ * So the upstream's close only ENDS the client (flush, then FIN). The other
264
+ * direction stays a destroy: a client that is gone will never read what the
265
+ * upstream still has to say, and a merely ended upstream would sit paused
266
+ * and half-open until the origin gave up.
267
+ */
256
268
  function pipeBoth(client: Socket, upstream: Socket): void {
257
269
  client.pipe(upstream);
258
270
  upstream.pipe(client);
259
- client.on("close", () => upstream.destroy());
260
- upstream.on("close", () => client.destroy());
261
271
  client.on("error", () => upstream.destroy());
272
+ upstream.on("error", () => client.destroy());
273
+ client.on("close", () => upstream.destroy());
274
+ upstream.on("close", () => {
275
+ if (!client.writableEnded) client.end();
276
+ });
262
277
  }
263
278
 
264
279
  /** CONNECT host:port — the HTTPS path. The tunnel is opaque to the proxy. */