@aigne/afs-cli 1.11.0-beta.6 → 1.11.0-beta.7

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 (317) hide show
  1. package/dist/cli.cjs +27 -353
  2. package/dist/cli.d.cts +2 -1
  3. package/dist/cli.d.mts +2 -1
  4. package/dist/cli.mjs +28 -353
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/config/afs-loader.cjs +123 -0
  7. package/dist/config/afs-loader.d.cts +14 -0
  8. package/dist/config/afs-loader.d.cts.map +1 -0
  9. package/dist/config/afs-loader.d.mts +14 -0
  10. package/dist/config/afs-loader.d.mts.map +1 -0
  11. package/dist/config/afs-loader.mjs +122 -0
  12. package/dist/config/afs-loader.mjs.map +1 -0
  13. package/dist/config/loader.cjs +2 -2
  14. package/dist/config/loader.mjs +2 -2
  15. package/dist/{commands/mount.cjs → config/mount-commands.cjs} +13 -49
  16. package/dist/config/mount-commands.d.cts +20 -0
  17. package/dist/config/mount-commands.d.cts.map +1 -0
  18. package/dist/config/mount-commands.d.mts +20 -0
  19. package/dist/config/mount-commands.d.mts.map +1 -0
  20. package/dist/{commands/mount.mjs → config/mount-commands.mjs} +14 -49
  21. package/dist/config/mount-commands.mjs.map +1 -0
  22. package/dist/config/schema.cjs +9 -1
  23. package/dist/config/schema.mjs +9 -1
  24. package/dist/config/schema.mjs.map +1 -1
  25. package/dist/core/commands/delete.cjs +41 -0
  26. package/dist/core/commands/delete.d.cts +18 -0
  27. package/dist/core/commands/delete.d.cts.map +1 -0
  28. package/dist/core/commands/delete.d.mts +18 -0
  29. package/dist/core/commands/delete.d.mts.map +1 -0
  30. package/dist/core/commands/delete.mjs +42 -0
  31. package/dist/core/commands/delete.mjs.map +1 -0
  32. package/dist/core/commands/exec.cjs +95 -0
  33. package/dist/core/commands/exec.d.cts +26 -0
  34. package/dist/core/commands/exec.d.cts.map +1 -0
  35. package/dist/core/commands/exec.d.mts +26 -0
  36. package/dist/core/commands/exec.d.mts.map +1 -0
  37. package/dist/core/commands/exec.mjs +96 -0
  38. package/dist/core/commands/exec.mjs.map +1 -0
  39. package/dist/core/commands/explain.cjs +254 -0
  40. package/dist/core/commands/explain.d.cts +25 -0
  41. package/dist/core/commands/explain.d.cts.map +1 -0
  42. package/dist/core/commands/explain.d.mts +25 -0
  43. package/dist/core/commands/explain.d.mts.map +1 -0
  44. package/dist/core/commands/explain.mjs +255 -0
  45. package/dist/core/commands/explain.mjs.map +1 -0
  46. package/dist/core/commands/explore.cjs +30 -0
  47. package/dist/core/commands/explore.d.mts +2 -0
  48. package/dist/core/commands/explore.mjs +31 -0
  49. package/dist/core/commands/explore.mjs.map +1 -0
  50. package/dist/core/commands/index.cjs +36 -0
  51. package/dist/core/commands/index.d.cts +21 -0
  52. package/dist/core/commands/index.d.cts.map +1 -0
  53. package/dist/core/commands/index.d.mts +24 -0
  54. package/dist/core/commands/index.d.mts.map +1 -0
  55. package/dist/core/commands/index.mjs +37 -0
  56. package/dist/core/commands/index.mjs.map +1 -0
  57. package/dist/core/commands/ls.cjs +57 -0
  58. package/dist/core/commands/ls.d.cts +21 -0
  59. package/dist/core/commands/ls.d.cts.map +1 -0
  60. package/dist/core/commands/ls.d.mts +21 -0
  61. package/dist/core/commands/ls.d.mts.map +1 -0
  62. package/dist/core/commands/ls.mjs +58 -0
  63. package/dist/core/commands/ls.mjs.map +1 -0
  64. package/dist/core/commands/mount.cjs +139 -0
  65. package/dist/core/commands/mount.d.cts +33 -0
  66. package/dist/core/commands/mount.d.cts.map +1 -0
  67. package/dist/core/commands/mount.d.mts +33 -0
  68. package/dist/core/commands/mount.d.mts.map +1 -0
  69. package/dist/core/commands/mount.mjs +140 -0
  70. package/dist/core/commands/mount.mjs.map +1 -0
  71. package/dist/core/commands/read.cjs +48 -0
  72. package/dist/core/commands/read.d.cts +17 -0
  73. package/dist/core/commands/read.d.cts.map +1 -0
  74. package/dist/core/commands/read.d.mts +17 -0
  75. package/dist/core/commands/read.d.mts.map +1 -0
  76. package/dist/core/commands/read.mjs +49 -0
  77. package/dist/core/commands/read.mjs.map +1 -0
  78. package/dist/core/commands/search.cjs +40 -0
  79. package/dist/core/commands/search.d.mts +2 -0
  80. package/dist/core/commands/search.mjs +41 -0
  81. package/dist/core/commands/search.mjs.map +1 -0
  82. package/dist/core/commands/serve.cjs +242 -0
  83. package/dist/core/commands/serve.d.mts +2 -0
  84. package/dist/core/commands/serve.mjs +242 -0
  85. package/dist/core/commands/serve.mjs.map +1 -0
  86. package/dist/core/commands/stat.cjs +53 -0
  87. package/dist/core/commands/stat.d.cts +17 -0
  88. package/dist/core/commands/stat.d.cts.map +1 -0
  89. package/dist/core/commands/stat.d.mts +17 -0
  90. package/dist/core/commands/stat.d.mts.map +1 -0
  91. package/dist/core/commands/stat.mjs +54 -0
  92. package/dist/core/commands/stat.mjs.map +1 -0
  93. package/dist/core/commands/types.cjs +13 -0
  94. package/dist/core/commands/types.d.cts +54 -0
  95. package/dist/core/commands/types.d.cts.map +1 -0
  96. package/dist/core/commands/types.d.mts +54 -0
  97. package/dist/core/commands/types.d.mts.map +1 -0
  98. package/dist/core/commands/types.mjs +14 -0
  99. package/dist/core/commands/types.mjs.map +1 -0
  100. package/dist/core/commands/write.cjs +70 -0
  101. package/dist/core/commands/write.d.cts +20 -0
  102. package/dist/core/commands/write.d.cts.map +1 -0
  103. package/dist/core/commands/write.d.mts +20 -0
  104. package/dist/core/commands/write.d.mts.map +1 -0
  105. package/dist/core/commands/write.mjs +71 -0
  106. package/dist/core/commands/write.mjs.map +1 -0
  107. package/dist/core/executor/index.cjs +196 -0
  108. package/dist/core/executor/index.d.cts +77 -0
  109. package/dist/core/executor/index.d.cts.map +1 -0
  110. package/dist/core/executor/index.d.mts +77 -0
  111. package/dist/core/executor/index.d.mts.map +1 -0
  112. package/dist/core/executor/index.mjs +195 -0
  113. package/dist/core/executor/index.mjs.map +1 -0
  114. package/dist/core/formatters/delete.cjs +37 -0
  115. package/dist/core/formatters/delete.d.cts +18 -0
  116. package/dist/core/formatters/delete.d.cts.map +1 -0
  117. package/dist/core/formatters/delete.d.mts +18 -0
  118. package/dist/core/formatters/delete.d.mts.map +1 -0
  119. package/dist/core/formatters/delete.mjs +37 -0
  120. package/dist/core/formatters/delete.mjs.map +1 -0
  121. package/dist/core/formatters/exec.cjs +60 -0
  122. package/dist/core/formatters/exec.d.cts +18 -0
  123. package/dist/core/formatters/exec.d.cts.map +1 -0
  124. package/dist/core/formatters/exec.d.mts +18 -0
  125. package/dist/core/formatters/exec.d.mts.map +1 -0
  126. package/dist/core/formatters/exec.mjs +60 -0
  127. package/dist/core/formatters/exec.mjs.map +1 -0
  128. package/dist/core/formatters/explain.cjs +97 -0
  129. package/dist/core/formatters/explain.d.cts +11 -0
  130. package/dist/core/formatters/explain.d.cts.map +1 -0
  131. package/dist/core/formatters/explain.d.mts +11 -0
  132. package/dist/core/formatters/explain.d.mts.map +1 -0
  133. package/dist/core/formatters/explain.mjs +96 -0
  134. package/dist/core/formatters/explain.mjs.map +1 -0
  135. package/dist/core/formatters/index.d.mts +9 -0
  136. package/dist/core/formatters/ls.cjs +179 -0
  137. package/dist/core/formatters/ls.d.cts +20 -0
  138. package/dist/core/formatters/ls.d.cts.map +1 -0
  139. package/dist/core/formatters/ls.d.mts +20 -0
  140. package/dist/core/formatters/ls.d.mts.map +1 -0
  141. package/dist/core/formatters/ls.mjs +179 -0
  142. package/dist/core/formatters/ls.mjs.map +1 -0
  143. package/dist/core/formatters/mount.cjs +55 -0
  144. package/dist/core/formatters/mount.d.cts +15 -0
  145. package/dist/core/formatters/mount.d.cts.map +1 -0
  146. package/dist/core/formatters/mount.d.mts +15 -0
  147. package/dist/core/formatters/mount.d.mts.map +1 -0
  148. package/dist/core/formatters/mount.mjs +55 -0
  149. package/dist/core/formatters/mount.mjs.map +1 -0
  150. package/dist/core/formatters/read.cjs +100 -0
  151. package/dist/core/formatters/read.d.cts +22 -0
  152. package/dist/core/formatters/read.d.cts.map +1 -0
  153. package/dist/core/formatters/read.d.mts +22 -0
  154. package/dist/core/formatters/read.d.mts.map +1 -0
  155. package/dist/core/formatters/read.mjs +100 -0
  156. package/dist/core/formatters/read.mjs.map +1 -0
  157. package/dist/core/formatters/search.cjs +44 -0
  158. package/dist/core/formatters/search.d.mts +1 -0
  159. package/dist/core/formatters/search.mjs +44 -0
  160. package/dist/core/formatters/search.mjs.map +1 -0
  161. package/dist/core/formatters/stat.cjs +155 -0
  162. package/dist/core/formatters/stat.d.cts +15 -0
  163. package/dist/core/formatters/stat.d.cts.map +1 -0
  164. package/dist/core/formatters/stat.d.mts +15 -0
  165. package/dist/core/formatters/stat.d.mts.map +1 -0
  166. package/dist/core/formatters/stat.mjs +155 -0
  167. package/dist/core/formatters/stat.mjs.map +1 -0
  168. package/dist/core/formatters/write.cjs +51 -0
  169. package/dist/core/formatters/write.d.cts +22 -0
  170. package/dist/core/formatters/write.d.cts.map +1 -0
  171. package/dist/core/formatters/write.d.mts +22 -0
  172. package/dist/core/formatters/write.d.mts.map +1 -0
  173. package/dist/core/formatters/write.mjs +51 -0
  174. package/dist/core/formatters/write.mjs.map +1 -0
  175. package/dist/core/helpers/exec-args.cjs +142 -0
  176. package/dist/core/helpers/exec-args.d.cts +46 -0
  177. package/dist/core/helpers/exec-args.d.cts.map +1 -0
  178. package/dist/core/helpers/exec-args.d.mts +46 -0
  179. package/dist/core/helpers/exec-args.d.mts.map +1 -0
  180. package/dist/core/helpers/exec-args.mjs +139 -0
  181. package/dist/core/helpers/exec-args.mjs.map +1 -0
  182. package/dist/core/helpers/stdin.cjs +41 -0
  183. package/dist/core/helpers/stdin.d.cts +15 -0
  184. package/dist/core/helpers/stdin.d.cts.map +1 -0
  185. package/dist/core/helpers/stdin.d.mts +15 -0
  186. package/dist/core/helpers/stdin.d.mts.map +1 -0
  187. package/dist/core/helpers/stdin.mjs +41 -0
  188. package/dist/core/helpers/stdin.mjs.map +1 -0
  189. package/dist/core/index.cjs +49 -0
  190. package/dist/core/index.d.cts +24 -0
  191. package/dist/core/index.d.mts +25 -0
  192. package/dist/core/index.mjs +24 -0
  193. package/dist/core/path-utils.cjs +1 -0
  194. package/dist/core/path-utils.mjs +3 -0
  195. package/dist/core/types.d.cts +24 -0
  196. package/dist/core/types.d.cts.map +1 -0
  197. package/dist/core/types.d.mts +24 -0
  198. package/dist/core/types.d.mts.map +1 -0
  199. package/dist/errors.cjs +0 -11
  200. package/dist/errors.mjs +1 -11
  201. package/dist/errors.mjs.map +1 -1
  202. package/dist/explorer/actions.cjs +67 -32
  203. package/dist/explorer/actions.mjs +66 -32
  204. package/dist/explorer/actions.mjs.map +1 -1
  205. package/dist/explorer/components/dialog.cjs +170 -46
  206. package/dist/explorer/components/dialog.mjs +170 -46
  207. package/dist/explorer/components/dialog.mjs.map +1 -1
  208. package/dist/explorer/components/metadata-panel.cjs +86 -3
  209. package/dist/explorer/components/metadata-panel.mjs +86 -3
  210. package/dist/explorer/components/metadata-panel.mjs.map +1 -1
  211. package/dist/explorer/screen.cjs +63 -27
  212. package/dist/explorer/screen.d.cts +23 -0
  213. package/dist/explorer/screen.d.cts.map +1 -0
  214. package/dist/explorer/screen.d.mts +23 -0
  215. package/dist/explorer/screen.d.mts.map +1 -0
  216. package/dist/explorer/screen.mjs +63 -27
  217. package/dist/explorer/screen.mjs.map +1 -1
  218. package/dist/explorer/theme.cjs +1 -1
  219. package/dist/explorer/theme.mjs +1 -1
  220. package/dist/explorer/theme.mjs.map +1 -1
  221. package/dist/index.cjs +7 -1
  222. package/dist/index.d.cts +4 -1
  223. package/dist/index.d.mts +4 -1
  224. package/dist/index.mjs +4 -1
  225. package/dist/mcp/http-transport.cjs +68 -0
  226. package/dist/mcp/http-transport.mjs +68 -0
  227. package/dist/mcp/http-transport.mjs.map +1 -0
  228. package/dist/mcp/prompts.cjs +48 -0
  229. package/dist/mcp/prompts.mjs +48 -0
  230. package/dist/mcp/prompts.mjs.map +1 -0
  231. package/dist/mcp/resources.cjs +25 -0
  232. package/dist/mcp/resources.mjs +25 -0
  233. package/dist/mcp/resources.mjs.map +1 -0
  234. package/dist/mcp/server.cjs +30 -0
  235. package/dist/mcp/server.mjs +30 -0
  236. package/dist/mcp/server.mjs.map +1 -0
  237. package/dist/mcp/tools.cjs +196 -0
  238. package/dist/mcp/tools.mjs +196 -0
  239. package/dist/mcp/tools.mjs.map +1 -0
  240. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts +10 -0
  241. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts.map +1 -0
  242. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts +10 -0
  243. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts.map +1 -0
  244. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts +46 -0
  245. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts.map +1 -0
  246. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts +46 -0
  247. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts.map +1 -0
  248. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +902 -0
  249. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs +902 -0
  250. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs.map +1 -0
  251. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs +6 -0
  252. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs +8 -0
  253. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs.map +1 -0
  254. package/dist/path-utils.d.cts +50 -0
  255. package/dist/path-utils.d.cts.map +1 -0
  256. package/dist/path-utils.d.mts +50 -0
  257. package/dist/path-utils.d.mts.map +1 -0
  258. package/dist/repl.cjs +485 -0
  259. package/dist/repl.d.cts +15 -0
  260. package/dist/repl.d.cts.map +1 -0
  261. package/dist/repl.d.mts +16 -0
  262. package/dist/repl.d.mts.map +1 -0
  263. package/dist/repl.mjs +485 -0
  264. package/dist/repl.mjs.map +1 -0
  265. package/dist/serve.cjs +146 -0
  266. package/dist/serve.d.cts +41 -0
  267. package/dist/serve.d.cts.map +1 -0
  268. package/dist/serve.d.mts +41 -0
  269. package/dist/serve.d.mts.map +1 -0
  270. package/dist/serve.mjs +146 -0
  271. package/dist/serve.mjs.map +1 -0
  272. package/dist/ui/header.cjs +1 -40
  273. package/dist/ui/header.mjs +1 -39
  274. package/dist/ui/header.mjs.map +1 -1
  275. package/dist/ui/index.cjs +2 -9
  276. package/dist/ui/index.mjs +2 -7
  277. package/dist/ui/index.mjs.map +1 -1
  278. package/dist/ui/terminal.cjs +1 -10
  279. package/dist/ui/terminal.mjs +1 -8
  280. package/dist/ui/terminal.mjs.map +1 -1
  281. package/package.json +29 -16
  282. package/dist/commands/exec.cjs +0 -164
  283. package/dist/commands/exec.mjs +0 -160
  284. package/dist/commands/exec.mjs.map +0 -1
  285. package/dist/commands/explain.cjs +0 -244
  286. package/dist/commands/explain.mjs +0 -242
  287. package/dist/commands/explain.mjs.map +0 -1
  288. package/dist/commands/index.cjs +0 -8
  289. package/dist/commands/index.mjs +0 -10
  290. package/dist/commands/ls.cjs +0 -242
  291. package/dist/commands/ls.mjs +0 -242
  292. package/dist/commands/ls.mjs.map +0 -1
  293. package/dist/commands/mount.mjs.map +0 -1
  294. package/dist/commands/read.cjs +0 -264
  295. package/dist/commands/read.mjs +0 -263
  296. package/dist/commands/read.mjs.map +0 -1
  297. package/dist/commands/serve.cjs +0 -144
  298. package/dist/commands/serve.mjs +0 -143
  299. package/dist/commands/serve.mjs.map +0 -1
  300. package/dist/commands/stat.cjs +0 -195
  301. package/dist/commands/stat.mjs +0 -195
  302. package/dist/commands/stat.mjs.map +0 -1
  303. package/dist/commands/write.cjs +0 -85
  304. package/dist/commands/write.mjs +0 -85
  305. package/dist/commands/write.mjs.map +0 -1
  306. package/dist/config/provider-factory.cjs +0 -400
  307. package/dist/config/provider-factory.mjs +0 -401
  308. package/dist/config/provider-factory.mjs.map +0 -1
  309. package/dist/config/uri-parser.cjs +0 -285
  310. package/dist/config/uri-parser.mjs +0 -285
  311. package/dist/config/uri-parser.mjs.map +0 -1
  312. package/dist/runtime.cjs +0 -120
  313. package/dist/runtime.mjs +0 -120
  314. package/dist/runtime.mjs.map +0 -1
  315. package/dist/utils/meta.cjs +0 -51
  316. package/dist/utils/meta.mjs +0 -49
  317. package/dist/utils/meta.mjs.map +0 -1
