@livx.cc/agentx 0.99.23 → 0.99.25

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.
@@ -1,5 +1,5 @@
1
1
  import { IFilesystem } from '@livx.cc/wcli/core';
2
- import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, e as MessageContent, U as UserQuestion } from './tools-hAKTlzty.js';
2
+ import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, e as MessageContent, U as UserQuestion } from './tools-CJAPSBhS.js';
3
3
 
4
4
  /**
5
5
  * Hooks — deterministic interception points around tool execution, run by the
@@ -298,6 +298,11 @@ declare class AgentOptions {
298
298
  traceDir?: string;
299
299
  /** Stream tokens from the model. Takes effect only with a `host.notify`; off => current (non-stream) behavior. */
300
300
  stream: boolean;
301
+ /** Closure reflex for delegated runtimes (cursor/claude-code): when such a turn ends on a tool call with
302
+ * no assistant text after it (the runtime went silent post-work), nudge ONE more step for a brief summary
303
+ * of what changed + what's pending — so the turn delivers a wrap-up instead of trailing off mid-narration.
304
+ * Fires at most once per run and only for delegated runtimes (native turns never emit the trigger). */
305
+ closeDelegatedTurns: boolean;
301
306
  /** Fold the dropped middle of an over-long transcript into a synthetic summary (edge-safe, no LLM). Off => drop-oldest. */
302
307
  compaction?: {
303
308
  maxMessages: number;
package/dist/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import { H as Hooks, h as RunResult, R as ReasoningEffort, A as Agent } from './Agent-CSCWkq0C.js';
2
+ import { H as Hooks, h as RunResult, R as ReasoningEffort, A as Agent } from './Agent-ChSs1QSx.js';
3
3
  import { IFilesystem } from '@livx.cc/wcli/core';
4
- import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, e as MessageContent } from './tools-hAKTlzty.js';
4
+ import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, e as MessageContent } from './tools-CJAPSBhS.js';
5
5
 
6
6
  /**
7
7
  * On-disk session store for the CLI: each conversation is one JSON file at
@@ -144,6 +144,7 @@ interface Args {
144
144
  worktree?: string;
145
145
  updateCheck?: boolean;
146
146
  update?: boolean;
147
+ listModels?: boolean;
147
148
  }
148
149
  declare function parseArgs(argv: string[]): Args;
149
150
  declare function makeHost(format?: 'text' | 'json' | 'stream-json', opts?: {
package/dist/cli.js CHANGED
@@ -3292,6 +3292,11 @@ var AgentOptions = class {
3292
3292
  traceDir;
3293
3293
  /** Stream tokens from the model. Takes effect only with a `host.notify`; off => current (non-stream) behavior. */
3294
3294
  stream = false;
3295
+ /** Closure reflex for delegated runtimes (cursor/claude-code): when such a turn ends on a tool call with
3296
+ * no assistant text after it (the runtime went silent post-work), nudge ONE more step for a brief summary
3297
+ * of what changed + what's pending — so the turn delivers a wrap-up instead of trailing off mid-narration.
3298
+ * Fires at most once per run and only for delegated runtimes (native turns never emit the trigger). */
3299
+ closeDelegatedTurns = true;
3295
3300
  /** Fold the dropped middle of an over-long transcript into a synthetic summary (edge-safe, no LLM). Off => drop-oldest. */
3296
3301
  compaction;
3297
3302
  /** Add `Checkpoint`/`Rollback` tools (requires the fs to be an OverlayFilesystem). */
