llmist 5.1.0 → 6.0.0

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-F5QK5YVI.js";
2
+ import "./chunk-F62X5W2G.js";
3
3
  import {
4
4
  AbstractGadget,
5
5
  AgentBuilder,
@@ -34,7 +34,7 @@ import {
34
34
  schemaToJSONSchema,
35
35
  text,
36
36
  validateGadgetSchema
37
- } from "./chunk-YJKUWFIC.js";
37
+ } from "./chunk-EIE5VRSI.js";
38
38
 
39
39
  // src/cli/constants.ts
40
40
  var CLI_NAME = "llmist";
@@ -2941,7 +2941,8 @@ function formatCost(cost) {
2941
2941
  }
2942
2942
  function formatLLMCallLine(info) {
2943
2943
  const parts = [];
2944
- parts.push(`${chalk3.cyan(`#${info.iteration}`)} ${chalk3.magenta(info.model)}`);
2944
+ const callNumber = info.parentCallNumber ? `#${info.parentCallNumber}.${info.iteration}` : `#${info.iteration}`;
2945
+ parts.push(`${chalk3.cyan(callNumber)} ${chalk3.magenta(info.model)}`);
2945
2946
  if (info.contextPercent !== void 0 && info.contextPercent !== null) {
2946
2947
  const formatted = `${Math.round(info.contextPercent)}%`;
2947
2948
  if (info.contextPercent >= 80) {
@@ -3447,16 +3448,57 @@ var StreamProgress = class {
3447
3448
  hasInFlightGadgets() {
3448
3449
  return this.inFlightGadgets.size > 0;
3449
3450
  }
3451
+ /**
3452
+ * Mark a gadget as completed (keeps it visible with ✓ indicator).
3453
+ * Records completion time to freeze the elapsed timer.
3454
+ * The gadget and its nested operations remain visible until clearCompletedGadgets() is called.
3455
+ */
3456
+ completeGadget(invocationId) {
3457
+ const gadget = this.inFlightGadgets.get(invocationId);
3458
+ if (gadget) {
3459
+ gadget.completed = true;
3460
+ gadget.completedTime = Date.now();
3461
+ if (this.isRunning && this.isTTY) {
3462
+ this.render();
3463
+ }
3464
+ }
3465
+ }
3466
+ /**
3467
+ * Clear all completed gadgets from the display.
3468
+ * Called when new text output arrives to clean up the finished gadget section.
3469
+ */
3470
+ clearCompletedGadgets() {
3471
+ for (const [id, gadget] of this.inFlightGadgets) {
3472
+ if (gadget.completed) {
3473
+ this.inFlightGadgets.delete(id);
3474
+ for (const [nestedId, nested] of this.nestedAgents) {
3475
+ if (nested.parentInvocationId === id) {
3476
+ this.nestedAgents.delete(nestedId);
3477
+ }
3478
+ }
3479
+ for (const [nestedId, nested] of this.nestedGadgets) {
3480
+ if (nested.parentInvocationId === id) {
3481
+ this.nestedGadgets.delete(nestedId);
3482
+ }
3483
+ }
3484
+ }
3485
+ }
3486
+ if (this.isRunning && this.isTTY) {
3487
+ this.render();
3488
+ }
3489
+ }
3450
3490
  /**
3451
3491
  * Add a nested agent LLM call (called when nested llm_call_start event received).
3452
3492
  * Used to display hierarchical progress for subagent gadgets.
3493
+ * @param parentCallNumber - Top-level call number for hierarchical display (e.g., #1.2)
3453
3494
  */
3454
- addNestedAgent(id, parentInvocationId, depth, model, iteration, info) {
3495
+ addNestedAgent(id, parentInvocationId, depth, model, iteration, info, parentCallNumber) {
3455
3496
  this.nestedAgents.set(id, {
3456
3497
  parentInvocationId,
3457
3498
  depth,
3458
3499
  model,
3459
3500
  iteration,
3501
+ parentCallNumber,
3460
3502
  startTime: Date.now(),
3461
3503
  inputTokens: info?.inputTokens,
3462
3504
  cachedInputTokens: info?.cachedInputTokens
@@ -3702,7 +3744,8 @@ var StreamProgress = class {
3702
3744
  const activeNestedStreams = [];
3703
3745
  if (this.isTTY) {
3704
3746
  for (const [gadgetId, gadget] of this.inFlightGadgets) {
3705
- const elapsedSeconds = (Date.now() - gadget.startTime) / 1e3;
3747
+ const endTime = gadget.completedTime ?? Date.now();
3748
+ const elapsedSeconds = (endTime - gadget.startTime) / 1e3;
3706
3749
  const termWidth = process.stdout.columns ?? 80;
3707
3750
  const gadgetIndent = " ";
3708
3751
  const line = formatGadgetLine(
@@ -3710,7 +3753,7 @@ var StreamProgress = class {
3710
3753
  name: gadget.name,
3711
3754
  parameters: gadget.params,
3712
3755
  elapsedSeconds,
3713
- isComplete: false
3756
+ isComplete: gadget.completed ?? false
3714
3757
  },
3715
3758
  termWidth - gadgetIndent.length
3716
3759
  );
@@ -3724,6 +3767,7 @@ var StreamProgress = class {
3724
3767
  startTime: nested.startTime,
3725
3768
  depth: nested.depth,
3726
3769
  iteration: nested.iteration,
3770
+ parentCallNumber: nested.parentCallNumber,
3727
3771
  model: nested.model,
3728
3772
  inputTokens: nested.inputTokens,
3729
3773
  cachedInputTokens: nested.cachedInputTokens,
@@ -3737,6 +3781,7 @@ var StreamProgress = class {
3737
3781
  activeNestedStreams.push({
3738
3782
  depth: nested.depth,
3739
3783
  iteration: nested.iteration,
3784
+ parentCallNumber: nested.parentCallNumber,
3740
3785
  model: nested.model,
3741
3786
  inputTokens: nested.inputTokens,
3742
3787
  cachedInputTokens: nested.cachedInputTokens,
@@ -3766,11 +3811,12 @@ var StreamProgress = class {
3766
3811
  continue;
3767
3812
  }
3768
3813
  const indent = " ".repeat(op.depth + 2);
3769
- const endTime = op.completedTime ?? Date.now();
3770
- const elapsedSeconds2 = (endTime - op.startTime) / 1e3;
3814
+ const endTime2 = op.completedTime ?? Date.now();
3815
+ const elapsedSeconds2 = (endTime2 - op.startTime) / 1e3;
3771
3816
  if (op.type === "agent") {
3772
3817
  const line2 = formatLLMCallLine({
3773
3818
  iteration: op.iteration ?? 0,
3819
+ parentCallNumber: op.parentCallNumber,
3774
3820
  model: op.model ?? "",
3775
3821
  inputTokens: op.inputTokens,
3776
3822
  cachedInputTokens: op.cachedInputTokens,
@@ -3804,6 +3850,7 @@ var StreamProgress = class {
3804
3850
  const elapsedSeconds = (Date.now() - stream.startTime) / 1e3;
3805
3851
  const line = formatLLMCallLine({
3806
3852
  iteration: stream.iteration,
3853
+ parentCallNumber: stream.parentCallNumber,
3807
3854
  model: stream.model,
3808
3855
  inputTokens: stream.inputTokens,
3809
3856
  cachedInputTokens: stream.cachedInputTokens,
@@ -4559,7 +4606,9 @@ Denied: ${result.reason ?? "by user"}`
4559
4606
  {
4560
4607
  inputTokens: info.usage?.inputTokens ?? info.inputTokens,
4561
4608
  cachedInputTokens: info.usage?.cachedInputTokens
4562
- }
4609
+ },
4610
+ llmCallCounter
4611
+ // Parent call number for hierarchical display (e.g., #1.2)
4563
4612
  );
4564
4613
  } else if (subagentEvent.type === "llm_call_end") {
4565
4614
  const info = subagentEvent.event;
@@ -4603,6 +4652,9 @@ Denied: ${result.reason ?? "by user"}`
4603
4652
  let textBuffer = "";
4604
4653
  const flushTextBuffer = () => {
4605
4654
  if (textBuffer) {
4655
+ if (!options.quiet) {
4656
+ progress.clearCompletedGadgets();
4657
+ }
4606
4658
  const output = options.quiet ? textBuffer : renderMarkdownWithSeparators(textBuffer);
4607
4659
  printer.write(output);
4608
4660
  textBuffer = "";
@@ -4625,7 +4677,7 @@ Denied: ${result.reason ?? "by user"}`
4625
4677
  } else if (event.type === "gadget_result") {
4626
4678
  flushTextBuffer();
4627
4679
  if (!options.quiet) {
4628
- progress.removeGadget(event.result.invocationId);
4680
+ progress.completeGadget(event.result.invocationId);
4629
4681
  }
4630
4682
  progress.pause();
4631
4683
  if (options.quiet) {