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/{chunk-YJKUWFIC.js → chunk-EIE5VRSI.js} +60 -6
- package/dist/chunk-EIE5VRSI.js.map +1 -0
- package/dist/{chunk-F5QK5YVI.js → chunk-F62X5W2G.js} +2 -2
- package/dist/cli.cjs +119 -13
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +62 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +59 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +2 -2
- package/dist/testing/index.cjs +59 -5
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-YJKUWFIC.js.map +0 -1
- /package/dist/{chunk-F5QK5YVI.js.map → chunk-F62X5W2G.js.map} +0 -0
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
init_strategy,
|
|
35
35
|
init_stream_processor,
|
|
36
36
|
resolveHintTemplate
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-EIE5VRSI.js";
|
|
38
38
|
|
|
39
39
|
// src/index.ts
|
|
40
40
|
init_builder();
|
|
@@ -1096,4 +1096,4 @@ export {
|
|
|
1096
1096
|
resultWithFile,
|
|
1097
1097
|
z
|
|
1098
1098
|
};
|
|
1099
|
-
//# sourceMappingURL=chunk-
|
|
1099
|
+
//# sourceMappingURL=chunk-F62X5W2G.js.map
|
package/dist/cli.cjs
CHANGED
|
@@ -3870,6 +3870,8 @@ var init_stream_processor = __esm({
|
|
|
3870
3870
|
completedResults = /* @__PURE__ */ new Map();
|
|
3871
3871
|
/** Invocation IDs of gadgets that have failed (error or skipped due to dependency) */
|
|
3872
3872
|
failedInvocations = /* @__PURE__ */ new Set();
|
|
3873
|
+
/** Promises for independent gadgets currently executing (fire-and-forget) */
|
|
3874
|
+
inFlightExecutions = /* @__PURE__ */ new Map();
|
|
3873
3875
|
constructor(options) {
|
|
3874
3876
|
this.iteration = options.iteration;
|
|
3875
3877
|
this.registry = options.registry;
|
|
@@ -3978,6 +3980,16 @@ var init_stream_processor = __esm({
|
|
|
3978
3980
|
}
|
|
3979
3981
|
}
|
|
3980
3982
|
}
|
|
3983
|
+
const inFlightResults = await this.collectInFlightResults();
|
|
3984
|
+
for (const evt of inFlightResults) {
|
|
3985
|
+
yield evt;
|
|
3986
|
+
if (evt.type === "gadget_result") {
|
|
3987
|
+
didExecuteGadgets = true;
|
|
3988
|
+
if (evt.result.breaksLoop) {
|
|
3989
|
+
shouldBreakLoop = true;
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3981
3993
|
for await (const evt of this.processPendingGadgetsGenerator()) {
|
|
3982
3994
|
yield evt;
|
|
3983
3995
|
if (evt.type === "gadget_result") {
|
|
@@ -4163,12 +4175,24 @@ var init_stream_processor = __esm({
|
|
|
4163
4175
|
this.gadgetsAwaitingDependencies.set(call.invocationId, call);
|
|
4164
4176
|
return;
|
|
4165
4177
|
}
|
|
4178
|
+
for await (const evt of this.executeGadgetGenerator(call)) {
|
|
4179
|
+
yield evt;
|
|
4180
|
+
}
|
|
4181
|
+
for await (const evt of this.processPendingGadgetsGenerator()) {
|
|
4182
|
+
yield evt;
|
|
4183
|
+
}
|
|
4184
|
+
return;
|
|
4166
4185
|
}
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4186
|
+
if (this.stopOnGadgetError) {
|
|
4187
|
+
for await (const evt of this.executeGadgetGenerator(call)) {
|
|
4188
|
+
yield evt;
|
|
4189
|
+
}
|
|
4190
|
+
for await (const evt of this.processPendingGadgetsGenerator()) {
|
|
4191
|
+
yield evt;
|
|
4192
|
+
}
|
|
4193
|
+
} else {
|
|
4194
|
+
const executionPromise = this.executeGadgetAndCollect(call);
|
|
4195
|
+
this.inFlightExecutions.set(call.invocationId, executionPromise);
|
|
4172
4196
|
}
|
|
4173
4197
|
}
|
|
4174
4198
|
/**
|
|
@@ -4480,6 +4504,36 @@ var init_stream_processor = __esm({
|
|
|
4480
4504
|
}
|
|
4481
4505
|
}
|
|
4482
4506
|
}
|
|
4507
|
+
/**
|
|
4508
|
+
* Execute a gadget and collect all events into an array (non-blocking).
|
|
4509
|
+
* Used for fire-and-forget parallel execution of independent gadgets.
|
|
4510
|
+
*/
|
|
4511
|
+
async executeGadgetAndCollect(call) {
|
|
4512
|
+
const events = [];
|
|
4513
|
+
for await (const evt of this.executeGadgetGenerator(call)) {
|
|
4514
|
+
events.push(evt);
|
|
4515
|
+
}
|
|
4516
|
+
return events;
|
|
4517
|
+
}
|
|
4518
|
+
/**
|
|
4519
|
+
* Collect results from all fire-and-forget (in-flight) gadget executions.
|
|
4520
|
+
* Called at stream end to await parallel independent gadgets.
|
|
4521
|
+
* Clears the inFlightExecutions map after collection.
|
|
4522
|
+
* @returns Array of all events from completed gadgets
|
|
4523
|
+
*/
|
|
4524
|
+
async collectInFlightResults() {
|
|
4525
|
+
if (this.inFlightExecutions.size === 0) {
|
|
4526
|
+
return [];
|
|
4527
|
+
}
|
|
4528
|
+
this.logger.debug("Collecting in-flight gadget results", {
|
|
4529
|
+
count: this.inFlightExecutions.size,
|
|
4530
|
+
invocationIds: Array.from(this.inFlightExecutions.keys())
|
|
4531
|
+
});
|
|
4532
|
+
const promises = Array.from(this.inFlightExecutions.values());
|
|
4533
|
+
const results = await Promise.all(promises);
|
|
4534
|
+
this.inFlightExecutions.clear();
|
|
4535
|
+
return results.flat();
|
|
4536
|
+
}
|
|
4483
4537
|
/**
|
|
4484
4538
|
* Handle a gadget that cannot execute because a dependency failed.
|
|
4485
4539
|
* Calls the onDependencySkipped controller to allow customization.
|
|
@@ -12860,7 +12914,8 @@ function formatCost(cost) {
|
|
|
12860
12914
|
}
|
|
12861
12915
|
function formatLLMCallLine(info) {
|
|
12862
12916
|
const parts = [];
|
|
12863
|
-
|
|
12917
|
+
const callNumber = info.parentCallNumber ? `#${info.parentCallNumber}.${info.iteration}` : `#${info.iteration}`;
|
|
12918
|
+
parts.push(`${import_chalk3.default.cyan(callNumber)} ${import_chalk3.default.magenta(info.model)}`);
|
|
12864
12919
|
if (info.contextPercent !== void 0 && info.contextPercent !== null) {
|
|
12865
12920
|
const formatted = `${Math.round(info.contextPercent)}%`;
|
|
12866
12921
|
if (info.contextPercent >= 80) {
|
|
@@ -13366,16 +13421,57 @@ var StreamProgress = class {
|
|
|
13366
13421
|
hasInFlightGadgets() {
|
|
13367
13422
|
return this.inFlightGadgets.size > 0;
|
|
13368
13423
|
}
|
|
13424
|
+
/**
|
|
13425
|
+
* Mark a gadget as completed (keeps it visible with ✓ indicator).
|
|
13426
|
+
* Records completion time to freeze the elapsed timer.
|
|
13427
|
+
* The gadget and its nested operations remain visible until clearCompletedGadgets() is called.
|
|
13428
|
+
*/
|
|
13429
|
+
completeGadget(invocationId) {
|
|
13430
|
+
const gadget = this.inFlightGadgets.get(invocationId);
|
|
13431
|
+
if (gadget) {
|
|
13432
|
+
gadget.completed = true;
|
|
13433
|
+
gadget.completedTime = Date.now();
|
|
13434
|
+
if (this.isRunning && this.isTTY) {
|
|
13435
|
+
this.render();
|
|
13436
|
+
}
|
|
13437
|
+
}
|
|
13438
|
+
}
|
|
13439
|
+
/**
|
|
13440
|
+
* Clear all completed gadgets from the display.
|
|
13441
|
+
* Called when new text output arrives to clean up the finished gadget section.
|
|
13442
|
+
*/
|
|
13443
|
+
clearCompletedGadgets() {
|
|
13444
|
+
for (const [id, gadget] of this.inFlightGadgets) {
|
|
13445
|
+
if (gadget.completed) {
|
|
13446
|
+
this.inFlightGadgets.delete(id);
|
|
13447
|
+
for (const [nestedId, nested] of this.nestedAgents) {
|
|
13448
|
+
if (nested.parentInvocationId === id) {
|
|
13449
|
+
this.nestedAgents.delete(nestedId);
|
|
13450
|
+
}
|
|
13451
|
+
}
|
|
13452
|
+
for (const [nestedId, nested] of this.nestedGadgets) {
|
|
13453
|
+
if (nested.parentInvocationId === id) {
|
|
13454
|
+
this.nestedGadgets.delete(nestedId);
|
|
13455
|
+
}
|
|
13456
|
+
}
|
|
13457
|
+
}
|
|
13458
|
+
}
|
|
13459
|
+
if (this.isRunning && this.isTTY) {
|
|
13460
|
+
this.render();
|
|
13461
|
+
}
|
|
13462
|
+
}
|
|
13369
13463
|
/**
|
|
13370
13464
|
* Add a nested agent LLM call (called when nested llm_call_start event received).
|
|
13371
13465
|
* Used to display hierarchical progress for subagent gadgets.
|
|
13466
|
+
* @param parentCallNumber - Top-level call number for hierarchical display (e.g., #1.2)
|
|
13372
13467
|
*/
|
|
13373
|
-
addNestedAgent(id, parentInvocationId, depth, model, iteration, info) {
|
|
13468
|
+
addNestedAgent(id, parentInvocationId, depth, model, iteration, info, parentCallNumber) {
|
|
13374
13469
|
this.nestedAgents.set(id, {
|
|
13375
13470
|
parentInvocationId,
|
|
13376
13471
|
depth,
|
|
13377
13472
|
model,
|
|
13378
13473
|
iteration,
|
|
13474
|
+
parentCallNumber,
|
|
13379
13475
|
startTime: Date.now(),
|
|
13380
13476
|
inputTokens: info?.inputTokens,
|
|
13381
13477
|
cachedInputTokens: info?.cachedInputTokens
|
|
@@ -13621,7 +13717,8 @@ var StreamProgress = class {
|
|
|
13621
13717
|
const activeNestedStreams = [];
|
|
13622
13718
|
if (this.isTTY) {
|
|
13623
13719
|
for (const [gadgetId, gadget] of this.inFlightGadgets) {
|
|
13624
|
-
const
|
|
13720
|
+
const endTime = gadget.completedTime ?? Date.now();
|
|
13721
|
+
const elapsedSeconds = (endTime - gadget.startTime) / 1e3;
|
|
13625
13722
|
const termWidth = process.stdout.columns ?? 80;
|
|
13626
13723
|
const gadgetIndent = " ";
|
|
13627
13724
|
const line = formatGadgetLine(
|
|
@@ -13629,7 +13726,7 @@ var StreamProgress = class {
|
|
|
13629
13726
|
name: gadget.name,
|
|
13630
13727
|
parameters: gadget.params,
|
|
13631
13728
|
elapsedSeconds,
|
|
13632
|
-
isComplete: false
|
|
13729
|
+
isComplete: gadget.completed ?? false
|
|
13633
13730
|
},
|
|
13634
13731
|
termWidth - gadgetIndent.length
|
|
13635
13732
|
);
|
|
@@ -13643,6 +13740,7 @@ var StreamProgress = class {
|
|
|
13643
13740
|
startTime: nested.startTime,
|
|
13644
13741
|
depth: nested.depth,
|
|
13645
13742
|
iteration: nested.iteration,
|
|
13743
|
+
parentCallNumber: nested.parentCallNumber,
|
|
13646
13744
|
model: nested.model,
|
|
13647
13745
|
inputTokens: nested.inputTokens,
|
|
13648
13746
|
cachedInputTokens: nested.cachedInputTokens,
|
|
@@ -13656,6 +13754,7 @@ var StreamProgress = class {
|
|
|
13656
13754
|
activeNestedStreams.push({
|
|
13657
13755
|
depth: nested.depth,
|
|
13658
13756
|
iteration: nested.iteration,
|
|
13757
|
+
parentCallNumber: nested.parentCallNumber,
|
|
13659
13758
|
model: nested.model,
|
|
13660
13759
|
inputTokens: nested.inputTokens,
|
|
13661
13760
|
cachedInputTokens: nested.cachedInputTokens,
|
|
@@ -13685,11 +13784,12 @@ var StreamProgress = class {
|
|
|
13685
13784
|
continue;
|
|
13686
13785
|
}
|
|
13687
13786
|
const indent = " ".repeat(op.depth + 2);
|
|
13688
|
-
const
|
|
13689
|
-
const elapsedSeconds2 = (
|
|
13787
|
+
const endTime2 = op.completedTime ?? Date.now();
|
|
13788
|
+
const elapsedSeconds2 = (endTime2 - op.startTime) / 1e3;
|
|
13690
13789
|
if (op.type === "agent") {
|
|
13691
13790
|
const line2 = formatLLMCallLine({
|
|
13692
13791
|
iteration: op.iteration ?? 0,
|
|
13792
|
+
parentCallNumber: op.parentCallNumber,
|
|
13693
13793
|
model: op.model ?? "",
|
|
13694
13794
|
inputTokens: op.inputTokens,
|
|
13695
13795
|
cachedInputTokens: op.cachedInputTokens,
|
|
@@ -13723,6 +13823,7 @@ var StreamProgress = class {
|
|
|
13723
13823
|
const elapsedSeconds = (Date.now() - stream2.startTime) / 1e3;
|
|
13724
13824
|
const line = formatLLMCallLine({
|
|
13725
13825
|
iteration: stream2.iteration,
|
|
13826
|
+
parentCallNumber: stream2.parentCallNumber,
|
|
13726
13827
|
model: stream2.model,
|
|
13727
13828
|
inputTokens: stream2.inputTokens,
|
|
13728
13829
|
cachedInputTokens: stream2.cachedInputTokens,
|
|
@@ -14478,7 +14579,9 @@ Denied: ${result.reason ?? "by user"}`
|
|
|
14478
14579
|
{
|
|
14479
14580
|
inputTokens: info.usage?.inputTokens ?? info.inputTokens,
|
|
14480
14581
|
cachedInputTokens: info.usage?.cachedInputTokens
|
|
14481
|
-
}
|
|
14582
|
+
},
|
|
14583
|
+
llmCallCounter
|
|
14584
|
+
// Parent call number for hierarchical display (e.g., #1.2)
|
|
14482
14585
|
);
|
|
14483
14586
|
} else if (subagentEvent.type === "llm_call_end") {
|
|
14484
14587
|
const info = subagentEvent.event;
|
|
@@ -14522,6 +14625,9 @@ Denied: ${result.reason ?? "by user"}`
|
|
|
14522
14625
|
let textBuffer = "";
|
|
14523
14626
|
const flushTextBuffer = () => {
|
|
14524
14627
|
if (textBuffer) {
|
|
14628
|
+
if (!options.quiet) {
|
|
14629
|
+
progress.clearCompletedGadgets();
|
|
14630
|
+
}
|
|
14525
14631
|
const output = options.quiet ? textBuffer : renderMarkdownWithSeparators(textBuffer);
|
|
14526
14632
|
printer.write(output);
|
|
14527
14633
|
textBuffer = "";
|
|
@@ -14544,7 +14650,7 @@ Denied: ${result.reason ?? "by user"}`
|
|
|
14544
14650
|
} else if (event.type === "gadget_result") {
|
|
14545
14651
|
flushTextBuffer();
|
|
14546
14652
|
if (!options.quiet) {
|
|
14547
|
-
progress.
|
|
14653
|
+
progress.completeGadget(event.result.invocationId);
|
|
14548
14654
|
}
|
|
14549
14655
|
progress.pause();
|
|
14550
14656
|
if (options.quiet) {
|