@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
@@ -1,35 +1,98 @@
1
1
  # RunContext `ctx`
2
2
 
3
- 每个 `api.*` / `onMount` / `onUnmount` 都拿到同一个 `ctx`。
3
+ Every `api.*` method (`defineApp({ api })` keys) receives the same `ctx`.
4
4
 
5
- ## 总是可用
5
+ ## Always available
6
6
 
7
- | API | 返回 | 说明 |
8
- |-----|------|------|
9
- | `ctx.appId` | string | 当前小程序 reverse-DNS id |
10
- | `ctx.appDir` | string | 当前小程序绝对目录(`runtime/apps/<appId>`) |
11
- | `ctx.storage.get(key)` | value `null` | `storage/main.storage.json` |
12
- | `ctx.storage.set(key, value)` | | JSON 可序列化 |
7
+ | API | Returns | Notes |
8
+ |-----|---------|-------|
9
+ | `ctx.appId` | string | Reverse-DNS id of the running mini-app |
10
+ | `ctx.appDir` | string | Absolute directory of this app (`runtime/apps/<appId>`) |
11
+ | `ctx.storage.get(key)` | value or `null` | Backed by `storage/main.storage.json` |
12
+ | `ctx.storage.set(key, value)` | | Value must be JSON-serialisable |
13
13
  | `ctx.storage.delete` / `clear` | | |
14
- | `ctx.storage.table(name)` | 同样 API | `{name}.storage.json`,name=`[A-Za-z0-9_-]` |
15
- | `ctx.state` | object | 内存,与 defineDashboard.state 同一引用 |
16
- | `ctx.config` | `{ theme, palette, chatLanguage, hostPort, llm }` | 只含本 Host 配置(设置页 / 顶栏配色可改),**不是** dsh 设置 dump。`theme`=`light`/`dark`;`palette`=`default`/`ocean`/`violet`/`slate`(默认/海蓝/青紫/石墨) |
17
- | `ctx.credentials` | `Record<string,string>` | 声明过的密钥 |
14
+ | `ctx.storage.table(name)` | same API | Independent table in the same app (`{name}.storage.json`); `name` = `[A-Za-z0-9_-]` |
15
+ | `ctx.storage.bytes()` | number | Bytes this table occupies — for your own "is this getting big" logging |
16
+ | `ctx.state` | object | In-memory; the same reference as `defineApp.state` |
17
+ | `ctx.config` | `{ theme, palette, chatLanguage, hostPort, llm }` | This host's own settings only (settings page / top bar), **not** a dsh settings dump. `theme` = `light`\|`dark`\|`system` (a *preference* — resolve `system` yourself if you need a concrete mode); `palette` = `default`\|`ocean`\|`violet`\|`slate` |
18
+ | `ctx.credentials` | `Record<string,string>` | Secrets **supplied by the host** — a mini-app cannot declare them. `{}` when the host has no credential service: read by key, show a usable empty state when missing, never invent key names |
18
19
  | `ctx.log(...args)` | | console |
19
- | `ctx.signal` | AbortSignal undefined | 当前调用的取消信号(chat 点「停止」时 abort)。长任务在批次/循环间 `if (ctx.signal?.aborted) throw new Error("cancelled")`,`sleep` 也传它 |
20
- | `ctx.push(method, params)` | | 常为 no-op |
21
- | `ctx.system.metrics()` | os 快照 | |
20
+ | `ctx.signal` | AbortSignal or undefined | Cancel signal for the current call (aborted when the user hits "stop"). In long jobs check `if (ctx.signal?.aborted) throw new Error("cancelled")` between batches/loops and pass it to `sleep` too |
21
+ | `ctx.push(name, params)` | SSE to this app's UI | Live channel for `useApp().on(name, cb)`. Fire-and-forget, never throws; `params` must be JSON-serialisable. Host keeps the last 200 events **per app**, so a reconnecting or later-opened UI replays them (`Last-Event-ID`) |
22
+ | `ctx.system.metrics()` | os snapshot | |
22
23
 
23
- ## Host 能力
24
+ ## Typed events
24
25
 