@@ -3621,6 +3626,7 @@ var Agent = class _Agent {
3621
3626
  let toolCallsTotal = 0;
3622
3627
  let lastFp = "";
3623
3628
  let repeats = 0;
3629
+ let closureNudged = false;
3624
3630
  const kill = (finishReason) => {
3625
3631
  log4.warn(`kill-switch: ${finishReason} (steps=${steps}, tokens=${usage.totalTokens}, budgetTokens=${Math.round(usage.totalTokens - 0.9 * usage.cacheReadTokens)}, ms=${Date.now() - start - this.parkedMs}${this.parkedMs ? ` +${this.parkedMs} parked` : ""})`);
3626
3632
  this.ctx.jobs?.killAll();
@@ -3752,6 +3758,12 @@ var Agent = class _Agent {
3752
3758
  }
3753
3759
  if (toolCalls.length === 0) {
3754
3760
  if (this.drainInjections()) continue;
3761
+ if (o.closeDelegatedTurns && res.endedOnToolNoText && !closureNudged && steps < o.maxSteps) {
3762
+ closureNudged = true;
3763
+ log4.verbose("delegated turn went silent after a tool \u2014 nudging a closing summary");
3764
+ this.transcript.push({ role: "user", content: "Summarize what you did this turn and what (if anything) still needs doing. Be concise." });
3765
+ continue;
3766
+ }
3755
3767
  log4.verbose(`completed in ${steps} step(s)`);
3756
3768
  await this.ctx.jobs?.drain();
3757
3769
  await this.activeHooks?.onStop?.(res.content ?? "");
@@ -3843,6 +3855,7 @@ var Agent = class _Agent {
3843
3855
  let usage;
3844
3856
  const delegated = /* @__PURE__ */ new Map();
3845
3857
  const delegatedOrder = [];
3858
+ let endedOnToolNoText = false;
3846
3859
  for await (const chunk of stream) {
3847
3860
  poke?.();
3848
3861
  if (this.options.signal?.aborted) break;
@@ -3862,9 +3875,11 @@ var Agent = class _Agent {
3862
3875
  if (a.output !== void 0) prev.output = a.output;
3863
3876
  prev.status = a.status;
3864
3877
  }
3878
+ endedOnToolNoText = true;
3865
3879
  }
3866
3880
  if (chunk.content) {
3867
3881
  content += chunk.content;
3882
+ if (chunk.content.trim()) endedOnToolNoText = false;
3868
3883
  this.options.host.notify({ kind: "text_delta", message: chunk.content });
3869
3884
  }
3870
3885
  if (chunk.finishReason) finishReason = chunk.finishReason;
@@ -3872,7 +3887,7 @@ var Agent = class _Agent {
3872
3887
  if (chunk.usage) usage = chunk.usage;
3873
3888
  }
3874
3889
  const delegatedTools = delegatedOrder.map((k) => delegated.get(k));
3875
- return { content, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {} };
3890
+ return { content, ...finishReason ? { finishReason } : {}, ...toolCalls ? { toolCalls } : {}, ...usage ? { usage } : {}, ...delegatedTools.length ? { delegatedTools } : {}, ...endedOnToolNoText ? { endedOnToolNoText: true } : {} };
3876
3891
  }
3877
3892
  async dispatch(tc) {
3878
3893
  const tool = this.activeTools.find((t) => t.name === tc.function.name);
@@ -12060,8 +12075,13 @@ function parseArgs(argv) {
12060
12075
  const x = argv[i];
12061
12076
  if (x === "-h" || x === "--help") a.help = true;
12062
12077
  else if (x === "-v" || x === "--version") a.version = true;
12063
- else if (x === "-m" || x === "--model") a.model = val(++i, x);
12064
- else if (x === "-C" || x === "--cwd") a.cwd = val(++i, x);
12078
+ else if (x === "-m" || x === "--model") {
12079
+ const nxt = argv[i + 1];
12080
+ if (nxt === void 0 || nxt.startsWith("-") || nxt === "list" || nxt === "ls" || nxt === "?") {
12081
+ a.listModels = true;
12082
+ if (nxt === "list" || nxt === "ls" || nxt === "?") i++;
12083
+ } else a.model = argv[++i];
12084
+ } else if (x === "-C" || x === "--cwd") a.cwd = val(++i, x);
12065
12085
  else if (x === "-p" || x === "--print") {
12066
12086
  const nxt = argv[i + 1];
12067
12087
  if (nxt !== void 0 && !nxt.startsWith("-")) a.task = argv[++i];
@@ -12134,7 +12154,7 @@ var HELP = `agentx \u2014 agent runtime CLI
12134
12154
  agentx -c "<task>" continue the most recent session
12135
12155
 
12136
12156
  Flags:
12137
- -m, --model <id> model (default anthropic/claude-sonnet-4-6)
12157
+ -m, --model <id> model (default anthropic/claude-sonnet-4-6); bare -m or -m list = list all models
12138
12158
  -C, --cwd <dir> working dir / project root (default .)
12139
12159
  -c, --continue resume the most recent session in this dir
12140
12160
  -r, --resume [id] resume a session \u2014 with an id, or bare for an interactive picker
@@ -12214,6 +12234,24 @@ REPL paste: large/multi-line pastes collapse to a [Pasted text +N lines] preview
12214
12234
  function newestModel() {
12215
12235
  return listModels().slice().sort((a, b) => (getModelInfo(b)?.releaseDate ?? "").localeCompare(getModelInfo(a)?.releaseDate ?? ""))[0] ?? "";
12216
12236
  }
12237
+ function printModels() {
12238
+ const byProvider = /* @__PURE__ */ new Map();
12239
+ for (const id of listModels()) {
12240
+ const provider = getProviderFromModel(id) ?? "other";
12241
+ if (!byProvider.has(provider)) byProvider.set(provider, []);
12242
+ byProvider.get(provider).push(id);
12243
+ }
12244
+ for (const [provider, ids] of Array.from(byProvider.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
12245
+ console.log(`
12246
+ ${provider}`);
12247
+ ids.sort((a, b) => (getModelInfo(b)?.releaseDate ?? "").localeCompare(getModelInfo(a)?.releaseDate ?? ""));
12248
+ for (const id of ids) {
12249
+ const info = getModelInfo(id);
12250
+ const meta = [info?.displayName, info?.releaseDate].filter(Boolean).join(" \xB7 ");
12251
+ console.log(` ${id}${meta ? ` (${meta})` : ""}`);
12252
+ }
12253
+ }
12254
+ }
12217
12255
  function resolveModelOrNewest(model) {
12218
12256
  const want = model ?? new AgentOptions().model;
12219
12257
  const resolved = resolveModel(want);
@@ -15477,6 +15515,10 @@ async function main() {
15477
15515
  console.log(HELP);
15478
15516
  return;
15479
15517
  }
15518
+ if (args.listModels) {
15519
+ printModels();
15520
+ return;
15521
+ }
15480
15522
  if (args.update) {
15481
15523
  const msg = await checkForUpdate(VERSION).catch(() => null);
15482
15524
  if (!msg) {