@jerryliang122/openclaw-qqbot 1.0.6 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jerryliang122/openclaw-qqbot",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "QQ Bot channel plugin for OpenClaw (independently maintained fork)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^20.19.43",
51
- "openclaw": "2026.9.2",
51
+ "openclaw": "2026.9.1",
52
52
  "tsup": "^8.5.1",
53
53
  "typescript": "^5.9.3",
54
54
  "tsx": "^4.23.13"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@tencent-connect/qqbot-connector": "1.2.0",
58
- "openclaw": ">=2026.9.2"
58
+ "openclaw": ">=2026.9.1"
59
59
  },
60
60
  "homepage": "https://github.com/jerryliang122/qqbot-openclaw",
61
61
  "repository": {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * readAllowFromStore / issueChallenge / buildReply 直接来自稳定 subpath。
5
5
  *
6
- * approveCode 例外:`approveChannelPairingCode` 在 2026.9.2 未从任何
6
+ * approveCode 例外:`approveChannelPairingCode` 在 2026.9.1/2026.9.2 均未从任何
7
7
  * plugin-sdk subpath 导出(只存在于内部 pairing-store chunk 与
8
8
  * `openclaw pairing approve` CLI),走与网关同源的 CLI 执行
9
9
  * (见 secret-store-cli 的 resolveOpenClawCli 同源约束)。
@@ -2,7 +2,7 @@
2
2
  * Runtime Adapters — 一次 resolve,全程复用。
3
3
  *
4
4
  * Capability Probe 模式:按候选 API 路径探测,选出第一个可用函数。
5
- * 构建基线为 openclaw 2026.9.2(peer >=2026.9.2),不再保留对更旧版本的回退。
5
+ * 构建基线为 openclaw 2026.9.1(peer >=2026.9.1),不再保留对更旧版本的回退。
6
6
  *
7
7
  * 调用方通过 `resolveRuntimeAdapters(runtime)` 获取适配层对象,
8
8
  * 后续所有 dispatch / channel 代码只使用 adapters 上的方法。
@@ -237,7 +237,7 @@ export async function persistAuthConfig(
237
237
  const config: Record<string, unknown> | undefined = runtime.config as any;
238
238
 
239
239
  if (typeof config?.mutateConfigFile !== 'function') {
240
- throw new Error('persistAuthConfig: runtime.config.mutateConfigFile is unavailable (requires openclaw >= 2026.9.2)');
240
+ throw new Error('persistAuthConfig: runtime.config.mutateConfigFile is unavailable (requires openclaw >= 2026.9.1)');
241
241
  }
242
242
  await (config.mutateConfigFile as Function)({
243
243
  mutate: () => cfg,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Setup 工具 re-export(plugin-sdk/setup + plugin-sdk/setup-tools)
3
3
  *
4
- * 构建基线 openclaw 2026.9.2,两个 subpath 均为正式导出,直接转发。
4
+ * 构建基线 openclaw 2026.9.1,两个 subpath 均为正式导出,直接转发。
5
5
  */
6
6
  export type { ChannelSetupWizard } from 'openclaw/plugin-sdk/setup';
7
7
 
@@ -89,7 +89,26 @@ export function buildCtxPayload(params: CtxPayloadParams): any {
89
89
  },
90
90
  reply: {
91
91
  to: envelope.targetId,
92
- replyToId: envelope.messageId,
92
+ /**
93
+ * ReplyToId 契约语义 = 当前消息回复(引用)的那条消息的 ID —— 对齐
94
+ * telegram 原生通道(replyHead?.messageId ?? visibleReplyTarget?.id),
95
+ * 无引用时必须为 undefined。框架将其渲染为模型可见 Conversation info
96
+ * 的 reply_to_id 字段。
97
+ *
98
+ * 历史版本误填 envelope.messageId(消息自身 ID),导致每条消息都呈现
99
+ * message_id == reply_to_id —— 被上层 agent 的 AGENTS 规则判为「内部
100
+ * 回灌、非新指令」而拒绝响应(2026-09-22 事故)。
101
+ *
102
+ * QQ 被动回复锚点不依赖此字段:deliverCtx.replyToId / msgid-cache 兜底
103
+ * (resolvePassiveFirstReplyToId)/ attachMsgIdWithQuota 均独立取值,
104
+ * threading resolveReplyToMode='off' 阻断框架隐式回复线程。
105
+ *
106
+ * 防御守卫:即使上游异常传入当前消息 ID(自引用),也强制置空——
107
+ * 「reply_to_id == message_id」这一假回灌签名在任何路径都不允许再现。
108
+ */
109
+ replyToId: envelope.quote?.messageId && envelope.quote.messageId !== envelope.messageId
110
+ ? envelope.quote.messageId
111
+ : undefined,
93
112
  originatingTo: envelope.targetId,
94
113
  },
95
114
  access: {
@@ -100,8 +119,17 @@ export function buildCtxPayload(params: CtxPayloadParams): any {
100
119
  : undefined,
101
120
  media: mediaFacts.length > 0 ? mediaFacts : undefined,
102
121
  supplemental: {
122
+ // quote.id 同样必须是「被引用消息」的真实 ID(ref-index 命中时),
123
+ // 而非当前消息 ID——框架经 applySupplementalContext 映射为
124
+ // ctx.ReplyToId / "Reply target of current user message"。
103
125
  quote: envelope.quote
104
- ? { id: envelope.messageId, body: envelope.quote.content, sender: envelope.quote.senderId }
126
+ ? {
127
+ ...(envelope.quote.messageId && envelope.quote.messageId !== envelope.messageId
128
+ ? { id: envelope.quote.messageId }
129
+ : {}),
130
+ body: envelope.quote.content,
131
+ sender: envelope.quote.senderId,
132
+ }
105
133
  : undefined,
106
134
  groupSystemPrompt: envelope.systemPrompt,
107
135
  },
@@ -97,7 +97,7 @@ export async function dispatchToOpenClaw(
97
97
  dlog?.debug(`received sender=${envelope.senderId} scope=${envelope.chatScope} msgId=${envelope.messageId}`);
98
98
 
99
99
  if (!adapters.inboundRun || !adapters.dispatchReply) {
100
- dlog?.error(`runtime adapter inboundRun/dispatchReply not available (openclaw=${adapters.version}, requires >=2026.9.2)`);
100
+ dlog?.error(`runtime adapter inboundRun/dispatchReply not available (openclaw=${adapters.version}, requires >=2026.9.1)`);
101
101
  return;
102
102
  }
103
103
 
@@ -20,7 +20,7 @@ export interface OpenClawInboundMessage {
20
20
  messageId: string;
21
21
  content: string;
22
22
  history?: Array<{ role: string; content: string; senderId?: string; senderName?: string }>;
23
- quote?: { content: string; senderId: string; attachments?: unknown[] };
23
+ quote?: { content: string; senderId: string; messageId?: string; attachments?: unknown[] };
24
24
  attachments?: unknown[];
25
25
  /** 入站图片 URL 列表(从附件中提取) */
26
26
  imageUrls?: string[];
@@ -44,7 +44,11 @@ function mapHistory(
44
44
  }
45
45
 
46
46
  /**
47
- * 将 ResolvedQuote 转换为 OpenClaw quote 格式
47
+ * 将 ResolvedQuote 转换为 OpenClaw quote 格式。
48
+ *
49
+ * messageId 为被引用消息的真实平台消息 ID:仅 ref-index store 命中
50
+ * (quote.source === 'store',entry 存在)时可取;msg_elements 兜底
51
+ * 解析拿不到 id,保持 undefined —— 此时框架不渲染 reply_to_id。
48
52
  */
49
53
  function mapQuote(
50
54
  quote: ResolvedQuote | undefined,
@@ -53,6 +57,7 @@ function mapQuote(
53
57
  return {
54
58
  content: quote.text,
55
59
  senderId: quote.entry?.senderId ?? '',
60
+ messageId: quote.entry?.messageId,
56
61
  attachments: quote.attachments as unknown[],
57
62
  };
58
63
  }
@@ -74,7 +74,7 @@ let questionRuntimePromise: Promise<QuestionGatewayRuntime> | undefined;
74
74
 
75
75
  /**
76
76
  * question gateway runtime(openclaw/plugin-sdk/question-gateway-runtime,
77
- * 2026.8.1+ 稳定导出,peer 已要求 >=2026.9.2)。
77
+ * 2026.8.1+ 稳定导出,peer 已要求 >=2026.9.1)。
78
78
  */
79
79
  export function getQuestionGatewayRuntime(): Promise<QuestionGatewayRuntime> {
80
80
  questionRuntimePromise ??= import('openclaw/plugin-sdk/question-gateway-runtime')
@@ -536,7 +536,7 @@ declare module "openclaw/plugin-sdk" {
536
536
  }
537
537
 
538
538
  // 2026.8.1-beta 起 openclaw 发布包明确排除该子路径的 .d.ts(files 列表
539
- // "!dist/plugin-sdk/text-utility-runtime.d.ts"),2026.9.2 仍未恢复,运行时导出仍在。
539
+ // "!dist/plugin-sdk/text-utility-runtime.d.ts"),2026.9.1/2026.9.2 均未恢复,运行时导出仍在。
540
540
  // 仅声明本项目实际使用的函数(签名对齐 dist/utf16-slice-*.js)。
541
541
  declare module "openclaw/plugin-sdk/text-utility-runtime" {
542
542
  export function truncateUtf16Safe(input: string, maxLen: number): string;
@@ -16,7 +16,7 @@ export function getPackageVersion(): string {
16
16
  }
17
17
 
18
18
  /**
19
- * OpenClaw 框架版本(PluginRuntime.version,peer >=2026.9.2 恒存在)。
19
+ * OpenClaw 框架版本(PluginRuntime.version,peer >=2026.9.1 恒存在)。
20
20
  */
21
21
  export function getOpenclawVersion(runtimeVersion?: string): string {
22
22
  return runtimeVersion && runtimeVersion !== 'unknown' ? runtimeVersion : 'unknown';