@aiderdesk/aiderdesk 0.75.0 → 0.76.0

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.
Files changed (76) hide show
  1. package/out/renderer/assets/{AgentSettings-DX34HLFv.js → AgentSettings-Dc8h1zSI.js} +2 -2
  2. package/out/renderer/assets/{InfoIcon-DzyZQ7Ye.js → InfoIcon-BuABw5oZ.js} +1 -1
  3. package/out/renderer/assets/{Onboarding-FwXfKZ8B.js → Onboarding-lX23sGcW.js} +4 -4
  4. package/out/renderer/assets/{ProviderHeader-Cii9aAmV.js → ProviderHeader-s7JSikLR.js} +2 -2
  5. package/out/renderer/assets/{SettingsPage-XanGltUZ.js → SettingsPage-CcsH6kmE.js} +314 -276
  6. package/out/renderer/assets/{UsageDashboard-eHbvZTZC.js → UsageDashboard-oAQNYvYh.js} +3 -3
  7. package/out/renderer/assets/{arc-CVfdiTl1.js → arc-BiaIwS79.js} +1 -1
  8. package/out/renderer/assets/{architectureDiagram-3BPJPVTR-DsLLo_Ek.js → architectureDiagram-3BPJPVTR-d7fu6X13.js} +4 -4
  9. package/out/renderer/assets/{blockDiagram-GPEHLZMM-eWy47S0_.js → blockDiagram-GPEHLZMM-CWD8GVpw.js} +4 -4
  10. package/out/renderer/assets/{c4Diagram-AAUBKEIU-BH9b_e6y.js → c4Diagram-AAUBKEIU-b5nYOm14.js} +2 -2
  11. package/out/renderer/assets/{channel-D1z_mPGJ.js → channel-B99g0IUF.js} +1 -1
  12. package/out/renderer/assets/{chunk-2J33WTMH-DK0Yw_7f.js → chunk-2J33WTMH-DmrXuNY-.js} +1 -1
  13. package/out/renderer/assets/{chunk-4BX2VUAB-DIGR8Y5b.js → chunk-4BX2VUAB-4Soxfj2i.js} +1 -1
  14. package/out/renderer/assets/{chunk-55IACEB6-DoCkLI5e.js → chunk-55IACEB6-BtS727h4.js} +1 -1
  15. package/out/renderer/assets/{chunk-727SXJPM-C2gQLzLi.js → chunk-727SXJPM-CVxcBF7D.js} +5 -5
  16. package/out/renderer/assets/{chunk-AQP2D5EJ-D83_SlRR.js → chunk-AQP2D5EJ-m8ArTZfD.js} +3 -3
  17. package/out/renderer/assets/{chunk-FMBD7UC4-CyiPoUsC.js → chunk-FMBD7UC4-yWO_9Kky.js} +1 -1
  18. package/out/renderer/assets/{chunk-ND2GUHAM-DfGsUYDD.js → chunk-ND2GUHAM-BkVCmcvx.js} +1 -1
  19. package/out/renderer/assets/{chunk-QZHKN3VN-BhnTFlht.js → chunk-QZHKN3VN-DwLbWeqf.js} +1 -1
  20. package/out/renderer/assets/{classDiagram-4FO5ZUOK-Dy7E8tVe.js → classDiagram-4FO5ZUOK-B3t9RWJZ.js} +6 -6
  21. package/out/renderer/assets/{classDiagram-v2-Q7XG4LA2-Dy7E8tVe.js → classDiagram-v2-Q7XG4LA2-B3t9RWJZ.js} +6 -6
  22. package/out/renderer/assets/{cose-bilkent-S5V4N54A-Dsl61WN3.js → cose-bilkent-S5V4N54A-W70GNPEp.js} +2 -2
  23. package/out/renderer/assets/{cytoscape.esm-Bm8DJGmZ.js → cytoscape.esm-BNSvh83I.js} +957 -957
  24. package/out/renderer/assets/{dagre-BM42HDAG-D-u18G94.js → dagre-BM42HDAG-D_Val_ih.js} +3 -3
  25. package/out/renderer/assets/{diagram-2AECGRRQ-BumP49Qp.js → diagram-2AECGRRQ-Z7UeOtJN.js} +3 -3
  26. package/out/renderer/assets/{diagram-5GNKFQAL-VpUN87Sw.js → diagram-5GNKFQAL-DY9Yifty.js} +4 -4
  27. package/out/renderer/assets/{diagram-KO2AKTUF-CXCWwzRa.js → diagram-KO2AKTUF-CGi0HZww.js} +3 -3
  28. package/out/renderer/assets/{diagram-LMA3HP47-vlOcStwn.js → diagram-LMA3HP47-bdoVxL2p.js} +3 -3
  29. package/out/renderer/assets/{diagram-OG6HWLK6-DS1BscxN.js → diagram-OG6HWLK6-2K829auL.js} +4 -4
  30. package/out/renderer/assets/{erDiagram-TEJ5UH35-DPi6-CLL.js → erDiagram-TEJ5UH35-D4sO1GH8.js} +4 -4
  31. package/out/renderer/assets/{flowDiagram-I6XJVG4X-BYlX12Cd.js → flowDiagram-I6XJVG4X-DQNz4Jg_.js} +6 -6
  32. package/out/renderer/assets/{ganttDiagram-6RSMTGT7-BJQl-A9d.js → ganttDiagram-6RSMTGT7-B3dUFX1p.js} +3 -3
  33. package/out/renderer/assets/{gitGraphDiagram-PVQCEYII-CUFXx3IZ.js → gitGraphDiagram-PVQCEYII-B95Lrq_7.js} +4 -4
  34. package/out/renderer/assets/{graph-CbFubTTc.js → graph-7kCtdoo_.js} +1 -1
  35. package/out/renderer/assets/{index-B9iW9QmT.js → index-58fbbmhI.js} +1 -1
  36. package/out/renderer/assets/{index-BkdacTnN.js → index-B2TL7Kll.js} +1 -1
  37. package/out/renderer/assets/{index-9GNr8q1O.js → index-BHaWBJe9.js} +1 -1
  38. package/out/renderer/assets/{index-B6R_BNfE.js → index-Bihcg0ql.js} +1 -1
  39. package/out/renderer/assets/{index-Cg7tn967.js → index-BnFS7uhp.js} +4 -4
  40. package/out/renderer/assets/{index-DeoI6jti.js → index-BoogYopJ.js} +1 -1
  41. package/out/renderer/assets/{index-DNlMJMPg.js → index-CNgsMipO.js} +6804 -5899
  42. package/out/renderer/assets/{index-C7885gEz.js → index-CRfveI6m.js} +1 -1
  43. package/out/renderer/assets/{index-DCILJy4w.css → index-DcD881Q1.css} +51 -884
  44. package/out/renderer/assets/{index-DYKLRIHT.js → index-GRVDmgjb.js} +1 -1
  45. package/out/renderer/assets/{index-fD843lMX.js → index-pvhejocY.js} +1 -1
  46. package/out/renderer/assets/{infoDiagram-5YYISTIA-IWJLFUYz.js → infoDiagram-5YYISTIA-C0OH2to7.js} +2 -2
  47. package/out/renderer/assets/{ishikawaDiagram-YF4QCWOH-BuNfm7cB.js → ishikawaDiagram-YF4QCWOH-DsgR-cKp.js} +1 -1
  48. package/out/renderer/assets/{journeyDiagram-JHISSGLW-CfceKUHO.js → journeyDiagram-JHISSGLW-Bg6okgzG.js} +4 -4
  49. package/out/renderer/assets/{jsx-dev-runtime-DT3FTts0.js → jsx-dev-runtime-DLJNe6VM.js} +1 -1
  50. package/out/renderer/assets/{kanban-definition-UN3LZRKU-Bb6YnEgS.js → kanban-definition-UN3LZRKU-1UvLCrWk.js} +2 -2
  51. package/out/renderer/assets/{katex-DK1nL-FM.js → katex-Co8xHYNH.js} +193 -193
  52. package/out/renderer/assets/{layout-BkrDn6V9.js → layout-9w0fH2nL.js} +2 -2
  53. package/out/renderer/assets/{linear-jxO_dc8P.js → linear-WTE7GZY2.js} +1 -1
  54. package/out/renderer/assets/{mindmap-definition-RKZ34NQL-BPRx7p9A.js → mindmap-definition-RKZ34NQL-BlxjYw-a.js} +3 -3
  55. package/out/renderer/assets/{pieDiagram-4H26LBE5-CPR4AuPM.js → pieDiagram-4H26LBE5-C4jZuzAH.js} +4 -4
  56. package/out/renderer/assets/{quadrantDiagram-W4KKPZXB-BKzlAr7m.js → quadrantDiagram-W4KKPZXB-BLG4PrcM.js} +2 -2
  57. package/out/renderer/assets/{requirementDiagram-4Y6WPE33-CUan3EZI.js → requirementDiagram-4Y6WPE33-CTTFFDvR.js} +3 -3
  58. package/out/renderer/assets/{sankeyDiagram-5OEKKPKP-y8X8qnX2.js → sankeyDiagram-5OEKKPKP-CjDlOfXf.js} +1 -1
  59. package/out/renderer/assets/{sequenceDiagram-3UESZ5HK-B4xv8iDW.js → sequenceDiagram-3UESZ5HK-6PJo_0SQ.js} +3 -3
  60. package/out/renderer/assets/{stateDiagram-AJRCARHV-DTPE2Z4L.js → stateDiagram-AJRCARHV-Cnhm9mmx.js} +6 -6
  61. package/out/renderer/assets/{stateDiagram-v2-BHNVJYJU-BmZ9o6q3.js → stateDiagram-v2-BHNVJYJU-BxKTEg-3.js} +4 -4
  62. package/out/renderer/assets/{time-D391Z6zp.js → time-YGhgEMYh.js} +1 -1
  63. package/out/renderer/assets/{timeline-definition-PNZ67QCA-DVLUB2HD.js → timeline-definition-PNZ67QCA-ooi5Tti4.js} +2 -2
  64. package/out/renderer/assets/{vennDiagram-CIIHVFJN-BGGBlVN1.js → vennDiagram-CIIHVFJN-B_kwCHhU.js} +1 -1
  65. package/out/renderer/assets/{wardley-L42UT6IY-ZVVSjQUD.js → wardley-L42UT6IY-Dnx4ZTc4.js} +1 -1
  66. package/out/renderer/assets/{wardleyDiagram-YWT4CUSO-CRAH-LRw.js → wardleyDiagram-YWT4CUSO-cqZcXF7R.js} +3 -3
  67. package/out/renderer/assets/{xychartDiagram-2RQKCTM6-DQqvm7M3.js → xychartDiagram-2RQKCTM6-BBUpFNY4.js} +2 -2
  68. package/out/renderer/index.html +2 -2
  69. package/out/resources/skills/extension-creator/references/event-types.md +25 -0
  70. package/out/resources/skills/extension-creator/references/extension-interface.md +50 -0
  71. package/out/resources/skills/extension-creator/references/ui-components.md +6 -0
  72. package/out/runner.js +465 -86
  73. package/package.json +16 -16
  74. package/patches/{ai+7.0.28.patch → ai+7.0.37.patch} +3 -3
  75. package/out/resources/linux/probe +0 -0
  76. package/out/resources/linux-x64/probe +0 -0