@@ -255,8 +255,9 @@ function createDialogManager(blessed, options) {
255
255
  const required = inputSchema?.required || [];
256
256
  const propNames = Object.keys(properties);
257
257
  if (propNames.length === 0) {
258
- close();
259
- onSubmit({});
258
+ this.showConfirm(`Execute action on ${path}?`, () => {
259
+ onSubmit({});
260
+ });
260
261
  return;
261
262
  }
262
263
  const dialogHeight = Math.min(propNames.length * 3 + 8, 25);
@@ -269,7 +270,7 @@ function createDialogManager(blessed, options) {
269
270
  right: 1,
270
271
  bottom: 3,
271
272
  keys: true,
272
- vi: true
273
+ vi: false
273
274
  });
274
275
  const inputs = [];
275
276
  let yPos = 0;
@@ -288,28 +289,23 @@ function createDialogManager(blessed, options) {
288
289
  style: { fg: require_theme.Colors.fg.normal }
289
290
  });
290
291
  yPos += 1;
291
- const input = blessed.textbox({
292
+ const inputBox = blessed.box({
292
293
  parent: form,
293
- name: propName,
294
294
  top: yPos,
295
295
  left: 0,
296
296
  width: "100%-2",
297
297
  height: 1,
298
- keys: true,
299
- mouse: true,
300
- inputOnFocus: false,
298
+ tags: true,
301
299
  style: {
302
300
  fg: require_theme.Colors.fg.normal,
303
- bg: require_theme.Colors.bg.input,
304
- focus: {
305
- fg: "white",
306
- bg: require_theme.Colors.bg.inputFocus
307
- }
301
+ bg: require_theme.Colors.bg.input
308
302
  }
309
303
  });
310
304
  inputs.push({
311
305
  name: propName,
312
- input
306
+ value: "",
307
+ cursor: 0,
308
+ box: inputBox
313
309
  });
314
310
  yPos += 2;
315
311
  }
@@ -318,57 +314,185 @@ function createDialogManager(blessed, options) {
318
314
  bottom: 1,
319
315
  left: 1,
320
316
  tags: true,
321
- content: "{gray-fg}Tab: next | Shift+Tab: prev | Enter: submit | Esc: cancel{/gray-fg}"
317
+ content: "{gray-fg}Tab: next | ←→: move cursor | Enter: submit | Esc: cancel{/gray-fg}"
322
318
  });
