@ai-setting/roy-agent-cli 1.5.98 → 1.5.101

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.
@@ -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.98",
7430
+ version: "1.5.101",
7431
7431
  type: "module",
7432
7432
  description: "CLI for roy-agent - Non-interactive command execution",
7433
7433
  main: "./dist/index.js",
@@ -9084,13 +9084,15 @@ class QueryExecutor {
9084
9084
  this.output.info(`执行: ${message}`);
9085
9085
  }
9086
9086
  const contextHandler = new ContextHandlerService(this.env, this.sessionComponent, { maxRetries: 1, autoCompact: true });
9087
+ const { systemPrompt: agentContextSystemPrompt, ...restAgentContext } = agentContext ?? {};
9087
9088
  const context = {
9088
9089
  sessionId,
9089
9090
  metadata: {
9090
9091
  originalQuery: message,
9091
- traceId
9092
+ traceId,
9093
+ systemPrompt: agentContextSystemPrompt
9092
9094
  },
9093
- ...agentContext
9095
+ ...restAgentContext
9094
9096
  };
9095
9097
  let result;
9096
9098
  try {
@@ -9436,6 +9438,11 @@ class EventHandler {
9436
9438
  async processQueue() {
9437
9439
  this.isProcessing = true;
9438
9440
  const sessionId = await this.ensureActiveSession();
9441
+ if (this.isStopped) {
9442
+ this.clearActiveSession();
9443
+ this.isProcessing = false;
9444
+ return;
9445
+ }
9439
9446
  while (!this.isStopped && this.queue.length > 0) {
9440
9447
  await this.waitForIdle();
9441
9448
  if (this.isStopped) {
@@ -9468,8 +9475,12 @@ class EventHandler {
9468
9475
  return this.activeEventSessionId;
9469
9476
  try {
9470
9477
  const session = await this.sessionComponent.create({
9471
- title: `Event Session - ${new Date().toLocaleString("zh-CN")}`
9478
+ title: `Event Session - ${new Date().toLocaleString()}`
9472
9479
  });
9480
+ if (this.isStopped) {
9481
+ this.activeEventSessionId = null;
9482
+ return null;
9483
+ }
9473
9484
  this.activeEventSessionId = session.id;
9474
9485
  return session.id;
9475
9486
  } catch (error) {
@@ -10646,9 +10657,6 @@ function createInteractiveCommand(externalEnvService) {
10646
10657
  formatter: new EventMessageFormatter({ prefix: "[通知]" }),
10647
10658
  isIdle: () => repl.isIdle(),
10648
10659
  sessionComponent,
10649
- onEvent: async (message) => {
10650
- await repl.handleEventMessage(message);
10651
- },
10652
10660
  onEventWithEnv: async (formattedEvent) => {
10653
10661
  await repl.handleEventMessageWithEnv(formattedEvent);
10654
10662
  }
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.98",
7429
+ version: "1.5.101",
7430
7430
  type: "module",
7431
7431
  description: "CLI for roy-agent - Non-interactive command execution",
7432
7432
  main: "./dist/index.js",
@@ -9083,13 +9083,15 @@ class QueryExecutor {
9083
9083
  this.output.info(`执行: ${message}`);
9084
9084
  }
9085
9085
  const contextHandler = new ContextHandlerService(this.env, this.sessionComponent, { maxRetries: 1, autoCompact: true });
9086
+ const { systemPrompt: agentContextSystemPrompt, ...restAgentContext } = agentContext ?? {};
9086
9087
  const context = {
9087
9088
  sessionId,
9088
9089
  metadata: {
9089
9090
  originalQuery: message,
9090
- traceId
9091
+ traceId,
9092
+ systemPrompt: agentContextSystemPrompt
9091
9093
  },
9092
- ...agentContext
9094
+ ...restAgentContext
9093
9095
  };
9094
9096
  let result;
9095
9097
  try {
@@ -9435,6 +9437,11 @@ class EventHandler {
9435
9437
  async processQueue() {
9436
9438
  this.isProcessing = true;
9437
9439
  const sessionId = await this.ensureActiveSession();
9440
+ if (this.isStopped) {
9441
+ this.clearActiveSession();
9442
+ this.isProcessing = false;
9443
+ return;
9444
+ }
9438
9445
  while (!this.isStopped && this.queue.length > 0) {
9439
9446
  await this.waitForIdle();
9440
9447
  if (this.isStopped) {
@@ -9467,8 +9474,12 @@ class EventHandler {
9467
9474
  return this.activeEventSessionId;
9468
9475
  try {
9469
9476
  const session = await this.sessionComponent.create({
9470
- title: `Event Session - ${new Date().toLocaleString("zh-CN")}`
9477
+ title: `Event Session - ${new Date().toLocaleString()}`
9471
9478
  });
9479
+ if (this.isStopped) {
9480
+ this.activeEventSessionId = null;
9481
+ return null;
9482
+ }
9472
9483
  this.activeEventSessionId = session.id;
9473
9484
  return session.id;
9474
9485
  } catch (error) {
@@ -10645,9 +10656,6 @@ function createInteractiveCommand(externalEnvService) {
10645
10656
  formatter: new EventMessageFormatter({ prefix: "[通知]" }),
10646
10657
  isIdle: () => repl.isIdle(),
10647
10658
  sessionComponent,
10648
- onEvent: async (message) => {
10649
- await repl.handleEventMessage(message);
10650
- },
10651
10659
  onEventWithEnv: async (formattedEvent) => {
10652
10660
  await repl.handleEventMessageWithEnv(formattedEvent);
10653
10661
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.5.98",
3
+ "version": "1.5.101",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",