package/out/runner.js CHANGED
@@ -386,7 +386,7 @@ const TaskDataSchema = zod.z.object({
386
386
  lastMergeState: MergeStateSchema.optional(),
387
387
  aiderTotalCost: zod.z.number(),
388
388
  agentTotalCost: zod.z.number(),
389
- autonomyMode: zod.z.nativeEnum(AutonomyMode).optional(),
389
+ autonomyMode: zod.z.enum(AutonomyMode).optional(),
390
390
  agentProfileId: zod.z.string().optional(),
391
391
  provider: zod.z.string().optional(),
392
392
  model: zod.z.string().optional(),
@@ -413,6 +413,7 @@ var DefaultTaskState = /* @__PURE__ */ ((DefaultTaskState2) => {
413
413
  DefaultTaskState2["Done"] = "DONE";
414
414
  return DefaultTaskState2;
415
415
  })(DefaultTaskState || {});
416
+ new Set(Object.values(DefaultTaskState));
416
417
  const TaskStateEmoji = {
417
418
  [
418
419
  "TODO"
@@ -584,7 +585,44 @@ const extractProviderModel = (modelId) => {
584
585
  return [providerId, modelParts.join("/")];
585
586
  };
586
587
  const isUuid = (id) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id);
588
+ const parseCommandArgs = (input) => {
589
+ const args = [];
590
+ let current = "";
591
+ let inQuotes = false;
592
+ let wasQuoted = false;
593
+ for (let i = 0; i < input.length; i++) {
594
+ const char = input[i];
595
+ if (char === '"') {
596
+ wasQuoted = true;
597
+ inQuotes = !inQuotes;
598
+ } else if (char === " " && !inQuotes) {
599
+ if (current || wasQuoted) {
600
+ args.push(current);
601
+ current = "";
602
+ wasQuoted = false;
603
+ }
604
+ } else {
605
+ current += char;
606
+ }
607
+ }
608
+ if (current || wasQuoted) {
609
+ args.push(current);
610
+ }
611
+ return args;
612
+ };
587
613
  const DEFAULT_PAGE_SIZE = 100;
614
+ const safeStringify = (obj) => {
615
+ const seen = /* @__PURE__ */ new WeakSet();
616
+ return JSON.stringify(obj, (_key, value) => {
617
+ if (typeof value === "object" && value !== null) {
618
+ if (seen.has(value)) {
619
+ return "[Circular]";
620
+ }
621
+ seen.add(value);
622
+ }
623
+ return value;
624
+ });
625
+ };
588
626
  class LogBuffer {
589
627
  db = null;
590
628
  /**
@@ -618,8 +656,12 @@ class LogBuffer {
618
656
  INSERT INTO system_logs (timestamp, level, message, extension, metadata)
619
657
  VALUES (?, ?, ?, ?, ?)
620
658
  `;
659
+ const metadata = entry.metadata ? safeStringify(entry.metadata) : null;
660
+ if (metadata) {
661
+ entry.metadata = JSON.parse(metadata);
662
+ }
621
663
  const stmt = this.db.prepare(sql);
622
- const result = stmt.run(entry.timestamp, entry.level, entry.message, entry.extension || null, entry.metadata ? JSON.stringify(entry.metadata) : null);
664
+ const result = stmt.run(entry.timestamp, entry.level, entry.message, entry.extension || null, metadata);
623
665
  return result.lastInsertRowid;
624
666
  }
625
667
  /**
@@ -1210,7 +1252,9 @@ const getShellPath = () => {
1210
1252
  pathLength: shellPath.split(":").length
1211
1253
  });
1212
1254
  } catch (error) {
1213
- logger.error("Failed to load PATH from shell config:", error);
1255
+ logger.error("Failed to load PATH from shell config:", {
1256
+ error: error instanceof Error ? { message: error.message, name: error.name } : String(error)
1257
+ });
1214
1258
  try {
1215
1259
  shellPath = extractPathFromOutput(
1216
1260
  child_process.execSync(shellCommand, {
@@ -1227,7 +1271,9 @@ const getShellPath = () => {
1227
1271
  );
1228
1272
  logger.debug("Loaded PATH using login shell flags");
1229
1273
  } catch (loginError) {
1230
- logger.error("Failed to load PATH from login shell:", loginError);
1274
+ logger.error("Failed to load PATH from login shell:", {
1275
+ error: loginError instanceof Error ? { message: loginError.message, name: loginError.name } : String(loginError)
1276
+ });
1231
1277
  shellPath = process.env.PATH || "";
1232
1278
  }
1233
1279
  }
@@ -1354,7 +1400,7 @@ const getShellPath = () => {
1354
1400
  return cachedPath;
1355
1401
  } catch (error) {
1356
1402
  logger.error("ERROR: Failed to get shell PATH", {
1357
- error,
1403
+ error: error instanceof Error ? { message: error.message, name: error.name } : String(error),
1358
1404
  stack: error instanceof Error ? error.stack : "No stack trace available"
1359
1405
  });
1360
1406
  if (!isWindows) {
@@ -1403,7 +1449,7 @@ const getShellPath = () => {
1403
1449
  }
1404
1450
  } catch (configError) {
1405
1451
  logger.error("ERROR: Failed to read shell config files", {
1406
- error: configError,
1452
+ error: configError instanceof Error ? { message: configError.message, name: configError.name } : String(configError),
1407
1453
  stack: configError instanceof Error ? configError.stack : "No stack trace"
1408
1454
  });
1409
1455
  }
@@ -1416,6 +1462,29 @@ const getShellPath = () => {
1416
1462
  return fallbackPath;
1417
1463
  }
1418
1464
  };
1465
+ const getShellInitCommand = () => {
1466
+ const shellInfo = ShellDetector.getDefaultShell();
1467
+ const homeDir = os__namespace.homedir();
1468
+ switch (shellInfo.name) {
1469
+ case "bash": {
1470
+ const sourceCmd = `source /etc/profile >/dev/null 2>&1 || true; source ${homeDir}/.bash_profile >/dev/null 2>&1 || true; source ${homeDir}/.bashrc >/dev/null 2>&1 || true; `;
1471
+ const direnvCmd = 'command -v direnv >/dev/null 2>&1 && eval "$(direnv export bash 2>/dev/null)" 2>/dev/null || true; ';
1472
+ return sourceCmd + direnvCmd;
1473
+ }
1474
+ case "zsh": {
1475
+ const sourceCmd = `source /etc/zprofile >/dev/null 2>&1 || true; source ${homeDir}/.zprofile >/dev/null 2>&1 || true; source /etc/zshrc >/dev/null 2>&1 || true; source ${homeDir}/.zshrc >/dev/null 2>&1 || true; `;
1476
+ const direnvCmd = 'command -v direnv >/dev/null 2>&1 && eval "$(direnv export zsh 2>/dev/null)" 2>/dev/null || true; ';
1477
+ return sourceCmd + direnvCmd;
1478
+ }
1479
+ case "fish": {
1480
+ const sourceCmd = `source ${homeDir}/.config/fish/config.fish >/dev/null 2>&1 || true; `;
1481
+ const direnvCmd = "command -v direnv >/dev/null 2>&1 && direnv export fish 2>/dev/null | source || true; ";
1482
+ return sourceCmd + direnvCmd;
1483
+ }
1484
+ default:
1485
+ return "";
1486
+ }
1487
+ };
1419
1488
  const getShellCommandArgs = (command) => {
1420
1489
  return ShellDetector.getShellCommandArgs(command);
1421
1490
  };
@@ -4120,7 +4189,9 @@ Timeout: ${timeout}ms`;
4120
4189
  };
4121
4190
  abortSignal?.addEventListener("abort", abortListener);
4122
4191
  try {
4123
- const { shell: shellExec, args: shellArgs } = getShellCommandArgs(command);
4192
+ const shellInitCommand = getShellInitCommand();
4193
+ const fullCommand = shellInitCommand ? `${shellInitCommand} ${command}` : command;
4194
+ const { shell: shellExec, args: shellArgs } = getShellCommandArgs(fullCommand);
4124
4195
  childProcess = child_process.spawn(shellExec, shellArgs, {
4125
4196
  cwd: absoluteCwd,
4126
4197
  env: { ...process.env, TERM: "dumb", DEBIAN_FRONTEND: "noninteractive", PATH: getShellPath() },
@@ -7969,6 +8040,10 @@ ${fileList}${readOnlyNote}`
7969
8040
  const providers = this.modelManager.getProviders();
7970
8041
  let provider = providers.find((p) => p.id === profile.provider);
7971
8042
  let modelName = profile.model;
8043
+ let modelCallSettings = {
8044
+ maxRetries: MAX_RETRIES,
8045
+ abortSignal
8046
+ };
7972
8047
  if (provider) {
7973
8048
  const extensionResult = await this.extensionManager.dispatchEvent(
7974
8049
  "onAgentStarted",
@@ -7983,7 +8058,8 @@ ${fileList}${readOnlyNote}`
7983
8058
  contextFiles,
7984
8059
  systemPrompt,
7985
8060
  images,
7986
- skillsToActivate
8061
+ skillsToActivate,
8062
+ modelCallSettings
7987
8063
  },
7988
8064
  task.project,
7989
8065
  task
@@ -8002,6 +8078,10 @@ ${fileList}${readOnlyNote}`
8002
8078
  systemPrompt = extensionResult.systemPrompt;
8003
8079
  images = extensionResult.images ?? images;
8004
8080
  skillsToActivate = extensionResult.skillsToActivate;
8081
+ modelCallSettings = {
8082
+ ...modelCallSettings,
8083
+ ...extensionResult.modelCallSettings
8084
+ };
8005
8085
  }
8006
8086
  const userRequestMessage = prompt ? {
8007
8087
  id: promptContext?.id || uuid.v4(),
@@ -8066,7 +8146,7 @@ ${fileList}${readOnlyNote}`
8066
8146
  contextFiles,
8067
8147
  systemPrompt: systemPrompt?.substring(0, 100)
8068
8148
  });
8069
- const shouldCreateAbortController = !abortSignal;
8149
+ const shouldCreateAbortController = !modelCallSettings.abortSignal;
8070
8150
  let controllerId = null;
8071
8151
  if (shouldCreateAbortController) {
8072
8152
  controllerId = uuid.v4();
@@ -8077,10 +8157,10 @@ ${fileList}${readOnlyNote}`
8077
8157
  const newController = new AbortController();
8078
8158
  this.abortControllers.set(controllerId, newController);
8079
8159
  }
8080
- const effectiveAbortSignal = abortSignal || (controllerId ? this.abortControllers.get(controllerId)?.signal : void 0);
8160
+ const effectiveAbortSignal = modelCallSettings.abortSignal || (controllerId ? this.abortControllers.get(controllerId)?.signal : void 0);
8081
8161
  const cacheControl = this.modelManager.getCacheControl(provider, modelName);
8082
- const providerOptions = this.modelManager.getProviderOptions(provider, modelName);
8083
- const providerParameters = this.modelManager.getProviderParameters(provider, modelName);
8162
+ const providerParameters = this.modelManager.getProviderParameters(provider, modelName, modelCallSettings.reasoning);
8163
+ const providerOptions = this.modelManager.getProviderOptions(provider, modelName, modelCallSettings?.reasoning);
8084
8164
  const firstUserMessage = contextMessages.length > 0 ? contextMessages[0] : null;
8085
8165
  let messages = await this.prepareMessages(task, profile, contextMessages, contextFiles);
8086
8166
  const initialUserRequestMessageIndex = firstUserMessage ? messages.findIndex((message) => message.role === "user" && message.content === firstUserMessage.content) : messages.length;
@@ -8274,12 +8354,13 @@ ${fileList}${readOnlyNote}`
8274
8354
  instructions: systemPrompt,
8275
8355
  messages: optimizedMessages,
8276
8356
  tools: toolSet,
8277
- abortSignal: effectiveAbortSignal,
8278
8357
  maxOutputTokens: effectiveMaxOutputTokens,
8279
- maxRetries: 5,
8358
+ maxRetries: MAX_RETRIES,
8280
8359
  temperature: effectiveTemperature,
8281
8360
  telemetry: this.getTelemetrySettings(),
8282
- ...providerParameters
8361
+ ...modelCallSettings,
8362
+ ...providerParameters,
8363
+ abortSignal: effectiveAbortSignal
8283
8364
  };
8284
8365
  };
8285
8366
  let iterationCount = 0;
@@ -8311,7 +8392,7 @@ ${fileList}${readOnlyNote}`
8311
8392
  logger.info("Prompt aborted by user");
8312
8393
  return;
8313
8394
  }
8314
- currentStepMessages = await this.processStep(currentResponseId, stepResult, task, provider, modelName, promptContext, abortSignal);
8395
+ currentStepMessages = await this.processStep(currentResponseId, stepResult, task, provider, modelName, promptContext, effectiveAbortSignal);
8315
8396
  const extensionResult2 = await this.extensionManager.dispatchEvent(
8316
8397
  "onAgentStepFinished",
8317
8398
  {
@@ -8404,6 +8485,7 @@ ${fileList}${readOnlyNote}`
8404
8485
  onStepEnd,
8405
8486
  experimental_repairToolCall: repairToolCall
8406
8487
  });
8488
+ let currentMessageHasReasoning = false;
8407
8489
  try {
8408
8490
  for await (const chunk of result.stream) {
8409
8491
  logger.debug("Chunk:", { chunk, responseMessageIndex });
@@ -8411,6 +8493,7 @@ ${fileList}${readOnlyNote}`
8411
8493
  if (chunk.type === "text-start") {
8412
8494
  } else if (chunk.type === "text-end") {
8413
8495
  responseMessageIndex++;
8496
+ currentMessageHasReasoning = false;
8414
8497
  } else if (chunk.type === "text-delta") {
8415
8498
  if (chunk.text.trim()) {
8416
8499
  streamingMessageIds.add(responseMessageId);
@@ -8424,8 +8507,19 @@ ${fileList}${readOnlyNote}`
8424
8507
  }
8425
8508
  } else if (chunk.type === "reasoning-start") {
8426
8509
  streamingMessageIds.add(responseMessageId);
8510
+ if (currentMessageHasReasoning) {
8511
+ await task.processResponseMessage({
8512
+ id: responseMessageId,
8513
+ action: "response",
8514
+ content: "",
8515
+ reasoning: "\n\n",
8516
+ finished: false,
8517
+ promptContext
8518
+ });
8519
+ }
8427
8520
  } else if (chunk.type === "reasoning-delta") {
8428
8521
  streamingMessageIds.add(responseMessageId);
8522
+ currentMessageHasReasoning = true;
8429
8523
  await task.processResponseMessage({
8430
8524
  id: responseMessageId,
8431
8525
  action: "response",
@@ -8992,6 +9086,8 @@ ${fileList}${readOnlyNote}`
8992
9086
  }
8993
9087
  const hasAssistantMessage = content.some((part) => (part.type === "text" || part.type === "reasoning") && part.text?.trim());
8994
9088
  let responseMessageIndex = 0;
9089
+ let localReasoningText;
9090
+ let localText;
8995
9091
  const processToolResult = (toolResult, isLast) => {
8996
9092
  const [serverName, toolName] = extractServerNameToolName(toolResult.toolName);
8997
9093
  const toolPromptContext = extractPromptContextFromToolResult(toolResult.output) ?? promptContext;
@@ -9006,31 +9102,34 @@ ${fileList}${readOnlyNote}`
9006
9102
  );
9007
9103
  };
9008
9104
  for (let i = 0; i < content.length; i++) {
9009
- let part = content[i];
9105
+ const part = content[i];
9010
9106
  if (part.type === "reasoning") {
9011
- reasoningText = part.text;
9012
- text = "";
9013
- part = content[++i];
9107
+ if (localReasoningText) {
9108
+ localReasoningText += "\n\n" + part.text;
9109
+ } else {
9110
+ localReasoningText = part.text;
9111
+ }
9112
+ continue;
9014
9113
  }
9015
- if (part?.type === "text") {
9016
- text = part.text;
9114
+ if (part.type === "text") {
9115
+ localText = part.text;
9017
9116
  }
9018
- if (text || reasoningText) {
9117
+ if (localText || localReasoningText) {
9019
9118
  const message = {
9020
9119
  id: responseMessageIndex > 0 ? `${currentResponseId}-${responseMessageIndex}` : currentResponseId,
9021
9120
  action: "response",
9022
- content: text,
9023
- reasoning: reasoningText?.trim() || void 0,
9121
+ content: localText || "",
9122
+ reasoning: localReasoningText?.trim() || void 0,
9024
9123
  finished: true,
9025
9124
  usageReport: hasAssistantMessage ? usageReport : void 0,
9026
9125
  promptContext
9027
9126
  };
9028
9127
  await task.processResponseMessage(message);
9029
- text = "";
9030
- reasoningText = void 0;
9128
+ localText = void 0;
9129
+ localReasoningText = void 0;
9031
9130
  responseMessageIndex++;
9032
9131
  }
9033
- if (part?.type === "tool-result") {
9132
+ if (part.type === "tool-result") {
9034
9133
  const toolResult = toolResults.find((toolResult2) => toolResult2.toolCallId === part.toolCallId);
9035
9134
  if (toolResult) {
9036
9135
  toolResults = toolResults.filter((toolResult2) => toolResult2.toolCallId !== part.toolCallId);
@@ -9038,6 +9137,19 @@ ${fileList}${readOnlyNote}`
9038
9137
  }
9039
9138
  }
9040
9139
  }
9140
+ if (localReasoningText) {
9141
+ const message = {
9142
+ id: responseMessageIndex > 0 ? `${currentResponseId}-${responseMessageIndex}` : currentResponseId,
9143
+ action: "response",
9144
+ content: "",
9145
+ reasoning: localReasoningText.trim() || void 0,
9146
+ finished: true,
9147
+ usageReport: hasAssistantMessage ? usageReport : void 0,
9148
+ promptContext
9149
+ };
9150
+ await task.processResponseMessage(message);
9151
+ localReasoningText = void 0;
9152
+ }
9041
9153
  for (let i = 0; i < toolResults.length; i++) {
9042
9154
  const toolResult = toolResults[i];
9043
9155
  processToolResult(toolResult, i === toolResults.length - 1);
@@ -12163,6 +12275,10 @@ const UpdateExtensionSchema = zod.z.object({
12163
12275
  repositoryUrl: zod.z.string().url("Repository URL must be a valid URL"),
12164
12276
  projectDir: zod.z.string().optional()
12165
12277
  });
12278
+ const ReloadExtensionSchema = zod.z.object({
12279
+ filePath: zod.z.string().min(1, "File path is required"),
12280
+ projectDir: zod.z.string().optional()
12281
+ });
12166
12282
  class ExtensionsApi extends BaseApi {
12167
12283
  constructor(eventsHandler) {
12168
12284
  super();
@@ -12254,6 +12370,22 @@ class ExtensionsApi extends BaseApi {
12254
12370
  }
12255
12371
  })
12256
12372
  );
12373
+ router.post(
12374
+ "/extensions/reload",
12375
+ this.handleRequest(async (req, res) => {
12376
+ const parsed = this.validateRequest(ReloadExtensionSchema, req.body, res);
12377
+ if (!parsed) {
12378
+ return;
12379
+ }
12380
+ const { filePath, projectDir } = parsed;
12381
+ const success = await this.eventsHandler.reloadExtension(filePath, projectDir);
12382
+ if (success) {
12383
+ res.status(200).json({ message: "Extension reloaded successfully", success: true });
12384
+ } else {
12385
+ res.status(500).json({ message: "Failed to reload extension", success: false });
12386
+ }
12387
+ })
12388
+ );
12257
12389
  router.get(
12258
12390
  "/extensions/ui-components",
12259
12391
  this.handleRequest(async (req, res) => {
@@ -14141,8 +14273,12 @@ ${JSON.stringify(part.output.value)}`
14141
14273
  let subHasText = false;
14142
14274
  for (const subPart of subMessage.content) {
14143
14275
  if (subPart.type === "reasoning" && subPart.text?.trim()) {
14144
- subReasoningContent = subPart.text.trim();
14145
- subHasReasoning = true;
14276
+ if (subHasReasoning) {
14277
+ subReasoningContent += "\n\n" + subPart.text.trim();
14278
+ } else {
14279
+ subReasoningContent = subPart.text.trim();
14280
+ subHasReasoning = true;
14281
+ }
14146
14282
  } else if (subPart.type === "text" && subPart.text) {
14147
14283
  subTextContent = subPart.text.trim();
14148
14284
  subHasText = true;
@@ -14238,7 +14374,11 @@ ${JSON.stringify(part.output.value)}`
14238
14374
  };
14239
14375
  for (const part of message.content) {
14240
14376
  if (part.type === "reasoning" && part.text?.trim()) {
14241
- reasoning = part.text.trim();
14377
+ if (reasoning) {
14378
+ reasoning += "\n\n" + part.text.trim();
14379
+ } else {
14380
+ reasoning = part.text.trim();
14381
+ }
14242
14382
  } else if (part.type === "text" && part.text) {
14243
14383
  pushResponseCompletedData(part.text);
14244
14384
  } else if (part.type === "tool-call") {
@@ -14633,6 +14773,8 @@ class AiderManager {
14633
14773
  aiderStarting = false;
14634
14774
  aiderStartPromise = null;
14635
14775
  aiderStartResolve = null;
14776
+ aiderStartReject = null;
14777
+ aiderStartError = null;
14636
14778
  aiderModelsData = null;
14637
14779
  currentCommand = null;
14638
14780
  commandOutputs = /* @__PURE__ */ new Map();
@@ -14645,6 +14787,7 @@ class AiderManager {
14645
14787
  await this.kill();
14646
14788
  }
14647
14789
  await this.checkAndCleanupPidFile();
14790
+ this.aiderStartError = null;
14648
14791
  this.aiderStarting = true;
14649
14792
  this.eventManager.sendAiderConnectorStatus({ state: "starting-connector" }, this.task.getProjectDir(), this.task.taskId);
14650
14793
  const settings = this.store.getSettings();
@@ -14779,13 +14922,8 @@ class AiderManager {
14779
14922
  error: output
14780
14923
  });
14781
14924
  });
14782
- this.aiderProcess.on("close", (code) => {
14783
- logger.info("Aider process exited:", {
14784
- baseDir: this.task.getTaskDir(),
14785
- taskId: this.task.task.id,
14786
- code
14787
- });
14788
- });
14925
+ const aiderProcess = this.aiderProcess;
14926
+ aiderProcess.on("close", (code) => this.handleAiderProcessExit(aiderProcess, code));
14789
14927
  void this.writeAiderProcessPidFile();
14790
14928
  }
