@standardagents/builder 0.37.5 → 0.37.7

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 (33) hide show
  1. package/dist/built-in-routes.js +96 -5
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-Pk5oljVU.js → ApiKeysView-L85eJb6G.js} +1 -1
  4. package/dist/client/{CenteredContentView-HGpMGAQj.js → CenteredContentView-D9jkWoLc.js} +1 -1
  5. package/dist/client/{CompositionView-DN8dTOCO.js → CompositionView-BGp0EJCk.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang--j_hnMZ0.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-DgwqZrLV.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-CpJDcbZx.js → CopyButton.vue_vue_type_script_setup_true_lang-B8cGgU2J.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-unLrY-PY.js → DataTable.vue_vue_type_script_setup_true_lang-CRBXym9D.js} +1 -1
  9. package/dist/client/{JsonViewer-BYj_yrGB.js → JsonViewer-DkHnIfq3.js} +1 -1
  10. package/dist/client/{LoginView-CfVqItZV.js → LoginView-BXD9Odc-.js} +1 -1
  11. package/dist/client/{MarketplaceView-Cidt0nLf.js → MarketplaceView-DEnujUBs.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-C1dmm1HX.js → Modal.vue_vue_type_script_setup_true_lang-keKEwm3K.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-DIKLuPXT.js → ModelModal.vue_vue_type_script_setup_true_lang-t1n0bbJe.js} +1 -1
  14. package/dist/client/{ModelsView-DH6wNe38.js → ModelsView-BkCLr8sp.js} +1 -1
  15. package/dist/client/{PromptEditView-D_VjoAa-.js → PromptEditView-BjCfsJQE.js} +1 -1
  16. package/dist/client/{PromptModal-a9LTOWNt.js → PromptModal-nxu_LIv6.js} +1 -1
  17. package/dist/client/{PromptsView-BCCCryKR.js → PromptsView-1yXGCmEZ.js} +1 -1
  18. package/dist/client/{ProvidersView-CF4x5F6G.js → ProvidersView-DxF6gafk.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-D5VDoQiK.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-CjwWJ3uw.js} +14 -14
  20. package/dist/client/{ThreadsView-BzscU1l2.js → ThreadsView-CBup_w8u.js} +1 -1
  21. package/dist/client/{ToolsView-CeEtxDZV.js → ToolsView-B30TfXU9.js} +1 -1
  22. package/dist/client/{UsersView-Di5cmUYL.js → UsersView-kE7Xr4f3.js} +1 -1
  23. package/dist/client/{VariablesView-CXUr05jD.js → VariablesView-yYuynG0M.js} +1 -1
  24. package/dist/client/assets/{ThreadInspectorPane-D9ZMzSTn.css → ThreadInspectorPane-BRGO_P0_.css} +1 -1
  25. package/dist/client/{index-BMqXblce.js → index-AUGwDdSH.js} +2 -2
  26. package/dist/client/index.html +1 -1
  27. package/dist/index.js +31 -4
  28. package/dist/index.js.map +1 -1
  29. package/dist/plugin.js.map +1 -1
  30. package/dist/runtime.d.ts +0 -1
  31. package/dist/runtime.js +31 -4
  32. package/dist/runtime.js.map +1 -1
  33. package/package.json +5 -5
@@ -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.7".length > 0 ? "0.37.7" : "dev";
67971
67991
 
67972
67992
  // src/api/diagnostics.get.ts
67973
67993
  init_LLMRequest();
@@ -75585,6 +75605,76 @@ var messageId_patch_default = defineController2(async ({ req, params, env: env2
75585
75605
  }
75586
75606
  });
75587
75607
 
