autodev-cli 1.4.0 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/bin/autodev.js +0 -0
  2. package/out/agentBackup/archive.d.ts +44 -0
  3. package/out/agentBackup/archive.js +131 -0
  4. package/out/agentBackup/archive.js.map +1 -0
  5. package/out/agentBackup/export.d.ts +18 -0
  6. package/out/agentBackup/export.js +92 -0
  7. package/out/agentBackup/export.js.map +1 -0
  8. package/out/agentBackup/import.d.ts +21 -0
  9. package/out/agentBackup/import.js +40 -0
  10. package/out/agentBackup/import.js.map +1 -0
  11. package/out/agentBackup/index.d.ts +6 -0
  12. package/out/agentBackup/index.js +11 -0
  13. package/out/agentBackup/index.js.map +1 -0
  14. package/out/agentBackup/layout.d.ts +30 -0
  15. package/out/agentBackup/layout.js +126 -0
  16. package/out/agentBackup/layout.js.map +1 -0
  17. package/out/agentBackup/manifest.d.ts +24 -0
  18. package/out/agentBackup/manifest.js +70 -0
  19. package/out/agentBackup/manifest.js.map +1 -0
  20. package/out/agentBackup/opencodeDb.d.ts +20 -0
  21. package/out/agentBackup/opencodeDb.js +213 -0
  22. package/out/agentBackup/opencodeDb.js.map +1 -0
  23. package/out/agentBackup/sessionProviders.d.ts +35 -0
  24. package/out/agentBackup/sessionProviders.js +263 -0
  25. package/out/agentBackup/sessionProviders.js.map +1 -0
  26. package/out/agentBackup/upload.d.ts +9 -0
  27. package/out/agentBackup/upload.js +121 -0
  28. package/out/agentBackup/upload.js.map +1 -0
  29. package/out/cli.d.ts +1 -0
  30. package/out/cli.js +8 -0
  31. package/out/cli.js.map +1 -1
  32. package/out/cliExit.d.ts +34 -0
  33. package/out/cliExit.js +159 -0
  34. package/out/cliExit.js.map +1 -0
  35. package/out/commands/config.d.ts +2 -0
  36. package/out/commands/config.js +7 -7
  37. package/out/commands/config.js.map +1 -1
  38. package/out/commands/connect.d.ts +2 -0
  39. package/out/commands/connect.js +11 -0
  40. package/out/commands/connect.js.map +1 -1
  41. package/out/commands/export.d.ts +2 -0
  42. package/out/commands/export.js +79 -0
  43. package/out/commands/export.js.map +1 -0
  44. package/out/commands/import.d.ts +2 -0
  45. package/out/commands/import.js +92 -0
  46. package/out/commands/import.js.map +1 -0
  47. package/out/commands/init.d.ts +16 -0
  48. package/out/commands/init.js +9 -5
  49. package/out/commands/init.js.map +1 -1
  50. package/out/commands/resume.d.ts +2 -0
  51. package/out/commands/resume.js +65 -0
  52. package/out/commands/resume.js.map +1 -0
  53. package/out/commands/sessions.d.ts +2 -0
  54. package/out/commands/sessions.js +64 -0
  55. package/out/commands/sessions.js.map +1 -0
  56. package/out/commands/start.d.ts +2 -0
  57. package/out/commands/start.js +40 -7
  58. package/out/commands/start.js.map +1 -1
  59. package/out/commands/status.d.ts +2 -0
  60. package/out/commands/status.js +3 -3
  61. package/out/commands/status.js.map +1 -1
  62. package/out/commands/tailOutput.d.ts +12 -0
  63. package/out/commands/up.d.ts +3 -0
  64. package/out/configManager.d.ts +42 -0
  65. package/out/configManager.js +430 -0
  66. package/out/configManager.js.map +1 -0
  67. package/out/connect.d.ts +4 -0
  68. package/out/connect.js +7 -7
  69. package/out/connect.js.map +1 -1
  70. package/out/core/adapters.d.ts +34 -0
  71. package/out/core/adapters.js +84 -0
  72. package/out/core/adapters.js.map +1 -0
  73. package/out/core/commandHelpers.d.ts +12 -0
  74. package/out/core/commandHelpers.js +96 -0
  75. package/out/core/commandHelpers.js.map +1 -0
  76. package/out/core/projectMcp.d.ts +25 -0
  77. package/out/core/projectMcp.js +144 -0
  78. package/out/core/projectMcp.js.map +1 -0
  79. package/out/core/provider/BaseProvider.d.ts +14 -0
  80. package/out/core/provider/BaseProvider.js +25 -0
  81. package/out/core/provider/BaseProvider.js.map +1 -0
  82. package/out/core/provider/ProviderRegistry.d.ts +12 -0
  83. package/out/core/provider/ProviderRegistry.js +40 -0
  84. package/out/core/provider/ProviderRegistry.js.map +1 -0
  85. package/out/core/provider/contract.d.ts +62 -0
  86. package/out/core/provider/contract.js +9 -0
  87. package/out/core/provider/contract.js.map +1 -0
  88. package/out/core/provider/implementations.d.ts +54 -0
  89. package/out/core/provider/implementations.js +147 -0
  90. package/out/core/provider/implementations.js.map +1 -0
  91. package/out/core/settingsLoader.d.ts +221 -0
  92. package/out/core/settingsLoader.js +176 -0
  93. package/out/core/settingsLoader.js.map +1 -0
  94. package/out/discordGateway.d.ts +26 -0
  95. package/out/discordGateway.js +230 -0
  96. package/out/discordGateway.js.map +1 -0
  97. package/out/discordPoller.d.ts +28 -0
  98. package/out/discordPoller.js +247 -0
  99. package/out/discordPoller.js.map +1 -0
  100. package/out/dispatcher.d.ts +12 -0
  101. package/out/dispatcher.js +214 -0
  102. package/out/dispatcher.js.map +1 -0
  103. package/out/emailPoller.d.ts +42 -0
  104. package/out/emailPoller.js +221 -0
  105. package/out/emailPoller.js.map +1 -0
  106. package/out/git/gitService.d.ts +36 -0
  107. package/out/git/gitService.js +165 -0
  108. package/out/git/gitService.js.map +1 -0
  109. package/out/hookEventNormalizer.d.ts +39 -0
  110. package/out/hookEventNormalizer.js +397 -0
  111. package/out/hookEventNormalizer.js.map +1 -0
  112. package/out/hooksManager.d.ts +25 -0
  113. package/out/hooksManager.js +471 -0
  114. package/out/hooksManager.js.map +1 -0
  115. package/out/launchIde.d.ts +14 -0
  116. package/out/logger.d.ts +12 -0
  117. package/out/mcpEmailTest.d.ts +29 -0
  118. package/out/mcpEmailTest.js +245 -0
  119. package/out/mcpEmailTest.js.map +1 -0
  120. package/out/mcpInstallCheck.d.ts +23 -0
  121. package/out/mcpInstallCheck.js +219 -0
  122. package/out/mcpInstallCheck.js.map +1 -0
  123. package/out/mcpManager.d.ts +35 -0
  124. package/out/mcpManager.js +371 -0
  125. package/out/mcpManager.js.map +1 -0
  126. package/out/messageBuilder.d.ts +54 -0
  127. package/out/messageBuilder.js +373 -0
  128. package/out/messageBuilder.js.map +1 -0
  129. package/out/openCodeHooksManager.d.ts +23 -0
  130. package/out/openCodeHooksManager.js +511 -0
  131. package/out/openCodeHooksManager.js.map +1 -0
  132. package/out/periodicActions.d.ts +63 -0
  133. package/out/periodicActions.js +237 -0
  134. package/out/periodicActions.js.map +1 -0
  135. package/out/profileBuilder.d.ts +29 -0
  136. package/out/profileBuilder.js +366 -0
  137. package/out/profileBuilder.js.map +1 -0
  138. package/out/prompt.d.ts +12 -0
  139. package/out/prompt.js +18 -0
  140. package/out/prompt.js.map +1 -0
  141. package/out/protocolSections.d.ts +26 -0
  142. package/out/protocolSections.js +209 -0
  143. package/out/protocolSections.js.map +1 -0
  144. package/out/providers/claudeCliProvider.d.ts +71 -0
  145. package/out/providers/claudeCliProvider.js +425 -0
  146. package/out/providers/claudeCliProvider.js.map +1 -0
  147. package/out/providers/claudeTuiProvider.d.ts +23 -0
  148. package/out/providers/claudeTuiProvider.js +296 -0
  149. package/out/providers/claudeTuiProvider.js.map +1 -0
  150. package/out/providers/copilotCliProvider.d.ts +16 -0
  151. package/out/providers/copilotCliProvider.js +44 -0
  152. package/out/providers/copilotCliProvider.js.map +1 -0
  153. package/out/providers/copilotSdkProvider.d.ts +12 -0
  154. package/out/providers/copilotSdkProvider.js +445 -0
  155. package/out/providers/copilotSdkProvider.js.map +1 -0
  156. package/out/providers/grokTuiProvider.d.ts +14 -0
  157. package/out/providers/grokTuiProvider.js +271 -0
  158. package/out/providers/grokTuiProvider.js.map +1 -0
  159. package/out/providers/opencodeCliProvider.d.ts +29 -0
  160. package/out/providers/opencodeCliProvider.js +199 -0
  161. package/out/providers/opencodeCliProvider.js.map +1 -0
  162. package/out/providers/opencodeSdkProvider.d.ts +22 -0
  163. package/out/providers/opencodeSdkProvider.js +557 -0
  164. package/out/providers/opencodeSdkProvider.js.map +1 -0
  165. package/out/providers.d.ts +9 -0
  166. package/out/providers.js +44 -0
  167. package/out/providers.js.map +1 -0
  168. package/out/rateLimit.d.ts +18 -0
  169. package/out/rateLimit.js +90 -0
  170. package/out/rateLimit.js.map +1 -0
  171. package/out/rdp/auth.d.ts +55 -0
  172. package/out/rdp/auth.js +197 -0
  173. package/out/rdp/auth.js.map +1 -0
  174. package/out/rdp/bridge.d.ts +86 -0
  175. package/out/rdp/bridge.js +1398 -0
  176. package/out/rdp/bridge.js.map +1 -0
  177. package/out/rdp/constants.d.ts +86 -0
  178. package/out/rdp/constants.js +182 -0
  179. package/out/rdp/constants.js.map +1 -0
  180. package/out/rdp/index.d.ts +7 -0
  181. package/out/rdp/index.js +14 -0
  182. package/out/rdp/index.js.map +1 -0
  183. package/out/rdp/session.d.ts +30 -0
  184. package/out/rdp/session.js +196 -0
  185. package/out/rdp/session.js.map +1 -0
  186. package/out/rdp/types.d.ts +27 -0
  187. package/out/rdp/types.js +6 -0
  188. package/out/rdp/types.js.map +1 -0
  189. package/out/sdk/index.d.ts +22 -0
  190. package/out/sdk/index.js +81 -0
  191. package/out/sdk/index.js.map +1 -0
  192. package/out/sessionState.d.ts +54 -0
  193. package/out/sessionState.js +284 -0
  194. package/out/sessionState.js.map +1 -0
  195. package/out/sessions.d.ts +11 -0
  196. package/out/sessions.js +32 -0
  197. package/out/sessions.js.map +1 -0
  198. package/out/taskLoop.d.ts +152 -0
  199. package/out/taskLoop.js +2505 -0
  200. package/out/taskLoop.js.map +1 -0
  201. package/out/todo.d.ts +42 -0
  202. package/out/todo.js +311 -0
  203. package/out/todo.js.map +1 -0
  204. package/out/todoWriteManager.d.ts +26 -0
  205. package/out/todoWriteManager.js +44 -0
  206. package/out/todoWriteManager.js.map +1 -0
  207. package/out/vnc/auth.d.ts +52 -0
  208. package/out/vnc/auth.js +181 -0
  209. package/out/vnc/auth.js.map +1 -0
  210. package/out/vnc/bridge.d.ts +40 -0
  211. package/out/vnc/bridge.js +540 -0
  212. package/out/vnc/bridge.js.map +1 -0
  213. package/out/vnc/constants.d.ts +8 -0
  214. package/out/vnc/constants.js +34 -0
  215. package/out/vnc/constants.js.map +1 -0
  216. package/out/vnc/des.d.ts +6 -0
  217. package/out/vnc/des.js +93 -0
  218. package/out/vnc/des.js.map +1 -0
  219. package/out/vnc/index.d.ts +7 -0
  220. package/out/vnc/index.js +13 -0
  221. package/out/vnc/index.js.map +1 -0
  222. package/out/vnc/session.d.ts +18 -0
  223. package/out/vnc/session.js +193 -0
  224. package/out/vnc/session.js.map +1 -0
  225. package/out/vnc/types.d.ts +16 -0
  226. package/out/vnc/types.js +6 -0
  227. package/out/vnc/types.js.map +1 -0
  228. package/out/webSocketPoller.d.ts +95 -0
  229. package/out/webSocketPoller.js +986 -0
  230. package/out/webSocketPoller.js.map +1 -0
  231. package/out/webhook.d.ts +37 -0
  232. package/out/webhook.js +265 -0
  233. package/out/webhook.js.map +1 -0
  234. package/out/webhookPoller.d.ts +40 -0
  235. package/out/webhookPoller.js +378 -0
  236. package/out/webhookPoller.js.map +1 -0
  237. package/package.json +54 -41
