@monkey-mini-app/dsh-mini-app 0.1.0 → 0.1.4

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/README.md +59 -0
  2. package/assets/apps-list.png +0 -0
  3. package/assets/complex-demo-app.png +0 -0
  4. package/assets/demo-app.png +0 -0
  5. package/assets/home.png +0 -0
  6. package/assets/sidebar-mode.png +0 -0
  7. package/lib/client.js +2024 -783
  8. package/lib/index.d.ts +5 -2
  9. package/lib/index.js +29 -16
  10. package/package.json +12 -10
  11. package/skills/monkey-mini-app/SKILL.md +182 -106
  12. package/skills/monkey-mini-app/references/catalog.md +236 -99
  13. package/skills/monkey-mini-app/references/contracts/accordion.md +30 -0
  14. package/skills/monkey-mini-app/references/contracts/activity-feed.md +12 -2
  15. package/skills/monkey-mini-app/references/contracts/alert-dialog.md +38 -0
  16. package/skills/monkey-mini-app/references/contracts/alert.md +38 -0
  17. package/skills/monkey-mini-app/references/contracts/app-shell.md +2 -2
  18. package/skills/monkey-mini-app/references/contracts/aspect-ratio.md +25 -0
  19. package/skills/monkey-mini-app/references/contracts/attachment-gallery.md +12 -2
  20. package/skills/monkey-mini-app/references/contracts/attachment.md +35 -0
  21. package/skills/monkey-mini-app/references/contracts/autocomplete.md +12 -2
  22. package/skills/monkey-mini-app/references/contracts/avatar.md +24 -0
  23. package/skills/monkey-mini-app/references/contracts/badge.md +26 -0
  24. package/skills/monkey-mini-app/references/contracts/breadcrumb.md +33 -0
  25. package/skills/monkey-mini-app/references/contracts/bubble.md +30 -0
  26. package/skills/monkey-mini-app/references/contracts/button-group.md +36 -0
  27. package/skills/monkey-mini-app/references/contracts/button.md +26 -0
  28. package/skills/monkey-mini-app/references/contracts/calendar.md +20 -0
  29. package/skills/monkey-mini-app/references/contracts/card.md +41 -0
  30. package/skills/monkey-mini-app/references/contracts/cascader.md +12 -2
  31. package/skills/monkey-mini-app/references/contracts/chart.md +32 -0
  32. package/skills/monkey-mini-app/references/contracts/checkbox.md +19 -0
  33. package/skills/monkey-mini-app/references/contracts/code-block.md +20 -2
  34. package/skills/monkey-mini-app/references/contracts/code-editor.md +30 -4
  35. package/skills/monkey-mini-app/references/contracts/collapsible.md +21 -0
  36. package/skills/monkey-mini-app/references/contracts/color-picker.md +12 -2
  37. package/skills/monkey-mini-app/references/contracts/combobox.md +34 -0
  38. package/skills/monkey-mini-app/references/contracts/command.md +41 -0
  39. package/skills/monkey-mini-app/references/contracts/comment-thread.md +12 -2
  40. package/skills/monkey-mini-app/references/contracts/commit-graph.md +50 -0
  41. package/skills/monkey-mini-app/references/contracts/confirm-dialog.md +20 -2
  42. package/skills/monkey-mini-app/references/contracts/context-menu.md +41 -0
  43. package/skills/monkey-mini-app/references/contracts/copyable.md +12 -2
  44. package/skills/monkey-mini-app/references/contracts/currency-input.md +12 -2
  45. package/skills/monkey-mini-app/references/contracts/dashboard-shell.md +41 -0
  46. package/skills/monkey-mini-app/references/contracts/data-grid.md +13 -6
  47. package/skills/monkey-mini-app/references/contracts/date-picker.md +20 -2
  48. package/skills/monkey-mini-app/references/contracts/date-range-picker.md +10 -2
  49. package/skills/monkey-mini-app/references/contracts/date-time-picker.md +20 -2
  50. package/skills/monkey-mini-app/references/contracts/date-time-range-picker.md +20 -2
  51. package/skills/monkey-mini-app/references/contracts/description-list.md +12 -2
  52. package/skills/monkey-mini-app/references/contracts/detail-panel.md +10 -2
  53. package/skills/monkey-mini-app/references/contracts/dialog.md +44 -0
  54. package/skills/monkey-mini-app/references/contracts/diff-viewer.md +21 -2
  55. package/skills/monkey-mini-app/references/contracts/donut-chart.md +14 -2
  56. package/skills/monkey-mini-app/references/contracts/drawer.md +29 -0
  57. package/skills/monkey-mini-app/references/contracts/dropdown-menu.md +49 -0
  58. package/skills/monkey-mini-app/references/contracts/duration-input.md +20 -2
  59. package/skills/monkey-mini-app/references/contracts/empty.md +40 -0
  60. package/skills/monkey-mini-app/references/contracts/env-badge.md +12 -2
  61. package/skills/monkey-mini-app/references/contracts/env-table.md +46 -0
  62. package/skills/monkey-mini-app/references/contracts/event-calendar.md +28 -20
  63. package/skills/monkey-mini-app/references/contracts/field.md +34 -0
  64. package/skills/monkey-mini-app/references/contracts/file-dropzone.md +20 -2
  65. package/skills/monkey-mini-app/references/contracts/file-tree.md +12 -2
  66. package/skills/monkey-mini-app/references/contracts/filter-bar.md +2 -2
  67. package/skills/monkey-mini-app/references/contracts/form-sheet.md +51 -0
  68. package/skills/monkey-mini-app/references/contracts/gantt.md +20 -2
  69. package/skills/monkey-mini-app/references/contracts/gauge.md +14 -2
  70. package/skills/monkey-mini-app/references/contracts/hover-card.md +21 -0
  71. package/skills/monkey-mini-app/references/contracts/input-group.md +24 -0
  72. package/skills/monkey-mini-app/references/contracts/input.md +33 -0
  73. package/skills/monkey-mini-app/references/contracts/item.md +36 -0
  74. package/skills/monkey-mini-app/references/contracts/jira-wiki.md +3 -4
  75. package/skills/monkey-mini-app/references/contracts/jql-input.md +15 -8
  76. package/skills/monkey-mini-app/references/contracts/json-viewer.md +20 -2
  77. package/skills/monkey-mini-app/references/contracts/kanban-issue-panel.md +12 -2
  78. package/skills/monkey-mini-app/references/contracts/kanban.md +10 -2
  79. package/skills/monkey-mini-app/references/contracts/kbd.md +20 -0
  80. package/skills/monkey-mini-app/references/contracts/label.md +33 -0
  81. package/skills/monkey-mini-app/references/contracts/list-detail.md +46 -0
  82. package/skills/monkey-mini-app/references/contracts/log-viewer.md +45 -4
  83. package/skills/monkey-mini-app/references/contracts/markdown-editor.md +20 -2
  84. package/skills/monkey-mini-app/references/contracts/markdown.md +12 -2
  85. package/skills/monkey-mini-app/references/contracts/marker.md +30 -0
  86. package/skills/monkey-mini-app/references/contracts/menubar.md +34 -0
  87. package/skills/monkey-mini-app/references/contracts/message-scroller.md +24 -0
  88. package/skills/monkey-mini-app/references/contracts/message.md +24 -0
  89. package/skills/monkey-mini-app/references/contracts/mini-calendar.md +20 -2
  90. package/skills/monkey-mini-app/references/contracts/native-select.md +21 -0
  91. package/skills/monkey-mini-app/references/contracts/navigation-menu.md +27 -0
  92. package/skills/monkey-mini-app/references/contracts/notification-center.md +12 -2
  93. package/skills/monkey-mini-app/references/contracts/number-field.md +20 -2
  94. package/skills/monkey-mini-app/references/contracts/page-header.md +2 -2
  95. package/skills/monkey-mini-app/references/contracts/pagination.md +33 -0
  96. package/skills/monkey-mini-app/references/contracts/password-field.md +12 -2
  97. package/skills/monkey-mini-app/references/contracts/phone-input.md +12 -2
  98. package/skills/monkey-mini-app/references/contracts/popover.md +32 -0
  99. package/skills/monkey-mini-app/references/contracts/progress-ring.md +14 -2
  100. package/skills/monkey-mini-app/references/contracts/progress.md +39 -0
  101. package/skills/monkey-mini-app/references/contracts/questionnaire.md +33 -0
  102. package/skills/monkey-mini-app/references/contracts/radar-chart.md +14 -2
  103. package/skills/monkey-mini-app/references/contracts/radio-group.md +20 -0
  104. package/skills/monkey-mini-app/references/contracts/rating.md +12 -2
  105. package/skills/monkey-mini-app/references/contracts/relative-date-picker.md +20 -2
  106. package/skills/monkey-mini-app/references/contracts/request-inspector.md +12 -2
  107. package/skills/monkey-mini-app/references/contracts/resizable.md +29 -0
  108. package/skills/monkey-mini-app/references/contracts/reveal.md +31 -0
  109. package/skills/monkey-mini-app/references/contracts/rich-text-editor.md +14 -2
  110. package/skills/monkey-mini-app/references/contracts/run-timeline.md +20 -2
  111. package/skills/monkey-mini-app/references/contracts/scroll-area.md +20 -0
  112. package/skills/monkey-mini-app/references/contracts/scrollspy.md +20 -2
  113. package/skills/monkey-mini-app/references/contracts/search-input.md +12 -2
  114. package/skills/monkey-mini-app/references/contracts/select.md +36 -0
  115. package/skills/monkey-mini-app/references/contracts/separator.md +27 -0
  116. package/skills/monkey-mini-app/references/contracts/settings-split.md +53 -0
  117. package/skills/monkey-mini-app/references/contracts/severity-chip.md +12 -2
  118. package/skills/monkey-mini-app/references/contracts/sheet.md +34 -0
  119. package/skills/monkey-mini-app/references/contracts/sidebar.md +42 -0
  120. package/skills/monkey-mini-app/references/contracts/skeleton.md +33 -0
  121. package/skills/monkey-mini-app/references/contracts/slider-range.md +12 -2
  122. package/skills/monkey-mini-app/references/contracts/slider.md +25 -0
  123. package/skills/monkey-mini-app/references/contracts/sortable-list.md +20 -2
  124. package/skills/monkey-mini-app/references/contracts/sparkline.md +13 -2
  125. package/skills/monkey-mini-app/references/contracts/spinner.md +31 -0
  126. package/skills/monkey-mini-app/references/contracts/stacked-bar-chart.md +17 -2
  127. package/skills/monkey-mini-app/references/contracts/stat-card.md +2 -2
  128. package/skills/monkey-mini-app/references/contracts/status-badge.md +2 -2
  129. package/skills/monkey-mini-app/references/contracts/stepper-item.md +39 -0
  130. package/skills/monkey-mini-app/references/contracts/stepper.md +38 -11
  131. package/skills/monkey-mini-app/references/contracts/switch.md +25 -0
  132. package/skills/monkey-mini-app/references/contracts/table-page.md +41 -0
  133. package/skills/monkey-mini-app/references/contracts/table.md +42 -0
  134. package/skills/monkey-mini-app/references/contracts/tabs.md +31 -0
  135. package/skills/monkey-mini-app/references/contracts/tag-input.md +12 -2
  136. package/skills/monkey-mini-app/references/contracts/terminal.md +13 -2
  137. package/skills/monkey-mini-app/references/contracts/test-step-list.md +12 -2
  138. package/skills/monkey-mini-app/references/contracts/textarea.md +25 -0
  139. package/skills/monkey-mini-app/references/contracts/time-picker.md +18 -2
  140. package/skills/monkey-mini-app/references/contracts/time-range-picker.md +20 -2
  141. package/skills/monkey-mini-app/references/contracts/time-wheel.md +6 -2
  142. package/skills/monkey-mini-app/references/contracts/timeline.md +20 -2
  143. package/skills/monkey-mini-app/references/contracts/timezone-select.md +20 -2
  144. package/skills/monkey-mini-app/references/contracts/toast.md +39 -0
  145. package/skills/monkey-mini-app/references/contracts/toggle-group.md +28 -0
  146. package/skills/monkey-mini-app/references/contracts/toggle.md +26 -0
  147. package/skills/monkey-mini-app/references/contracts/tooltip.md +30 -0
  148. package/skills/monkey-mini-app/references/contracts/transfer.md +12 -2
  149. package/skills/monkey-mini-app/references/contracts/tree-view.md +20 -2
  150. package/skills/monkey-mini-app/references/contracts/trend-card.md +12 -2
  151. package/skills/monkey-mini-app/references/contracts/user-picker.md +12 -2
  152. package/skills/monkey-mini-app/references/contracts/wizard-shell.md +56 -0
  153. package/skills/monkey-mini-app/references/ctx.md +123 -53
  154. package/skills/monkey-mini-app/references/eval.md +115 -0
  155. package/skills/monkey-mini-app/references/examples/alert/alert-01.tsx +17 -0
  156. package/skills/monkey-mini-app/references/examples/aspect-ratio/aspect-ratio-01.tsx +16 -0
  157. package/skills/monkey-mini-app/references/examples/attachment/attachment-01.tsx +19 -0
  158. package/skills/monkey-mini-app/references/examples/breadcrumb/breadcrumb-01.tsx +31 -0
  159. package/skills/monkey-mini-app/references/examples/bubble/bubble-01.tsx +16 -0
  160. package/skills/monkey-mini-app/references/examples/button-group/button-group-01.tsx +23 -0
  161. package/skills/monkey-mini-app/references/examples/card/card-01.tsx +19 -0
  162. package/skills/monkey-mini-app/references/examples/charts-blocks.md +15 -0
  163. package/skills/monkey-mini-app/references/examples/code-block/code-block-01.tsx +14 -0
  164. package/skills/monkey-mini-app/references/examples/code-editor/code-editor-01.tsx +15 -0
  165. package/skills/monkey-mini-app/references/examples/command/command-01.tsx +30 -0
  166. package/skills/monkey-mini-app/references/examples/confirm-dialog/confirm-dialog-01.tsx +33 -0
  167. package/skills/monkey-mini-app/references/examples/context-menu/context-menu-01.tsx +29 -0
  168. package/skills/monkey-mini-app/references/examples/dashboard-shell/dashboard-shell-01.tsx +78 -0
  169. package/skills/monkey-mini-app/references/examples/data-grid/data-grid-01.tsx +34 -0
  170. package/skills/monkey-mini-app/references/examples/data-grid/data-grid-02.tsx +88 -0
  171. package/skills/monkey-mini-app/references/examples/date-picker/date-picker-01.tsx +14 -0
  172. package/skills/monkey-mini-app/references/examples/date-range-picker/date-range-picker-01.tsx +14 -0
  173. package/skills/monkey-mini-app/references/examples/date-time-picker/date-time-picker-01.tsx +16 -0
  174. package/skills/monkey-mini-app/references/examples/date-time-range-picker/date-time-range-picker-01.tsx +15 -0
  175. package/skills/monkey-mini-app/references/examples/detail-panel/detail-panel-01.tsx +21 -0
  176. package/skills/monkey-mini-app/references/examples/dialog/dialog-01.tsx +30 -0
  177. package/skills/monkey-mini-app/references/examples/diff-viewer/diff-viewer-01.tsx +10 -0
  178. package/skills/monkey-mini-app/references/examples/dropdown-menu/dropdown-menu-01.tsx +31 -0
  179. package/skills/monkey-mini-app/references/examples/duration-input/duration-input-01.tsx +20 -0
  180. package/skills/monkey-mini-app/references/examples/editors.md +11 -0
  181. package/skills/monkey-mini-app/references/examples/empty/empty-01.tsx +19 -0
  182. package/skills/monkey-mini-app/references/examples/event-calendar/event-calendar-01.tsx +53 -0
  183. package/skills/monkey-mini-app/references/examples/file-dropzone/file-dropzone-01.tsx +14 -0
  184. package/skills/monkey-mini-app/references/examples/form-sheet/form-sheet-01.tsx +85 -0
  185. package/skills/monkey-mini-app/references/examples/forms.md +16 -0
  186. package/skills/monkey-mini-app/references/examples/gantt/gantt-01.tsx +29 -0
  187. package/skills/monkey-mini-app/references/examples/input/input-01.tsx +10 -0
  188. package/skills/monkey-mini-app/references/examples/item/item-01.tsx +19 -0
  189. package/skills/monkey-mini-app/references/examples/jql-input/jql-input-01.tsx +33 -0
  190. package/skills/monkey-mini-app/references/examples/json-viewer/json-viewer-01.tsx +10 -0
  191. package/skills/monkey-mini-app/references/examples/kanban/kanban-01.tsx +60 -0
  192. package/skills/monkey-mini-app/references/examples/label/label-01.tsx +10 -0
  193. package/skills/monkey-mini-app/references/examples/list-detail/list-detail-01.tsx +117 -0
  194. package/skills/monkey-mini-app/references/examples/log-viewer/log-viewer-01.tsx +20 -0
  195. package/skills/monkey-mini-app/references/examples/markdown-editor/markdown-editor-01.tsx +18 -0
  196. package/skills/monkey-mini-app/references/examples/marker/marker-01.tsx +16 -0
  197. package/skills/monkey-mini-app/references/examples/mini-calendar/mini-calendar-01.tsx +14 -0
  198. package/skills/monkey-mini-app/references/examples/misc-charts-blocks/misc-charts-blocks-01.tsx +20 -0
  199. package/skills/monkey-mini-app/references/examples/misc-charts-blocks/misc-charts-blocks-02.tsx +32 -0
  200. package/skills/monkey-mini-app/references/examples/misc-charts-blocks/misc-charts-blocks-03.tsx +47 -0
  201. package/skills/monkey-mini-app/references/examples/misc-charts-blocks/misc-charts-blocks-04.tsx +20 -0
  202. package/skills/monkey-mini-app/references/examples/misc-charts-blocks/misc-charts-blocks-05.tsx +24 -0
  203. package/skills/monkey-mini-app/references/examples/misc-charts-blocks/misc-charts-blocks-06.tsx +89 -0
  204. package/skills/monkey-mini-app/references/examples/misc-editors/misc-editors-01.tsx +114 -0
  205. package/skills/monkey-mini-app/references/examples/misc-editors/misc-editors-02.tsx +33 -0
  206. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-01.tsx +22 -0
  207. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-02.tsx +37 -0
  208. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-03.tsx +42 -0
  209. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-04.tsx +25 -0
  210. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-05.tsx +27 -0
  211. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-06.tsx +33 -0
  212. package/skills/monkey-mini-app/references/examples/misc-forms/misc-forms-07.tsx +44 -0
  213. package/skills/monkey-mini-app/references/examples/misc-overlays/misc-overlays-01.tsx +43 -0
  214. package/skills/monkey-mini-app/references/examples/misc-overlays/misc-overlays-02.tsx +38 -0
  215. package/skills/monkey-mini-app/references/examples/misc-primitives/misc-primitives-01.tsx +21 -0
  216. package/skills/monkey-mini-app/references/examples/misc-primitives/misc-primitives-02.tsx +52 -0
  217. package/skills/monkey-mini-app/references/examples/misc-primitives/misc-primitives-03.tsx +44 -0
  218. package/skills/monkey-mini-app/references/examples/number-field/number-field-01.tsx +22 -0
  219. package/skills/monkey-mini-app/references/examples/overlays.md +11 -0
  220. package/skills/monkey-mini-app/references/examples/pagination/pagination-01.tsx +51 -0
  221. package/skills/monkey-mini-app/references/examples/primitives.md +12 -0
  222. package/skills/monkey-mini-app/references/examples/progress/progress-01.tsx +10 -0
  223. package/skills/monkey-mini-app/references/examples/relative-date-picker/relative-date-picker-01.tsx +19 -0
  224. package/skills/monkey-mini-app/references/examples/rich-text-editor/rich-text-editor-01.tsx +15 -0
  225. package/skills/monkey-mini-app/references/examples/run-timeline/run-timeline-01.tsx +17 -0
  226. package/skills/monkey-mini-app/references/examples/scrollspy/scrollspy-01.tsx +29 -0
  227. package/skills/monkey-mini-app/references/examples/separator/separator-01.tsx +10 -0
  228. package/skills/monkey-mini-app/references/examples/settings-split/settings-split-01.tsx +84 -0
  229. package/skills/monkey-mini-app/references/examples/shared/jira-wiki-sample.ts +38 -0
  230. package/skills/monkey-mini-app/references/examples/skeleton/skeleton-01.tsx +10 -0
  231. package/skills/monkey-mini-app/references/examples/slider/slider-01.tsx +22 -0
  232. package/skills/monkey-mini-app/references/examples/sortable-list/sortable-list-01.tsx +18 -0
  233. package/skills/monkey-mini-app/references/examples/spinner/spinner-01.tsx +10 -0
  234. package/skills/monkey-mini-app/references/examples/stepper/stepper-01.tsx +41 -0
  235. package/skills/monkey-mini-app/references/examples/table/table-01.tsx +25 -0
  236. package/skills/monkey-mini-app/references/examples/table-page/table-page-01.tsx +103 -0
  237. package/skills/monkey-mini-app/references/examples/time-picker/time-picker-01.tsx +19 -0
  238. package/skills/monkey-mini-app/references/examples/time-range-picker/time-range-picker-01.tsx +14 -0
  239. package/skills/monkey-mini-app/references/examples/timeline/timeline-01.tsx +18 -0
  240. package/skills/monkey-mini-app/references/examples/timezone-select/timezone-select-01.tsx +15 -0
  241. package/skills/monkey-mini-app/references/examples/toggle/toggle-01.tsx +20 -0
  242. package/skills/monkey-mini-app/references/examples/toggle-group/toggle-group-01.tsx +22 -0
  243. package/skills/monkey-mini-app/references/examples/tree-view/tree-view-01.tsx +25 -0
  244. package/skills/monkey-mini-app/references/examples/wizard-shell/wizard-shell-01.tsx +58 -0
  245. package/skills/monkey-mini-app/references/history.md +23 -7
  246. package/skills/monkey-mini-app/references/icons.md +99 -69
  247. package/skills/monkey-mini-app/references/llm-json.md +39 -26
  248. package/skills/monkey-mini-app/references/loader.md +47 -20
  249. package/skills/monkey-mini-app/references/looks/aurora-bento.md +88 -0
  250. package/skills/monkey-mini-app/references/looks/desk-split.md +89 -0
  251. package/skills/monkey-mini-app/references/looks/editorial.md +78 -0
  252. package/skills/monkey-mini-app/references/looks/glass-island.md +90 -0
  253. package/skills/monkey-mini-app/references/looks/index.md +18 -0
  254. package/skills/monkey-mini-app/references/looks/signage.md +74 -0
  255. package/skills/monkey-mini-app/references/looks/tape.md +22 -0
  256. package/skills/monkey-mini-app/references/looks/terminal.md +88 -0
  257. package/skills/monkey-mini-app/references/looks/void.md +22 -0
  258. package/skills/monkey-mini-app/references/styling.md +189 -0
  259. package/skills/monkey-mini-app/references/test.md +12 -12
  260. package/skills/monkey-mini-app/references/theme.md +197 -0
  261. package/skills/monkey-mini-app/references/tools.md +12 -12
  262. package/skills/monkey-mini-app/references/troubleshoot.md +165 -12
  263. package/skills/monkey-mini-app/templates/README.md +33 -21
  264. package/skills/monkey-mini-app/templates/{jira → board}/main.api.ts +11 -11
  265. package/skills/monkey-mini-app/templates/board/manifest.json +8 -0
  266. package/skills/monkey-mini-app/templates/board/theme.css +46 -0
  267. package/skills/monkey-mini-app/templates/board/ui.tsx +546 -0
  268. package/skills/monkey-mini-app/templates/chores/main.api.ts +35 -0
  269. package/skills/monkey-mini-app/templates/chores/manifest.json +8 -0
  270. package/skills/monkey-mini-app/templates/chores/theme.css +46 -0
  271. package/skills/monkey-mini-app/templates/chores/ui.tsx +117 -0
  272. package/skills/monkey-mini-app/templates/minimal/main.api.ts +5 -5
  273. package/skills/monkey-mini-app/templates/minimal/manifest.json +1 -2
  274. package/skills/monkey-mini-app/templates/minimal/ui.tsx +17 -8
  275. package/skills/monkey-mini-app/templates/radar/api/scan.ts +79 -0
  276. package/skills/monkey-mini-app/templates/radar/main.api.ts +29 -0
  277. package/skills/monkey-mini-app/templates/radar/manifest.json +8 -0
  278. package/skills/monkey-mini-app/templates/radar/shared/events.ts +25 -0
  279. package/skills/monkey-mini-app/templates/{insights/lib → radar/shared}/sample.ts +1 -1
  280. package/skills/monkey-mini-app/templates/radar/theme.css +47 -0
  281. package/skills/monkey-mini-app/templates/radar/ui/brief.tsx +31 -0
  282. package/skills/monkey-mini-app/templates/radar/ui.tsx +131 -0
  283. package/skills/monkey-mini-app/templates/runner/main.api.ts +91 -0
  284. package/skills/monkey-mini-app/templates/runner/manifest.json +8 -0
  285. package/skills/monkey-mini-app/templates/runner/shared/events.ts +14 -0
  286. package/skills/monkey-mini-app/templates/runner/theme.css +46 -0
  287. package/skills/monkey-mini-app/templates/runner/ui.tsx +213 -0
  288. package/skills/monkey-mini-app/templates/sheets/main.api.ts +276 -0
  289. package/skills/monkey-mini-app/templates/sheets/manifest.json +8 -0
  290. package/skills/monkey-mini-app/templates/sheets/theme.css +46 -0
  291. package/skills/monkey-mini-app/templates/sheets/ui.tsx +419 -0
  292. package/skills/monkey-mini-app/templates/{todo → today}/main.api.ts +8 -8
  293. package/skills/monkey-mini-app/templates/today/manifest.json +8 -0
  294. package/skills/monkey-mini-app/templates/today/theme.css +45 -0
  295. package/skills/monkey-mini-app/templates/today/ui/item-row.tsx +25 -0
  296. package/skills/monkey-mini-app/templates/today/ui.tsx +406 -0
  297. package/skills/monkey-mini-app/templates/{monitor → watch}/main.api.ts +8 -8
  298. package/skills/monkey-mini-app/templates/watch/manifest.json +8 -0
  299. package/skills/monkey-mini-app/templates/watch/ui.tsx +187 -0
  300. package/skills/monkey-mini-app/tsconfig.json +31 -0
  301. package/skills/monkey-mini-app/types/cdn.d.ts +1 -0
  302. package/tsup.config.ts +1 -0
  303. package/skills/monkey-mini-app/templates/agentrun/main.api.ts +0 -78
  304. package/skills/monkey-mini-app/templates/agentrun/manifest.json +0 -9
  305. package/skills/monkey-mini-app/templates/agentrun/ui.tsx +0 -125
  306. package/skills/monkey-mini-app/templates/insights/main.api.ts +0 -101
  307. package/skills/monkey-mini-app/templates/insights/manifest.json +0 -9
  308. package/skills/monkey-mini-app/templates/insights/ui.tsx +0 -138
  309. package/skills/monkey-mini-app/templates/jira/manifest.json +0 -9
  310. package/skills/monkey-mini-app/templates/jira/ui.tsx +0 -318
  311. package/skills/monkey-mini-app/templates/monitor/manifest.json +0 -9
  312. package/skills/monkey-mini-app/templates/monitor/ui.tsx +0 -176
  313. package/skills/monkey-mini-app/templates/review/main.api.ts +0 -68
  314. package/skills/monkey-mini-app/templates/review/manifest.json +0 -9
  315. package/skills/monkey-mini-app/templates/review/ui.tsx +0 -159
  316. package/skills/monkey-mini-app/templates/todo/manifest.json +0 -8
  317. package/skills/monkey-mini-app/templates/todo/ui.tsx +0 -177
