leaf-coding-agent 1.0.1 → 1.0.2

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.
@@ -2080,6 +2080,11 @@ export class InteractiveMode {
2080
2080
  this.editor.setText("");
2081
2081
  return;
2082
2082
  }
2083
+ if (text === "/worker" || text.startsWith("/worker ")) {
2084
+ this.handleWorkerCommand(text);
2085
+ this.editor.setText("");
2086
+ return;
2087
+ }
2083
2088
  if (text === "/quit") {
2084
2089
  this.editor.setText("");
2085
2090
  await this.shutdown();
@@ -4361,6 +4366,48 @@ export class InteractiveMode {
4361
4366
  this.chatContainer.addChild(new Text(info, 1, 0));
4362
4367
  this.ui.requestRender();
4363
4368
  }
4369
+ handleWorkerCommand(text) {
4370
+ const args = text.slice(7).trim();
4371
+ if (args === "" || args === "status") {
4372
+ // 显示 Worker 状态
4373
+ const status = this.session.workerIntegration?.getWorkerStatus();
4374
+ const progress = this.session.workerIntegration?.getWorkerProgress();
4375
+ let info = `${theme.bold("Worker 状态")}\n\n`;
4376
+ if (status && status.length > 0) {
4377
+ info += `活跃 Worker: ${status.length}\n`;
4378
+ for (const worker of status) {
4379
+ info += ` - ${worker.id}: ${worker.status} - ${worker.task}\n`;
4380
+ }
4381
+ }
4382
+ else {
4383
+ info += `没有活跃的 Worker\n`;
4384
+ }
4385
+ if (progress) {
4386
+ info += `\n进度: ${progress.completed}/${progress.total} (${progress.percentage.toFixed(1)}%)\n`;
4387
+ }
4388
+ this.chatContainer.addChild(new Spacer(1));
4389
+ this.chatContainer.addChild(new Text(info, 1, 0));
4390
+ this.ui.requestRender();
4391
+ }
4392
+ else if (args === "enable") {
4393
+ // 启用 Worker 模式
4394
+ this.session.workerEnabled = true;
4395
+ this.showWarning("Worker 模式已启用");
4396
+ }
4397
+ else if (args === "disable") {
4398
+ // 禁用 Worker 模式
4399
+ this.session.workerEnabled = false;
4400
+ this.showWarning("Worker 模式已禁用");
4401
+ }
4402
+ else if (args === "abort") {
4403
+ // 中止所有 Worker
4404
+ this.session.workerIntegration?.abortAllWorkers();
4405
+ this.showWarning("已中止所有 Worker");
4406
+ }
4407
+ else {
4408
+ this.showWarning(`未知的 Worker 命令: ${args}\n用法: /worker [status|enable|disable|abort]`);
4409
+ }
4410
+ }
4364
4411
  handleChangelogCommand() {
4365
4412
  const changelogPath = getChangelogPath();
4366
4413
  const allEntries = parseChangelog(changelogPath);