atlarix 14.39.3 → 14.40.0

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.
@@ -327521,14 +327521,40 @@ function isNetworkStreamError(err2) {
327521
327521
  if (err2?.name === "APICallError") {
327522
327522
  const retryable = err2.isRetryable;
327523
327523
  if (typeof retryable === "boolean") return retryable;
327524
- const code = errorStatusCode(err2);
327525
- if (code == null) return true;
327526
- return code === 429 || code >= 500;
327527
- }
327524
+ const code2 = errorStatusCode(err2);
327525
+ if (code2 == null) return true;
327526
+ return code2 === 429 || code2 >= 500;
327527
+ }
327528
+ const code = err2?.code;
327529
+ if (typeof code === "string" && [
327530
+ "UND_ERR_SOCKET",
327531
+ "UND_ERR_CONNECT_TIMEOUT",
327532
+ "UND_ERR_HEADERS_TIMEOUT",
327533
+ "UND_ERR_BODY_TIMEOUT",
327534
+ "UND_ERR_RESPONSE_STATUS_CODE",
327535
+ "ECONNRESET",
327536
+ "ETIMEDOUT",
327537
+ "EPIPE"
327538
+ ].includes(code))
327539
+ return true;
327528
327540
  const msg = String(err2?.message ?? err2);
327529
- return /terminated|fetch failed|ECONNRESET|ETIMEDOUT|socket hang up|premature close|connection (?:reset|refused|closed)|network/i.test(
327541
+ if (/terminated|fetch failed|ECONNRESET|ETIMEDOUT|socket hang up|premature close|other side closed|connection (?:reset|refused|closed)|network/i.test(
327530
327542
  msg
327531
- );
327543
+ ))
327544
+ return true;
327545
+ const cause = err2?.cause;
327546
+ if (cause && cause !== err2) {
327547
+ let depth = 0;
327548
+ let node2 = cause;
327549
+ while (node2 && depth < 4) {
327550
+ if (isNetworkStreamError(node2)) return true;
327551
+ const next = node2?.cause;
327552
+ if (next === node2) break;
327553
+ node2 = next;
327554
+ depth++;
327555
+ }
327556
+ }
327557
+ return false;
327532
327558
  }
327533
327559
  function isForcedToolChoiceRejection(err2) {
327534
327560
  if (!err2) return false;
@@ -336563,12 +336589,13 @@ async function runHeadlessAgent(opts) {
336563
336589
  }
336564
336590
 
336565
336591
  // src/headless/atlarix-headless.mts
336592
+ init_network_retry();
336566
336593
  if (!process.env.ATLARIX_MODELS_SNAPSHOT) {
336567
336594
  const here = path49.dirname(fileURLToPath2(import.meta.url));
336568
336595
  const shipped = path49.join(here, "models-snapshot.json.gz");
336569
336596
  if (fs39.existsSync(shipped)) process.env.ATLARIX_MODELS_SNAPSHOT = shipped;
336570
336597
  }
336571
- var VERSION15 = false ? "dev" : "14.39.3";
336598
+ var VERSION15 = false ? "dev" : "14.40.0";
336572
336599
  if (process.argv[2] === "run") process.argv.splice(2, 1);
336573
336600
  function arg(name29) {
336574
336601
  const i4 = process.argv.indexOf(`--${name29}`);
@@ -336634,6 +336661,17 @@ async function main() {
336634
336661
  );
336635
336662
  process.exit(res.completed ? 0 : 1);
336636
336663
  }
336664
+ process.on("unhandledRejection", (reason) => {
336665
+ if (isNetworkStreamError(reason)) {
336666
+ const detail = reason instanceof Error ? reason.message : String(reason);
336667
+ console.error(
336668
+ `[atlarix-headless] network fault absorbed, letting the turn retry: ${detail}`
336669
+ );
336670
+ return;
336671
+ }
336672
+ console.error("[atlarix-headless] fatal (unhandled rejection):", reason);
336673
+ process.exit(1);
336674
+ });
336637
336675
  main().catch((err2) => {
336638
336676
  console.error("[atlarix-headless] fatal:", err2);
336639
336677
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlarix",
3
- "version": "14.39.3",
3
+ "version": "14.40.0",
4
4
  "description": "Headless Atlarix coding agent — the Electron-free agent loop as a CLI, for benchmarks, CI and unattended runs.",
5
5
  "license": "PROPRIETARY",
6
6
  "author": {