@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.
- package/dist/built-in-routes.js +25 -5
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +24 -4
- package/dist/runtime.js.map +1 -1
- package/package.json +5 -5
package/dist/runtime.js
CHANGED
|
@@ -14086,7 +14086,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
14086
14086
|
return bytes.buffer;
|
|
14087
14087
|
}
|
|
14088
14088
|
async readFileStream(path, options) {
|
|
14089
|
-
const fileInfo = await this._threadInstance.statFile(path);
|
|
14089
|
+
const fileInfo = this._unwrapStatRecord(await this._threadInstance.statFile(path));
|
|
14090
14090
|
if (!fileInfo) {
|
|
14091
14091
|
return null;
|
|
14092
14092
|
}
|
|
@@ -14141,12 +14141,32 @@ var init_ThreadStateImpl = __esm({
|
|
|
14141
14141
|
}
|
|
14142
14142
|
};
|
|
14143
14143
|
}
|
|
14144
|
+
/**
|
|
14145
|
+
* Unwrap the thread DO's `{ success, file }` stat envelope (older shapes
|
|
14146
|
+
* returned the record directly). A failed or absent lookup is NULL — the
|
|
14147
|
+
* old code mapped the envelope itself, producing a truthy record with
|
|
14148
|
+
* every field defaulted (size 0, application/octet-stream) even for
|
|
14149
|
+
* NONEXISTENT paths, which let a phantom asset pass an existence check and
|
|
14150
|
+
* a real 1.2MB image read as "0 bytes" (2026-08-11).
|
|
14151
|
+
*/
|
|
14152
|
+
_unwrapStatRecord(result) {
|
|
14153
|
+
const record = result?.file ?? result;
|
|
14154
|
+
if (!record || typeof record !== "object") return null;
|
|
14155
|
+
if (!("path" in record) && !("name" in record)) return null;
|
|
14156
|
+
return record;
|
|
14157
|
+
}
|
|
14144
14158
|
async statFile(path) {
|
|
14145
|
-
const
|
|
14146
|
-
return
|
|
14159
|
+
const record = this._unwrapStatRecord(await this._threadInstance.statFile(path));
|
|
14160
|
+
return record ? this._mapFileRecord(record) : null;
|
|
14147
14161
|
}
|
|
14148
14162
|
async readdirFile(path) {
|
|
14149
|
-
const
|
|
14163
|
+
const result = await this._threadInstance.readdirFile(path);
|
|
14164
|
+
const entries = Array.isArray(result) ? result : result?.files;
|
|
14165
|
+
if (!Array.isArray(entries)) {
|
|
14166
|
+
throw new Error(
|
|
14167
|
+
result?.error || `Could not list directory: ${path}`
|
|
14168
|
+
);
|
|
14169
|
+
}
|
|
14150
14170
|
return {
|
|
14151
14171
|
entries: entries.map((e) => this._mapFileRecord(e))
|
|
14152
14172
|
};
|