@ai-setting/roy-agent-cli 1.7.39 → 1.7.41
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 +43 -11
- package/dist/index.js +43 -11
- 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.41",
|
|
9465
9465
|
type: "module",
|
|
9466
9466
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9467
9467
|
main: "./dist/index.js",
|
|
@@ -11531,7 +11531,10 @@ function extractChatId(event) {
|
|
|
11531
11531
|
import { existsSync, mkdirSync } from "node:fs";
|
|
11532
11532
|
import { join } from "node:path";
|
|
11533
11533
|
import { homedir } from "node:os";
|
|
11534
|
-
import {
|
|
11534
|
+
import {
|
|
11535
|
+
EventStoreImpl,
|
|
11536
|
+
setSharedEventStore
|
|
11537
|
+
} from "@ai-setting/roy-agent-core";
|
|
11535
11538
|
|
|
11536
11539
|
// src/commands/shared/event-handler.ts
|
|
11537
11540
|
import { TracedAs as TracedAs5 } from "@ai-setting/roy-agent-core";
|
|
@@ -11546,6 +11549,12 @@ function parseLarkPerTaskChatId(contextJson) {
|
|
|
11546
11549
|
return;
|
|
11547
11550
|
}
|
|
11548
11551
|
}
|
|
11552
|
+
var NOTIFY_V2_TERMINAL_TYPES = new Set([
|
|
11553
|
+
"task.background.completed",
|
|
11554
|
+
"task.background.failed",
|
|
11555
|
+
"task.background.timeout",
|
|
11556
|
+
"task.background.stopped"
|
|
11557
|
+
]);
|
|
11549
11558
|
|
|
11550
11559
|
class EventHandler {
|
|
11551
11560
|
env;
|
|
@@ -11620,7 +11629,7 @@ class EventHandler {
|
|
|
11620
11629
|
this.enqueue(formatted);
|
|
11621
11630
|
}
|
|
11622
11631
|
async formatEvent(event) {
|
|
11623
|
-
if (event.type
|
|
11632
|
+
if (NOTIFY_V2_TERMINAL_TYPES.has(event.type) && event.metadata?.triggerEventId && this.eventStore && this.getHandlerForEsType) {
|
|
11624
11633
|
try {
|
|
11625
11634
|
const v2Formatted = await this.formatEventViaESPluginV2(event);
|
|
11626
11635
|
if (v2Formatted) {
|
|
@@ -13180,16 +13189,23 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13180
13189
|
const agentFromEvent = envEvent.metadata?.agent;
|
|
13181
13190
|
let envEventForAgent = envEvent;
|
|
13182
13191
|
const eventReplyChannel = envEvent?.metadata?.replyChannel;
|
|
13192
|
+
const eventChatId = eventReplyChannel?.chatId ?? formattedEvent.chatId ?? envEvent?.payload?.replyChannel?.chatId;
|
|
13183
13193
|
if (eventReplyChannel) {
|
|
13184
13194
|
this.lastReplyChannel = eventReplyChannel;
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13195
|
+
const rcChatId = eventReplyChannel.chatId;
|
|
13196
|
+
if (rcChatId)
|
|
13197
|
+
this.rememberReplyChannelForChat(rcChatId, eventReplyChannel);
|
|
13198
|
+
} else {
|
|
13199
|
+
const fallbackChannel = (eventChatId ? this.lastReplyChannelByChat?.get(eventChatId) : undefined) ?? this.lastReplyChannel;
|
|
13200
|
+
if (fallbackChannel) {
|
|
13201
|
+
envEventForAgent = {
|
|
13202
|
+
...envEvent,
|
|
13203
|
+
metadata: {
|
|
13204
|
+
...envEvent?.metadata ?? {},
|
|
13205
|
+
replyChannel: fallbackChannel
|
|
13206
|
+
}
|
|
13207
|
+
};
|
|
13208
|
+
}
|
|
13193
13209
|
}
|
|
13194
13210
|
this.currentAgentContext = {
|
|
13195
13211
|
agentType: agentFromEvent,
|
|
@@ -13203,6 +13219,22 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13203
13219
|
}
|
|
13204
13220
|
currentAgentContext = undefined;
|
|
13205
13221
|
lastReplyChannel = undefined;
|
|
13222
|
+
lastReplyChannelByChat = new Map;
|
|
13223
|
+
static REPLY_CHANNEL_CHAT_CACHE_MAX = 100;
|
|
13224
|
+
rememberReplyChannelForChat(chatId, channel) {
|
|
13225
|
+
if (!this.lastReplyChannelByChat)
|
|
13226
|
+
this.lastReplyChannelByChat = new Map;
|
|
13227
|
+
if (this.lastReplyChannelByChat.has(chatId)) {
|
|
13228
|
+
this.lastReplyChannelByChat.delete(chatId);
|
|
13229
|
+
}
|
|
13230
|
+
this.lastReplyChannelByChat.set(chatId, channel);
|
|
13231
|
+
while (this.lastReplyChannelByChat.size > REPL.REPLY_CHANNEL_CHAT_CACHE_MAX) {
|
|
13232
|
+
const oldest = this.lastReplyChannelByChat.keys().next().value;
|
|
13233
|
+
if (oldest === undefined)
|
|
13234
|
+
break;
|
|
13235
|
+
this.lastReplyChannelByChat.delete(oldest);
|
|
13236
|
+
}
|
|
13237
|
+
}
|
|
13206
13238
|
isIdle() {
|
|
13207
13239
|
return !this.isExecuting;
|
|
13208
13240
|
}
|
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.41",
|
|
9464
9464
|
type: "module",
|
|
9465
9465
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9466
9466
|
main: "./dist/index.js",
|
|
@@ -11530,7 +11530,10 @@ function extractChatId(event) {
|
|
|
11530
11530
|
import { existsSync, mkdirSync } from "node:fs";
|
|
11531
11531
|
import { join } from "node:path";
|
|
11532
11532
|
import { homedir } from "node:os";
|
|
11533
|
-
import {
|
|
11533
|
+
import {
|
|
11534
|
+
EventStoreImpl,
|
|
11535
|
+
setSharedEventStore
|
|
11536
|
+
} from "@ai-setting/roy-agent-core";
|
|
11534
11537
|
|
|
11535
11538
|
// src/commands/shared/event-handler.ts
|
|
11536
11539
|
import { TracedAs as TracedAs5 } from "@ai-setting/roy-agent-core";
|
|
@@ -11545,6 +11548,12 @@ function parseLarkPerTaskChatId(contextJson) {
|
|
|
11545
11548
|
return;
|
|
11546
11549
|
}
|
|
11547
11550
|
}
|
|
11551
|
+
var NOTIFY_V2_TERMINAL_TYPES = new Set([
|
|
11552
|
+
"task.background.completed",
|
|
11553
|
+
"task.background.failed",
|
|
11554
|
+
"task.background.timeout",
|
|
11555
|
+
"task.background.stopped"
|
|
11556
|
+
]);
|
|
11548
11557
|
|
|
11549
11558
|
class EventHandler {
|
|
11550
11559
|
env;
|
|
@@ -11619,7 +11628,7 @@ class EventHandler {
|
|
|
11619
11628
|
this.enqueue(formatted);
|
|
11620
11629
|
}
|
|
11621
11630
|
async formatEvent(event) {
|
|
11622
|
-
if (event.type
|
|
11631
|
+
if (NOTIFY_V2_TERMINAL_TYPES.has(event.type) && event.metadata?.triggerEventId && this.eventStore && this.getHandlerForEsType) {
|
|
11623
11632
|
try {
|
|
11624
11633
|
const v2Formatted = await this.formatEventViaESPluginV2(event);
|
|
11625
11634
|
if (v2Formatted) {
|
|
@@ -13179,16 +13188,23 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13179
13188
|
const agentFromEvent = envEvent.metadata?.agent;
|
|
13180
13189
|
let envEventForAgent = envEvent;
|
|
13181
13190
|
const eventReplyChannel = envEvent?.metadata?.replyChannel;
|
|
13191
|
+
const eventChatId = eventReplyChannel?.chatId ?? formattedEvent.chatId ?? envEvent?.payload?.replyChannel?.chatId;
|
|
13182
13192
|
if (eventReplyChannel) {
|
|
13183
13193
|
this.lastReplyChannel = eventReplyChannel;
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13194
|
+
const rcChatId = eventReplyChannel.chatId;
|
|
13195
|
+
if (rcChatId)
|
|
13196
|
+
this.rememberReplyChannelForChat(rcChatId, eventReplyChannel);
|
|
13197
|
+
} else {
|
|
13198
|
+
const fallbackChannel = (eventChatId ? this.lastReplyChannelByChat?.get(eventChatId) : undefined) ?? this.lastReplyChannel;
|
|
13199
|
+
if (fallbackChannel) {
|
|
13200
|
+
envEventForAgent = {
|
|
13201
|
+
...envEvent,
|
|
13202
|
+
metadata: {
|
|
13203
|
+
...envEvent?.metadata ?? {},
|
|
13204
|
+
replyChannel: fallbackChannel
|
|
13205
|
+
}
|
|
13206
|
+
};
|
|
13207
|
+
}
|
|
13192
13208
|
}
|
|
13193
13209
|
this.currentAgentContext = {
|
|
13194
13210
|
agentType: agentFromEvent,
|
|
@@ -13202,6 +13218,22 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
13202
13218
|
}
|
|
13203
13219
|
currentAgentContext = undefined;
|
|
13204
13220
|
lastReplyChannel = undefined;
|
|
13221
|
+
lastReplyChannelByChat = new Map;
|
|
13222
|
+
static REPLY_CHANNEL_CHAT_CACHE_MAX = 100;
|
|
13223
|
+
rememberReplyChannelForChat(chatId, channel) {
|
|
13224
|
+
if (!this.lastReplyChannelByChat)
|
|
13225
|
+
this.lastReplyChannelByChat = new Map;
|
|
13226
|
+
if (this.lastReplyChannelByChat.has(chatId)) {
|
|
13227
|
+
this.lastReplyChannelByChat.delete(chatId);
|
|
13228
|
+
}
|
|
13229
|
+
this.lastReplyChannelByChat.set(chatId, channel);
|
|
13230
|
+
while (this.lastReplyChannelByChat.size > REPL.REPLY_CHANNEL_CHAT_CACHE_MAX) {
|
|
13231
|
+
const oldest = this.lastReplyChannelByChat.keys().next().value;
|
|
13232
|
+
if (oldest === undefined)
|
|
13233
|
+
break;
|
|
13234
|
+
this.lastReplyChannelByChat.delete(oldest);
|
|
13235
|
+
}
|
|
13236
|
+
}
|
|
13205
13237
|
isIdle() {
|
|
13206
13238
|
return !this.isExecuting;
|
|
13207
13239
|
}
|
|
@@ -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: 528166449c43291284fb90bf9399e65222287176cbe7114abf870e4fe0aee093
|