@dudousxd/nestjs-agent 1.25.0 → 1.25.1
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/README.md +6 -0
- package/dist/durable/index.cjs +26 -1
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +26 -1
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +31 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/durable/index.js
CHANGED
|
@@ -2517,6 +2517,30 @@ function _ts_param7(paramIndex, decorator) {
|
|
|
2517
2517
|
};
|
|
2518
2518
|
}
|
|
2519
2519
|
__name(_ts_param7, "_ts_param");
|
|
2520
|
+
var NO_USER_MESSAGE_CODE = "no_user_message";
|
|
2521
|
+
function sendableParams(params) {
|
|
2522
|
+
const message = params.message;
|
|
2523
|
+
if (message !== void 0 && message !== null && typeof message !== "string") {
|
|
2524
|
+
throw new BadRequestException2({
|
|
2525
|
+
statusCode: 400,
|
|
2526
|
+
code: "invalid_message",
|
|
2527
|
+
message: "message must be a string"
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
const text = typeof message === "string" ? message : "";
|
|
2531
|
+
if (text.trim().length === 0 && (params.attachments?.length ?? 0) === 0 && params.regenerate !== true) {
|
|
2532
|
+
throw new BadRequestException2({
|
|
2533
|
+
statusCode: 400,
|
|
2534
|
+
code: NO_USER_MESSAGE_CODE,
|
|
2535
|
+
message: "nothing to answer: send a non-empty message, an attachment, or regenerate"
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
return text === message ? params : {
|
|
2539
|
+
...params,
|
|
2540
|
+
message: text
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
__name(sendableParams, "sendableParams");
|
|
2520
2544
|
var AgentService = class {
|
|
2521
2545
|
static {
|
|
2522
2546
|
__name(this, "AgentService");
|
|
@@ -2785,7 +2809,8 @@ var AgentService = class {
|
|
|
2785
2809
|
* Send a message: start a turn, or — when its thread already has one running — queue the message
|
|
2786
2810
|
* to run after it (see {@link ChatSendMode}). What `POST <base>/chat` calls.
|
|
2787
2811
|
*/
|
|
2788
|
-
async send(
|
|
2812
|
+
async send(claimed, sendOptions = {}) {
|
|
2813
|
+
const params = sendableParams(claimed);
|
|
2789
2814
|
if (sendOptions.textDecisions !== false && this.options?.actionApprovalMode === "independent" && params.threadId !== void 0 && params.regenerate !== true && this.proposals) {
|
|
2790
2815
|
const decision = await this.proposals.handleTextDecision(params.threadId, params.actor, params.message);
|
|
2791
2816
|
if ("proposalDecision" in decision) return decision;
|