package/lib/index.d.ts CHANGED
@@ -2,12 +2,15 @@ import { HostConfig, AbsolutePath, AppCallContext, AgentRunOptions, HostCapabili
2
2
 
3
3
  type DshPluginConfig = {
4
4
  runtimeRoot?: string;
5
+ /** Override skill install dir. Default: ~/.dsh/skills/monkey-mini-app. */
6
+ skillDest?: string;
5
7
  };
6
8
  /** Locate runtimeRoot from plugin config only when provided; else bootstrap seed path. */
7
9
  declare function resolveRuntimeRoot(config?: DshPluginConfig): AbsolutePath;
8
10
  /**
9
- * Runtime load: read host.json, no field defaults.
10
- * Missing file fails loud with an install/init hint.
11
+ * Runtime load: read host.json.
12
+ * A missing file is bootstrapped on first run (so `dsh plugin add` just works);
13
+ * a present-but-corrupt host.json still fails loud (never silently patched).
11
14
  */
12
15
  declare function loadPluginHostConfig(config?: DshPluginConfig): HostConfig;
13
16
 
package/lib/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  // src/index.ts
2
+ import path5 from "path";
2
3
  import { createHost } from "@monkey-mini-app/host";
3
4
 
4
5
  // src/apply-config.ts
6
+ import { mkdirSync, writeFileSync } from "fs";
5
7
  import { homedir } from "os";
6
8
  import path from "path";
7
9
  import {
8
10
  asAbsolutePath,
9
11
  bootstrapHostConfig,
10
- createHostI18n,
11
12
  HostConfigError,
12
13
  loadHostConfig,
13
14
  WorkspacePaths
@@ -31,11 +32,6 @@ function resolveRuntimeRoot(config = {}) {
31
32
  }
32
33
  return bootstrapHostConfig({}).runtimeRoot;
33
34
  }
34
- function missingConfigError(file, cause) {
35
- const i18n = createHostI18n("zh-CN");
36
- const message = `${i18n.t("config.missingFile", { path: file })} ${i18n.t("config.missingHint")}`;
37
- return new HostConfigError(message, { code: "HOST_CONFIG_NOT_FOUND", cause });
38
- }
39
35
  function loadPluginHostConfig(config = {}) {
40
36
  const runtimeRoot = resolveRuntimeRoot(config);
41
37
  const paths = new WorkspacePaths(runtimeRoot);
@@ -43,7 +39,12 @@ function loadPluginHostConfig(config = {}) {
43
39
  return loadHostConfig(paths);
44
40
  } catch (cause) {
45
41
  if (cause instanceof HostConfigError && cause.code === "HOST_CONFIG_NOT_FOUND") {
46
- throw missingConfigError(paths.hostConfigFile(), cause);
42
+ const cfg = bootstrapHostConfig({ runtimeRoot });
43
+ mkdirSync(cfg.runtimeRoot, { recursive: true });
44
+ mkdirSync(paths.appsDir(), { recursive: true });
45
+ writeFileSync(paths.hostConfigFile(), `${JSON.stringify(cfg, null, 2)}
46
+ `);
47
+ return cfg;
47
48
  }
48
49
  throw cause;
49
50
  }
@@ -215,6 +216,7 @@ function resolveLlmRoute(ctx, opts, hostLlm) {
215
216
  }
216
217
 
217
218
  // src/llm-stream.ts
219
+ import { DEFAULT_LLM_MAX_TOKENS } from "@monkey-mini-app/host";
218
220
  function stringifyToolResult(value) {
219
221
  if (typeof value === "string") return value;
220
222
  try {
@@ -260,7 +262,9 @@ async function collectLlmStream(llmSvc, prompt, route, opts) {
260
262
  model: route.model,
261
263
  messages: [{ role: "user", content: [{ type: "text", text }] }],
262
264
  system,
263
- maxTokens: opts?.maxTokens ?? 1024
265
+ // The host normally supplies this (see DEFAULT_LLM_MAX_TOKENS); the same constant here keeps
266
+ // a direct capability call from silently falling back to a truncating budget.
267
+ maxTokens: opts?.maxTokens ?? DEFAULT_LLM_MAX_TOKENS
264
268
  };
265
269
  const acc = [];
266
270
  let sawDelta = false;
@@ -276,7 +280,7 @@ async function collectLlmStream(llmSvc, prompt, route, opts) {
276
280
  }
277
281
  }
278
282
  const out = acc.join("");
279
- if (!out) throw new Error("llm stream empty");
283
+ if (!out) throw new Error("llm: stream empty");
280
284
  return coerceSchemaJson(out, opts);
281
285
  }
282
286
 
@@ -729,7 +733,7 @@ var DshCapabilities = class {
729
733
  };
730
734
 
731
735
  // src/lifecycle.ts
732
- import { cpSync, mkdirSync } from "fs";
736
+ import { cpSync, mkdirSync as mkdirSync2 } from "fs";
733
737
  import { homedir as homedir2 } from "os";
734
738
  import path3 from "path";
735
739
 
@@ -741,7 +745,7 @@ function resolveSkillDir() {
741
745
  const here = path2.dirname(fileURLToPath(import.meta.url));
742
746
  const candidates = [
743
747
  path2.join(here, "..", "skills", "monkey-mini-app"),
744
- path2.join(here, "..", "..", "skills", "monkey-mini-app")
748
+ path2.join(here, "..", "..", "..", "skills", "monkey-mini-app")
745
749
  ];
746
750
  for (const c of candidates) {
747
751
  if (existsSync(path2.join(c, "SKILL.md"))) return c;
@@ -928,7 +932,7 @@ function registerListCtxTools(ctx, defineTool = null) {
928
932
  }
929
933
  }
930
934
  function installSkillDir(src, dest) {
931
- mkdirSync(path3.dirname(dest), { recursive: true });
935
+ mkdirSync2(path3.dirname(dest), { recursive: true });
932
936
  cpSync(src, dest, { recursive: true });
933
937
  }
934
938
  function defaultSkillDest() {
@@ -1047,10 +1051,19 @@ var inject = ["tools"];
1047
1051
  async function apply(ctx, config = {}) {
1048
1052
  const hostConfig = loadPluginHostConfig(config);
1049
1053
  const themes = new DshThemeResource(hostConfig.runtimeRoot);
1050
- const host = createHost(new DshCapabilities(ctx), new DshLifecycle(ctx), {
1051
- config: hostConfig,
1052
- themes
1053
- });
1054
+ const host = createHost(
1055
+ new DshCapabilities(ctx),
1056
+ new DshLifecycle(ctx, config.skillDest ? { skillDest: path5.resolve(config.skillDest) } : {}),
1057
+ {
1058
+ config: hostConfig,
1059
+ themes,
1060
+ about: {
1061
+ adapter: "dsh",
1062
+ packageName,
1063
+ env: process.env.NODE_ENV ?? "production"
1064
+ }
1065
+ }
1066
+ );
1054
1067
  let port;
1055
1068
  try {
1056
1069
  ({ port } = await host.apply(ctx));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkey-mini-app/dsh-mini-app",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "DeepSeek Harness plugin: mini-app host wiring, panel, and skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -23,14 +23,16 @@
23
23
  "lib",
24
24
  "cordis.patch.yml",
25
25
  "tsup.config.ts",
26
- "skills"
26
+ "skills",
27
+ "assets"
27
28
  ],
28
29
  "scripts": {
29
30
  "build": "rm -rf lib && tsup",
30
- "prepare": "rm -rf lib && tsup",
31
31
  "test": "vitest run --passWithNoTests",
32
32
  "typecheck": "tsc -p tsconfig.json --noEmit",
33
- "prepublishOnly": "pnpm --filter @monkey-mini-app/ui build && node ../../scripts/generate-skill.mjs && rm -rf lib && tsup"
33
+ "prepack": "node ../../scripts/gen/skill/copy.mjs dsh",
34
+ "postpack": "node ../../scripts/gen/skill/copy.mjs clean dsh",
35
+ "prepublishOnly": "pnpm --filter @monkey-mini-app/ui build && pnpm --filter @monkey-mini-app/api build && node ../../scripts/gen/skill/index.mjs && rm -rf lib && tsup"
34
36
  },
35
37
  "dsh": {
36
38
  "bundle": {
@@ -51,13 +53,13 @@
51
53
  "monkey-mini-app"
52
54
  ],
53
55
  "dependencies": {
54
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
55
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
56
- "@deepseek-ai/dsh-subagent": "0.1.1-rc.2",
56
+ "@deepseek-ai/dsh-llm": "0.1.2-rc.1",
57
+ "@deepseek-ai/dsh-session": "0.1.2-rc.1",
58
+ "@deepseek-ai/dsh-subagent": "0.1.2-rc.1",
57
59
  "@hono/node-server": "^2.1.1",
58
- "@monkey-mini-app/host": "^0.1.0",
59
- "@monkey-mini-app/panel": "^0.1.0",
60
- "@monkey-mini-app/ui": "^0.1.0",
60
+ "@monkey-mini-app/host": "^0.1.4",
61
+ "@monkey-mini-app/panel": "^0.1.4",
62
+ "@monkey-mini-app/ui": "^0.1.4",
61
63
  "esbuild": "^0.28.2",
62
64
  "esbuild-wasm": "^0.25.12",
63
65
  "hono": "^4.8.0",
@@ -1,21 +1,38 @@
1
1
  ---
2
2
  name: monkey-mini-app
3
- description: Create or edit local mini-apps (ui.tsx + main.api.ts). Create with mini_app_register; edit with mini_app_read + mini_app_edit; verify with mini_app_reload; smoke with mini_app_call; open with mini_app_open.
3
+ description: Create or edit local mini-apps (ui.tsx + main.api.ts) — small self-contained web tools that run in the mini-app panel. Typical asks a todo/notepad, an internal utility, a data dashboard, a monitor page, a report, a kanban board, visualising a script's output, or an LLM summary page. Trigger phrases include 做个小程序 / 小工具 / 面板 / 仪表盘 / dashboard / 看板 / 帮我可视化 / mini-app. Create with mini_app_register, change with mini_app_read + mini_app_edit, compile-verify with mini_app_reload, smoke-test with mini_app_call, reveal with mini_app_open. Not for editing host / panel / SDK source, and not for writing the dsh or pi plugin itself.
4
4
  ---
5
5
 
6
6
  # monkey-mini-app
7
7
 
8
- 生成或修改本地小程序。本 skill `~/.dsh/skills/monkey-mini-app/`(`references/`、`templates/` 同级)。
8
+ Generate or modify a local mini-app. Reference docs and templates live **next to this SKILL.md** (`references/`, `templates/`) — always open them by relative path; never assume where a given host installed the skill.
9
9
 
10
- **`ctx` / 模型 API 以本 skill [references/ctx.md](references/ctx.md)、[references/llm-json.md](references/llm-json.md) 为准**(含 `llm` / `agent` / `schema` / `onEvent`)。现网样例不要当契约:不要读 `~/.monkey-mini-app/runtime/apps/*/`。
10
+ **Language rule for this skill:** instructions are English; the Chinese in code samples is *product copy* that the end user sees. Mini-app UI text follows the host locale (the samples use Chinese because the shipped host defaults to it) do not translate user-facing strings when you adapt a template.
11
11
 
12
- ## 文件怎么落地
12
+ **`ctx` and the model APIs are defined by [references/ctx.md](references/ctx.md) and [references/llm-json.md](references/llm-json.md)** (incl. `llm` / `agent` / `schema` / `onEvent`). Live apps are not a contract: do not read `~/.monkey-mini-app/runtime/apps/*/`.
13
13
 
14
- Workspace 直接 Write `~/.monkey-mini-app/runtime/**` 会被沙箱拒绝,一律走 `mini_app_*` 工具。
14
+ ## How files reach disk
15
15
 
16
- ### 新建 app `mini_app_register`
16
+ Writing `~/.monkey-mini-app/runtime/**` directly is refused by the sandbox — always go through the `mini_app_*` tools (no curl, no bash against `:17880`).
17
17
 
18
- 脚手架创建(要 `manifest.json`)。`files` **key 是相对路径**(动态名字),value 是全文;自动建目录。常见还有 `ui.tsx`、`main.api.ts`,按需 `lib/...`、`components/...`(禁止 `..` / 绝对路径):
18
+ | Goal | Tool | Notes |
19
+ |---|---|---|
20
+ | Inspect an existing app's manifest + absolute dir | `mini_app_get({ appId })` | Call this before editing — beats guessing |
21
+ | List its source files | `mini_app_list_files({ appId })` | Skips `.git` / `storage` |
22
+ | Read one file | `mini_app_read({ appId, path })` | `startLine`/`endLine` or `offset`/`limit`; `numbered: true` for `N\|` line prefixes |
23
+ | **Edit an existing file** (main path) | `mini_app_edit({ appId, path, edits })` | `edits: [{ oldText, newText }]`; each `oldText` must be **unique** in the file. Never rewrite a whole tree to change one line |
24
+ | New file / large rewrite | `mini_app_write({ appId, path, content })` | |
25
+ | Delete one file | `mini_app_delete({ appId, path })` | `manifest.json` cannot be deleted |
26
+ | Create a whole app | `mini_app_register({ appId, files })` | `files` keys are relative paths, values full text; must include `manifest.json` |
27
+ | Validate + compile + warm cache | `mini_app_reload({ appId })` | After every round of edits — see below |
28
+ | **Add a backend npm library** | `mini_app_install({ appId, packages: [{ name: "exceljs" }] })` | Only when `main.api.ts` must `import` a real Node library. Never for `lodash` / `motion` / `axios` / `react`. Not importable from `ui.tsx`. |
29
+ | Smoke-test api methods | `mini_app_call({ appId, method, args })` | Or `calls: [{ method, args }]` for a whole set in one round trip |
30
+ | Show it to the user | `mini_app_open({ appId })` | Returns whether a panel actually received it |
31
+ | **Read runtime errors** | `mini_app_errors({ appId, since? })` | The only way to see a UI that compiled and then crashed |
32
+ | **Ask the rendered view** | `mini_app_view_eval({ appId, code? })` | Run JS in the live DOM — what actually rendered, at what size, with which styles |
33
+ | Confirm the plugin is alive | `mini_app_list()` | |
34
+
35
+ `mini_app_register` shape (`ui.tsx` + `main.api.ts` are the two entries; add `ui/…` / `api/…` / `shared/…` as needed — `..` and absolute paths are rejected):
19
36
 
20
37
  ```
21
38
  mini_app_register({
@@ -24,138 +41,183 @@ mini_app_register({
24
41
  "manifest.json": "...",
25
42
  "ui.tsx": "...",
26
43
  "main.api.ts": "...",
27
- "lib/parse.ts": "...",
28
- "components/Card.tsx": "..."
44
+ "ui/Card.tsx": "...",
45
+ "api/parse.ts": "...",
46
+ "shared/format.ts": "..."
29
47
  }
30
48
  })
31
49
  ```
32
50
 
33
- ### 改已有文件 `read` + `edit`(主路径)
51
+ Mutating tools **auto-commit** by default; pass `commit: false` to batch a few edits and let one final `mini_app_reload` close the round. Versioning (`mini_app_history_commit` / `mini_app_history_list` / `mini_app_history_reset` / `mini_app_history_revert`, single branch, revert = forward commit) → [references/history.md](references/history.md).
52
+
53
+ **Deleting a whole app is a user action** in the panel. There is no unregister tool — do not delete the directory, do not curl `DELETE`.
54
+
55
+ ### What `mini_app_reload` returns
56
+
57
+ `{ ok, errors, notices?, compiled, committed, caches }`. The **prefix** of each `errors[i]` names the failing layer — fix that layer, don't shotgun.
58
+
59
+ **Cache contract (do not second-guess this):** every successful reload drops the in-memory API module, UI bundle, **and app CSS** (`caches.appCss` is always `"dropped"`), and signals open panels to re-fetch. The tool also defaults to `cleanCaches: true` (purges `.autogen/` + on-disk bundles) so a stale Tailwind artifact cannot linger — pass `cleanCaches: false` only when you intentionally want to keep disk caches. Read `caches.views` to know whether a browser actually re-fetched.
60
+
61
+ Error prefixes:
62
+
63
+ | Prefix | Meaning | Next step |
64
+ |---|---|---|
65
+ | `appId must be reverse-DNS` | Bad id shape | Use `com.<you>.<thing>` |
66
+ | `app not registered` | Nothing on disk yet | `mini_app_register` first |
67
+ | `manifest: …` | Missing key / broken JSON | Needs `id` `name` `version` `entry` |
68
+ | `main.api: …` | Backend compile, relative-import resolution, or an undefined name | Read the rest of the message |
69
+ | `ui: …` | UI bundle failed, or an undefined name/component | Usually a disallowed import or a typo'd identifier |
70
+ | `shared: …` | Undefined name in `shared/**` (used by both sides) | Fix in `shared/` |
71
+ | `commit: …` | Compiled fine, auto-commit failed | Commit explicitly with `mini_app_history_commit` |
72
+
73
+ `committed.status` is explicit, because "nothing happened" and "I could not commit" need different follow-ups:
74
+
75
+ | `status` | Meaning |
76
+ |---|---|
77
+ | `committed` | New commit (`commitId` set) |
78
+ | `clean` | Nothing to commit — `mini_app_edit` already auto-committed it |
79
+ | `skipped` | Compile failed, so no commit was attempted |
80
+ | `failed` | Commit itself errored (`reason`; also in `errors[]`) |
81
+
82
+ **Compile green is not "it runs".** `errors[]` from an undefined identifier *is* caught now (`"greeting()" is called but never defined or imported`, often with a `did you mean`), and `notices[]` carries lower-confidence findings — read them, they are cheap. What no compile step can see is anything that only fails at render time, so finish the loop:
34
83
 
35
- 不要再用 `register` 整树重写来改一行。
84
+ ### Debug loop (this is the part that used to need a human)
36
85
 
37
86
  ```
38
- mini_app_list_files({ appId })
39
- mini_app_read({ appId, path: "ui.tsx" })
40
- // 可选行窗(1-indexed 闭区间):startLine/endLine;也可 offset+limit(Pi 风格)
41
- // mini_app_read({ appId, path: "ui.tsx", startLine: 10, endLine: 40 })
42
- // mini_app_read({ appId, path: "main.api.ts", offset: 1, limit: 80, numbered: true })
43
- mini_app_edit({
44
- appId,
45
- path: "ui.tsx",
46
- edits: [{ oldText: "旧片段(须唯一)", newText: "新片段" }],
47
- // commit: false // 多轮小改可先不提交,最后 reload 收口
48
- })
87
+ edit mini_app_reload → mini_app_open → mini_app_errors → mini_app_view_eval
49
88
  ```
50
89
 
51
- - **新建单文件 / 大段重写** → `mini_app_write({ appId, path, content })`
52
- - **删文件** `mini_app_delete({ appId, path })`(不能删 `manifest.json`)
53
- - mutate 默认 **auto-commit**;设 `commit: false` 可攒改动
90
+ 1. `mini_app_reload` until `ok: true`.
91
+ 2. `mini_app_open` the iframe mounts and streams back anything it throws. `panel: "no-panel-connected"` means no browser is attached: the app is fine, nobody is looking, so tell the user to open the panel.
92
+ 3. Give it a moment to render, then `mini_app_errors`. Empty + never opened ≠ clean; the hint says when to re-read.
93
+ 4. `mini_app_view_eval({ appId })` (no `code` = the `#root` subtree) to see what actually drew — then ask it anything in JS: did that class apply, which node has no width, is that subtree `display:none`.
94
+
95
+ `mini_app_errors` polls with `since: <lastSeq>`; a reload clears the ring, so errors after a reload are only from the new build. `mini_app_view_eval` needs a live view and says which of `not-open` / `runner-not-booted` / `stuck` it hit when it does not get one → **[references/eval.md](references/eval.md)**.
96
+
97
+ More symptoms → [references/troubleshoot.md](references/troubleshoot.md).
98
+
99
+ ## Protocol
54
100
 
55
- ### 验证 + 预热缓存 `mini_app_reload`
101
+ **Two author packages:** `@monkey-mini-app/ui` (UI: `useApp` + components) and `@monkey-mini-app/api` (backend: `defineApp`, host-injected). The UI compiler externalises `react` + the UI package; the backend loader injects `defineApp` only. Any other bare import is a compile error by design.
56
102
 
57
- 改完一轮后调用(**替代旧的 `mini_app_validate`**):校验 + **同步编译** `main.api` 与 UI;成功且工作区有未提交改动会 auto-commit。
103
+ **Layout** (enforced, not cosmetic):
58
104
 
59
105
  ```
60
- mini_app_reload({ appId }) // { ok, errors, compiled, committed? }
106
+ manifest.json · ui.tsx · main.api.ts
107
+ ui/ → UI only (components, hooks) backend may NOT import it
108
+ api/ → backend only (helpers, ctx work) UI may NOT import it
109
+ shared/ → both — pure code only: no React, no DOM, no ctx, no Node
61
110
  ```
62
111
 
63
- 然后:
112
+ A trivial app needs none of the three folders. Relative imports may use any subfolder name, but must stay inside the app dir.
64
113
 
65
- 1. `mini_app_call({ appId, method, args })` 冒烟(不是 curl / 不是 bash 打 `:17880`)
66
- 2. `mini_app_open({ appId })` —— 弹出侧栏「小程序」并打开该 app
114
+ - UI may **not** `import` `main.api.ts`
115
+ - UI: `const { call } = useApp()` you own loading/error state; `useApp` comes from `@monkey-mini-app/ui` (never implement your own)
116
+ - Backend: `export default defineApp({ name, description, api })` (`name` **and** `description` are required; import `defineApp` from `@monkey-mini-app/api` — the host injects the runtime copy, nothing React gets loaded)
117
+ - `call("foo")` must be a key of `api.foo`
118
+ - Backend imports: `@monkey-mini-app/api` + relative paths inside the app dir (no npm, no Node builtins)
119
+ - Fetching: `ctx.http(url)` / `ctx.http(url, { method, headers, query, body, timeout })`; put parsing in `api/`
120
+ - Machine commands only via `ctx.bash` (`{ stdout, stderr, exitCode }`)
121
+ - **Model**: `ctx.llm(prompt, opts?)` / `ctx.agent(goal, opts?)` → **string**. Shared opts: `provider?` `model?` `system?` `schema?` `maxTokens?` `signal?`; `agent` adds `onEvent?` `maxIterations?` `cwdType?` `cwd?`. Structured JSON → [llm-json.md](references/llm-json.md); full signatures and event shapes → [ctx.md](references/ctx.md)
122
+ - MCP / tool args are plain objects — never `{ input: "..." }`; `ctx.tool` / `ctx.agent` / `ctx.llm` all return **string** (the host stringifies tool results)
123
+ - Copy is for the end user; card titles speak business (`「今日摘要」` / "Today's digest"), never `ctx.bash` or `storage/*.json`
124
+ - **Long jobs run sampled only**, must honour `ctx.signal`, and expose `scanStatus`/`progress` — see [ctx.md](references/ctx.md)
67
125
 
68
- `mini_app_list` 只需确认插件活着。显式 `mini_app_history_commit` / `_list` / `_reset` / `_revert` 仍可用。
126
+ ## UI (`@monkey-mini-app/ui`)
69
127
 
70
- ## 协议
128
+ **The component library is a convenience, not a mandate.** It exists so you stop rebuilding wheels — use it where it fits, but never contort a design to use it. Free-form UI is expected:
71
129
 
72
- - UI **禁止** `import` `main.api.ts`
73
- - UI:`const { call } = useDashboardApi()`,自己管 loading;`useDashboardApi` `@monkeyagent/host` 导入(host 注入,不要自己实现)
74
- - 后端:`export default defineDashboard({ name, description, api })`
75
- - `call("foo")` 必须是 `api.foo`
76
- - 后端 import 只许 `@monkeyagent/dashboard` `./lib` `./components`
77
- - 抓网:`ctx.http(url)` / `ctx.http(url, { method, headers, query, body, timeout })`;解析写 `./lib`
78
- - 本机命令才用 `ctx.bash`(`{ stdout, stderr, exitCode }`)
79
- - **模型**:`ctx.llm(prompt, opts?)` / `ctx.agent(goal, opts?)` → **string**。共用 opts:`provider?` `model?` `system?` `schema?` `maxTokens?` `signal?`;agent 另加 `onEvent?`。结构化 JSON → [llm-json.md](references/llm-json.md);过程事件与完整签名 → [ctx.md](references/ctx.md)
80
- - MCP / tool 参数是普通对象,禁止 `{ input: "..." }`;`ctx.tool` / `ctx.agent` / `ctx.llm` 返回值都是 **string**(tool/mcp 经宿主 stringify)
81
- - 文案给用户看;卡片标题用业务语言(「今日摘要」),不要写 `ctx.bash` / `storage/*.json`
82
- - **长耗时任务只跑采样** + 必须响应 `ctx.signal` + `scanStatus`/`progress`,见 [ctx.md](references/ctx.md)
130
+ - **Decide first**: is there a component for this that actually fits? **Yes → use it** (fewer tokens, consistent look). **No, or the design needs its own visual/interaction, or the user asked for free play → build it from native elements (`div`/`span`/`button`/`input`/`table`/`svg`…) + Tailwind classes.** Do not bend the design to fit the library.
131
+ - **Mixing is normal**: library components for the skeleton (cards / page header / dialogs), native + Tailwind for the distinctive parts.
132
+ - **Boundary of free play**: native elements and Tailwind are unlimited, but `ui.tsx` may only import `react`, `@monkey-mini-app/ui`, `lodash` / `lodash-es`, `motion` / `motion/react`, and in-app relative paths — never `api/**`, never `../` out of the app dir, never another npm package. Hooks from `react`; components, `useApp`, and `cn` from the SDK.
133
+ - **Not your job**: the theme provider and the app runtime are wrapped by the host; there is no `Stack`/`Text` layout component — use Tailwind classes.
134
+ - Component props list **only their own API**: `className`, `style`, `onClick`, `aria-*` are never repeated (every component takes them). Conversely, **never guess the part names of a compound component** (`Dialog` + `DialogTrigger` + `DialogContent`, not `<Dialog title>`) — read its contract.
83
135
 
84
- ## UI(@monkey-mini-app/ui)
136
+ The snippet below is a common shape, **not the only shape** — complex or bespoke UI may well be fully hand-written.
85
137
 
86
138
  ```tsx
87
- import { useEffect, useState } from "react";
88
- import { Button, Input, Card, CardContent, CardHeader, CardTitle, Textarea } from "@monkey-mini-app/ui";
89
- import { useDashboardApi } from "@monkeyagent/host";
139
+ import { useState } from "react";
140
+ import { useApp, Button, Input, Card, CardContent, CardHeader, CardTitle } from "@monkey-mini-app/ui";
90
141
 
91
142
  export default function Ui() {
92
- const { call } = useDashboardApi();
143
+ const { call } = useApp();
93
144
  const [draft, setDraft] = useState("");
94
145
  ...
95
146
  return (
96
147
  <Card className="mt-8 w-full">
97
- <CardHeader><CardTitle>名称</CardTitle></CardHeader>
148
+ <CardHeader><CardTitle>Name</CardTitle></CardHeader>
98
149
  <CardContent className="flex flex-col gap-3">
99
- <Input value={draft} onChange={(e) => setDraft(e.target.value)} placeholder="写一条" />
100
- <Button onClick={async () => { await call("add", { title: draft }); }}>添加</Button>
150
+ <Input value={draft} onChange={(e) => setDraft(e.target.value)} placeholder="Write something" />
151
+ <Button onClick={async () => { await call("add", { title: draft }); }}>Add</Button>
101
152
  </CardContent>
102
153
  </Card>
103
154
  );
104
155
  }
105
156
  ```
106
157
 
107
- - **布局用 Tailwind classes**(`flex flex-col gap-3 p-4 grid md:grid-cols-3 w-full space-y-4`),库内没有 Stack/Text 这类布局组件
108
- - **`UiProvider` host 自动包裹**(locale 跟随 host 设置),不要自己写 Provider
109
- - 组件清单(props + 类型 + 示例)→ **[references/catalog.md](references/catalog.md)** **[references/contracts/](references/contracts/)**(自动生成,改组件后 `pnpm skill:gen` 再生成)
110
- - **图标**:`import { Icon } from "@monkey-mini-app/ui"` 后用 `Icon.HelpCircle`(任意 lucide 名都行);**常用推荐子集 + 何时用** → **[references/icons.md](references/icons.md)**(不要读上千个名,看这份精简的)
111
- - **空状态插图**:`import { IlluServerStatus } from "@monkey-mini-app/ui"`(`Illu*`,已 token 化跟主题)
112
- - 组件库已内置 lucide 图标 / recharts / CodeMirror 等依赖——**不要**额外 import 这些 npm 包;从 `@monkey-mini-app/ui`
113
-
114
- | 场景 | 组件 |
158
+ - **Layout is Tailwind** (`flex flex-col gap-3 p-4 grid md:grid-cols-3 w-full space-y-4`)
159
+ - **`cn` is already in the kit** `import { cn } from "@monkey-mini-app/ui"` (`clsx` + `tailwind-merge`). Prefer it over concatenating class strings.
160
+ - **Tailwind is compiled per app from your source** — variants (`hover:` `group-hover:` `md:`), the default palette (`bg-rose-500`) and arbitrary values (`w-[437px]`) all work, so **do not fall back to inline `style` out of caution**. The one trap: class names must be complete literals — `` `bg-${x}-500` `` generates nothing, silently → **[references/styling.md](references/styling.md)**
161
+ - **Colour is tokens, never hex** the user's palette rewrites token values under `<html>`, a literal breaks dark mode → **[references/theme.md](references/theme.md)** (generated token table). **Do not invent a theme in `ui.tsx`.** Two escape hatches, both rare: a host-global custom palette (`themes/theme-<id>.css`) when the user asks for a named brand — *Custom host theme file*; or an app-local `theme.css` when the **style itself depends on a hue** (a look the app carries, e.g. neon signage) — *App-local palette*. A plain CRUD/table/settings app ships neither.
162
+ - **`lodash` is a platform module** on UI and backend (`import { groupBy, debounce } from "lodash"`). Prefer it over hand-rolled `groupBy` / `uniqBy` / `pick` / `debounce`. Bare `axios` / `ramda` / `dayjs` still fail.
163
+ - **`motion` is a platform module** (UI only — `import { motion, AnimatePresence } from "motion/react"`). Use it for enter/exit/layout, Tailwind `transition` for a one-property hover, and kit `<Reveal delay={i * 60}>` for a staggered entrance. Custom `@keyframes` are allowed — give them your own name, since keyframe names are global inside the app's document and the platform already defines `spin` / `pulse` / `enter` / `exit` / … → **[references/styling.md](references/styling.md)** *Animation*.
164
+ - **Need a library the platform does not ship** (a real file format, a binary protocol, a vendor SDK): `mini_app_install({ appId, packages: [{ name: "exceljs" }] })`, then `import ExcelJS from "exceljs"` in `main.api.ts`. Order of preference: `ctx.http` → `ctx.bash` / `ctx.tool` → install. Backend only — the UI still gets JSON through `call`.
165
+ - **Icons**: `import { Icon } from "@monkey-mini-app/ui"`, then `Icon.HelpCircle` (any lucide name works); **curated subset + when to use** → **[references/icons.md](references/icons.md)** (don't page through a thousand names)
166
+ - **Empty-state illustrations** — exactly these 10, the names are not guessable: `IlluEmpty` `IlluNoData` `IlluSearch` `IlluLoading` `IlluServerStatus` `IlluAccessDenied` `IlluPageNotFound` `IlluDataProcessing` `IlluBugFixing` `IlluCodeReview`
167
+ - Component index (props + types) → **[references/catalog.md](references/catalog.md)** and **[references/contracts/](references/contracts/)** (generated; after changing a component run `pnpm gen:skill`).
168
+ - **Prefer a ready example over writing a widget from memory**: each component contract lists [references/examples/](references/examples/) files, one scenario each (e.g. `data-grid-01` = sort+search+pagination, `data-grid-02` = rich cells via renderers). They import `react` + `@monkey-mini-app/ui` + relatives only, so copy one into `ui/` and edit — do not invent a variant no example shows.
169
+ - The SDK already bundles React / lucide / recharts — **never** import those yourself
170
+ - **Heavy editors load from a CDN on demand** (not npm): `CodeEditor` pulls CodeMirror 6 from `esm.sh`; `CodeBlock` / `DiffViewer` pull shiki; `RichTextEditor` is a local contentEditable editor (no CDN, no dependency). Do not `import` `@codemirror/*` / `shiki` / `@tiptap/*` / `@uiw/react-codemirror` (the last one brings a second React). When the CDN is blocked the components degrade — see [troubleshoot.md](references/troubleshoot.md)
171
+
172
+ | Need | Components |
115
173
  |---|---|
116
- | 页面骨架 | `AppShell` `PageHeader` `FilterBar` `DetailPanel` |
117
- | KPI 卡片 | `StatCard` `TrendCard` `StatusBadge` `SeverityChip` |
118
- | 表格 | `DataGrid` + `ColumnDef`(排序/筛选/分页/CSV 自带) |
119
- | 日期时间 | `DatePicker` `DateRangePicker` `DateTimePicker` `TimePicker` `DurationInput` `RelativeDatePicker` |
120
- | 看板/日历/计划 | `Kanban` `EventCalendar` `Gantt` `Timeline` `Stepper` |
121
- | 树/列表 | `TreeView` `SortableList` `FileTree` |
122
- | 编辑器 | `CodeEditor` `MarkdownEditor` `RichTextEditor` `CodeBlock` `Markdown` |
123
- | 检查/日志 | `DiffViewer` `JsonViewer` `LogViewer` `RequestInspector` `Terminal` |
124
- | 表单扩展 | `SearchInput` `NumberField` `TagInput` `ConfirmDialog` `FileDropzone` `Copyable` `UserPicker` |
125
- | 图表 | `DonutChart` `StackedBarChart` `Sparkline` `Gauge` `RadarChart` + L1 `Chart` |
126
- | 基础件 | `Button` `Input` `Select` `Dialog` `Sheet` `Tabs` `Card` `Badge` `Toast` `Empty` … |
127
-
128
- ## CRUD 骨架(普通记事直接改这段)
174
+ | Page skeleton | `AppShell` `PageHeader` `FilterBar` `DetailPanel` |
175
+ | KPI cards | `StatCard` `TrendCard` `StatusBadge` `SeverityChip` |
176
+ | Tables | `DataGrid` + `ColumnDef` (sorting / filtering / paging / CSV built in) |
177
+ | Date & time | `DatePicker` `DateRangePicker` `DateTimePicker` `TimePicker` `DurationInput` `RelativeDatePicker` |
178
+ | Boards / calendar / plans | `Kanban` `EventCalendar` `Gantt` `Timeline` `Stepper` |
179
+ | Trees / lists | `TreeView` `SortableList` `FileTree` |
180
+ | Editors | `CodeEditor` `MarkdownEditor` `RichTextEditor` `CodeBlock` `Markdown` |
181
+ | Inspect / logs | `DiffViewer` `JsonViewer` `LogViewer` `RequestInspector` `Terminal` |
182
+ | Form extras | `SearchInput` `NumberField` `TagInput` `ConfirmDialog` `FileDropzone` `Copyable` `UserPicker` |
183
+ | Charts | `DonutChart` `StackedBarChart` `Sparkline` `Gauge` `RadarChart` + L1 `Chart` |
184
+ | Primitives | `Button` `Input` `Select` `Dialog` `Sheet` `Tabs` `Card` `Badge` `Toast` `Empty` … |
185
+
186
+ ## CRUD skeleton (edit this for plain local notes)
129
187
 
130
188
  `manifest.json`:
131
189
 
132
190
  ```json
133
191
  {
134
192
  "id": "com.example.foo",
135
- "name": "名称",
136
- "description": "一句话",
193
+ "name": "My Mini App",
194
+ "description": "One line description for the app",
137
195
  "version": "0.1.0",
138
196
  "entry": "ui.tsx",
139
- "theme": { "followsHost": true },
140
- "acronym": "MC"
197
+ "acronym": "MA"
141
198
  }
142
199
  ```
143
200
 
144
- `acronym`(可选):双字母缩写,用于 Host 列表的卡片 monogram。不写时按中文名拼音声母自动生成(「备忘录」→ BW),英文名取前两个字母。只有想自定义缩写时才需要填(如品牌名)。
201
+ There is **no theme block**. Colour comes from the host palette unless the app ships its own
202
+ `theme.css` — see [references/theme.md](references/theme.md) → *App-local palette*.
203
+
204
+ Product strings (`name`, `description`, every label the user sees) follow the **host locale** — the shipped host defaults to Chinese, so the samples are Chinese. Instructions and comments stay English.
205
+
206
+ `acronym` (optional): two letters used as the monogram on the host's list card. Omit it and the host derives one (pinyin initials for Chinese names, e.g. `备忘录` → BW; first two letters for Latin names). Only set it to override a brand name.
145
207
 
146
208
  `main.api.ts`:
147
209
 
148
210
  ```ts
149
- import { defineDashboard } from "@monkeyagent/dashboard";
211
+ import { defineApp } from "@monkey-mini-app/api";
150
212
 
151
213
  async function loadItems(ctx) {
152
214
  const items = await ctx.storage.get("items");
153
215
  return Array.isArray(items) ? items : [];
154
216
  }
155
217
 
156
- export default defineDashboard({
157
- name: "名称",
158
- description: "一句话",
218
+ export default defineApp({
219
+ name: "My Mini App",
220
+ description: "One line description for the app",
159
221
  api: {
160
222
  async list(ctx) {
161
223
  return loadItems(ctx);
@@ -178,32 +240,46 @@ export default defineDashboard({
178
240
  });
179
241
  ```
180
242
 
181
- ## 按需再读(不要一次全打开)
243
+ ## Read on demand (do not open everything)
182
244
 
183
- | 何时 | 打开 |
245
+ | When | Open |
184
246
  |------|------|
185
- | 组件 props / 类型 / 示例 | [references/catalog.md](references/catalog.md) → [references/contracts/](references/contracts/) |
186
- | 图标子集(`Icon` 命名空间,何时用) | [references/icons.md](references/icons.md) || `ctx.*` 完整契约(含 agent `onEvent` 事件形状) | [references/ctx.md](references/ctx.md)(用 `ctx.http`,不要 bash curl) |
187
- | `schema` 结构化 JSON 例子 | [references/llm-json.md](references/llm-json.md) |
188
- | **真的要用** `ctx.tool` | `mini_app_list_ctx_tools`,再 [references/tools.md](references/tools.md) |
189
- | 相对 import、`./lib` 解析 | [references/loader.md](references/loader.md) |
190
- | 人类调试 Host `:17880` / curl | [references/test.md](references/test.md)(≠ `ctx.http`) |
191
- | 骨架基线 / 最小可运行结构 | `templates/minimal/` |
192
- | 本地 CRUD + 筛选 + 派生统计 | `templates/todo/` |
193
- | 联网数据 模型摘要(长任务/采样/取消) | `templates/insights/` |
194
- | 本机指标实时看板(system + bash) | `templates/monitor/` |
195
- | 编辑/diff/日志/用例表格(复杂组件示例) | `templates/review/` |
196
- | `ctx.agent` 多步任务 + 过程/取消 | `templates/agentrun/` |
197
- | 看板/表格双视图 + 编辑 + AI(flagship) | `templates/jira/` |
198
- | **先把 7 个模板的指引侧重读一遍再选** | [`templates/README.md`](templates/README.md) |
199
- | 报错 | [references/troubleshoot.md](references/troubleshoot.md) |
200
-
201
- 普通 storage CRUD **先用上面骨架**,不要为了记笔记去读整份 Todo。模板是风格样板:中文产品文案、`call` 自己管 loading/error、后端可用 TypeScript。
247
+ | Component props / types | [references/catalog.md](references/catalog.md) → [references/contracts/](references/contracts/) |
248
+ | **Which Tailwind classes work / how to colour** | [references/styling.md](references/styling.md) |
249
+ | **What actually rendered (live DOM query)** | [references/eval.md](references/eval.md) — recipes, output format, the four `view` states |
250
+ | **Theme token table + custom host theme file** | [references/theme.md](references/theme.md) (generated — do not hand-edit) |
251
+ | **A runnable starting point for one component** | contract's `## Examples` → [references/examples/](references/examples/) (each file = one scenario: `@title` + `@scenario`; layout/pattern recipes in `examples/<group>.md`) |
252
+ | Icon subset (`Icon` namespace, when to use) | [references/icons.md](references/icons.md) |
253
+ | Full `ctx.*` contract (incl. agent `onEvent` shapes) | [references/ctx.md](references/ctx.md) (use `ctx.http`, not bash curl) |
254
+ | Structured JSON via `schema` | [references/llm-json.md](references/llm-json.md) |
255
+ | **Actually using** `ctx.tool` | `mini_app_list_ctx_tools` first, then [references/tools.md](references/tools.md) |
256
+ | Relative imports, `ui` / `api` / `shared` layout | [references/loader.md](references/loader.md) |
257
+ | Human debugging of host `:17880` / curl | [references/test.md](references/test.md) (≠ `ctx.http`) |
258
+ | Errors | [references/troubleshoot.md](references/troubleshoot.md) |
259
+ | Versioning / rollback | [references/history.md](references/history.md) |
260
+ | **A named visual style** (only if the user asked) | [references/looks/index.md](references/looks/index.md) — recipes, not apps |
261
+
262
+ **Templates are product facades, cut by interaction loop.** Read [`templates/README.md`](templates/README.md). Lift the pattern — do not paste whole files. Looks are optional; do not open them unless the user named a style.
263
+
264
+ | Loop | Template |
265
+ |---|---|
266
+ | One `call` / connectivity | `templates/minimal/` |
267
+ | Open → my screen → one record | `templates/today/` |
268
+ | Items move in 2D status | `templates/board/` |
269
+ | Trigger → wait → read (cancel) | `templates/radar/` |
270
+ | File in, grid work (`mini_app_install`) | `templates/sheets/` |
271
+ | The UI *is* the run (`ctx.agent`) | `templates/runner/` |
272
+ | Named buttons, this machine, no model | `templates/chores/` |
273
+ | Numbers move by themselves | `templates/watch/` |
274
+
275
+ For a plain note **start from the skeleton above**. Product copy follows the host locale.
202
276
 
203
277
  ## Checklist
204
278
 
205
- - [ ] 新建用 `mini_app_register`;改已有用 `mini_app_read` + `mini_app_edit`(或 `write`)
206
- - [ ] `mini_app_reload` 编译通过
207
- - [ ] `mini_app_call` 冒烟通过(不是 curl)
208
- - [ ] `mini_app_open`
209
- - [ ] call api 键;UI fetch / secrets / llm
279
+ - [ ] New app via `mini_app_register`; edits via `mini_app_get` / `mini_app_list_files` + `mini_app_read` + `mini_app_edit` (or `write`)
280
+ - [ ] Started from the closest template(s), lifted patterns/structure rather than pasting whole files
281
+ - [ ] `mini_app_reload` compiles (located the failure by `errors[i]` prefix) and `notices[]` was read
282
+ - [ ] `mini_app_call` smoke test passes (not curl) — batch with `calls: []` instead of N round trips
283
+ - [ ] `mini_app_open`, then `mini_app_errors` **compile green it renders**; do not stop at the build
284
+ - [ ] `mini_app_view_eval` confirms the styling actually applied (no hardcoded hex, no composed class names)
285
+ - [ ] `call` keys ⊆ `api` keys; no fetch / secrets / llm in the UI; compound part names taken from a contract, not memory