14791
14929
  async kill() {
@@ -14826,12 +14964,37 @@ class AiderManager {
14826
14964
  isStarted() {
14827
14965
  return !!this.aiderProcess;
14828
14966
  }
14967
+ handleAiderProcessExit(process2, code) {
14968
+ logger.info("Aider process exited:", {
14969
+ baseDir: this.task.getTaskDir(),
14970
+ taskId: this.task.task.id,
14971
+ code
14972
+ });
14973
+ if (this.aiderProcess !== process2) {
14974
+ return;
14975
+ }
14976
+ this.aiderProcess = null;
14977
+ this.aiderStarting = false;
14978
+ this.removeAiderProcessPidFile();
14979
+ this.currentCommand = null;
14980
+ const error = new Error(`Aider process exited before the connector became ready (code ${code ?? "unknown"})`);
14981
+ this.aiderStartError = error;
14982
+ this.eventManager.sendAiderConnectorStatus({ state: "failed", error: error.message }, this.task.getProjectDir(), this.task.taskId);
14983
+ this.aiderStartReject?.(error);
14984
+ this.aiderStartReject = null;
14985
+ this.aiderStartResolve = null;
14986
+ this.aiderStartPromise = null;
14987
+ }
14829
14988
  createAiderStartPromise() {
14989
+ if (this.aiderStartError) {
14990
+ return Promise.reject(this.aiderStartError);
14991
+ }
14830
14992
  if (this.aiderStartPromise) {
14831
14993
  return this.aiderStartPromise;
14832
14994
  }
14833
- this.aiderStartPromise = new Promise((resolve) => {
14995
+ this.aiderStartPromise = new Promise((resolve, reject) => {
14834
14996
  this.aiderStartResolve = resolve;
14997
+ this.aiderStartReject = reject;
14835
14998
  if (!this.aiderStarting) {
14836
14999
  resolve();
14837
15000
  }
@@ -14907,10 +15070,12 @@ class AiderManager {
14907
15070
  handleConnectorAdded(connector) {
14908
15071
  if (connector.source === "aider") {
14909
15072
  this.aiderStarting = false;
15073
+ this.aiderStartError = null;
14910
15074
  this.eventManager.sendAiderConnectorStatus({ state: "ready" }, this.task.getProjectDir(), this.task.taskId);
14911
15075
  if (this.aiderStartResolve) {
14912
15076
  this.aiderStartResolve();
14913
15077
  this.aiderStartResolve = null;
15078
+ this.aiderStartReject = null;
14914
15079
  this.aiderStartPromise = null;
14915
15080
  }
14916
15081
  }
@@ -16515,7 +16680,7 @@ Git output: ${err.stderr || err.stdout || err.message}`
16515
16680
  try {
16516
16681
  await execWithShellPath("git rev-parse HEAD", { cwd: worktreePath });
16517
16682
  } catch {
16518
- return files;
16683
+ return files.concat(await this.getNoHeadUpdatedFiles(worktreePath));
16519
16684
  }
16520
16685
  try {
16521
16686
  const { stdout: uncommittedNumstat } = await execWithShellPath("git diff --numstat -z HEAD", {
@@ -16624,7 +16789,7 @@ Git output: ${err.stderr || err.stdout || err.message}`
16624
16789
  try {
16625
16790
  await execWithShellPath("git rev-parse HEAD", { cwd: worktreePath });
16626
16791
  } catch {
16627
- return [];
16792
+ return await this.getNoHeadUpdatedFiles(worktreePath);
16628
16793
  }
16629
16794
  const { stdout } = await execWithShellPath("git diff --numstat -z HEAD", {
16630
16795
  cwd: worktreePath
@@ -16671,6 +16836,67 @@ Git output: ${err.stderr || err.stdout || err.message}`
16671
16836
  }
16672
16837
  return files;
16673
16838
  }
16839
+ /**
16840
+ * No-HEAD mode: repo has no commits yet. Uses the well-known empty tree hash
16841
+ * as the diff base, which is equivalent to `git diff HEAD` against an empty repo.
16842
+ * Shows staged files and unstaged modifications to staged files (same as `git diff HEAD`
16843
+ * would show if HEAD pointed to an empty commit). Untracked files are not shown,
16844
+ * consistent with the existing HEAD-based behavior.
16845
+ */
16846
+ async getNoHeadUpdatedFiles(worktreePath) {
16847
+ const EMPTY_TREE_HASH = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
16848
+ const files = [];
16849
+ try {
16850
+ const { stdout } = await execWithShellPath(`git diff --numstat -z ${EMPTY_TREE_HASH}`, {
16851
+ cwd: worktreePath
16852
+ });
16853
+ const entries = stdout.split("\0").filter((entry) => entry.trim() !== "");
16854
+ for (const entry of entries) {
16855
+ const parts = entry.split(" ");
16856
+ if (parts.length < 3) {
16857
+ continue;
16858
+ }
16859
+ const additions = parts[0] === "-" ? 0 : parseInt(parts[0], 10);
16860
+ const deletions = parts[1] === "-" ? 0 : parseInt(parts[1], 10);
16861
+ const filePath = parts.slice(2).join(" ");
16862
+ if (!filePath) {
16863
+ continue;
16864
+ }
16865
+ if (this.isSymlinkPath(worktreePath, filePath)) {
16866
+ continue;
16867
+ }
16868
+ const absoluteFilePath = path.join(worktreePath, filePath);
16869
+ let diff = "";
16870
+ try {
16871
+ const fileExists2 = await fs.access(absoluteFilePath).then(() => true).catch(() => false);
16872
+ if (fileExists2) {
16873
+ const fileContentBuffer = await fs.readFile(absoluteFilePath);
16874
+ if (istextorbinary.isBinary(filePath, fileContentBuffer)) {
16875
+ files.push({ path: filePath, additions, deletions, diff });
16876
+ continue;
16877
+ }
16878
+ }
16879
+ const escapedPath = filePath.replace(/"/g, '\\"');
16880
+ const { stdout: diffOutput } = await execWithShellPath(`git diff --unified=3 ${EMPTY_TREE_HASH} -- "${escapedPath}"`, {
16881
+ cwd: worktreePath,
16882
+ maxBuffer: 10 * 1024 * 1024
16883
+ });
16884
+ diff = diffOutput;
16885
+ } catch (diffError) {
16886
+ logger.warn(`Failed to get diff for file ${filePath}:`, {
16887
+ error: diffError instanceof Error ? diffError.message : String(diffError)
16888
+ });
16889
+ diff = "";
16890
+ }
16891
+ files.push({ path: filePath, additions, deletions, diff });
16892
+ }
16893
+ } catch (error) {
16894
+ logger.warn("Failed to get updated files for repo with no commits:", {
16895
+ error: error instanceof Error ? error.message : String(error)
16896
+ });
16897
+ }
16898
+ return files;
16899
+ }
16674
16900
  /**
16675
16901
  * Parse the output of `git diff-tree -p -r` into a map of filePath -> diff text.
16676
16902
  * Splits on "diff --git" boundaries to isolate per-file patches.
@@ -17312,16 +17538,13 @@ class Task {
17312
17538
  await this.renameWorktreeBranch(newBranch);
17313
17539
  }
17314
17540
  /**
17315
- * @deprecated This migration ensures older task data has the `branch` field
17316
- * and `baseBranch` stores the branch the worktree was created from.
17317
- * Can be removed once all users have migrated past v0.64.0.
17541
+ * Resolves missing `baseBranch` for worktrees created while the main repo
17542
+ * was in detached HEAD state, where `baseBranch` was never stored.
17318
17543
  */
17319
- async migrateWorktreeData() {
17320
- if (!this.task.worktree || this.task.worktree.branch) {
17321
- return;
17544
+ async resolveMissingWorktreeBaseBranch() {
17545
+ if (!this.task.worktree || this.task.worktree.baseBranch) {
17546
+ return false;
17322
17547
  }
17323
- const currentBranch = this.task.worktree.baseBranch;
17324
- this.task.worktree.branch = currentBranch;
17325
17548
  let resolvedBase = "";
17326
17549
  if (this.task.worktree.baseCommit) {
17327
17550
  const branches = await this.worktreeManager.getBranchesContainingCommit(this.project.baseDir, this.task.worktree.baseCommit);
@@ -17337,7 +17560,8 @@ class Task {
17337
17560
  }
17338
17561
  }
17339
17562
  this.task.worktree.baseBranch = resolvedBase || void 0;
17340
- await this.saveTask({ worktree: this.task.worktree });
17563
+ await this.saveTask({ worktree: this.task.worktree }, false);
17564
+ return true;
17341
17565
  }
17342
17566
  isInternal() {
17343
17567
  return this.taskId === INTERNAL_TASK_ID;
@@ -17441,7 +17665,10 @@ class Task {
17441
17665
  this.task.workingMode = "local";
17442
17666
  }
17443
17667
  }
17444
- await this.migrateWorktreeData();
17668
+ const worktreeBaseBranchResolved = await this.resolveMissingWorktreeBaseBranch();
17669
+ if (worktreeBaseBranchResolved && this.task.worktree) {
17670
+ void this.sendWorktreeIntegrationStatusUpdated();
17671
+ }
17445
17672
  if (await fileExists(this.getTaskDir())) {
17446
17673
  this.git = simpleGit.simpleGit(this.getTaskDir());
17447
17674
  }
@@ -19508,6 +19735,11 @@ ${contentText}</agent-response>`;
19508
19735
  const originalText = extractTextContent(originalUserMessage.content);
19509
19736
  const promptToRun = updatedPrompt ?? originalText;
19510
19737
  const imagesToRun = updatedImages ?? (updatedPrompt !== void 0 ? void 0 : extractImagesFromContent(originalUserMessage.content));
19738
+ if (this.tryCustomCommand(promptToRun, mode)) {
19739
+ this.sendTaskMessageRemoved(removedMessages.map((msg) => msg.id));
19740
+ await this.updateContextInfo();
19741
+ return;
19742
+ }
19511
19743
  if (promptToRun) {
19512
19744
  logger.info("Found message content to run, reloading and re-running prompt.", {
19513
19745
  remainingMessagesCount: (await this.contextManager.getContextMessages()).length
@@ -19525,6 +19757,13 @@ ${contentText}</agent-response>`;
19525
19757
  taskId: this.taskId
19526
19758
  });
19527
19759
  const mode = this.getCurrentMode();
19760
+ const contextMessages = await this.contextManager.getContextMessages();
19761
+ const lastMessage = contextMessages[contextMessages.length - 1];
19762
+ if (lastMessage?.role === MessageRole.User && this.tryCustomCommand(extractTextContent(lastMessage.content), mode)) {
19763
+ const removedMessageIds = this.contextManager.removeMessageById(lastMessage.id);
19764
+ this.sendTaskMessageRemoved(removedMessageIds);
19765
+ return;
19766
+ }
19528
19767
  if (!AIDER_MODES.includes(mode)) {
19529
19768
  const profile = await this.getTaskAgentProfile();
19530
19769
  if (!profile) {
@@ -19539,8 +19778,6 @@ ${contentText}</agent-response>`;
19539
19778
  this.addLogMessage("loading", "Resuming task...");
19540
19779
  void this.runPromptInAgent(profile, mode, null);
19541
19780
  } else {
19542
- const contextMessages = await this.contextManager.getContextMessages();
19543
- const lastMessage = contextMessages[contextMessages.length - 1];
19544
19781
  if (lastMessage && lastMessage.role === MessageRole.User) {
19545
19782
  logger.info("Last message is from user, redoing prompt");
19546
19783
  this.addLogMessage("loading", "Resuming task...");
@@ -19551,6 +19788,23 @@ ${contentText}</agent-response>`;
19551
19788
  }
19552
19789
  }
19553
19790
  }
19791
+ tryCustomCommand(prompt, mode) {
19792
+ if (!prompt.startsWith("/")) {
19793
+ return false;
19794
+ }
19795
+ const [name, ...args] = parseCommandArgs(prompt.slice(1));
19796
+ if (!name) {
19797
+ return false;
19798
+ }
19799
+ const isExtensionCommand = this.extensionManager.getCommands(this.project).some(({ command }) => command.name === name);
19800
+ const isCustomCommand = !!this.customCommandManager.getCommand(name);
19801
+ if (!isExtensionCommand && !isCustomCommand) {
19802
+ return false;
19803
+ }
19804
+ logger.info("Executing custom command from user prompt", { name, args });
19805
+ void this.runCustomCommand(name, args, mode);
19806
+ return true;
19807
+ }
19554
19808
  getCurrentMode() {
19555
19809
  return this.task.currentMode || this.store.getProjectSettings(this.project.baseDir).currentMode || "agent";
19556
19810
  }
@@ -22228,8 +22482,8 @@ const getAnthropicCacheControl = () => {
22228
22482
  placement: "message"
22229
22483
  };
22230
22484
  };
22231
- const getAnthropicProviderOptions = (llmProvider, _model) => {
22232
- if (!isAnthropicProvider(llmProvider)) {
22485
+ const getAnthropicProviderOptions = (llmProvider, _model, reasoning) => {
22486
+ if (!isAnthropicProvider(llmProvider) || reasoning && reasoning !== "provider-default") {
22233
22487
  return void 0;
22234
22488
  }
22235
22489
  return {
@@ -22359,8 +22613,8 @@ const createAnthropicCompatibleLlm = (profile, model, settings, projectDir) => {
22359
22613
  });
22360
22614
  return anthropicProvider(model.id);
22361
22615
  };
22362
- const getAnthropicCompatibleProviderOptions = (llmProvider, _model) => {
22363
- if (!isAnthropicCompatibleProvider(llmProvider)) {
22616
+ const getAnthropicCompatibleProviderOptions = (llmProvider, _model, reasoning) => {
22617
+ if (!isAnthropicCompatibleProvider(llmProvider) || reasoning && reasoning !== "provider-default") {
22364
22618
  return void 0;
22365
22619
  }
22366
22620
  return {
@@ -22447,8 +22701,15 @@ const createAzureLlm = (profile, model, settings, projectDir) => {
22447
22701
  });
22448
22702
  return azureProvider.responses(model.id);
22449
22703
  };
22450
- const getAzureProviderOptions = (llmProvider, model) => {
22704
+ const getAzureProviderOptions = (llmProvider, model, reasoning) => {
22451
22705
  if (isAzureProvider(llmProvider)) {
22706
+ if (reasoning && reasoning !== "provider-default") {
22707
+ return {
22708
+ openai: {
22709
+ reasoningSummary: "auto"
22710
+ }
22711
+ };
22712
+ }
22452
22713
  const providerOverrides = model.providerOverrides;
22453
22714
  const reasoningEffort = providerOverrides?.reasoningEffort ?? llmProvider.reasoningEffort;
22454
22715
  const mappedReasoningEffort = reasoningEffort === void 0 || reasoningEffort === ReasoningEffort.None ? void 0 : reasoningEffort.toLowerCase();
@@ -22467,12 +22728,13 @@ const getAzureProviderOptions = (llmProvider, model) => {
22467
22728
  }
22468
22729
  return void 0;
22469
22730
  };
22470
- const getAzureProviderParameters = (llmProvider, model) => {
22731
+ const getAzureProviderParameters = (llmProvider, model, reasoning) => {
22471
22732
  if (isAzureProvider(llmProvider)) {
22472
22733
  const providerOverrides = model.providerOverrides;
22473
22734
  const reasoningEffort = providerOverrides?.reasoningEffort ?? llmProvider.reasoningEffort;
22474
- if (reasoningEffort && reasoningEffort !== ReasoningEffort.None) {
22475
- logger.debug("Clearing temperature and maxOutputTokens for Azure with reasoning effort:", { reasoningEffort });
22735
+ const reasoningEnabled = reasoning && reasoning !== "provider-default" ? reasoning !== "none" : !!reasoningEffort && reasoningEffort !== ReasoningEffort.None;
22736
+ if (reasoningEnabled) {
22737
+ logger.debug("Clearing temperature and maxOutputTokens for Azure with reasoning:", { reasoning: reasoning ?? reasoningEffort });
22476
22738
  return {
22477
22739
  // not supported by Azure with reasoning models
22478
22740
  maxOutputTokens: void 0,
@@ -23061,10 +23323,20 @@ const createDeepseekLlm = (profile, model, settings, projectDir) => {
23061
23323
  });
23062
23324
  return deepseekProvider(model.id);
23063
23325
  };
23064
- const getDeepseekProviderOptions = (llmProvider, model) => {
23326
+ const getDeepseekProviderOptions = (llmProvider, model, reasoning) => {
23065
23327
  if (!isDeepseekProvider(llmProvider)) {
23066
23328
  return void 0;
23067
23329
  }
23330
+ if (reasoning && reasoning !== "provider-default") {
23331
+ if (reasoning === "none") {
23332
+ return {
23333
+ deepseek: {
23334
+ thinking: { type: "disabled" }
23335
+ }
23336
+ };
23337
+ }
23338
+ return void 0;
23339
+ }
23068
23340
  const providerOverrides = model.providerOverrides;
23069
23341
  const thinkingEnabled = providerOverrides?.thinkingEnabled ?? llmProvider.thinkingEnabled ?? true;
23070
23342
  const reasoningEffort = providerOverrides?.reasoningEffort ?? llmProvider.reasoningEffort ?? "high";
@@ -23075,12 +23347,13 @@ const getDeepseekProviderOptions = (llmProvider, model) => {
23075
23347
  }
23076
23348
  };
23077
23349
  };
23078
- const getDeepseekProviderParameters = (llmProvider, model) => {
23350
+ const getDeepseekProviderParameters = (llmProvider, model, reasoning) => {
23079
23351
  if (!isDeepseekProvider(llmProvider)) {
23080
23352
  return {};
23081
23353
  }
23082
23354
  const providerOverrides = model.providerOverrides;
23083
- const thinkingEnabled = providerOverrides?.thinkingEnabled ?? llmProvider.thinkingEnabled ?? true;
23355
+ const configuredThinkingEnabled = providerOverrides?.thinkingEnabled ?? llmProvider.thinkingEnabled ?? true;
23356
+ const thinkingEnabled = reasoning && reasoning !== "provider-default" ? reasoning !== "none" : configuredThinkingEnabled;
23084
23357
  if (thinkingEnabled) {
23085
23358
  return {
23086
23359
  temperature: void 0,
@@ -23204,11 +23477,22 @@ const getGeminiUsageReport = (task, provider, model, usage, providerMetadata) =>
23204
23477
  agentTotalCost: task.task.agentTotalCost + messageCost
23205
23478
  };
23206
23479
  };
23207
- const getGeminiProviderOptions = (llmProvider, model) => {
23480
+ const getGeminiProviderOptions = (llmProvider, model, reasoning) => {
23208
23481
  if (isGeminiProvider(llmProvider)) {
23209
23482
  const providerOverrides = model.providerOverrides;
23210
23483
  const includeThoughts = providerOverrides?.includeThoughts ?? llmProvider.includeThoughts;
23211
23484
  const thinkingBudget = providerOverrides?.thinkingBudget ?? llmProvider.thinkingBudget;
23485
+ if (reasoning && reasoning !== "provider-default") {
23486
+ return {
23487
+ google: {
23488
+ ...includeThoughts && {
23489
+ thinkingConfig: {
23490
+ includeThoughts: true
23491
+ }
23492
+ }
23493
+ }
23494
+ };
23495
+ }
23212
23496
  return {
23213
23497
  google: {
23214
23498
  ...(includeThoughts || thinkingBudget) && {
@@ -23596,9 +23880,12 @@ const createAlibabaPlanLlm = (profile, model, settings, projectDir) => {
23596
23880
  });
23597
23881
  return alibabaPlanProvider(model.id);
23598
23882
  };
23599
- const getAlibabaPlanProviderOptions = (llmProvider, model) => {
23883
+ const getAlibabaPlanProviderOptions = (llmProvider, model, reasoning) => {
23600
23884
  if (isAlibabaPlanProvider(llmProvider)) {
23601
23885
  const providerOverrides = model.providerOverrides;
23886
+ if (reasoning && reasoning !== "provider-default") {
23887
+ return void 0;
23888
+ }
23602
23889
  const thinkingEnabled = providerOverrides?.thinkingEnabled ?? llmProvider.thinkingEnabled ?? true;
23603
23890
  const thinkingBudget = providerOverrides?.thinkingBudget ?? llmProvider.thinkingBudget ?? 8192;
23604
23891
  logger.info(`Alibaba Plan provider options: thinkingEnabled=${thinkingEnabled}, thinkingBudget=${thinkingBudget}`);
@@ -24098,8 +24385,8 @@ const getMinimaxCacheControl = () => {
24098
24385
  placement: "message"
24099
24386
  };
24100
24387
  };
24101
- const getMinimaxProviderOptions = (llmProvider, _model) => {
24102
- if (!isMinimaxProvider(llmProvider)) {
24388
+ const getMinimaxProviderOptions = (llmProvider, _model, reasoning) => {
24389
+ if (!isMinimaxProvider(llmProvider) || reasoning && reasoning !== "provider-default") {
24103
24390
  return void 0;
24104
24391
  }
24105
24392
  return {
@@ -24288,10 +24575,13 @@ const createNeuralwattLlm = (profile, model, settings, projectDir) => {
24288
24575
  });
24289
24576
  return compatibleProvider(model.id);
24290
24577
  };
24291
- const getNeuralwattProviderOptions = (llmProvider, model) => {
24578
+ const getNeuralwattProviderOptions = (llmProvider, model, reasoning) => {
24292
24579
  if (!isNeuralwattProvider(llmProvider)) {
24293
24580
  return void 0;
24294
24581
  }
24582
+ if (reasoning && reasoning !== "provider-default") {
24583
+ return void 0;
24584
+ }
24295
24585
  const neuralwattProvider = llmProvider;
24296
24586
  const providerOverrides = model.providerOverrides;
24297
24587
  const reasoningEffort = providerOverrides?.reasoningEffort ?? neuralwattProvider.reasoningEffort;
@@ -24493,11 +24783,18 @@ const createOpenAiLlm = (profile, model, settings, projectDir) => {
24493
24783
  });
24494
24784
  return openAIProvider(model.id);
24495
24785
  };
24496
- const getOpenAiProviderOptions = (provider, model) => {
24786
+ const getOpenAiProviderOptions = (provider, model, reasoning) => {
24497
24787
  if (!isOpenAiProvider(provider)) {
24498
24788
  return void 0;
24499
24789
  }
24500
24790
  const openAiProvider = provider;
24791
+ if (reasoning && reasoning !== "provider-default") {
24792
+ return {
24793
+ openai: {
24794
+ reasoningSummary: "auto"
24795
+ }
24796
+ };
24797
+ }
24501
24798
  const providerOverrides = model.providerOverrides;
24502
24799
  const reasoningEffort = providerOverrides?.reasoningEffort ?? openAiProvider.reasoningEffort;
24503
24800
  const mappedReasoningEffort = reasoningEffort === void 0 || reasoningEffort === ReasoningEffort.None ? void 0 : reasoningEffort.toLowerCase();
@@ -24718,7 +25015,7 @@ const createOpenAiCompatibleLlm = (profile, model, settings, projectDir) => {
24718
25015
  });
24719
25016
  return compatibleProvider(model.id);
24720
25017
  };
24721
- const getOpenAiCompatibleProviderOptions = (provider, model) => {
25018
+ const getOpenAiCompatibleProviderOptions = (provider, model, reasoning) => {
24722
25019
  if (!isOpenAiCompatibleProvider(provider)) {
24723
25020
  return void 0;
24724
25021
  }
@@ -24726,17 +25023,19 @@ const getOpenAiCompatibleProviderOptions = (provider, model) => {
24726
25023
  const providerOverrides = model.providerOverrides;
24727
25024
  const reasoningEffort = providerOverrides?.reasoningEffort ?? openAiCompatibleProvider.reasoningEffort;
24728
25025
  const extraBody = providerOverrides?.extraBody ?? openAiCompatibleProvider.extraBody;
24729
- const mappedReasoningEffort = reasoningEffort === void 0 || reasoningEffort === ReasoningEffort.None ? void 0 : reasoningEffort.toLowerCase();
24730
25026
  const providerOptions = {};
24731
- if (mappedReasoningEffort) {
24732
- providerOptions.reasoningEffort = mappedReasoningEffort;
25027
+ if (!reasoning || reasoning === "provider-default") {
25028
+ const mappedReasoningEffort = reasoningEffort === void 0 || reasoningEffort === ReasoningEffort.None ? void 0 : reasoningEffort.toLowerCase();
25029
+ if (mappedReasoningEffort) {
25030
+ providerOptions.reasoningEffort = mappedReasoningEffort;
25031
+ }
24733
25032
  }
24734
25033
  if (extraBody) {
24735
25034
  Object.assign(providerOptions, extraBody);
24736
25035
  }
24737
25036
  if (Object.keys(providerOptions).length > 0) {
24738
25037
  logger.debug("Using provider options for OpenAI Compatible:", {
24739
- mappedReasoningEffort,
25038
+ reasoning,
24740
25039
  hasExtraBody: !!extraBody
24741
25040
  });
24742
25041
  return {
@@ -25472,11 +25771,22 @@ const getVertexAiUsageReport = (task, provider, model, usage, providerMetadata)
25472
25771
  agentTotalCost: task.task.agentTotalCost + messageCost
25473
25772
  };
25474
25773
  };
25475
- const getVertexAiProviderOptions = (llmProvider, model) => {
25774
+ const getVertexAiProviderOptions = (llmProvider, model, reasoning) => {
25476
25775
  if (isVertexAiProvider(llmProvider)) {
25477
25776
  const providerOverrides = model.providerOverrides;
25478
25777
  const includeThoughts = providerOverrides?.includeThoughts ?? llmProvider.includeThoughts;
25479
25778
  const thinkingBudget = providerOverrides?.thinkingBudget ?? llmProvider.thinkingBudget;
25779
+ if (reasoning && reasoning !== "provider-default") {
25780
+ return {
25781
+ vertex: {
25782
+ ...includeThoughts && {
25783
+ thinkingConfig: {
25784
+ includeThoughts: true
25785
+ }
25786
+ }
25787
+ }
25788
+ };
25789
+ }
25480
25790
  return {
25481
25791
  vertex: {
25482
25792
  ...(includeThoughts || thinkingBudget) && {
@@ -25586,13 +25896,29 @@ const getZaiPlanModelInfo = (_provider, modelId, allModelInfos) => {
25586
25896
  const fullModelId = `zai-coding-plan/${modelId}`;
25587
25897
  return allModelInfos[fullModelId];
25588
25898
  };
25589
- const getZaiPlanProviderOptions = (llmProvider, model) => {
25899
+ const getZaiPlanProviderOptions = (llmProvider, model, reasoning) => {
25590
25900
  if (isZaiPlanProvider(llmProvider)) {
25591
25901
  const providerOverrides = model.providerOverrides;
25592
25902
  const thinkingEnabled = providerOverrides?.thinkingEnabled ?? llmProvider.thinkingEnabled ?? true;
25593
25903
  const reasoningEffort = providerOverrides?.reasoningEffort ?? llmProvider.reasoningEffort ?? ReasoningEffort.Max;
25594
25904
  const toolCallStreamingDisabled = providerOverrides?.disableToolCallStreaming ?? llmProvider.disableToolCallStreaming ?? false;
25595
25905
  const toolStreamOption = toolCallStreamingDisabled ? {} : { tool_stream: true };
25906
+ if (reasoning && reasoning !== "provider-default") {
25907
+ if (reasoning === "none") {
25908
+ return {
25909
+ zaiPlan: {
25910
+ thinking: { type: "disabled" },
25911
+ ...toolStreamOption
25912
+ }
25913
+ };
25914
+ }
25915
+ if (Object.keys(toolStreamOption).length > 0) {
25916
+ return {
25917
+ zaiPlan: toolStreamOption
25918
+ };
25919
+ }
25920
+ return void 0;
25921
+ }
25596
25922
  if (thinkingEnabled === false) {
25597
25923
  return {
25598
25924
  zaiPlan: {
@@ -26235,7 +26561,7 @@ class ModelManager {
26235
26561
  }
26236
26562
  return typeof modelObj.providerOverrides?.disableToolCallStreaming === "boolean" ? modelObj.providerOverrides.disableToolCallStreaming : llmProvider.disableToolCallStreaming ?? false;
26237
26563
  }
26238
- getProviderOptions(provider, modelId) {
26564
+ getProviderOptions(provider, modelId, reasoning) {
26239
26565
  const llmProvider = provider.provider;
26240
26566
  const strategy = this.providerRegistry[llmProvider.name];
26241
26567
  if (!strategy?.getProviderOptions) {
@@ -26253,14 +26579,14 @@ class ModelManager {
26253
26579
  id: modelId,
26254
26580
  providerId: provider.id
26255
26581
  };
26256
- return strategy.getProviderOptions(llmProvider, fallbackModel);
26582
+ return strategy.getProviderOptions(llmProvider, fallbackModel, reasoning);
26257
26583
  }
26258
26584
  logger.debug(`Found model object for ${modelId} in provider ${provider.id}`, {
26259
26585
  hasProviderOverrides: !!modelObj.providerOverrides
26260
26586
  });
26261
- return strategy.getProviderOptions(llmProvider, modelObj);
26587
+ return strategy.getProviderOptions(llmProvider, modelObj, reasoning);
26262
26588
  }
26263
- getProviderParameters(provider, modelId) {
26589
+ getProviderParameters(provider, modelId, reasoning) {
26264
26590
  const llmProvider = provider.provider;
26265
26591
  const strategy = this.providerRegistry[llmProvider.name];
26266
26592
  if (!strategy?.getProviderParameters) {
@@ -26278,12 +26604,12 @@ class ModelManager {
26278
26604
  id: modelId,
26279
26605
  providerId: provider.id
26280
26606
  };
26281
- return strategy.getProviderParameters(llmProvider, fallbackModel);
26607
+ return strategy.getProviderParameters(llmProvider, fallbackModel, reasoning);
26282
26608
  }
26283
26609
  logger.debug(`Found model object for ${modelId} in provider ${provider.id}`, {
26284
26610
  hasProviderOverrides: !!modelObj.providerOverrides
26285
26611
  });
26286
- return strategy.getProviderParameters(llmProvider, modelObj);
26612
+ return strategy.getProviderParameters(llmProvider, modelObj, reasoning);
26287
26613
  }
26288
26614
  /**
26289
26615
  * Returns provider-specific tools for the given provider and model
@@ -26350,9 +26676,9 @@ class ModelManager {
26350
26676
  ...provider.strategy,
26351
26677
  createLlm: (profile2, model, settings, projectDir, toolSet, systemPrompt, providerMetadata) => provider.strategy.createLlm(profile2, model, settings, projectDir, toolSet, systemPrompt, providerMetadata),
26352
26678
  getUsageReport: provider.strategy.getUsageReport || getDefaultUsageReport,
26353
- getProviderOptions: provider.strategy.getProviderOptions ? (_provider, model) => provider.strategy.getProviderOptions(model) : void 0,
26679
+ getProviderOptions: provider.strategy.getProviderOptions ? (_provider, model, reasoning) => provider.strategy.getProviderOptions(model, reasoning) : void 0,
26354
26680
  getProviderTools: provider.strategy.getProviderTools ? (_provider, model) => provider.strategy.getProviderTools(model) : void 0,
26355
- getProviderParameters: provider.strategy.getProviderParameters ? (_provider, model) => provider.strategy.getProviderParameters(model) : void 0,
26681
+ getProviderParameters: provider.strategy.getProviderParameters ? (_provider, model, reasoning) => provider.strategy.getProviderParameters(model, reasoning) : void 0,
26356
26682
  getCacheControl: provider.strategy.getCacheControl ? (_provider, model) => provider.strategy.getCacheControl(model) : void 0,
26357
26683
  hasEnvVars: () => false,
26358
26684
  getAiderMapping: provider.strategy.getAiderMapping ? provider.strategy.getAiderMapping : (_provider, modelId) => ({
@@ -27810,6 +28136,9 @@ class TaskContextImpl {
27810
28136
  async mergeWorktreeToWorktree(targetWorktreeDir, includeUncommitted) {
27811
28137
  await this.task.mergeWorktreeToWorktree(targetWorktreeDir, includeUncommitted);
27812
28138
  }
28139
+ async resumeTask() {
28140
+ await this.task.resumeTask();
28141
+ }
27813
28142
  }
27814
28143
  class ProjectContextImpl {
27815
28144
  constructor(project) {
@@ -27885,6 +28214,17 @@ class ExtensionContextImpl {
27885
28214
  getProjectDir() {
27886
28215
  return this.project?.baseDir ?? "";
27887
28216
  }
28217
+ getOpenProjectDirs() {
28218
+ if (!this.store) {
28219
+ return [];
28220
+ }
28221
+ try {
28222
+ return this.store.getOpenProjects().map((project) => project.baseDir);
28223
+ } catch (error) {
28224
+ this.log(`Failed to get open project dirs: ${error}`, "error");
28225
+ return [];
28226
+ }
28227
+ }
27888
28228
  getTaskContext() {
27889
28229
  return this.taskContext;
27890
28230
  }
@@ -28848,6 +29188,29 @@ class ExtensionManager {
28848
29188
  this.modelManager.unregisterExtensionProviders(extension.id);
28849
29189
  logger.debug(`[Extensions] Unloaded extension: ${filePath}`);
28850
29190
  }
29191
+ async reloadExtension(filePath, project) {
29192
+ const extension = this.findExtensionByPath(filePath);
29193
+ if (!extension) {
29194
+ logger.warn(`[Extensions] Cannot reload: extension not found at ${filePath}`);
29195
+ return false;
29196
+ }
29197
+ logger.info(`[Extensions] Reloading extension: ${extension.metadata.name} (${filePath})`);
29198
+ const hadUIComponents = extension.instance.getUIComponents !== void 0;
29199
+ await this.unloadExtension(filePath);
29200
+ const { success, hasUIComponents } = await this.loadAndInitializeExtension(filePath, project);
29201
+ if (success && (hasUIComponents || hadUIComponents)) {
29202
+ this.eventManager.sendExtensionUIRefresh({
29203
+ projectDir: project?.baseDir,
29204
+ reloadComponents: true
29205
+ });
29206
+ }
29207
+ const providers = this.getProviders(project);
29208
+ if (providers.length > 0) {
29209
+ this.modelManager.registerExtensionProviders(providers);
29210
+ }
29211
+ this.debouncedNotifyListeners();
29212
+ return success;
29213
+ }
28851
29214
  findExtensionByPath(filePath) {
28852
29215
  const extensions = this.registry.getExtensions();
28853
29216
  return extensions.find((ext) => ext.filePath === filePath);
@@ -30178,9 +30541,15 @@ class EventsHandler {
30178
30541
  if (!existingProject) {
30179
30542
  logger.info("EventsHandler: addOpenProject", { baseDir });
30180
30543
  const providerModels = await this.modelManager.getProviderModels();
30544
+ const defaultAgentProfileId = this.agentProfileManager.getDefaultAgentProfileId();
30545
+ const settings = getDefaultProjectSettings(this.store, providerModels.models || [], baseDir, defaultAgentProfileId);
30546
+ const agentProfile = this.agentProfileManager.getProfile(settings.agentProfileId);
30547
+ if (!agentProfile || agentProfile.projectDir && !compareBaseDirs$1(agentProfile.projectDir, baseDir)) {
30548
+ settings.agentProfileId = defaultAgentProfileId;
30549
+ }
30181
30550
  const newProject = {
30182
30551
  baseDir: baseDir.endsWith("/") ? baseDir.slice(0, -1) : baseDir,
30183
- settings: getDefaultProjectSettings(this.store, providerModels.models || [], baseDir, this.agentProfileManager.getDefaultAgentProfileId()),
30552
+ settings,
30184
30553
  active: true
30185
30554
  };
30186
30555
  const updatedProjects = [...projects.map((p) => ({ ...p, active: false })), newProject];
@@ -31027,6 +31396,16 @@ ${error instanceof Error ? error.message : String(error)}`);
31027
31396
  async uninstallExtension(extensionId, projectDir) {
31028
31397
  return await this.extensionManager.uninstallExtension(extensionId, projectDir);
31029
31398
  }
31399
+ async reloadExtension(filePath, projectDir) {
31400
+ let project = void 0;
31401
+ if (projectDir) {
31402
+ project = this.projectManager.getProject(projectDir);
31403
+ if (!project) {
31404
+ throw new Error("Project not found");
31405
+ }
31406
+ }
31407
+ return await this.extensionManager.reloadExtension(filePath, project);
31408
+ }
31030
31409
  async updateExtension(extensionId, repositoryUrl, projectDir) {
31031
31410
  let project = void 0;
31032
31411
  if (projectDir) {