@ai-setting/roy-agent-cli 1.5.42 → 1.5.44

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.
@@ -7240,7 +7240,7 @@ var require_dist = __commonJS((exports) => {
7240
7240
  var require_package = __commonJS((exports, module) => {
7241
7241
  module.exports = {
7242
7242
  name: "@ai-setting/roy-agent-cli",
7243
- version: "1.5.42",
7243
+ version: "1.5.44",
7244
7244
  type: "module",
7245
7245
  description: "CLI for roy-agent - Non-interactive command execution",
7246
7246
  main: "./dist/index.js",
@@ -7267,7 +7267,7 @@ var require_package = __commonJS((exports, module) => {
7267
7267
  },
7268
7268
  dependencies: {
7269
7269
  "@ai-setting/roy-agent-coder-harness": "^1.5.41",
7270
- "@ai-setting/roy-agent-core": "^1.5.42",
7270
+ "@ai-setting/roy-agent-core": "^1.5.44",
7271
7271
  "@ai-setting/roy-agent-ontology-harness": "^1.5.41",
7272
7272
  chalk: "^5.6.2",
7273
7273
  commander: "^14.0.3",
@@ -7649,7 +7649,6 @@ class EnvironmentService {
7649
7649
  env,
7650
7650
  options: { configComponent }
7651
7651
  });
7652
- await agentComponent.syncRegistryAgentsFromConfig();
7653
7652
  this.taskComponent = new TaskComponent;
7654
7653
  const taskComponent = this.taskComponent;
7655
7654
  await taskComponent.init({
@@ -7733,6 +7732,7 @@ class EnvironmentService {
7733
7732
  env.registerComponent(agentComponent);
7734
7733
  env.registerComponent(logTraceComponent);
7735
7734
  env.registerComponent(promptComponent);
7735
+ await agentComponent.syncRegistryAgentsFromConfig();
7736
7736
  env.registerComponent(taskComponent);
7737
7737
  env.registerComponent(skillComponent);
7738
7738
  env.registerComponent(mcpComponent);
@@ -8204,6 +8204,26 @@ class TaskEventHandler {
8204
8204
  }
8205
8205
  }
8206
8206
 
8207
+ // src/commands/act-agent-validation.ts
8208
+ function validateActAgent(agentComponent, agentName) {
8209
+ if (!agentName || agentName === "default") {
8210
+ return { valid: true };
8211
+ }
8212
+ if (!agentComponent?.getAgent(agentName)) {
8213
+ return {
8214
+ valid: false,
8215
+ message: `Agent "${agentName}" 不存在`
8216
+ };
8217
+ }
8218
+ return { valid: true };
8219
+ }
8220
+ function buildActAgentContext(agentName) {
8221
+ if (!agentName || agentName === "default") {
8222
+ return;
8223
+ }
8224
+ return { agentType: agentName };
8225
+ }
8226
+
8207
8227
  // src/commands/act.ts
8208
8228
  function createActCommand(externalEnvService) {
8209
8229
  return {
@@ -8250,6 +8270,10 @@ function createActCommand(externalEnvService) {
8250
8270
  describe: "启用 coder plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder)",
8251
8271
  type: "array",
8252
8272
  string: true
8273
+ }).option("agent", {
8274
+ alias: "a",
8275
+ describe: "指定要使用的 agent(如 explore, markdown-ontology-extractor)",
8276
+ type: "string"
8253
8277
  }),
8254
8278
  async handler(args) {
8255
8279
  const quiet = args.quiet ?? true;
@@ -8306,6 +8330,18 @@ function createActCommand(externalEnvService) {
8306
8330
  output.error("SessionComponent not available");
8307
8331
  process.exit(1);
8308
8332
  }
8333
+ if (args.agent && args.agent !== "default") {
8334
+ const agentComponent = env.getComponent("agent");
8335
+ const validation = validateActAgent(agentComponent, args.agent);
8336
+ if (!validation.valid) {
8337
+ output.error(validation.message);
8338
+ output.info("提示: roy-agent agents list");
8339
+ process.exit(1);
8340
+ }
8341
+ if (!quiet) {
8342
+ output.info(`Agent: ${args.agent}`);
8343
+ }
8344
+ }
8309
8345
  const taskEventHandlerForCleanup = new TaskEventHandler({
8310
8346
  env,
8311
8347
  enabled: true
@@ -8457,7 +8493,8 @@ function createActCommand(externalEnvService) {
8457
8493
  const rootSpan = tracer.startSpan("act.execute", {
8458
8494
  attributes: {
8459
8495
  message: args.message.substring(0, 200),
8460
- sessionId
8496
+ sessionId,
8497
+ ...buildActAgentContext(args.agent) ?? {}
8461
8498
  }
8462
8499
  });
8463
8500
  const traceId = rootSpan.spanContext.traceId;
@@ -8468,6 +8505,7 @@ function createActCommand(externalEnvService) {
8468
8505
  const contextHandler = new ContextHandlerService(env, sessionComponent, { maxRetries: 1, autoCompact: true });
8469
8506
  const context = {
8470
8507
  sessionId,
8508
+ ...buildActAgentContext(args.agent),
8471
8509
  metadata: {
8472
8510
  originalQuery: args.message,
8473
8511
  traceId
@@ -9563,6 +9601,10 @@ function createInteractiveCommand(externalEnvService) {
9563
9601
  describe: "启用 plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder, memory, task-tag)",
9564
9602
  type: "array",
9565
9603
  string: true
9604
+ }).option("agent", {
9605
+ alias: "a",
9606
+ describe: "指定使用的 agent (如 explore, general)",
9607
+ type: "string"
9566
9608
  }),
9567
9609
  async handler(args) {
9568
9610
  CliQuietModeService.getInstance().setQuiet(true);
@@ -9626,6 +9668,18 @@ function createInteractiveCommand(externalEnvService) {
9626
9668
  output,
9627
9669
  quiet: true
9628
9670
  });
9671
+ let currentAgentContext = undefined;
9672
+ if (args.agent && args.agent !== "default") {
9673
+ const agentComponent = env.getComponent("agent");
9674
+ const validation = validateActAgent(agentComponent, args.agent);
9675
+ if (!validation.valid) {
9676
+ output.error(validation.message);
9677
+ output.info("提示: roy-agent agents list");
9678
+ process.exit(1);
9679
+ }
9680
+ currentAgentContext = buildActAgentContext(args.agent);
9681
+ output.info(`Agent: ${args.agent}`);
9682
+ }
9629
9683
  queryExecutor.initStreamOutput(llmComponent);
9630
9684
  let pluginAdapterDispose = null;
9631
9685
  let lspManagerDispose = null;
@@ -9709,7 +9763,6 @@ function createInteractiveCommand(externalEnvService) {
9709
9763
  output.error(`❌ 加载 coder-harness 插件失败: ${error}`);
9710
9764
  }
9711
9765
  }
9712
- let currentAgentContext = undefined;
9713
9766
  const repl = new REPL({
9714
9767
  sessionId,
9715
9768
  sessionTitle,
package/dist/index.js CHANGED
@@ -7239,7 +7239,7 @@ var require_dist = __commonJS((exports) => {
7239
7239
  var require_package = __commonJS((exports, module) => {
7240
7240
  module.exports = {
7241
7241
  name: "@ai-setting/roy-agent-cli",
7242
- version: "1.5.42",
7242
+ version: "1.5.44",
7243
7243
  type: "module",
7244
7244
  description: "CLI for roy-agent - Non-interactive command execution",
7245
7245
  main: "./dist/index.js",
@@ -7266,7 +7266,7 @@ var require_package = __commonJS((exports, module) => {
7266
7266
  },
7267
7267
  dependencies: {
7268
7268
  "@ai-setting/roy-agent-coder-harness": "^1.5.41",
7269
- "@ai-setting/roy-agent-core": "^1.5.42",
7269
+ "@ai-setting/roy-agent-core": "^1.5.44",
7270
7270
  "@ai-setting/roy-agent-ontology-harness": "^1.5.41",
7271
7271
  chalk: "^5.6.2",
7272
7272
  commander: "^14.0.3",
@@ -7648,7 +7648,6 @@ class EnvironmentService {
7648
7648
  env,
7649
7649
  options: { configComponent }
7650
7650
  });
7651
- await agentComponent.syncRegistryAgentsFromConfig();
7652
7651
  this.taskComponent = new TaskComponent;
7653
7652
  const taskComponent = this.taskComponent;
7654
7653
  await taskComponent.init({
@@ -7732,6 +7731,7 @@ class EnvironmentService {
7732
7731
  env.registerComponent(agentComponent);
7733
7732
  env.registerComponent(logTraceComponent);
7734
7733
  env.registerComponent(promptComponent);
7734
+ await agentComponent.syncRegistryAgentsFromConfig();
7735
7735
  env.registerComponent(taskComponent);
7736
7736
  env.registerComponent(skillComponent);
7737
7737
  env.registerComponent(mcpComponent);
@@ -8203,6 +8203,26 @@ class TaskEventHandler {
8203
8203
  }
8204
8204
  }
8205
8205
 
8206
+ // src/commands/act-agent-validation.ts
8207
+ function validateActAgent(agentComponent, agentName) {
8208
+ if (!agentName || agentName === "default") {
8209
+ return { valid: true };
8210
+ }
8211
+ if (!agentComponent?.getAgent(agentName)) {
8212
+ return {
8213
+ valid: false,
8214
+ message: `Agent "${agentName}" 不存在`
8215
+ };
8216
+ }
8217
+ return { valid: true };
8218
+ }
8219
+ function buildActAgentContext(agentName) {
8220
+ if (!agentName || agentName === "default") {
8221
+ return;
8222
+ }
8223
+ return { agentType: agentName };
8224
+ }
8225
+
8206
8226
  // src/commands/act.ts
8207
8227
  function createActCommand(externalEnvService) {
8208
8228
  return {
@@ -8249,6 +8269,10 @@ function createActCommand(externalEnvService) {
8249
8269
  describe: "启用 coder plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder)",
8250
8270
  type: "array",
8251
8271
  string: true
8272
+ }).option("agent", {
8273
+ alias: "a",
8274
+ describe: "指定要使用的 agent(如 explore, markdown-ontology-extractor)",
8275
+ type: "string"
8252
8276
  }),
8253
8277
  async handler(args) {
8254
8278
  const quiet = args.quiet ?? true;
@@ -8305,6 +8329,18 @@ function createActCommand(externalEnvService) {
8305
8329
  output.error("SessionComponent not available");
8306
8330
  process.exit(1);
8307
8331
  }
8332
+ if (args.agent && args.agent !== "default") {
8333
+ const agentComponent = env.getComponent("agent");
8334
+ const validation = validateActAgent(agentComponent, args.agent);
8335
+ if (!validation.valid) {
8336
+ output.error(validation.message);
8337
+ output.info("提示: roy-agent agents list");
8338
+ process.exit(1);
8339
+ }
8340
+ if (!quiet) {
8341
+ output.info(`Agent: ${args.agent}`);
8342
+ }
8343
+ }
8308
8344
  const taskEventHandlerForCleanup = new TaskEventHandler({
8309
8345
  env,
8310
8346
  enabled: true
@@ -8456,7 +8492,8 @@ function createActCommand(externalEnvService) {
8456
8492
  const rootSpan = tracer.startSpan("act.execute", {
8457
8493
  attributes: {
8458
8494
  message: args.message.substring(0, 200),
8459
- sessionId
8495
+ sessionId,
8496
+ ...buildActAgentContext(args.agent) ?? {}
8460
8497
  }
8461
8498
  });
8462
8499
  const traceId = rootSpan.spanContext.traceId;
@@ -8467,6 +8504,7 @@ function createActCommand(externalEnvService) {
8467
8504
  const contextHandler = new ContextHandlerService(env, sessionComponent, { maxRetries: 1, autoCompact: true });
8468
8505
  const context = {
8469
8506
  sessionId,
8507
+ ...buildActAgentContext(args.agent),
8470
8508
  metadata: {
8471
8509
  originalQuery: args.message,
8472
8510
  traceId
@@ -9562,6 +9600,10 @@ function createInteractiveCommand(externalEnvService) {
9562
9600
  describe: "启用 plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder, memory, task-tag)",
9563
9601
  type: "array",
9564
9602
  string: true
9603
+ }).option("agent", {
9604
+ alias: "a",
9605
+ describe: "指定使用的 agent (如 explore, general)",
9606
+ type: "string"
9565
9607
  }),
9566
9608
  async handler(args) {
9567
9609
  CliQuietModeService.getInstance().setQuiet(true);
@@ -9625,6 +9667,18 @@ function createInteractiveCommand(externalEnvService) {
9625
9667
  output,
9626
9668
  quiet: true
9627
9669
  });
9670
+ let currentAgentContext = undefined;
9671
+ if (args.agent && args.agent !== "default") {
9672
+ const agentComponent = env.getComponent("agent");
9673
+ const validation = validateActAgent(agentComponent, args.agent);
9674
+ if (!validation.valid) {
9675
+ output.error(validation.message);
9676
+ output.info("提示: roy-agent agents list");
9677
+ process.exit(1);
9678
+ }
9679
+ currentAgentContext = buildActAgentContext(args.agent);
9680
+ output.info(`Agent: ${args.agent}`);
9681
+ }
9628
9682
  queryExecutor.initStreamOutput(llmComponent);
9629
9683
  let pluginAdapterDispose = null;
9630
9684
  let lspManagerDispose = null;
@@ -9708,7 +9762,6 @@ function createInteractiveCommand(externalEnvService) {
9708
9762
  output.error(`❌ 加载 coder-harness 插件失败: ${error}`);
9709
9763
  }
9710
9764
  }
9711
- let currentAgentContext = undefined;
9712
9765
  const repl = new REPL({
9713
9766
  sessionId,
9714
9767
  sessionTitle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.5.42",
3
+ "version": "1.5.44",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@ai-setting/roy-agent-coder-harness": "^1.5.41",
30
- "@ai-setting/roy-agent-core": "^1.5.42",
30
+ "@ai-setting/roy-agent-core": "^1.5.44",
31
31
  "@ai-setting/roy-agent-ontology-harness": "^1.5.41",
32
32
  "chalk": "^5.6.2",
33
33
  "commander": "^14.0.3",