@dudousxd/nestjs-agent-core 0.15.1 → 0.15.2
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 +16 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -5
- package/dist/index.d.ts +29 -5
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -154,6 +154,7 @@ __export(index_exports, {
|
|
|
154
154
|
skillInputSchema: () => skillInputSchema,
|
|
155
155
|
skillToolDefinition: () => skillToolDefinition,
|
|
156
156
|
skillWriteVerdict: () => skillWriteVerdict,
|
|
157
|
+
stampToolKinds: () => stampToolKinds,
|
|
157
158
|
staticSkillProvider: () => staticSkillProvider,
|
|
158
159
|
summarizeWithModel: () => summarizeWithModel,
|
|
159
160
|
tenantScope: () => tenantScope,
|
|
@@ -2615,6 +2616,16 @@ async function structureAnswer(schema, deps, input, hooks, messages, step) {
|
|
|
2615
2616
|
throw new StructuredOutputError(issues, text, maxAttempts);
|
|
2616
2617
|
}
|
|
2617
2618
|
__name(structureAnswer, "structureAnswer");
|
|
2619
|
+
function stampToolKinds(result, deps) {
|
|
2620
|
+
return {
|
|
2621
|
+
...result,
|
|
2622
|
+
toolCalls: result.toolCalls.map((call) => call.kind === void 0 ? {
|
|
2623
|
+
...call,
|
|
2624
|
+
kind: declaredKind(deps, call.name)
|
|
2625
|
+
} : call)
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
__name(stampToolKinds, "stampToolKinds");
|
|
2618
2629
|
function declaredKind(deps, name) {
|
|
2619
2630
|
if (deps.ask === true && name === ASK_TOOL_NAME) {
|
|
2620
2631
|
return "ask";
|
|
@@ -2815,7 +2826,7 @@ async function claimToolCall(turn, call) {
|
|
|
2815
2826
|
const { deps, input, hooks, messageId } = turn;
|
|
2816
2827
|
const persisted = await hooks.step(`persist:toolcall:${call.id}`, async () => {
|
|
2817
2828
|
const spec = deps.registry.spec(call.name);
|
|
2818
|
-
const kind = declaredKind(deps, call.name);
|
|
2829
|
+
const kind = call.kind ?? declaredKind(deps, call.name);
|
|
2819
2830
|
const awaitsHuman = kind === "action" || kind === "ask";
|
|
2820
2831
|
await deps.store.recordToolCall({
|
|
2821
2832
|
toolCallId: call.id,
|
|
@@ -3479,12 +3490,12 @@ ${block}`;
|
|
|
3479
3490
|
writer
|
|
3480
3491
|
}) : void 0;
|
|
3481
3492
|
const buffer = gateMode === "whole" ? createFrameBuffer() : void 0;
|
|
3482
|
-
const result = await traceLlmTurn(hooks.runId, i, () => deps.model.runTurn({
|
|
3493
|
+
const result = stampToolKinds(await traceLlmTurn(hooks.runId, i, () => deps.model.runTurn({
|
|
3483
3494
|
system: prompt.system,
|
|
3484
3495
|
messages: prompt.messages,
|
|
3485
3496
|
tools,
|
|
3486
3497
|
sink: incremental?.writer ?? buffer?.writer ?? writer
|
|
3487
|
-
}));
|
|
3498
|
+
})), deps);
|
|
3488
3499
|
if (incremental !== void 0) {
|
|
3489
3500
|
await incremental.settled();
|
|
3490
3501
|
const refusal = incremental.rejection();
|
|
@@ -3543,7 +3554,7 @@ ${block}`;
|
|
|
3543
3554
|
const costUsd = resolveCostUsd(turn.usage, turn.costUsd, priceByModel.get(resolvedModelId));
|
|
3544
3555
|
const toolCallsWithKind = turn.toolCalls.map((call) => ({
|
|
3545
3556
|
...call,
|
|
3546
|
-
kind: declaredKind(deps, call.name)
|
|
3557
|
+
kind: call.kind ?? declaredKind(deps, call.name)
|
|
3547
3558
|
}));
|
|
3548
3559
|
await hooks.step(`persist:usage:${i}`, () => deps.store.recordUsage({
|
|
3549
3560
|
threadId: input.threadId,
|
|
@@ -3980,6 +3991,7 @@ __name(runAgentLoop, "runAgentLoop");
|
|
|
3980
3991
|
skillInputSchema,
|
|
3981
3992
|
skillToolDefinition,
|
|
3982
3993
|
skillWriteVerdict,
|
|
3994
|
+
stampToolKinds,
|
|
3983
3995
|
staticSkillProvider,
|
|
3984
3996
|
summarizeWithModel,
|
|
3985
3997
|
tenantScope,
|