323
319
  let focusIndex = 0;
324
- const activateInput = (input) => {
325
- input.readInput(() => {});
320
+ const renderInput = (state, focused) => {
321
+ if (focused) {
322
+ const before = state.value.slice(0, state.cursor);
323
+ const cursorChar = state.value[state.cursor] || "█";
324
+ const after = state.value.slice(state.cursor + 1);
325
+ state.box.setContent(`${before}{white-bg}{black-fg}${cursorChar}{/black-fg}{/white-bg}${after}`);
326
+ state.box.style.bg = require_theme.Colors.bg.inputFocus;
327
+ } else {
328
+ state.box.setContent(state.value || "");
329
+ state.box.style.bg = require_theme.Colors.bg.input;
330
+ }
326
331
  };
327
332
  const focusInput = (index) => {
328
- const currentItem = inputs[focusIndex];
329
- const nextItem = inputs[index];
330
- if (nextItem) {
331
- if (currentItem) currentItem.input.cancel();
333
+ const prevState = inputs[focusIndex];
334
+ const nextState = inputs[index];
335
+ if (nextState) {
336
+ if (prevState) renderInput(prevState, false);
332
337
  focusIndex = index;
333
- nextItem.input.focus();
334
- activateInput(nextItem.input);
338
+ renderInput(nextState, true);
335
339
  parent.render();
336
340
  }
337
341
  };
338
- for (const entry of inputs) {
339
- const input = entry.input;
340
- input.key(["tab"], () => {
341
- focusInput((focusIndex + 1) % inputs.length);
342
- });
343
- input.key(["S-tab"], () => {
344
- focusInput((focusIndex - 1 + inputs.length) % inputs.length);
345
- });
346
- input.key(["enter"], () => {
347
- input.cancel();
342
+ const keypressHandler = (ch, key) => {
343
+ const state = inputs[focusIndex];
344
+ if (!state) return;
345
+ const keyName = key?.name || "";
346
+ if (keyName === "tab") {
347
+ if (key.shift) focusInput((focusIndex - 1 + inputs.length) % inputs.length);
348
+ else focusInput((focusIndex + 1) % inputs.length);
349
+ return;
350
+ }
351
+ if (keyName === "enter" || keyName === "return") {
348
352
  submitForm();
349
- });
350
- input.key(["escape"], () => {
351
- input.cancel();
352
- close();
353
- });
354
- }
353
+ return;
354
+ }
355
+ if (keyName === "escape") return;
356
+ if (keyName === "left") {
357
+ state.cursor = Math.max(0, state.cursor - 1);
358
+ renderInput(state, true);
359
+ parent.render();
360
+ return;
361
+ }
362
+ if (keyName === "right") {
363
+ state.cursor = Math.min(state.value.length, state.cursor + 1);
364
+ renderInput(state, true);
365
+ parent.render();
366
+ return;
367
+ }
368
+ if (keyName === "home") {
369
+ state.cursor = 0;
370
+ renderInput(state, true);
371
+ parent.render();
372
+ return;
373
+ }
374
+ if (keyName === "end") {
375
+ state.cursor = state.value.length;
376
+ renderInput(state, true);
377
+ parent.render();
378
+ return;
379
+ }
380
+ if (keyName === "backspace") {
381
+ if (state.cursor > 0) {
382
+ state.value = state.value.slice(0, state.cursor - 1) + state.value.slice(state.cursor);
383
+ state.cursor--;
384
+ renderInput(state, true);
385
+ parent.render();
386
+ }
387
+ return;
388
+ }
389
+ if (keyName === "delete") {
390
+ if (state.cursor < state.value.length) {
391
+ state.value = state.value.slice(0, state.cursor) + state.value.slice(state.cursor + 1);
392
+ renderInput(state, true);
393
+ parent.render();
394
+ }
395
+ return;
396
+ }
397
+ if (ch && ch.length === 1 && !key.ctrl && !key.meta) {
398
+ state.value = state.value.slice(0, state.cursor) + ch + state.value.slice(state.cursor);
399
+ state.cursor++;
400
+ renderInput(state, true);
401
+ parent.render();
402
+ }
403
+ };
355
404
  const submitForm = () => {
405
+ parent.removeListener("keypress", keypressHandler);
356
406
  const params = {};
357
- for (const { name, input } of inputs) {
358
- const value = input.getValue().trim();
359
- if (value) try {
360
- params[name] = JSON.parse(value);
361
- } catch {
362
- params[name] = value;
407
+ for (const { name, value } of inputs) {
408
+ const trimmed = value.trim();
409
+ if (trimmed) {
410
+ const expectedType = properties[name]?.type || "string";
411
+ if (expectedType === "string") params[name] = trimmed;
412
+ else if (expectedType === "number" || expectedType === "integer") {
413
+ const num = Number(trimmed);
414
+ params[name] = Number.isNaN(num) ? trimmed : num;
415
+ } else if (expectedType === "boolean") params[name] = trimmed.toLowerCase() === "true";
416
+ else if (expectedType === "object" || expectedType === "array") try {
417
+ params[name] = JSON.parse(trimmed);
418
+ } catch {
419
+ params[name] = trimmed;
420
+ }
421
+ else try {
422
+ params[name] = JSON.parse(trimmed);
423
+ } catch {
424
+ params[name] = trimmed;
425
+ }
363
426
  }
364
427
  }
365
428
  close();
366
429
  onSubmit(params);
367
430
  };
431
+ const originalClose = close;
432
+ const closeWithCleanup = () => {
433
+ parent.removeListener("keypress", keypressHandler);
434
+ originalClose();
435
+ };
368
436
  dialog.key(["escape"], () => {
437
+ closeWithCleanup();
438
+ });
439
+ dialog.focus();
440
+ parent.render();
441
+ setTimeout(() => {
442
+ parent.on("keypress", keypressHandler);
443
+ focusInput(0);
444
+ }, 50);
445
+ },
446
+ showActionPicker(nodePath, actions, onSelect) {
447
+ close();
448
+ const nodeName = nodePath.split("/").pop() || nodePath;
449
+ const dialogHeight = Math.min(actions.length + 6, 20);
450
+ const dialog = createDialog(`Actions: ${nodeName}`, "50%", dialogHeight, { skipDefaultKeys: true });
451
+ currentDialog = dialog;
452
+ let selectedIndex = 0;
453
+ const renderContent = () => {
454
+ const lines = [""];
455
+ for (let i = 0; i < actions.length; i++) {
456
+ const action = actions[i];
457
+ if (!action) continue;
458
+ const prefix = i === selectedIndex ? " {inverse}" : " ";
459
+ const suffix = i === selectedIndex ? "{/inverse}" : "";
460
+ lines.push(`${prefix}[${i + 1}] ${action.name}${suffix}`);
461
+ if (action.description) lines.push(` {gray-fg}${action.description}{/gray-fg}`);
462
+ }
463
+ lines.push("");
464
+ lines.push(" {gray-fg}↑/↓: select | Enter: execute | Esc: cancel{/gray-fg}");
465
+ dialog.setContent(lines.join("\n"));
466
+ parent.render();
467
+ };
468
+ renderContent();
469
+ dialog.key(["up", "k"], () => {
470
+ selectedIndex = (selectedIndex - 1 + actions.length) % actions.length;
471
+ renderContent();
472
+ });
473
+ dialog.key(["down", "j"], () => {
474
+ selectedIndex = (selectedIndex + 1) % actions.length;
475
+ renderContent();
476
+ });
477
+ for (let i = 1; i <= Math.min(9, actions.length); i++) dialog.key([String(i)], () => {
478
+ const action = actions[i - 1];
479
+ if (action) {
480
+ close();
481
+ onSelect(action);
482
+ }
483
+ });
484
+ dialog.key(["enter"], () => {
485
+ const action = actions[selectedIndex];
486
+ if (action) {
487
+ close();
488
+ onSelect(action);
489
+ }
490
+ });
491
+ dialog.key(["escape", "q"], () => {
369
492
  close();
370
493
  });
371
- focusInput(0);
494
+ dialog.focus();
495
+ parent.render();
372
496
  },
373
497
  close,
374
498
  isOpen() {
@@ -255,8 +255,9 @@ function createDialogManager(blessed, options) {
255
255
  const required = inputSchema?.required || [];
256
256
  const propNames = Object.keys(properties);
257
257
  if (propNames.length === 0) {
258
- close();
259
- onSubmit({});
258
+ this.showConfirm(`Execute action on ${path}?`, () => {
259
+ onSubmit({});
260
+ });
260
261
  return;
261
262
  }
262
263
  const dialogHeight = Math.min(propNames.length * 3 + 8, 25);
@@ -269,7 +270,7 @@ function createDialogManager(blessed, options) {
269
270
  right: 1,
270
271
  bottom: 3,
271
272
  keys: true,
272
- vi: true
273
+ vi: false
273
274
  });
274
275
  const inputs = [];
275
276
  let yPos = 0;
@@ -288,28 +289,23 @@ function createDialogManager(blessed, options) {
288
289
  style: { fg: Colors.fg.normal }
289
290
  });
290
291
  yPos += 1;
291
- const input = blessed.textbox({
292
+ const inputBox = blessed.box({
292
293
  parent: form,
293
- name: propName,
294
294
  top: yPos,
295
295
  left: 0,
296
296
  width: "100%-2",
297
297
  height: 1,
298
- keys: true,
299
- mouse: true,
300
- inputOnFocus: false,
298
+ tags: true,
301
299
  style: {
302
300
  fg: Colors.fg.normal,
303
- bg: Colors.bg.input,
304
- focus: {
305
- fg: "white",
306
- bg: Colors.bg.inputFocus
307
- }
301
+ bg: Colors.bg.input
308
302
  }
309
303
  });
310
304
  inputs.push({
311
305
  name: propName,
312
- input
306
+ value: "",
307
+ cursor: 0,
308
+ box: inputBox
313
309
  });
314
310
  yPos += 2;
315
311
  }
@@ -318,57 +314,185 @@ function createDialogManager(blessed, options) {
318
314
  bottom: 1,
319
315
  left: 1,
320
316
  tags: true,
321
- content: "{gray-fg}Tab: next | Shift+Tab: prev | Enter: submit | Esc: cancel{/gray-fg}"
317
+ content: "{gray-fg}Tab: next | ←→: move cursor | Enter: submit | Esc: cancel{/gray-fg}"
322
318
  });
323
319
  let focusIndex = 0;
324
- const activateInput = (input) => {
325
- input.readInput(() => {});
320
+ const renderInput = (state, focused) => {
321
+ if (focused) {
322
+ const before = state.value.slice(0, state.cursor);
323
+ const cursorChar = state.value[state.cursor] || "█";
324
+ const after = state.value.slice(state.cursor + 1);
325
+ state.box.setContent(`${before}{white-bg}{black-fg}${cursorChar}{/black-fg}{/white-bg}${after}`);
326
+ state.box.style.bg = Colors.bg.inputFocus;
327
+ } else {
328
+ state.box.setContent(state.value || "");
329
+ state.box.style.bg = Colors.bg.input;
330
+ }
326
331
  };
327
332
  const focusInput = (index) => {
328
- const currentItem = inputs[focusIndex];
329
- const nextItem = inputs[index];
330
- if (nextItem) {
331
- if (currentItem) currentItem.input.cancel();
333
+ const prevState = inputs[focusIndex];
334
+ const nextState = inputs[index];
335
+ if (nextState) {
336
+ if (prevState) renderInput(prevState, false);
332
337
  focusIndex = index;
333
- nextItem.input.focus();
334
- activateInput(nextItem.input);
338
+ renderInput(nextState, true);
335
339
  parent.render();
336
340
  }
337
341
  };
338
- for (const entry of inputs) {
339
- const input = entry.input;
340
- input.key(["tab"], () => {
341
- focusInput((focusIndex + 1) % inputs.length);
342
- });
343
- input.key(["S-tab"], () => {
344
- focusInput((focusIndex - 1 + inputs.length) % inputs.length);
345
- });
346
- input.key(["enter"], () => {
347
- input.cancel();
342
+ const keypressHandler = (ch, key) => {
343
+ const state = inputs[focusIndex];
344
+ if (!state) return;
345
+ const keyName = key?.name || "";
346
+ if (keyName === "tab") {
347
+ if (key.shift) focusInput((focusIndex - 1 + inputs.length) % inputs.length);
348
+ else focusInput((focusIndex + 1) % inputs.length);
349
+ return;
350
+ }
351
+ if (keyName === "enter" || keyName === "return") {
348
352
  submitForm();
349
- });
350
- input.key(["escape"], () => {
351
- input.cancel();
352
- close();
353
- });
354
- }
353
+ return;
354
+ }
355
+ if (keyName === "escape") return;
356
+ if (keyName === "left") {
357
+ state.cursor = Math.max(0, state.cursor - 1);
358
+ renderInput(state, true);
359
+ parent.render();
360
+ return;
361
+ }
362
+ if (keyName === "right") {
363
+ state.cursor = Math.min(state.value.length, state.cursor + 1);
364
+ renderInput(state, true);
365
+ parent.render();
366
+ return;
367
+ }
368
+ if (keyName === "home") {
369
+ state.cursor = 0;
370
+ renderInput(state, true);
371
+ parent.render();
372
+ return;
373
+ }
374
+ if (keyName === "end") {
375
+ state.cursor = state.value.length;
376
+ renderInput(state, true);
377
+ parent.render();
378
+ return;
379
+ }
380
+ if (keyName === "backspace") {
381
+ if (state.cursor > 0) {
382
+ state.value = state.value.slice(0, state.cursor - 1) + state.value.slice(state.cursor);
383
+ state.cursor--;
384
+ renderInput(state, true);
385
+ parent.render();
386
+ }
387
+ return;
388
+ }
389
+ if (keyName === "delete") {
390
+ if (state.cursor < state.value.length) {
391
+ state.value = state.value.slice(0, state.cursor) + state.value.slice(state.cursor + 1);
392
+ renderInput(state, true);
393
+ parent.render();
394
+ }
395
+ return;
396
+ }
397
+ if (ch && ch.length === 1 && !key.ctrl && !key.meta) {
398
+ state.value = state.value.slice(0, state.cursor) + ch + state.value.slice(state.cursor);
399
+ state.cursor++;
400
+ renderInput(state, true);
401
+ parent.render();
402
+ }
403
+ };
355
404
  const submitForm = () => {
405
+ parent.removeListener("keypress", keypressHandler);
356
406
  const params = {};
357
- for (const { name, input } of inputs) {
358
- const value = input.getValue().trim();
359
- if (value) try {
360
- params[name] = JSON.parse(value);
361
- } catch {
362
- params[name] = value;
407
+ for (const { name, value } of inputs) {
408
+ const trimmed = value.trim();
409
+ if (trimmed) {
410
+ const expectedType = properties[name]?.type || "string";
411
+ if (expectedType === "string") params[name] = trimmed;
412
+ else if (expectedType === "number" || expectedType === "integer") {
413
+ const num = Number(trimmed);
414
+ params[name] = Number.isNaN(num) ? trimmed : num;
415
+ } else if (expectedType === "boolean") params[name] = trimmed.toLowerCase() === "true";
416
+ else if (expectedType === "object" || expectedType === "array") try {
417
+ params[name] = JSON.parse(trimmed);
418
+ } catch {
419
+ params[name] = trimmed;
420
+ }
421
+ else try {
422
+ params[name] = JSON.parse(trimmed);
423
+ } catch {
424
+ params[name] = trimmed;
425
+ }
363
426
  }
364
427
  }
365
428
  close();
366
429
  onSubmit(params);
367
430
  };
431
+ const originalClose = close;
432
+ const closeWithCleanup = () => {
433
+ parent.removeListener("keypress", keypressHandler);
434
+ originalClose();
435
+ };
368
436
  dialog.key(["escape"], () => {
437
+ closeWithCleanup();
438
+ });
439
+ dialog.focus();
440
+ parent.render();
441
+ setTimeout(() => {
442
+ parent.on("keypress", keypressHandler);
443
+ focusInput(0);
444
+ }, 50);
445
+ },
446
+ showActionPicker(nodePath, actions, onSelect) {
447
+ close();
448
+ const nodeName = nodePath.split("/").pop() || nodePath;
449
+ const dialogHeight = Math.min(actions.length + 6, 20);
450
+ const dialog = createDialog(`Actions: ${nodeName}`, "50%", dialogHeight, { skipDefaultKeys: true });
451
+ currentDialog = dialog;
452
+ let selectedIndex = 0;
453
+ const renderContent = () => {
454
+ const lines = [""];
455
+ for (let i = 0; i < actions.length; i++) {
456
+ const action = actions[i];
457
+ if (!action) continue;
458
+ const prefix = i === selectedIndex ? " {inverse}" : " ";
459
+ const suffix = i === selectedIndex ? "{/inverse}" : "";
460
+ lines.push(`${prefix}[${i + 1}] ${action.name}${suffix}`);
461
+ if (action.description) lines.push(` {gray-fg}${action.description}{/gray-fg}`);
462
+ }
463
+ lines.push("");
464
+ lines.push(" {gray-fg}↑/↓: select | Enter: execute | Esc: cancel{/gray-fg}");
465
+ dialog.setContent(lines.join("\n"));
466
+ parent.render();
467
+ };
468
+ renderContent();
469
+ dialog.key(["up", "k"], () => {
470
+ selectedIndex = (selectedIndex - 1 + actions.length) % actions.length;
471
+ renderContent();
472
+ });
473
+ dialog.key(["down", "j"], () => {
474
+ selectedIndex = (selectedIndex + 1) % actions.length;
475
+ renderContent();
476
+ });
477
+ for (let i = 1; i <= Math.min(9, actions.length); i++) dialog.key([String(i)], () => {
478
+ const action = actions[i - 1];
479
+ if (action) {
480
+ close();
481
+ onSelect(action);
482
+ }
483
+ });
484
+ dialog.key(["enter"], () => {
485
+ const action = actions[selectedIndex];
486
+ if (action) {
487
+ close();
488
+ onSelect(action);
489
+ }
490
+ });
491
+ dialog.key(["escape", "q"], () => {
369
492
  close();
370
493
  });
371
- focusInput(0);
494
+ dialog.focus();
495
+ parent.render();
372
496
  },
373
497
  close,
374
498
  isOpen() {