@ynhcj/xiaoyi-channel 0.0.178-next → 0.0.179-next
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/dist/src/formatter.js +9 -11
- package/dist/src/outbound.js +5 -0
- package/dist/src/reply-dispatcher.js +0 -6
- package/dist/src/self-evolution-handler.js +2 -1
- package/dist/src/tools/login-token-tool.js +2 -1
- package/dist/src/tools/send-cross-device-task-tool.js +2 -0
- package/dist/src/tools/send-file-to-user-tool.js +2 -0
- package/package.json +1 -1
package/dist/src/formatter.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// OpenClaw → A2A format conversion
|
|
2
|
+
import os from "os";
|
|
2
3
|
import { v4 as uuidv4 } from "uuid";
|
|
3
4
|
import { getXYWebSocketManager } from "./client.js";
|
|
4
5
|
import { logger } from "./utils/logger.js";
|
|
@@ -97,7 +98,7 @@ export async function sendA2AResponse(params) {
|
|
|
97
98
|
agentId: config.agentId,
|
|
98
99
|
sessionId,
|
|
99
100
|
taskId,
|
|
100
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
101
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
101
102
|
};
|
|
102
103
|
if (shouldLog) {
|
|
103
104
|
const redactedText = redactSensitiveText(bridgedText ?? "");
|
|
@@ -141,18 +142,15 @@ export async function sendReasoningTextUpdate(params) {
|
|
|
141
142
|
id: messageId,
|
|
142
143
|
result: artifact,
|
|
143
144
|
};
|
|
144
|
-
const redactedText = redactSensitiveText(bridgedText);
|
|
145
|
-
log.log(`[A2A_REASONING] Sending reasoning update, append=${append}, taskId=${taskId}, messageId=${messageId}, text=${buildTextPreview(redactedText)}, sensitive=${containsSensitiveInfo(bridgedText)}`);
|
|
146
145
|
const wsManager = getXYWebSocketManager(config);
|
|
147
146
|
const outboundMessage = {
|
|
148
147
|
msgType: "agent_response",
|
|
149
148
|
agentId: config.agentId,
|
|
150
149
|
sessionId,
|
|
151
150
|
taskId,
|
|
152
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
151
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
153
152
|
};
|
|
154
153
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
155
|
-
log.log(`[A2A_REASONING] Reasoning update sent successfully`);
|
|
156
154
|
}
|
|
157
155
|
/**
|
|
158
156
|
* Send an A2A task status update.
|
|
@@ -196,7 +194,7 @@ export async function sendStatusUpdate(params) {
|
|
|
196
194
|
agentId: config.agentId,
|
|
197
195
|
sessionId,
|
|
198
196
|
taskId,
|
|
199
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
197
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
200
198
|
};
|
|
201
199
|
// Log complete response body
|
|
202
200
|
log.log(`[A2A_STATUS] Sending status-update, text="${redactedText}"`);
|
|
@@ -304,7 +302,7 @@ export async function sendCommand(params) {
|
|
|
304
302
|
agentId: config.agentId,
|
|
305
303
|
sessionId,
|
|
306
304
|
taskId,
|
|
307
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
305
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
308
306
|
};
|
|
309
307
|
// Log complete response body
|
|
310
308
|
log.log(`[A2A_COMMAND] Sending command`);
|
|
@@ -356,7 +354,7 @@ export async function sendCard(params) {
|
|
|
356
354
|
agentId: config.agentId,
|
|
357
355
|
sessionId,
|
|
358
356
|
taskId,
|
|
359
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
357
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
360
358
|
};
|
|
361
359
|
log.log(`[A2A_CARD] Sending card`);
|
|
362
360
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
@@ -390,7 +388,7 @@ export async function sendClearContextResponse(params) {
|
|
|
390
388
|
agentId: config.agentId,
|
|
391
389
|
sessionId,
|
|
392
390
|
taskId: sessionId, // Use sessionId as taskId for clearContext
|
|
393
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
391
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
394
392
|
};
|
|
395
393
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
396
394
|
log.log(`[CLEAR_CONTEXT] Sent clearContext response`);
|
|
@@ -424,7 +422,7 @@ export async function sendTasksCancelResponse(params) {
|
|
|
424
422
|
agentId: config.agentId,
|
|
425
423
|
sessionId,
|
|
426
424
|
taskId,
|
|
427
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
425
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
428
426
|
};
|
|
429
427
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
430
428
|
log.log(`[TASKS_CANCEL] Sent tasks/cancel response`);
|
|
@@ -472,7 +470,7 @@ export async function sendTriggerResponse(params) {
|
|
|
472
470
|
agentId: config.agentId,
|
|
473
471
|
sessionId,
|
|
474
472
|
taskId,
|
|
475
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
473
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
476
474
|
};
|
|
477
475
|
log.log(`[TRIGGER_RESPONSE] Sending Trigger response, text=${buildTextPreview(redactedContent)}`);
|
|
478
476
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
package/dist/src/outbound.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Outbound adapter for XY channel
|
|
2
|
+
// Following feishu/outbound.ts pattern
|
|
3
|
+
// NOTE: Using any for compatibility with SDK 2026.3.24
|
|
4
|
+
import os from "os";
|
|
1
5
|
import { resolveXYConfig } from "./config.js";
|
|
2
6
|
import { XYFileUploadService } from "./file-upload.js";
|
|
3
7
|
import { XYPushService } from "./push.js";
|
|
@@ -219,6 +223,7 @@ export const xyOutbound = {
|
|
|
219
223
|
},
|
|
220
224
|
},
|
|
221
225
|
error: { code: 0 },
|
|
226
|
+
hostname: os.hostname(),
|
|
222
227
|
}),
|
|
223
228
|
};
|
|
224
229
|
// Get WebSocket manager and send message
|
|
@@ -414,16 +414,13 @@ export function createXYReplyDispatcher(params) {
|
|
|
414
414
|
onReasoningStream: async (payload) => {
|
|
415
415
|
// 🔑 steered dispatch不发送reasoning stream
|
|
416
416
|
if (steerState.steered) {
|
|
417
|
-
scopedLog().log(`[REASONING-STREAM] Skipped (steered dispatch)`);
|
|
418
417
|
return;
|
|
419
418
|
}
|
|
420
419
|
let text = payload.text ?? "";
|
|
421
|
-
scopedLog().log(`[REASONING-STREAM] Received reasoning chunk, rawText.length=${text.length}, steered=${steerState.steered}`);
|
|
422
420
|
// Strip "Reasoning:" prefix that some reasoning models add to their thinking output
|
|
423
421
|
const lines = text.split(/\r?\n/);
|
|
424
422
|
if (lines[0]?.trim() === "Reasoning:") {
|
|
425
423
|
text = lines.slice(1).join("\n").trim();
|
|
426
|
-
scopedLog().log(`[REASONING-STREAM] Stripped "Reasoning:" prefix, text.length=${text.length}`);
|
|
427
424
|
}
|
|
428
425
|
try {
|
|
429
426
|
if (text.length > 0) {
|
|
@@ -436,9 +433,6 @@ export function createXYReplyDispatcher(params) {
|
|
|
436
433
|
append: false,
|
|
437
434
|
});
|
|
438
435
|
}
|
|
439
|
-
else {
|
|
440
|
-
scopedLog().log(`[REASONING-STREAM] Skipped (empty text after stripping)`);
|
|
441
|
-
}
|
|
442
436
|
}
|
|
443
437
|
catch (err) {
|
|
444
438
|
scopedLog().error(`[REASONING-STREAM] Failed to send reasoning text:`, err);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from "os";
|
|
1
2
|
import { readFileSync, writeFileSync } from "fs";
|
|
2
3
|
import { v4 as uuidv4 } from "uuid";
|
|
3
4
|
import { resolveXYConfig } from "./config.js";
|
|
@@ -136,7 +137,7 @@ export async function handleSelfEvolutionStateGetEvent(context, cfg, runtime, ws
|
|
|
136
137
|
agentId: cfg.agentId,
|
|
137
138
|
sessionId,
|
|
138
139
|
taskId,
|
|
139
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
140
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
140
141
|
};
|
|
141
142
|
logger.log(`[A2A_COMMAND] Sending A2A command, taskId: ${taskId}`);
|
|
142
143
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { v4 as uuidv4 } from "uuid";
|
|
3
3
|
import { getCachedXYWebSocketManager } from "../client.js";
|
|
4
4
|
import { getCurrentSessionContext } from './session-manager.js';
|
|
5
|
+
import os from "os";
|
|
5
6
|
import { readFileSync, existsSync } from "fs";
|
|
6
7
|
import { logger } from "../utils/logger.js";
|
|
7
8
|
const TOKEN_FILE_PATH = "/home/sandbox/.openclaw/.xiaoyitoken.json";
|
|
@@ -70,7 +71,7 @@ export const loginTokenTool = {
|
|
|
70
71
|
agentId: config.agentId,
|
|
71
72
|
sessionId,
|
|
72
73
|
taskId,
|
|
73
|
-
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
74
|
+
msgDetail: JSON.stringify({ ...jsonRpcResponse, hostname: os.hostname() }),
|
|
74
75
|
};
|
|
75
76
|
logger.log(`[LOGIN_TOKEN] Sending getLoginToken artifact for clientId=${clientId}, skillName=${skillName}`);
|
|
76
77
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from "os";
|
|
1
2
|
import { sendCommand, sendStatusUpdate } from "../formatter.js";
|
|
2
3
|
import { getCachedXYWebSocketManager } from "../client.js";
|
|
3
4
|
import { logger } from "../utils/logger.js";
|
|
@@ -108,6 +109,7 @@ async function sendFileCardsToUser(ctx, fileCards) {
|
|
|
108
109
|
},
|
|
109
110
|
},
|
|
110
111
|
error: { code: 0 },
|
|
112
|
+
hostname: os.hostname(),
|
|
111
113
|
}),
|
|
112
114
|
};
|
|
113
115
|
logger.log(`${SEND_CROSS_RESULT_LOG_TAG} sending file card by fileId, fileName=${card.fileName}`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getCachedXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { XYFileUploadService } from "../file-upload.js";
|
|
3
|
+
import os from "os";
|
|
3
4
|
import { appendRunCrossTaskSentFiles, getCurrentSessionContext } from './session-manager.js';
|
|
4
5
|
import { logger } from "../utils/logger.js";
|
|
5
6
|
import fetch from "node-fetch";
|
|
@@ -255,6 +256,7 @@ b. 操作超时时间为2分钟(120秒),请勿重复调用此工具,如
|
|
|
255
256
|
},
|
|
256
257
|
},
|
|
257
258
|
error: { code: 0 },
|
|
259
|
+
hostname: os.hostname(),
|
|
258
260
|
}),
|
|
259
261
|
};
|
|
260
262
|
logger.log(`[SEND-FILE-TO-USER] EXEC sending, fileName=${fileName}`);
|