@hyperwindmill/caretaker-cli 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +25 -0
  3. package/dist/agents/dispatch.d.ts +35 -0
  4. package/dist/agents/dispatch.d.ts.map +1 -0
  5. package/dist/agents/dispatch.js +108 -0
  6. package/dist/agents/sync.d.ts +10 -0
  7. package/dist/agents/sync.d.ts.map +1 -0
  8. package/dist/agents/sync.js +95 -0
  9. package/dist/cli/index.d.ts +2 -0
  10. package/dist/cli/index.d.ts.map +1 -0
  11. package/dist/cli/index.js +50 -0
  12. package/dist/cli/run.d.ts +11 -0
  13. package/dist/cli/run.d.ts.map +1 -0
  14. package/dist/cli/run.js +89 -0
  15. package/dist/cli/web/fs.d.ts +3 -0
  16. package/dist/cli/web/fs.d.ts.map +1 -0
  17. package/dist/cli/web/fs.js +35 -0
  18. package/dist/cli/web/mcp_bridge.d.ts +7 -0
  19. package/dist/cli/web/mcp_bridge.d.ts.map +1 -0
  20. package/dist/cli/web/mcp_bridge.js +86 -0
  21. package/dist/cli/web/scheduler/heartbeat.d.ts +16 -0
  22. package/dist/cli/web/scheduler/heartbeat.d.ts.map +1 -0
  23. package/dist/cli/web/scheduler/heartbeat.js +181 -0
  24. package/dist/cli/web/scheduler/locks.d.ts +8 -0
  25. package/dist/cli/web/scheduler/locks.d.ts.map +1 -0
  26. package/dist/cli/web/scheduler/locks.js +7 -0
  27. package/dist/cli/web/scheduler/logs.d.ts +21 -0
  28. package/dist/cli/web/scheduler/logs.d.ts.map +1 -0
  29. package/dist/cli/web/scheduler/logs.js +62 -0
  30. package/dist/cli/web/scheduler/strategy.d.ts +6 -0
  31. package/dist/cli/web/scheduler/strategy.d.ts.map +1 -0
  32. package/dist/cli/web/scheduler/strategy.js +1 -0
  33. package/dist/cli/web/scheduler/task_review.d.ts +18 -0
  34. package/dist/cli/web/scheduler/task_review.d.ts.map +1 -0
  35. package/dist/cli/web/scheduler/task_review.js +77 -0
  36. package/dist/cli/web/scheduler/task_roles.d.ts +22 -0
  37. package/dist/cli/web/scheduler/task_roles.d.ts.map +1 -0
  38. package/dist/cli/web/scheduler/task_roles.js +70 -0
  39. package/dist/cli/web/scheduler/task_strategy.d.ts +2 -0
  40. package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -0
  41. package/dist/cli/web/scheduler/task_strategy.js +437 -0
  42. package/dist/cli/web/scheduler/telegram.d.ts +7 -0
  43. package/dist/cli/web/scheduler/telegram.d.ts.map +1 -0
  44. package/dist/cli/web/scheduler/telegram.js +393 -0
  45. package/dist/cli/web/scheduler.d.ts +15 -0
  46. package/dist/cli/web/scheduler.d.ts.map +1 -0
  47. package/dist/cli/web/scheduler.js +60 -0
  48. package/dist/cli/web/server.d.ts +38 -0
  49. package/dist/cli/web/server.d.ts.map +1 -0
  50. package/dist/cli/web/server.js +970 -0
  51. package/dist/commands/loader.d.ts +37 -0
  52. package/dist/commands/loader.d.ts.map +1 -0
  53. package/dist/commands/loader.js +110 -0
  54. package/dist/harness/claude_code_runner.d.ts +47 -0
  55. package/dist/harness/claude_code_runner.d.ts.map +1 -0
  56. package/dist/harness/claude_code_runner.js +325 -0
  57. package/dist/harness/claude_code_stream.d.ts +32 -0
  58. package/dist/harness/claude_code_stream.d.ts.map +1 -0
  59. package/dist/harness/claude_code_stream.js +121 -0
  60. package/dist/harness/context_files.d.ts +23 -0
  61. package/dist/harness/context_files.d.ts.map +1 -0
  62. package/dist/harness/context_files.js +126 -0
  63. package/dist/harness/history.d.ts +4 -0
  64. package/dist/harness/history.d.ts.map +1 -0
  65. package/dist/harness/history.js +120 -0
  66. package/dist/harness/index.d.ts +8 -0
  67. package/dist/harness/index.d.ts.map +1 -0
  68. package/dist/harness/index.js +8 -0
  69. package/dist/harness/loop.d.ts +73 -0
  70. package/dist/harness/loop.d.ts.map +1 -0
  71. package/dist/harness/loop.js +373 -0
  72. package/dist/harness/model_limits.d.ts +25 -0
  73. package/dist/harness/model_limits.d.ts.map +1 -0
  74. package/dist/harness/model_limits.js +67 -0
  75. package/dist/harness/models.d.ts +9 -0
  76. package/dist/harness/models.d.ts.map +1 -0
  77. package/dist/harness/models.js +38 -0
  78. package/dist/harness/prelude.d.ts +21 -0
  79. package/dist/harness/prelude.d.ts.map +1 -0
  80. package/dist/harness/prelude.js +41 -0
  81. package/dist/harness/provider.d.ts +87 -0
  82. package/dist/harness/provider.d.ts.map +1 -0
  83. package/dist/harness/provider.js +140 -0
  84. package/dist/harness/runtime_info.d.ts +7 -0
  85. package/dist/harness/runtime_info.d.ts.map +1 -0
  86. package/dist/harness/runtime_info.js +15 -0
  87. package/dist/harness/think_tag_splitter.d.ts +33 -0
  88. package/dist/harness/think_tag_splitter.d.ts.map +1 -0
  89. package/dist/harness/think_tag_splitter.js +70 -0
  90. package/dist/harness/title.d.ts +17 -0
  91. package/dist/harness/title.d.ts.map +1 -0
  92. package/dist/harness/title.js +75 -0
  93. package/dist/harness/tools/builtin/bash.d.ts +3 -0
  94. package/dist/harness/tools/builtin/bash.d.ts.map +1 -0
  95. package/dist/harness/tools/builtin/bash.js +137 -0
  96. package/dist/harness/tools/builtin/edit.d.ts +6 -0
  97. package/dist/harness/tools/builtin/edit.d.ts.map +1 -0
  98. package/dist/harness/tools/builtin/edit.js +85 -0
  99. package/dist/harness/tools/builtin/fetch.d.ts +3 -0
  100. package/dist/harness/tools/builtin/fetch.d.ts.map +1 -0
  101. package/dist/harness/tools/builtin/fetch.js +75 -0
  102. package/dist/harness/tools/builtin/get_agent_context.d.ts +3 -0
  103. package/dist/harness/tools/builtin/get_agent_context.d.ts.map +1 -0
  104. package/dist/harness/tools/builtin/get_agent_context.js +76 -0
  105. package/dist/harness/tools/builtin/glob.d.ts +3 -0
  106. package/dist/harness/tools/builtin/glob.d.ts.map +1 -0
  107. package/dist/harness/tools/builtin/glob.js +52 -0
  108. package/dist/harness/tools/builtin/grep.d.ts +3 -0
  109. package/dist/harness/tools/builtin/grep.d.ts.map +1 -0
  110. package/dist/harness/tools/builtin/grep.js +126 -0
  111. package/dist/harness/tools/builtin/index.d.ts +23 -0
  112. package/dist/harness/tools/builtin/index.d.ts.map +1 -0
  113. package/dist/harness/tools/builtin/index.js +74 -0
  114. package/dist/harness/tools/builtin/invoke_agent.d.ts +3 -0
  115. package/dist/harness/tools/builtin/invoke_agent.d.ts.map +1 -0
  116. package/dist/harness/tools/builtin/invoke_agent.js +106 -0
  117. package/dist/harness/tools/builtin/invoke_command.d.ts +3 -0
  118. package/dist/harness/tools/builtin/invoke_command.d.ts.map +1 -0
  119. package/dist/harness/tools/builtin/invoke_command.js +42 -0
  120. package/dist/harness/tools/builtin/list_agents.d.ts +3 -0
  121. package/dist/harness/tools/builtin/list_agents.d.ts.map +1 -0
  122. package/dist/harness/tools/builtin/list_agents.js +32 -0
  123. package/dist/harness/tools/builtin/list_commands.d.ts +3 -0
  124. package/dist/harness/tools/builtin/list_commands.d.ts.map +1 -0
  125. package/dist/harness/tools/builtin/list_commands.js +27 -0
  126. package/dist/harness/tools/builtin/list_skills.d.ts +3 -0
  127. package/dist/harness/tools/builtin/list_skills.d.ts.map +1 -0
  128. package/dist/harness/tools/builtin/list_skills.js +24 -0
  129. package/dist/harness/tools/builtin/multiedit.d.ts +3 -0
  130. package/dist/harness/tools/builtin/multiedit.d.ts.map +1 -0
  131. package/dist/harness/tools/builtin/multiedit.js +88 -0
  132. package/dist/harness/tools/builtin/read_attachment.d.ts +3 -0
  133. package/dist/harness/tools/builtin/read_attachment.d.ts.map +1 -0
  134. package/dist/harness/tools/builtin/read_attachment.js +128 -0
  135. package/dist/harness/tools/builtin/read_document.d.ts +37 -0
  136. package/dist/harness/tools/builtin/read_document.d.ts.map +1 -0
  137. package/dist/harness/tools/builtin/read_document.js +238 -0
  138. package/dist/harness/tools/builtin/read_file.d.ts +3 -0
  139. package/dist/harness/tools/builtin/read_file.d.ts.map +1 -0
  140. package/dist/harness/tools/builtin/read_file.js +141 -0
  141. package/dist/harness/tools/builtin/read_image.d.ts +3 -0
  142. package/dist/harness/tools/builtin/read_image.d.ts.map +1 -0
  143. package/dist/harness/tools/builtin/read_image.js +80 -0
  144. package/dist/harness/tools/builtin/read_skill.d.ts +3 -0
  145. package/dist/harness/tools/builtin/read_skill.d.ts.map +1 -0
  146. package/dist/harness/tools/builtin/read_skill.js +30 -0
  147. package/dist/harness/tools/builtin/shell-env.d.ts +55 -0
  148. package/dist/harness/tools/builtin/shell-env.d.ts.map +1 -0
  149. package/dist/harness/tools/builtin/shell-env.js +181 -0
  150. package/dist/harness/tools/builtin/task_tools.d.ts +21 -0
  151. package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -0
  152. package/dist/harness/tools/builtin/task_tools.js +708 -0
  153. package/dist/harness/tools/builtin/write.d.ts +3 -0
  154. package/dist/harness/tools/builtin/write.d.ts.map +1 -0
  155. package/dist/harness/tools/builtin/write.js +56 -0
  156. package/dist/harness/tools/index.d.ts +6 -0
  157. package/dist/harness/tools/index.d.ts.map +1 -0
  158. package/dist/harness/tools/index.js +7 -0
  159. package/dist/harness/tools/instance.d.ts +3 -0
  160. package/dist/harness/tools/instance.d.ts.map +1 -0
  161. package/dist/harness/tools/instance.js +19 -0
  162. package/dist/harness/tools/registry.d.ts +21 -0
  163. package/dist/harness/tools/registry.d.ts.map +1 -0
  164. package/dist/harness/tools/registry.js +33 -0
  165. package/dist/harness/tools/resolve.d.ts +5 -0
  166. package/dist/harness/tools/resolve.d.ts.map +1 -0
  167. package/dist/harness/tools/resolve.js +60 -0
  168. package/dist/harness/tools/sandbox.d.ts +6 -0
  169. package/dist/harness/tools/sandbox.d.ts.map +1 -0
  170. package/dist/harness/tools/sandbox.js +23 -0
  171. package/dist/harness/tools/types.d.ts +80 -0
  172. package/dist/harness/tools/types.d.ts.map +1 -0
  173. package/dist/harness/tools/types.js +16 -0
  174. package/dist/index.d.ts +3 -0
  175. package/dist/index.d.ts.map +1 -0
  176. package/dist/index.js +46 -0
  177. package/dist/lib/encryption.d.ts +24 -0
  178. package/dist/lib/encryption.d.ts.map +1 -0
  179. package/dist/lib/encryption.js +163 -0
  180. package/dist/lib/open_url.d.ts +9 -0
  181. package/dist/lib/open_url.d.ts.map +1 -0
  182. package/dist/lib/open_url.js +23 -0
  183. package/dist/lib/task_git.d.ts +11 -0
  184. package/dist/lib/task_git.d.ts.map +1 -0
  185. package/dist/lib/task_git.js +100 -0
  186. package/dist/mcp/adapter.d.ts +9 -0
  187. package/dist/mcp/adapter.d.ts.map +1 -0
  188. package/dist/mcp/adapter.js +74 -0
  189. package/dist/mcp/client.d.ts +50 -0
  190. package/dist/mcp/client.d.ts.map +1 -0
  191. package/dist/mcp/client.js +243 -0
  192. package/dist/mcp/oauth.d.ts +30 -0
  193. package/dist/mcp/oauth.d.ts.map +1 -0
  194. package/dist/mcp/oauth.js +171 -0
  195. package/dist/mcp/oauth_callback.d.ts +9 -0
  196. package/dist/mcp/oauth_callback.d.ts.map +1 -0
  197. package/dist/mcp/oauth_callback.js +51 -0
  198. package/dist/mcp/oauth_store.d.ts +22 -0
  199. package/dist/mcp/oauth_store.d.ts.map +1 -0
  200. package/dist/mcp/oauth_store.js +40 -0
  201. package/dist/mcp/server_manager.d.ts +49 -0
  202. package/dist/mcp/server_manager.d.ts.map +1 -0
  203. package/dist/mcp/server_manager.js +271 -0
  204. package/dist/plugins/fetchers/git.d.ts +67 -0
  205. package/dist/plugins/fetchers/git.d.ts.map +1 -0
  206. package/dist/plugins/fetchers/git.js +130 -0
  207. package/dist/plugins/fetchers/path.d.ts +4 -0
  208. package/dist/plugins/fetchers/path.d.ts.map +1 -0
  209. package/dist/plugins/fetchers/path.js +22 -0
  210. package/dist/plugins/loader.d.ts +31 -0
  211. package/dist/plugins/loader.d.ts.map +1 -0
  212. package/dist/plugins/loader.js +146 -0
  213. package/dist/plugins/manifest.d.ts +56 -0
  214. package/dist/plugins/manifest.d.ts.map +1 -0
  215. package/dist/plugins/manifest.js +389 -0
  216. package/dist/plugins/refresh_on_start.d.ts +7 -0
  217. package/dist/plugins/refresh_on_start.d.ts.map +1 -0
  218. package/dist/plugins/refresh_on_start.js +35 -0
  219. package/dist/plugins/source_manager.d.ts +27 -0
  220. package/dist/plugins/source_manager.d.ts.map +1 -0
  221. package/dist/plugins/source_manager.js +211 -0
  222. package/dist/plugins/types.d.ts +41 -0
  223. package/dist/plugins/types.d.ts.map +1 -0
  224. package/dist/plugins/types.js +11 -0
  225. package/dist/session/context_usage.d.ts +13 -0
  226. package/dist/session/context_usage.d.ts.map +1 -0
  227. package/dist/session/context_usage.js +25 -0
  228. package/dist/session/index.d.ts +7 -0
  229. package/dist/session/index.d.ts.map +1 -0
  230. package/dist/session/index.js +5 -0
  231. package/dist/session/store.d.ts +68 -0
  232. package/dist/session/store.d.ts.map +1 -0
  233. package/dist/session/store.js +268 -0
  234. package/dist/session/types.d.ts +60 -0
  235. package/dist/session/types.d.ts.map +1 -0
  236. package/dist/session/types.js +11 -0
  237. package/dist/store/db.d.ts +64 -0
  238. package/dist/store/db.d.ts.map +1 -0
  239. package/dist/store/db.js +91 -0
  240. package/dist/store/json.d.ts +21 -0
  241. package/dist/store/json.d.ts.map +1 -0
  242. package/dist/store/json.js +135 -0
  243. package/dist/tui/agents.d.ts +4 -0
  244. package/dist/tui/agents.d.ts.map +1 -0
  245. package/dist/tui/agents.js +616 -0
  246. package/dist/tui/app.d.ts +2 -0
  247. package/dist/tui/app.d.ts.map +1 -0
  248. package/dist/tui/app.js +32 -0
  249. package/dist/tui/chat.d.ts +10 -0
  250. package/dist/tui/chat.d.ts.map +1 -0
  251. package/dist/tui/chat.js +258 -0
  252. package/dist/tui/logo.d.ts +2 -0
  253. package/dist/tui/logo.d.ts.map +1 -0
  254. package/dist/tui/logo.js +10 -0
  255. package/dist/tui/mcp_servers.d.ts +4 -0
  256. package/dist/tui/mcp_servers.d.ts.map +1 -0
  257. package/dist/tui/mcp_servers.js +287 -0
  258. package/dist/tui/plugins.d.ts +4 -0
  259. package/dist/tui/plugins.d.ts.map +1 -0
  260. package/dist/tui/plugins.js +234 -0
  261. package/dist/tui/providers.d.ts +4 -0
  262. package/dist/tui/providers.d.ts.map +1 -0
  263. package/dist/tui/providers.js +178 -0
  264. package/dist/tui/tool_picker_state.d.ts +9 -0
  265. package/dist/tui/tool_picker_state.d.ts.map +1 -0
  266. package/dist/tui/tool_picker_state.js +37 -0
  267. package/dist/types.d.ts +2 -0
  268. package/dist/types.d.ts.map +1 -0
  269. package/dist/types.js +1 -0
  270. package/dist/webview/index.html +22 -0
  271. package/dist/webview/standalone.css +2732 -0
  272. package/dist/webview/standalone.css.map +7 -0
  273. package/dist/webview/standalone.js +20641 -0
  274. package/dist/webview/standalone.js.map +7 -0
  275. package/package.json +120 -0
