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