@acmecloud/core 1.0.9 → 1.0.10

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.
@@ -281,6 +281,21 @@ export async function* runAgent(provider, modelName, messages, systemPrompt, abo
281
281
  return [];
282
282
  }
283
283
  else {
284
+ // Check if this is a content safety error (should not retry)
285
+ const errorMessage = err.message?.toLowerCase() || "";
286
+ const isContentSafetyError = errorMessage.includes("sensitive_words_detected") ||
287
+ errorMessage.includes("content_policy") ||
288
+ errorMessage.includes("safety") ||
289
+ errorMessage.includes("content_filter");
290
+ if (isContentSafetyError) {
291
+ // Content safety errors should not be retried - they won't succeed by retrying
292
+ yield {
293
+ type: "text",
294
+ text: `\n[Content Safety Error: ${err.message}]\n\nThis request triggered the content safety filter. Please modify your request to avoid sensitive topics and try again.\n`,
295
+ };
296
+ yield { type: "messages", messages: currentMessages };
297
+ return [];
298
+ }
284
299
  yield {
285
300
  type: "text",
286
301
  text: `\n[Error: ${err.message}]\n[Auto-recovering from stream drop...]\n`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acmecloud/core",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -363,6 +363,24 @@ export async function* runAgent(
363
363
  yield { type: "messages", messages: currentMessages };
364
364
  return [];
365
365
  } else {
366
+ // Check if this is a content safety error (should not retry)
367
+ const errorMessage = err.message?.toLowerCase() || "";
368
+ const isContentSafetyError =
369
+ errorMessage.includes("sensitive_words_detected") ||
370
+ errorMessage.includes("content_policy") ||
371
+ errorMessage.includes("safety") ||
372
+ errorMessage.includes("content_filter");
373
+
374
+ if (isContentSafetyError) {
375
+ // Content safety errors should not be retried - they won't succeed by retrying
376
+ yield {
377
+ type: "text",
378
+ text: `\n[Content Safety Error: ${err.message}]\n\nThis request triggered the content safety filter. Please modify your request to avoid sensitive topics and try again.\n`,
379
+ };
380
+ yield { type: "messages", messages: currentMessages };
381
+ return [];
382
+ }
383
+
366
384
  yield {
367
385
  type: "text",
368
386
  text: `\n[Error: ${err.message}]\n[Auto-recovering from stream drop...]\n`,