25
- | API | 签名 | 返回 | Fallback | 失败 |
26
- |-----|------|------|----------|------|
27
- | `http(url)` / `http(url, opts)` | opts:`method?` `headers?` `query?` `body?` `timeout?`(默认 8s)。自动组合 `ctx.signal`(停止即中断) | `{ ok, status, headers, text, json }`。`json` 仅当 Content-Type 含 json 且能 parse,否则 `null`。HTTP 4xx/5xx **不 throw**,看 `ok`/`status`。只允许 http/https | Node `fetch` | `http: timeout` / `http: only http/https` / `http: response too large` / `http: …` |
28
- | `bash(command)` | string | `{ stdout, stderr, exitCode }` | 本地 `bash -c` 120s/8MB → dsh `shell.run`。给本机命令用,**不要** `curl` | `bash unavailable` |
29
- | `tool(name, args)` | args **普通对象**,禁止 `{input}` | **string** | dsh tools | `tool: ctx.tools not available` |
30
- | `mcp(name, args?)` | 不要 `mcp_` 前缀 | string | `tool(name)` `tool("mcp__"+name)`。dsh 登记名是 `mcp__<server>__<tool>`,例如 `ctx.mcp("everything__echo", { message: "hi" })` | 第一次错误 |
31
- | `llm(prompt, opts?)` | 见下方 **ModelCallOptions** | **string** | dsh `llm.stream` | `llm: no dsh model service` / `llm stream empty` |
32
- | `agent(goal, opts?)` | **ModelCallOptions** + `onEvent?`(见下) | **string** | dsh one-shot agent(与聊天 session 隔离);可用工具循环。不要用多次 `ctx.llm` 假装 agent | `agent: … unbound` / `empty result` / `cancelled` |
26
+ `ctx.push("stage", …)` and `useApp().on("stage", …)` are joined by a **string**, and no type can
27
+ cross the seam: `ui.tsx` may not import `main.api.ts` (AGENTS.md → Hard constraints 1), so the
28
+ compiler cannot see that the two names must agree. A typo produces an app that renders perfectly
29
+ and never updates.
30
+
31
+ Declare the names once in `shared/` the one tree both sides may import and let the literal be
32
+ the source of truth:
33
+
34
+ ```ts
35
+ // shared/events.ts (pure isomorphic: no React, no ctx, no DOM)
36
+ export const EV = {
37
+ progress: "progress",
38
+ latest: "latest",
39
+ } as const;
40
+
41
+ export type Events = {
42
+ progress: { running: boolean; step: string; done: number; total: number; error?: string };
43
+ latest: { items: { title: string }[]; digest: { headline: string; bullets: string[] } | null; at: number };
44
+ };
45
+
46
+ export type Progress = Events["progress"];
47
+ export type Payload = Events["latest"];
48
+ ```
49
+
50
+ ```ts
51
+ // api/scan.ts (or main.api.ts)
52
+ import { EV, type Progress } from "../shared/events";
53
+ const next: Progress = { running: true, step: "fetch", done: 1, total: 3 };
54
+ ctx.push(EV.progress, next);
55
+ ```
56
+
57
+ ```tsx
58
+ // ui.tsx
59
+ import { EV, type Progress } from "./shared/events";
60
+ const { on } = useApp();
61
+ useEffect(() => on(EV.progress, (p) => setProgress(p as Progress)), [on]);
62
+ ```
63
+
64
+ Rename `EV.progress` once — both sides move. The `Events` map is the payload contract.
65
+ Worked example: `templates/radar/shared/events.ts`. `mini_app_reload` still notices a leftover
66
+ string literal that nothing pushes (`"stga"`); names that go through `EV.*` are the source of truth.
67
+
68
+ ## Choosing a table
69
+
70
+ Tables are independent namespaces over the same API: `ctx.storage.table("reads")` gives you a table
71
+ whose keys cannot collide with the default one. There is no `keys()`, no enumeration and no query —
72
+ every method addresses exactly one key. Each table is one JSON file; every `set` rewrites that file,
73
+ so **what shares a table is a real cost**, not just a naming preference:
74
+
75
+ | Data | Put it in |
76
+ |---|---|
77
+ | A handful of settings (source list, thresholds, UI prefs) | default `ctx.storage` — small, and you read it whole anyway |
78
+ | Anything that **grows**: fetched article bodies, run logs, activity, per-day records, snapshots | its own `ctx.storage.table("reads")` |
79
+ | Both of the above in one app | two tables — otherwise your settings rewrite rides along with every log line |
80
+
81
+ Large lists should be **one key per row** (`await rows.set(id, row)`), not one giant array under a
82
+ single key. `ctx.storage.bytes()` answers "how big is this table right now". Past roughly 512 KB the
83
+ host surfaces a **panel banner** (writes are never blocked) with the heaviest keys and a copy-paste
84
+ prompt you can hand to an agent to do the split.
85
+
86
+ ## Host capabilities
87
+
88
+ | API | Signature | Returns | Fallback | Failure |
89
+ |-----|-----------|---------|----------|---------|
90
+ | `http(url)` / `http(url, opts)` | opts: `method?` `headers?` `query?` `body?` `timeout?` (default 8s). Automatically combines `ctx.signal` (stop aborts the request) | `{ ok, status, headers, text, json }`. `json` is set only when Content-Type contains json **and** parsing succeeds, else `null`. HTTP 4xx/5xx **do not throw** — check `ok`/`status`. http/https only | Node `fetch` | `http: timeout` / `http: only http/https` / `http: response too large` / `http: …` |
91
+ | `bash(command)` | string | `{ stdout, stderr, exitCode }` | Local `bash -c`, 120s/8MB → dsh `shell.run`. For machine commands; **do not** shell out to `curl` | `bash unavailable` |
92
+ | `tool(name, args)` | args is a **plain object**, never `{input}` | **string** | dsh tools | error containing `tool:` when the host exposes no tool service |
93
+ | `mcp(name, args?)` | no `mcp_` prefix | string | tries `tool(name)` then `tool("mcp__"+name)`. dsh registers `mcp__<server>__<tool>`, e.g. `ctx.mcp("everything__echo", { message: "hi" })` | first-attempt error |
94
+ | `llm(prompt, opts?)` | see **ModelCallOptions** below | **string** | dsh `llm.stream` | `llm: no dsh model service` / `llm stream empty` |
95
+ | `agent(goal, opts?)` | **ModelCallOptions** + `onEvent?` (below) | **string** | dsh one-shot agent (isolated from the chat session); may loop over tools. Do not fake an agent with repeated `ctx.llm` calls | `agent: … unbound` / `empty result` / `cancelled` |
33
96
 
