@livx.cc/agentx 0.99.43 → 0.99.45

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.
@@ -1,5 +1,5 @@
1
1
  import { IFilesystem } from '@livx.cc/wcli/core';
2
- import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, g as MessageContent, U as UserQuestion } from './tools-S-ArIR3o.js';
2
+ import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, g as MessageContent, U as UserQuestion } from './tools-BqL8Lk4J.js';
3
3
 
4
4
  /**
5
5
  * Hooks — deterministic interception points around tool execution, run by the
package/dist/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-f4um2q8E.js';
2
+ import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-Bzs57-iD.js';
3
3
  import { IFilesystem } from '@livx.cc/wcli/core';
4
- import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, g as MessageContent } from './tools-S-ArIR3o.js';
4
+ import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, g as MessageContent } from './tools-BqL8Lk4J.js';
5
5
 
6
6
  /**
7
7
  * On-disk session store for the CLI: each conversation is one JSON file at
package/dist/cli.js CHANGED
@@ -23,6 +23,9 @@ var init_logging = __esm({
23
23
  import { readFileSync, statSync as statSync2, realpathSync } from "fs";
24
24
  import { resolve, sep } from "path";
25
25
  import { randomBytes } from "crypto";
26
+ function passesBackReasoning(model) {
27
+ return !!model && /^(deepseek|moonshot)\//.test(model);
28
+ }
26
29
  function contentText(content) {
27
30
  if (content == null) return "";
28
31
  if (typeof content === "string") return content;
@@ -203,7 +206,7 @@ function sendBytes(messages, keepRecent = 1, stub = IMAGE_ELIDE_STUB) {
203
206
  }
204
207
  function sendBytesPer(messages, keepRecent = 1, stub = IMAGE_ELIDE_STUB) {
205
208
  const keep = messages.some(bearsImage) ? imageWindows(messages, keepRecent) : null;
206
- return messages.map((m, i) => wireBytes(m.content, keep == null || keep.has(i), stub) + (m.tool_calls ? JSON.stringify(m.tool_calls).length : 0));
209
+ return messages.map((m, i) => wireBytes(m.content, keep == null || keep.has(i), stub) + (m.tool_calls ? JSON.stringify(m.tool_calls).length : 0) + (m.reasoning_content?.length ?? 0));
207
210
  }
208
211
  function wireBytes(content, kept, stub) {
209
212
  const tool = toolImageRef(content);
@@ -4482,7 +4485,8 @@ var Agent = class _Agent {
4482
4485
  this.transcript.push({
4483
4486
  role: "assistant",
4484
4487
  content: res.content ?? "",
4485
- ...toolCalls.length ? { tool_calls: toolCalls } : {}
4488
+ ...toolCalls.length ? { tool_calls: toolCalls } : {},
4489
+ ...res.reasoningContent && passesBackReasoning(o.model) ? { reasoning_content: res.reasoningContent } : {}
4486
4490
  });
4487
4491
  }
4488
4492
  if (toolCalls.length === 0) {
@@ -4608,10 +4612,14 @@ var Agent = class _Agent {
4608
4612
  const delegatedOrder = [];
4609
4613
  let sawTool = false;
4610
4614
  let trailing = "";
4615
+ let reasoning = "";
4611
4616
  for await (const chunk of stream) {
4612
4617
  poke?.();
4613
4618
  if (this.options.signal?.aborted) break;
4614
- if (chunk.reasoningContent) this.options.host.notify({ kind: "thinking_delta", message: chunk.reasoningContent });
4619
+ if (chunk.reasoningContent) {
4620
+ reasoning += chunk.reasoningContent;
4621
+ this.options.host.notify({ kind: "thinking_delta", message: chunk.reasoningContent });
4622
+ }
4615
4623
  if (chunk.toolActivity) {
4616
4624
  const a = chunk.toolActivity;
4617
4625
  const verb = a.status === "error" ? "\u2717" : a.status === "completed" ? "\u2713" : "\u2192";
@@ -4642,7 +4650,7 @@ var Agent = class _Agent {
4642
4650
  }
4643
4651
  const delegatedTools = delegatedOrder.map((k) => delegated.get(k));
4644
4652
  const endedWithoutClosing = sawTool && (!trailing.trim() || endsOnAnnouncedAction(trailing));
4645
- return { content, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {}, ...endedWithoutClosing ? { endedWithoutClosing: true } : {} };
4653
+ return { content, ...reasoning ? { reasoningContent: reasoning } : {}, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {}, ...endedWithoutClosing ? { endedWithoutClosing: true } : {} };
4646
4654
  }
4647
4655
  /**
4648
4656
  * FABRICATED TOOL USE — the failure no call-reactive layer can see, because there IS no call.