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.js
CHANGED
|
@@ -10768,6 +10768,69 @@ var init_builder = __esm({
|
|
|
10768
10768
|
depth
|
|
10769
10769
|
};
|
|
10770
10770
|
}
|
|
10771
|
+
if (ctx.onSubagentEvent && ctx.invocationId) {
|
|
10772
|
+
const invocationId = ctx.invocationId;
|
|
10773
|
+
this.subagentEventCallback = (event) => {
|
|
10774
|
+
ctx.onSubagentEvent({
|
|
10775
|
+
...event,
|
|
10776
|
+
gadgetInvocationId: invocationId,
|
|
10777
|
+
// Add depths: parent's depth + event's depth (for recursive nesting)
|
|
10778
|
+
depth: depth + (event.depth ?? 0)
|
|
10779
|
+
});
|
|
10780
|
+
};
|
|
10781
|
+
const existingHooks = this.hooks ?? {};
|
|
10782
|
+
this.hooks = {
|
|
10783
|
+
...existingHooks,
|
|
10784
|
+
observers: {
|
|
10785
|
+
...existingHooks.observers,
|
|
10786
|
+
onLLMCallStart: async (info) => {
|
|
10787
|
+
await existingHooks.observers?.onLLMCallStart?.(info);
|
|
10788
|
+
ctx.onSubagentEvent({
|
|
10789
|
+
type: "llm_call_start",
|
|
10790
|
+
event: {
|
|
10791
|
+
iteration: info.iteration,
|
|
10792
|
+
model: info.options.model
|
|
10793
|
+
},
|
|
10794
|
+
gadgetInvocationId: invocationId,
|
|
10795
|
+
depth,
|
|
10796
|
+
iteration: info.iteration
|
|
10797
|
+
});
|
|
10798
|
+
},
|
|
10799
|
+
onGadgetExecutionStart: async (gadgetCtx) => {
|
|
10800
|
+
await existingHooks.observers?.onGadgetExecutionStart?.(gadgetCtx);
|
|
10801
|
+
ctx.onSubagentEvent({
|
|
10802
|
+
type: "gadget_call",
|
|
10803
|
+
event: {
|
|
10804
|
+
type: "gadget_call",
|
|
10805
|
+
call: {
|
|
10806
|
+
gadgetName: gadgetCtx.gadgetName,
|
|
10807
|
+
invocationId: gadgetCtx.invocationId,
|
|
10808
|
+
parametersRaw: JSON.stringify(gadgetCtx.parameters),
|
|
10809
|
+
parameters: gadgetCtx.parameters,
|
|
10810
|
+
dependencies: []
|
|
10811
|
+
}
|
|
10812
|
+
},
|
|
10813
|
+
gadgetInvocationId: invocationId,
|
|
10814
|
+
depth
|
|
10815
|
+
});
|
|
10816
|
+
},
|
|
10817
|
+
onLLMCallComplete: async (info) => {
|
|
10818
|
+
await existingHooks.observers?.onLLMCallComplete?.(info);
|
|
10819
|
+
ctx.onSubagentEvent({
|
|
10820
|
+
type: "llm_call_end",
|
|
10821
|
+
event: {
|
|
10822
|
+
iteration: info.iteration,
|
|
10823
|
+
model: info.options.model,
|
|
10824
|
+
finishReason: info.finishReason ?? void 0,
|
|
10825
|
+
usage: info.usage
|
|
10826
|
+
},
|
|
10827
|
+
gadgetInvocationId: invocationId,
|
|
10828
|
+
depth
|
|
10829
|
+
});
|
|
10830
|
+
}
|
|
10831
|
+
}
|
|
10832
|
+
};
|
|
10833
|
+
}
|
|
10771
10834
|
if (ctx.signal && !this.signal) {
|
|
10772
10835
|
this.signal = ctx.signal;
|
|
10773
10836
|
}
|