@standardagents/builder 0.37.5 → 0.37.6

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.
@@ -13677,7 +13677,7 @@ var init_ThreadStateImpl = __esm({
13677
13677
  return bytes.buffer;
13678
13678
  }
13679
13679
  async readFileStream(path10, options) {
13680
- const fileInfo = await this._threadInstance.statFile(path10);
13680
+ const fileInfo = this._unwrapStatRecord(await this._threadInstance.statFile(path10));
13681
13681
  if (!fileInfo) {
13682
13682
  return null;
13683
13683
  }
@@ -13732,12 +13732,32 @@ var init_ThreadStateImpl = __esm({
13732
13732
  }
13733
13733
  };
13734
13734
  }
13735
+ /**
13736
+ * Unwrap the thread DO's `{ success, file }` stat envelope (older shapes
13737
+ * returned the record directly). A failed or absent lookup is NULL — the
13738
+ * old code mapped the envelope itself, producing a truthy record with
13739
+ * every field defaulted (size 0, application/octet-stream) even for
13740
+ * NONEXISTENT paths, which let a phantom asset pass an existence check and
13741
+ * a real 1.2MB image read as "0 bytes" (2026-08-11).
13742
+ */
13743
+ _unwrapStatRecord(result) {
13744
+ const record24 = result?.file ?? result;
13745
+ if (!record24 || typeof record24 !== "object") return null;
13746
+ if (!("path" in record24) && !("name" in record24)) return null;
13747
+ return record24;
13748
+ }
13735
13749
  async statFile(path10) {
13736
- const result = await this._threadInstance.statFile(path10);
13737
- return result ? this._mapFileRecord(result) : null;
13750
+ const record24 = this._unwrapStatRecord(await this._threadInstance.statFile(path10));
13751
+ return record24 ? this._mapFileRecord(record24) : null;
13738
13752
  }
13739
13753
  async readdirFile(path10) {
13740
- const entries = await this._threadInstance.readdirFile(path10);
13754
+ const result = await this._threadInstance.readdirFile(path10);
13755
+ const entries = Array.isArray(result) ? result : result?.files;
13756
+ if (!Array.isArray(entries)) {
13757
+ throw new Error(
13758
+ result?.error || `Could not list directory: ${path10}`
13759
+ );
13760
+ }
13741
13761
  return {
13742
13762
  entries: entries.map((e) => this._mapFileRecord(e))
13743
13763
  };
@@ -67967,7 +67987,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
67967
67987
  });
67968
67988
 
67969
67989
  // src/version.ts
67970
- var BUILDER_VERSION = "0.37.5".length > 0 ? "0.37.5" : "dev";
67990
+ var BUILDER_VERSION = "0.37.6".length > 0 ? "0.37.6" : "dev";
67971
67991
 
67972
67992
  // src/api/diagnostics.get.ts
67973
67993
  init_LLMRequest();