@@ -0,0 +1,23 @@
1
+ import { spawn } from 'node:child_process';
2
+ // ponytail: 3 OS branches, that's the whole feature.
3
+ export function openCommandFor(platform, url) {
4
+ if (platform === 'darwin')
5
+ return { cmd: 'open', args: [url] };
6
+ if (platform === 'win32')
7
+ return { cmd: 'cmd', args: ['/c', 'start', '', url] };
8
+ return { cmd: 'xdg-open', args: [url] };
9
+ }
10
+ /** Open a URL in the user's default browser. Fire-and-forget: a missing
11
+ * opener must not crash the flow — the URL is still surfaced to the user by
12
+ * the caller. */
13
+ export function openUrl(url) {
14
+ const { cmd, args } = openCommandFor(process.platform, url);
15
+ try {
16
+ const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
17
+ child.on('error', () => { });
18
+ child.unref();
19
+ }
20
+ catch {
21
+ // ignore
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ export declare function isGitRepo(dir: string): Promise<boolean>;
2
+ export declare function agentDirIn(worktreePath: string, projectWorkingDir: string): Promise<string>;
3
+ export declare function ensureWorktree(projectWorkingDir: string, projectId: number, taskId: number, title: string): Promise<{
4
+ branch: string;
5
+ worktreePath: string;
6
+ agentWorkingDir: string;
7
+ }>;
8
+ export declare function commitWip(worktreePath: string, title: string): Promise<boolean>;
9
+ export declare function finalizeDone(worktreePath: string): Promise<void>;
10
+ export declare function discardWorktree(worktreePath: string, title: string): Promise<void>;
11
+ //# sourceMappingURL=task_git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task_git.d.ts","sourceRoot":"","sources":["../../src/lib/task_git.ts"],"names":[],"mappings":"AAaA,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM7D;AAgBD,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjG;AAED,wBAAsB,cAAc,CAClC,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CAe5E;AAcD,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrF;AAED,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBtE;AAED,wBAAsB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxF"}
@@ -0,0 +1,100 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ import { rm } from 'node:fs/promises';
4
+ import { join, relative, dirname } from 'node:path';
5
+ import { dataDir } from '../store/db.js';
6
+ const exec = promisify(execFile);
7
+ async function git(cwd, args) {
8
+ const { stdout } = await exec('git', args, { cwd, maxBuffer: 32 * 1024 * 1024 });
9
+ return stdout.trim();
10
+ }
11
+ export async function isGitRepo(dir) {
12
+ try {
13
+ return (await git(dir, ['rev-parse', '--is-inside-work-tree'])) === 'true';
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
19
+ function slug(title) {
20
+ return (title
21
+ .toLowerCase()
22
+ .replace(/[^a-z0-9]+/g, '-')
23
+ .replace(/^-+|-+$/g, '')
24
+ .slice(0, 40) || 'task');
25
+ }
26
+ function worktreePathFor(projectId, taskId) {
27
+ return join(dataDir(), 'worktrees', `${projectId}-${taskId}`);
28
+ }
29
+ export async function agentDirIn(worktreePath, projectWorkingDir) {
30
+ // Preserve a sub-directory working dir when the project points below the repo root.
31
+ const repoRoot = await git(projectWorkingDir, ['rev-parse', '--show-toplevel']);
32
+ const rel = relative(repoRoot, projectWorkingDir);
33
+ return rel ? join(worktreePath, rel) : worktreePath;
34
+ }
35
+ export async function ensureWorktree(projectWorkingDir, projectId, taskId, title) {
36
+ const repoRoot = await git(projectWorkingDir, ['rev-parse', '--show-toplevel']);
37
+ const branch = `caretaker/task-${taskId}-${slug(title)}`;
38
+ const worktreePath = worktreePathFor(projectId, taskId);
39
+ try {
40
+ await git(repoRoot, ['worktree', 'add', '-b', branch, worktreePath, 'HEAD']);
41
+ }
42
+ catch {
43
+ // Branch may already exist from a previous run whose path field was lost — reuse it.
44
+ await git(repoRoot, ['worktree', 'add', worktreePath, branch]);
45
+ }
46
+ const rel = relative(repoRoot, projectWorkingDir);
47
+ const agentWorkingDir = rel ? join(worktreePath, rel) : worktreePath;
48
+ return { branch, worktreePath, agentWorkingDir };
49
+ }
50
+ async function hasGitIdentity(cwd) {
51
+ try {
52
+ const [name, email] = await Promise.all([
53
+ git(cwd, ['config', 'user.name']),
54
+ git(cwd, ['config', 'user.email']),
55
+ ]);
56
+ return name.length > 0 && email.length > 0;
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ }
62
+ export async function commitWip(worktreePath, title) {
63
+ const status = await git(worktreePath, ['status', '--porcelain']);
64
+ if (!status)
65
+ return false;
66
+ await git(worktreePath, ['add', '-A']);
67
+ // --no-verify: these are machine-made WIP commits; the repo's pre-commit hooks
68
+ // (husky, lint-staged) belong on the user's real commit/merge after review, not here.
69
+ // Inject a fallback identity ONLY when the repo has none configured — never override the user's.
70
+ const idArgs = (await hasGitIdentity(worktreePath))
71
+ ? []
72
+ : ['-c', 'user.name=Caretaker', '-c', 'user.email=caretaker@localhost'];
73
+ // "chore(auto):" instead of "wip:" — wip is not a conventional-commits type,
74
+ // so commitlint-style hooks and wip-detecting tools warn on it downstream.
75
+ await git(worktreePath, [...idArgs, 'commit', '--no-verify', '-m', `chore(auto): ${title}`]);
76
+ return true;
77
+ }
78
+ export async function finalizeDone(worktreePath) {
79
+ let mainRepo;
80
+ try {
81
+ const commonDir = await git(worktreePath, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
82
+ mainRepo = dirname(commonDir); // .../<repo>/.git -> .../<repo>
83
+ }
84
+ catch {
85
+ await rm(worktreePath, { recursive: true, force: true });
86
+ return;
87
+ }
88
+ try {
89
+ await git(mainRepo, ['worktree', 'remove', '--force', worktreePath]);
90
+ }
91
+ catch {
92
+ // Metadata inconsistent (e.g. dir already gone): force cleanup + prune.
93
+ await rm(worktreePath, { recursive: true, force: true });
94
+ await git(mainRepo, ['worktree', 'prune']).catch(() => { });
95
+ }
96
+ }
97
+ export async function discardWorktree(worktreePath, title) {
98
+ await commitWip(worktreePath, title);
99
+ await finalizeDone(worktreePath);
100
+ }
@@ -0,0 +1,9 @@
1
+ import type { Tool } from '../harness/tools/types.js';
2
+ /**
3
+ * Build the Tool[] exposed by a list of MCP server ids. Servers that are
4
+ * unknown, disabled, or unreachable contribute zero tools; the agent run
5
+ * continues with whatever connected. Order follows the input ids and the
6
+ * remote tools/list order.
7
+ */
8
+ export declare function mcpToolsForServers(serverIds: string[]): Promise<Tool[]>;
9
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/mcp/adapter.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAgDtD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CA0B7E"}
@@ -0,0 +1,74 @@
1
+ // Adapter: bridges MCP servers into the in-process Tool registry shape used
2
+ // by the harness loop. For each requested server id, connects via the pool,
3
+ // calls tools/list, and returns one Tool per remote tool with name
4
+ // `mcp__<id>__<toolName>`.
5
+ //
6
+ // Failure semantics: a server that cannot be connected to surfaces as zero
7
+ // tools plus a one-line warn — we don't want a single broken MCP server to
8
+ // abort the whole agent run. The error is already persisted on the server
9
+ // row by getClient().
10
+ import { getClient } from './client.js';
11
+ const NAME_PREFIX = 'mcp__';
12
+ function joinedToolName(serverId, toolName) {
13
+ return `${NAME_PREFIX}${serverId}__${toolName}`;
14
+ }
15
+ function buildTool(serverId, remote) {
16
+ return {
17
+ name: joinedToolName(serverId, remote.name),
18
+ description: remote.description ?? `MCP tool ${remote.name}`,
19
+ parameters: remote.inputSchema ?? {
20
+ type: 'object',
21
+ properties: {},
22
+ additionalProperties: true,
23
+ },
24
+ async execute(args, ctx) {
25
+ const client = await getClient(serverId);
26
+ const res = await client.callTool({ name: remote.name, arguments: (args ?? {}) }, undefined, { signal: ctx.signal });
27
+ const parts = [];
28
+ const content = (res.content ?? []);
29
+ for (const c of content) {
30
+ if (c.type === 'text' && typeof c.text === 'string')
31
+ parts.push(c.text);
32
+ // Non-text content (image/audio/resource) is dropped for now — the
33
+ // loop's ToolResult contract is text-only. A future iteration can
34
+ // surface attachments through ToolResult.attachments.
35
+ }
36
+ const text = parts.join('\n');
37
+ if (res.isError === true) {
38
+ return { content: text || 'Error: MCP tool reported a failure' };
39
+ }
40
+ return { content: text };
41
+ },
42
+ };
43
+ }
44
+ /**
45
+ * Build the Tool[] exposed by a list of MCP server ids. Servers that are
46
+ * unknown, disabled, or unreachable contribute zero tools; the agent run
47
+ * continues with whatever connected. Order follows the input ids and the
48
+ * remote tools/list order.
49
+ */
50
+ export async function mcpToolsForServers(serverIds) {
51
+ const out = [];
52
+ for (const id of serverIds) {
53
+ let client;
54
+ try {
55
+ client = await getClient(id);
56
+ }
57
+ catch (err) {
58
+ console.warn(`[mcp adapter] skipping server ${id}: ${err instanceof Error ? err.message : String(err)}`);
59
+ continue;
60
+ }
61
+ let listed;
62
+ try {
63
+ listed = await client.listTools();
64
+ }
65
+ catch (err) {
66
+ console.warn(`[mcp adapter] tools/list failed for ${id}: ${err instanceof Error ? err.message : String(err)}`);
67
+ continue;
68
+ }
69
+ for (const t of listed.tools ?? []) {
70
+ out.push(buildTool(id, t));
71
+ }
72
+ }
73
+ return out;
74
+ }
@@ -0,0 +1,50 @@
1
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
+ import type { McpServerConfig } from '../types.js';
3
+ interface PoolEntry {
4
+ client: Client;
5
+ close: () => Promise<void>;
6
+ }
7
+ type ConnectOverride = (server: McpServerConfig) => Promise<PoolEntry>;
8
+ export declare function __setConnectOverride(fn: ConnectOverride | undefined): void;
9
+ export type ResolvedServerRuntime = {
10
+ type: 'stdio';
11
+ command: string;
12
+ args?: string[];
13
+ env?: Record<string, string>;
14
+ } | {
15
+ type: 'http';
16
+ url: string;
17
+ headers?: Record<string, string>;
18
+ };
19
+ /**
20
+ * Resolve a configured server into the plaintext runtime shape an external
21
+ * consumer (Claude Code `--mcp-config`) needs: decrypted headers, `${VAR}`
22
+ * and `${CLAUDE_PLUGIN_ROOT}` expansion applied — the same pipeline
23
+ * `openClient()` uses to build a live transport. Returns `null` for disabled
24
+ * servers, malformed stdio/http rows (missing command/url), and OAuth
25
+ * servers without a current access token (Claude Code can't drive our OAuth
26
+ * refresh, so callers log and skip rather than connecting unauthenticated).
27
+ */
28
+ export declare function resolvedServerRuntime(server: McpServerConfig): Promise<ResolvedServerRuntime | null>;
29
+ /**
30
+ * Resolve a connected MCP Client for the given server id. Reuses a pooled
31
+ * connection when available; otherwise resolves the McpServerConfig from
32
+ * mcp.json and opens a fresh transport. Concurrent callers for the same id
33
+ * share the same in-flight connect promise.
34
+ *
35
+ * Throws when the server id is unknown, disabled, or the transport fails to
36
+ * open. The error message is recorded on the server row.
37
+ */
38
+ export declare function getClient(id: string): Promise<Client>;
39
+ /** Close one connection by id. No-op if not connected. */
40
+ export declare function closeClient(id: string): Promise<void>;
41
+ /** Close every pooled connection. Used by the boot exit handler. Errors are
42
+ * swallowed — we are tearing down regardless. */
43
+ export declare function closeAll(): Promise<void>;
44
+ /** Test hook: drop the pool without closing (the test owns the lifecycle). */
45
+ export declare function __resetPool(): void;
46
+ /** Test hook: expose the placeholder expander so tests can verify the
47
+ * exact substitution rules without spinning up a transport. */
48
+ export declare function __expandForTests(value: string, pluginRoot: string | null): string;
49
+ export {};
50
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AASD,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;AAEvE,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAE1E;AAsHD,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEpE;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAsCvC;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B3D;AAED,0DAA0D;AAC1D,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3D;AAED;kDACkD;AAClD,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAI9C;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;gEACgE;AAChE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,243 @@
1
+ // MCP client pool: lazy-connect, kept-alive, single-process singleton.
2
+ // Connections are keyed by server id. The first call to `getClient(id)`
3
+ // resolves the McpServerConfig from mcp.json, opens the configured transport,
4
+ // and caches the live Client instance. Subsequent calls hit the cache.
5
+ //
6
+ // Failure mode: a connect error is surfaced once to the caller and recorded
7
+ // on the server row (lastConnectError) so the TUI can display it. The cache
8
+ // does NOT memoize failures — the next call retries (e.g. after the server
9
+ // is restarted).
10
+ //
11
+ // Cleanup: closeAll() walks the cache and closes every live client, used by
12
+ // the boot script's exit handler.
13
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
14
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
15
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
16
+ import { decrypt, isEncrypted } from '../lib/encryption.js';
17
+ import { loadMcpServers, saveMcpServers, withMcpServersLock } from '../store/json.js';
18
+ import { pluginAbsoluteRoot } from '../plugins/loader.js';
19
+ import { buildAuthProvider } from './oauth.js';
20
+ import { readOAuthBlob } from './oauth_store.js';
21
+ const pool = new Map();
22
+ const inflight = new Map();
23
+ let connectOverride;
24
+ export function __setConnectOverride(fn) {
25
+ connectOverride = fn;
26
+ }
27
+ function decryptHeaders(headers) {
28
+ if (!headers)
29
+ return {};
30
+ const out = {};
31
+ for (const [k, v] of Object.entries(headers)) {
32
+ out[k] = isEncrypted(v) ? decrypt(v) : v;
33
+ }
34
+ return out;
35
+ }
36
+ /**
37
+ * Expand `${VAR}` placeholders in a single string. `${CLAUDE_PLUGIN_ROOT}`
38
+ * resolves to the owning plugin's absolute root (when known); other names
39
+ * resolve from `process.env`. Unknown placeholders are left literal so the
40
+ * spawned MCP server can detect and report them.
41
+ */
42
+ function expandPlaceholders(value, pluginRoot) {
43
+ return value.replace(/\$\{([A-Z_][A-Z0-9_]*)\}/gi, (match, name) => {
44
+ if (name === 'CLAUDE_PLUGIN_ROOT')
45
+ return pluginRoot ?? match;
46
+ const envValue = process.env[name];
47
+ return envValue !== undefined ? envValue : match;
48
+ });
49
+ }
50
+ function expandStrings(value, pluginRoot) {
51
+ return value === undefined ? undefined : expandPlaceholders(value, pluginRoot);
52
+ }
53
+ function expandArray(value, pluginRoot) {
54
+ return value?.map((s) => expandPlaceholders(s, pluginRoot));
55
+ }
56
+ function expandRecord(value, pluginRoot) {
57
+ if (!value)
58
+ return undefined;
59
+ const out = {};
60
+ for (const [k, v] of Object.entries(value))
61
+ out[k] = expandPlaceholders(v, pluginRoot);
62
+ return out;
63
+ }
64
+ async function recordConnectResult(id, error) {
65
+ // Best-effort persistence — the connect already succeeded or failed at the
66
+ // pool level, and a failed mcp.json write should not turn a working
67
+ // connection into a broken one.
68
+ try {
69
+ await withMcpServersLock(async () => {
70
+ const file = await loadMcpServers();
71
+ const srv = file.servers.find((s) => s.id === id);
72
+ if (!srv)
73
+ return;
74
+ srv.lastConnectedAt = new Date().toISOString();
75
+ srv.lastConnectError = error;
76
+ await saveMcpServers(file);
77
+ });
78
+ }
79
+ catch (err) {
80
+ console.error(`[mcp pool] failed to persist connect result for ${id}:`, err);
81
+ }
82
+ }
83
+ async function openClient(server) {
84
+ const client = new Client({ name: 'caretaker-cli', version: '1.0.0' }, { capabilities: {} });
85
+ // Resolve the plugin's absolute root once (only managed rows need it; user
86
+ // rows pass null and unknown placeholders stay literal).
87
+ const pluginRoot = server.pluginId ? await pluginAbsoluteRoot(server.pluginId) : null;
88
+ if (server.transport === 'stdio') {
89
+ if (!server.command) {
90
+ throw new Error(`MCP server "${server.name}" (stdio) is missing "command"`);
91
+ }
92
+ const transport = new StdioClientTransport({
93
+ command: expandPlaceholders(server.command, pluginRoot),
94
+ args: expandArray(server.args, pluginRoot) ?? [],
95
+ env: expandRecord(server.env, pluginRoot),
96
+ stderr: 'pipe',
97
+ });
98
+ await client.connect(transport);
99
+ return {
100
+ client,
101
+ close: async () => {
102
+ await client.close().catch(() => { });
103
+ },
104
+ };
105
+ }
106
+ if (server.transport === 'http') {
107
+ if (!server.url) {
108
+ throw new Error(`MCP server "${server.name}" (http) is missing "url"`);
109
+ }
110
+ const decrypted = decryptHeaders(server.headers);
111
+ const headers = expandRecord(decrypted, pluginRoot) ?? {};
112
+ const url = expandStrings(server.url, pluginRoot);
113
+ let hasTokens = false;
114
+ try {
115
+ hasTokens = readOAuthBlob(server).tokens != null;
116
+ }
117
+ catch {
118
+ // Treat decryption failure as no tokens
119
+ }
120
+ const transport = new StreamableHTTPClientTransport(new URL(url), {
121
+ authProvider: hasTokens ? buildAuthProvider(server) : undefined,
122
+ requestInit: { headers },
123
+ });
124
+ await client.connect(transport);
125
+ return {
126
+ client,
127
+ close: async () => {
128
+ await client.close().catch(() => { });
129
+ },
130
+ };
131
+ }
132
+ throw new Error(`Unknown MCP transport: ${server.transport}`);
133
+ }
134
+ /**
135
+ * Resolve a configured server into the plaintext runtime shape an external
136
+ * consumer (Claude Code `--mcp-config`) needs: decrypted headers, `${VAR}`
137
+ * and `${CLAUDE_PLUGIN_ROOT}` expansion applied — the same pipeline
138
+ * `openClient()` uses to build a live transport. Returns `null` for disabled
139
+ * servers, malformed stdio/http rows (missing command/url), and OAuth
140
+ * servers without a current access token (Claude Code can't drive our OAuth
141
+ * refresh, so callers log and skip rather than connecting unauthenticated).
142
+ */
143
+ export async function resolvedServerRuntime(server) {
144
+ if (!server.enabled)
145
+ return null;
146
+ const pluginRoot = server.pluginId ? await pluginAbsoluteRoot(server.pluginId) : null;
147
+ if (server.transport === 'stdio') {
148
+ if (!server.command)
149
+ return null;
150
+ return {
151
+ type: 'stdio',
152
+ command: expandPlaceholders(server.command, pluginRoot),
153
+ ...(server.args ? { args: expandArray(server.args, pluginRoot) } : {}),
154
+ ...(server.env ? { env: expandRecord(server.env, pluginRoot) } : {}),
155
+ };
156
+ }
157
+ if (server.transport === 'http') {
158
+ if (!server.url)
159
+ return null;
160
+ const headers = expandRecord(decryptHeaders(server.headers), pluginRoot) ?? {};
161
+ if (server.oauthState) {
162
+ let token;
163
+ try {
164
+ token = readOAuthBlob(server).tokens?.access_token;
165
+ }
166
+ catch {
167
+ // Treat decryption failure as no tokens.
168
+ }
169
+ if (!token)
170
+ return null;
171
+ headers['Authorization'] = `Bearer ${token}`;
172
+ }
173
+ return {
174
+ type: 'http',
175
+ url: expandStrings(server.url, pluginRoot),
176
+ ...(Object.keys(headers).length ? { headers } : {}),
177
+ };
178
+ }
179
+ return null;
180
+ }
181
+ /**
182
+ * Resolve a connected MCP Client for the given server id. Reuses a pooled
183
+ * connection when available; otherwise resolves the McpServerConfig from
184
+ * mcp.json and opens a fresh transport. Concurrent callers for the same id
185
+ * share the same in-flight connect promise.
186
+ *
187
+ * Throws when the server id is unknown, disabled, or the transport fails to
188
+ * open. The error message is recorded on the server row.
189
+ */
190
+ export async function getClient(id) {
191
+ const cached = pool.get(id);
192
+ if (cached)
193
+ return cached.client;
194
+ const existing = inflight.get(id);
195
+ if (existing)
196
+ return existing;
197
+ const promise = (async () => {
198
+ const file = await loadMcpServers();
199
+ const server = file.servers.find((s) => s.id === id);
200
+ if (!server)
201
+ throw new Error(`MCP server ${id} not found`);
202
+ if (!server.enabled)
203
+ throw new Error(`MCP server "${server.name}" is disabled`);
204
+ try {
205
+ const entry = await (connectOverride ?? openClient)(server);
206
+ pool.set(id, entry);
207
+ await recordConnectResult(id, null);
208
+ return entry.client;
209
+ }
210
+ catch (err) {
211
+ const msg = err instanceof Error ? err.message : String(err);
212
+ await recordConnectResult(id, msg);
213
+ throw err;
214
+ }
215
+ })().finally(() => inflight.delete(id));
216
+ inflight.set(id, promise);
217
+ return promise;
218
+ }
219
+ /** Close one connection by id. No-op if not connected. */
220
+ export async function closeClient(id) {
221
+ const entry = pool.get(id);
222
+ if (!entry)
223
+ return;
224
+ pool.delete(id);
225
+ await entry.close();
226
+ }
227
+ /** Close every pooled connection. Used by the boot exit handler. Errors are
228
+ * swallowed — we are tearing down regardless. */
229
+ export async function closeAll() {
230
+ const entries = [...pool.values()];
231
+ pool.clear();
232
+ await Promise.all(entries.map((e) => e.close().catch(() => { })));
233
+ }
234
+ /** Test hook: drop the pool without closing (the test owns the lifecycle). */
235
+ export function __resetPool() {
236
+ pool.clear();
237
+ inflight.clear();
238
+ }
239
+ /** Test hook: expose the placeholder expander so tests can verify the
240
+ * exact substitution rules without spinning up a transport. */
241
+ export function __expandForTests(value, pluginRoot) {
242
+ return expandPlaceholders(value, pluginRoot);
243
+ }
@@ -0,0 +1,30 @@
1
+ import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
2
+ import type { OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
3
+ export declare class StoredOAuthProvider implements OAuthClientProvider {
4
+ private readonly serverId;
5
+ private readonly _redirectUrl;
6
+ private readonly interactive;
7
+ private verifier?;
8
+ constructor(serverId: string, _redirectUrl: string, interactive?: boolean);
9
+ get redirectUrl(): string;
10
+ get clientMetadata(): OAuthClientMetadata;
11
+ private readBlob;
12
+ private mergeBlob;
13
+ clientInformation(): Promise<OAuthClientInformationFull | undefined>;
14
+ saveClientInformation(info: OAuthClientInformationFull): Promise<void>;
15
+ tokens(): Promise<OAuthTokens | undefined>;
16
+ saveTokens(tokens: OAuthTokens): Promise<void>;
17
+ saveCodeVerifier(codeVerifier: string): void;
18
+ codeVerifier(): string;
19
+ redirectToAuthorization(authorizationUrl: URL): void;
20
+ }
21
+ export declare function buildAuthProvider(server: {
22
+ id: string;
23
+ }): StoredOAuthProvider;
24
+ /** Interactive OAuth: open the browser, capture the code on a loopback
25
+ * listener, exchange it, and persist tokens. Explicit user action only —
26
+ * never called from the passive pool. */
27
+ export declare function authenticateMcpServer(id: string): Promise<void>;
28
+ /** Clear stored OAuth state (logout) and drop any pooled connection. */
29
+ export declare function revokeMcpAuth(id: string): Promise<void>;
30
+ //# sourceMappingURL=oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/mcp/oauth.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACZ,MAAM,0CAA0C,CAAC;AAIlD,qBAAa,mBAAoB,YAAW,mBAAmB;IAI3D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAL9B,OAAO,CAAC,QAAQ,CAAC,CAAS;gBAGP,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,WAAW,GAAE,OAAe;IAG/C,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,cAAc,IAAI,mBAAmB,CAQxC;YAEa,QAAQ;YAQR,SAAS;IAcjB,iBAAiB,IAAI,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;IAQpE,qBAAqB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAItE,MAAM,IAAI,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAQ1C,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAI5C,YAAY,IAAI,MAAM;IAKtB,uBAAuB,CAAC,gBAAgB,EAAE,GAAG,GAAG,IAAI;CAMrD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAI7E;AAED;;0CAE0C;AAC1C,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDrE;AAED,wEAAwE;AACxE,wBAAsB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS7D"}