@livx.cc/agentx 0.99.44 → 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.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-f4um2q8E.js';
2
- export { C as ChatFragment, b as CompactResult, D as DEFAULT_MUTATING, c as Decision, P as PermissionOptions, d as PermissionPolicy, e as PermissionRule, f as PreToolUseDecision, R as ReasoningEffort, g as RecordingHooks, h as RecordingLifecycle, T as ToolUse, j as ToolUseMeta, k as composeHooks, l as estimateTokens, p as planMode, r as reasoningToChatFragment } from './Agent-f4um2q8E.js';
1
+ import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-Bzs57-iD.js';
2
+ export { C as ChatFragment, b as CompactResult, D as DEFAULT_MUTATING, c as Decision, P as PermissionOptions, d as PermissionPolicy, e as PermissionRule, f as PreToolUseDecision, R as ReasoningEffort, g as RecordingHooks, h as RecordingLifecycle, T as ToolUse, j as ToolUseMeta, k as composeHooks, l as estimateTokens, p as planMode, r as reasoningToChatFragment } from './Agent-Bzs57-iD.js';
3
3
  export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
4
4
  import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
5
5
  export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
6
6
  import { BodDB } from '@bod.ee/db';
7
- import { A as AgentTool, C as ChatLike, a as ChatOptions, b as ChatResponse, j as ToolCall, H as HostBridge, U as UserQuestion, g as MessageContent } from './tools-S-ArIR3o.js';
8
- export { c as ContentPart, d as HostEvent, I as IMAGE_ELIDE_STUB, e as IMAGE_REF_SCHEME, f as ImageRef, M as Message, R as Role, S as SandboxJobRegistry, h as StreamChunk, T as TodoItem, i as Tool, k as ToolContext, l as bashTool, m as clearImageRefs, n as contentBytes, o as contentText, p as defaultTools, q as editTool, r as elideImages, s as elideInlineImages, t as elideStaleImages, u as exitSessionTool, v as expandImagesForSend, w as imagePart, x as imageRefPart, y as imageRefResult, z as makeContext, B as makeJobTools, D as messageHasImage, E as messageHasImageRef, F as messageHasInlineImage, G as mintImageRef, J as parseImageRef, K as readTool, L as remintImageRefs, N as sendBytes, O as sendBytesPer, P as toWireTools, Q as todoWriteTool, V as toolImageRef, W as toolRegistry, X as toolsByName } from './tools-S-ArIR3o.js';
7
+ import { A as AgentTool, C as ChatLike, a as ChatOptions, b as ChatResponse, j as ToolCall, H as HostBridge, U as UserQuestion, g as MessageContent } from './tools-BqL8Lk4J.js';
8
+ export { c as ContentPart, d as HostEvent, I as IMAGE_ELIDE_STUB, e as IMAGE_REF_SCHEME, f as ImageRef, M as Message, R as Role, S as SandboxJobRegistry, h as StreamChunk, T as TodoItem, i as Tool, k as ToolContext, l as bashTool, m as clearImageRefs, n as contentBytes, o as contentText, p as defaultTools, q as editTool, r as elideImages, s as elideInlineImages, t as elideStaleImages, u as exitSessionTool, v as expandImagesForSend, w as imagePart, x as imageRefPart, y as imageRefResult, z as makeContext, B as makeJobTools, D as messageHasImage, E as messageHasImageRef, F as messageHasInlineImage, G as mintImageRef, J as parseImageRef, K as readTool, L as remintImageRefs, N as sendBytes, O as sendBytesPer, P as toWireTools, Q as todoWriteTool, V as toolImageRef, W as toolRegistry, X as toolsByName } from './tools-BqL8Lk4J.js';
9
9
  import { ShellJobRegistry } from './tools.shell.js';
10
10
  import { SpokenSplitter } from '@bod.ee/voice';
11
11
  export { AudioSink, AudioSource, AuthProvider, CartesiaTTS, CartesiaTTSOptions, STT_SAMPLE_RATE, SonioxSTT, SonioxSTTOptions, SttLike, TTS_SAMPLE_RATE, TtsLike, VoiceEngine, VoiceEngineOptions, VoiceState, resolveAuth } from '@bod.ee/voice';
