@cortexkit/aft 0.29.1 → 0.30.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.
Files changed (2) hide show
  1. package/dist/index.js +38 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11475,6 +11475,7 @@ var init_bridge = __esm(() => {
11475
11475
  onConfigureWarnings;
11476
11476
  onBashCompletion;
11477
11477
  onBashLongRunning;
11478
+ onBashPatternMatch;
11478
11479
  cachedStatus = null;
11479
11480
  statusListeners = new Set;
11480
11481
  configureWarningClients = new Map;
@@ -11492,6 +11493,7 @@ var init_bridge = __esm(() => {
11492
11493
  this.onConfigureWarnings = options?.onConfigureWarnings;
11493
11494
  this.onBashCompletion = options?.onBashCompletion;
11494
11495
  this.onBashLongRunning = options?.onBashLongRunning;
11496
+ this.onBashPatternMatch = options?.onBashPatternMatch;
11495
11497
  this.errorPrefix = options?.errorPrefix ?? "[aft-bridge]";
11496
11498
  this.logger = options?.logger;
11497
11499
  }
@@ -11984,6 +11986,10 @@ var init_bridge = __esm(() => {
11984
11986
  this.onBashLongRunning?.(response, this);
11985
11987
  continue;
11986
11988
  }
11989
+ if (response.type === "bash_pattern_match") {
11990
+ this.onBashPatternMatch?.(response, this);
11991
+ continue;
11992
+ }
11987
11993
  if (response.type === "configure_warnings") {
11988
11994
  this.handleConfigureWarningsFrame(response).catch((err) => {
11989
11995
  this.warnVia(`configure warning delivery failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -35980,18 +35986,40 @@ async function fetchUrlToTempFile(url, storageDir, options = {}) {
35980
35986
  }
35981
35987
  const chunks = [];
35982
35988
  let total = 0;
35983
- while (true) {
35984
- const { done, value } = await reader.read();
35985
- if (done)
35986
- break;
35987
- if (value) {
35988
- total += value.length;
35989
- if (total > MAX_RESPONSE_BYTES) {
35989
+ try {
35990
+ while (true) {
35991
+ let chunkTimer;
35992
+ const stallSymbol = Symbol("body-stall");
35993
+ const stallPromise = new Promise((resolve5) => {
35994
+ chunkTimer = setTimeout(() => resolve5(stallSymbol), BODY_CHUNK_TIMEOUT_MS);
35995
+ });
35996
+ let result;
35997
+ try {
35998
+ result = await Promise.race([reader.read(), stallPromise]);
35999
+ } finally {
36000
+ if (chunkTimer)
36001
+ clearTimeout(chunkTimer);
36002
+ }
36003
+ if (result === stallSymbol) {
35990
36004
  reader.cancel().catch(() => {});
35991
- throw new Error(`Response exceeded ${MAX_RESPONSE_BYTES} bytes, aborted`);
36005
+ throw new Error(`Body read stalled (no data for ${BODY_CHUNK_TIMEOUT_MS}ms) fetching ${url}`);
36006
+ }
36007
+ const { done, value } = result;
36008
+ if (done)
36009
+ break;
36010
+ if (value) {
36011
+ total += value.length;
36012
+ if (total > MAX_RESPONSE_BYTES) {
36013
+ reader.cancel().catch(() => {});
36014
+ throw new Error(`Response exceeded ${MAX_RESPONSE_BYTES} bytes, aborted`);
36015
+ }
36016
+ chunks.push(value);
35992
36017
  }
35993
- chunks.push(value);
35994
36018
  }
36019
+ } finally {
36020
+ try {
36021
+ reader.releaseLock();
36022
+ } catch {}
35995
36023
  }
35996
36024
  const body = Buffer.concat(chunks);
35997
36025
  const contentFile = contentPath(storageDir, hash, extension);
@@ -36047,7 +36075,7 @@ function cleanupUrlCache(storageDir) {
36047
36075
  log(`URL cache cleanup: removed ${removed} stale entries`);
36048
36076
  }
36049
36077
  }
36050
- var MAX_RESPONSE_BYTES, CACHE_TTL_MS, FETCH_TIMEOUT_MS = 30000, MAX_REDIRECTS = 5;
36078
+ var MAX_RESPONSE_BYTES, CACHE_TTL_MS, FETCH_TIMEOUT_MS = 30000, BODY_CHUNK_TIMEOUT_MS = 15000, MAX_REDIRECTS = 5;
36051
36079
  var init_url_fetch = __esm(() => {
36052
36080
  init_undici();
36053
36081
  init_active_logger();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.29.1",
3
+ "version": "0.30.0",
4
4
  "type": "module",
5
5
  "description": "Unified CLI for Agent File Tools (AFT) — setup, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^1.2.0",
26
- "@cortexkit/aft-bridge": "0.29.1",
26
+ "@cortexkit/aft-bridge": "0.30.0",
27
27
  "comment-json": "^4.6.2"
28
28
  },
29
29
  "devDependencies": {