@agent-native/core 0.101.14 → 0.102.1

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 (316) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +12 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/cli/templates-meta.ts +13 -0
  5. package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +1 -1
  6. package/corpus/core/src/client/org/OrgSwitcher.tsx +2 -0
  7. package/corpus/templates/analytics/changelog/2026-07-15-fixed-the-agent-discarding-a-successful-dashboard-edit-and-r.md +6 -0
  8. package/corpus/templates/analytics/server/lib/real-data-actions.ts +30 -1
  9. package/corpus/templates/analytics/server/plugins/agent-chat.ts +15 -0
  10. package/corpus/templates/content/actions/_database-source-utils.ts +59 -4
  11. package/corpus/templates/content/actions/prepare-builder-source-review.ts +9 -0
  12. package/corpus/templates/content/actions/preview-builder-source-review.ts +6 -4
  13. package/corpus/templates/content/app/components/editor/DescriptionField.tsx +10 -2
  14. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +4 -0
  15. package/corpus/templates/content/changelog/2026-07-15-page-and-database-descriptions-now-use-a-clean-single-line-f.md +6 -0
  16. package/corpus/templates/content/changelog/2026-07-15-selected-builder-reviews-now-load-only-the-chosen-rows-avoid.md +6 -0
  17. package/corpus/templates/content/shared/api.ts +1 -0
  18. package/corpus/templates/tasks/.agents/commands/visual-plan.md +9 -0
  19. package/corpus/templates/tasks/.agents/commands/visual-recap.md +8 -0
  20. package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +492 -0
  21. package/corpus/templates/tasks/.agents/skills/adding-a-feature/SKILL.md +189 -0
  22. package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +76 -0
  23. package/corpus/templates/tasks/.agents/skills/agent-watchdog/README.md +43 -0
  24. package/corpus/templates/tasks/.agents/skills/agent-watchdog/SKILL.md +110 -0
  25. package/corpus/templates/tasks/.agents/skills/agent-watchdog/agents/openai.yaml +4 -0
  26. package/corpus/templates/tasks/.agents/skills/capture-learnings/SKILL.md +89 -0
  27. package/corpus/templates/tasks/.agents/skills/change-summary/SKILL.md +83 -0
  28. package/corpus/templates/tasks/.agents/skills/create-skill/SKILL.md +221 -0
  29. package/corpus/templates/tasks/.agents/skills/delegate-to-agent/SKILL.md +263 -0
  30. package/corpus/templates/tasks/.agents/skills/efficient-fable/README.md +75 -0
  31. package/corpus/templates/tasks/.agents/skills/efficient-fable/SKILL.md +95 -0
  32. package/corpus/templates/tasks/.agents/skills/efficient-frontier/README.md +53 -0
  33. package/corpus/templates/tasks/.agents/skills/efficient-frontier/SKILL.md +73 -0
  34. package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +112 -0
  35. package/corpus/templates/tasks/.agents/skills/plan-arbiter/README.md +41 -0
  36. package/corpus/templates/tasks/.agents/skills/plan-arbiter/SKILL.md +114 -0
  37. package/corpus/templates/tasks/.agents/skills/plan-arbiter/agents/openai.yaml +4 -0
  38. package/corpus/templates/tasks/.agents/skills/plow-ahead/README.md +42 -0
  39. package/corpus/templates/tasks/.agents/skills/plow-ahead/SKILL.md +104 -0
  40. package/corpus/templates/tasks/.agents/skills/plow-ahead/agents/openai.yaml +4 -0
  41. package/corpus/templates/tasks/.agents/skills/quick-recap/README.md +55 -0
  42. package/corpus/templates/tasks/.agents/skills/quick-recap/SKILL.md +54 -0
  43. package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/README.md +54 -0
  44. package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/SKILL.md +126 -0
  45. package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/agents/openai.yaml +4 -0
  46. package/corpus/templates/tasks/.agents/skills/real-time-sync/SKILL.md +232 -0
  47. package/corpus/templates/tasks/.agents/skills/security/SKILL.md +280 -0
  48. package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +106 -0
  49. package/corpus/templates/tasks/.agents/skills/shadcn-ui/SKILL.md +95 -0
  50. package/corpus/templates/tasks/.agents/skills/stay-within-limits/README.md +61 -0
  51. package/corpus/templates/tasks/.agents/skills/stay-within-limits/SKILL.md +83 -0
  52. package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
  53. package/corpus/templates/tasks/.agents/skills/visual-plan/SKILL.md +547 -0
  54. package/corpus/templates/tasks/.agents/skills/visual-plan/agent-native-skill.json +12 -0
  55. package/corpus/templates/tasks/.agents/skills/visual-plan/references/canvas.md +121 -0
  56. package/corpus/templates/tasks/.agents/skills/visual-plan/references/document-quality.md +178 -0
  57. package/corpus/templates/tasks/.agents/skills/visual-plan/references/exemplar.md +62 -0
  58. package/corpus/templates/tasks/.agents/skills/visual-plan/references/wireframe.md +264 -0
  59. package/corpus/templates/tasks/.agents/skills/visual-recap/SKILL.md +634 -0
  60. package/corpus/templates/tasks/.agents/skills/visual-recap/agent-native-skill.json +12 -0
  61. package/corpus/templates/tasks/.agents/skills/visual-recap/references/wireframe.md +264 -0
  62. package/corpus/templates/tasks/.claude/commands/visual-plan.md +9 -0
  63. package/corpus/templates/tasks/.claude/commands/visual-recap.md +8 -0
  64. package/corpus/templates/tasks/.env.example +5 -0
  65. package/corpus/templates/tasks/.ignore +0 -0
  66. package/corpus/templates/tasks/.prettierrc +5 -0
  67. package/corpus/templates/tasks/AGENTS.md +158 -0
  68. package/corpus/templates/tasks/DEVELOPING.md +185 -0
  69. package/corpus/templates/tasks/README.md +16 -0
  70. package/corpus/templates/tasks/actions/bulk-delete-inbox-items.ts +24 -0
  71. package/corpus/templates/tasks/actions/bulk-delete-tasks.ts +21 -0
  72. package/corpus/templates/tasks/actions/bulk-mark-inbox-items-ready.ts +27 -0
  73. package/corpus/templates/tasks/actions/bulk-update-tasks.ts +35 -0
  74. package/corpus/templates/tasks/actions/create-custom-field.ts +22 -0
  75. package/corpus/templates/tasks/actions/create-inbox-item.ts +30 -0
  76. package/corpus/templates/tasks/actions/create-task.ts +33 -0
  77. package/corpus/templates/tasks/actions/delete-custom-field.ts +19 -0
  78. package/corpus/templates/tasks/actions/delete-inbox-item.ts +17 -0
  79. package/corpus/templates/tasks/actions/delete-task.ts +17 -0
  80. package/corpus/templates/tasks/actions/lib/boolean-query-param.ts +30 -0
  81. package/corpus/templates/tasks/actions/list-custom-fields.ts +18 -0
  82. package/corpus/templates/tasks/actions/list-inbox-items.ts +16 -0
  83. package/corpus/templates/tasks/actions/list-tasks.ts +52 -0
  84. package/corpus/templates/tasks/actions/list-visible-task-fields.ts +18 -0
  85. package/corpus/templates/tasks/actions/mark-inbox-item-ready.ts +31 -0
  86. package/corpus/templates/tasks/actions/navigate.ts +51 -0
  87. package/corpus/templates/tasks/actions/reorder-custom-fields.ts +27 -0
  88. package/corpus/templates/tasks/actions/reorder-inbox-items.ts +24 -0
  89. package/corpus/templates/tasks/actions/reorder-tasks.ts +29 -0
  90. package/corpus/templates/tasks/actions/run.ts +2 -0
  91. package/corpus/templates/tasks/actions/update-custom-field.ts +33 -0
  92. package/corpus/templates/tasks/actions/update-inbox-item.ts +24 -0
  93. package/corpus/templates/tasks/actions/update-task.ts +68 -0
  94. package/corpus/templates/tasks/actions/update-visible-task-fields.ts +27 -0
  95. package/corpus/templates/tasks/actions/view-screen-helpers.ts +68 -0
  96. package/corpus/templates/tasks/actions/view-screen.ts +207 -0
  97. package/corpus/templates/tasks/app/components/custom-fields/FieldCreateBar.tsx +121 -0
  98. package/corpus/templates/tasks/app/components/custom-fields/FieldListRow.tsx +116 -0
  99. package/corpus/templates/tasks/app/components/custom-fields/FieldsList.tsx +225 -0
  100. package/corpus/templates/tasks/app/components/custom-fields/FieldsListSkeleton.tsx +18 -0
  101. package/corpus/templates/tasks/app/components/custom-fields/FieldsPage.tsx +42 -0
  102. package/corpus/templates/tasks/app/components/custom-fields/editor/FieldEditorSidebar.tsx +69 -0
  103. package/corpus/templates/tasks/app/components/custom-fields/editor/FieldTitleSection.tsx +32 -0
  104. package/corpus/templates/tasks/app/components/custom-fields/editor/config/CurrencyConfigControl.tsx +49 -0
  105. package/corpus/templates/tasks/app/components/custom-fields/editor/config/FieldConfigControl.tsx +56 -0
  106. package/corpus/templates/tasks/app/components/custom-fields/editor/config/NumberConfigControl.tsx +52 -0
  107. package/corpus/templates/tasks/app/components/custom-fields/editor/config/PercentConfigControl.tsx +30 -0
  108. package/corpus/templates/tasks/app/components/custom-fields/editor/config/SelectConfigControl.tsx +135 -0
  109. package/corpus/templates/tasks/app/components/custom-fields/editor/config/select-colors.ts +23 -0
  110. package/corpus/templates/tasks/app/components/custom-fields/editor/config/utils.ts +52 -0
  111. package/corpus/templates/tasks/app/components/custom-fields/editor/types.ts +7 -0
  112. package/corpus/templates/tasks/app/components/dnd/SortableItem.tsx +72 -0
  113. package/corpus/templates/tasks/app/components/dnd/SortableList.tsx +136 -0
  114. package/corpus/templates/tasks/app/components/dnd/reorder-moving-items.ts +160 -0
  115. package/corpus/templates/tasks/app/components/dnd/sortable-drag-props.ts +60 -0
  116. package/corpus/templates/tasks/app/components/inbox/InboxList.tsx +222 -0
  117. package/corpus/templates/tasks/app/components/inbox/InboxListPage.tsx +39 -0
  118. package/corpus/templates/tasks/app/components/inbox/InboxListRow.tsx +122 -0
  119. package/corpus/templates/tasks/app/components/layout/Header.tsx +55 -0
  120. package/corpus/templates/tasks/app/components/layout/HeaderActions.tsx +84 -0
  121. package/corpus/templates/tasks/app/components/layout/Layout.tsx +134 -0
  122. package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +211 -0
  123. package/corpus/templates/tasks/app/components/shared/AddListItemInput.tsx +57 -0
  124. package/corpus/templates/tasks/app/components/shared/AlertDialog.tsx +53 -0
  125. package/corpus/templates/tasks/app/components/shared/BulkDeleteDialog.tsx +76 -0
  126. package/corpus/templates/tasks/app/components/shared/ChipSelect.tsx +240 -0
  127. package/corpus/templates/tasks/app/components/shared/DeleteItemDialog.tsx +40 -0
  128. package/corpus/templates/tasks/app/components/shared/InlineEditable.tsx +166 -0
  129. package/corpus/templates/tasks/app/components/shared/ListEmptyState.tsx +13 -0
  130. package/corpus/templates/tasks/app/components/shared/ListErrorMessage.tsx +15 -0
  131. package/corpus/templates/tasks/app/components/shared/ListViewHeader.tsx +75 -0
  132. package/corpus/templates/tasks/app/components/shared/PageHeader.tsx +25 -0
  133. package/corpus/templates/tasks/app/components/shared/RowActionsMenu.tsx +42 -0
  134. package/corpus/templates/tasks/app/components/shared/SidePanel.tsx +99 -0
  135. package/corpus/templates/tasks/app/components/shared/dnd/ListRowPreview.tsx +37 -0
  136. package/corpus/templates/tasks/app/components/shared/list/List.tsx +63 -0
  137. package/corpus/templates/tasks/app/components/shared/list/ListRow.tsx +159 -0
  138. package/corpus/templates/tasks/app/components/shared/list/ListRowDragHandle.tsx +52 -0
  139. package/corpus/templates/tasks/app/components/shared/list/ListSkeletonRows.tsx +11 -0
  140. package/corpus/templates/tasks/app/components/shared/list/SortableListItemShell.tsx +32 -0
  141. package/corpus/templates/tasks/app/components/shared/list/types.ts +1 -0
  142. package/corpus/templates/tasks/app/components/shared/selection/ListSelectionBar.tsx +158 -0
  143. package/corpus/templates/tasks/app/components/shared/selection/ListSelectionHeaderToggle.tsx +28 -0
  144. package/corpus/templates/tasks/app/components/shared/selection/ListSelectionToolbar.tsx +81 -0
  145. package/corpus/templates/tasks/app/components/shared/selection/get-list-row-selection-ui.ts +41 -0
  146. package/corpus/templates/tasks/app/components/shared/selection/use-list-selection.ts +196 -0
  147. package/corpus/templates/tasks/app/components/tasks/TaskList.tsx +333 -0
  148. package/corpus/templates/tasks/app/components/tasks/TaskListHeaderRow.tsx +46 -0
  149. package/corpus/templates/tasks/app/components/tasks/TaskListPage.tsx +115 -0
  150. package/corpus/templates/tasks/app/components/tasks/TaskListRow.css +49 -0
  151. package/corpus/templates/tasks/app/components/tasks/TaskListRow.tsx +307 -0
  152. package/corpus/templates/tasks/app/components/tasks/fields/TaskFieldsSidebar.tsx +102 -0
  153. package/corpus/templates/tasks/app/components/tasks/fields/TaskTitleSection.tsx +27 -0
  154. package/corpus/templates/tasks/app/components/tasks/fields/controls/DateValueControl.tsx +21 -0
  155. package/corpus/templates/tasks/app/components/tasks/fields/controls/FieldValueControl.tsx +76 -0
  156. package/corpus/templates/tasks/app/components/tasks/fields/controls/MultiSelectValueControl.tsx +52 -0
  157. package/corpus/templates/tasks/app/components/tasks/fields/controls/NumberValueControl.tsx +56 -0
  158. package/corpus/templates/tasks/app/components/tasks/fields/controls/RichTextValueControl.tsx +115 -0
  159. package/corpus/templates/tasks/app/components/tasks/fields/controls/SingleSelectValueControl.tsx +61 -0
  160. package/corpus/templates/tasks/app/components/tasks/fields/controls/TextValueControl.tsx +20 -0
  161. package/corpus/templates/tasks/app/components/tasks/use-task-row-completion-animation.ts +181 -0
  162. package/corpus/templates/tasks/app/components/ui/accordion.tsx +56 -0
  163. package/corpus/templates/tasks/app/components/ui/alert-dialog.tsx +1 -0
  164. package/corpus/templates/tasks/app/components/ui/alert.tsx +1 -0
  165. package/corpus/templates/tasks/app/components/ui/aspect-ratio.tsx +5 -0
  166. package/corpus/templates/tasks/app/components/ui/avatar.tsx +1 -0
  167. package/corpus/templates/tasks/app/components/ui/badge.tsx +1 -0
  168. package/corpus/templates/tasks/app/components/ui/breadcrumb.tsx +115 -0
  169. package/corpus/templates/tasks/app/components/ui/button.tsx +1 -0
  170. package/corpus/templates/tasks/app/components/ui/calendar.tsx +70 -0
  171. package/corpus/templates/tasks/app/components/ui/card.tsx +1 -0
  172. package/corpus/templates/tasks/app/components/ui/carousel.tsx +260 -0
  173. package/corpus/templates/tasks/app/components/ui/chart.tsx +379 -0
  174. package/corpus/templates/tasks/app/components/ui/checkbox.tsx +1 -0
  175. package/corpus/templates/tasks/app/components/ui/collapsible.tsx +1 -0
  176. package/corpus/templates/tasks/app/components/ui/command.tsx +1 -0
  177. package/corpus/templates/tasks/app/components/ui/context-menu.tsx +1 -0
  178. package/corpus/templates/tasks/app/components/ui/dialog.tsx +1 -0
  179. package/corpus/templates/tasks/app/components/ui/drawer.tsx +1 -0
  180. package/corpus/templates/tasks/app/components/ui/dropdown-menu.tsx +1 -0
  181. package/corpus/templates/tasks/app/components/ui/form.tsx +177 -0
  182. package/corpus/templates/tasks/app/components/ui/hover-card.tsx +27 -0
  183. package/corpus/templates/tasks/app/components/ui/input-otp.tsx +69 -0
  184. package/corpus/templates/tasks/app/components/ui/input.tsx +1 -0
  185. package/corpus/templates/tasks/app/components/ui/label.tsx +1 -0
  186. package/corpus/templates/tasks/app/components/ui/menubar.tsx +254 -0
  187. package/corpus/templates/tasks/app/components/ui/navigation-menu.tsx +128 -0
  188. package/corpus/templates/tasks/app/components/ui/pagination.tsx +121 -0
  189. package/corpus/templates/tasks/app/components/ui/popover.tsx +1 -0
  190. package/corpus/templates/tasks/app/components/ui/progress.tsx +1 -0
  191. package/corpus/templates/tasks/app/components/ui/radio-group.tsx +1 -0
  192. package/corpus/templates/tasks/app/components/ui/resizable.tsx +43 -0
  193. package/corpus/templates/tasks/app/components/ui/scroll-area.tsx +1 -0
  194. package/corpus/templates/tasks/app/components/ui/select.tsx +1 -0
  195. package/corpus/templates/tasks/app/components/ui/separator.tsx +1 -0
  196. package/corpus/templates/tasks/app/components/ui/sheet.tsx +1 -0
  197. package/corpus/templates/tasks/app/components/ui/sidebar.tsx +782 -0
  198. package/corpus/templates/tasks/app/components/ui/skeleton.tsx +1 -0
  199. package/corpus/templates/tasks/app/components/ui/slider.tsx +1 -0
  200. package/corpus/templates/tasks/app/components/ui/sonner.tsx +1 -0
  201. package/corpus/templates/tasks/app/components/ui/spinner.tsx +1 -0
  202. package/corpus/templates/tasks/app/components/ui/switch.tsx +1 -0
  203. package/corpus/templates/tasks/app/components/ui/table.tsx +1 -0
  204. package/corpus/templates/tasks/app/components/ui/tabs.tsx +1 -0
  205. package/corpus/templates/tasks/app/components/ui/textarea.tsx +1 -0
  206. package/corpus/templates/tasks/app/components/ui/toast.tsx +1 -0
  207. package/corpus/templates/tasks/app/components/ui/toaster.tsx +1 -0
  208. package/corpus/templates/tasks/app/components/ui/toggle-group.tsx +1 -0
  209. package/corpus/templates/tasks/app/components/ui/toggle.tsx +43 -0
  210. package/corpus/templates/tasks/app/components/ui/tooltip.tsx +1 -0
  211. package/corpus/templates/tasks/app/components/ui/use-toast.ts +3 -0
  212. package/corpus/templates/tasks/app/entry.client.tsx +19 -0
  213. package/corpus/templates/tasks/app/entry.server.tsx +10 -0
  214. package/corpus/templates/tasks/app/global.css +93 -0
  215. package/corpus/templates/tasks/app/hooks/cache.ts +31 -0
  216. package/corpus/templates/tasks/app/hooks/use-custom-fields.ts +93 -0
  217. package/corpus/templates/tasks/app/hooks/use-inbox-items.ts +196 -0
  218. package/corpus/templates/tasks/app/hooks/use-mobile.tsx +21 -0
  219. package/corpus/templates/tasks/app/hooks/use-navigation-state.ts +40 -0
  220. package/corpus/templates/tasks/app/hooks/use-tasks.ts +276 -0
  221. package/corpus/templates/tasks/app/hooks/use-toast.ts +188 -0
  222. package/corpus/templates/tasks/app/hooks/use-visible-task-fields.ts +140 -0
  223. package/corpus/templates/tasks/app/lib/app-config.ts +11 -0
  224. package/corpus/templates/tasks/app/lib/tab-id.ts +1 -0
  225. package/corpus/templates/tasks/app/lib/utils.ts +1 -0
  226. package/corpus/templates/tasks/app/root.tsx +130 -0
  227. package/corpus/templates/tasks/app/routes/_index.tsx +22 -0
  228. package/corpus/templates/tasks/app/routes/extensions.$id.$slug.tsx +2 -0
  229. package/corpus/templates/tasks/app/routes/extensions.$id.tsx +11 -0
  230. package/corpus/templates/tasks/app/routes/extensions._index.tsx +11 -0
  231. package/corpus/templates/tasks/app/routes/extensions.tsx +5 -0
  232. package/corpus/templates/tasks/app/routes/fields.tsx +16 -0
  233. package/corpus/templates/tasks/app/routes/inbox.tsx +16 -0
  234. package/corpus/templates/tasks/app/routes/tasks.tsx +17 -0
  235. package/corpus/templates/tasks/app/routes/team.tsx +17 -0
  236. package/corpus/templates/tasks/app/routes.ts +4 -0
  237. package/corpus/templates/tasks/app/vite-env.d.ts +6 -0
  238. package/corpus/templates/tasks/components.json +20 -0
  239. package/corpus/templates/tasks/data/sync-config.json +1 -0
  240. package/corpus/templates/tasks/docs/features/README.md +81 -0
  241. package/corpus/templates/tasks/docs/features/f1-tasks.mdx +67 -0
  242. package/corpus/templates/tasks/docs/features/f2-custom-fields.mdx +68 -0
  243. package/corpus/templates/tasks/docs/features/f3-projects.mdx +33 -0
  244. package/corpus/templates/tasks/docs/features/f4-inbox.mdx +55 -0
  245. package/corpus/templates/tasks/docs/features/f5-views.mdx +65 -0
  246. package/corpus/templates/tasks/docs/features/f6-search.mdx +43 -0
  247. package/corpus/templates/tasks/docs/features/f7-first-run.mdx +66 -0
  248. package/corpus/templates/tasks/docs/features/f8-chat.mdx +120 -0
  249. package/corpus/templates/tasks/e2e/global-setup.ts +42 -0
  250. package/corpus/templates/tasks/e2e/helpers/inbox.ts +71 -0
  251. package/corpus/templates/tasks/e2e/helpers/tasks.ts +99 -0
  252. package/corpus/templates/tasks/learnings.defaults.md +5 -0
  253. package/corpus/templates/tasks/netlify.toml +10 -0
  254. package/corpus/templates/tasks/package.json +104 -0
  255. package/corpus/templates/tasks/playwright.config.ts +34 -0
  256. package/corpus/templates/tasks/public/agent-native-icon-dark.svg +10 -0
  257. package/corpus/templates/tasks/public/agent-native-icon-light.svg +10 -0
  258. package/corpus/templates/tasks/public/agent-native-logo-dark.svg +21 -0
  259. package/corpus/templates/tasks/public/agent-native-logo-light.svg +21 -0
  260. package/corpus/templates/tasks/public/favicon.svg +1 -0
  261. package/corpus/templates/tasks/public/icon-180.svg +1 -0
  262. package/corpus/templates/tasks/public/icon-192.svg +1 -0
  263. package/corpus/templates/tasks/public/icon-512.svg +1 -0
  264. package/corpus/templates/tasks/public/manifest.json +21 -0
  265. package/corpus/templates/tasks/react-router.config.ts +7 -0
  266. package/corpus/templates/tasks/server/custom-fields/normalize.ts +163 -0
  267. package/corpus/templates/tasks/server/custom-fields/parse.ts +146 -0
  268. package/corpus/templates/tasks/server/custom-fields/schema.ts +147 -0
  269. package/corpus/templates/tasks/server/custom-fields/store.ts +425 -0
  270. package/corpus/templates/tasks/server/custom-fields/task-fields.ts +104 -0
  271. package/corpus/templates/tasks/server/custom-fields/types.ts +98 -0
  272. package/corpus/templates/tasks/server/custom-fields/validate.ts +210 -0
  273. package/corpus/templates/tasks/server/custom-fields/values/store.ts +386 -0
  274. package/corpus/templates/tasks/server/db/bulk-write.ts +30 -0
  275. package/corpus/templates/tasks/server/db/index.ts +5 -0
  276. package/corpus/templates/tasks/server/db/record-utils.ts +7 -0
  277. package/corpus/templates/tasks/server/db/schema.ts +67 -0
  278. package/corpus/templates/tasks/server/db/test-tasks-table.ts +76 -0
  279. package/corpus/templates/tasks/server/db/transaction.ts +6 -0
  280. package/corpus/templates/tasks/server/errors.ts +31 -0
  281. package/corpus/templates/tasks/server/inbox/store.ts +216 -0
  282. package/corpus/templates/tasks/server/middleware/auth.ts +15 -0
  283. package/corpus/templates/tasks/server/plugins/agent-chat.ts +46 -0
  284. package/corpus/templates/tasks/server/plugins/auth.ts +15 -0
  285. package/corpus/templates/tasks/server/plugins/db.ts +90 -0
  286. package/corpus/templates/tasks/server/routes/[...page].get.ts +5 -0
  287. package/corpus/templates/tasks/server/stored-items/store.ts +548 -0
  288. package/corpus/templates/tasks/server/tasks/store.ts +306 -0
  289. package/corpus/templates/tasks/server/user-config/store.ts +138 -0
  290. package/corpus/templates/tasks/shared/app-state-tabs.ts +15 -0
  291. package/corpus/templates/tasks/shared/boolean-param.ts +22 -0
  292. package/corpus/templates/tasks/shared/bulk-limits.ts +7 -0
  293. package/corpus/templates/tasks/shared/list-screen-snapshot.ts +90 -0
  294. package/corpus/templates/tasks/shared/navigation.ts +104 -0
  295. package/corpus/templates/tasks/shared/visible-task-fields.ts +2 -0
  296. package/corpus/templates/tasks/ssr-entry.ts +15 -0
  297. package/corpus/templates/tasks/tsconfig.json +24 -0
  298. package/corpus/templates/tasks/vite.config.ts +19 -0
  299. package/corpus/templates/tasks/vitest.config.ts +8 -0
  300. package/dist/cli/templates-meta.d.ts.map +1 -1
  301. package/dist/cli/templates-meta.js +13 -0
  302. package/dist/cli/templates-meta.js.map +1 -1
  303. package/dist/client/agent-page/AgentTabsPage.js +1 -1
  304. package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
  305. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  306. package/dist/client/org/OrgSwitcher.js +2 -1
  307. package/dist/client/org/OrgSwitcher.js.map +1 -1
  308. package/dist/collab/routes.d.ts +1 -1
  309. package/dist/collab/struct-routes.d.ts +1 -1
  310. package/dist/notifications/routes.d.ts +2 -2
  311. package/dist/observability/routes.d.ts +5 -5
  312. package/dist/resources/handlers.d.ts +3 -3
  313. package/dist/secrets/routes.d.ts +9 -9
  314. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  315. package/dist/server/transcribe-voice.d.ts +1 -1
  316. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ # /read-the-damn-docs
