llmist 10.1.0 → 10.2.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/index.cjs +63 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10781,6 +10781,69 @@ var init_builder = __esm({
|
|
|
10781
10781
|
depth
|
|
10782
10782
|
};
|
|
10783
10783
|
}
|
|
10784
|
+
if (ctx.onSubagentEvent && ctx.invocationId) {
|
|
10785
|
+
const invocationId = ctx.invocationId;
|
|
10786
|
+
this.subagentEventCallback = (event) => {
|
|
10787
|
+
ctx.onSubagentEvent({
|
|
10788
|
+
...event,
|
|
10789
|
+
gadgetInvocationId: invocationId,
|
|
10790
|
+
// Add depths: parent's depth + event's depth (for recursive nesting)
|
|
10791
|
+
depth: depth + (event.depth ?? 0)
|
|
10792
|
+
});
|
|
10793
|
+
};
|
|
10794
|
+
const existingHooks = this.hooks ?? {};
|
|
10795
|
+
this.hooks = {
|
|
10796
|
+
...existingHooks,
|
|
10797
|
+
observers: {
|
|
10798
|
+
...existingHooks.observers,
|
|
10799
|
+
onLLMCallStart: async (info) => {
|
|
10800
|
+
await existingHooks.observers?.onLLMCallStart?.(info);
|
|
10801
|
+
ctx.onSubagentEvent({
|
|
10802
|
+
type: "llm_call_start",
|
|
10803
|
+
event: {
|
|
10804
|
+
iteration: info.iteration,
|
|
10805
|
+
model: info.options.model
|
|
10806
|
+
},
|
|
10807
|
+
gadgetInvocationId: invocationId,
|
|
10808
|
+
depth,
|
|
10809
|
+
iteration: info.iteration
|
|
10810
|
+
});
|
|
10811
|
+
},
|
|
10812
|
+
onGadgetExecutionStart: async (gadgetCtx) => {
|
|
10813
|
+
await existingHooks.observers?.onGadgetExecutionStart?.(gadgetCtx);
|
|
10814
|
+
ctx.onSubagentEvent({
|
|
10815
|
+
type: "gadget_call",
|
|
10816
|
+
event: {
|
|
10817
|
+
type: "gadget_call",
|
|
10818
|
+
call: {
|
|
10819
|
+
gadgetName: gadgetCtx.gadgetName,
|
|
10820
|
+
invocationId: gadgetCtx.invocationId,
|
|
10821
|
+
parametersRaw: JSON.stringify(gadgetCtx.parameters),
|
|
10822
|
+
parameters: gadgetCtx.parameters,
|
|
10823
|
+
dependencies: []
|
|
10824
|
+
}
|
|
10825
|
+
},
|
|
10826
|
+
gadgetInvocationId: invocationId,
|
|
10827
|
+
depth
|
|
10828
|
+
});
|
|
10829
|
+
},
|
|
10830
|
+
onLLMCallComplete: async (info) => {
|
|
10831
|
+
await existingHooks.observers?.onLLMCallComplete?.(info);
|
|
10832
|
+
ctx.onSubagentEvent({
|
|
10833
|
+
type: "llm_call_end",
|
|
10834
|
+
event: {
|
|
10835
|
+
iteration: info.iteration,
|
|
10836
|
+
model: info.options.model,
|
|
10837
|
+
finishReason: info.finishReason ?? void 0,
|
|
10838
|
+
usage: info.usage
|
|
10839
|
+
},
|
|
10840
|
+
gadgetInvocationId: invocationId,
|
|
10841
|
+
depth
|
|
10842
|
+
});
|
|
10843
|
+
}
|
|
10844
|
+
}
|
|
10845
|
+
};
|
|
10846
|
+
}
|
|
10784
10847
|
if (ctx.signal && !this.signal) {
|
|
10785
10848
|
this.signal = ctx.signal;
|
|
10786
10849
|
}
|