terminal-pilot 0.0.30 → 0.0.32

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 (329) hide show
  1. package/dist/cli.js +1599 -497
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +489 -6
  4. package/dist/commands/close-session.js.map +4 -4
  5. package/dist/commands/create-session.js +489 -6
  6. package/dist/commands/create-session.js.map +4 -4
  7. package/dist/commands/fill.js +489 -6
  8. package/dist/commands/fill.js.map +4 -4
  9. package/dist/commands/get-session.js +489 -6
  10. package/dist/commands/get-session.js.map +4 -4
  11. package/dist/commands/index.js +630 -44
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +626 -40
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +68 -17
  16. package/dist/commands/installer.js.map +4 -4
  17. package/dist/commands/list-sessions.js +489 -6
  18. package/dist/commands/list-sessions.js.map +4 -4
  19. package/dist/commands/press-key.js +489 -6
  20. package/dist/commands/press-key.js.map +4 -4
  21. package/dist/commands/read-history.js +489 -6
  22. package/dist/commands/read-history.js.map +4 -4
  23. package/dist/commands/read-screen.js +489 -6
  24. package/dist/commands/read-screen.js.map +4 -4
  25. package/dist/commands/resize.js +489 -6
  26. package/dist/commands/resize.js.map +4 -4
  27. package/dist/commands/runtime.js.map +1 -1
  28. package/dist/commands/screenshot.js +489 -6
  29. package/dist/commands/screenshot.js.map +4 -4
  30. package/dist/commands/send-signal.js +489 -6
  31. package/dist/commands/send-signal.js.map +4 -4
  32. package/dist/commands/type.js +489 -6
  33. package/dist/commands/type.js.map +4 -4
  34. package/dist/commands/uninstall.js +554 -20
  35. package/dist/commands/uninstall.js.map +4 -4
  36. package/dist/commands/wait-for-exit.js +489 -6
  37. package/dist/commands/wait-for-exit.js.map +4 -4
  38. package/dist/commands/wait-for.js +489 -6
  39. package/dist/commands/wait-for.js.map +4 -4
  40. package/dist/testing/cli-repl.js +1599 -497
  41. package/dist/testing/cli-repl.js.map +4 -4
  42. package/dist/testing/qa-cli.js +1609 -507
  43. package/dist/testing/qa-cli.js.map +4 -4
  44. package/node_modules/@poe-code/agent-defs/README.md +35 -0
  45. package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.d.ts +2 -0
  46. package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +21 -0
  47. package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.d.ts +2 -0
  48. package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +18 -0
  49. package/node_modules/@poe-code/agent-defs/dist/agents/codex.d.ts +2 -0
  50. package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +25 -0
  51. package/node_modules/@poe-code/agent-defs/dist/agents/cursor.d.ts +2 -0
  52. package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +15 -0
  53. package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.d.ts +2 -0
  54. package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +16 -0
  55. package/node_modules/@poe-code/agent-defs/dist/agents/goose.d.ts +2 -0
  56. package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +16 -0
  57. package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +9 -0
  58. package/node_modules/@poe-code/agent-defs/dist/agents/index.js +9 -0
  59. package/node_modules/@poe-code/agent-defs/dist/agents/kimi.d.ts +2 -0
  60. package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +16 -0
  61. package/node_modules/@poe-code/agent-defs/dist/agents/opencode.d.ts +2 -0
  62. package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +20 -0
  63. package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.d.ts +2 -0
  64. package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +14 -0
  65. package/node_modules/@poe-code/agent-defs/dist/index.d.ts +5 -0
  66. package/node_modules/@poe-code/agent-defs/dist/index.js +3 -0
  67. package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +3 -0
  68. package/node_modules/@poe-code/agent-defs/dist/registry.js +45 -0
  69. package/node_modules/@poe-code/agent-defs/dist/specifier.d.ts +7 -0
  70. package/node_modules/@poe-code/agent-defs/dist/specifier.js +40 -0
  71. package/node_modules/@poe-code/agent-defs/dist/types.d.ts +28 -0
  72. package/node_modules/@poe-code/agent-defs/dist/types.js +1 -0
  73. package/node_modules/@poe-code/agent-defs/package.json +20 -0
  74. package/node_modules/@poe-code/agent-skill-config/dist/apply.js +2 -1
  75. package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.d.ts +1 -0
  76. package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +37 -18
  77. package/node_modules/@poe-code/agent-skill-config/dist/resolve-skill-reference.js +8 -4
  78. package/node_modules/@poe-code/agent-skill-config/package.json +1 -5
  79. package/node_modules/@poe-code/config-mutations/README.md +55 -0
  80. package/node_modules/@poe-code/config-mutations/dist/error-codes.d.ts +1 -0
  81. package/node_modules/@poe-code/config-mutations/dist/error-codes.js +6 -0
  82. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.d.ts +6 -0
  83. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +829 -0
  84. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +17 -0
  85. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +64 -0
  86. package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.d.ts +7 -0
  87. package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.js +39 -0
  88. package/node_modules/@poe-code/config-mutations/dist/formats/index.d.ts +13 -0
  89. package/node_modules/@poe-code/config-mutations/dist/formats/index.js +49 -0
  90. package/node_modules/@poe-code/config-mutations/dist/formats/json.d.ts +32 -0
  91. package/node_modules/@poe-code/config-mutations/dist/formats/json.js +171 -0
  92. package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
  93. package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
  94. package/node_modules/@poe-code/config-mutations/dist/formats/toml.d.ts +2 -0
  95. package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +75 -0
  96. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.d.ts +2 -0
  97. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +76 -0
  98. package/node_modules/@poe-code/config-mutations/dist/fs-utils.d.ts +18 -0
  99. package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +43 -0
  100. package/node_modules/@poe-code/config-mutations/dist/index.d.ts +8 -0
  101. package/node_modules/@poe-code/config-mutations/dist/index.js +8 -0
  102. package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.d.ts +47 -0
  103. package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.js +34 -0
  104. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +62 -0
  105. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +55 -0
  106. package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +40 -0
  107. package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.js +32 -0
  108. package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +6 -0
  109. package/node_modules/@poe-code/config-mutations/dist/template/render.js +8 -0
  110. package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.d.ts +7 -0
  111. package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.js +21 -0
  112. package/node_modules/@poe-code/config-mutations/dist/testing/index.d.ts +3 -0
  113. package/node_modules/@poe-code/config-mutations/dist/testing/index.js +2 -0
  114. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +25 -0
  115. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +194 -0
  116. package/node_modules/@poe-code/config-mutations/dist/types.d.ts +168 -0
  117. package/node_modules/@poe-code/config-mutations/dist/types.js +6 -0
  118. package/node_modules/@poe-code/config-mutations/package.json +29 -0
  119. package/node_modules/@poe-code/frontmatter/README.md +35 -0
  120. package/node_modules/@poe-code/frontmatter/dist/fences.d.ts +25 -0
  121. package/node_modules/@poe-code/frontmatter/dist/fences.js +100 -0
  122. package/node_modules/@poe-code/frontmatter/dist/index.d.ts +3 -0
  123. package/node_modules/@poe-code/frontmatter/dist/index.js +3 -0
  124. package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +20 -0
  125. package/node_modules/@poe-code/frontmatter/dist/parse.js +209 -0
  126. package/node_modules/@poe-code/frontmatter/dist/stringify.d.ts +1 -0
  127. package/node_modules/@poe-code/frontmatter/dist/stringify.js +48 -0
  128. package/node_modules/@poe-code/frontmatter/package.json +25 -0
  129. package/node_modules/toolcraft-design/README.md +160 -0
  130. package/node_modules/toolcraft-design/dist/acp/components.d.ts +12 -0
  131. package/node_modules/toolcraft-design/dist/acp/components.js +137 -0
  132. package/node_modules/toolcraft-design/dist/acp/index.d.ts +3 -0
  133. package/node_modules/toolcraft-design/dist/acp/index.js +2 -0
  134. package/node_modules/toolcraft-design/dist/acp/writer.d.ts +13 -0
  135. package/node_modules/toolcraft-design/dist/acp/writer.js +21 -0
  136. package/node_modules/toolcraft-design/dist/components/browser.d.ts +15 -0
  137. package/node_modules/toolcraft-design/dist/components/browser.js +31 -0
  138. package/node_modules/toolcraft-design/dist/components/catalog.d.ts +26 -0
  139. package/node_modules/toolcraft-design/dist/components/catalog.js +95 -0
  140. package/node_modules/toolcraft-design/dist/components/color.d.ts +31 -0
  141. package/node_modules/toolcraft-design/dist/components/color.js +102 -0
  142. package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +16 -0
  143. package/node_modules/toolcraft-design/dist/components/command-errors.js +23 -0
  144. package/node_modules/toolcraft-design/dist/components/detail-card.d.ts +22 -0
  145. package/node_modules/toolcraft-design/dist/components/detail-card.js +45 -0
  146. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.d.ts +5 -0
  147. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +132 -0
  148. package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +33 -0
  149. package/node_modules/toolcraft-design/dist/components/help-formatter.js +213 -0
  150. package/node_modules/toolcraft-design/dist/components/index.d.ts +16 -0
  151. package/node_modules/toolcraft-design/dist/components/index.js +10 -0
  152. package/node_modules/toolcraft-design/dist/components/logger.d.ts +11 -0
  153. package/node_modules/toolcraft-design/dist/components/logger.js +60 -0
  154. package/node_modules/toolcraft-design/dist/components/symbols.d.ts +12 -0
  155. package/node_modules/toolcraft-design/dist/components/symbols.js +71 -0
  156. package/node_modules/toolcraft-design/dist/components/table.d.ts +15 -0
  157. package/node_modules/toolcraft-design/dist/components/table.js +302 -0
  158. package/node_modules/toolcraft-design/dist/components/template.d.ts +10 -0
  159. package/node_modules/toolcraft-design/dist/components/template.js +437 -0
  160. package/node_modules/toolcraft-design/dist/components/text.d.ts +16 -0
  161. package/node_modules/toolcraft-design/dist/components/text.js +145 -0
  162. package/node_modules/toolcraft-design/dist/dashboard/ansi.d.ts +18 -0
  163. package/node_modules/toolcraft-design/dist/dashboard/ansi.js +343 -0
  164. package/node_modules/toolcraft-design/dist/dashboard/buffer.d.ts +25 -0
  165. package/node_modules/toolcraft-design/dist/dashboard/buffer.js +219 -0
  166. package/node_modules/toolcraft-design/dist/dashboard/components/border.d.ts +9 -0
  167. package/node_modules/toolcraft-design/dist/dashboard/components/border.js +123 -0
  168. package/node_modules/toolcraft-design/dist/dashboard/components/footer.d.ts +8 -0
  169. package/node_modules/toolcraft-design/dist/dashboard/components/footer.js +56 -0
  170. package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.d.ts +12 -0
  171. package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.js +268 -0
  172. package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.d.ts +7 -0
  173. package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.js +107 -0
  174. package/node_modules/toolcraft-design/dist/dashboard/dashboard.d.ts +20 -0
  175. package/node_modules/toolcraft-design/dist/dashboard/dashboard.js +167 -0
  176. package/node_modules/toolcraft-design/dist/dashboard/demo.d.ts +13 -0
  177. package/node_modules/toolcraft-design/dist/dashboard/demo.js +145 -0
  178. package/node_modules/toolcraft-design/dist/dashboard/index.d.ts +8 -0
  179. package/node_modules/toolcraft-design/dist/dashboard/index.js +4 -0
  180. package/node_modules/toolcraft-design/dist/dashboard/keymap.d.ts +8 -0
  181. package/node_modules/toolcraft-design/dist/dashboard/keymap.js +233 -0
  182. package/node_modules/toolcraft-design/dist/dashboard/layout.d.ts +25 -0
  183. package/node_modules/toolcraft-design/dist/dashboard/layout.js +79 -0
  184. package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.d.ts +10 -0
  185. package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.js +7 -0
  186. package/node_modules/toolcraft-design/dist/dashboard/snapshot.d.ts +10 -0
  187. package/node_modules/toolcraft-design/dist/dashboard/snapshot.js +68 -0
  188. package/node_modules/toolcraft-design/dist/dashboard/store.d.ts +8 -0
  189. package/node_modules/toolcraft-design/dist/dashboard/store.js +51 -0
  190. package/node_modules/toolcraft-design/dist/dashboard/terminal-width.d.ts +4 -0
  191. package/node_modules/toolcraft-design/dist/dashboard/terminal-width.js +71 -0
  192. package/node_modules/toolcraft-design/dist/dashboard/terminal.d.ts +37 -0
  193. package/node_modules/toolcraft-design/dist/dashboard/terminal.js +264 -0
  194. package/node_modules/toolcraft-design/dist/dashboard/types.d.ts +38 -0
  195. package/node_modules/toolcraft-design/dist/dashboard/types.js +1 -0
  196. package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +16 -0
  197. package/node_modules/toolcraft-design/dist/explorer/actions.js +39 -0
  198. package/node_modules/toolcraft-design/dist/explorer/demo.d.ts +13 -0
  199. package/node_modules/toolcraft-design/dist/explorer/demo.js +297 -0
  200. package/node_modules/toolcraft-design/dist/explorer/events.d.ts +67 -0
  201. package/node_modules/toolcraft-design/dist/explorer/events.js +1 -0
  202. package/node_modules/toolcraft-design/dist/explorer/filter.d.ts +10 -0
  203. package/node_modules/toolcraft-design/dist/explorer/filter.js +95 -0
  204. package/node_modules/toolcraft-design/dist/explorer/index.d.ts +8 -0
  205. package/node_modules/toolcraft-design/dist/explorer/index.js +8 -0
  206. package/node_modules/toolcraft-design/dist/explorer/jobs.d.ts +7 -0
  207. package/node_modules/toolcraft-design/dist/explorer/jobs.js +59 -0
  208. package/node_modules/toolcraft-design/dist/explorer/keymap.d.ts +21 -0
  209. package/node_modules/toolcraft-design/dist/explorer/keymap.js +376 -0
  210. package/node_modules/toolcraft-design/dist/explorer/layout.d.ts +20 -0
  211. package/node_modules/toolcraft-design/dist/explorer/layout.js +73 -0
  212. package/node_modules/toolcraft-design/dist/explorer/reducer.d.ts +9 -0
  213. package/node_modules/toolcraft-design/dist/explorer/reducer.js +782 -0
  214. package/node_modules/toolcraft-design/dist/explorer/render/detail.d.ts +4 -0
  215. package/node_modules/toolcraft-design/dist/explorer/render/detail.js +97 -0
  216. package/node_modules/toolcraft-design/dist/explorer/render/footer.d.ts +4 -0
  217. package/node_modules/toolcraft-design/dist/explorer/render/footer.js +73 -0
  218. package/node_modules/toolcraft-design/dist/explorer/render/header.d.ts +4 -0
  219. package/node_modules/toolcraft-design/dist/explorer/render/header.js +49 -0
  220. package/node_modules/toolcraft-design/dist/explorer/render/index.d.ts +8 -0
  221. package/node_modules/toolcraft-design/dist/explorer/render/index.js +53 -0
  222. package/node_modules/toolcraft-design/dist/explorer/render/list.d.ts +4 -0
  223. package/node_modules/toolcraft-design/dist/explorer/render/list.js +116 -0
  224. package/node_modules/toolcraft-design/dist/explorer/render/modal.d.ts +3 -0
  225. package/node_modules/toolcraft-design/dist/explorer/render/modal.js +87 -0
  226. package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.d.ts +8 -0
  227. package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.js +156 -0
  228. package/node_modules/toolcraft-design/dist/explorer/render/text.d.ts +12 -0
  229. package/node_modules/toolcraft-design/dist/explorer/render/text.js +81 -0
  230. package/node_modules/toolcraft-design/dist/explorer/runtime.d.ts +2 -0
  231. package/node_modules/toolcraft-design/dist/explorer/runtime.js +340 -0
  232. package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.d.ts +50 -0
  233. package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.js +101 -0
  234. package/node_modules/toolcraft-design/dist/explorer/state.d.ts +137 -0
  235. package/node_modules/toolcraft-design/dist/explorer/state.js +86 -0
  236. package/node_modules/toolcraft-design/dist/explorer/theme.d.ts +27 -0
  237. package/node_modules/toolcraft-design/dist/explorer/theme.js +29 -0
  238. package/node_modules/toolcraft-design/dist/index.d.ts +50 -0
  239. package/node_modules/toolcraft-design/dist/index.js +43 -0
  240. package/node_modules/toolcraft-design/dist/internal/color-support.d.ts +9 -0
  241. package/node_modules/toolcraft-design/dist/internal/color-support.js +12 -0
  242. package/node_modules/toolcraft-design/dist/internal/output-format.d.ts +6 -0
  243. package/node_modules/toolcraft-design/dist/internal/output-format.js +22 -0
  244. package/node_modules/toolcraft-design/dist/internal/strip-ansi.d.ts +1 -0
  245. package/node_modules/toolcraft-design/dist/internal/strip-ansi.js +50 -0
  246. package/node_modules/toolcraft-design/dist/internal/theme-detect.d.ts +12 -0
  247. package/node_modules/toolcraft-design/dist/internal/theme-detect.js +71 -0
  248. package/node_modules/toolcraft-design/dist/internal/theme-state.d.ts +12 -0
  249. package/node_modules/toolcraft-design/dist/internal/theme-state.js +35 -0
  250. package/node_modules/toolcraft-design/dist/prompts/index.d.ts +91 -0
  251. package/node_modules/toolcraft-design/dist/prompts/index.js +137 -0
  252. package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.d.ts +2 -0
  253. package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.js +4 -0
  254. package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.d.ts +9 -0
  255. package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.js +47 -0
  256. package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +55 -0
  257. package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +274 -0
  258. package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.d.ts +20 -0
  259. package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.js +53 -0
  260. package/node_modules/toolcraft-design/dist/prompts/interactive/index.d.ts +6 -0
  261. package/node_modules/toolcraft-design/dist/prompts/interactive/index.js +6 -0
  262. package/node_modules/toolcraft-design/dist/prompts/interactive/keys.d.ts +2 -0
  263. package/node_modules/toolcraft-design/dist/prompts/interactive/keys.js +28 -0
  264. package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.d.ts +13 -0
  265. package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.js +131 -0
  266. package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.d.ts +10 -0
  267. package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.js +52 -0
  268. package/node_modules/toolcraft-design/dist/prompts/interactive/password.d.ts +10 -0
  269. package/node_modules/toolcraft-design/dist/prompts/interactive/password.js +55 -0
  270. package/node_modules/toolcraft-design/dist/prompts/interactive/select.d.ts +18 -0
  271. package/node_modules/toolcraft-design/dist/prompts/interactive/select.js +89 -0
  272. package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.d.ts +21 -0
  273. package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.js +32 -0
  274. package/node_modules/toolcraft-design/dist/prompts/interactive/text.d.ts +12 -0
  275. package/node_modules/toolcraft-design/dist/prompts/interactive/text.js +60 -0
  276. package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.d.ts +4 -0
  277. package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.js +18 -0
  278. package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.d.ts +2 -0
  279. package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.js +9 -0
  280. package/node_modules/toolcraft-design/dist/prompts/primitives/intro.d.ts +1 -0
  281. package/node_modules/toolcraft-design/dist/prompts/primitives/intro.js +16 -0
  282. package/node_modules/toolcraft-design/dist/prompts/primitives/log.d.ts +18 -0
  283. package/node_modules/toolcraft-design/dist/prompts/primitives/log.js +104 -0
  284. package/node_modules/toolcraft-design/dist/prompts/primitives/note.d.ts +1 -0
  285. package/node_modules/toolcraft-design/dist/prompts/primitives/note.js +39 -0
  286. package/node_modules/toolcraft-design/dist/prompts/primitives/outro.d.ts +1 -0
  287. package/node_modules/toolcraft-design/dist/prompts/primitives/outro.js +16 -0
  288. package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.d.ts +6 -0
  289. package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +74 -0
  290. package/node_modules/toolcraft-design/dist/prompts/theme.d.ts +11 -0
  291. package/node_modules/toolcraft-design/dist/prompts/theme.js +15 -0
  292. package/node_modules/toolcraft-design/dist/static/index.d.ts +4 -0
  293. package/node_modules/toolcraft-design/dist/static/index.js +2 -0
  294. package/node_modules/toolcraft-design/dist/static/menu.d.ts +11 -0
  295. package/node_modules/toolcraft-design/dist/static/menu.js +42 -0
  296. package/node_modules/toolcraft-design/dist/static/spinner.d.ts +14 -0
  297. package/node_modules/toolcraft-design/dist/static/spinner.js +52 -0
  298. package/node_modules/toolcraft-design/dist/terminal-markdown/ast.d.ts +92 -0
  299. package/node_modules/toolcraft-design/dist/terminal-markdown/ast.js +1 -0
  300. package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.d.ts +2 -0
  301. package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.js +139 -0
  302. package/node_modules/toolcraft-design/dist/terminal-markdown/index.d.ts +6 -0
  303. package/node_modules/toolcraft-design/dist/terminal-markdown/index.js +8 -0
  304. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.d.ts +7 -0
  305. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.js +1495 -0
  306. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.d.ts +8 -0
  307. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +36 -0
  308. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.d.ts +10 -0
  309. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.js +1190 -0
  310. package/node_modules/toolcraft-design/dist/terminal-markdown/parser.d.ts +5 -0
  311. package/node_modules/toolcraft-design/dist/terminal-markdown/parser.js +42 -0
  312. package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.d.ts +6 -0
  313. package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.js +615 -0
  314. package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.d.ts +1 -0
  315. package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.js +27 -0
  316. package/node_modules/toolcraft-design/dist/tokens/brand.d.ts +5 -0
  317. package/node_modules/toolcraft-design/dist/tokens/brand.js +5 -0
  318. package/node_modules/toolcraft-design/dist/tokens/colors.d.ts +37 -0
  319. package/node_modules/toolcraft-design/dist/tokens/colors.js +85 -0
  320. package/node_modules/toolcraft-design/dist/tokens/index.d.ts +6 -0
  321. package/node_modules/toolcraft-design/dist/tokens/index.js +5 -0
  322. package/node_modules/toolcraft-design/dist/tokens/spacing.d.ts +6 -0
  323. package/node_modules/toolcraft-design/dist/tokens/spacing.js +6 -0
  324. package/node_modules/toolcraft-design/dist/tokens/typography.d.ts +7 -0
  325. package/node_modules/toolcraft-design/dist/tokens/typography.js +8 -0
  326. package/node_modules/toolcraft-design/dist/tokens/widths.d.ts +5 -0
  327. package/node_modules/toolcraft-design/dist/tokens/widths.js +5 -0
  328. package/node_modules/toolcraft-design/package.json +44 -0
  329. package/package.json +15 -5
