@ai-setting/roy-agent-cli 1.5.112 → 1.5.114
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 +36 -4
- package/dist/index.js +36 -4
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7427,7 +7427,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7427
7427
|
var require_package = __commonJS((exports, module) => {
|
|
7428
7428
|
module.exports = {
|
|
7429
7429
|
name: "@ai-setting/roy-agent-cli",
|
|
7430
|
-
version: "1.5.
|
|
7430
|
+
version: "1.5.114",
|
|
7431
7431
|
type: "module",
|
|
7432
7432
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7433
7433
|
main: "./dist/index.js",
|
|
@@ -9495,7 +9495,6 @@ class EventHandler {
|
|
|
9495
9495
|
console.error(`[EventHandler] 处理事件失败:`, error);
|
|
9496
9496
|
}
|
|
9497
9497
|
}
|
|
9498
|
-
this.clearActiveSession();
|
|
9499
9498
|
this.isProcessing = false;
|
|
9500
9499
|
}
|
|
9501
9500
|
async ensureActiveSession() {
|
|
@@ -9512,13 +9511,29 @@ class EventHandler {
|
|
|
9512
9511
|
return null;
|
|
9513
9512
|
}
|
|
9514
9513
|
this.activeEventSessionId = existing.id;
|
|
9514
|
+
await this.sessionComponent.setActiveSession(existing.id);
|
|
9515
9515
|
return existing.id;
|
|
9516
9516
|
}
|
|
9517
|
-
console.warn(`[EventHandler] Parent session ${triggerSessionId} not found,
|
|
9517
|
+
console.warn(`[EventHandler] Parent session ${triggerSessionId} not found, trying global active session`);
|
|
9518
9518
|
} catch (error) {
|
|
9519
9519
|
console.error(`[EventHandler] Failed to lookup parent session ${triggerSessionId}:`, error);
|
|
9520
9520
|
}
|
|
9521
9521
|
}
|
|
9522
|
+
try {
|
|
9523
|
+
const activeId = this.sessionComponent.getActiveSessionId();
|
|
9524
|
+
if (activeId) {
|
|
9525
|
+
const existing = await this.sessionComponent.get(activeId);
|
|
9526
|
+
if (existing) {
|
|
9527
|
+
if (this.isStopped) {
|
|
9528
|
+
return null;
|
|
9529
|
+
}
|
|
9530
|
+
this.activeEventSessionId = existing.id;
|
|
9531
|
+
return existing.id;
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9534
|
+
} catch (error) {
|
|
9535
|
+
console.error(`[EventHandler] Failed to lookup global active session:`, error);
|
|
9536
|
+
}
|
|
9522
9537
|
return this.createNewEventSession();
|
|
9523
9538
|
}
|
|
9524
9539
|
async createNewEventSession() {
|
|
@@ -9531,6 +9546,7 @@ class EventHandler {
|
|
|
9531
9546
|
return null;
|
|
9532
9547
|
}
|
|
9533
9548
|
this.activeEventSessionId = session.id;
|
|
9549
|
+
await this.sessionComponent.setActiveSession(session.id);
|
|
9534
9550
|
return session.id;
|
|
9535
9551
|
} catch (error) {
|
|
9536
9552
|
console.error(`[EventHandler] 创建事件 session 失败:`, error);
|
|
@@ -9953,6 +9969,7 @@ class REPL {
|
|
|
9953
9969
|
inputHandler;
|
|
9954
9970
|
keypressHandler;
|
|
9955
9971
|
sessionManager = null;
|
|
9972
|
+
sessionComponent = null;
|
|
9956
9973
|
lastAttachPath = undefined;
|
|
9957
9974
|
lastUsage = null;
|
|
9958
9975
|
setLastUsage(usage) {
|
|
@@ -10191,9 +10208,22 @@ ${COLORS.system("⏳ 上一次请求尚未完成,请稍候...")}
|
|
|
10191
10208
|
`);
|
|
10192
10209
|
return;
|
|
10193
10210
|
}
|
|
10211
|
+
await this.ensureActiveSession();
|
|
10194
10212
|
const payload = this.sessionManager ? await this.sessionManager.getQueryPayload(message) : message;
|
|
10195
10213
|
await this.executeInternal(payload, { showPrompt: false });
|
|
10196
10214
|
}
|
|
10215
|
+
async ensureActiveSession() {
|
|
10216
|
+
if (!this.sessionComponent)
|
|
10217
|
+
return;
|
|
10218
|
+
try {
|
|
10219
|
+
const activeId = this.sessionComponent.getActiveSessionId();
|
|
10220
|
+
if (!activeId && this.sessionManager) {
|
|
10221
|
+
await this.sessionManager.init(undefined, false);
|
|
10222
|
+
}
|
|
10223
|
+
} catch (error) {
|
|
10224
|
+
console.error(`[REPL] Failed to ensure active session:`, error);
|
|
10225
|
+
}
|
|
10226
|
+
}
|
|
10197
10227
|
async handleEventMessage(message) {
|
|
10198
10228
|
console.log(`
|
|
10199
10229
|
${COLORS.system("[通知] ❯ " + message.replace(/\n/g, `
|
|
@@ -10207,6 +10237,7 @@ ${COLORS.system("[通知] ❯ " + message.replace(/\n/g, `
|
|
|
10207
10237
|
${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
10208
10238
|
` + COLORS.system("[通知2] ❯ ")))}
|
|
10209
10239
|
`);
|
|
10240
|
+
await this.ensureActiveSession();
|
|
10210
10241
|
const sourceId = envEvent.metadata?.sourceId;
|
|
10211
10242
|
let pluginEnabled = envEvent.metadata?.pluginEnabled;
|
|
10212
10243
|
let plugins = envEvent.metadata?.plugins;
|
|
@@ -10775,6 +10806,7 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10775
10806
|
};
|
|
10776
10807
|
process.on("SIGINT", sigintHandler);
|
|
10777
10808
|
repl.sessionManager = sessionManager;
|
|
10809
|
+
repl.sessionComponent = sessionComponent;
|
|
10778
10810
|
await repl.start();
|
|
10779
10811
|
process.removeListener("SIGINT", sigintHandler);
|
|
10780
10812
|
console.log("正在清理资源...");
|
|
@@ -19489,7 +19521,7 @@ import fs5 from "fs";
|
|
|
19489
19521
|
import path8 from "path";
|
|
19490
19522
|
import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19491
19523
|
import { getTracerProvider as getTracerProvider4, propagation, wrapFunction } from "@ai-setting/roy-agent-core";
|
|
19492
|
-
import { isValidSessionId } from "@ai-setting/roy-agent-core/env/session
|
|
19524
|
+
import { isValidSessionId } from "@ai-setting/roy-agent-core/env/session";
|
|
19493
19525
|
var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
19494
19526
|
const output = new OutputService2;
|
|
19495
19527
|
const envService = new EnvironmentService(output);
|
package/dist/index.js
CHANGED
|
@@ -7426,7 +7426,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7426
7426
|
var require_package = __commonJS((exports, module) => {
|
|
7427
7427
|
module.exports = {
|
|
7428
7428
|
name: "@ai-setting/roy-agent-cli",
|
|
7429
|
-
version: "1.5.
|
|
7429
|
+
version: "1.5.114",
|
|
7430
7430
|
type: "module",
|
|
7431
7431
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7432
7432
|
main: "./dist/index.js",
|
|
@@ -9494,7 +9494,6 @@ class EventHandler {
|
|
|
9494
9494
|
console.error(`[EventHandler] 处理事件失败:`, error);
|
|
9495
9495
|
}
|
|
9496
9496
|
}
|
|
9497
|
-
this.clearActiveSession();
|
|
9498
9497
|
this.isProcessing = false;
|
|
9499
9498
|
}
|
|
9500
9499
|
async ensureActiveSession() {
|
|
@@ -9511,13 +9510,29 @@ class EventHandler {
|
|
|
9511
9510
|
return null;
|
|
9512
9511
|
}
|
|
9513
9512
|
this.activeEventSessionId = existing.id;
|
|
9513
|
+
await this.sessionComponent.setActiveSession(existing.id);
|
|
9514
9514
|
return existing.id;
|
|
9515
9515
|
}
|
|
9516
|
-
console.warn(`[EventHandler] Parent session ${triggerSessionId} not found,
|
|
9516
|
+
console.warn(`[EventHandler] Parent session ${triggerSessionId} not found, trying global active session`);
|
|
9517
9517
|
} catch (error) {
|
|
9518
9518
|
console.error(`[EventHandler] Failed to lookup parent session ${triggerSessionId}:`, error);
|
|
9519
9519
|
}
|
|
9520
9520
|
}
|
|
9521
|
+
try {
|
|
9522
|
+
const activeId = this.sessionComponent.getActiveSessionId();
|
|
9523
|
+
if (activeId) {
|
|
9524
|
+
const existing = await this.sessionComponent.get(activeId);
|
|
9525
|
+
if (existing) {
|
|
9526
|
+
if (this.isStopped) {
|
|
9527
|
+
return null;
|
|
9528
|
+
}
|
|
9529
|
+
this.activeEventSessionId = existing.id;
|
|
9530
|
+
return existing.id;
|
|
9531
|
+
}
|
|
9532
|
+
}
|
|
9533
|
+
} catch (error) {
|
|
9534
|
+
console.error(`[EventHandler] Failed to lookup global active session:`, error);
|
|
9535
|
+
}
|
|
9521
9536
|
return this.createNewEventSession();
|
|
9522
9537
|
}
|
|
9523
9538
|
async createNewEventSession() {
|
|
@@ -9530,6 +9545,7 @@ class EventHandler {
|
|
|
9530
9545
|
return null;
|
|
9531
9546
|
}
|
|
9532
9547
|
this.activeEventSessionId = session.id;
|
|
9548
|
+
await this.sessionComponent.setActiveSession(session.id);
|
|
9533
9549
|
return session.id;
|
|
9534
9550
|
} catch (error) {
|
|
9535
9551
|
console.error(`[EventHandler] 创建事件 session 失败:`, error);
|
|
@@ -9952,6 +9968,7 @@ class REPL {
|
|
|
9952
9968
|
inputHandler;
|
|
9953
9969
|
keypressHandler;
|
|
9954
9970
|
sessionManager = null;
|
|
9971
|
+
sessionComponent = null;
|
|
9955
9972
|
lastAttachPath = undefined;
|
|
9956
9973
|
lastUsage = null;
|
|
9957
9974
|
setLastUsage(usage) {
|
|
@@ -10190,9 +10207,22 @@ ${COLORS.system("⏳ 上一次请求尚未完成,请稍候...")}
|
|
|
10190
10207
|
`);
|
|
10191
10208
|
return;
|
|
10192
10209
|
}
|
|
10210
|
+
await this.ensureActiveSession();
|
|
10193
10211
|
const payload = this.sessionManager ? await this.sessionManager.getQueryPayload(message) : message;
|
|
10194
10212
|
await this.executeInternal(payload, { showPrompt: false });
|
|
10195
10213
|
}
|
|
10214
|
+
async ensureActiveSession() {
|
|
10215
|
+
if (!this.sessionComponent)
|
|
10216
|
+
return;
|
|
10217
|
+
try {
|
|
10218
|
+
const activeId = this.sessionComponent.getActiveSessionId();
|
|
10219
|
+
if (!activeId && this.sessionManager) {
|
|
10220
|
+
await this.sessionManager.init(undefined, false);
|
|
10221
|
+
}
|
|
10222
|
+
} catch (error) {
|
|
10223
|
+
console.error(`[REPL] Failed to ensure active session:`, error);
|
|
10224
|
+
}
|
|
10225
|
+
}
|
|
10196
10226
|
async handleEventMessage(message) {
|
|
10197
10227
|
console.log(`
|
|
10198
10228
|
${COLORS.system("[通知] ❯ " + message.replace(/\n/g, `
|
|
@@ -10206,6 +10236,7 @@ ${COLORS.system("[通知] ❯ " + message.replace(/\n/g, `
|
|
|
10206
10236
|
${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
10207
10237
|
` + COLORS.system("[通知2] ❯ ")))}
|
|
10208
10238
|
`);
|
|
10239
|
+
await this.ensureActiveSession();
|
|
10209
10240
|
const sourceId = envEvent.metadata?.sourceId;
|
|
10210
10241
|
let pluginEnabled = envEvent.metadata?.pluginEnabled;
|
|
10211
10242
|
let plugins = envEvent.metadata?.plugins;
|
|
@@ -10774,6 +10805,7 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10774
10805
|
};
|
|
10775
10806
|
process.on("SIGINT", sigintHandler);
|
|
10776
10807
|
repl.sessionManager = sessionManager;
|
|
10808
|
+
repl.sessionComponent = sessionComponent;
|
|
10777
10809
|
await repl.start();
|
|
10778
10810
|
process.removeListener("SIGINT", sigintHandler);
|
|
10779
10811
|
console.log("正在清理资源...");
|
|
@@ -19488,7 +19520,7 @@ import fs5 from "fs";
|
|
|
19488
19520
|
import path8 from "path";
|
|
19489
19521
|
import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19490
19522
|
import { getTracerProvider as getTracerProvider4, propagation, wrapFunction } from "@ai-setting/roy-agent-core";
|
|
19491
|
-
import { isValidSessionId } from "@ai-setting/roy-agent-core/env/session
|
|
19523
|
+
import { isValidSessionId } from "@ai-setting/roy-agent-core/env/session";
|
|
19492
19524
|
var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
19493
19525
|
const output = new OutputService2;
|
|
19494
19526
|
const envService = new EnvironmentService(output);
|
|
Binary file
|