@aiderdesk/extensions 0.12.1 → 0.13.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.
package/extensions.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- export type LlmProviderName = "anthropic" | "anthropic-compatible" | "auggie" | "azure" | "bedrock" | "cerebras" | "claude-agent-sdk" | "deepseek" | "gemini" | "gemini-cli" | "gpustack" | "groq" | "alibaba-plan" | "kimi-plan" | "litellm" | "lmstudio" | "minimax" | "ollama" | "openai" | "openai-compatible" | "opencode" | "openrouter" | "requesty" | "synthetic" | "vertex-ai" | "zai-plan" | string;
3
+ export type LlmProviderName = "anthropic" | "anthropic-compatible" | "auggie" | "azure" | "bedrock" | "cerebras" | "claude-agent-sdk" | "deepseek" | "gemini" | "gemini-cli" | "gpustack" | "groq" | "alibaba-plan" | "kimi-plan" | "litellm" | "lmstudio" | "minimax" | "mistral" | "ollama" | "openai" | "openai-compatible" | "opencode" | "openrouter" | "requesty" | "synthetic" | "vertex-ai" | "zai-plan" | string;
4
4
  export interface LlmProviderBase {
5
5
  name: LlmProviderName;
6
6
  disableStreaming?: boolean;
@@ -88,9 +88,12 @@ export interface LmStudioProvider extends LlmProviderBase {
88
88
  name: "lmstudio";
89
89
  baseUrl: string;
90
90
  }
91
+ export type DeepseekReasoningEffort = "high" | "max";
91
92
  export interface DeepseekProvider extends LlmProviderBase {
92
93
  name: "deepseek";
93
94
  apiKey: string;
95
+ thinkingEnabled?: boolean;
96
+ reasoningEffort?: DeepseekReasoningEffort;
94
97
  }
95
98
  export interface GroqProvider extends LlmProviderBase {
96
99
  name: "groq";
@@ -163,6 +166,10 @@ export interface MinimaxProvider extends LlmProviderBase {
163
166
  name: "minimax";
164
167
  apiKey: string;
165
168
  }
169
+ export interface MistralProvider extends LlmProviderBase {
170
+ name: "mistral";
171
+ apiKey: string;
172
+ }
166
173
  export interface SyntheticProvider extends LlmProviderBase {
167
174
  name: "synthetic";
168
175
  apiKey: string;
@@ -170,7 +177,7 @@ export interface SyntheticProvider extends LlmProviderBase {
170
177
  export interface ExtensionLlmProvider extends LlmProviderBase {
171
178
  [key: string]: unknown;
172
179
  }
173
- export type LlmProvider = OpenAiProvider | AnthropicProvider | AnthropicCompatibleProvider | AuggieProvider | AzureProvider | GeminiProvider | GeminiCliProvider | VertexAiProvider | LmStudioProvider | BedrockProvider | ClaudeAgentSdkProvider | DeepseekProvider | GroqProvider | GpustackProvider | CerebrasProvider | AlibabaPlanProvider | KimiPlanProvider | OpenAiCompatibleProvider | LitellmProvider | OllamaProvider | OpenCodeProvider | OpenRouterProvider | RequestyProvider | SyntheticProvider | ZaiPlanProvider | MinimaxProvider | ExtensionLlmProvider;
180
+ export type LlmProvider = OpenAiProvider | AnthropicProvider | AnthropicCompatibleProvider | AuggieProvider | AzureProvider | GeminiProvider | GeminiCliProvider | VertexAiProvider | LmStudioProvider | BedrockProvider | ClaudeAgentSdkProvider | DeepseekProvider | GroqProvider | GpustackProvider | CerebrasProvider | AlibabaPlanProvider | KimiPlanProvider | OpenAiCompatibleProvider | LitellmProvider | OllamaProvider | OpenCodeProvider | OpenRouterProvider | RequestyProvider | SyntheticProvider | ZaiPlanProvider | MinimaxProvider | MistralProvider | ExtensionLlmProvider;
174
181
  export type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
175
182
  export type JSONObject = {
176
183
  [key: string]: JSONValue;
@@ -355,6 +362,7 @@ export interface UpdatedFile {
355
362
  diff?: string;
356
363
  commitHash?: string;
357
364
  commitMessage?: string;
365
+ hasConflicts?: boolean;
358
366
  }
359
367
  export interface CommandsData {
360
368
  baseDir: string;
@@ -401,6 +409,11 @@ declare const ProjectSettingsSchema: z.ZodObject<{
401
409
  contextCompactingThreshold: z.ZodOptional<z.ZodNumber>;
402
410
  weakModelLocked: z.ZodOptional<z.ZodBoolean>;
403
411
  autoApproveLocked: z.ZodOptional<z.ZodBoolean>;
412
+ updatedFilesGroupMode: z.ZodDefault<z.ZodEnum<{
413
+ grouped: "grouped";
414
+ flat: "flat";
415
+ }>>;
416
+ disabledRuleFiles: z.ZodDefault<z.ZodArray<z.ZodString>>;
404
417
  }, z.core.$strip>;
405
418
  export type ProjectSettings = z.infer<typeof ProjectSettingsSchema>;
406
419
  export declare enum ToolApprovalState {
@@ -490,7 +503,8 @@ declare const THEMES: readonly [
490
503
  "cappuccino",
491
504
  "fresh",
492
505
  "botanical-garden",
493
- "botanical-garden-dark"
506
+ "botanical-garden-dark",
507
+ "obsidian"
494
508
  ];
495
509
  export type Theme = (typeof THEMES)[number];
496
510
  declare const FONTS: readonly [
@@ -570,6 +584,8 @@ export interface TaskSettings {
570
584
  taskStateModel?: string | null;
571
585
  commitMessageModel?: string | null;
572
586
  defaultWorkingMode: WorkingMode;
587
+ worktreeBranchPrefix: string;
588
+ renameBranchOnNameGeneration: boolean;
573
589
  }
574
590
  export interface MemoryConfig {
575
591
  enabled: boolean;
@@ -634,11 +650,19 @@ export interface SettingsData {
634
650
  username: string;
635
651
  password: string;
636
652
  };
653
+ cors: {
654
+ enabled: boolean;
655
+ origins: string[];
656
+ };
637
657
  };
638
658
  memory: MemoryConfig;
639
659
  taskSettings: TaskSettings;
640
660
  hotkeyConfig?: HotkeyConfig;
641
661
  extensions?: ExtensionsConfig;
662
+ proxy: {
663
+ enabled: boolean;
664
+ url: string;
665
+ };
642
666
  }
643
667
  export interface ProviderProfile {
644
668
  id: string;
@@ -724,6 +748,7 @@ export interface CreateTaskParams {
724
748
  provider?: string;
725
749
  model?: string;
726
750
  mode?: Mode;
751
+ workingMode?: WorkingMode;
727
752
  addInitialContextFiles?: boolean;
728
753
  }
729
754
  export interface TodoItem {
@@ -762,6 +787,19 @@ export interface CustomCommand extends Command {
762
787
  includeContext?: boolean;
763
788
  autoApprove?: boolean;
764
789
  }
790
+ declare enum MemoryEntryType {
791
+ Task = "task",
792
+ UserPreference = "user-preference",
793
+ CodePattern = "code-pattern"
794
+ }
795
+ export interface MemoryEntry {
796
+ id: string;
797
+ content: string;
798
+ type: MemoryEntryType;
799
+ taskId?: string;
800
+ projectId?: string;
801
+ timestamp: number;
802
+ }
765
803
  export type AgentStepResult = unknown;
766
804
  export declare const AIDER_DESK_EXTENSIONS_REPO_URL = "https://github.com/hotovo/aider-desk/tree/main/packages/extensions/extensions/";
767
805
  export interface ResponseMessage {
@@ -872,7 +910,7 @@ export interface ExtensionProviderStrategy {
872
910
  getAiderMapping?: (provider: ProviderProfile, modelId: string, settings: SettingsData, projectDir: string) => AiderModelMapping;
873
911
  getUsageReport?: (task: unknown, provider: ProviderProfile, model: Model, usage: unknown, providerMetadata?: unknown) => UsageReportData;
874
912
  getProviderOptions?: (model: Model) => Record<string, Record<string, JSONValue>> | undefined;
875
- getCacheControl?: (profile: AgentProfile) => CacheControl | undefined;
913
+ getCacheControl?: (model: Model) => CacheControl | undefined;
876
914
  getProviderTools?: (model: Model) => Record<string, Tool> | Promise<Record<string, Tool>>;
877
915
  getProviderParameters?: (model: Model) => Record<string, unknown>;
878
916
  createVoiceSession?: (profile: ProviderProfile, settings: SettingsData) => Promise<VoiceSession>;
@@ -1221,55 +1259,381 @@ export interface QuestionOptions {
1221
1259
  * Provides read-only access to task data and safe operations.
1222
1260
  */
1223
1261
  export interface TaskContext {
1262
+ /** Read-only snapshot of the current task state including id, name, status, mode, and all persisted fields */
1224
1263
  readonly data: TaskData;
1264
+ /**
1265
+ * Get the list of files currently in the task's context.
1266
+ * These are the files the agent is aware of and can reference.
1267
+ * @returns Array of context files with their paths and read-only flags
1268
+ */
1225
1269
  getContextFiles(): Promise<ContextFile[]>;
1270
+ /**
1271
+ * Add a single file to the task's context by path.
1272
+ * Dispatches the `onFilesAdded` extension event before adding.
1273
+ * Updates context info and notifies connectors after adding.
1274
+ * @param path - Relative or absolute file path to add
1275
+ * @param readOnly - If true, the file is marked as read-only in the context
1276
+ */
1226
1277
  addFile(path: string, readOnly?: boolean): Promise<void>;
1278
+ /**
1279
+ * Add multiple files to the task's context at once.
1280
+ * Dispatches the `onFilesAdded` extension event for each file before adding.
1281
+ * Updates context info and notifies connectors after adding.
1282
+ * @param files - One or more ContextFile objects with path and optional readOnly flag
1283
+ */
1227
1284
  addFiles(...files: ContextFile[]): Promise<void>;
1285
+ /**
1286
+ * Remove a file from the task's context by path.
1287
+ * Dispatches the `onFilesDropped` extension event before removing.
1288
+ * @param path - File path to remove
1289
+ */
1228
1290
  dropFile(path: string): Promise<void>;
1291
+ /**
1292
+ * Get the full conversation history from the task's context manager.
1293
+ * These messages are stored in a JSON file on disk (not in a database) and sent to the LLM.
1294
+ * @returns Array of context messages (user, assistant, system, tool, etc.)
1295
+ */
1229
1296
  getContextMessages(): Promise<ContextMessage[]>;
1297
+ /**
1298
+ * Append a message to the task's context messages.
1299
+ * The message is stored in memory and auto-saved to the context JSON file on disk.
1300
+ * Optionally refreshes the context info summary displayed in the UI.
1301
+ * @param message - The context message to add
1302
+ * @param updateContextInfo - If true, refreshes the context info summary after adding
1303
+ */
1230
1304
  addContextMessage(message: ContextMessage, updateContextInfo?: boolean): Promise<void>;
1305
+ /**
1306
+ * Remove a specific message from the context by its ID.
1307
+ * Reloads connector messages and updates context info after removal.
1308
+ * @param messageId - The unique identifier of the message to remove
1309
+ */
1231
1310
  removeMessage(messageId: string): Promise<void>;
1311
+ /**
1312
+ * Remove the most recent message from the context.
1313
+ * Reloads connector messages and updates context info after removal.
1314
+ */
1232
1315
  removeLastMessage(): Promise<void>;
1316
+ /**
1317
+ * Remove all messages after the specified message (inclusive).
1318
+ * Reloads connector messages and updates context info after removal.
1319
+ * @param messageId - The ID of the message; this message and all messages after it are removed
1320
+ */
1233
1321
  removeMessagesUpTo(messageId: string): Promise<void>;
1322
+ /**
1323
+ * Load a set of messages into the context manager, replacing the current in-memory messages
1324
+ * and sending them to the UI via the event manager.
1325
+ * This is used for loading pre-authored context (e.g., from extensions).
1326
+ * @param messages - The context messages to load
1327
+ */
1234
1328
  loadContextMessages(messages: ContextMessage[]): Promise<void>;
1329
+ /**
1330
+ * Re-execute the last user prompt, optionally with a different mode or edited text.
1331
+ * Removes the last user message and all messages after it from the context, then resubmits.
1332
+ * @param mode - Optional mode to use for re-execution (defaults to current mode)
1333
+ * @param updatedPrompt - Optional new prompt text; if omitted, reuses the original prompt
1334
+ */
1235
1335
  redoLastUserPrompt(mode?: string, updatedPrompt?: string): Promise<void>;
1336
+ /**
1337
+ * Send a user message to the UI for display in the task's chat.
1338
+ * This only sends the message to the renderer via the event manager — it does not
1339
+ * add the message to the data context or persist it.
1340
+ * @param id - Unique identifier for the message
1341
+ * @param content - Text content of the user message
1342
+ * @param promptContext - Optional prompt context metadata
1343
+ */
1236
1344
  addUserMessage(id: string, content: string, promptContext?: PromptContext): void;
1345
+ /**
1346
+ * Send a tool execution message to the UI for display in the task's chat.
1347
+ * If a response and usage report are provided and saveToDb is true, the message is also
1348
+ * persisted via the data manager. Updates total cost tracking when usage data is present.
1349
+ * @param id - Unique identifier for the tool message
1350
+ * @param serverName - Name of the tool server (e.g., MCP server name or tool group)
1351
+ * @param toolName - Name of the tool that was called
1352
+ * @param input - Tool input parameters
1353
+ * @param response - Tool response text (if already available)
1354
+ * @param usageReport - Token usage data for this tool call
1355
+ * @param promptContext - Optional prompt context metadata
1356
+ * @param saveToDb - Whether to persist this message via the data manager (default: true)
1357
+ * @param finished - Whether the tool execution is complete (default: true if response is provided)
1358
+ */
1237
1359
  addToolMessage(id: string, serverName: string, toolName: string, input?: unknown, response?: string, usageReport?: UsageReportData, promptContext?: PromptContext, saveToDb?: boolean, finished?: boolean): void;
1360
+ /**
1361
+ * Process a response message — streams response chunks to the UI while in progress,
1362
+ * and sends the completed response when finished.
1363
+ * If finished and saveToDb is true, persists the response via the data manager.
1364
+ * Dispatches the `onResponseChunk` and `onResponseCompleted` extension events.
1365
+ * @param message - The response message containing content, finish state, and optional usage
1366
+ * @param saveToDb - Whether to persist the completed response via the data manager (default: true)
1367
+ */
1238
1368
  addResponseMessage(message: ResponseMessage, saveToDb?: boolean): Promise<void>;
1369
+ /**
1370
+ * Get the working directory for this task.
1371
+ * Returns the worktree path if the task has a git worktree configured,
1372
+ * otherwise returns the project's base directory.
1373
+ * @returns Absolute filesystem path to the task's working directory
1374
+ */
1239
1375
  getTaskDir(): string;
1376
+ /**
1377
+ * Get a list of files that can be added to the task's context.
1378
+ * Returns all files in the task directory that are not already in the context,
1379
+ * optionally filtered by a regex pattern.
1380
+ * @param searchRegex - Optional regex pattern to filter file names
1381
+ * @returns Array of file paths relative to the task directory
1382
+ */
1240
1383
  getAddableFiles(searchRegex?: string): Promise<string[]>;
1384
+ /**
1385
+ * Get all files in the task directory, optionally filtered by git tracking.
1386
+ * @param useGit - If true (default), returns only git-tracked files; if false, returns all files
1387
+ * @returns Array of file paths relative to the task directory
1388
+ */
1241
1389
  getAllFiles(useGit?: boolean): Promise<string[]>;
1390
+ /**
1391
+ * Get files modified during the current task's execution.
1392
+ * Compares the current state against the main branch using the worktree manager.
1393
+ * @returns Array of updated file entries with path and diff information
1394
+ */
1242
1395
  getUpdatedFiles(): Promise<UpdatedFile[]>;
1396
+ /**
1397
+ * Get the cached repository map string.
1398
+ * The repo map summarizes the codebase structure and is maintained by the Aider manager.
1399
+ * @returns Repository map as a formatted string
1400
+ */
1243
1401
  getRepoMap(): string;
1402
+ /**
1403
+ * Stage a file in git (equivalent to `git add`).
1404
+ * No-op if the project is not a git repository.
1405
+ * @param path - File path to stage
1406
+ */
1244
1407
  addToGit(path: string): Promise<void>;
1408
+ /**
1409
+ * Get all todo items for this task, read from the task's todo file on disk.
1410
+ * @returns Array of todo items with name, completed status, and metadata
1411
+ */
1245
1412
  getTodos(): Promise<TodoItem[]>;
1413
+ /**
1414
+ * Create a new uncompleted todo item and write the updated list to the todo file.
1415
+ * @param name - Descriptive name for the todo item
1416
+ * @returns Updated array of all todo items
1417
+ */
1246
1418
  addTodo(name: string): Promise<TodoItem[]>;
1419
+ /**
1420
+ * Update an existing todo item's properties (e.g., mark as completed).
1421
+ * Writes the updated list to the todo file.
1422
+ * @param name - The name of the todo item to update
1423
+ * @param updates - Partial fields to update (e.g., { completed: true })
1424
+ * @returns Updated array of all todo items
1425
+ * @throws Error if no todo items exist or the specified name is not found
1426
+ */
1247
1427
  updateTodo(name: string, updates: Partial<TodoItem>): Promise<TodoItem[]>;
1428
+ /**
1429
+ * Remove a todo item by name and write the updated list to the todo file.
1430
+ * @param name - The name of the todo item to delete
1431
+ * @returns Updated array of all todo items
1432
+ * @throws Error if no todo items exist
1433
+ */
1248
1434
  deleteTodo(name: string): Promise<TodoItem[]>;
1435
+ /**
1436
+ * Remove all todo items from the task and write the empty list to the todo file.
1437
+ * @returns Empty array
1438
+ * @throws Error if no todo items exist
1439
+ */
1249
1440
  clearAllTodos(): Promise<TodoItem[]>;
1441
+ /**
1442
+ * Replace the entire todo list with the provided items and write to the todo file.
1443
+ * @param items - Complete set of todo items to set
1444
+ * @param initialUserPrompt - Optional prompt text to associate with the todo set
1445
+ */
1250
1446
  setTodos(items: TodoItem[], initialUserPrompt?: string): Promise<void>;
1447
+ /**
1448
+ * Submit a prompt for processing. If a prompt is already running, the new prompt is queued
1449
+ * and will execute after the current one finishes.
1450
+ * If there is a pending question, it will be answered with 'no' using the prompt text as user input.
1451
+ * @param prompt - The text prompt to send
1452
+ * @param mode - Optional mode to use (defaults to the task's current mode)
1453
+ */
1251
1454
  runPrompt(prompt: string, mode?: string): Promise<void>;
1455
+ /**
1456
+ * Execute a prompt directly using a specific agent profile.
1457
+ * Optionally waits for the currently running agent to finish before starting.
1458
+ * Saves the task state, runs the agent, sends resulting messages to connectors,
1459
+ * and determines the final task state.
1460
+ * @param profile - The agent profile configuration to use
1461
+ * @param mode - Execution mode
1462
+ * @param prompt - The prompt text, or null to use the current conversation context
1463
+ * @param promptContext - Optional prompt context metadata
1464
+ * @param contextMessages - Override context messages (uses task's context messages if omitted)
1465
+ * @param contextFiles - Override context files (uses task's context files if omitted)
1466
+ * @param systemPrompt - Override system prompt for the agent
1467
+ * @param waitForCurrentAgentToFinish - If true (default), waits for the running agent to complete before starting
1468
+ * @param sendNotification - If true (default), sends a desktop notification when the prompt completes
1469
+ * @returns Array of response completion data from the agent's execution
1470
+ */
1252
1471
  runPromptInAgent(profile: AgentProfile, mode: string, prompt: string | null, promptContext?: PromptContext, contextMessages?: ContextMessage[], contextFiles?: ContextFile[], systemPrompt?: string, waitForCurrentAgentToFinish?: boolean, sendNotification?: boolean): Promise<ResponseCompletedData[]>;
1472
+ /**
1473
+ * Execute a registered custom command by name.
1474
+ * First checks extension commands, then falls back to file-based custom commands.
1475
+ * Dispatches the `onCustomCommandExecuted` extension event. Processes the command template
1476
+ * with the provided arguments before executing it.
1477
+ * @param name - The command name (without the leading slash)
1478
+ * @param args - Optional arguments to pass to the command template
1479
+ * @param mode - Optional mode context for the command execution
1480
+ */
1253
1481
  runCustomCommand(name: string, args?: string[], mode?: string): Promise<void>;
1482
+ /**
1483
+ * Spawn a subagent with the given profile and prompt within the current task context.
1484
+ * The profile is automatically marked as a subagent. Dispatches the `onSubagentStarted`
1485
+ * extension event (can be blocked). Uses the task's context messages and files unless
1486
+ * overridden. Dispatches `onSubagentFinished` when complete.
1487
+ * @param agentProfile - The agent profile configuration for the subagent
1488
+ * @param prompt - The prompt to send to the subagent
1489
+ */
1254
1490
  runSubagent(agentProfile: AgentProfile, prompt: string): Promise<void>;
1491
+ /**
1492
+ * Execute a slash command in the task's context.
1493
+ * Dispatches the `onCommandExecuted` extension event (can be blocked).
1494
+ * Adds the command to input history. Handles built-in commands like 'drop', 'reset',
1495
+ * and 'undo' with special logic; forwards other commands to connectors.
1496
+ * @param command - The command string to execute (without the leading slash)
1497
+ */
1255
1498
  runCommand(command: string): Promise<void>;
1499
+ /**
1500
+ * Interrupt the currently running agent response or a specific subagent/conflict-resolution
1501
+ * agent by ID. Aborts the corresponding AbortController and answers any pending question with 'no'.
1502
+ */
1256
1503
  interruptResponse(): Promise<void>;
1504
+ /**
1505
+ * Generate text using a specific model without running the full agent loop.
1506
+ * Delegates to the Agent's generateText method using the project directory.
1507
+ * Useful for quick LLM calls (e.g., summarization, classification) within extensions.
1508
+ * @param modelId - The model identifier to use (format: "provider/model")
1509
+ * @param systemPrompt - System prompt for the generation request
1510
+ * @param prompt - User prompt for the generation request
1511
+ * @returns The generated text, or undefined if generation failed
1512
+ */
1257
1513
  generateText(modelId: string, systemPrompt: string, prompt: string): Promise<string | undefined>;
1514
+ /**
1515
+ * Ask the user a question and wait for their response.
1516
+ * Dispatches the `onQuestionAsked` extension event. If a previous question is pending,
1517
+ * waits for it to be answered first. Supports stored answers for auto-answering.
1518
+ * Sends a desktop notification if notifications are enabled.
1519
+ * @param text - The question text to display to the user
1520
+ * @param options - Optional configuration for answer choices, default answer, and subject
1521
+ * @returns The user's selected answer string
1522
+ */
1258
1523
  askQuestion(text: string, options?: QuestionOptions): Promise<string>;
1524
+ /**
1525
+ * Send a log message to the UI via the event manager.
1526
+ * Log messages appear in the task's message stream as informational, error, or warning entries.
1527
+ * @param level - Severity level: 'info', 'error', or 'warning'
1528
+ * @param message - The log message text
1529
+ */
1259
1530
  addLogMessage(level: "info" | "error" | "warning", message?: string): void;
1531
+ /**
1532
+ * Show or update a loading indicator in the task's UI.
1533
+ * Sends a loading log message via the event manager with optional interrupt action IDs.
1534
+ * @param message - Loading text to display
1535
+ * @param finished - If true, dismisses the loading indicator
1536
+ */
1260
1537
  addLoadingMessage(message?: string, finished?: boolean): void;
1538
+ /**
1539
+ * Update the task's data with the provided partial changes and persist them.
1540
+ * Merges updates into the existing task data. Handles special side effects:
1541
+ * working mode changes trigger worktree setup, mode changes may start the Aider manager,
1542
+ * and agent profile changes update estimated tokens. Skips saving if nothing changed.
1543
+ * @param updates - Partial task data fields to update
1544
+ * @returns The fully updated task data
1545
+ */
1261
1546
  updateTask(updates: Partial<TaskData>): Promise<TaskData>;
1547
+ /**
1548
+ * Perform a conversation handoff — generates a handoff summary of the current conversation
1549
+ * using the handoff prompt template, then optionally executes a follow-up prompt.
1550
+ * In agent mode, uses the handoff agent profile to generate the summary text.
1551
+ * @param focus - Optional focus description to guide the handoff summary
1552
+ * @param execute - If true, automatically runs the handoff prompt after generating the summary
1553
+ */
1262
1554
  handoffConversation(focus?: string, execute?: boolean): Promise<void>;
1555
+ /**
1556
+ * Clear the task's conversation context: sets the task state to Todo, clears all context messages
1557
+ * in the context manager, sends a 'clear' command to connectors, and dispatches a clear event to the UI.
1558
+ */
1263
1559
  clearContext(): Promise<void>;
1560
+ /**
1561
+ * Reset the task context by clearing both context files and context messages in the context manager,
1562
+ * then saves the context to disk immediately.
1563
+ */
1264
1564
  resetContext(): Promise<void>;
1565
+ /**
1566
+ * Compact the conversation by running a compact-conversation agent that summarizes the history.
1567
+ * Preserves the original user message and skill activation messages, replacing the rest with the summary.
1568
+ * Updates context info and adjusts the token usage estimate afterward.
1569
+ * @param instructions - Optional custom instructions to guide the compaction process
1570
+ */
1265
1571
  compactConversation(instructions?: string): Promise<void>;
1572
+ /**
1573
+ * Generate a markdown representation of the context messages in the context manager.
1574
+ * Formats user and assistant messages as text, and tool messages with tool name and JSON result.
1575
+ * @returns Markdown string of the context messages, or null if generation fails
1576
+ */
1266
1577
  generateContextMarkdown(): Promise<string | null>;
1578
+ /**
1579
+ * Check whether the task has been fully initialized and is ready for use.
1580
+ * @returns True if the task initialization process is complete
1581
+ */
1267
1582
  isInitialized(): boolean;
1583
+ /**
1584
+ * Update the autocompletion data sent to the UI.
1585
+ * Sends the provided words and the current file list from the task directory,
1586
+ * but only if the file list has changed or force is true.
1587
+ * @param words - New set of autocompletion words, or undefined to only update file list
1588
+ */
1268
1589
  updateAutocompletionWords(words?: string[]): Promise<void>;
1590
+ /**
1591
+ * Get all prompts currently queued for execution in this task.
1592
+ * Queued prompts are held in memory and execute sequentially after the current prompt finishes.
1593
+ * @returns Array of queued prompt data with IDs, text, mode, and timestamp
1594
+ */
1269
1595
  getQueuedPrompts(): QueuedPromptData[];
1596
+ /**
1597
+ * Immediately execute a queued prompt by moving it to the front of the queue,
1598
+ * adding it as a user message, and interrupting the current agent response.
1599
+ * @param promptId - The ID of the queued prompt to execute now
1600
+ */
1270
1601
  sendQueuedPromptNow(promptId: string): Promise<void>;
1602
+ /**
1603
+ * Remove a prompt from the execution queue without running it.
1604
+ * Notifies the UI of the updated queue.
1605
+ * @param promptId - The ID of the queued prompt to remove
1606
+ */
1271
1607
  removeQueuedPrompt(promptId: string): void;
1608
+ /**
1609
+ * Reorder the queued prompts to a specific arrangement.
1610
+ * Notifies the UI of the updated queue.
1611
+ * @param prompts - The complete reordered array of queued prompts
1612
+ */
1613
+ reorderQueuedPrompts(prompts: QueuedPromptData[]): void;
1614
+ /**
1615
+ * Edit the text content of an existing queued prompt.
1616
+ * Notifies the UI of the updated queue.
1617
+ * @param promptId - The ID of the queued prompt to edit
1618
+ * @param newText - The new text content for the prompt
1619
+ */
1620
+ editQueuedPrompt(promptId: string, newText: string): void;
1621
+ /**
1622
+ * Get the agent profile assigned to this task.
1623
+ * Checks the task-level agentProfileId first, then falls back to the project-level setting.
1624
+ * Applies any task-level provider/model overrides to the resolved profile.
1625
+ * @returns The resolved agent profile, or null if no profile is configured
1626
+ */
1272
1627
  getTaskAgentProfile(): Promise<AgentProfile | null>;
1628
+ /**
1629
+ * Programmatically answer a pending question that was asked to the user.
1630
+ * Dispatches the `onQuestionAnswered` extension event. Matches the answer against
1631
+ * configured shortkeys, or defaults to 'y'/'n'. Supports storing the answer for
1632
+ * future auto-answering with 'd' (don't ask again) or 'a' (always).
1633
+ * @param answer - The answer text to submit (e.g., 'y', 'n', 'a', 'd')
1634
+ * @param userInput - Optional raw user input associated with the answer
1635
+ * @returns True if a pending question was answered, false if no question is pending
1636
+ */
1273
1637
  answerQuestion(answer: string, userInput?: string): Promise<boolean>;
1274
1638
  }
1275
1639
  /**
@@ -1277,21 +1641,98 @@ export interface TaskContext {
1277
1641
  * Provides read-only access to project data and safe operations.
1278
1642
  */
1279
1643
  export interface ProjectContext {
1644
+ /** Absolute path to the project's root directory on the filesystem */
1280
1645
  readonly baseDir: string;
1646
+ /**
1647
+ * Create a new task within the project. Inherits model, mode, and other settings from the
1648
+ * most recent task (or from the parent task if parentId is specified).
1649
+ * Dispatches the `onTaskCreated` extension event after the task is created.
1650
+ * @param params - Task creation parameters including optional name, parentId, mode, and agent/model selection
1651
+ * @returns The newly created task data
1652
+ */
1281
1653
  createTask(params: CreateTaskParams): Promise<TaskData>;
1654
+ /**
1655
+ * Get a TaskContext for a specific loaded task by its ID.
1656
+ * Returns null if the task is not currently loaded in memory.
1657
+ * @param taskId - The unique identifier of the task to retrieve
1658
+ * @returns A TaskContext wrapping the Task instance, or null if not found
1659
+ */
1282
1660
  getTask(taskId: string): TaskContext | null;
1661
+ /**
1662
+ * Get all loaded tasks in the project (excluding the internal task).
1663
+ * Waits for initial task loading to complete before returning.
1664
+ * @returns Array of all task data objects sorted by updatedAt (most recent first)
1665
+ */
1283
1666
  getTasks(): Promise<TaskData[]>;
1667
+ /**
1668
+ * Get the TaskContext for the most recently updated task.
1669
+ * Determined by the updatedAt timestamp, excluding the internal task.
1670
+ * @returns A TaskContext for the most recent task, or null if no tasks exist
1671
+ */
1284
1672
  getMostRecentTask(): TaskContext | null;
1673
+ /**
1674
+ * Fork a task at a specific message, creating a new subtask.
1675
+ * The new task inherits settings from the source task and copies context messages
1676
+ * up to and including the specified message. The new task's parentId is set to the
1677
+ * source task or its parent.
1678
+ * @param taskId - The ID of the task to fork
1679
+ * @param messageId - The ID of the message to fork at (conversation is copied up to this point)
1680
+ * @returns The newly created forked task data
1681
+ */
1285
1682
  forkTask(taskId: string, messageId: string): Promise<TaskData>;
1683
+ /**
1684
+ * Create a duplicate of an existing task.
1685
+ * The duplicate inherits settings from the source task and copies all context messages and files.
1686
+ * If the source task has a worktree, the duplicate is made a subtask of the same parent.
1687
+ * @param taskId - The ID of the task to duplicate
1688
+ * @returns The newly created duplicate task data
1689
+ */
1286
1690
  duplicateTask(taskId: string): Promise<TaskData>;
1691
+ /**
1692
+ * Permanently delete a task and all its subtasks.
1693
+ * Closes the task(s), removes their worktrees if not shared with other tasks,
1694
+ * and deletes their task directories from disk.
1695
+ * @param taskId - The ID of the task to delete
1696
+ */
1287
1697
  deleteTask(taskId: string): Promise<void>;
1698
+ /**
1699
+ * Get all agent profiles available for this project.
1700
+ * Returns profiles from the agent profile manager scoped to this project,
1701
+ * including built-in, user-defined, and extension-provided profiles.
1702
+ * @returns Array of agent profile configurations
1703
+ */
1288
1704
  getAgentProfiles(): AgentProfile[];
1705
+ /**
1706
+ * Get all custom commands registered in the project.
1707
+ * Returns the full command data from the custom command manager,
1708
+ * which includes both file-based and extension-provided commands.
1709
+ * @returns Commands data containing all registered command definitions
1710
+ */
1289
1711
  getCommands(): CommandsData;
1712
+ /**
1713
+ * Get the project-level settings from the store.
1714
+ * @returns Current project settings
1715
+ */
1290
1716
  getProjectSettings(): ProjectSettings;
1717
+ /**
1718
+ * Load the input history file for the project.
1719
+ * Reads a file in a custom format where entries are separated by timestamp headers (# ...)
1720
+ * and lines starting with + contain the actual input text.
1721
+ * @returns Array of prompt strings in reverse chronological order (most recent first)
1722
+ */
1291
1723
  getInputHistory(): Promise<string[]>;
1292
1724
  }
1293
1725
  /**
1294
- * Context object passed to extension methods providing access to AiderDesk APIs
1726
+ * Context object passed to extension methods providing access to AiderDesk APIs.
1727
+ *
1728
+ * Availability depends on where the context is created:
1729
+ * - **Global context** (e.g., `onLoad` without project, `getAgents`, `getConfigComponent`):
1730
+ * project and task are not available — `getProjectDir()` returns empty string,
1731
+ * `getTaskContext()` returns null, and `getProjectContext()` throws.
1732
+ * - **Project context** (e.g., event handlers, `getTools`, `getCommands`):
1733
+ * project is available but task may not be.
1734
+ * - **Task context** (e.g., task-specific event handlers, command execution):
1735
+ * both project and task are available.
1295
1736
  *
1296
1737
  * @example
1297
1738
  * ```typescript
@@ -1305,69 +1746,137 @@ export interface ProjectContext {
1305
1746
  */
1306
1747
  export interface ExtensionContext {
1307
1748
  /**
1308
- * Log a message to the AiderDesk console and log files
1749
+ * Log a message prefixed with the extension name to the AiderDesk logger.
1750
+ * Messages appear in the console output and log files at the specified level.
1309
1751
  * @param message - Message to log
1310
- * @param type - Log level (info, error, warn, debug)
1752
+ * @param type - Log level: 'info' (default), 'error', 'warn', or 'debug'
1311
1753
  */
1312
1754
  log(message: string, type?: "info" | "error" | "warn" | "debug"): void;
1313
1755
  /**
1314
- * Get the current project directory path
1315
- * @returns Absolute path to the project directory
1756
+ * Get the current project directory path.
1757
+ * Only available when the context is created within a project scope (e.g., event handlers,
1758
+ * getTools, getCommands). Returns an empty string when no project is available.
1759
+ * @returns Absolute path to the project directory, or empty string if not in a project context
1316
1760
  */
1317
1761
  getProjectDir(): string;
1318
1762
  /**
1319
- * Get the current task context for safe task operations
1320
- * @returns TaskContext or null if no task is active
1763
+ * Get the task context for the current task.
1764
+ * Only available when the context is created for a specific task (e.g., task event handlers,
1765
+ * command execution within a task). Returns null when no task is available.
1766
+ * @returns TaskContext wrapping the current Task, or null if no task is active
1321
1767
  */
1322
1768
  getTaskContext(): TaskContext | null;
1323
1769
  /**
1324
- * Get the project context for safe project operations
1325
- * @returns ProjectContext
1770
+ * Get the project context for safe project-level operations.
1771
+ * Only available when the context is created within a project scope.
1772
+ * Throws an Error if no project is available (e.g., during global onLoad).
1773
+ * @returns ProjectContext wrapping the current Project
1774
+ * @throws Error if called outside of a project context
1326
1775
  */
1327
1776
  getProjectContext(): ProjectContext;
1328
1777
  /**
1329
- * Get all available model configurations
1330
- * @returns Promise resolving to array of models
1778
+ * Get all available model configurations from all enabled providers.
1779
+ * Loads models from providers on first call and caches the results.
1780
+ * Returns an empty array if the ModelManager is not available.
1781
+ * @returns Promise resolving to a flat array of Model objects from all providers
1331
1782
  */
1332
1783
  getModelConfigs(): Promise<Model[]>;
1333
1784
  /**
1334
- * Get a specific setting value
1335
- * @param key - Setting key (dot-notation supported, e.g., 'general.theme')
1336
- * @returns Promise resolving to the setting value
1785
+ * Get a specific setting value from the global settings using dot-notation path.
1786
+ * Navigates the settings object by splitting the key on '.' and reducing.
1787
+ * Returns undefined if the key path does not exist.
1788
+ * @param key - Setting key in dot-notation (e.g., 'general.theme', 'taskSettings.defaultWorkingMode')
1789
+ * @returns Promise resolving to the setting value, or undefined if not found
1790
+ * @throws Error if the Store is not available
1337
1791
  */
1338
1792
  getSetting(key: string): Promise<unknown>;
1339
1793
  /**
1340
- * Update multiple settings at once
1341
- * @param updates - Partial settings object with updates
1342
- * @returns Promise that resolves when settings are saved
1794
+ * Update global settings by merging the provided partial updates into the current settings,
1795
+ * saving them via the store, and notifying the renderer via the event manager.
1796
+ * @param updates - Partial settings object with fields to update
1797
+ * @throws Error if the Store is not available
1343
1798
  */
1344
1799
  updateSettings(updates: Partial<SettingsData>): Promise<void>;
1345
1800
  /**
1346
- * Trigger a data refresh for UI components in the renderer
1347
- * Use this when extension internal state changes and UI components need to re-fetch their data
1801
+ * Trigger a data refresh for UI components in the renderer.
1802
+ * Sends an event to the renderer causing matching components to re-fetch their data
1803
+ * via `getUIExtensionData`. Can target a specific component and/or task.
1804
+ * No-op if the EventManager is not available.
1348
1805
  * @param componentId - Optional component ID to refresh only a specific component
1349
- * @param taskId - Optional task ID to refresh only components for a specific task
1806
+ * @param taskId - Optional task ID to scope the refresh to components for a specific task
1350
1807
  */
1351
1808
  triggerUIDataRefresh(componentId?: string, taskId?: string): void;
1352
1809
  /**
1353
- * Trigger a full reload of all UI component definitions for this extension
1354
- * Use this when the component structure or definitions have changed
1810
+ * Trigger a full reload of all UI component definitions for this extension.
1811
+ * Causes the renderer to discard cached component definitions and re-fetch them
1812
+ * via `getUIComponents`. Use this when component structure or JSX has changed.
1813
+ * No-op if the EventManager is not available.
1355
1814
  */
1356
1815
  triggerUIComponentsReload(): void;
1357
1816
  /**
1358
- * Open a URL either in external browser, a new window, or a modal overlay
1817
+ * Open a URL in the specified target.
1818
+ * - 'external': Opens in the system's default browser via `shell.openExternal`.
1819
+ * - 'window': Opens in a new Electron BrowserWindow (in Node/Docker environments, falls back to external).
1820
+ * - 'modal-overlay': Opens as an iframe inside a modal overlay dialog in the app (requires EventManager).
1359
1821
  * @param url - URL to open
1360
1822
  * @param target - Where to open: 'external' (system browser), 'window' (new Electron window), or 'modal-overlay' (iframe in modal)
1361
- * In Node/Docker environments, 'window' falls back to 'external'
1362
- * @returns Promise that resolves when URL is opened
1823
+ * @throws Error if the URL fails to open
1363
1824
  */
1364
1825
  openUrl(url: string, target?: "external" | "window" | "modal-overlay"): Promise<void>;
1365
1826
  /**
1366
- * Open a file or directory in the system's default application or file manager
1827
+ * Open a file or directory in the system's default application using Electron's `shell.openPath`.
1367
1828
  * @param path - Absolute path to the file or directory to open
1368
- * @returns Promise that resolves to true if successful, false otherwise
1829
+ * @returns true if opened successfully, false if it failed (e.g., not in Electron environment)
1369
1830
  */
1370
1831
  openPath(path: string): Promise<boolean>;
1832
+ /**
1833
+ * Get the memory context for vector store operations (store, retrieve, update, delete memories).
1834
+ * Uses the same underlying vector store as the built-in memory tools.
1835
+ * @returns MemoryContext instance (the MemoryManager itself)
1836
+ * @throws Error if the MemoryManager is not available
1837
+ */
1838
+ getMemoryContext(): MemoryContext;
1839
+ }
1840
+ /**
1841
+ * Memory context providing access to AiderDesk's memory system.
1842
+ * Uses the same underlying vector store as the built-in memory MCP tools.
1843
+ */
1844
+ export interface MemoryContext {
1845
+ /**
1846
+ * Store a new memory entry
1847
+ * @returns The ID of the created memory
1848
+ */
1849
+ storeMemory(projectId: string, taskId: string, type: MemoryEntryType, content: string): Promise<string>;
1850
+ /**
1851
+ * Retrieve memories by semantic similarity
1852
+ * @returns Array of matching memory entries, ranked by relevance
1853
+ */
1854
+ retrieveMemories(projectId: string, query: string, limit?: number): Promise<MemoryEntry[]>;
1855
+ /**
1856
+ * Get a single memory by ID
1857
+ */
1858
+ getMemory(id: string): Promise<MemoryEntry | null>;
1859
+ /**
1860
+ * Delete a specific memory by ID
1861
+ */
1862
+ deleteMemory(id: string): Promise<boolean>;
1863
+ /**
1864
+ * Update the content of an existing memory
1865
+ */
1866
+ updateMemory(id: string, content: string): Promise<boolean>;
1867
+ /**
1868
+ * Get all stored memories
1869
+ */
1870
+ getAllMemories(): Promise<MemoryEntry[]>;
1871
+ /**
1872
+ * Check if the memory system is enabled and initialized
1873
+ */
1874
+ isMemoryEnabled(): boolean;
1875
+ /**
1876
+ * Enable or disable the memory system
1877
+ * Persists the setting to the store
1878
+ */
1879
+ setMemoryEnabled(enabled: boolean): void;
1371
1880
  }
1372
1881
  /**
1373
1882
  * Main extension interface that all extensions must implement
@@ -1475,6 +1984,29 @@ export interface Extension {
1475
1984
  * @returns Result of the action execution
1476
1985
  */
1477
1986
  executeUIExtensionAction?(componentId: string, action: string, args: unknown[], context: ExtensionContext): Promise<unknown>;
1987
+ /**
1988
+ * Return this extension's settings/config UI component.
1989
+ * Only one config component per extension is supported.
1990
+ * The returned JSX receives { config, updateConfig } props.
1991
+ * @param context - Extension context
1992
+ * @returns JSX string for the settings component, or undefined if no settings UI
1993
+ */
1994
+ getConfigComponent?(context: ExtensionContext): string | undefined;
1995
+ /**
1996
+ * Return the current configuration data for this extension's settings.
1997
+ * Called by the settings dialog on mount to populate initial values.
1998
+ * @param context - Extension context
1999
+ * @returns Current config data (any serializable type)
2000
+ */
2001
+ getConfigData?(context: ExtensionContext): Promise<unknown>;
2002
+ /**
2003
+ * Save configuration data for this extension's settings.
2004
+ * Called by the settings dialog when user clicks Save.
2005
+ * @param configData - The config data to persist
2006
+ * @param context - Extension context
2007
+ * @returns Result of the save operation
2008
+ */
2009
+ saveConfigData?(configData: unknown, context: ExtensionContext): Promise<unknown>;
1478
2010
  /**
1479
2011
  * Called when a new task is created
1480
2012
  * @returns void or partial event to modify task data