@livx.cc/agentx 0.99.36 → 0.99.38
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-Fr8uwN_l.d.ts → Agent-DJwg1g8V.d.ts} +26 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +25 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-
|
|
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-
|
|
1
|
+
import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-DJwg1g8V.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-DJwg1g8V.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';
|
package/dist/index.js
CHANGED
|
@@ -4064,7 +4064,8 @@ var Agent = class _Agent {
|
|
|
4064
4064
|
const kill = (finishReason) => {
|
|
4065
4065
|
log6.warn(`kill-switch: ${finishReason} (steps=${steps}, tokens=${usage.totalTokens}, budgetTokens=${Math.round(usage.totalTokens - 0.9 * usage.cacheReadTokens)}, ms=${Date.now() - start - this.parkedMs}${finishReason === "timeout" ? `, idle=${Date.now() - lastProgressAt - this.parkedMs}ms` : ""}${this.parkedMs ? ` +${this.parkedMs} parked` : ""})`);
|
|
4066
4066
|
this.ctx.jobs?.killAll();
|
|
4067
|
-
|
|
4067
|
+
const claims = this.survivingClaims();
|
|
4068
|
+
return { text: lastAssistantText(this.transcript), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...claims.length ? { fabricatedToolClaims: claims } : {} };
|
|
4068
4069
|
};
|
|
4069
4070
|
while (true) {
|
|
4070
4071
|
if (o.signal?.aborted) return kill("aborted");
|
|
@@ -4203,7 +4204,7 @@ var Agent = class _Agent {
|
|
|
4203
4204
|
}
|
|
4204
4205
|
if (toolCalls.length === 0) {
|
|
4205
4206
|
if (this.drainInjections()) continue;
|
|
4206
|
-
const fabricated = o.catchFabricatedToolUse && !closureNudged
|
|
4207
|
+
const fabricated = o.catchFabricatedToolUse && !closureNudged ? this.fabricatedToolNames(contentText(res.content ?? "")) : [];
|
|
4207
4208
|
for (const n of fabricated) this.fabricatedClaims.add(n);
|
|
4208
4209
|
if (fabricated.length && steps < o.maxSteps) {
|
|
4209
4210
|
closureNudged = true;
|
|
@@ -4227,7 +4228,8 @@ var Agent = class _Agent {
|
|
|
4227
4228
|
await this.ctx.jobs?.drain();
|
|
4228
4229
|
this.releaseStaleImages();
|
|
4229
4230
|
await this.activeHooks?.onStop?.(res.content ?? "");
|
|
4230
|
-
|
|
4231
|
+
const claims = this.survivingClaims();
|
|
4232
|
+
return { text: res.content ?? "", steps, finishReason: "stop", messages: this.transcript, usage, usageEstimated, ...claims.length ? { fabricatedToolClaims: claims } : {} };
|
|
4231
4233
|
}
|
|
4232
4234
|
const fp = toolCalls.map((tc) => tc.function.name + ":" + (tc.function.arguments ?? "")).join("|");
|
|
4233
4235
|
repeats = fp === lastFp ? repeats + 1 : 1;
|
|
@@ -4379,6 +4381,18 @@ var Agent = class _Agent {
|
|
|
4379
4381
|
* - only against the ledger for the WHOLE run, so referring back to a call it genuinely made earlier
|
|
4380
4382
|
* ("the screenshot showed an empty grid") is honest and stays silent;
|
|
4381
4383
|
* - only on a turn that made no tool calls of its own — a turn that DID call tools is closing normally.
|
|
4384
|
+
* (That is the enclosing `toolCalls.length === 0` branch. It is NOT extended to delegated activity:
|
|
4385
|
+
* a `cursor/*` turn runs its own tools and then fabricates in the SAME response, which is the exact
|
|
4386
|
+
* reported defect — see the call site.)
|
|
4387
|
+
*
|
|
4388
|
+
* What it deliberately does NOT catch, both verified:
|
|
4389
|
+
* - a fabrication that names no tool at all ("Let me take a look at the running app. The app view did
|
|
4390
|
+
* not respond in time.") — there is nothing to prove it against. Only prose matching could reach it,
|
|
4391
|
+
* and ungating `endsOnAnnouncedAction` for that was tried and reverted (it fires on ordinary English).
|
|
4392
|
+
* - a SECOND invented result for a tool the run genuinely called earlier. The ledger is per-run by
|
|
4393
|
+
* design, because that is the same fact that keeps an honest back-reference ("the screenshot showed
|
|
4394
|
+
* an empty grid") silent. Distinguishing them would need per-claim positional accounting, which buys
|
|
4395
|
+
* a rarer case at the cost of the common honest one.
|
|
4382
4396
|
*/
|
|
4383
4397
|
fabricatedToolNames(text) {
|
|
4384
4398
|
const out = [];
|
|
@@ -4390,6 +4404,14 @@ var Agent = class _Agent {
|
|
|
4390
4404
|
}
|
|
4391
4405
|
return out;
|
|
4392
4406
|
}
|
|
4407
|
+
/** The claims still standing at return time: named in this run's prose, and STILL absent from the
|
|
4408
|
+
* invocation ledger. Re-checked here rather than trusted from detection because the ledger moves —
|
|
4409
|
+
* the recovery nudge can succeed, and then the host would tell the user "I never ran it" about a
|
|
4410
|
+
* call that demonstrably ran. See `RunResult.fabricatedToolClaims`. */
|
|
4411
|
+
survivingClaims() {
|
|
4412
|
+
if (!this.fabricatedClaims.size) return [];
|
|
4413
|
+
return [...this.fabricatedClaims].filter((n) => !this.invokedTools.has(n));
|
|
4414
|
+
}
|
|
4393
4415
|
async dispatch(tc) {
|
|
4394
4416
|
this.invokedTools.add(tc.function.name);
|
|
4395
4417
|
const tool = this.activeTools.find((t) => t.name === tc.function.name);
|