75608
+ // src/api/threads/[id]/public/[...path].ts
75609
+ var path_default4 = defineController2(async ({ req, params, env: env2 }) => {
75610
+ if (req.method !== "GET" && req.method !== "HEAD") {
75611
+ return Response.json({ error: "Method not allowed" }, { status: 405 });
75612
+ }
75613
+ const threadId = params.id;
75614
+ if (!threadId) {
75615
+ return Response.json({ error: "Thread ID required" }, { status: 400 });
75616
+ }
75617
+ const rawPathParam = params._ || params.path || params["*"] || "";
75618
+ const relative4 = rawPathParam === "public" ? "" : rawPathParam.replace(/^\/?public\//, "");
75619
+ const segments = [];
75620
+ for (const part of relative4.replace(/\\/g, "/").split("/")) {
75621
+ if (!part || part === ".") continue;
75622
+ if (part === "..") return notFound();
75623
+ segments.push(part);
75624
+ }
75625
+ if (segments.length === 0) return notFound();
75626
+ const path10 = `/public/${segments.join("/")}`;
75627
+ try {
75628
+ const durableId = env2.AGENT_BUILDER_THREAD.idFromName(threadId);
75629
+ const stub = env2.AGENT_BUILDER_THREAD.get(durableId);
75630
+ const statResult = await stub.statFile(path10);
75631
+ if (!statResult?.success) return notFound();
75632
+ const file = statResult.file;
75633
+ if (!file || file.isDirectory || file.storage !== "local") return notFound();
75634
+ const headers = {
75635
+ "Content-Type": file.mimeType || "application/octet-stream",
75636
+ "Content-Length": String(file.size),
75637
+ "Content-Disposition": `inline; filename="${file.name}"`,
75638
+ // Public files are mutable (unlike content-addressed assets): cache
75639
+ // briefly so shares are fast without pinning stale content for a year.
75640
+ "Cache-Control": "public, max-age=300"
75641
+ };
75642
+ if (req.method === "HEAD") return new Response(null, { headers });
75643
+ if (file.isChunked && file.chunkCount) {
75644
+ const { readable, writable } = new TransformStream();
75645
+ const writer = writable.getWriter();
75646
+ (async () => {
75647
+ try {
75648
+ for (let i = 0; i < file.chunkCount; i++) {
75649
+ const chunk = await stub.readFileChunk(path10, i);
75650
+ if (!chunk?.success) break;
75651
+ const binary2 = atob(chunk.data);
75652
+ const bytes2 = new Uint8Array(binary2.length);
75653
+ for (let j = 0; j < binary2.length; j++) bytes2[j] = binary2.charCodeAt(j);
75654
+ await writer.write(bytes2);
75655
+ }
75656
+ } finally {
75657
+ await writer.close().catch(() => {
75658
+ });
75659
+ }
75660
+ })();
75661
+ return new Response(readable, { headers });
75662
+ }
75663
+ const result = await stub.readFile(path10);
75664
+ if (!result?.success) return notFound();
75665
+ const binary = atob(result.data);
75666
+ const bytes = new Uint8Array(binary.length);
75667
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
75668
+ return new Response(bytes, { headers });
75669
+ } catch (error) {
75670
+ console.error(`Error serving public file for thread ${threadId}:`, error);
75671
+ return notFound();
75672
+ }
75673
+ });
75674
+ function notFound() {
75675
+ return Response.json({ error: "Not found" }, { status: 404 });
75676
+ }
75677
+
75588
75678
  // src/api/threads/[id]/variables/[requestId].get.ts
75589
75679
  var requestId_get_default = defineController2(async ({ req, params, env: env2 }) => {
75590
75680
  const authResult = await requireAuth(req, env2);
@@ -76229,6 +76319,7 @@ var routeHandlers = {
76229
76319
  "GET:/threads/:id/logs/:logId": logId_get_default,
76230
76320
  "DELETE:/threads/:id/messages/:messageId": messageId_delete_default,
76231
76321
  "PATCH:/threads/:id/messages/:messageId": messageId_patch_default,
76322
+ "GET:/threads/:id/public/**": path_default4,
76232
76323
  "GET:/threads/:id/variables/:requestId": requestId_get_default,
76233
76324
  "POST:/threads/:id/variables/:requestId": requestId_post_default,
76234
76325
  "POST:/threads/:id/effects/:effectId/cancel": cancel_post_default,