leaf-coding-agent 1.0.2 → 1.0.3

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.
@@ -4369,25 +4369,8 @@ export class InteractiveMode {
4369
4369
  handleWorkerCommand(text) {
4370
4370
  const args = text.slice(7).trim();
4371
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();
4372
+ // 显示 Worker 设置界面
4373
+ this.showWorkerSelector();
4391
4374
  }
4392
4375
  else if (args === "enable") {
4393
4376
  // 启用 Worker 模式
@@ -4408,6 +4391,37 @@ export class InteractiveMode {
4408
4391
  this.showWarning(`未知的 Worker 命令: ${args}\n用法: /worker [status|enable|disable|abort]`);
4409
4392
  }
4410
4393
  }
4394
+ showWorkerSelector() {
4395
+ import("./components/worker-selector.js").then(({ WorkerSelectorComponent }) => {
4396
+ const config = {
4397
+ enabled: this.session.workerEnabled,
4398
+ maxWorkers: 4,
4399
+ communicationMode: "message",
4400
+ };
4401
+ const selector = new WorkerSelectorComponent(config, {
4402
+ onEnabledChange: (enabled) => {
4403
+ this.session.workerEnabled = enabled;
4404
+ this.showWarning(`Worker 模式已${enabled ? "启用" : "禁用"}`);
4405
+ },
4406
+ onMaxWorkersChange: (maxWorkers) => {
4407
+ this.showWarning(`最大 Worker 数已设置为 ${maxWorkers}`);
4408
+ },
4409
+ onCommunicationModeChange: (mode) => {
4410
+ this.showWarning(`通信模式已设置为 ${mode}`);
4411
+ },
4412
+ onAbortAll: () => {
4413
+ this.session.workerIntegration?.abortAllWorkers();
4414
+ this.showWarning("已中止所有 Worker");
4415
+ },
4416
+ onCancel: () => {
4417
+ this.chatContainer.removeChild(selector);
4418
+ this.ui.requestRender();
4419
+ },
4420
+ });
4421
+ this.chatContainer.addChild(selector);
4422
+ this.ui.requestRender();
4423
+ });
4424
+ }
4411
4425
  handleChangelogCommand() {
4412
4426
  const changelogPath = getChangelogPath();
4413
4427
  const allEntries = parseChangelog(changelogPath);