@ynhcj/xiaoyi-channel 0.0.9 → 1.0.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.
@@ -132,6 +132,7 @@ export async function sendCommand(params) {
132
132
  const log = runtime?.log ?? console.log;
133
133
  const error = runtime?.error ?? console.error;
134
134
  // Build artifact update with command as data
135
+ // Wrap command in commands array as per protocol requirement
135
136
  const artifact = {
136
137
  taskId,
137
138
  kind: "artifact-update",
@@ -143,7 +144,9 @@ export async function sendCommand(params) {
143
144
  parts: [
144
145
  {
145
146
  kind: "data",
146
- data: command,
147
+ data: {
148
+ commands: [command],
149
+ },
147
150
  },
148
151
  ],
149
152
  },
@@ -111,6 +111,15 @@ export const xyOutbound = {
111
111
  }
112
112
  // Upload file
113
113
  const fileId = await uploadService.uploadFile(mediaUrl);
114
+ // Check if fileId is empty
115
+ if (!fileId) {
116
+ console.log(`[xyOutbound.sendMedia] ⚠️ File upload failed: fileId is empty, aborting sendMedia`);
117
+ return {
118
+ channel: "xiaoyi-channel",
119
+ messageId: "",
120
+ chatId: to,
121
+ };
122
+ }
114
123
  console.log(`[xyOutbound.sendMedia] File uploaded:`, {
115
124
  fileId,
116
125
  sessionId,
@@ -119,7 +128,7 @@ export const xyOutbound = {
119
128
  // Get filename and mime type from mediaUrl
120
129
  // mediaUrl may be a local file path or URL
121
130
  const fileName = mediaUrl.split("/").pop() || "unknown";
122
- const mimeType = text?.match(/\[ MediaType: ([^\]]+)\]/)?.[1] || "application/octet-stream";
131
+ const mimeType = "text/plain";
123
132
  // Build agent_response message
124
133
  const agentResponse = {
125
134
  msgType: "agent_response",
@@ -47,16 +47,26 @@ export const locationTool = {
47
47
  name: "Action",
48
48
  },
49
49
  payload: {
50
+ cardParam: {},
50
51
  executeParam: {
51
52
  achieveType: "INTENT",
52
53
  actionResponse: true,
53
54
  bundleName: "com.huawei.hmos.aidispatchservice",
55
+ dimension: "",
56
+ executeMode: "background",
54
57
  intentName: "GetCurrentLocation",
55
58
  intentParam: {},
56
59
  needUnlock: true,
60
+ permissionId: [],
57
61
  timeOut: 5,
58
62
  },
59
63
  needUploadResult: true,
64
+ pageControlRelated: false,
65
+ responses: [{
66
+ displayText: "",
67
+ resultCode: "",
68
+ ttsText: "",
69
+ }],
60
70
  },
61
71
  };
62
72
  // Send command and wait for response (5 second timeout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.9",
3
+ "version": "1.0.0",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",