@livx.cc/agentx 0.99.21 → 0.99.23
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/{Agent-CM7HL95r.d.ts → Agent-CSCWkq0C.d.ts} +1 -1
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +43 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +41 -2
- package/dist/index.js.map +1 -1
- package/dist/{mcp-2wyAAfPQ.d.ts → mcp-CM4Eq9Jf.d.ts} +1 -1
- package/dist/mcp.client.d.ts +2 -2
- package/dist/{tools-ClgFZjUr.d.ts → tools-hAKTlzty.d.ts} +10 -0
- package/dist/tools.shell.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as AgentOptions, H as Hooks, h as RunResult, A as Agent } from './Agent-
|
|
2
|
-
export { C as ChatFragment, D as DEFAULT_MUTATING, b as Decision, P as PermissionOptions, c as PermissionPolicy, d as PermissionRule, e as PreToolUseDecision, R as ReasoningEffort, f as RecordingHooks, g as RecordingLifecycle, T as ToolUse, i as ToolUseMeta, j as composeHooks, p as planMode, r as reasoningToChatFragment } from './Agent-
|
|
1
|
+
import { a as AgentOptions, H as Hooks, h as RunResult, A as Agent } from './Agent-CSCWkq0C.js';
|
|
2
|
+
export { C as ChatFragment, D as DEFAULT_MUTATING, b as Decision, P as PermissionOptions, c as PermissionPolicy, d as PermissionRule, e as PreToolUseDecision, R as ReasoningEffort, f as RecordingHooks, g as RecordingLifecycle, T as ToolUse, i as ToolUseMeta, j as composeHooks, p as planMode, r as reasoningToChatFragment } from './Agent-CSCWkq0C.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, h as ToolCall, H as HostBridge, U as UserQuestion, e as MessageContent } from './tools-
|
|
8
|
-
export { c as ContentPart, d as HostEvent, M as Message, R as Role, S as SandboxJobRegistry, f as StreamChunk, T as TodoItem, g as Tool, i as ToolContext, j as bashTool, k as contentText, l as defaultTools, m as editTool, n as exitSessionTool, o as imagePart, p as makeContext, q as makeJobTools, r as readTool, t as toWireTools, s as todoWriteTool, u as toolRegistry, v as toolsByName } from './tools-
|
|
7
|
+
import { A as AgentTool, C as ChatLike, a as ChatOptions, b as ChatResponse, h as ToolCall, H as HostBridge, U as UserQuestion, e as MessageContent } from './tools-hAKTlzty.js';
|
|
8
|
+
export { c as ContentPart, d as HostEvent, M as Message, R as Role, S as SandboxJobRegistry, f as StreamChunk, T as TodoItem, g as Tool, i as ToolContext, j as bashTool, k as contentText, l as defaultTools, m as editTool, n as exitSessionTool, o as imagePart, p as makeContext, q as makeJobTools, r as readTool, t as toWireTools, s as todoWriteTool, u as toolRegistry, v as toolsByName } from './tools-hAKTlzty.js';
|
|
9
9
|
import { SpokenSplitter } from '@bod.ee/voice';
|
|
10
10
|
export { AudioSink, AudioSource, AuthProvider, CartesiaTTS, CartesiaTTSOptions, STT_SAMPLE_RATE, SonioxSTT, SonioxSTTOptions, SttLike, TTS_SAMPLE_RATE, TtsLike, VoiceEngine, VoiceEngineOptions, VoiceState, resolveAuth } from '@bod.ee/voice';
|
|
11
|
-
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-
|
|
11
|
+
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-CM4Eq9Jf.js';
|
|
12
12
|
import * as libx_js_src_modules_log from 'libx.js/src/modules/log';
|
|
13
13
|
export { log } from 'libx.js/src/modules/log';
|
|
14
14
|
|
package/dist/index.js
CHANGED
|
@@ -3678,8 +3678,33 @@ var Agent = class _Agent {
|
|
|
3678
3678
|
usage.cacheCreationTokens += res.usage.cacheCreationTokens ?? 0;
|
|
3679
3679
|
usage.cacheReadTokens += res.usage.cacheReadTokens ?? 0;
|
|
3680
3680
|
}
|
|
3681
|
+
const delegatedTools = res.delegatedTools ?? [];
|
|
3682
|
+
if (delegatedTools.length) {
|
|
3683
|
+
const cap = this.options.maxToolResultBytes ?? 0;
|
|
3684
|
+
this.transcript.push({
|
|
3685
|
+
role: "assistant",
|
|
3686
|
+
content: "",
|
|
3687
|
+
tool_calls: delegatedTools.map((a) => ({ id: a.id, type: "function", function: { name: a.name || "tool", arguments: (() => {
|
|
3688
|
+
try {
|
|
3689
|
+
return JSON.stringify(a.input ?? {});
|
|
3690
|
+
} catch {
|
|
3691
|
+
return "{}";
|
|
3692
|
+
}
|
|
3693
|
+
})() } }))
|
|
3694
|
+
});
|
|
3695
|
+
for (const a of delegatedTools) {
|
|
3696
|
+
const out = typeof a.output === "string" ? a.output : a.output == null ? "" : (() => {
|
|
3697
|
+
try {
|
|
3698
|
+
return JSON.stringify(a.output);
|
|
3699
|
+
} catch {
|
|
3700
|
+
return String(a.output);
|
|
3701
|
+
}
|
|
3702
|
+
})();
|
|
3703
|
+
this.transcript.push({ role: "tool", tool_call_id: a.id, content: cap > 0 && out.length > cap ? cropResult(out, cap) : out });
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3681
3706
|
const toolCalls = res.toolCalls ?? [];
|
|
3682
|
-
const emptyTurn = toolCalls.length === 0 && contentText(res.content ?? "").trim() === "";
|
|
3707
|
+
const emptyTurn = toolCalls.length === 0 && delegatedTools.length === 0 && contentText(res.content ?? "").trim() === "";
|
|
3683
3708
|
if (!emptyTurn) {
|
|
3684
3709
|
this.transcript.push({
|
|
3685
3710
|
role: "assistant",
|
|
@@ -3778,6 +3803,8 @@ var Agent = class _Agent {
|
|
|
3778
3803
|
let finishReason;
|
|
3779
3804
|
let toolCalls;
|
|
3780
3805
|
let usage;
|
|
3806
|
+
const delegated = /* @__PURE__ */ new Map();
|
|
3807
|
+
const delegatedOrder = [];
|
|
3781
3808
|
for await (const chunk of stream) {
|
|
3782
3809
|
poke?.();
|
|
3783
3810
|
if (this.options.signal?.aborted) break;
|
|
@@ -3786,6 +3813,17 @@ var Agent = class _Agent {
|
|
|
3786
3813
|
const a = chunk.toolActivity;
|
|
3787
3814
|
const verb = a.status === "error" ? "\u2717" : a.status === "completed" ? "\u2713" : "\u2192";
|
|
3788
3815
|
this.options.host.notify({ kind: "tool_activity", id: a.id, name: a.name, input: a.input, output: a.output, status: a.status, truncated: a.truncated, message: `${verb} ${a.name}` });
|
|
3816
|
+
const key = a.id ?? `${a.name}:${delegatedOrder.length}`;
|
|
3817
|
+
const prev = delegated.get(key);
|
|
3818
|
+
if (!prev) {
|
|
3819
|
+
delegated.set(key, { id: key, name: a.name, input: a.input, output: a.output, status: a.status });
|
|
3820
|
+
delegatedOrder.push(key);
|
|
3821
|
+
} else {
|
|
3822
|
+
if (a.name) prev.name = a.name;
|
|
3823
|
+
if (a.input !== void 0) prev.input = a.input;
|
|
3824
|
+
if (a.output !== void 0) prev.output = a.output;
|
|
3825
|
+
prev.status = a.status;
|
|
3826
|
+
}
|
|
3789
3827
|
}
|
|
3790
3828
|
if (chunk.content) {
|
|
3791
3829
|
content += chunk.content;
|
|
@@ -3795,7 +3833,8 @@ var Agent = class _Agent {
|
|
|
3795
3833
|
if (chunk.toolCalls?.length) toolCalls = chunk.toolCalls;
|
|
3796
3834
|
if (chunk.usage) usage = chunk.usage;
|
|
3797
3835
|
}
|
|
3798
|
-
|
|
3836
|
+
const delegatedTools = delegatedOrder.map((k) => delegated.get(k));
|
|
3837
|
+
return { content, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {} };
|
|
3799
3838
|
}
|
|
3800
3839
|
async dispatch(tc) {
|
|
3801
3840
|
const tool = this.activeTools.find((t) => t.name === tc.function.name);
|