@agentionai/agents 1.10.2 → 1.10.3

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.
@@ -115,9 +115,12 @@ export declare class LlamaCppAgent extends OpenAICompatibleAgent {
115
115
  * A no-op if no streamed completion is in flight yet (`lastChunkId` unset).
116
116
  * Best-effort: a failed request is logged (when `debug` is on) rather than
117
117
  * thrown, since this is a side channel to a turn that should otherwise
118
- * proceed normally.
118
+ * proceed normally. The endpoint reports failure (e.g. a completion that
119
+ * already finished) as `{success: false}` inside a 200 response rather than
120
+ * an HTTP error, so a non-throwing rejection has to be read from the body.
119
121
  */
120
122
  skipReasoning(): Promise<void>;
123
+ private logSkipReasoningFailure;
121
124
  }
122
125
  export {};
123
126
  //# sourceMappingURL=LlamaCppAgent.d.ts.map
@@ -86,13 +86,15 @@ class LlamaCppAgent extends OpenAICompatibleAgent_1.OpenAICompatibleAgent {
86
86
  * A no-op if no streamed completion is in flight yet (`lastChunkId` unset).
87
87
  * Best-effort: a failed request is logged (when `debug` is on) rather than
88
88
  * thrown, since this is a side channel to a turn that should otherwise
89
- * proceed normally.
89
+ * proceed normally. The endpoint reports failure (e.g. a completion that
90
+ * already finished) as `{success: false}` inside a 200 response rather than
91
+ * an HTTP error, so a non-throwing rejection has to be read from the body.
90
92
  */
91
93
  async skipReasoning() {
92
94
  if (!this.lastChunkId)
93
95
  return;
94
96
  try {
95
- await fetch(`${this.config.baseURL}/chat/completions/control`, {
97
+ const res = await fetch(`${this.config.baseURL}/chat/completions/control`, {
96
98
  method: "POST",
97
99
  headers: { "Content-Type": "application/json" },
98
100
  body: JSON.stringify({
@@ -101,11 +103,18 @@ class LlamaCppAgent extends OpenAICompatibleAgent_1.OpenAICompatibleAgent {
101
103
  model: this.config.model,
102
104
  }),
103
105
  });
106
+ const body = (await res.json().catch(() => undefined));
107
+ if (!res.ok || body?.success === false) {
108
+ this.logSkipReasoningFailure(body?.message ?? `HTTP ${res.status}`);
109
+ }
104
110
  }
105
111
  catch (error) {
106
- if (this.debug) {
107
- console.error(`Failed to signal reasoning_end to ${this.getVendorName()}: ${error instanceof Error ? error.message : "Unknown error"}`);
108
- }
112
+ this.logSkipReasoningFailure(error instanceof Error ? error.message : "Unknown error");
113
+ }
114
+ }
115
+ logSkipReasoningFailure(reason) {
116
+ if (this.debug) {
117
+ console.error(`Failed to signal reasoning_end to ${this.getVendorName()}: ${reason}`);
109
118
  }
110
119
  }
111
120
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentionai/agents",
3
3
  "author": "Laurent Zuijdwijk",
4
- "version": "1.10.2",
4
+ "version": "1.10.3",
5
5
  "description": "Agent Library",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",