@ynhcj/xiaoyi-channel 0.0.43-beta → 0.0.44-beta

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.
@@ -147,8 +147,8 @@ export const xyOutbound = {
147
147
  for (const pushId of pushIdList) {
148
148
  try {
149
149
  console.log(`[xyOutbound.sendText] Sending to pushId: ${pushId.substring(0, 20)}...`);
150
- // 传入 pushDataId,使用 kind="data" 格式
151
- await pushService.sendPush(pushText, title, undefined, actualTo, pushDataId);
150
+ // 传入 pushId 和 pushDataId,使用 kind="data" 格式
151
+ await pushService.sendPush(pushText, title, undefined, actualTo, pushDataId, pushId);
152
152
  successCount++;
153
153
  console.log(`[xyOutbound.sendText] ✅ Sent successfully to pushId: ${pushId.substring(0, 20)}...`);
154
154
  }
@@ -20,8 +20,9 @@ export declare class XYPushService {
20
20
  * @param data - Optional additional data
21
21
  * @param sessionId - Optional session ID
22
22
  * @param pushDataId - Optional pushDataId for kind="data" format
23
+ * @param pushId - Push ID to use (required)
23
24
  */
24
- sendPush(content: string, title: string, data?: Record<string, any>, sessionId?: string, pushDataId?: string): Promise<void>;
25
+ sendPush(content: string, title: string, data?: Record<string, any>, sessionId?: string, pushDataId?: string, pushId?: string): Promise<void>;
25
26
  /**
26
27
  * Send a push message with file attachments.
27
28
  */
package/dist/src/push.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // Push message service for scheduled tasks
2
2
  import fetch from "node-fetch";
3
3
  import { randomUUID } from "crypto";
4
- import { configManager } from "./utils/config-manager.js";
5
4
  /**
6
5
  * Service for sending push messages to users.
7
6
  * Used for outbound messages and scheduled tasks.
@@ -27,27 +26,21 @@ export class XYPushService {
27
26
  * @param data - Optional additional data
28
27
  * @param sessionId - Optional session ID
29
28
  * @param pushDataId - Optional pushDataId for kind="data" format
29
+ * @param pushId - Push ID to use (required)
30
30
  */
31
- async sendPush(content, title, data, sessionId, pushDataId) {
31
+ async sendPush(content, title, data, sessionId, pushDataId, pushId) {
32
32
  const pushUrl = this.config.pushUrl || this.DEFAULT_PUSH_URL;
33
33
  const traceId = this.generateTraceId();
34
- // Get dynamic pushId for the session (falls back to config pushId)
35
- const dynamicPushId = configManager.getPushId(sessionId);
36
- const pushId = dynamicPushId || this.config.pushId;
34
+ // Use provided pushId or fall back to config pushId
35
+ const actualPushId = pushId || this.config.pushId;
37
36
  console.log(`[PUSH] 📤 Preparing to send push message`);
38
37
  console.log(`[PUSH] - Title: "${title}"`);
39
38
  console.log(`[PUSH] - Content length: ${content.length} chars`);
40
39
  console.log(`[PUSH] - Session ID: ${sessionId || 'none'}`);
41
40
  console.log(`[PUSH] - Trace ID: ${traceId}`);
42
41
  console.log(`[PUSH] - Push URL: ${pushUrl}`);
43
- if (dynamicPushId) {
44
- console.log(`[PUSH] - Using dynamic pushId (from session): ${pushId.substring(0, 20)}...`);
45
- console.log(`[PUSH] - Full dynamic pushId: ${pushId}`);
46
- }
47
- else {
48
- console.log(`[PUSH] - Using config pushId (fallback): ${pushId.substring(0, 20)}...`);
49
- console.log(`[PUSH] - Full config pushId: ${pushId}`);
50
- }
42
+ console.log(`[PUSH] - Using pushId: ${actualPushId.substring(0, 20)}...`);
43
+ console.log(`[PUSH] - Full pushId: ${actualPushId}`);
51
44
  console.log(`[PUSH] - API ID: ${this.config.apiId}`);
52
45
  console.log(`[PUSH] - UID: ${this.config.uid}`);
53
46
  try {
@@ -57,7 +50,7 @@ export class XYPushService {
57
50
  result: {
58
51
  id: randomUUID(),
59
52
  apiId: this.config.apiId,
60
- pushId: pushId, // Use dynamic pushId
53
+ pushId: actualPushId,
61
54
  pushText: title,
62
55
  kind: "task",
63
56
  artifacts: [
@@ -129,14 +122,14 @@ export class XYPushService {
129
122
  console.log(`[PUSH] ✅ Push message sent successfully`);
130
123
  console.log(`[PUSH] - Title: "${title}"`);
131
124
  console.log(`[PUSH] - Trace ID: ${traceId}`);
132
- console.log(`[PUSH] - Used pushId: ${pushId.substring(0, 20)}...`);
125
+ console.log(`[PUSH] - Used pushId: ${actualPushId.substring(0, 20)}...`);
133
126
  console.log(`[PUSH] - Response:`, result);
134
127
  }
135
128
  catch (error) {
136
129
  console.log(`[PUSH] ❌ Failed to send push message`);
137
130
  console.log(`[PUSH] - Trace ID: ${traceId}`);
138
131
  console.log(`[PUSH] - Target URL: ${pushUrl}`);
139
- console.log(`[PUSH] - Push ID: ${pushId.substring(0, 20)}...`);
132
+ console.log(`[PUSH] - Push ID: ${actualPushId.substring(0, 20)}...`);
140
133
  if (error instanceof Error) {
141
134
  console.log(`[PUSH] - Error name: ${error.name}`);
142
135
  console.log(`[PUSH] - Error message: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.43-beta",
3
+ "version": "0.0.44-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",