fix(onebot): trace empty text placeholder normalization

Document the compatibility rule in action metadata and regenerate the MCP catalog.
This commit is contained in:
DrSmoothl committed 2026-07-23 12:14:01 +08:00
1 parent a7b9ba14fb
commit edd2ac278a
4 files changed
+63 -54

No files matched your search

+26 -26
View File
@@ -7466,7 +7466,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7474,7 +7474,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
}
],
@@ -7483,10 +7483,10 @@
"type": "object",
"properties": {
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
"additionalProperties": true
@@ -7635,7 +7635,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7643,7 +7643,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
}
],
@@ -7658,10 +7658,10 @@
"x-role": "group_id"
},
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
"required": [
@@ -7694,7 +7694,7 @@
"type": "message",
"required": true,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7718,7 +7718,7 @@
"x-role": "group_id"
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"auto_escape": {
"type": "boolean",
@@ -7794,7 +7794,7 @@
"type": "message",
"required": true,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7840,7 +7840,7 @@
"type": "object",
"properties": {
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message_type": {
"type": "string"
@@ -7998,7 +7998,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -8006,7 +8006,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
}
],
@@ -8020,10 +8020,10 @@
"x-role": "user_id"
},
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
"required": [
@@ -8055,7 +8055,7 @@
"type": "message",
"required": true,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -8087,7 +8087,7 @@
"x-role": "user_id"
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"group_id": {
"type": "integer",
@@ -10528,7 +10528,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10536,7 +10536,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10555,10 +10555,10 @@
"type": "object",
"properties": {
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"group_id": {
"type": "integer",
@@ -10581,7 +10581,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10589,7 +10589,7 @@
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10608,10 +10608,10 @@
"type": "object",
"properties": {
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"group_id": {
"type": "integer",
+26 -26
View File
@@ -7469,7 +7469,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7477,7 +7477,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
}
],
@@ -7486,10 +7486,10 @@ export const ACTIONS: CatalogAction[] = [
"type": "object",
"properties": {
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
"additionalProperties": true
@@ -7638,7 +7638,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7646,7 +7646,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
}
],
@@ -7661,10 +7661,10 @@ export const ACTIONS: CatalogAction[] = [
"x-role": "group_id"
},
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
"required": [
@@ -7697,7 +7697,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": true,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7721,7 +7721,7 @@ export const ACTIONS: CatalogAction[] = [
"x-role": "group_id"
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"auto_escape": {
"type": "boolean",
@@ -7797,7 +7797,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": true,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -7843,7 +7843,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "object",
"properties": {
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message_type": {
"type": "string"
@@ -8001,7 +8001,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -8009,7 +8009,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
}
],
@@ -8023,10 +8023,10 @@ export const ACTIONS: CatalogAction[] = [
"x-role": "user_id"
},
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
"required": [
@@ -8058,7 +8058,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": true,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -8090,7 +8090,7 @@ export const ACTIONS: CatalogAction[] = [
"x-role": "user_id"
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"group_id": {
"type": "integer",
@@ -10531,7 +10531,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10539,7 +10539,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10558,10 +10558,10 @@ export const ACTIONS: CatalogAction[] = [
"type": "object",
"properties": {
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"group_id": {
"type": "integer",
@@ -10584,7 +10584,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10592,7 +10592,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "message",
"required": false,
"schema": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
}
},
{
@@ -10611,10 +10611,10 @@ export const ACTIONS: CatalogAction[] = [
"type": "object",
"properties": {
"messages": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"message": {
"description": "OneBot message: string | segment[] | object"
"description": "OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly \"\" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation."
},
"group_id": {
"type": "integer",
+7 -1
View File
@@ -323,7 +323,13 @@ export const f = {
}
}
return ok(raw);
}, { type: 'message', required: true, schema: { description: 'OneBot message: string | segment[] | object' } });
}, {
type: 'message',
required: true,
schema: {
description: 'OneBot message: string | segment[] | object. In segment arrays, text segments whose text field is exactly "" are compatibility placeholders and do not count as sendable segments; missing, null, and whitespace-only text remain subject to normal validation.',
},
});
},
/** Homogeneous array; `.nonEmpty()` rejects []. */
array<E>(el: Field<E>): Field<E[]> & { nonEmpty(): Field<E[]> } {
+4 -1
View File
@@ -411,7 +411,10 @@ export async function parseMessage(message: JsonValue, autoEscape: boolean, opti
// Some OneBot clients insert empty text between media as a separator.
// Only the exact empty string is a no-op; malformed and whitespace text
// must still pass through strict element validation.
if (seg.type.trim().toLowerCase() === 'text' && data.text === '') continue;
if (seg.type.trim().toLowerCase() === 'text' && data.text === '') {
log.debug('ignored explicit empty text placeholder in message segment array');
continue;
}
const elem = await segmentToElement(seg.type, data, options);
if (elem) elements.push(elem);
}