34
97
  ```ts
35
98
  const r = await ctx.http("https://example.com/api", {
@@ -42,18 +105,19 @@ if (!r.ok) throw new Error("HTTP " + r.status);
42
105
  const data = r.json ?? JSON.parse(r.text);
43
106
  ```
44
107
 
45
- POST:`ctx.http(url, { method: "POST", body: { a: 1 } })`(对象会 JSON 编码)。RSS/HTML `r.text`。
108
+ POST: `ctx.http(url, { method: "POST", body: { a: 1 } })` (objects are JSON-encoded). For RSS/HTML use `r.text`.
46
109
 
47
- ### ModelCallOptions(`llm` / `agent` 共用最小集合)
110
+ ### ModelCallOptions (shared minimum for `llm` / `agent`)
48
111
 
49
112
  ```ts
50
113
  type ModelCallOptions = {
51
- provider?: string; // 默认跟 dsh 当前模型;可不传
114
+ provider?: string; // defaults to the host's current model; usually omitted
52
115
  model?: string;
53
116
  system?: string;
54
- schema?: object; // JSON Schema;要对象时用,再 JSON.parse 返回值
55
- maxTokens?: number;
56
- signal?: AbortSignal; // api 调用里通常已有 ctx.signal,可省略
117
+ schema?: object; // JSON Schema — use it when you need an object, then JSON.parse the result
118
+ maxTokens?: number; // host default 4096 when unset — raise it for wide arrays
119
+ retryTimes?: number; // attempts IN TOTAL (1 = no retry); llm default 3, agent default 1
120
+ signal?: AbortSignal; // ctx.signal already exists inside an api call, so this is optional
57
121
  };
58
122
 
59
123
  // llm
@@ -66,23 +130,29 @@ await ctx.agent(goal, opts?: ModelCallOptions & {
66
130
  onEvent?: (ev: AgentEvent) => void;
67
131
  /**
68
132
  * Working dir mode (default "process").
69
- * app = 当前小程序目录;process = dsh 启动目录;temp = 临时目录;custom = cwd 绝对路径。
70
- * 只传 cwd 路径 视为 custom。cwd + custom cwdType 报错。
133
+ * app = this mini-app's directory; process = host start dir; temp = temp dir; custom = absolute cwd.
134
+ * Passing only a cwd path implies custom. cwd + a non-custom cwdType is an error.
71
135
  */
72
136
  cwdType?: "app" | "process" | "temp" | "custom";
73
- cwd?: string; // 绝对路径;custom 必填,或单独传
137
+ cwd?: string; // absolute path; required for custom
74
138
  }): Promise<string>
75
139
  ```
76
140
 
77
- 路由:`opts.provider/model` → dsh 当前 `agent-default-model` → `deepseek-official` / `deepseek-v4-flash`。不必改 `host.json`。
141
+ Routing: `opts.provider/model` → host `agent-default-model` → `deepseek-official` / `deepseek-v4-flash`. No `host.json` edit needed.
78
142
 
79
- ### `opts.schema`(llm + agent
143
+ ### `opts.schema` (llm + agent)
80
144
 
81
- 软约束「只回 JSON」+ markdown;**返回仍是 string**,`JSON.parse`。例子 → [llm-json.md](llm-json.md)。提示宜短,约束交给 schema
145
+ A soft "reply with JSON only" constraint plus fence stripping — **the return value is still a string**, you `JSON.parse` it. Examples → [llm-json.md](llm-json.md). Keep the prompt short: state the task, push the constraints into `schema`.
82
146
 
