@livx.cc/agentx 0.99.126 → 0.99.127
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/cli.d.ts +1 -1
- package/dist/cli.js +13 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/{secondChannel-B76KLrf7.d.ts → secondChannel-CYU9qqwr.d.ts} +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel-
|
|
2
|
-
export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel-
|
|
1
|
+
import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel-CYU9qqwr.js';
|
|
2
|
+
export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel-CYU9qqwr.js';
|
|
3
3
|
export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, latestClaude, 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
|
@@ -5217,6 +5217,7 @@ var Agent = class _Agent {
|
|
|
5217
5217
|
return texts;
|
|
5218
5218
|
}
|
|
5219
5219
|
/** Fold any host-injected messages into the transcript as user turns. Returns true if any landed. */
|
|
5220
|
+
reopen = () => this.drainInjections();
|
|
5220
5221
|
drainInjections() {
|
|
5221
5222
|
if (!this.pendingInjections.length) return false;
|
|
5222
5223
|
for (const content of this.pendingInjections.splice(0)) this.transcript.push({ role: "user", content });
|
|
@@ -5487,6 +5488,14 @@ var Agent = class _Agent {
|
|
|
5487
5488
|
};
|
|
5488
5489
|
const overBudget = () => !!o.maxTokens && spent >= o.maxTokens;
|
|
5489
5490
|
const canNudge = () => steps < o.maxSteps && !overBudget();
|
|
5491
|
+
this.reopen = () => {
|
|
5492
|
+
if (!this.pendingInjections.length) return false;
|
|
5493
|
+
if (steps >= o.maxSteps || overBudget()) {
|
|
5494
|
+
log9.warn(`answer finished with ${this.pendingInjections.length} injection(s) pending and no step/budget left \u2014 they wait for the next run`);
|
|
5495
|
+
return false;
|
|
5496
|
+
}
|
|
5497
|
+
return this.drainInjections();
|
|
5498
|
+
};
|
|
5490
5499
|
while (true) {
|
|
5491
5500
|
if (o.signal?.aborted) return kill("aborted");
|
|
5492
5501
|
if (steps >= o.maxSteps) return kill("max_steps");
|
|
@@ -5631,6 +5640,7 @@ var Agent = class _Agent {
|
|
|
5631
5640
|
usage.cacheCreationTokens += res.usage.cacheCreationTokens ?? 0;
|
|
5632
5641
|
usage.cacheReadTokens += res.usage.cacheReadTokens ?? 0;
|
|
5633
5642
|
const prompt = res.usage.promptTokens ?? 0, cacheRead = res.usage.cacheReadTokens ?? 0;
|
|
5643
|
+
const ctxTokens = res.usage.contextTokens ?? prompt;
|
|
5634
5644
|
usage.contextTokens = res.usage.contextTokens ?? prompt;
|
|
5635
5645
|
usage.contextWindow = res.usage.contextWindow || _Agent.contextCap(o);
|
|
5636
5646
|
if (prevPrompt < 0) {
|
|
@@ -5639,7 +5649,7 @@ var Agent = class _Agent {
|
|
|
5639
5649
|
}
|
|
5640
5650
|
const reused = Math.min(prompt, Math.max(cacheRead, prevPrompt));
|
|
5641
5651
|
spent += (res.usage.totalTokens ?? 0) - 0.9 * reused;
|
|
5642
|
-
prevPrompt = stepPrompt =
|
|
5652
|
+
prevPrompt = stepPrompt = ctxTokens;
|
|
5643
5653
|
}
|
|
5644
5654
|
const delegatedTools = res.delegatedTools ?? [];
|
|
5645
5655
|
if (delegatedTools.length) {
|
|
@@ -5679,7 +5689,7 @@ var Agent = class _Agent {
|
|
|
5679
5689
|
});
|
|
5680
5690
|
}
|
|
5681
5691
|
if (toolCalls.length === 0) {
|
|
5682
|
-
if (this.
|
|
5692
|
+
if (this.reopen()) continue;
|
|
5683
5693
|
if (emptyTurn && o.failEmptyTurns) {
|
|
5684
5694
|
if (!emptyNudged && canNudge()) {
|
|
5685
5695
|
emptyNudged = true;
|
|
@@ -5717,7 +5727,7 @@ var Agent = class _Agent {
|
|
|
5717
5727
|
const drained = await this.jobs.drain(o.signal);
|
|
5718
5728
|
if (o.signal?.aborted) return kill("aborted");
|
|
5719
5729
|
if (drained.length) lastProgressAt = Date.now();
|
|
5720
|
-
if (this.
|
|
5730
|
+
if (this.reopen()) continue;
|
|
5721
5731
|
this.releaseStaleImages();
|
|
5722
5732
|
await this.activeHooks?.onStop?.(res.content ?? "");
|
|
5723
5733
|
const claims = this.survivingClaims();
|