@livx.cc/agentx 0.99.19 → 0.99.21
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/README.md +1 -0
- package/dist/{Agent-Cn9BxS8h.d.ts → Agent-CM7HL95r.d.ts} +8 -3
- package/dist/cli.d.ts +7 -4
- package/dist/cli.js +162 -42
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +12 -7
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/{mcp-DopVRDLx.d.ts → mcp-2wyAAfPQ.d.ts} +1 -1
- package/dist/mcp.client.d.ts +2 -2
- package/dist/{tools-DKf3hN4M.d.ts → tools-ClgFZjUr.d.ts} +5 -0
- package/dist/tools.shell.d.ts +1 -1
- package/dist/tools.shell.js.map +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-CM7HL95r.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-CM7HL95r.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-ClgFZjUr.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-ClgFZjUr.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-2wyAAfPQ.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
|
|
|
@@ -596,8 +596,13 @@ declare function makeAskTool(o: AskOptions): AgentTool;
|
|
|
596
596
|
|
|
597
597
|
/**
|
|
598
598
|
* `AskUserQuestion` tool — lets the model pose a structured choice to a human.
|
|
599
|
-
* Delegates to `ctx.host.ask
|
|
600
|
-
*
|
|
599
|
+
* Delegates to `ctx.host.ask` when a human is reachable.
|
|
600
|
+
*
|
|
601
|
+
* When NO human is reachable (`host.ask` absent — headless `-p`, a piped/redirected run, an edge
|
|
602
|
+
* host), the question is NOT dropped and NOT guessed at: it parks on `ctx.needsInput`, and the
|
|
603
|
+
* Agent ends the run with `finishReason:'needs_input'` carrying the question up to the CALLER.
|
|
604
|
+
* The caller answers and resumes. Guessing silently is the failure mode this exists to prevent —
|
|
605
|
+
* a delegated agent that picks for you on a decision that was never its to make.
|
|
601
606
|
*/
|
|
602
607
|
declare const askUserQuestionTool: AgentTool;
|
|
603
608
|
/** Deterministic HostBridge for tests/dev: scripts answers + records what was asked. */
|
package/dist/index.js
CHANGED
|
@@ -1911,7 +1911,7 @@ ${out.replace(/\n+$/, "") || "(no output yet)"}`;
|
|
|
1911
1911
|
// src/host.ts
|
|
1912
1912
|
var askUserQuestionTool = {
|
|
1913
1913
|
name: "AskUserQuestion",
|
|
1914
|
-
description:
|
|
1914
|
+
description: 'Ask the user a multiple-choice question when a decision is genuinely theirs to make: an ambiguous or under-specified requirement, a fork you cannot resolve from context, a premise of the task that the evidence contradicts, or a risky/irreversible next step. Prefer this over guessing, "proceeding with best judgment", or quietly widening scope to make an unclear brief fit \u2014 a wrong silent decision is far more costly than a question. Returns their selection if a human is reachable; otherwise the run pauses and the question is handed to whoever delegated the task (you do not need to know which \u2014 just ask).',
|
|
1915
1915
|
parameters: {
|
|
1916
1916
|
type: "object",
|
|
1917
1917
|
required: ["question", "options"],
|
|
@@ -1927,8 +1927,8 @@ var askUserQuestionTool = {
|
|
|
1927
1927
|
},
|
|
1928
1928
|
async run(args, ctx) {
|
|
1929
1929
|
if (!ctx.host?.ask) {
|
|
1930
|
-
|
|
1931
|
-
return
|
|
1930
|
+
ctx.needsInput = args;
|
|
1931
|
+
return "PAUSED \u2014 no interactive user is reachable from this run, so your question has been raised to the caller that delegated this task. The run stops here; do not guess and do not continue. Their answer will arrive as the next user message when the run resumes.";
|
|
1932
1932
|
}
|
|
1933
1933
|
const answer = ctx.host.ask(args);
|
|
1934
1934
|
return ctx.parkHuman ? ctx.parkHuman(answer) : answer;
|
|
@@ -3579,6 +3579,7 @@ var Agent = class _Agent {
|
|
|
3579
3579
|
let usageEstimated = false;
|
|
3580
3580
|
const start = Date.now();
|
|
3581
3581
|
this.parkedMs = 0;
|
|
3582
|
+
this.ctx.needsInput = void 0;
|
|
3582
3583
|
let toolCallsTotal = 0;
|
|
3583
3584
|
let lastFp = "";
|
|
3584
3585
|
let repeats = 0;
|
|
@@ -3712,6 +3713,17 @@ var Agent = class _Agent {
|
|
|
3712
3713
|
}
|
|
3713
3714
|
this.transcript.push({ role: "tool", tool_call_id: tc.id, name: tc.function.name, content });
|
|
3714
3715
|
}
|
|
3716
|
+
if (this.ctx.needsInput) {
|
|
3717
|
+
const question = this.ctx.needsInput;
|
|
3718
|
+
this.ctx.needsInput = void 0;
|
|
3719
|
+
log4.warn(`needs_input: ${question.question} (steps=${steps})`);
|
|
3720
|
+
await this.ctx.jobs?.drain();
|
|
3721
|
+
const text = [
|
|
3722
|
+
`OPEN QUESTION (run paused \u2014 no human was reachable): ${question.question}`,
|
|
3723
|
+
...question.options.map((o2) => ` \u2022 ${o2.label}${o2.description ? ` \u2014 ${o2.description}` : ""}`)
|
|
3724
|
+
].join("\n");
|
|
3725
|
+
return { text, steps, finishReason: "needs_input", messages: this.transcript, usage, usageEstimated, question };
|
|
3726
|
+
}
|
|
3715
3727
|
this.drainInjections();
|
|
3716
3728
|
}
|
|
3717
3729
|
}
|