83
- ### `opts.onEvent`(仅 agent)— 过程事件完整形状
147
+ ### `opts.onEvent` (agent only) — full event shapes
84
148
 
85
- 返回值仍是最终 string;`onEvent` 只观测过程。UI storage 轮询即可:
149
+ The return value is still the final string; `onEvent` only observes the run. To show progress in the UI pass
150
+ `streamTo: "agent"` — the host mirrors every event as `ctx.push("agent", event)`:
151
+
152
+ ```ts
153
+ await ctx.agent(goal, { streamTo: "agent", maxIterations: 12 });
154
+ // UI: on("agent", (ev) => …) — see templates/runner
155
+ ```
86
156
 
87
157
  ```ts
88
158
  type AgentEvent =
@@ -91,37 +161,37 @@ type AgentEvent =
91
161
  | { type: "tool"; phase: "start" | "end"; name: string; args?: unknown; result?: unknown }
92
162
  | { type: "turn"; phase: "start"; turn: number }
93
163
  | { type: "turn"; phase: "end"; turn: number; reason?: { kind: string; error?: unknown; reason?: unknown } }
94
- // reason.kind 常见:completed | blocked | error | aborted | max-tokens
164
+ // common reason.kind: completed | blocked | error | aborted | max-tokens
95
165
  | { type: "error"; message: string }
96
166
  | { type: "done"; text: string };
97
167
 
98
168
  const trace = [];
99
- const text = await ctx.agent("根据材料给出洞察", {
169
+ const text = await ctx.agent("Summarise the material into insights", {
100
170
  schema: { type: "object", properties: { summary: { type: "string" } }, required: ["summary"] },
101
171
  onEvent: (ev) => {
102
172
  trace.push(ev);
103
- void ctx.storage.set("agentTrace", trace);
173
+ ctx.push("agentEvent", ev); // live to the UI; do NOT persist per event — that rewrites the
174
+ // whole file once per step, for a buffer nobody reads mid-run
104
175
  },
105
176
  });
106
177
  const insight = JSON.parse(text);
107
178
  ```
108
179
 
109
- `ctx.agent` 与用户聊天 session 隔离(ephemeral,跑完 dispose)。
110
-
180
+ `ctx.agent` is isolated from the user's chat session (ephemeral, disposed when it finishes).
111
181
 
112
- ## 列出当前 tool
182
+ ## Listing live tools
113
183
 
114
- **仅当 main.api.ts 会调用 `ctx.tool` 时**才调聊天工具 `mini_app_list_ctx_tools`。纯 storage / http / bash / llm 的 app 不要调。
184
+ Call the chat tool `mini_app_list_ctx_tools` **only when `main.api.ts` will actually use `ctx.tool`**. Skip it for storage / http / bash / llm-only apps.
115
185
 
116
- 后端也可用 `ctx.listTools()`。不要假设 read/write/bash 一定存在或参数名固定。
186
+ The backend can also call `ctx.listTools()`. Never assume `read` / `write` / `bash` exist or that their parameter names are stable.
117
187
 
118
- ## 长耗时任务:必须采样 + 响应取消
188
+ ## Long jobs: sample and honour cancellation
119
189
 
120
- 多源抓取 × LLM 分析这类任务,**不要全量跑**:
190
+ Multi-source fetch × LLM analysis — **do not run it in full**:
121
191
 
122
- - **采样走通流程**:10 RSS 2 个有代表性的源(如主站 + 高热度站);批次只跑 1 批(如最热的 16~24 条)验证全链路;其余用启发式兜底。告诉用户「先跑样例,全量可后续加」。
123
- - **批次上限**:LLM 分析批次数硬上限(如 `MAX_BATCHES = 2`),避免单次调用跑 10 分钟。
124
- - **必须响应取消**:循环/批次/sleep 处检查 `ctx.signal`:
192
+ - **Sample the flow end to end**: of 10 RSS feeds take 2 representative sources; of N batches run 1 (e.g. the hottest 1624 items) to prove the whole path; fall back to heuristics for the rest. Tell the user "sample first, full run is a switch away".
193
+ - **Hard batch cap**: limit LLM batches (e.g. `MAX_BATCHES = 2`) so one call never runs ten minutes.
194
+ - **Always honour cancellation**:
125
195
  ```ts
126
196
  async function sleep(ms: number, signal?: AbortSignal) {
127
197
  return new Promise((resolve) => {
@@ -130,8 +200,8 @@ const insight = JSON.parse(text);
130
200
  signal?.addEventListener("abort", () => { clearTimeout(t); resolve(); }, { once: true });
131
201
  });
132
202
  }
133
- // 批次间
203
+ // between batches
134
204
  if (ctx.signal?.aborted) throw new Error("cancelled");
135
205
  await sleep(400, ctx.signal);
136
206
  ```
