@rei-standard/amsg-server 2.4.0-next.0 → 2.4.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/README.md +2 -2
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.mjs +4 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- 业务端点统一使用 `Authorization: Bearer <tenantToken>`
|
|
10
10
|
- `send-notifications` 支持 `cronToken`(Header 或 query token)
|
|
11
11
|
|
|
12
|
-
2.2+ 的字段增量(`messages` 数组、`splitPattern`、`avatarUrl`
|
|
12
|
+
2.2+ 的字段增量(`messages` 数组、`splitPattern`、`avatarUrl` 软清空策略)在规范的 [§6.1](https://github.com/Tosd0/ReiStandard/blob/main/standards/active-messaging-api.md#61-ai-消息字段约束) / [§6.2](https://github.com/Tosd0/ReiStandard/blob/main/standards/active-messaging-api.md#62-avatarurl-软清空策略)。其中 `splitPattern` 是 server 调度任务的持久化配置;`amsg-instant` 0.8.0 起改为 hook 内自定义 split 函数 + `pushPayloads`。
|
|
13
13
|
|
|
14
14
|
## 安装
|
|
15
15
|
|
|
@@ -78,7 +78,7 @@ AI 配置消息的提示词可以用两种形态之一,**互斥二选一**:
|
|
|
78
78
|
|
|
79
79
|
可选 `temperature?: number` 透传给 LLM:`completePrompt` 路径未传时默认 0.8(保持旧行为);`messages` 路径未传时**不发**,让上游主路径自己决定。
|
|
80
80
|
|
|
81
|
-
## 自定义分句正则 `splitPattern`(2.3.0+)
|
|
81
|
+
## 自定义分句正则 `splitPattern`(server 2.3.0+)
|
|
82
82
|
|
|
83
83
|
`processSingleMessage` 默认按 `/([。!?!?]+)/` 把 LLM 返回的整段文本切成多条推送(每条间隔 1.5s)。`splitPattern` 让调用方覆盖这个正则:
|
|
84
84
|
|
package/dist/index.cjs
CHANGED
|
@@ -190,7 +190,8 @@ function validateScheduleMessagePayload(payload) {
|
|
|
190
190
|
}
|
|
191
191
|
const avatarErr = validateAvatarUrl(payload.avatarUrl);
|
|
192
192
|
if (avatarErr) {
|
|
193
|
-
|
|
193
|
+
console.warn("[amsg-server] avatarUrl \u4E0D\u5408\u6CD5\uFF0C\u5DF2\u7F6E\u7A7A\uFF1A", avatarErr);
|
|
194
|
+
payload.avatarUrl = null;
|
|
194
195
|
}
|
|
195
196
|
if (payload.uuid && !isValidUUID(payload.uuid)) {
|
|
196
197
|
return { valid: false, errorCode: "INVALID_PARAMETERS", errorMessage: "\u7F3A\u5C11\u5FC5\u9700\u53C2\u6570\u6216\u53C2\u6570\u683C\u5F0F\u9519\u8BEF", details: { invalidFields: ["uuid (invalid UUID format)"] } };
|
|
@@ -1152,7 +1153,8 @@ function createUpdateMessageHandler(ctx) {
|
|
|
1152
1153
|
if (Object.prototype.hasOwnProperty.call(updates, "avatarUrl")) {
|
|
1153
1154
|
const avatarErr = validateAvatarUrl(updates.avatarUrl);
|
|
1154
1155
|
if (avatarErr) {
|
|
1155
|
-
|
|
1156
|
+
console.warn("[amsg-server] update-message avatarUrl \u4E0D\u5408\u6CD5\uFF0C\u5DF2\u5FFD\u7565\uFF1A", avatarErr);
|
|
1157
|
+
delete updates.avatarUrl;
|
|
1156
1158
|
}
|
|
1157
1159
|
}
|
|
1158
1160
|
const existingTask = await db.getTaskByUuid(taskUuid, userId);
|
package/dist/index.d.cts
CHANGED
|
@@ -316,7 +316,11 @@ function validateScheduleMessagePayload(payload) {
|
|
|
316
316
|
|
|
317
317
|
const avatarErr = validateAvatarUrl(payload.avatarUrl);
|
|
318
318
|
if (avatarErr) {
|
|
319
|
-
|
|
319
|
+
// Soft-strip: a bad avatarUrl (data: URI / oversized / malformed) used to
|
|
320
|
+
// 400 the whole schedule. Avatar is cosmetic — drop the field, log, and
|
|
321
|
+
// let the rest of the task ship. See standards §6.2.
|
|
322
|
+
console.warn('[amsg-server] avatarUrl 不合法,已置空:', avatarErr);
|
|
323
|
+
payload.avatarUrl = null;
|
|
320
324
|
}
|
|
321
325
|
if (payload.uuid && !isValidUUID(payload.uuid)) {
|
|
322
326
|
return { valid: false, errorCode: 'INVALID_PARAMETERS', errorMessage: '缺少必需参数或参数格式错误', details: { invalidFields: ['uuid (invalid UUID format)'] } };
|
|
@@ -1778,7 +1782,11 @@ function createUpdateMessageHandler(ctx) {
|
|
|
1778
1782
|
if (Object.prototype.hasOwnProperty.call(updates, 'avatarUrl')) {
|
|
1779
1783
|
const avatarErr = validateAvatarUrl(updates.avatarUrl);
|
|
1780
1784
|
if (avatarErr) {
|
|
1781
|
-
|
|
1785
|
+
// Soft-strip: drop the bad avatarUrl from the patch (keeps the
|
|
1786
|
+
// existing stored avatar untouched) and continue applying the rest
|
|
1787
|
+
// of the update. See standards §6.2.
|
|
1788
|
+
console.warn('[amsg-server] update-message avatarUrl 不合法,已忽略:', avatarErr);
|
|
1789
|
+
delete updates.avatarUrl;
|
|
1782
1790
|
}
|
|
1783
1791
|
}
|
|
1784
1792
|
|
package/dist/index.d.ts
CHANGED
|
@@ -316,7 +316,11 @@ function validateScheduleMessagePayload(payload) {
|
|
|
316
316
|
|
|
317
317
|
const avatarErr = validateAvatarUrl(payload.avatarUrl);
|
|
318
318
|
if (avatarErr) {
|
|
319
|
-
|
|
319
|
+
// Soft-strip: a bad avatarUrl (data: URI / oversized / malformed) used to
|
|
320
|
+
// 400 the whole schedule. Avatar is cosmetic — drop the field, log, and
|
|
321
|
+
// let the rest of the task ship. See standards §6.2.
|
|
322
|
+
console.warn('[amsg-server] avatarUrl 不合法,已置空:', avatarErr);
|
|
323
|
+
payload.avatarUrl = null;
|
|
320
324
|
}
|
|
321
325
|
if (payload.uuid && !isValidUUID(payload.uuid)) {
|
|
322
326
|
return { valid: false, errorCode: 'INVALID_PARAMETERS', errorMessage: '缺少必需参数或参数格式错误', details: { invalidFields: ['uuid (invalid UUID format)'] } };
|
|
@@ -1778,7 +1782,11 @@ function createUpdateMessageHandler(ctx) {
|
|
|
1778
1782
|
if (Object.prototype.hasOwnProperty.call(updates, 'avatarUrl')) {
|
|
1779
1783
|
const avatarErr = validateAvatarUrl(updates.avatarUrl);
|
|
1780
1784
|
if (avatarErr) {
|
|
1781
|
-
|
|
1785
|
+
// Soft-strip: drop the bad avatarUrl from the patch (keeps the
|
|
1786
|
+
// existing stored avatar untouched) and continue applying the rest
|
|
1787
|
+
// of the update. See standards §6.2.
|
|
1788
|
+
console.warn('[amsg-server] update-message avatarUrl 不合法,已忽略:', avatarErr);
|
|
1789
|
+
delete updates.avatarUrl;
|
|
1782
1790
|
}
|
|
1783
1791
|
}
|
|
1784
1792
|
|
package/dist/index.mjs
CHANGED
|
@@ -190,7 +190,8 @@ function validateScheduleMessagePayload(payload) {
|
|
|
190
190
|
}
|
|
191
191
|
const avatarErr = validateAvatarUrl(payload.avatarUrl);
|
|
192
192
|
if (avatarErr) {
|
|
193
|
-
|
|
193
|
+
console.warn("[amsg-server] avatarUrl \u4E0D\u5408\u6CD5\uFF0C\u5DF2\u7F6E\u7A7A\uFF1A", avatarErr);
|
|
194
|
+
payload.avatarUrl = null;
|
|
194
195
|
}
|
|
195
196
|
if (payload.uuid && !isValidUUID(payload.uuid)) {
|
|
196
197
|
return { valid: false, errorCode: "INVALID_PARAMETERS", errorMessage: "\u7F3A\u5C11\u5FC5\u9700\u53C2\u6570\u6216\u53C2\u6570\u683C\u5F0F\u9519\u8BEF", details: { invalidFields: ["uuid (invalid UUID format)"] } };
|
|
@@ -1152,7 +1153,8 @@ function createUpdateMessageHandler(ctx) {
|
|
|
1152
1153
|
if (Object.prototype.hasOwnProperty.call(updates, "avatarUrl")) {
|
|
1153
1154
|
const avatarErr = validateAvatarUrl(updates.avatarUrl);
|
|
1154
1155
|
if (avatarErr) {
|
|
1155
|
-
|
|
1156
|
+
console.warn("[amsg-server] update-message avatarUrl \u4E0D\u5408\u6CD5\uFF0C\u5DF2\u5FFD\u7565\uFF1A", avatarErr);
|
|
1157
|
+
delete updates.avatarUrl;
|
|
1156
1158
|
}
|
|
1157
1159
|
}
|
|
1158
1160
|
const existingTask = await db.getTaskByUuid(taskUuid, userId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rei-standard/amsg-server",
|
|
3
|
-
"version": "2.4.0
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "ReiStandard Active Messaging server SDK with pluggable database adapters. Three-axis push schema (messageKind / messageType / messageSubtype) from @rei-standard/amsg-shared. Auto-emits ReasoningPush when the LLM response carries reasoning_content.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=20"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@rei-standard/amsg-shared": "0.1.0
|
|
36
|
+
"@rei-standard/amsg-shared": "0.1.0",
|
|
37
37
|
"web-push": "^3.6.7",
|
|
38
38
|
"@netlify/blobs": "^8.1.0"
|
|
39
39
|
},
|