@@ -0,0 +1,12 @@
1
+ /** Tee a command's combined stdout/stderr to `outFile` (UTF-8, BOM-aware). */
2
+ export declare function teeCommand(cmd: string, outFile: string): string;
3
+ /** Append a step that writes the command's exit code to `exitFile`. */
4
+ export declare function withExitFile(cmd: string, exitFile: string): string;
5
+ /**
6
+ * Bracket a command with synthetic SessionStart / SessionEnd hook events
7
+ * (`.autodev/hooks-events.jsonl`) for providers without native hooks
8
+ * (copilot-cli, opencode-cli). The post hook always runs even on failure.
9
+ */
10
+ export declare function wrapWithSyntheticHooks(cmd: string, provider: string, workspaceRoot: string, sessionName: string): string;
11
+ /** Combine profile + message into a temp file under `.autodev/messages/` and return its path. */
12
+ export declare function writeCombinedFile(root: string, agentProfileFile: string, messageFile: string, includeProfile: boolean): string;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ // ---------------------------------------------------------------------------
3
+ // Shared shell-command builders used by every CLI provider strategy AND the
4
+ // dispatcher. Extracted from dispatcher.ts so the provider classes can reuse
5
+ // them without a circular import (DRY — one definition of how we tee output,
6
+ // capture exit codes, and bracket a run with synthetic hook events).
7
+ // ---------------------------------------------------------------------------
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.teeCommand = teeCommand;
43
+ exports.withExitFile = withExitFile;
44
+ exports.wrapWithSyntheticHooks = wrapWithSyntheticHooks;
45
+ exports.writeCombinedFile = writeCombinedFile;
46
+ const fs = __importStar(require("fs"));
47
+ const os = __importStar(require("os"));
48
+ const path = __importStar(require("path"));
49
+ const hooksManager_1 = require("../hooksManager");
50
+ /** Tee a command's combined stdout/stderr to `outFile` (UTF-8, BOM-aware). */
51
+ function teeCommand(cmd, outFile) {
52
+ if (os.platform() === 'win32') {
53
+ const utf8NoBom = 'New-Object System.Text.UTF8Encoding($false)';
54
+ return `$OutputEncoding=${utf8NoBom}; [Console]::OutputEncoding=${utf8NoBom}; ${cmd} 2>&1 | Tee-Object -FilePath ${JSON.stringify(outFile)}`;
55
+ }
56
+ return `{ LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 ${cmd}; } 2>&1 | tee ${JSON.stringify(outFile)}`;
57
+ }
58
+ /** Append a step that writes the command's exit code to `exitFile`. */
59
+ function withExitFile(cmd, exitFile) {
60
+ const q = JSON.stringify(exitFile);
61
+ if (os.platform() === 'win32') {
62
+ return `${cmd}; [System.IO.File]::WriteAllText(${q}, $LASTEXITCODE.ToString())`;
63
+ }
64
+ return `{ ${cmd}; echo $? > ${q}; }`;
65
+ }
66
+ /**
67
+ * Bracket a command with synthetic SessionStart / SessionEnd hook events
68
+ * (`.autodev/hooks-events.jsonl`) for providers without native hooks
69
+ * (copilot-cli, opencode-cli). The post hook always runs even on failure.
70
+ */
71
+ function wrapWithSyntheticHooks(cmd, provider, workspaceRoot, sessionName) {
72
+ const pre = (0, hooksManager_1.getManualHookCmd)(provider, 'SessionStart', workspaceRoot, sessionName);
73
+ const post = (0, hooksManager_1.getManualHookCmd)(provider, 'SessionEnd', workspaceRoot, sessionName);
74
+ if (os.platform() === 'win32') {
75
+ return `${pre}; ${cmd}; ${post}`;
76
+ }
77
+ return `${pre}; { ${cmd}; }; ${post}`;
78
+ }
79
+ /** Combine profile + message into a temp file under `.autodev/messages/` and return its path. */
80
+ function writeCombinedFile(root, agentProfileFile, messageFile, includeProfile) {
81
+ const msgsDir = path.join(root, '.autodev', 'messages');
82
+ if (!fs.existsSync(msgsDir)) {
83
+ fs.mkdirSync(msgsDir, { recursive: true });
84
+ }
85
+ const msgContent = fs.readFileSync(messageFile, 'utf8');
86
+ let combined = msgContent;
87
+ if (includeProfile) {
88
+ const profileContent = fs.readFileSync(agentProfileFile, 'utf8');
89
+ // Task message FIRST so the agent sees the current task immediately.
90
+ combined = `${msgContent}\n\n---\n\n${profileContent}`;
91
+ }
92
+ const combinedFile = path.join(msgsDir, `temp_${Date.now()}.md`);
93
+ fs.writeFileSync(combinedFile, combined, 'utf8');
94
+ return combinedFile;
95
+ }
96
+ //# sourceMappingURL=commandHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandHelpers.js","sourceRoot":"","sources":["../../src/core/commandHelpers.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,qEAAqE;AACrE,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQ9E,gCAMC;AAGD,oCAMC;AAOD,wDAOC;AAGD,8CAaC;AAnDD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,kDAAmD;AAEnD,8EAA8E;AAC9E,SAAgB,UAAU,CAAC,GAAW,EAAE,OAAe;IACrD,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,6CAA6C,CAAC;QAChE,OAAO,mBAAmB,SAAS,+BAA+B,SAAS,KAAK,GAAG,gCAAgC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/I,CAAC;IACD,OAAO,yCAAyC,GAAG,kBAAkB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;AACjG,CAAC;AAED,uEAAuE;AACvE,SAAgB,YAAY,CAAC,GAAW,EAAE,QAAgB;IACxD,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,EAAE,CAAC;QAC9B,OAAO,GAAG,GAAG,oCAAoC,CAAC,6BAA6B,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,GAAW,EAAE,QAAgB,EAAE,aAAqB,EAAE,WA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,CAAC,CAAC;IACjD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface McpJsonEntry {
2
+ command: string;
3
+ args?: string[];
4
+ env?: Record<string, string>;
5
+ /** false = entry is kept in .mcp.json to preserve credentials but not synced to providers */
6
+ enabled?: boolean;
7
+ alwaysLoad?: boolean;
8
+ _meta?: {
9
+ managedBy?: string;
10
+ name?: string;
11
+ kind?: 'user' | 'builtin';
12
+ [k: string]: unknown;
13
+ };
14
+ }
15
+ export type McpJsonEntries = Record<string, McpJsonEntry>;
16
+ /** Return only USER entries from .mcp.json (built-ins filtered out). */
17
+ export declare function loadProjectUserMcp(root: string): McpJsonEntries;
18
+ /** Read every entry from .mcp.json (user + builtin). */
19
+ export declare function loadProjectAllMcp(root: string): McpJsonEntries;
20
+ /** Write the full set of user entries (full replace), preserving any built-ins. */
21
+ export declare function saveProjectUserMcp(root: string, userEntries: McpJsonEntries): void;
22
+ /** Remove a single user entry by name. Built-ins are not touched. */
23
+ export declare function removeProjectUserMcp(root: string, name: string): boolean;
24
+ /** Replace every built-in entry with the supplied set, leaving user entries alone. */
25
+ export declare function replaceProjectBuiltinMcp(root: string, builtins: McpJsonEntries): void;
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadProjectUserMcp = loadProjectUserMcp;
37
+ exports.loadProjectAllMcp = loadProjectAllMcp;
38
+ exports.saveProjectUserMcp = saveProjectUserMcp;
39
+ exports.removeProjectUserMcp = removeProjectUserMcp;
40
+ exports.replaceProjectBuiltinMcp = replaceProjectBuiltinMcp;
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const MCP_FILE = '.mcp.json';
44
+ function _file(root) { return path.join(root, MCP_FILE); }
45
+ function _readAll(root) {
46
+ try {
47
+ const f = _file(root);
48
+ if (!fs.existsSync(f))
49
+ return {};
50
+ const cfg = JSON.parse(fs.readFileSync(f, 'utf8'));
51
+ const mcp = cfg && typeof cfg.mcpServers === 'object' && cfg.mcpServers ? cfg.mcpServers : {};
52
+ return mcp || {};
53
+ }
54
+ catch {
55
+ return {};
56
+ }
57
+ }
58
+ function _writeAll(root, entries) {
59
+ const f = _file(root);
60
+ let cfg = {};
61
+ if (fs.existsSync(f)) {
62
+ try {
63
+ cfg = JSON.parse(fs.readFileSync(f, 'utf8'));
64
+ }
65
+ catch { /* overwrite */ }
66
+ }
67
+ cfg.mcpServers = entries;
68
+ const dir = path.dirname(f);
69
+ if (!fs.existsSync(dir))
70
+ fs.mkdirSync(dir, { recursive: true });
71
+ fs.writeFileSync(f, JSON.stringify(cfg, null, 2) + '\n', 'utf8');
72
+ }
73
+ function _isBuiltin(entry) {
74
+ return entry?._meta?.kind === 'builtin';
75
+ }
76
+ /** Return only USER entries from .mcp.json (built-ins filtered out). */
77
+ function loadProjectUserMcp(root) {
78
+ const all = _readAll(root);
79
+ const out = {};
80
+ for (const [name, e] of Object.entries(all)) {
81
+ if (!_isBuiltin(e))
82
+ out[name] = e;
83
+ }
84
+ return out;
85
+ }
86
+ /** Read every entry from .mcp.json (user + builtin). */
87
+ function loadProjectAllMcp(root) {
88
+ return _readAll(root);
89
+ }
90
+ /** Write the full set of user entries (full replace), preserving any built-ins. */
91
+ function saveProjectUserMcp(root, userEntries) {
92
+ const all = _readAll(root);
93
+ for (const [name, e] of Object.entries(all)) {
94
+ if (!_isBuiltin(e))
95
+ delete all[name];
96
+ }
97
+ for (const [name, raw] of Object.entries(userEntries)) {
98
+ if (!raw || typeof raw.command !== 'string')
99
+ continue;
100
+ const meta = { ...(raw._meta || {}), managedBy: 'autoaidev', name, kind: 'user' };
101
+ all[name] = {
102
+ command: raw.command,
103
+ args: Array.isArray(raw.args) ? raw.args : [],
104
+ ...(raw.env && typeof raw.env === 'object' ? { env: raw.env } : {}),
105
+ alwaysLoad: true,
106
+ // Preserve disabled state so credentials survive unchecking in the sidebar.
107
+ ...(raw.enabled === false ? { enabled: false } : {}),
108
+ _meta: meta,
109
+ };
110
+ }
111
+ _writeAll(root, all);
112
+ }
113
+ /** Remove a single user entry by name. Built-ins are not touched. */
114
+ function removeProjectUserMcp(root, name) {
115
+ const all = _readAll(root);
116
+ const e = all[name];
117
+ if (!e || _isBuiltin(e))
118
+ return false;
119
+ delete all[name];
120
+ _writeAll(root, all);
121
+ return true;
122
+ }
123
+ /** Replace every built-in entry with the supplied set, leaving user entries alone. */
124
+ function replaceProjectBuiltinMcp(root, builtins) {
125
+ const all = _readAll(root);
126
+ for (const [name, e] of Object.entries(all)) {
127
+ if (_isBuiltin(e))
128
+ delete all[name];
129
+ }
130
+ for (const [name, raw] of Object.entries(builtins)) {
131
+ if (!raw || typeof raw.command !== 'string')
132
+ continue;
133
+ const meta = { ...(raw._meta || {}), managedBy: 'autoaidev', name, kind: 'builtin' };
134
+ all[name] = {
135
+ command: raw.command,
136
+ args: Array.isArray(raw.args) ? raw.args : [],
137
+ ...(raw.env && typeof raw.env === 'object' ? { env: raw.env } : {}),
138
+ alwaysLoad: true,
139
+ _meta: meta,
140
+ };
141
+ }
142
+ _writeAll(root, all);
143
+ }
144
+ //# sourceMappingURL=projectMcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectMcp.js","sourceRoot":"","sources":["../../src/core/projectMcp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,gDAOC;AAGD,8CAEC;AAGD,gDAmBC;AAGD,oDAOC;AAGD,4DAiBC;AA9HD,uCAAyB;AACzB,2CAA6B;AA8B7B,MAAM,QAAQ,GAAG,WAAW,CAAC;AAE7B,SAAS,KAAK,CAAC,IAAY,IAAY,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE1E,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAA4B,CAAC;QAC9E,MAAM,GAAG,GAAG,GAAG,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,UAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;QAChH,OAAO,GAAG,IAAI,EAAE,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QA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AI,EAAE,SAAkB,EAAE,CAAC;QAC9F,GAAG,CAAC,IAAI,CAAC,GAAG;YACV,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YAC7C,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnE,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,IAAI;SACZ,CAAC;IACJ,CAAC;IACD,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { ProviderId } from '../../providers';
2
+ import { IProvider, ProviderKind, Logger, DispatchRequest, DispatchOutcome, DispatchContext } from './contract';
3
+ export declare abstract class BaseProvider implements IProvider {
4
+ abstract readonly id: ProviderId;
5
+ abstract readonly label: string;
6
+ abstract readonly kind: ProviderKind;
7
+ /** Default: no session to resume. CLI providers that probe override this. */
8
+ resolveSession(_root: string, _log: Logger): Promise<string | undefined>;
9
+ abstract dispatch(req: DispatchRequest, ctx: DispatchContext): Promise<DispatchOutcome>;
10
+ /** Default: stateless, never "busy" between dispatches. */
11
+ isBusy(_root: string): boolean;
12
+ /** Default: nothing persistent to tear down. */
13
+ close(_root: string, _log: Logger): void;
14
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // ---------------------------------------------------------------------------
3
+ // Abstract base — provides the sane defaults shared by every provider so each
4
+ // concrete class only states what is genuinely different (Liskov + DRY). CLI
5
+ // providers inherit the no-op isBusy/close; only persistent sdk/tui providers
6
+ // override them.
7
+ // ---------------------------------------------------------------------------
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BaseProvider = void 0;
10
+ class BaseProvider {
11
+ /** Default: no session to resume. CLI providers that probe override this. */
12
+ async resolveSession(_root, _log) {
13
+ return undefined;
14
+ }
15
+ /** Default: stateless, never "busy" between dispatches. */
16
+ isBusy(_root) {
17
+ return false;
18
+ }
19
+ /** Default: nothing persistent to tear down. */
20
+ close(_root, _log) {
21
+ /* no-op */
22
+ }
23
+ }
24
+ exports.BaseProvider = BaseProvider;
25
+ //# sourceMappingURL=BaseProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseProvider.js","sourceRoot":"","sources":["../../../src/core/provider/BaseProvider.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;;;AAO9E,MAAsB,YAAY;IAKhC,6EAA6E;IAC7E,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,IAAY;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IAID,2DAA2D;IAC3D,MAAM,CAAC,KAAa;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gDAAgD;IAChD,KAAK,CAAC,KAAa,EAAE,IAAY;QAC/B,WAAW;IACb,CAAC;CACF;AArBD,oCAqBC"}
@@ -0,0 +1,12 @@
1
+ import { ProviderId } from '../../providers';
2
+ import { IProvider } from './contract';
3
+ export declare class ProviderRegistry {
4
+ private readonly _providers;
5
+ constructor(providers: IProvider[]);
6
+ /** Resolve a provider by id. Throws on an unknown id (fail loudly). */
7
+ get(id: ProviderId): IProvider;
8
+ has(id: ProviderId): boolean;
9
+ ids(): ProviderId[];
10
+ }
11
+ /** The default registry wired with every built-in provider. */
12
+ export declare const providerRegistry: ProviderRegistry;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // ---------------------------------------------------------------------------
3
+ // ProviderRegistry — single point that maps a ProviderId to its IProvider
4
+ // strategy (dependency inversion: callers depend on this + IProvider, never on
5
+ // a concrete provider). Adding a provider = add a class + one line here, with
6
+ // no change to the dispatcher (open/closed).
7
+ // ---------------------------------------------------------------------------
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.providerRegistry = exports.ProviderRegistry = void 0;
10
+ const implementations_1 = require("./implementations");
11
+ class ProviderRegistry {
12
+ _providers = new Map();
13
+ constructor(providers) {
14
+ for (const p of providers) {
15
+ this._providers.set(p.id, p);
16
+ }
17
+ }
18
+ /** Resolve a provider by id. Throws on an unknown id (fail loudly). */
19
+ get(id) {
20
+ const p = this._providers.get(id);
21
+ if (!p) {
22
+ throw new Error(`No provider registered for id "${id}"`);
23
+ }
24
+ return p;
25
+ }
26
+ has(id) { return this._providers.has(id); }
27
+ ids() { return [...this._providers.keys()]; }
28
+ }
29
+ exports.ProviderRegistry = ProviderRegistry;
30
+ /** The default registry wired with every built-in provider. */
31
+ exports.providerRegistry = new ProviderRegistry([
32
+ new implementations_1.ClaudeCliProvider(),
33
+ new implementations_1.CopilotCliProvider(),
34
+ new implementations_1.OpenCodeCliProvider(),
35
+ new implementations_1.ClaudeTuiProvider(),
36
+ new implementations_1.CopilotSdkProvider(),
37
+ new implementations_1.OpenCodeSdkProvider(),
38
+ new implementations_1.GrokTuiProvider(),
39
+ ]);
40
+ //# sourceMappingURL=ProviderRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderRegistry.js","sourceRoot":"","sources":["../../../src/core/provider/ProviderRegistry.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,0EAA0E;AAC1E,+EAA+E;AAC/E,8EAA8E;AAC9E,6CAA6C;AAC7C,8EAA8E;;;AAI9E,uDAG2B;AAE3B,MAAa,gBAAgB;IACV,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/D,YAAY,SAAsB;QAChC,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;YAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAAC,CAAC;IAC9D,CAAC;IAED,uEAAuE;IACvE,GAAG,CAAC,EAAc;QAChB,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,CAAC,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;QAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,GAAG,CAAC,EAAc,IAAa,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEhE,GAAG,KAAmB,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;CAC5D;AAjBD,4CAiBC;AAED,+DAA+D;AAClD,QAAA,gBAAgB,GAAG,IAAI,gBAAgB,CAAC;IACnD,IAAI,mCAAiB,EAAE;IACvB,IAAI,oCAAkB,EAAE;IACxB,IAAI,qCAAmB,EAAE;IACzB,IAAI,mCAAiB,EAAE;IACvB,IAAI,oCAAkB,EAAE;IACxB,IAAI,qCAAmB,EAAE;IACzB,IAAI,iCAAe,EAAE;CACtB,CAAC,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { ProviderId } from '../../providers';
2
+ import { AutodevSettings } from '../settingsLoader';
3
+ import { IProcessLauncher } from '../adapters';
4
+ export type ProviderKind = 'cli' | 'sdk' | 'tui';
5
+ export type Logger = (msg: string) => void;
6
+ /**
7
+ * DTO — everything a provider needs to dispatch ONE task. Immutable; built by
8
+ * the dispatcher's shared setup phase and handed to the resolved provider.
9
+ */
10
+ export interface DispatchRequest {
11
+ /** Absolute workspace root. */
12
+ readonly root: string;
13
+ /** Absolute path to `.autodev/AGENT_PROFILE.md`. */
14
+ readonly agentProfileFile: string;
15
+ /** Absolute path to the task MESSAGE file. */
16
+ readonly messageFile: string;
17
+ /** Absolute path to a profile+message combined file (built on demand). */
18
+ readonly combinedFile: string;
19
+ /** Session id to resume, or undefined for a fresh session. */
20
+ readonly resolvedSessionId?: string;
21
+ /** Whether to inject the agent profile into the prompt. */
22
+ readonly includeProfile: boolean;
23
+ /** Loaded workspace settings. */
24
+ readonly settings: AutodevSettings;
25
+ /** Per-message stdout sink. */
26
+ readonly stdoutFile: string;
27
+ /** Per-message exit-code sink. */
28
+ readonly exitFile: string;
29
+ }
30
+ /**
31
+ * DTO — the result of a dispatch. CLI providers return a shell `command` for
32
+ * the orchestrator to launch via the injected IProcessLauncher; in-process
33
+ * (sdk/tui) providers spawn directly and return `command: undefined`.
34
+ */
35
+ export interface DispatchOutcome {
36
+ readonly command?: string;
37
+ }
38
+ /** Collaborators passed to a provider at dispatch time (dependency injection). */
39
+ export interface DispatchContext {
40
+ readonly log: Logger;
41
+ readonly launcher: IProcessLauncher;
42
+ /** Reveal output UI (VS Code shell only); no-op headless. */
43
+ readonly showOutput?: () => void;
44
+ }
45
+ /**
46
+ * A pluggable AI backend. One instance per provider id, registered in the
47
+ * ProviderRegistry. Methods are intentionally minimal (interface segregation):
48
+ * CLI providers leave isBusy/close as the BaseProvider defaults.
49
+ */
50
+ export interface IProvider {
51
+ readonly id: ProviderId;
52
+ readonly label: string;
53
+ readonly kind: ProviderKind;
54
+ /** Resolve a session id to resume (probe/list), or undefined for fresh. */
55
+ resolveSession(root: string, log: Logger): Promise<string | undefined>;
56
+ /** Build a shell command (cli) or send in-process (sdk/tui) and return the outcome. */
57
+ dispatch(req: DispatchRequest, ctx: DispatchContext): Promise<DispatchOutcome>;
58
+ /** True while a persistent in-process turn is still running (sdk/tui only). */
59
+ isBusy(root: string): boolean;
60
+ /** Tear down any persistent server/session for this root (sdk/tui only). */
61
+ close(root: string, log: Logger): void;
62
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // ---------------------------------------------------------------------------
3
+ // Provider contract — DTOs + interfaces (SOLID: interface segregation +
4
+ // dependency inversion). The dispatcher depends on IProvider, never on a
5
+ // concrete provider, so adding a provider means adding a class + a registry
6
+ // entry (open/closed) with zero changes to the dispatch orchestration.
7
+ // ---------------------------------------------------------------------------
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/core/provider/contract.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,8EAA8E"}
@@ -0,0 +1,54 @@
1
+ import { ProviderId } from '../../providers';
2
+ import { BaseProvider } from './BaseProvider';
3
+ import { ProviderKind, Logger, DispatchRequest, DispatchOutcome, DispatchContext } from './contract';
4
+ export declare class ClaudeCliProvider extends BaseProvider {
5
+ readonly id: ProviderId;
6
+ readonly label = "Claude CLI";
7
+ readonly kind: ProviderKind;
8
+ resolveSession(root: string, log: Logger): Promise<string | undefined>;
9
+ dispatch(req: DispatchRequest): Promise<DispatchOutcome>;
10
+ }
11
+ export declare class CopilotCliProvider extends BaseProvider {
12
+ readonly id: ProviderId;
13
+ readonly label = "Copilot CLI";
14
+ readonly kind: ProviderKind;
15
+ resolveSession(root: string, log: Logger): Promise<string | undefined>;
16
+ dispatch(req: DispatchRequest): Promise<DispatchOutcome>;
17
+ }
18
+ export declare class OpenCodeCliProvider extends BaseProvider {
19
+ readonly id: ProviderId;
20
+ readonly label = "OpenCode CLI";
21
+ readonly kind: ProviderKind;
22
+ resolveSession(root: string, log: Logger): Promise<string | undefined>;
23
+ dispatch(req: DispatchRequest): Promise<DispatchOutcome>;
24
+ }
25
+ export declare class ClaudeTuiProvider extends BaseProvider {
26
+ readonly id: ProviderId;
27
+ readonly label = "Claude TUI";
28
+ readonly kind: ProviderKind;
29
+ dispatch(req: DispatchRequest, ctx: DispatchContext): Promise<DispatchOutcome>;
30
+ isBusy(root: string): boolean;
31
+ close(root: string, log: Logger): void;
32
+ }
33
+ export declare class CopilotSdkProvider extends BaseProvider {
34
+ readonly id: ProviderId;
35
+ readonly label = "Copilot SDK";
36
+ readonly kind: ProviderKind;
37
+ dispatch(req: DispatchRequest, ctx: DispatchContext): Promise<DispatchOutcome>;
38
+ isBusy(root: string): boolean;
39
+ close(root: string, log: Logger): void;
40
+ }
41
+ export declare class OpenCodeSdkProvider extends BaseProvider {
42
+ readonly id: ProviderId;
43
+ readonly label = "OpenCode SDK";
44
+ readonly kind: ProviderKind;
45
+ dispatch(req: DispatchRequest, ctx: DispatchContext): Promise<DispatchOutcome>;
46
+ isBusy(root: string): boolean;
47
+ close(root: string, log: Logger): void;
48
+ }
49
+ export declare class GrokTuiProvider extends BaseProvider {
50
+ readonly id: ProviderId;
51
+ readonly label = "Grok TUI";
52
+ readonly kind: ProviderKind;
53
+ dispatch(req: DispatchRequest, ctx: DispatchContext): Promise<DispatchOutcome>;
54
+ }