@dudousxd/nestjs-agent 1.25.0 → 1.25.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/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/README.md
CHANGED
|
@@ -151,6 +151,12 @@ With nothing bound to `AGENT_ATTACHMENT_STAGING` there is no way to tell whose m
|
|
|
151
151
|
turn carrying attachments is refused with `501`. Text-only turns are unaffected. At most 10
|
|
152
152
|
attachments per turn.
|
|
153
153
|
|
|
154
|
+
A send must carry something to answer: a non-blank `message`, an attachment, or `regenerate: true`.
|
|
155
|
+
Anything else (`{}`, a blank message) is `400 { code: 'no_user_message' }` (`NO_USER_MESSAGE_CODE`)
|
|
156
|
+
before any thread, run or queue entry exists, on `POST /agent/chat`, the AG-UI route and
|
|
157
|
+
`AgentService.send` / `chat` alike; a `message` that is not a string is `400 invalid_message`. An
|
|
158
|
+
attachment-only send runs with an empty text.
|
|
159
|
+
|
|
154
160
|
`POST /agent/attachments` (multipart, live whenever a staging store is bound — `501` otherwise)
|
|
155
161
|
aborts a body larger than `HARD_MAX_ATTACHMENT_BYTES` (32 MiB) while it streams; the configured
|
|
156
162
|
`maxBytes` narrows that ceiling at request time and cannot raise it. The limits come from ONE place:
|
package/dist/durable/index.cjs
CHANGED
|
@@ -2545,6 +2545,30 @@ function _ts_param7(paramIndex, decorator) {
|
|
|
2545
2545
|
};
|
|
2546
2546
|
}
|
|
2547
2547
|
__name(_ts_param7, "_ts_param");
|
|
2548
|
+
var NO_USER_MESSAGE_CODE = "no_user_message";
|
|
2549
|
+
function sendableParams(params) {
|
|
2550
|
+
const message = params.message;
|
|
2551
|
+
if (message !== void 0 && message !== null && typeof message !== "string") {
|
|
2552
|
+
throw new import_common10.BadRequestException({
|
|
2553
|
+
statusCode: 400,
|
|
2554
|
+
code: "invalid_message",
|
|
2555
|
+
message: "message must be a string"
|
|
2556
|
+
});
|
|
2557
|
+
}
|
|
2558
|
+
const text = typeof message === "string" ? message : "";
|
|
2559
|
+
if (text.trim().length === 0 && (params.attachments?.length ?? 0) === 0 && params.regenerate !== true) {
|
|
2560
|
+
throw new import_common10.BadRequestException({
|
|
2561
|
+
statusCode: 400,
|
|
2562
|
+
code: NO_USER_MESSAGE_CODE,
|
|
2563
|
+
message: "nothing to answer: send a non-empty message, an attachment, or regenerate"
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
return text === message ? params : {
|
|
2567
|
+
...params,
|
|
2568
|
+
message: text
|
|
2569
|
+
};
|
|
2570
|
+
}
|
|
2571
|
+
__name(sendableParams, "sendableParams");
|
|
2548
2572
|
var AgentService = class {
|
|
2549
2573
|
static {
|
|
2550
2574
|
__name(this, "AgentService");
|
|
@@ -2813,7 +2837,8 @@ var AgentService = class {
|
|
|
2813
2837
|
* Send a message: start a turn, or — when its thread already has one running — queue the message
|
|
2814
2838
|
* to run after it (see {@link ChatSendMode}). What `POST <base>/chat` calls.
|
|
2815
2839
|
*/
|
|
2816
|
-
async send(
|
|
2840
|
+
async send(claimed, sendOptions = {}) {
|
|
2841
|
+
const params = sendableParams(claimed);
|
|
2817
2842
|
if (sendOptions.textDecisions !== false && this.options?.actionApprovalMode === "independent" && params.threadId !== void 0 && params.regenerate !== true && this.proposals) {
|
|
2818
2843
|
const decision = await this.proposals.handleTextDecision(params.threadId, params.actor, params.message);
|
|
2819
2844
|
if ("proposalDecision" in decision) return decision;
|