@cognipeer/agent-sdk 0.8.8 → 0.8.9

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/index.cjs CHANGED
@@ -4885,11 +4885,13 @@ var StructuredOutputManager = class {
4885
4885
  /**
4886
4886
  * Build a nudge message for when the model didn't produce structured output.
4887
4887
  * Used by the agent loop when it needs to retry.
4888
+ * User role is intentional: OpenAI-compatible chat templates such as Qwen
4889
+ * reject system messages anywhere except the beginning of the conversation.
4888
4890
  */
4889
4891
  buildNudgeMessage(isLastAttempt) {
4890
4892
  if (this.strategy.kind === "native") {
4891
4893
  return {
4892
- role: "system",
4894
+ role: "user",
4893
4895
  content: [
4894
4896
  "A structured output schema is active.",
4895
4897
  "You MUST respond with valid JSON matching the schema.",
@@ -4899,7 +4901,7 @@ var StructuredOutputManager = class {
4899
4901
  };
4900
4902
  }
4901
4903
  return {
4902
- role: "system",
4904
+ role: "user",
4903
4905
  content: [
4904
4906
  "A structured output schema is active.",
4905
4907
  "You MUST now call tool `response` with the final JSON object that matches the schema.",
@@ -4917,7 +4919,7 @@ var StructuredOutputManager = class {
4917
4919
  const fieldIssues = error.fieldErrors.map((f) => `- "${f.path}": ${f.message} (received: ${JSON.stringify(f.received)})`).join("\n");
4918
4920
  const action = this.strategy.kind === "native" ? "Please output corrected JSON matching the schema." : "Please call `response` again with corrected values matching the schema.";
4919
4921
  return {
4920
- role: "system",
4922
+ role: "user",
4921
4923
  content: [
4922
4924
  "Your previous structured output had validation errors:",
4923
4925
  fieldIssues,