@xfxstudio/claworld 2026.5.3-testing.1 → 2026.5.6-testing
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/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1292,6 +1292,8 @@ function compactResultPayload(payload = {}) {
|
|
|
1292
1292
|
'status',
|
|
1293
1293
|
'tool',
|
|
1294
1294
|
'action',
|
|
1295
|
+
'scope',
|
|
1296
|
+
'query',
|
|
1295
1297
|
'accountId',
|
|
1296
1298
|
'worldId',
|
|
1297
1299
|
'displayName',
|
|
@@ -1317,6 +1319,53 @@ function readNestedObject(value, key) {
|
|
|
1317
1319
|
return nested && typeof nested === 'object' && !Array.isArray(nested) ? nested : {};
|
|
1318
1320
|
}
|
|
1319
1321
|
|
|
1322
|
+
function firstObjectFromArray(value) {
|
|
1323
|
+
if (!Array.isArray(value)) return {};
|
|
1324
|
+
return value.find((entry) => isPlainObject(entry)) || {};
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
function nestedConversationWorldId(value = {}) {
|
|
1328
|
+
return firstText(value.worldId, value.conversation?.worldId);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
function resolvePayloadItemCounts(payload = {}) {
|
|
1332
|
+
const counts = [];
|
|
1333
|
+
for (const [key, label] of [
|
|
1334
|
+
['worlds', 'worlds'],
|
|
1335
|
+
['members', 'members'],
|
|
1336
|
+
['people', 'people'],
|
|
1337
|
+
['results', 'results'],
|
|
1338
|
+
['items', 'items'],
|
|
1339
|
+
['pendingRequests', 'pendingRequests'],
|
|
1340
|
+
['recentRequests', 'recentRequests'],
|
|
1341
|
+
['chats', 'chats'],
|
|
1342
|
+
]) {
|
|
1343
|
+
if (Array.isArray(payload[key])) {
|
|
1344
|
+
counts.push(`${label}=${payload[key].length}`);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return counts;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
function formatToolSummaryPart(key, value) {
|
|
1351
|
+
const normalized = flattenInline(value);
|
|
1352
|
+
return normalized ? `${key}=${normalized}` : null;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
function buildToolCallSummary({ toolName, params = {}, payload = {}, compactPayload = {} } = {}) {
|
|
1356
|
+
const parts = [
|
|
1357
|
+
formatToolSummaryPart('action', firstText(params.action, payload.action)),
|
|
1358
|
+
formatToolSummaryPart('scope', firstText(params.scope, payload.scope)),
|
|
1359
|
+
formatToolSummaryPart('query', firstText(params.query, payload.query)),
|
|
1360
|
+
formatToolSummaryPart('status', firstText(payload.status, compactPayload.status)),
|
|
1361
|
+
formatToolSummaryPart('worldId', firstText(params.worldId, payload.worldId)),
|
|
1362
|
+
formatToolSummaryPart('chatRequestId', firstText(params.chatRequestId, payload.chatRequestId)),
|
|
1363
|
+
formatToolSummaryPart('conversationKey', firstText(params.conversationKey, payload.conversationKey)),
|
|
1364
|
+
...resolvePayloadItemCounts(payload),
|
|
1365
|
+
].filter(Boolean);
|
|
1366
|
+
return `${toolName} completed${parts.length > 0 ? ` (${parts.join(', ')})` : ''}.`;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1320
1369
|
export function buildClaworldToolMaintenanceEvent({
|
|
1321
1370
|
toolName,
|
|
1322
1371
|
params = {},
|
|
@@ -1330,6 +1379,8 @@ export function buildClaworldToolMaintenanceEvent({
|
|
|
1330
1379
|
const chatRequest = readNestedObject(payload, 'chatRequest');
|
|
1331
1380
|
const request = readNestedObject(payload, 'request');
|
|
1332
1381
|
const kickoff = readNestedObject(payload, 'kickoff');
|
|
1382
|
+
const chat = readNestedObject(payload, 'chat');
|
|
1383
|
+
const firstChat = firstObjectFromArray(payload.chats);
|
|
1333
1384
|
const conversation = readNestedObject(payload, 'conversation');
|
|
1334
1385
|
const compactPayload = compactResultPayload(payload);
|
|
1335
1386
|
const requestId = firstText(
|
|
@@ -1340,31 +1391,82 @@ export function buildClaworldToolMaintenanceEvent({
|
|
|
1340
1391
|
chatRequest.chatRequestId,
|
|
1341
1392
|
chatRequest.requestId,
|
|
1342
1393
|
request.requestId,
|
|
1394
|
+
chat.chatRequestId,
|
|
1395
|
+
firstChat.chatRequestId,
|
|
1343
1396
|
);
|
|
1344
|
-
const
|
|
1397
|
+
const requesterSessionKey = firstText(
|
|
1345
1398
|
context.sessionKey,
|
|
1346
1399
|
context.SessionKey,
|
|
1347
1400
|
context.localSessionKey,
|
|
1401
|
+
context.LocalSessionKey,
|
|
1402
|
+
);
|
|
1403
|
+
const resultConversationSessionKey = firstText(
|
|
1404
|
+
chat.localSessionKey,
|
|
1405
|
+
firstChat.localSessionKey,
|
|
1348
1406
|
payload.localSessionKey,
|
|
1349
1407
|
kickoff.localSessionKey,
|
|
1408
|
+
conversation.localSessionKey,
|
|
1409
|
+
);
|
|
1410
|
+
const conversationToolNames = new Set([
|
|
1411
|
+
'claworld_manage_conversations',
|
|
1412
|
+
'claworld_chat_inbox',
|
|
1413
|
+
'claworld_request_chat',
|
|
1414
|
+
]);
|
|
1415
|
+
const localSessionKey = firstText(
|
|
1416
|
+
conversationToolNames.has(normalizedToolName) ? resultConversationSessionKey : null,
|
|
1417
|
+
requesterSessionKey,
|
|
1418
|
+
resultConversationSessionKey,
|
|
1350
1419
|
);
|
|
1351
1420
|
const relaySessionKey = firstText(
|
|
1352
1421
|
context.RelaySessionKey,
|
|
1353
1422
|
payload.sessionKey,
|
|
1423
|
+
chat.sessionKey,
|
|
1424
|
+
firstChat.sessionKey,
|
|
1354
1425
|
kickoff.sessionKey,
|
|
1355
1426
|
conversation.sessionKey,
|
|
1356
1427
|
);
|
|
1428
|
+
const targetDiffersFromRequester = requesterSessionKey && localSessionKey && requesterSessionKey !== localSessionKey;
|
|
1357
1429
|
const sessionKind = resolveJournalScope({
|
|
1358
1430
|
sessionKey: localSessionKey || relaySessionKey,
|
|
1431
|
+
sessionType: targetDiffersFromRequester
|
|
1432
|
+
? null
|
|
1433
|
+
: firstText(context.sessionType, context.SessionType, context.ChatType, context.sessionKind),
|
|
1434
|
+
context: targetDiffersFromRequester ? {} : context,
|
|
1435
|
+
});
|
|
1436
|
+
const actorSessionKind = resolveJournalScope({
|
|
1437
|
+
sessionKey: requesterSessionKey || localSessionKey || relaySessionKey,
|
|
1359
1438
|
sessionType: firstText(context.sessionType, context.SessionType, context.ChatType, context.sessionKind),
|
|
1360
1439
|
context,
|
|
1361
1440
|
});
|
|
1362
1441
|
const refs = {
|
|
1363
1442
|
accountId: params.accountId || payload.accountId,
|
|
1364
|
-
worldId:
|
|
1443
|
+
worldId: firstText(
|
|
1444
|
+
params.worldId,
|
|
1445
|
+
payload.worldId,
|
|
1446
|
+
nestedConversationWorldId(chat),
|
|
1447
|
+
nestedConversationWorldId(firstChat),
|
|
1448
|
+
nestedConversationWorldId(chatRequest),
|
|
1449
|
+
nestedConversationWorldId(request),
|
|
1450
|
+
conversation.worldId,
|
|
1451
|
+
),
|
|
1365
1452
|
requestId,
|
|
1366
|
-
chatRequestId:
|
|
1367
|
-
|
|
1453
|
+
chatRequestId: firstText(
|
|
1454
|
+
params.chatRequestId,
|
|
1455
|
+
payload.chatRequestId,
|
|
1456
|
+
chatRequest.chatRequestId,
|
|
1457
|
+
request.chatRequestId,
|
|
1458
|
+
chat.chatRequestId,
|
|
1459
|
+
firstChat.chatRequestId,
|
|
1460
|
+
requestId,
|
|
1461
|
+
),
|
|
1462
|
+
conversationKey: firstText(
|
|
1463
|
+
params.conversationKey,
|
|
1464
|
+
payload.conversationKey,
|
|
1465
|
+
conversation.conversationKey,
|
|
1466
|
+
kickoff.conversationKey,
|
|
1467
|
+
chat.conversationKey,
|
|
1468
|
+
firstChat.conversationKey,
|
|
1469
|
+
),
|
|
1368
1470
|
agentCode: params.agentCode || payload.agentCode,
|
|
1369
1471
|
sessionKey: localSessionKey || relaySessionKey,
|
|
1370
1472
|
relaySessionKey,
|
|
@@ -1388,21 +1490,28 @@ export function buildClaworldToolMaintenanceEvent({
|
|
|
1388
1490
|
relaySessionKey,
|
|
1389
1491
|
sessionKey: localSessionKey || relaySessionKey,
|
|
1390
1492
|
localAgentId: firstText(context.agentId, context.AgentId),
|
|
1391
|
-
sessionId: firstText(context.sessionId, context.SessionId),
|
|
1392
|
-
sessionFile: firstText(context.sessionFile, context.SessionFile, context.sessionPath),
|
|
1393
|
-
transcriptPath: firstText(context.transcriptPath),
|
|
1493
|
+
sessionId: targetDiffersFromRequester ? null : firstText(context.sessionId, context.SessionId),
|
|
1494
|
+
sessionFile: targetDiffersFromRequester ? null : firstText(context.sessionFile, context.SessionFile, context.sessionPath),
|
|
1495
|
+
transcriptPath: targetDiffersFromRequester ? null : firstText(context.transcriptPath),
|
|
1394
1496
|
},
|
|
1395
1497
|
actor: {
|
|
1396
|
-
sessionKind,
|
|
1498
|
+
sessionKind: actorSessionKind,
|
|
1397
1499
|
agentId: firstText(context.agentId, context.AgentId),
|
|
1398
|
-
sessionKey: localSessionKey || relaySessionKey,
|
|
1500
|
+
sessionKey: requesterSessionKey || localSessionKey || relaySessionKey,
|
|
1399
1501
|
},
|
|
1400
1502
|
tool: {
|
|
1401
1503
|
name: normalizedToolName,
|
|
1402
1504
|
action: firstText(params.action, payload.action),
|
|
1403
1505
|
status: firstText(payload.status, 'succeeded'),
|
|
1506
|
+
requesterSessionKey,
|
|
1507
|
+
targetSessionKey: targetDiffersFromRequester ? localSessionKey : null,
|
|
1404
1508
|
},
|
|
1405
|
-
summary:
|
|
1509
|
+
summary: buildToolCallSummary({
|
|
1510
|
+
toolName: normalizedToolName,
|
|
1511
|
+
params,
|
|
1512
|
+
payload,
|
|
1513
|
+
compactPayload,
|
|
1514
|
+
}),
|
|
1406
1515
|
excerpt: Object.keys(compactPayload).length > 0
|
|
1407
1516
|
? JSON.stringify(compactPayload)
|
|
1408
1517
|
: null,
|