@ai-setting/roy-agent-cli 1.7.39 → 1.7.40
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/bin/roy-agent.js +39 -10
- package/dist/index.js +39 -10
- package/dist/roy-agent-linux-x64/bin/roy-agent +2 -2
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -9461,7 +9461,7 @@ class CliQuietModeService {
|
|
|
9461
9461
|
// package.json
|
|
9462
9462
|
var package_default = {
|
|
9463
9463
|
name: "@ai-setting/roy-agent-cli",
|
|
9464
|
-
version: "1.7.
|
|
9464
|
+
version: "1.7.40",
|
|
9465
9465
|
type: "module",
|
|
9466
9466
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9467
9467
|
main: "./dist/index.js",
|
|
@@ -11546,6 +11546,12 @@ function parseLarkPerTaskChatId(contextJson) {
|
|
|
11546
11546
|
return;
|
|
11547
11547
|
}
|
|
11548
11548
|
}
|
|
11549
|
+
var NOTIFY_V2_TERMINAL_TYPES = new Set([
|
|
11550
|
+
"task.background.completed",
|
|
11551
|
+
"task.background.failed",
|
|
11552
|
+
"task.background.timeout",
|
|
11553
|
+
"task.background.stopped"
|
|
11554
|
+
]);
|
|
11549
11555
|
|
|
11550
11556
|
class EventHandler {
|
|
11551
11557
|
env;
|
|
@@ -11620,7 +11626,7 @@ class EventHandler {
|
|
|
11620
11626
|
this.enqueue(formatted);
|
|
11621
11627
|
}
|
|
11622
11628
|
async formatEvent(event) {
|
|
11623
|
-
if (event.type
|
|
11629
|
+
if (NOTIFY_V2_TERMINAL_TYPES.has(event.type) && event.metadata?.triggerEventId && this.eventStore && this.getHandlerForEsType) {
|
|
11624
11630
|
try {
|
|
11625
11631
|
const v2Formatted = await this.formatEventViaESPluginV2(event);
|
|
11626
11632
|
if (v2Formatted) {
|
|
@@ -13180,16 +13186,23 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13180
13186
|
const agentFromEvent = envEvent.metadata?.agent;
|
|
13181
13187
|
let envEventForAgent = envEvent;
|
|
13182
13188
|
const eventReplyChannel = envEvent?.metadata?.replyChannel;
|
|
13189
|
+
const eventChatId = eventReplyChannel?.chatId ?? formattedEvent.chatId ?? envEvent?.payload?.replyChannel?.chatId;
|
|
13183
13190
|
if (eventReplyChannel) {
|
|
13184
13191
|
this.lastReplyChannel = eventReplyChannel;
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13192
|
+
const rcChatId = eventReplyChannel.chatId;
|
|
13193
|
+
if (rcChatId)
|
|
13194
|
+
this.rememberReplyChannelForChat(rcChatId, eventReplyChannel);
|
|
13195
|
+
} else {
|
|
13196
|
+
const fallbackChannel = (eventChatId ? this.lastReplyChannelByChat?.get(eventChatId) : undefined) ?? this.lastReplyChannel;
|
|
13197
|
+
if (fallbackChannel) {
|
|
13198
|
+
envEventForAgent = {
|
|
13199
|
+
...envEvent,
|
|
13200
|
+
metadata: {
|
|
13201
|
+
...envEvent?.metadata ?? {},
|
|
13202
|
+
replyChannel: fallbackChannel
|
|
13203
|
+
}
|
|
13204
|
+
};
|
|
13205
|
+
}
|
|
13193
13206
|
}
|
|
13194
13207
|
this.currentAgentContext = {
|
|
13195
13208
|
agentType: agentFromEvent,
|
|
@@ -13203,6 +13216,22 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13203
13216
|
}
|
|
13204
13217
|
currentAgentContext = undefined;
|
|
13205
13218
|
lastReplyChannel = undefined;
|
|
13219
|
+
lastReplyChannelByChat = new Map;
|
|
13220
|
+
static REPLY_CHANNEL_CHAT_CACHE_MAX = 100;
|
|
13221
|
+
rememberReplyChannelForChat(chatId, channel) {
|
|
13222
|
+
if (!this.lastReplyChannelByChat)
|
|
13223
|
+
this.lastReplyChannelByChat = new Map;
|
|
13224
|
+
if (this.lastReplyChannelByChat.has(chatId)) {
|
|
13225
|
+
this.lastReplyChannelByChat.delete(chatId);
|
|
13226
|
+
}
|
|
13227
|
+
this.lastReplyChannelByChat.set(chatId, channel);
|
|
13228
|
+
while (this.lastReplyChannelByChat.size > REPL.REPLY_CHANNEL_CHAT_CACHE_MAX) {
|
|
13229
|
+
const oldest = this.lastReplyChannelByChat.keys().next().value;
|
|
13230
|
+
if (oldest === undefined)
|
|
13231
|
+
break;
|
|
13232
|
+
this.lastReplyChannelByChat.delete(oldest);
|
|
13233
|
+
}
|
|
13234
|
+
}
|
|
13206
13235
|
isIdle() {
|
|
13207
13236
|
return !this.isExecuting;
|
|
13208
13237
|
}
|
package/dist/index.js
CHANGED
|
@@ -9460,7 +9460,7 @@ class CliQuietModeService {
|
|
|
9460
9460
|
// package.json
|
|
9461
9461
|
var package_default = {
|
|
9462
9462
|
name: "@ai-setting/roy-agent-cli",
|
|
9463
|
-
version: "1.7.
|
|
9463
|
+
version: "1.7.40",
|
|
9464
9464
|
type: "module",
|
|
9465
9465
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9466
9466
|
main: "./dist/index.js",
|
|
@@ -11545,6 +11545,12 @@ function parseLarkPerTaskChatId(contextJson) {
|
|
|
11545
11545
|
return;
|
|
11546
11546
|
}
|
|
11547
11547
|
}
|
|
11548
|
+
var NOTIFY_V2_TERMINAL_TYPES = new Set([
|
|
11549
|
+
"task.background.completed",
|
|
11550
|
+
"task.background.failed",
|
|
11551
|
+
"task.background.timeout",
|
|
11552
|
+
"task.background.stopped"
|
|
11553
|
+
]);
|
|
11548
11554
|
|
|
11549
11555
|
class EventHandler {
|
|
11550
11556
|
env;
|
|
@@ -11619,7 +11625,7 @@ class EventHandler {
|
|
|
11619
11625
|
this.enqueue(formatted);
|
|
11620
11626
|
}
|
|
11621
11627
|
async formatEvent(event) {
|
|
11622
|
-
if (event.type
|
|
11628
|
+
if (NOTIFY_V2_TERMINAL_TYPES.has(event.type) && event.metadata?.triggerEventId && this.eventStore && this.getHandlerForEsType) {
|
|
11623
11629
|
try {
|
|
11624
11630
|
const v2Formatted = await this.formatEventViaESPluginV2(event);
|
|
11625
11631
|
if (v2Formatted) {
|
|
@@ -13179,16 +13185,23 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13179
13185
|
const agentFromEvent = envEvent.metadata?.agent;
|
|
13180
13186
|
let envEventForAgent = envEvent;
|
|
13181
13187
|
const eventReplyChannel = envEvent?.metadata?.replyChannel;
|
|
13188
|
+
const eventChatId = eventReplyChannel?.chatId ?? formattedEvent.chatId ?? envEvent?.payload?.replyChannel?.chatId;
|
|
13182
13189
|
if (eventReplyChannel) {
|
|
13183
13190
|
this.lastReplyChannel = eventReplyChannel;
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13191
|
+
const rcChatId = eventReplyChannel.chatId;
|
|
13192
|
+
if (rcChatId)
|
|
13193
|
+
this.rememberReplyChannelForChat(rcChatId, eventReplyChannel);
|
|
13194
|
+
} else {
|
|
13195
|
+
const fallbackChannel = (eventChatId ? this.lastReplyChannelByChat?.get(eventChatId) : undefined) ?? this.lastReplyChannel;
|
|
13196
|
+
if (fallbackChannel) {
|
|
13197
|
+
envEventForAgent = {
|
|
13198
|
+
...envEvent,
|
|
13199
|
+
metadata: {
|
|
13200
|
+
...envEvent?.metadata ?? {},
|
|
13201
|
+
replyChannel: fallbackChannel
|
|
13202
|
+
}
|
|
13203
|
+
};
|
|
13204
|
+
}
|
|
13192
13205
|
}
|
|
13193
13206
|
this.currentAgentContext = {
|
|
13194
13207
|
agentType: agentFromEvent,
|
|
@@ -13202,6 +13215,22 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13202
13215
|
}
|
|
13203
13216
|
currentAgentContext = undefined;
|
|
13204
13217
|
lastReplyChannel = undefined;
|
|
13218
|
+
lastReplyChannelByChat = new Map;
|
|
13219
|
+
static REPLY_CHANNEL_CHAT_CACHE_MAX = 100;
|
|
13220
|
+
rememberReplyChannelForChat(chatId, channel) {
|
|
13221
|
+
if (!this.lastReplyChannelByChat)
|
|
13222
|
+
this.lastReplyChannelByChat = new Map;
|
|
13223
|
+
if (this.lastReplyChannelByChat.has(chatId)) {
|
|
13224
|
+
this.lastReplyChannelByChat.delete(chatId);
|
|
13225
|
+
}
|
|
13226
|
+
this.lastReplyChannelByChat.set(chatId, channel);
|
|
13227
|
+
while (this.lastReplyChannelByChat.size > REPL.REPLY_CHANNEL_CHAT_CACHE_MAX) {
|
|
13228
|
+
const oldest = this.lastReplyChannelByChat.keys().next().value;
|
|
13229
|
+
if (oldest === undefined)
|
|
13230
|
+
break;
|
|
13231
|
+
this.lastReplyChannelByChat.delete(oldest);
|
|
13232
|
+
}
|
|
13233
|
+
}
|
|
13205
13234
|
isIdle() {
|
|
13206
13235
|
return !this.isExecuting;
|
|
13207
13236
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/roy-agent-linux-x64/bin/roy-agent
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 109627520 bytes
|
|
4
|
+
sha256: 70e2598656125685dba913f210bd2d2f5d7a41a7e80c3969b259fef85b7b61f1
|