2
+
3
+ Make agents web-search for the docs before they guess.
4
+
5
+ `/read-the-damn-docs` is a docs-first discipline skill for implementation,
6
+ debugging, and technical answers that depend on versioned or external behavior.
7
+ It tells the agent when docs are mandatory, why web search is usually the right
8
+ way to find them, which sources count as authoritative, and how to report the
9
+ evidence it used.
10
+
11
+ ## What It Does
12
+
13
+ - Forces a docs pass for third-party APIs, libraries, frameworks, CLIs, cloud
14
+ services, model SDKs, and provider integrations.
15
+ - Directs the agent to web-search for current official docs unless the relevant
16
+ docs are already local or supplied by the user.
17
+ - Requires current version checks before adding packages or writing install,
18
+ import, config, or CLI commands.
19
+ - Prioritizes local repo docs, specs, schemas, generated types, and tests for
20
+ internal contracts.
21
+ - Treats auth, security, billing, data, migrations, deploys, quotas, caching,
22
+ and compliance as docs-required surfaces.
23
+ - Makes the agent name the docs or files it relied on when that evidence affects
24
+ the implementation.
25
+
26
+ ## When To Use It
27
+
28
+ Use it when an agent might otherwise rely on stale model memory. Most of the
29
+ time, that means it should search the web for official docs first: latest/current
30
+ behavior, package setup, SDK usage, platform limits, provider APIs, upgrade
31
+ guides, framework config, OAuth, payments, webhooks, migrations, CI/CD, browser
32
+ APIs, and repo-specific contracts.
33
+
34
+ Skip it for trivial typo fixes, formatting, self-contained local code, or cases
35
+ where nearby tests and types fully answer the question.
36
+
37
+ ## Examples
38
+
39
+ These should trigger docs before code:
40
+
41
+ - Adding Tailwind, Next.js, React, Vite, Nitro, Drizzle, Prisma, or an AI SDK.
42
+ - Streaming model responses with OpenAI, Anthropic, Google, or a provider SDK.
43
+ - Wiring Stripe webhooks, OAuth, GitHub Actions, Slack apps, or Notion APIs.
44
+ - Debugging deprecations, unknown config fields, missing exports, or changed
45
+ framework defaults.
46
+ - Choosing a model, package, cloud API, storage strategy, or migration path.
47
+ - Implementing a repo-specific system where local docs, schemas, or generated
48
+ clients define the contract.
49
+
50
+ ## Install
51
+
52
+ ```sh
53
+ npx @agent-native/skills@latest add --skill read-the-damn-docs
54
+ ```
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: read-the-damn-docs
3
+ description: >-
4
+ Use when implementing, integrating, upgrading, debugging, or answering
5
+ anything involving third-party APIs, libraries, frameworks, CLIs, cloud
6
+ services, model/provider SDKs, fast-moving product behavior, user requests for
7
+ latest/current/official behavior, unfamiliar repo docs/specs, errors that may
8
+ indicate API drift, or high-stakes auth, security, billing, data, migration,
9
+ deployment, compliance, or privacy behavior. Forces Codex to web-search for
10
+ current official docs and read primary docs before assuming from memory.
11
+ ---
12
+
13
+ # Read The Damn Docs
14
+
15
+ Do not guess where authoritative docs can answer the question. The most common
16
+ right move is to web-search for the current official docs, open the relevant
17
+ pages, and read them before coding. For APIs, versions, provider behavior,
18
+ config, limits, lifecycle hooks, or security-sensitive flows, ground the answer
19
+ in what the docs actually say.
20
+
21
+ ## Docs-First Triggers
22
+
23
+ Read docs before proceeding when any of these are true:
24
+
25
+ - The user asks for "latest", "current", "official", "supported", "best
26
+ practice", "recommended", "today", "now", or "look it up".
27
+ - The needed docs are not already in the repo or supplied by the user. Search
28
+ the web for the official docs rather than hoping model memory is current.
29
+ - The task adds, upgrades, configures, or imports a package, SDK, framework,
30
+ plugin, CLI, model, cloud resource, or provider integration.
31
+ - The API is fast-moving or version-sensitive: AI SDKs, OpenAI/Anthropic/Google
32
+ APIs, Next.js, React, Tailwind, Vite, Nitro, Drizzle, Prisma, Stripe, GitHub,
33
+ Slack, Notion, browser APIs, deployment platforms, auth libraries, and similar.
34
+ - The implementation depends on auth, OAuth scopes, permissions, secrets,
35
+ webhooks, billing, payments, PII, encryption, data retention, migrations,
36
+ retries, rate limits, quotas, caching, deploys, or compliance.
37
+ - An error mentions deprecation, unknown options, missing exports, invalid
38
+ config, unsupported fields, changed defaults, or version mismatch.
39
+ - A repo has local docs, ADRs, generated schemas, OpenAPI specs, route/action
40
+ registries, design-system docs, or package-level READMEs that could define the
41
+ contract.
42
+ - The choice is expensive to reverse: public wire formats, database schema,
43
+ migration strategy, persistent IDs, event names, customer-visible behavior, or
44
+ external automation contracts.
45
+ - You catch yourself about to write "usually", "probably", "I think", "from
46
+ memory", or code copied from model memory for an external API.
47
+
48
+ ## What Counts As Docs
49
+
50
+ Use the most authoritative source available:
51
+
52
+ - Local repo docs, specs, ADRs, schemas, generated types, package READMEs, and
53
+ tests for project-specific behavior.
54
+ - Official product docs, API references, migration guides, changelogs, release
55
+ notes, and SDK source/types for third-party behavior. Find these with web
56
+ search when you do not already have the exact URL.
57
+ - Package registry metadata for versions. Before adding a dependency, run
58
+ `npm view <pkg> version`, `pnpm view <pkg> version`, or the ecosystem
59
+ equivalent, then read the docs for that major version.
60
+ - Source code or type definitions when official docs are incomplete. Treat this
61
+ as evidence, not folklore.
62
+
63
+ Avoid Stack Overflow, old blog posts, random snippets, and memory as the primary
64
+ source when official docs exist. Use community sources only to debug symptoms
65
+ after the authoritative contract is known.
66
+
67
+ ## Required Workflow
68
+
69
+ 1. Identify the exact surface: package name, installed version, target version,
70
+ provider endpoint, CLI command, config file, local helper, schema, or product
71
+ feature.
72
+ 2. Search the web for the current official docs unless the relevant docs are
73
+ already local or the user supplied a URL. Use targeted searches such as
74
+ `<product> <feature> official docs`, `<package> migration guide`, or
75
+ `<provider> API reference`.
76
+ 3. Open and read the docs closest to that surface. Prefer local docs first for
77
+ internal code, then official upstream docs. For new packages, verify the
78
+ latest version before writing imports, config, or install commands.
79
+ 4. Extract the few facts needed for the task: option names, imports, lifecycle
80
+ rules, default behavior, breaking changes, limits, permissions, and examples
81
+ for the current major version.
82
+ 5. Implement or answer using those facts. If the docs conflict with existing
83
+ code, inspect the local code path and call out the discrepancy.
84
+ 6. Verify with the smallest useful check: typecheck, tests, build, CLI dry run,
85
+ API schema validation, or a local reproduction.
86
+ 7. In the final answer, name the docs or local files consulted when that
87
+ evidence affects the recommendation or implementation.
88
+
89
+ ## Examples That Must Trigger Docs
90
+
91
+ - "Add Tailwind to this app." Check the current Tailwind major and its install
92
+ docs from the web before creating config files or assuming old PostCSS setup.
93
+ - "Use the AI SDK to stream responses." Verify the current AI SDK major,
94
+ imports, provider package names, streaming helpers, and server/runtime
95
+ examples from official docs.
96
+ - "Wire up Stripe webhooks." Read Stripe's current signature verification,
97
+ event retry, endpoint secret, and framework body-parsing docs before coding.
98
+ - "Fix this Next.js caching bug." Read the docs for the installed Next.js major
99
+ and router mode before assuming cache invalidation semantics.
100
+ - "Add Drizzle migrations." Read the current Drizzle kit docs and existing repo
101
+ migration conventions before generating files.
102
+ - "Create a GitHub Action." Read official Actions syntax and permissions docs,
103
+ especially for `pull_request`, `workflow_run`, OIDC, tokens, and artifacts.
104
+ - "Why does this OAuth flow fail?" Read the provider's scopes, redirect URI,
105
+ PKCE, token refresh, and app verification docs before changing code.
106
+ - "Use this repo's plan/comment/action system." Read local docs, route/action
107
+ registries, schemas, and tests before inventing endpoints or props.
108
+ - "Upgrade Vite/Nitro/React." Read the migration guide for the exact target
109
+ major before editing config or imports.
110
+ - "What model should we use?" Read current provider model docs, pricing/limits
111
+ pages, and SDK examples before recommending.
112
+
113
+ ## When A Quick Local Read Is Enough
114
+
115
+ Do not browse the web for every tiny edit. A docs pass can be local and brief
116
+ when the answer is already in the repo: existing helper usage, nearby tests,
117
+ typed interfaces, generated clients, ADRs, or package READMEs. But if the task
118
+ depends on an external tool, package, provider, or current product behavior, web
119
+ search is usually the right first step. For trivial language syntax, typo fixes,
120
+ formatting, or self-contained code with no external contract, proceed normally.
121
+
122
+ ## If Docs Are Unavailable
123
+
124
+ If network access, auth, or missing local files prevents reading the docs, say
125
+ that plainly before relying on memory. Narrow the uncertainty, inspect source or
126
+ types if available, and avoid presenting the result as confirmed-current.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Read The Damn Docs"
3
+ short_description: "Make agents web-search docs before guessing."
4
+ default_prompt: "Use $read-the-damn-docs to web-search for official docs before implementation."
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: real-time-sync
3
+ description: >-
4
+ How to keep the UI in sync with agent changes via SSE plus polling fallback.
5
+ Use when wiring query invalidation for new data models, debugging UI not
6
+ updating, or understanding jitter prevention.
7
+ scope: dev
8
+ metadata:
9
+ internal: true
10
+ ---
11
+
12
+ # Real-Time Sync
13
+
14
+ ## Rule
15
+
16
+ The UI stays in sync with agent/script changes through `useDbSync()`. In-process writes stream over `/_agent-native/events` first; `/_agent-native/poll` remains the cross-process/serverless fallback. When the agent writes to the database, the UI detects the change and updates automatically — no manual refresh needed.
17
+
18
+ ## Why
19
+
20
+ The agent modifies data in SQL, but the UI runs in the browser. SSE bridges same-process writes immediately; polling bridges anything SSE cannot see, such as another serverless invocation, cron job, or external script. Every visible write increments a version counter, `useDbSync()` receives the change, and React Query invalidates the relevant caches. This is what makes database writes feel real-time without relying on aggressive polling.
21
+
22
+ ## How It Works
23
+
24
+ 1. **Server** increments a version counter on every database write. In-process events stream through the authenticated `/_agent-native/events` endpoint.
25
+
26
+ 2. **Client** listens for sync events and updates per-source change counters:
27
+
28
+ ```ts
29
+ import { useDbSync } from "@agent-native/core/client";
30
+ useDbSync({ queryClient });
31
+ ```
32
+
33
+ For each non-own event, `useDbSync` bumps a per-source counter (e.g. `dashboards`, `analyses`, `settings`, `action`) and invalidates a small fixed list of framework-internal prefixes (`["action"]`, `["app-state"]`, `["__set_url__"]`, etc.). It does **not** blanket-invalidate templates' own data queries — that caused request storms in production. A successful mutating action refreshes active `useActionQuery` observers under the `["action"]` prefix. Browser actions carry a tab id so their originating tab ignores the sync echo while other tabs refresh. Legacy apps can opt into broader compatibility with `actionInvalidatePredicate`, but first-party apps should use action-backed or source-versioned query keys. Idle fallback polling runs once per minute; active agent work temporarily uses the faster cadence.
34
+
35
+ 3. **Templates fold per-source counters into their query keys.** This is the pattern that makes "agent writes show up without a manual refresh" reliable:
36
+
37
+ ```ts
38
+ import { useChangeVersion } from "@agent-native/core/client";
39
+ import { useQuery } from "@tanstack/react-query";
40
+
41
+ const v = useChangeVersion("dashboards");
42
+ const dashboard = useQuery({
43
+ queryKey: ["dashboard", id, v],
44
+ queryFn: () => fetchDashboard(id),
45
+ placeholderData: (prev) => prev, // no flicker on refetch
46
+ });
47
+ ```
48
+
49
+ When the agent writes (`update-dashboard` action → server emits `source: "dashboards"`), the counter advances, the queryKey changes, and React Query refetches that one query. The old data stays on screen during the refetch thanks to `placeholderData`.
50
+
51
+ For list/sidebar queries, use the same pattern — pass the counter into the queryKey of every list query you want to keep fresh.
52
+
53
+ 4. **Fallback** polling calls `/_agent-native/poll?since=N`. It runs every 2 seconds until SSE is connected, then relaxes to 15 seconds (`SSE_FALLBACK_INTERVAL_MS`). If SSE is disabled or unavailable (e.g., edge/serverless deployments), polling continues at the 2 s cadence. Polling is the universal serverless fallback: new framework writes are read from the durable `sync_events` log, while the older DB timestamp scan remains as a slower safety net for direct SQL writes and older processes.
54
+
55
+ 5. When the agent writes to the database, the version increments, SSE/polling detects it, and React Query refetches the affected queries.
56
+
57
+ ## Don't
58
+
59
+ - Don't create manual polling loops — `useDbSync()` handles SSE plus fallback polling
60
+ - Don't create your own fetch-based polling alongside `useDbSync` — use the `onEvent` callback for custom handling
61
+ - Don't open your own `EventSource` to `/_agent-native/events`. A tab must hold exactly ONE SSE connection no matter how many features listen — extra streams eat the browser's per-origin connection budget and can starve ordinary data fetches (worst on HTTP/1.1 dev servers). Subscribe to the shared transport instead:
62
+
63
+ ```ts
64
+ import { subscribeSyncEvents } from "@agent-native/core/client";
65
+
66
+ const unsubscribe = subscribeSyncEvents({
67
+ onEvents: (events) => {
68
+ // filter by event.source and handle push-style updates
69
+ },
70
+ // Optional: relax your own fallback cadence while push is healthy.
71
+ onSseStateChange: (connected) => {},
72
+ });
73
+ ```
74
+
75
+ `useDbSync` and every `subscribeSyncEvents` subscriber share one `EventSource` and one fallback poll loop per tab — this is how collaborative documents receive doc updates and cursor/awareness events.
76
+
77
+ ## Which sources to depend on
78
+
79
+ Common sources you'll fold into query keys:
80
+
81
+ | Source | Bumped by |
82
+ | ----------------- | --------------------------------------------------------------------------- |
83
+ | `action` | The agent runner after every successful mutating action tool call |
84
+ | `app-state` | Writes to `application_state` (navigation, selections, ephemeral UI state) |
85
+ | `settings` | Writes to the `settings` table |
86
+ | `dashboards` | Dashboard CRUD via `upsertDashboard` / `archiveDashboard` etc. |
87
+ | `analyses` | Analysis CRUD |
88
+ | `extensions` | Extension CRUD |
89
+ | `collab` | Yjs collaborative-doc updates |
90
+ | `screen-refresh` | Explicit `refresh-screen` agent tool call |
91
+
92
+ If a query reads data the agent can mutate via more than one path, depend on multiple sources with `useChangeVersions`:
93
+
94
+ ```ts
95
+ const v = useChangeVersions(["dashboards", "action"]);
96
+ useQuery({ queryKey: ["dashboard", id, v], ... });
97
+ ```
98
+
99
+ `useChangeVersions` returns a single integer that advances whenever any of the listed sources advance.
100
+
101
+ ## Tuning refetch behavior
102
+
103
+ To prevent cache thrashing during rapid agent writes, set `staleTime` on your queries:
104
+
105
+ ```ts
106
+ useQuery({
107
+ queryKey: ["items"],
108
+ queryFn: fetchItems,
109
+ staleTime: 2000, // don't refetch within 2 seconds
110
+ });
111
+ ```
112
+
113
+ ## Troubleshooting
114
+
115
+ | Symptom | Check |
116
+ | ---------------------------------- | -------------------------------------------------------------------------------------------------------------- |
117
+ | UI not updating after agent writes | Is `useDbSync` called with the correct `queryClient`? Does the affected query have an active observer? |
118
+ | Poll endpoint not responding | Is `/_agent-native/poll` accessible? Is the server running? |
119
+ | SSE not connecting | Is `/_agent-native/events` accessible and authenticated? Polling should still keep the UI fresh as fallback. |
120
+ | High CPU / event storms | Use targeted source keys, settle bursty list counters, and avoid broad action invalidation. |
121
+
122
+ ## Jitter Prevention
123
+
124
+ When the agent writes to application-state via script helpers (`writeAppState`, `deleteAppState`), the write is automatically tagged with `requestSource: "agent"`. This prevents the UI from overwriting active user edits when it receives the change event.
125
+
126
+ ### How it works
127
+
128
+ 1. **Agent writes** are tagged: the script helpers in `@agent-native/core/application-state` pass `{ requestSource: "agent" }` to the store.
129
+ 2. **UI writes** are tagged: templates send a per-tab ID via the `X-Request-Source` header on PUT/DELETE requests to application-state endpoints.
130
+ 3. **Sync filters**: `useDbSync()` accepts an `ignoreSource` option. The UI passes its own tab ID so it ignores events from its own writes — but still picks up events from agents, other tabs, and scripts.
131
+
132
+ ### Template setup
133
+
134
+ ```ts
135
+ // app/lib/tab-id.ts
136
+ export const TAB_ID = `tab-${Math.random().toString(36).slice(2, 8)}`;
137
+
138
+ // app/root.tsx
139
+ import { TAB_ID } from "@/lib/tab-id";
140
+
141
+ useDbSync({
142
+ queryClient,
143
+ ignoreSource: TAB_ID,
144
+ });
145
+ ```
146
+
147
+ The `use-navigation-state.ts` hook sends the same `TAB_ID` in the `X-Request-Source` header when writing navigation state, so the tab that wrote the state does not refetch it.
148
+
149
+ ### Why this matters
150
+
151
+ Without jitter prevention, a cycle occurs: the UI writes state, sync detects the change, the UI refetches and re-renders, potentially overwriting what the user is actively editing. With `ignoreSource`, the UI only reacts to changes from other sources (agent scripts, other browser tabs, other users).
152
+
153
+ ## Action Routes and Live Sync
154
+
155
+ Actions work with the same sync system. When a mutating action writes to the database, the version counter increments and `useDbSync` picks up the change. Frontend mutations via `useActionMutation` automatically invalidate `["action"]` query keys on success, triggering refetches of `useActionQuery` hooks. Client components should call actions through those hooks, not with raw action-route fetches.
156
+
157
+ For custom apps, the best out-of-the-box path is:
158
+
159
+ 1. Put read actions in `actions/` with `defineAction({ http: { method: "GET" } })`.
160
+ 2. Put write actions in `actions/` with the default POST/PUT/DELETE behavior.
161
+ 3. Call reads from React with `useActionQuery` and writes with `useActionMutation`.
162
+
163
+ This avoids duplicate `/api/*` JSON CRUD routes and makes agent-created records show up automatically. Raw `useQuery` can still work, but it should include `useChangeVersions(["action", "<domain-source>"])` in the query key for targeted refreshes.
164
+
165
+ ### Auto-emit on mutating actions
166
+
167
+ The framework emits a change event with `source: "action"` whenever any non-read-only action runs to completion — whether called via HTTP (`/_agent-native/actions/:name`) or as an agent tool call. Read-only actions (`http: { method: "GET" }` or explicit `readOnly: true`) are skipped.
168
+
169
+ This means UIs don't need the agent to remember to call `refresh-screen` after every mutation. A listener like this (used in the `macros` template) will refresh after any mutating agent call:
170
+
171
+ ```ts
172
+ useDbSync({
173
+ queryClient,
174
+ ignoreSource: TAB_ID,
175
+ onEvent: (data) => {
176
+ if (data.requestSource === TAB_ID) return;
177
+ // Invalidate all useActionQuery caches so list-*, get-*, etc. refetch
178
+ queryClient.invalidateQueries({ queryKey: ["action"] });
179
+ },
180
+ });
181
+ ```
182
+
183
+ `refresh-screen` remains available for unusual cases — e.g. the agent mutated data via a path the framework can't see (external system the app mirrors), or the agent wants to pass a `scope` hint for narrower invalidation.
184
+
185
+ ## Keeping Stateful Components In Sync
186
+
187
+ The `useChangeVersion` / `useActionQuery` pattern above keeps the **query layer** fresh. But components that copy a server value into local React state still go stale on agent edits — refetching the query updates the prop, yet the local copy never re-adopts it. This is a recurring bug.
188
+
189
+ **Never do this** for a value the agent can mutate:
190
+
191
+ ```ts
192
+ // BUG: `title` is captured once and never re-reads the prop.
193
+ const [title, setTitle] = useState(props.title);
194
+ ```
195
+
196
+ When the agent renames the record, the query refetches, `props.title` updates, but the input still shows the stale value until the component remounts.
197
+
198
+ **Derived-state surfaces (form fields, inline editors, popovers): use `useReconciledState`.** It re-adopts the authoritative external value when it changes, except while the user is actively editing that field — so agent mutations show up live without clobbering in-progress typing:
199
+
200
+ ```ts
201
+ import { useReconciledState } from "@agent-native/core/client";
202
+
203
+ // `active` = true while the user is editing this field (focused / dirty).
204
+ const [title, setTitle] = useReconciledState(props.title, { active: isEditing });
205
+ ```
206
+
207
+ **Collaborative rich-text editors are different** — they don't copy a value into `useState`. They reconcile authoritative SQL content into a shared Y.Doc under an `updatedAt` gate with lead-client election. See `real-time-collab` → "Agent edits as a real-time peer editor". Don't reach for `useReconciledState` for a Yjs-backed editor.
208
+
209
+ | Surface | Keep it fresh with |
210
+ | ------- | ------------------ |
211
+ | React Query reads | `useChangeVersion` / `useActionQuery` (above) |
212
+ | Local edit state copied from a server value (inputs, popovers, inline editors) | `useReconciledState(externalValue, { active })` |
213
+ | Collaborative rich-text editor (Yjs) | `updatedAt`-gated reconcile + `isReconcileLeadClient` — see `real-time-collab` |
214
+
215
+ ## Granular server-side merge for non-body fields
216
+
217
+ For structured documents (slide decks, form builders, design files) where the
218
+ Yjs body collab would cause LWW conflicts at the container level, pair the
219
+ change-sync `updatedAt` bump with a **granular server-side merge action** that
220
+ accepts targeted per-item operations (add/patch/delete/reorder). Concurrent
221
+ edits to different items both survive at the action level; the `collab` source
222
+ version bump then propagates the merged state to all open clients. See
223
+ `real-time-collab` for the pattern and examples.
224
+
225
+ ## Related Skills
226
+
227
+ - **storing-data** — Application-state and settings are data stores that sync through change events
228
+ - **context-awareness** — Navigation state writes use jitter prevention to avoid overwriting active edits
229
+ - **actions** — Mutating actions trigger change events
230
+ - **client-methods** — Route details belong in helpers/hooks, not components
231
+ - **self-modifying-code** — Agent code edits trigger change events; rapid edits can cause event storms
232
+ - **real-time-collab** — Collaborative editors reconcile agent edits into a shared Y.Doc, driven by the same change-sync `updatedAt` bump; also the granular server-side merge pattern for structured data