@@ -727,7 +727,54 @@ var symbols = {
727
727
 
728
728
  // ../toolcraft-design/src/internal/strip-ansi.ts
729
729
  function stripAnsi(value) {
730
- return value.replace(/\u001b\[[0-9;]*m/g, "");
730
+ let output = "";
731
+ let index = 0;
732
+ while (index < value.length) {
733
+ const char = value[index];
734
+ if (char === "\x1B") {
735
+ index = skipEscapeSequence(value, index);
736
+ continue;
737
+ }
738
+ if (char === "\x9B") {
739
+ index = skipCsiSequence(value, index + 1);
740
+ continue;
741
+ }
742
+ output += char;
743
+ index += char.length;
744
+ }
745
+ return output;
746
+ }
747
+ function skipEscapeSequence(value, index) {
748
+ const next = value[index + 1];
749
+ if (next === "[") {
750
+ return skipCsiSequence(value, index + 2);
751
+ }
752
+ if (next === "]") {
753
+ return skipOscSequence(value, index + 2);
754
+ }
755
+ return Math.min(value.length, index + 2);
756
+ }
757
+ function skipCsiSequence(value, index) {
758
+ while (index < value.length) {
759
+ const codePoint = value.charCodeAt(index);
760
+ index += 1;
761
+ if (codePoint >= 64 && codePoint <= 126) {
762
+ break;
763
+ }
764
+ }
765
+ return index;
766
+ }
767
+ function skipOscSequence(value, index) {
768
+ while (index < value.length) {
769
+ if (value[index] === "\x07") {
770
+ return index + 1;
771
+ }
772
+ if (value[index] === "\x1B" && value[index + 1] === "\\") {
773
+ return index + 2;
774
+ }
775
+ index += 1;
776
+ }
777
+ return index;
731
778
  }
732
779
 
733
780
  // ../toolcraft-design/src/prompts/primitives/log.ts
@@ -924,6 +971,10 @@ var graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
924
971
  // ../toolcraft-design/src/components/table.ts
925
972
  var graphemeSegmenter2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
926
973
 
974
+ // ../toolcraft-design/src/components/detail-card.ts
975
+ import stringWidth from "fast-string-width";
976
+ import { wrapAnsi } from "fast-wrap-ansi";
977
+
927
978
  // ../toolcraft-design/src/components/template.ts
928
979
  var MAX_PARTIAL_DEPTH = 100;
929
980
  var HTML_ESCAPE = {
@@ -1346,13 +1397,13 @@ import { LineCounter, parse, parseDocument } from "yaml";
1346
1397
  // ../frontmatter/src/stringify.ts
1347
1398
  import { stringify } from "yaml";
1348
1399
 
1400
+ // ../toolcraft-design/src/dashboard/terminal-width.ts
1401
+ var graphemeSegmenter3 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
1402
+
1349
1403
  // ../toolcraft-design/src/acp/writer.ts
1350
1404
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
1351
1405
  var storage = new AsyncLocalStorage2();
1352
1406
 
1353
- // ../toolcraft-design/src/dashboard/terminal-width.ts
1354
- var graphemeSegmenter3 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
1355
-
1356
1407
  // ../toolcraft-design/src/dashboard/terminal.ts
1357
1408
  import readline from "node:readline";
1358
1409
  import { PassThrough } from "node:stream";
@@ -1401,11 +1452,11 @@ import { EventEmitter } from "node:events";
1401
1452
  import * as readline2 from "node:readline";
1402
1453
 
1403
1454
  // ../toolcraft-design/src/prompts/interactive/wrap.ts
1404
- import { wrapAnsi } from "fast-wrap-ansi";
1405
- import stringWidth from "fast-string-width";
1455
+ import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
1456
+ import stringWidth2 from "fast-string-width";
1406
1457
 
1407
1458
  // ../toolcraft-design/src/prompts/interactive/pagination.ts
1408
- import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
1459
+ import { wrapAnsi as wrapAnsi3 } from "fast-wrap-ansi";
1409
1460
 
1410
1461
  // ../toolcraft-design/src/static/spinner.ts
1411
1462
  var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
@@ -1835,9 +1886,9 @@ function hasOwnErrorCode(error2, code) {
1835
1886
  function isNotFound(error2) {
1836
1887
  return hasOwnErrorCode(error2, "ENOENT");
1837
1888
  }
1838
- async function readFileIfExists(fs3, target) {
1889
+ async function readFileIfExists(fs4, target) {
1839
1890
  try {
1840
- return await fs3.readFile(target, "utf8");
1891
+ return await fs4.readFile(target, "utf8");
1841
1892
  } catch (error2) {
1842
1893
  if (isNotFound(error2)) {
1843
1894
  return null;
@@ -1845,9 +1896,9 @@ async function readFileIfExists(fs3, target) {
1845
1896
  throw error2;
1846
1897
  }
1847
1898
  }
1848
- async function pathExists(fs3, target) {
1899
+ async function pathExists(fs4, target) {
1849
1900
  try {
1850
- await fs3.stat(target);
1901
+ await fs4.stat(target);
1851
1902
  return true;
1852
1903
  } catch (error2) {
1853
1904
  if (isNotFound(error2)) {
@@ -1970,6 +2021,56 @@ function describeMutation(kind, targetPath) {
1970
2021
  return "Operation";
1971
2022
  }
1972
2023
  }
2024
+ function mutationTargetPath(mutation, options) {
2025
+ switch (mutation.kind) {
2026
+ case "ensureDirectory":
2027
+ case "removeDirectory":
2028
+ return resolveValue(mutation.path, options);
2029
+ case "removeFile":
2030
+ case "chmod":
2031
+ case "backup":
2032
+ case "restoreBackup":
2033
+ case "configMerge":
2034
+ case "configPrune":
2035
+ case "configTransform":
2036
+ case "templateWrite":
2037
+ case "templateMergeToml":
2038
+ case "templateMergeJson":
2039
+ return resolveValue(mutation.target, options);
2040
+ default:
2041
+ return void 0;
2042
+ }
2043
+ }
2044
+ function resolveMutationDetails(mutation, context, options) {
2045
+ try {
2046
+ const rawTarget = mutationTargetPath(mutation, options);
2047
+ if (rawTarget === void 0) {
2048
+ return {
2049
+ kind: mutation.kind,
2050
+ label: mutation.label ?? mutation.kind
2051
+ };
2052
+ }
2053
+ try {
2054
+ const targetPath = resolvePath(rawTarget, context.homeDir, context.pathMapper);
2055
+ return {
2056
+ kind: mutation.kind,
2057
+ label: mutation.label ?? describeMutation(mutation.kind, targetPath),
2058
+ targetPath
2059
+ };
2060
+ } catch {
2061
+ return {
2062
+ kind: mutation.kind,
2063
+ label: mutation.label ?? describeMutation(mutation.kind, rawTarget),
2064
+ targetPath: void 0
2065
+ };
2066
+ }
2067
+ } catch {
2068
+ return {
2069
+ kind: mutation.kind,
2070
+ label: mutation.label ?? mutation.kind
2071
+ };
2072
+ }
2073
+ }
1973
2074
  function pruneKeysByPrefix(table, prefix) {
1974
2075
  const result = {};
1975
2076
  for (const [key, value] of Object.entries(table)) {
@@ -2060,6 +2161,7 @@ async function applyEnsureDirectory(mutation, context, options) {
2060
2161
  label: mutation.label ?? describeMutation(mutation.kind, targetPath),
2061
2162
  targetPath
2062
2163
  };
2164
+ await assertRegularWriteTarget(context, targetPath);
2063
2165
  const existed = await pathExists(context.fs, targetPath);
2064
2166
  if (!context.dryRun) {
2065
2167
  await context.fs.mkdir(targetPath, { recursive: true });
@@ -2176,6 +2278,7 @@ async function applyChmod(mutation, context, options) {
2176
2278
  };
2177
2279
  }
2178
2280
  try {
2281
+ await assertRegularWriteTarget(context, targetPath);
2179
2282
  const stat2 = await context.fs.stat(targetPath);
2180
2283
  const currentMode = typeof stat2.mode === "number" ? stat2.mode & 511 : null;
2181
2284
  if (currentMode === mutation.mode) {
@@ -2209,6 +2312,7 @@ async function applyBackup(mutation, context, options) {
2209
2312
  label: mutation.label ?? describeMutation(mutation.kind, targetPath),
2210
2313
  targetPath
2211
2314
  };
2315
+ await assertRegularWriteTarget(context, targetPath);
2212
2316
  if (mutation.once && await findLatestGeneratedBackup(context.fs, targetPath) !== null) {
2213
2317
  return {
2214
2318
  outcome: { changed: false, effect: "none", detail: "noop" },
@@ -2275,13 +2379,13 @@ async function applyRestoreBackup(mutation, context, options) {
2275
2379
  }
2276
2380
  return { outcome: { changed: true, effect: "copy", detail: "restore" }, details };
2277
2381
  }
2278
- async function findLatestGeneratedBackup(fs3, targetPath) {
2382
+ async function findLatestGeneratedBackup(fs4, targetPath) {
2279
2383
  const separatorIndex = targetPath.lastIndexOf("/");
2280
2384
  const directoryPath = separatorIndex <= 0 ? "/" : targetPath.slice(0, separatorIndex);
2281
2385
  const targetName = targetPath.slice(separatorIndex + 1);
2282
2386
  let entries;
2283
2387
  try {
2284
- entries = await fs3.readdir(directoryPath);
2388
+ entries = await fs4.readdir(directoryPath);
2285
2389
  } catch (error2) {
2286
2390
  if (isNotFound(error2)) {
2287
2391
  return null;
@@ -2345,6 +2449,9 @@ async function applyConfigMerge(mutation, context, options) {
2345
2449
  preserveContent = null;
2346
2450
  }
2347
2451
  const value = resolveValue(mutation.value, options);
2452
+ if (!isConfigObject4(value)) {
2453
+ throw new Error(`configMerge value must be an object for "${rawPath}".`);
2454
+ }
2348
2455
  let merged;
2349
2456
  if (mutation.pruneByPrefix) {
2350
2457
  merged = mergeWithPruneByPrefix(current, value, mutation.pruneByPrefix);
@@ -2478,6 +2585,13 @@ async function applyConfigTransform(mutation, context, options) {
2478
2585
  };
2479
2586
  }
2480
2587
  const serialized = serializeConfigUpdate(format, preserveContent, current, transformed);
2588
+ const serializedChanged = serialized !== rawContent;
2589
+ if (!serializedChanged) {
2590
+ return {
2591
+ outcome: { changed: false, effect: "none", detail: "noop" },
2592
+ details
2593
+ };
2594
+ }
2481
2595
  if (!context.dryRun) {
2482
2596
  await writeAtomically(context, targetPath, serialized);
2483
2597
  }
@@ -2594,25 +2708,14 @@ async function runMutations(mutations, context, options) {
2594
2708
  };
2595
2709
  }
2596
2710
  async function executeMutation(mutation, context, options) {
2597
- context.observers?.onStart?.({
2598
- kind: mutation.kind,
2599
- label: mutation.label ?? mutation.kind,
2600
- targetPath: void 0
2601
- // Will be resolved during apply
2602
- });
2711
+ const pendingDetails = resolveMutationDetails(mutation, context, options);
2712
+ context.observers?.onStart?.(pendingDetails);
2603
2713
  try {
2604
2714
  const { outcome, details } = await applyMutation(mutation, context, options);
2605
2715
  context.observers?.onComplete?.(details, outcome);
2606
2716
  return { outcome, details };
2607
2717
  } catch (error2) {
2608
- context.observers?.onError?.(
2609
- {
2610
- kind: mutation.kind,
2611
- label: mutation.label ?? mutation.kind,
2612
- targetPath: void 0
2613
- },
2614
- error2
2615
- );
2718
+ context.observers?.onError?.(pendingDetails, error2);
2616
2719
  throw error2;
2617
2720
  }
2618
2721
  }
@@ -2641,9 +2744,9 @@ function toHomeRelative(localSkillDir) {
2641
2744
  const normalized = localSkillDir.startsWith("./") ? localSkillDir.slice(2) : localSkillDir;
2642
2745
  return `~/${normalized}`;
2643
2746
  }
2644
- async function pathExists2(fs3, targetPath) {
2747
+ async function pathExists2(fs4, targetPath) {
2645
2748
  try {
2646
- await fs3.stat(targetPath);
2749
+ await fs4.stat(targetPath);
2647
2750
  return true;
2648
2751
  } catch (error2) {
2649
2752
  if (hasOwnErrorCode2(error2, "ENOENT")) {
@@ -2660,7 +2763,7 @@ async function installSkill(agentId, skill, options) {
2660
2763
  }
2661
2764
  const scope = options.scope ?? "local";
2662
2765
  const config2 = support.config;
2663
- if (skill.name.length === 0 || skill.name === "." || skill.name === ".." || skill.name.includes("/") || skill.name.includes("\\") || skill.name.includes("\n") || skill.name.includes("\r")) {
2766
+ if (skill.name.length === 0 || skill.name !== skill.name.trim() || skill.name === "." || skill.name === ".." || skill.name.includes("/") || skill.name.includes("\\") || skill.name.includes("\n") || skill.name.includes("\r")) {
2664
2767
  throw new Error(`Invalid skill name: ${skill.name}`);
2665
2768
  }
2666
2769
  const skillDir = scope === "global" ? config2.globalSkillDir : toHomeRelative(config2.localSkillDir);
@@ -2696,21 +2799,21 @@ async function installSkill(agentId, skill, options) {
2696
2799
  }
2697
2800
  }
2698
2801
  );
2699
- return { skillPath: skillFilePath, displayPath };
2802
+ return { skillPath: absoluteSkillPath, displayPath };
2700
2803
  }
2701
2804
 
2702
2805
  // ../agent-skill-config/src/resolve-skill-reference.ts
2703
- import { statSync } from "node:fs";
2806
+ import * as fs from "node:fs";
2704
2807
  import path5 from "node:path";
2705
2808
 
2706
2809
  // ../agent-skill-config/src/git-exclude.ts
2707
2810
  import { execFileSync } from "node:child_process";
2708
2811
  import { randomUUID as randomUUID2 } from "node:crypto";
2709
- import * as fs from "node:fs";
2812
+ import * as fs2 from "node:fs";
2710
2813
  import path6 from "node:path";
2711
2814
 
2712
2815
  // ../agent-skill-config/src/bridge-active-skills.ts
2713
- import * as fs2 from "node:fs";
2816
+ import * as fs3 from "node:fs";
2714
2817
  import { createHash, randomUUID as randomUUID3 } from "node:crypto";
2715
2818
  import path7 from "node:path";
2716
2819
 
@@ -2792,6 +2895,9 @@ function isOptionalSchema(schema) {
2792
2895
  function getRequiredKeys(schema) {
2793
2896
  return Object.keys(schema.shape).filter((key) => !isOptionalSchema(schema.shape[key])).sort();
2794
2897
  }
2898
+ function getRequiredKeyFingerprint(schema) {
2899
+ return getRequiredKeys(schema).join("+");
2900
+ }
2795
2901
  function assertUniqueRequiredKeyFingerprints(branches) {
2796
2902
  const fingerprints = /* @__PURE__ */ new Map();
2797
2903
  branches.forEach((branch, index) => {
@@ -2829,6 +2935,451 @@ function Union(branches) {
2829
2935
  };
2830
2936
  }
2831
2937
 
2938
+ // ../toolcraft-schema/src/validate.ts
2939
+ var missingValue = /* @__PURE__ */ Symbol("missingValue");
2940
+ function validate(schema, value) {
2941
+ const state = { issues: [] };
2942
+ const result = walkSchema(schema, value, [], state);
2943
+ if (state.issues.length > 0) {
2944
+ return { ok: false, issues: state.issues };
2945
+ }
2946
+ return { ok: true, value: result.present ? result.value : void 0 };
2947
+ }
2948
+ function walkSchema(schema, value, path10, state) {
2949
+ if (schema.kind === "optional") {
2950
+ return walkOptional(schema, value, path10, state);
2951
+ }
2952
+ if (value === missingValue) {
2953
+ addIssue(
2954
+ state,
2955
+ path10,
2956
+ expectedFor(schema),
2957
+ "missing",
2958
+ `Expected ${expectedFor(schema)} at ${formatPath(path10)}`
2959
+ );
2960
+ return { present: false };
2961
+ }
2962
+ if (value === null && schema.nullable === true) {
2963
+ return { present: true, value };
2964
+ }
2965
+ switch (schema.kind) {
2966
+ case "string":
2967
+ return walkString(schema, value, path10, state);
2968
+ case "number":
2969
+ return walkNumber(schema, value, path10, state);
2970
+ case "boolean":
2971
+ return walkBoolean(value, path10, state);
2972
+ case "enum":
2973
+ return walkEnum(schema, value, path10, state);
2974
+ case "array":
2975
+ return walkArray(schema, value, path10, state);
2976
+ case "object":
2977
+ return walkObject(schema, value, path10, state);
2978
+ case "oneOf":
2979
+ return walkOneOf(schema, value, path10, state);
2980
+ case "union":
2981
+ return walkUnion(schema, value, path10, state);
2982
+ case "record":
2983
+ return walkRecord(schema, value, path10, state);
2984
+ case "json":
2985
+ return walkJson(value, path10, state);
2986
+ }
2987
+ }
2988
+ function walkOptional(schema, value, path10, state) {
2989
+ if (value === missingValue || value === void 0) {
2990
+ const defaultValue = getDefault(schema.inner);
2991
+ if (defaultValue.present) {
2992
+ return walkSchema(schema.inner, cloneDefault(defaultValue.value), path10, state);
2993
+ }
2994
+ return { present: false };
2995
+ }
2996
+ return walkSchema(schema.inner, value, path10, state);
2997
+ }
2998
+ function walkString(schema, value, path10, state) {
2999
+ if (typeof value !== "string") {
3000
+ addExpectedIssue(state, path10, "string", value);
3001
+ return { present: true, value };
3002
+ }
3003
+ if (schema.minLength !== void 0 && value.length < schema.minLength) {
3004
+ const expected = `string with length at least ${schema.minLength}`;
3005
+ addIssue(
3006
+ state,
3007
+ path10,
3008
+ expected,
3009
+ `string with length ${value.length}`,
3010
+ `Expected ${expected} at ${formatPath(path10)}`
3011
+ );
3012
+ }
3013
+ if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
3014
+ const expected = `string with length at most ${schema.maxLength}`;
3015
+ addIssue(
3016
+ state,
3017
+ path10,
3018
+ expected,
3019
+ `string with length ${value.length}`,
3020
+ `Expected ${expected} at ${formatPath(path10)}`
3021
+ );
3022
+ }
3023
+ if (schema.pattern !== void 0) {
3024
+ const pattern = compilePattern(schema.pattern);
3025
+ if (pattern === void 0 || !pattern.test(value)) {
3026
+ const expected = `string matching pattern ${schema.pattern}`;
3027
+ addIssue(state, path10, expected, value, `Expected ${expected} at ${formatPath(path10)}`);
3028
+ }
3029
+ }
3030
+ return { present: true, value };
3031
+ }
3032
+ function walkNumber(schema, value, path10, state) {
3033
+ if (typeof value !== "number" || !Number.isFinite(value)) {
3034
+ addExpectedIssue(state, path10, schema.jsonType === "integer" ? "integer" : "number", value);
3035
+ return { present: true, value };
3036
+ }
3037
+ if (schema.jsonType === "integer" && !Number.isInteger(value)) {
3038
+ addExpectedIssue(state, path10, "integer", value);
3039
+ }
3040
+ if (schema.minimum !== void 0 && value < schema.minimum) {
3041
+ const expected = `number greater than or equal to ${schema.minimum}`;
3042
+ addIssue(state, path10, expected, String(value), `Expected ${expected} at ${formatPath(path10)}`);
3043
+ }
3044
+ if (schema.maximum !== void 0 && value > schema.maximum) {
3045
+ const expected = `number less than or equal to ${schema.maximum}`;
3046
+ addIssue(state, path10, expected, String(value), `Expected ${expected} at ${formatPath(path10)}`);
3047
+ }
3048
+ return { present: true, value };
3049
+ }
3050
+ function walkBoolean(value, path10, state) {
3051
+ if (typeof value !== "boolean") {
3052
+ addExpectedIssue(state, path10, "boolean", value);
3053
+ }
3054
+ return { present: true, value };
3055
+ }
3056
+ function walkEnum(schema, value, path10, state) {
3057
+ if (!schema.values.includes(value)) {
3058
+ const expected = `one of ${schema.values.join(", ")}`;
3059
+ addIssue(
3060
+ state,
3061
+ path10,
3062
+ expected,
3063
+ receivedValue(value),
3064
+ `Expected ${expected} at ${formatPath(path10)}`
3065
+ );
3066
+ }
3067
+ return { present: true, value };
3068
+ }
3069
+ function walkArray(schema, value, path10, state) {
3070
+ if (!Array.isArray(value)) {
3071
+ addExpectedIssue(state, path10, "array", value);
3072
+ return { present: true, value };
3073
+ }
3074
+ if (schema.minItems !== void 0 && value.length < schema.minItems) {
3075
+ const expected = `array with at least ${schema.minItems} items`;
3076
+ addIssue(
3077
+ state,
3078
+ path10,
3079
+ expected,
3080
+ `array with ${value.length} items`,
3081
+ `Expected ${expected} at ${formatPath(path10)}`
3082
+ );
3083
+ }
3084
+ if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
3085
+ const expected = `array with at most ${schema.maxItems} items`;
3086
+ addIssue(
3087
+ state,
3088
+ path10,
3089
+ expected,
3090
+ `array with ${value.length} items`,
3091
+ `Expected ${expected} at ${formatPath(path10)}`
3092
+ );
3093
+ }
3094
+ const nextValue = value.map((item, index) => {
3095
+ const result = walkSchema(schema.item, item, [...path10, String(index)], state);
3096
+ return result.present ? result.value : item;
3097
+ });
3098
+ return { present: true, value: nextValue };
3099
+ }
3100
+ function walkObject(schema, value, path10, state, injectedProperties = {}) {
3101
+ if (!isPlainRecord(value)) {
3102
+ addExpectedIssue(state, path10, "object", value);
3103
+ return { present: true, value };
3104
+ }
3105
+ const nextValue = {};
3106
+ const allowedKeys = /* @__PURE__ */ new Set([...Object.keys(schema.shape), ...Object.keys(injectedProperties)]);
3107
+ for (const [key, propertySchema] of Object.entries(schema.shape)) {
3108
+ const propertyValue = Object.hasOwn(value, key) ? value[key] : missingValue;
3109
+ const result = walkSchema(propertySchema, propertyValue, [...path10, key], state);
3110
+ if (result.present) {
3111
+ setOwnValue(nextValue, key, result.value);
3112
+ }
3113
+ }
3114
+ for (const [key, injectedValue] of Object.entries(injectedProperties)) {
3115
+ if (Object.hasOwn(value, key)) {
3116
+ setOwnValue(nextValue, key, value[key]);
3117
+ } else {
3118
+ setOwnValue(nextValue, key, injectedValue);
3119
+ }
3120
+ }
3121
+ for (const [key, propertyValue] of Object.entries(value)) {
3122
+ if (allowedKeys.has(key)) {
3123
+ continue;
3124
+ }
3125
+ if (schema.additionalProperties === true) {
3126
+ setOwnValue(nextValue, key, propertyValue);
3127
+ } else {
3128
+ addUnexpectedPropertyIssue(state, [...path10, key]);
3129
+ }
3130
+ }
3131
+ return { present: true, value: nextValue };
3132
+ }
3133
+ function walkOneOf(schema, value, path10, state) {
3134
+ if (!isPlainRecord(value)) {
3135
+ addExpectedIssue(state, path10, "object", value);
3136
+ return { present: true, value };
3137
+ }
3138
+ const discriminatorValue = value[schema.discriminator];
3139
+ const discriminatorPath = [...path10, schema.discriminator];
3140
+ const branchValues = Object.keys(schema.branches);
3141
+ const expected = `one of ${branchValues.join(", ")}`;
3142
+ if (!Object.hasOwn(value, schema.discriminator)) {
3143
+ addIssueWithMessage(
3144
+ state,
3145
+ discriminatorPath,
3146
+ expected,
3147
+ "missing",
3148
+ `Missing discriminator "${schema.discriminator}" at ${formatPath(path10)}. Expected one of: ${branchValues.join(", ")}.`
3149
+ );
3150
+ return { present: true, value };
3151
+ }
3152
+ if (typeof discriminatorValue !== "string" || !Object.hasOwn(schema.branches, discriminatorValue)) {
3153
+ addIssueWithMessage(
3154
+ state,
3155
+ discriminatorPath,
3156
+ expected,
3157
+ receivedValue(discriminatorValue),
3158
+ `Expected ${expected} at ${formatPath(discriminatorPath)}, got ${formatReceivedDiscriminator(discriminatorValue)}`
3159
+ );
3160
+ return { present: true, value };
3161
+ }
3162
+ return walkObject(schema.branches[discriminatorValue], value, path10, state, {
3163
+ [schema.discriminator]: discriminatorValue
3164
+ });
3165
+ }
3166
+ function walkUnion(schema, value, path10, state) {
3167
+ if (isPlainRecord(value)) {
3168
+ const candidateBranches = schema.branches.filter((branch) => hasRequiredKeys(branch, value));
3169
+ if (candidateBranches.length === 1) {
3170
+ return walkObject(candidateBranches[0], value, path10, state);
3171
+ }
3172
+ }
3173
+ const matches = [];
3174
+ for (const branch of schema.branches) {
3175
+ const branchState = { issues: [] };
3176
+ const result = walkObject(branch, value, path10, branchState);
3177
+ if (branchState.issues.length === 0 && result.present) {
3178
+ matches.push({ fingerprint: getRequiredKeyFingerprint(branch), value: result.value });
3179
+ }
3180
+ }
3181
+ if (matches.length === 1) {
3182
+ return { present: true, value: matches[0].value };
3183
+ }
3184
+ if (matches.length === 0) {
3185
+ const branchDescriptions = schema.branches.map((branch) => getRequiredKeyFingerprint(branch));
3186
+ addIssueWithMessage(
3187
+ state,
3188
+ path10,
3189
+ "exactly one union branch",
3190
+ "0 matching branches",
3191
+ `No union branch matched at ${formatPath(path10)}. Tried ${schema.branches.length} branches. Expected one of: ${branchDescriptions.join(" | ")}.`
3192
+ );
3193
+ return { present: true, value };
3194
+ }
3195
+ addIssueWithMessage(
3196
+ state,
3197
+ path10,
3198
+ "exactly one union branch",
3199
+ `${matches.length} matching branches`,
3200
+ `Expected exactly one union branch at ${formatPath(path10)}, but matched more than one branch: ${matches.map((match) => match.fingerprint).join(" | ")}`
3201
+ );
3202
+ return { present: true, value };
3203
+ }
3204
+ function hasRequiredKeys(schema, value) {
3205
+ for (const [key, propertySchema] of Object.entries(schema.shape)) {
3206
+ if (propertySchema.kind !== "optional" && !Object.hasOwn(value, key)) {
3207
+ return false;
3208
+ }
3209
+ }
3210
+ return true;
3211
+ }
3212
+ function walkRecord(schema, value, path10, state) {
3213
+ if (!isPlainRecord(value)) {
3214
+ addExpectedIssue(state, path10, "object", value);
3215
+ return { present: true, value };
3216
+ }
3217
+ const nextValue = {};
3218
+ for (const [key, propertyValue] of Object.entries(value)) {
3219
+ const result = walkSchema(schema.value, propertyValue, [...path10, key], state);
3220
+ if (result.present) {
3221
+ setOwnValue(nextValue, key, result.value);
3222
+ }
3223
+ }
3224
+ return { present: true, value: nextValue };
3225
+ }
3226
+ function walkJson(value, path10, state) {
3227
+ if (isJsonValue(value)) {
3228
+ return { present: true, value };
3229
+ }
3230
+ addExpectedIssue(state, path10, "JSON value", value);
3231
+ return { present: true, value };
3232
+ }
3233
+ function getDefault(schema) {
3234
+ if (schema.default !== void 0) {
3235
+ return { present: true, value: schema.default };
3236
+ }
3237
+ if (schema.kind === "optional") {
3238
+ return getDefault(schema.inner);
3239
+ }
3240
+ return { present: false };
3241
+ }
3242
+ function isPlainRecord(value) {
3243
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
3244
+ return false;
3245
+ }
3246
+ const prototype = Object.getPrototypeOf(value);
3247
+ return prototype === Object.prototype || prototype === null;
3248
+ }
3249
+ function isJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
3250
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
3251
+ return typeof value !== "number" || Number.isFinite(value);
3252
+ }
3253
+ if (Array.isArray(value)) {
3254
+ if (ancestors.has(value)) {
3255
+ return false;
3256
+ }
3257
+ ancestors.add(value);
3258
+ const result = value.every((item) => isJsonValue(item, ancestors));
3259
+ ancestors.delete(value);
3260
+ return result;
3261
+ }
3262
+ if (isPlainRecord(value)) {
3263
+ if (ancestors.has(value)) {
3264
+ return false;
3265
+ }
3266
+ ancestors.add(value);
3267
+ const result = Object.values(value).every((item) => isJsonValue(item, ancestors));
3268
+ ancestors.delete(value);
3269
+ return result;
3270
+ }
3271
+ return false;
3272
+ }
3273
+ function cloneDefault(value) {
3274
+ return structuredClone(value);
3275
+ }
3276
+ function setOwnValue(target, key, value) {
3277
+ Object.defineProperty(target, key, {
3278
+ configurable: true,
3279
+ enumerable: true,
3280
+ writable: true,
3281
+ value
3282
+ });
3283
+ }
3284
+ function expectedFor(schema) {
3285
+ switch (schema.kind) {
3286
+ case "string":
3287
+ return "string";
3288
+ case "number":
3289
+ return schema.jsonType === "integer" ? "integer" : "number";
3290
+ case "boolean":
3291
+ return "boolean";
3292
+ case "enum":
3293
+ return `one of ${schema.values.join(", ")}`;
3294
+ case "array":
3295
+ return "array";
3296
+ case "object":
3297
+ case "oneOf":
3298
+ case "record":
3299
+ return "object";
3300
+ case "union":
3301
+ return "exactly one union branch";
3302
+ case "json":
3303
+ return "JSON value";
3304
+ case "optional":
3305
+ return expectedFor(schema.inner);
3306
+ }
3307
+ }
3308
+ function addExpectedIssue(state, path10, expected, value) {
3309
+ addIssue(
3310
+ state,
3311
+ path10,
3312
+ expected,
3313
+ receivedType(value),
3314
+ `Expected ${expected} at ${formatPath(path10)}`
3315
+ );
3316
+ }
3317
+ function addUnexpectedPropertyIssue(state, path10) {
3318
+ addIssue(
3319
+ state,
3320
+ path10,
3321
+ "no additional properties",
3322
+ "unknown property",
3323
+ `Unexpected property ${formatPath(path10)}`
3324
+ );
3325
+ }
3326
+ function addIssue(state, path10, expected, received, _message) {
3327
+ state.issues.push({
3328
+ path: path10,
3329
+ expected,
3330
+ received,
3331
+ message: formatIssueMessage(expected, path10, received)
3332
+ });
3333
+ }
3334
+ function addIssueWithMessage(state, path10, expected, received, message2) {
3335
+ state.issues.push({
3336
+ path: path10,
3337
+ expected,
3338
+ received,
3339
+ message: message2
3340
+ });
3341
+ }
3342
+ function formatIssueMessage(expected, path10, received) {
3343
+ return `Expected ${expected} at ${formatPath(path10)}, got ${received}`;
3344
+ }
3345
+ function formatPath(path10) {
3346
+ return path10.length === 0 ? "value" : path10.join(".");
3347
+ }
3348
+ function compilePattern(pattern) {
3349
+ try {
3350
+ return new RegExp(pattern);
3351
+ } catch {
3352
+ return void 0;
3353
+ }
3354
+ }
3355
+ function receivedType(value) {
3356
+ if (value === null) {
3357
+ return "null";
3358
+ }
3359
+ if (Array.isArray(value)) {
3360
+ return "array";
3361
+ }
3362
+ if (typeof value === "number" && Number.isInteger(value)) {
3363
+ return "integer";
3364
+ }
3365
+ return typeof value;
3366
+ }
3367
+ function receivedValue(value) {
3368
+ if (typeof value === "string") {
3369
+ return value;
3370
+ }
3371
+ if (value === void 0) {
3372
+ return "undefined";
3373
+ }
3374
+ return String(value);
3375
+ }
3376
+ function formatReceivedDiscriminator(value) {
3377
+ if (typeof value === "string") {
3378
+ return JSON.stringify(value);
3379
+ }
3380
+ return receivedValue(value);
3381
+ }
3382
+
2832
3383
  // ../toolcraft-schema/src/index.ts
2833
3384
  function assertValidEnumValues(values) {
2834
3385
  if (values.length === 0) {
@@ -2852,6 +3403,22 @@ function assertFiniteNumber(value, name) {
2852
3403
  throw new Error(`${name} must be finite`);
2853
3404
  }
2854
3405
  }
3406
+ function assertMinMaxOrder(minimum, maximum, minimumName, maximumName) {
3407
+ if (minimum !== void 0 && maximum !== void 0 && minimum > maximum) {
3408
+ throw new Error(`${minimumName} must be less than or equal to ${maximumName}`);
3409
+ }
3410
+ }
3411
+ function assertValidDefault(schema) {
3412
+ if (schema.default === void 0) {
3413
+ return;
3414
+ }
3415
+ const result = validate(schema, schema.default);
3416
+ if (!result.ok) {
3417
+ throw new Error(
3418
+ `default must satisfy schema: ${result.issues[0]?.message ?? "invalid default"}`
3419
+ );
3420
+ }
3421
+ }
2855
3422
  function assertPattern(pattern) {
2856
3423
  if (pattern === void 0) {
2857
3424
  return;
@@ -2866,56 +3433,71 @@ var S = {
2866
3433
  String(options = {}) {
2867
3434
  assertNonNegativeInteger(options.minLength, "minLength");
2868
3435
  assertNonNegativeInteger(options.maxLength, "maxLength");
3436
+ assertMinMaxOrder(options.minLength, options.maxLength, "minLength", "maxLength");
2869
3437
  assertPattern(options.pattern);
2870
- return {
3438
+ const schema = {
2871
3439
  kind: "string",
2872
3440
  ...options
2873
3441
  };
3442
+ assertValidDefault(schema);
3443
+ return schema;
2874
3444
  },
2875
3445
  Number(options = {}) {
2876
3446
  assertFiniteNumber(options.minimum, "minimum");
2877
3447
  assertFiniteNumber(options.maximum, "maximum");
3448
+ assertMinMaxOrder(options.minimum, options.maximum, "minimum", "maximum");
2878
3449
  assertFiniteNumber(options.default, "default");
2879
3450
  if (options.jsonType === "integer" && options.default !== void 0 && !Number.isInteger(options.default)) {
2880
3451
  throw new Error("default must be an integer");
2881
3452
  }
2882
- return {
3453
+ const schema = {
2883
3454
  kind: "number",
2884
3455
  ...options
2885
3456
  };
3457
+ assertValidDefault(schema);
3458
+ return schema;
2886
3459
  },
2887
3460
  Boolean(options = {}) {
2888
- return {
3461
+ const schema = {
2889
3462
  kind: "boolean",
2890
3463
  ...options
2891
3464
  };
3465
+ assertValidDefault(schema);
3466
+ return schema;
2892
3467
  },
2893
3468
  Enum(values, options = {}) {
2894
3469
  assertValidEnumValues(values);
2895
3470
  if (options.jsonType === "integer" && values.some((value) => typeof value !== "number" || !Number.isInteger(value))) {
2896
3471
  throw new Error("Integer enum values must be integers");
2897
3472
  }
2898
- return {
3473
+ const schema = {
2899
3474
  kind: "enum",
2900
3475
  values,
2901
3476
  ...options
2902
3477
  };
3478
+ assertValidDefault(schema);
3479
+ return schema;
2903
3480
  },
2904
3481
  Array(item, options = {}) {
2905
3482
  assertNonNegativeInteger(options.minItems, "minItems");
2906
3483
  assertNonNegativeInteger(options.maxItems, "maxItems");
2907
- return {
3484
+ assertMinMaxOrder(options.minItems, options.maxItems, "minItems", "maxItems");
3485
+ const schema = {
2908
3486
  kind: "array",
2909
3487
  item,
2910
3488
  ...options
2911
3489
  };
3490
+ assertValidDefault(schema);
3491
+ return schema;
2912
3492
  },
2913
3493
  Object(shape, options = {}) {
2914
- return {
3494
+ const schema = {
2915
3495
  kind: "object",
2916
3496
  shape,
2917
3497
  ...options
2918
3498
  };
3499
+ assertValidDefault(schema);
3500
+ return schema;
2919
3501
  },
2920
3502
  Optional(inner) {
2921
3503
  return {
@@ -3064,6 +3646,7 @@ function createBaseCommand(config2) {
3064
3646
  kind: "command",
3065
3647
  name: config2.name,
3066
3648
  description: config2.description,
3649
+ hidden: config2.hidden ?? false,
3067
3650
  examples: cloneCommandExamples(config2.examples),
3068
3651
  aliases: [...config2.aliases ?? []],
3069
3652
  positional: [...config2.positional ?? []],
@@ -3080,6 +3663,7 @@ function createBaseCommand(config2) {
3080
3663
  Object.defineProperty(command, commandConfigSymbol, {
3081
3664
  value: {
3082
3665
  scope: cloneScope(config2.scope),
3666
+ hidden: config2.hidden ?? false,
3083
3667
  examples: cloneCommandExamples(config2.examples),
3084
3668
  result: config2.result,
3085
3669
  humanInLoop: config2.humanInLoop,
@@ -3099,6 +3683,7 @@ function materializeCommand(command, inherited) {
3099
3683
  kind: "command",
3100
3684
  name: command.name,
3101
3685
  description: command.description,
3686
+ hidden: internal.hidden,
3102
3687
  examples: cloneCommandExamples(internal.examples),
3103
3688
  aliases: [...command.aliases],
3104
3689
  positional: [...command.positional],
@@ -3115,6 +3700,7 @@ function materializeCommand(command, inherited) {
3115
3700
  Object.defineProperty(materialized, commandConfigSymbol, {
3116
3701
  value: {
3117
3702
  scope: cloneScope(internal.scope),
3703
+ hidden: internal.hidden,
3118
3704
  examples: cloneCommandExamples(internal.examples),
3119
3705
  result: internal.result,
3120
3706
  humanInLoop: internal.humanInLoop,