@livx.cc/agentx 0.99.80 → 0.99.82
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-BK-heHrw.d.ts → Agent-RHsiEAiP.d.ts} +7 -1
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +22 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AgentOptions, H as Hooks, n as RunResult, A as Agent, g as PermissionPolicy } from './Agent-
|
|
2
|
-
export { C as ChatFragment, b as Classification, c as Classifier, d as CompactResult, D as DEFAULT_MUTATING, e as Decision, M as ModelRouter, f as ModelRouterOptions, P as PermissionOptions, h as PermissionRule, i as PreToolUseDecision, R as ReasoningEffort, j as RecordingHooks, k as RecordingLifecycle, l as RouteDecision, m as RouterState, T as Tier, o as ToolUse, p as ToolUseMeta, q as claudeCodeDisallowedTools, r as composeHooks, s as estimateTokens, t as jevAvailable, u as jevClassifier, v as pickTier, w as planMode, x as reasoningToChatFragment } from './Agent-
|
|
1
|
+
import { a as AgentOptions, H as Hooks, n as RunResult, A as Agent, g as PermissionPolicy } from './Agent-RHsiEAiP.js';
|
|
2
|
+
export { C as ChatFragment, b as Classification, c as Classifier, d as CompactResult, D as DEFAULT_MUTATING, e as Decision, M as ModelRouter, f as ModelRouterOptions, P as PermissionOptions, h as PermissionRule, i as PreToolUseDecision, R as ReasoningEffort, j as RecordingHooks, k as RecordingLifecycle, l as RouteDecision, m as RouterState, T as Tier, o as ToolUse, p as ToolUseMeta, q as claudeCodeDisallowedTools, r as composeHooks, s as estimateTokens, t as jevAvailable, u as jevClassifier, v as pickTier, w as planMode, x as reasoningToChatFragment } from './Agent-RHsiEAiP.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
|
@@ -5057,10 +5057,11 @@ var Agent = class _Agent {
|
|
|
5057
5057
|
* retained window → halve the window → drop-oldest backstop. Deterministic, no LLM call.
|
|
5058
5058
|
* `focus` (e.g. `/compact keep the API details`) preserves matching lines from the dropped span verbatim.
|
|
5059
5059
|
* Returns before/after token estimates so the caller can report honestly (0 freed => say so).
|
|
5060
|
+
* `target` (tokens): a tighter budget than half the window — a host compacting at its own threshold.
|
|
5060
5061
|
*/
|
|
5061
|
-
compactNow(maxMessages = 12, focus) {
|
|
5062
|
+
compactNow(maxMessages = 12, focus, target) {
|
|
5062
5063
|
const cap = _Agent.contextCap(this.options);
|
|
5063
|
-
|
|
5064
|
+
target = Math.min(Math.round(cap * _Agent.COMPACT_TARGET), target || Infinity);
|
|
5064
5065
|
const kr = this.options.keepRecentImages ?? 1;
|
|
5065
5066
|
const vis = this.sendsImages();
|
|
5066
5067
|
const tokensBefore = estimateTokens(this.transcript, kr, vis);
|
|
@@ -5268,6 +5269,8 @@ var Agent = class _Agent {
|
|
|
5268
5269
|
usage.cacheCreationTokens += res.usage.cacheCreationTokens ?? 0;
|
|
5269
5270
|
usage.cacheReadTokens += res.usage.cacheReadTokens ?? 0;
|
|
5270
5271
|
const prompt = res.usage.promptTokens ?? 0, cacheRead = res.usage.cacheReadTokens ?? 0;
|
|
5272
|
+
usage.contextTokens = res.usage.contextTokens ?? prompt;
|
|
5273
|
+
usage.contextWindow = res.usage.contextWindow || _Agent.contextCap(o);
|
|
5271
5274
|
if (prevPrompt < 0) {
|
|
5272
5275
|
const u = sent.map((m) => m.role).lastIndexOf("user");
|
|
5273
5276
|
prevPrompt = u > 0 ? estimateTokens(sent.slice(0, u)) : 0;
|
|
@@ -5498,7 +5501,7 @@ var Agent = class _Agent {
|
|
|
5498
5501
|
const nj = a.id ? this.nativeJobs.get(a.id) : void 0;
|
|
5499
5502
|
if (a.status === "running") {
|
|
5500
5503
|
if (nj) nj.touch();
|
|
5501
|
-
else if (a.id) this.nativeJobs.set(a.id, this.jobs.track({ kind: "native", label: a.name, holds: true, idleMs: this.nativeHoldMs, hardCapMs: this.toolHoldMs }));
|
|
5504
|
+
else if (a.id) this.nativeJobs.set(a.id, this.jobs.track({ kind: "native", label: a.name === "mcp" && a.input?.toolName ? `mcp:${a.input.toolName}` : a.name, holds: true, idleMs: this.nativeHoldMs, hardCapMs: this.toolHoldMs }));
|
|
5502
5505
|
} else {
|
|
5503
5506
|
if (nj) {
|
|
5504
5507
|
if (typeof a.output === "string") nj.chunk(a.output.slice(-4e3));
|