12
- export { M as McpCall, a as McpImage, b as McpRoute, c as McpRouteResolver, d as McpToolResult, e as McpToolSearchOptions, f as McpToolSpec, g as MountedMcpLike, h as buildMcpCatalog, m as makeLazyMcpToolSearch, i as makeMcpToolSearch, j as makeMcpToolSearchFromMounted, k as mcpToolToAgentTool, l as mcpToolsToAgentTools } from './mcp-D5eN0JyQ.js';
12
+ export { M as McpCall, a as McpImage, b as McpRoute, c as McpRouteResolver, d as McpToolResult, e as McpToolSearchOptions, f as McpToolSpec, g as MountedMcpLike, h as buildMcpCatalog, m as makeLazyMcpToolSearch, i as makeMcpToolSearch, j as makeMcpToolSearchFromMounted, k as mcpToolToAgentTool, l as mcpToolsToAgentTools } from './mcp-kgG6rtsd.js';
13
13
  import * as libx_js_src_modules_log from 'libx.js/src/modules/log';
14
14
  export { log } from 'libx.js/src/modules/log';
15
15
 
package/dist/index.js CHANGED
@@ -22,6 +22,9 @@ var init_logging = __esm({
22
22
  import { readFileSync, statSync, realpathSync } from "fs";
23
23
  import { resolve, sep } from "path";
24
24
  import { randomBytes } from "crypto";
25
+ function passesBackReasoning(model) {
26
+ return !!model && /^(deepseek|moonshot)\//.test(model);
27
+ }
25
28
  function contentText(content) {
26
29
  if (content == null) return "";
27
30
  if (typeof content === "string") return content;
@@ -205,7 +208,7 @@ function sendBytes(messages, keepRecent = 1, stub = IMAGE_ELIDE_STUB) {
205
208
  }
206
209
  function sendBytesPer(messages, keepRecent = 1, stub = IMAGE_ELIDE_STUB) {
207
210
  const keep = messages.some(bearsImage) ? imageWindows(messages, keepRecent) : null;
208
- return messages.map((m, i) => wireBytes(m.content, keep == null || keep.has(i), stub) + (m.tool_calls ? JSON.stringify(m.tool_calls).length : 0));
211
+ 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));
209
212
  }
210
213
  function wireBytes(content, kept, stub) {
211
214
  const tool = toolImageRef(content);
@@ -4468,7 +4471,8 @@ var Agent = class _Agent {
4468
4471
  this.transcript.push({
4469
4472
  role: "assistant",
4470
4473
  content: res.content ?? "",
4471
- ...toolCalls.length ? { tool_calls: toolCalls } : {}
4474
+ ...toolCalls.length ? { tool_calls: toolCalls } : {},
4475
+ ...res.reasoningContent && passesBackReasoning(o.model) ? { reasoning_content: res.reasoningContent } : {}
4472
4476
  });
4473
4477
  }
4474
4478
  if (toolCalls.length === 0) {
@@ -4594,10 +4598,14 @@ var Agent = class _Agent {
4594
4598
  const delegatedOrder = [];
4595
4599
  let sawTool = false;
4596
4600
  let trailing = "";
4601
+ let reasoning = "";
4597
4602
  for await (const chunk of stream) {
4598
4603
  poke?.();
4599
4604
  if (this.options.signal?.aborted) break;
4600
- if (chunk.reasoningContent) this.options.host.notify({ kind: "thinking_delta", message: chunk.reasoningContent });
4605
+ if (chunk.reasoningContent) {
4606
+ reasoning += chunk.reasoningContent;
4607
+ this.options.host.notify({ kind: "thinking_delta", message: chunk.reasoningContent });
4608
+ }
4601
4609
  if (chunk.toolActivity) {
4602
4610
  const a = chunk.toolActivity;
4603
4611
  const verb = a.status === "error" ? "\u2717" : a.status === "completed" ? "\u2713" : "\u2192";
@@ -4628,7 +4636,7 @@ var Agent = class _Agent {
4628
4636
  }
4629
4637
  const delegatedTools = delegatedOrder.map((k) => delegated.get(k));
4630
4638
  const endedWithoutClosing = sawTool && (!trailing.trim() || endsOnAnnouncedAction(trailing));
4631
- return { content, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {}, ...endedWithoutClosing ? { endedWithoutClosing: true } : {} };
4639
+ return { content, ...reasoning ? { reasoningContent: reasoning } : {}, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {}, ...endedWithoutClosing ? { endedWithoutClosing: true } : {} };
4632
4640
  }
4633
4641
  /**
4634
4642
  * FABRICATED TOOL USE — the failure no call-reactive layer can see, because there IS no call.