@standardagents/builder 0.37.2 → 0.37.4

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.
@@ -9983,10 +9983,18 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
9983
9983
  const mimeType = match2[1];
9984
9984
  const base64Data = match2[2];
9985
9985
  const ext = mimeType.split("/")[1] || "png";
9986
+ if (base64Data.length < 64) {
9987
+ console.error("[FlowEngine] Generated image payload is empty/truncated, skipping");
9988
+ continue;
9989
+ }
9986
9990
  const attachmentId = crypto.randomUUID();
9987
9991
  const path10 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
9988
9992
  try {
9989
- await state.thread.instance.writeFile(path10, base64Data, mimeType);
9993
+ const written = await state.thread.instance.writeFile(path10, base64Data, mimeType);
9994
+ if (written && written.success === false) {
9995
+ console.error("[FlowEngine] Generated image write failed:", written.error);
9996
+ continue;
9997
+ }
9990
9998
  if (image.id) {
9991
9999
  imagePathMap.set(image.id, path10);
9992
10000
  }
@@ -10053,10 +10061,18 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
10053
10061
  const mimeType = imageUrl.slice(dataPrefix.length, base64Index);
10054
10062
  const base64Data = imageUrl.slice(base64Index + base64Marker.length);
10055
10063
  const ext = mimeType.split("/")[1] || "png";
10064
+ if (base64Data.length < 64) {
10065
+ console.error(`[FlowEngine] ${toolName} image payload is empty/truncated, skipping`);
10066
+ continue;
10067
+ }
10056
10068
  const attachmentId = crypto.randomUUID();
10057
10069
  const path10 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
10058
10070
  try {
10059
- await state.thread.instance.writeFile(path10, base64Data, mimeType);
10071
+ const written = await state.thread.instance.writeFile(path10, base64Data, mimeType);
10072
+ if (written && written.success === false) {
10073
+ console.error(`[FlowEngine] ${toolName} image write failed:`, written.error);
10074
+ continue;
10075
+ }
10060
10076
  const attachmentRef = {
10061
10077
  id: attachmentId,
10062
10078
  type: "file",
@@ -13894,14 +13910,17 @@ var init_ThreadStateImpl = __esm({
13894
13910
  * dispatcher recorded in the runtime context instead.
13895
13911
  */
13896
13912
  _getRuntimeEnv() {
13913
+ const contextEnv = this._runtimeContext.env;
13914
+ if (contextEnv?.AGENT_BUILDER) {
13915
+ return contextEnv;
13916
+ }
13897
13917
  const instanceEnv = this._threadInstance.env;
13898
- const env2 = instanceEnv?.AGENT_BUILDER ? instanceEnv : this._runtimeContext.env;
13899
- if (!env2?.AGENT_BUILDER) {
13918
+ if (!instanceEnv?.AGENT_BUILDER) {
13900
13919
  throw new Error(
13901
13920
  "No runtime environment available on this ThreadState. Stub-backed states must be constructed with runtimeContext.env."
13902
13921
  );
13903
13922
  }
13904
- return env2;
13923
+ return instanceEnv;
13905
13924
  }
13906
13925
  /** The per-user hub stub for this thread's user (user-scope surfaces). */
13907
13926
  _getUserHubStub(userId) {
@@ -67909,7 +67928,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
67909
67928
  });
67910
67929
 
67911
67930
  // src/version.ts
67912
- var BUILDER_VERSION = "0.37.2".length > 0 ? "0.37.2" : "dev";
67931
+ var BUILDER_VERSION = "0.37.4".length > 0 ? "0.37.4" : "dev";
67913
67932
 
67914
67933
  // src/api/diagnostics.get.ts
67915
67934
  init_LLMRequest();