137
- - **异步进度**:长任务提供 `scanStatus`/`progress` 类方法(写入 storage),UI 轮询;`scan` 本身 fire-and-forget 立即返回「已启动」。
207
+ - **Async progress**: `ctx.push(name, payload)` from the background job; the UI fetches one snapshot on mount (`runStatus`) and then applies pushed events — do **not** `setInterval` a status method. Keep writing the snapshot to storage as well, so an app opened cold still shows the last state. Buffer is 200/app: if the UI sees an `app:gap` (`onAny` receives `{ name: "*", data: { gap: true } }`), refetch the snapshot.
@@ -0,0 +1,115 @@
1
+ # Asking the rendered view (`mini_app_view_eval`)
2
+
3
+ `mini_app_errors` tells you an app crashed. This tells you **what it drew** — which is the
4
+ question left over once the build is green and the panel shows something, just not the thing
5
+ you meant.
6
+
7
+ You send JavaScript; it runs inside the app's rendered iframe; you get text back. Nothing is
8
+ pre-decided about what to look at, so there is no "the tool doesn't support that" case.
9
+
10
+ ## When to ask, and when not to
11
+
12
+ | Situation | Do this instead |
13
+ |---|---|
14
+ | It compiled and the panel is blank / errored | `mini_app_errors` — cheaper, and a crash is already reported to you |
15
+ | "Did this Tailwind class / theme token actually apply?" | ask the view (below) |
16
+ | "Is this node zero-size / hidden / not in the tree?" | ask the view |
17
+ | "Is this centred? Does it look good?" | **do not ask the view** — there are no pixels here. Describe the change and let the user judge |
18
+ | Backend returned the wrong thing | `mini_app_call` — no browser involved |
19
+
20
+ It needs a **live iframe**: `mini_app_open({ appId })` first. If nothing is rendering the app
21
+ you get `view: "not-open"`, not an empty answer.
22
+
23
+ Every query runs on a budget: `timeoutMs` (default 1500, capped at 8000), echoed back as
24
+ `budgetMs` so a near-miss is visible. If it expires, the host asks your view a trivial question
25
+ and the answer decides what you're told: `pending` means the page is healthy and your expression
26
+ is still running — raise `timeoutMs` or split the click-wait-assert into separate calls;
27
+ `stuck` means even the probe went unanswered, i.e. the main thread is genuinely blocked.
28
+
29
+ ## The three names you get
30
+
31
+ ```js
32
+ mma.$(sel, root?) // Element | null
33
+ mma.$$(sel, root?) // Array<Element> — a real array, so .map() / .filter() / [0] work
34
+ mma.selector(el) // a CSS string you can hand straight back to mma.$()
35
+ ```
36
+
37
+ Everything else is standard DOM (`textContent`, `dataset`, `getBoundingClientRect`,
38
+ `classList`, `closest`, `children`). Host-side data is one same-origin `fetch` away:
39
+
40
+ ```js
41
+ const r = await fetch("/api/app/com.example.todo/errors");
42
+ return (await r.json()).errors.map((e) => e.message);
43
+ ```
44
+
45
+ `code` is an **async function body**, so it must `return`. Omit it for the default, which is
46
+ `return mma.$("#root")` — a shallow tree, and the cheapest way to see what you drew.
47
+
48
+ ## Recipes
49
+
50
+ ```js
51
+ // 1. Did the class land? (compare the two colours, do not eyeball the name)
52
+ const el = mma.$("button.btn");
53
+ const cs = getComputedStyle(el);
54
+ return { class: el.className, bg: cs.backgroundColor, color: cs.color };
55
+
56
+ // 2. Which nodes rendered to nothing? (a class that never compiled, or a false condition)
57
+ return mma.$$("#root *").filter((n) => n.getBoundingClientRect().width === 0 && n.children.length === 0)
58
+ .map((n) => mma.selector(n) + " " + n.className);
59
+
60
+ // 3. Something is off-screen — find it by geometry, not by guessing the layout
61
+ return mma.$$("#root *").filter((n) => { const b = n.getBoundingClientRect();
62
+ return b.right > innerWidth + 1 || b.bottom > innerHeight + 1; }).map(mma.selector);
63
+
64
+ // 4. Walk deeper than the default 2 levels: return the node itself
65
+ return mma.$(".toolbar");
66
+
67
+ // 5. Is a hidden branch the reason?
68
+ return mma.$$(".notes").map((n) => ({ sel: mma.selector(n), display: getComputedStyle(n).display }));
69
+ ```
70
+
71
+ Pattern: **`$$` to find, `selector` to name, `$` to go back in.** A list of elements comes
72
+ back as one line each without children — that is a locator, and it is deliberately cheap;
73
+ return one of those nodes to see its subtree.
74
+
75
+ ## Reading the answer
76
+
77
+ ```
78
+ # 6 lines shown of 6 in subtree · 1 query hit · depth 2 · coords: viewport px (scrolls with page) · viewport 1024x768 · 0.3KB · 4ms
79
+ div#root.panel.flex x=16 y=64 w=380 h=812 (2 children)
80
+ h2.title x=16 y=64 w=200 h=24 "Panel"
81
+ aside.notes x=16 y=564 w=380 h=212 (1 child) display:none
82
+ +2 deeper levels not shown — return that node to go on
83
+ ```
84
+
85
+ * Containers report `(N children)`, never their whole text — a panel's text is the page.
86
+ * `x= y= w= h=` are **viewport pixels** (they move with scroll), stated in the header.
87
+ * `display:none` / `visibility:hidden` / `opacity:0` / `detached` are flags, not bugs. An
88
+ element with no box has no geometry to complain about.
89
+ * The header states how much you got. If it says `STOPPED by bytes`, the rest is missing.
90
+
91
+ ## When it fails, `view` says whose fault it is
92
+
93
+ | `view` | Meaning | Next step |
94
+ |---|---|---|
95
+ | `live` + `ok: false` | your JavaScript failed — `error.kind` is `syntax` or `runtime`, with `line`/`source`/`caret` into **your** code | fix the query |
96
+ | `not-open` | nothing is rendering this app | `mini_app_open`, then retry |
97
+ | `runner-not-booted` | the iframe exists but its script never ran | the bundle or the page is broken → `mini_app_errors`, then `mini_app_open` |
98
+ | `stuck` | the script ran and then stopped answering | the main thread is blocked (an app loop, or one of yours) — **no tool fixes this**: ask the user to reload the tab |
99
+
100
+ The distinction between the last three matters: only `not-open` is fixed by opening, and only
101
+ `stuck` means something is running that never ends — which needs a human, not another tool call.
102
+
103
+ ## Limits, stated plainly
104
+
105
+ * **A synchronous infinite loop freezes more than the query.** The executor never gets the
106
+ thread back, so nothing can interrupt it — and the wedged iframe blocks the whole panel
107
+ page with it, which means no tool call can recover it. If you send a loop that does not
108
+ terminate, tell the user to reload the tab. Prefer `mma.$$` + `.filter` / `.map` over
109
+ hand-rolled walks; they are shorter and they terminate.
110
+ * The reply is capped at `min(maxBytes, 6144)` — about 1.5 k tokens. If you need more, ask a
111
+ narrower question rather than raising the cap; four small queries beat one big dump.
112
+ * Not a screenshot. No pixels, no "is this pretty", no cross-origin frames (an `<iframe>` in
113
+ your app is a different document — its subtree is reported as one node).
114
+ * It reads the **live** DOM, so an app that loads data on mount answers differently before and
115
+ after its fetch settles. If a query comes back emptier than expected, ask again.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @exampleOf Alert
3
+ * @title Alert
4
+ * @scenario Inline, non-blocking notice inside a page or panel — title + description, colours follow the semantic theme. Use for 'saved', '2 checks failed'; reach for Toast for transient confirmations and Dialog when the user must acknowledge.
5
+ */
6
+ import { Alert, AlertDescription, AlertTitle } from "@monkey-mini-app/ui";
7
+
8
+ export default function Alert01Example() {
9
+ return (
10
+ <>
11
+ <Alert>
12
+ <AlertTitle>Heads up</AlertTitle>
13
+ <AlertDescription>Something needs attention.</AlertDescription>
14
+ </Alert>
15
+ </>
16
+ );
17
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @exampleOf AspectRatio
3
+ * @title AspectRatio
4
+ * @scenario A media/skeleton placeholder that must keep a fixed ratio (16/9 here) while its container resizes — prevents layout shift when images or embeds load late.
5
+ */
6
+ import { AspectRatio } from "@monkey-mini-app/ui";
7
+
8
+ export default function AspectRatio01Example() {
9
+ return (
10
+ <>
11
+ <div className="w-48">
12
+ <AspectRatio ratio={16 / 9} className="rounded-lg bg-muted" />
13
+ </div>
14
+ </>
15
+ );
16
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @exampleOf Attachment
3
+ * @title Attachment
4
+ * @scenario A file chip in a list — icon, name, meta line and a remove affordance; the shape used for uploaded files or chat attachments.
5
+ */
6
+ import { Attachment, AttachmentContent, AttachmentDescription, AttachmentTitle } from "@monkey-mini-app/ui";
7
+
8
+ export default function Attachment01Example() {
9
+ return (
10
+ <>
11
+ <Attachment>
12
+ <AttachmentContent>
13
+ <AttachmentTitle>report.pdf</AttachmentTitle>
14
+ <AttachmentDescription>PDF · 120 KB</AttachmentDescription>
15
+ </AttachmentContent>
16
+ </Attachment>
17
+ </>
18
+ );
19
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @exampleOf Breadcrumb
3
+ * @title Breadcrumb
4
+ * @scenario Deep-navigation path where the current level is not a link and separators are automatic; use for drill-down pages (org / team / project / run).
5
+ */
6
+ import {
7
+ Breadcrumb,
8
+ BreadcrumbItem,
9
+ BreadcrumbLink,
10
+ BreadcrumbList,
11
+ BreadcrumbPage,
12
+ BreadcrumbSeparator,
13
+ } from "@monkey-mini-app/ui";
14
+
15
+ export default function Breadcrumb01Example() {
16
+ return (
17
+ <>
18
+ <Breadcrumb>
19
+ <BreadcrumbList>
20
+ <BreadcrumbItem>
21
+ <BreadcrumbLink href="#">Home</BreadcrumbLink>
22
+ </BreadcrumbItem>
23
+ <BreadcrumbSeparator />
24
+ <BreadcrumbItem>
25
+ <BreadcrumbPage>Demo</BreadcrumbPage>
26
+ </BreadcrumbItem>
27
+ </BreadcrumbList>
28
+ </Breadcrumb>
29
+ </>
30
+ );
31
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @exampleOf Bubble
3
+ * @title Bubble
4
+ * @scenario One side of a chat transcript — agent vs user bubble without hand-rolling alignment or spacing.
5
+ */
6
+ import { Bubble, BubbleContent } from "@monkey-mini-app/ui";
7
+
8
+ export default function Bubble01Example() {
9
+ return (
10
+ <>
11
+ <Bubble>
12
+ <BubbleContent>Can you rerun login-spec?</BubbleContent>
13
+ </Bubble>
14
+ </>
15
+ );
16
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @exampleOf ButtonGroup
3
+ * @title Button / ButtonGroup
4
+ * @scenario Related buttons fused into one visual unit (joined borders/radius) — e.g. Save + dropdown Split action; distinct from Toolbar/ToggleGroup because there is no pressed state.
5
+ */
6
+ import { Button, ButtonGroup } from "@monkey-mini-app/ui";
7
+
8
+ export default function ButtonGroup01Example() {
9
+ return (
10
+ <>
11
+ <div className="flex flex-wrap gap-2">
12
+ <Button data-testid="primitive-button">Default</Button>
13
+ <Button variant="outline">Outline</Button>
14
+ <Button variant="ghost">Ghost</Button>
15
+ <Button variant="destructive">Destructive</Button>
16
+ <ButtonGroup>
17
+ <Button variant="outline">One</Button>
18
+ <Button variant="outline">Two</Button>
19
+ </ButtonGroup>
20
+ </div>
21
+ </>
22
+ );
23
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @exampleOf Card
3
+ * @title Card
4
+ * @scenario The default content container: header (title + description), body, optional footer. Start here for any panel before writing custom borders/padding.
5
+ */
6
+ import { Card, CardContent, CardHeader, CardTitle } from "@monkey-mini-app/ui";
7
+
8
+ export default function Card01Example() {
9
+ return (
10
+ <>
11
+ <Card>
12
+ <CardHeader>
13
+ <CardTitle>Card</CardTitle>
14
+ </CardHeader>
15
+ <CardContent>Interactive container.</CardContent>
16
+ </Card>
17
+ </>
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ <!-- generated by scripts/gen/skill — do not edit -->
2
+
3
+ # Examples · charts-blocks
4
+
5
+ Multi-component demos: layout/pattern recipes with no single subject component.
6
+ Copy the whole file into `ui.tsx` (or split it) — imports are `react` + `@monkey-mini-app/ui` only.
7
+
8
+ | example | what it shows | scenario |
9
+ |---|---|---|
10
+ | [`misc-charts-blocks-01.tsx`](./misc-charts-blocks/misc-charts-blocks-01.tsx) | PageHeader / FilterBar | Page chrome working together: PageHeader (title + description + primary action) with a FilterBar row beneath — the standard screen top for list/monitor pages. |
11
+ | [`misc-charts-blocks-02.tsx`](./misc-charts-blocks/misc-charts-blocks-02.tsx) | StatCard / TrendCard / Sparkline / Gauge / ProgressRing | KPI strip: StatCard for numbers with delta, TrendCard adding a sparkline, plus Sparkline/Gauge/ProgressRing for compact meters in one row. |
12
+ | [`misc-charts-blocks-03.tsx`](./misc-charts-blocks/misc-charts-blocks-03.tsx) | Donut / StackedBar / Radar | Recharts-backed set: DonutChart for share-of-total, StackedBarChart for composition over time, RadarChart for multi-axis scorecards — all fed plain arrays. |
13
+ | [`misc-charts-blocks-04.tsx`](./misc-charts-blocks/misc-charts-blocks-04.tsx) | StatusBadge / SeverityChip / EnvBadge | Status vocabulary in one view: StatusBadge (pass/fail/flaky, lowercase statuses), SeverityChip (P0–P3) and EnvBadge (dev/stg/prd) so triage rows read consistently. |
14
+ | [`misc-charts-blocks-05.tsx`](./misc-charts-blocks/misc-charts-blocks-05.tsx) | ActivityFeed / NotificationCenter / CommentThread / TestStepList | Feed-style blocks: ActivityFeed, NotificationCenter and CommentThread share an items-in / rows-out shape; TestStepList shows pass/fail steps per case. |
15
+ | [`misc-charts-blocks-06.tsx`](./misc-charts-blocks/misc-charts-blocks-06.tsx) | DescriptionList / RequestInspector / Terminal / FileTree / AttachmentGallery | Inspect/debug kit on one screen: DescriptionList for metadata, RequestInspector for a method/url/response, Terminal for command output, FileTree and AttachmentGallery for artifacts. |
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @exampleOf CodeBlock
3
+ * @title CodeBlock
4
+ * @scenario Read-only highlighted source with filename, language badge and copy button (shiki via CDN); use when the code is shown, not edited.
5
+ */
6
+ import { CodeBlock } from "@monkey-mini-app/ui";
7
+
8
+ export default function CodeBlock01Example() {
9
+ return (
10
+ <>
11
+ <CodeBlock language="ts" code={`type Run = { id: string }\nexport const run: Run = { id: \"1\" }\n`} />
12
+ </>
13
+ );
14
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @exampleOf CodeEditor
3
+ * @title CodeEditor
4
+ * @scenario Editable source with syntax highlighting and line numbers (CodeMirror 6 via CDN). Reach for it when the user changes config/scripts in-app; degrade to Textarea if the network blocks the CDN.
5
+ * @hint CodeMirror 6
6
+ */
7
+ import * as React from "react";
8
+
9
+ import { CodeEditor } from "@monkey-mini-app/ui";
10
+
11
+ export default function CodeEditor01Example() {
12
+ const [code, setCode] = React.useState("export const n = 1\n");
13
+
14
+ return <CodeEditor value={code} onChange={setCode} language="ts" />;
15
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @exampleOf Command
3
+ * @title Command
4
+ * @scenario Cmd-K style palette: fuzzy input over grouped actions with an empty state, mounted inline rather than as a dialog.
5
+ */
6
+ import {
7
+ Command,
8
+ CommandEmpty,
9
+ CommandGroup,
10
+ CommandInput,
11
+ CommandItem,
12
+ CommandList,
13
+ } from "@monkey-mini-app/ui";
14
+
15
+ export default function Command01Example() {
16
+ return (
17
+ <>
18
+ <Command className="h-40 w-72 rounded-xl border">
19
+ <CommandInput placeholder="Search…" />
20
+ <CommandList>
21
+ <CommandEmpty>No results</CommandEmpty>
22
+ <CommandGroup>
23
+ <CommandItem>Open grid</CommandItem>
24
+ <CommandItem>New run</CommandItem>
25
+ </CommandGroup>
26
+ </CommandList>
27
+ </Command>
28
+ </>
29
+ );
30
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @exampleOf ConfirmDialog
3
+ * @title ConfirmDialog / Toast
4
+ * @scenario Destructive-action guard — one click opens a yes/no dialog, cancel keeps state; pair with toast for the result. Do not hand-roll a Dialog for confirmations.
5
+ */
6
+ import * as React from "react";
7
+
8
+ import { Button, ConfirmDialog, toast } from "@monkey-mini-app/ui";
9
+
10
+ export default function ConfirmDialog01Example() {
11
+ const [confirm, setConfirm] = React.useState(false);
12
+
13
+ return (
14
+ <>
15
+ <div className="flex gap-2">
16
+ <Button variant="destructive" onClick={() => setConfirm(true)}>
17
+ Delete
18
+ </Button>
19
+ <Button variant="outline" onClick={() => toast.add({ title: "Saved", description: "Run updated." })}>
20
+ Toast
21
+ </Button>
22
+ </div>
23
+ <ConfirmDialog
24
+ open={confirm}
25
+ onOpenChange={setConfirm}
26
+ title="Delete this run?"
27
+ description="This cannot be undone."
28
+ confirmLabel="Delete"
29
+ onConfirm={() => setConfirm(false)}
30
+ />
31
+ </>
32
+ );
33
+ }