cortico-world-forward-reader 0.1.0 → 0.1.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/describe.json CHANGED
@@ -5,13 +5,13 @@
5
5
  "tags": [
6
6
  "read"
7
7
  ],
8
- "description": "拆开 QQ 的「合并转发 / 聊天记录」卡片,包括转发里套着的转发。\n什么时候用:收到 `qq.forward` 事件、或者 QQ 消息里写着「[合并转发]」但只摊开了一层、里面还有「又一层」时;想看清某段聊天记录到底是谁说了什么,也用它。\n怎么给编号:QQ 消息事件行首的 `#编号`(如 `#265277450`)就是 message_id,原样填进 ref;带不带 `#`、前后有空格都不要紧。\n它只读,只走本机的 SnowLuma OneBot HTTP 接口(默认 127.0.0.1:3000),不发消息、不改任何东西;接口没开或 token 不对会直接说清楚哪一步不对。输出过长会截断。",
8
+ "description": "拆开 QQ 的「合并转发 / 聊天记录」卡片,包括转发里套着的转发。\n什么时候用:收到 `qq.forward` 事件、或者 QQ 消息里写着「[合并转发]」但只摊开了一层、里面还有「又一层」时;想看清某段聊天记录到底是谁说了什么,也用它。\n怎么给编号:QQ 消息事件行首的 `#编号`(如 `#265277450`)就是 message_id,原样填进 ref;带不带 `#`、前后有空格都不要紧。编号可能是负数(如 `#-1175570559`),负号是编号的一部分,要一起填,别去掉。\n它只读,只走本机的 SnowLuma OneBot HTTP 接口(默认 127.0.0.1:3000),不发消息、不改任何东西;接口没开或 token 不对会直接说清楚哪一步不对。输出过长会截断。",
9
9
  "parameters": {
10
10
  "type": "object",
11
11
  "properties": {
12
12
  "ref": {
13
13
  "type": "string",
14
- "description": "消息编号,即 QQ 消息事件行首的 #后面的数字,如 \"265277450\"。"
14
+ "description": "消息编号,即 QQ 消息事件行首的 #后面的数字,如 \"265277450\";负数就带负号一起填,如 \"-1175570559\"。"
15
15
  },
16
16
  "depth": {
17
17
  "type": "integer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-forward-reader",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "转发拆解 World:把 QQ 的「合并转发」一层层拆到底,嵌套在里面的转发也展开,输出带缩进的人话。只读,不发消息。",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -128,7 +128,8 @@ export class ForwardReaderWorld {
128
128
  .trim()
129
129
  .replace(/^#/, '');
130
130
  if (!rawRef) return fail('要给消息编号(QQ 消息行首的 #后面那串数字)。');
131
- if (!/^\d+$/.test(rawRef)) return fail(`"${rawRef}" 不像消息编号,应该是纯数字,比如 265277450。`);
131
+ // QQ 的 message_id 有负数的(合并转发卡片就常见):负号是 id 的一部分,不能丢。
132
+ if (!/^-?\d+$/.test(rawRef)) return fail(`"${rawRef}" 不像消息编号,应该是数字(前面可能带一个负号),比如 265277450 或 -1175570559。`);
132
133
 
133
134
  const maxDepth = clampInt(args.depth ?? cfg.maxDepth, 8, 1, 20);
134
135
  const limit = clampInt(args.maxChars ?? cfg.maxChars, MAX_OUTPUT_CHARS, 1000, 60000);
package/src/tools.js CHANGED
@@ -15,7 +15,8 @@ export const TOOL_DECLS = [
15
15
  '拆开 QQ 的「合并转发 / 聊天记录」卡片,包括转发里套着的转发。\n' +
16
16
  '什么时候用:收到 `qq.forward` 事件、或者 QQ 消息里写着「[合并转发]」但只摊开了一层、里面还有「又一层」时;' +
17
17
  '想看清某段聊天记录到底是谁说了什么,也用它。\n' +
18
- '怎么给编号:QQ 消息事件行首的 `#编号`(如 `#265277450`)就是 message_id,原样填进 ref;带不带 `#`、前后有空格都不要紧。\n' +
18
+ '怎么给编号:QQ 消息事件行首的 `#编号`(如 `#265277450`)就是 message_id,原样填进 ref;带不带 `#`、前后有空格都不要紧。' +
19
+ '编号可能是负数(如 `#-1175570559`),负号是编号的一部分,要一起填,别去掉。\n' +
19
20
  '它只读,只走本机的 SnowLuma OneBot HTTP 接口(默认 127.0.0.1:3000),不发消息、不改任何东西;' +
20
21
  '接口没开或 token 不对会直接说清楚哪一步不对。输出过长会截断。',
21
22
  parameters: {
@@ -23,7 +24,7 @@ export const TOOL_DECLS = [
23
24
  properties: {
24
25
  ref: {
25
26
  type: 'string',
26
- description: '消息编号,即 QQ 消息事件行首的 #后面的数字,如 "265277450"。',
27
+ description: '消息编号,即 QQ 消息事件行首的 #后面的数字,如 "265277450";负数就带负号一起填,如 "-1175570559"。',
27
28
  },
28
29
  depth: {
29
30
  type: 'integer',