@notis_ai/cli 0.2.17 → 0.2.19

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 (395) hide show
  1. package/README.md +542 -146
  2. package/bin/check-runtime.js +15 -0
  3. package/bin/notis.js +2 -0
  4. package/config/notis_app_design_rules.json +320 -0
  5. package/config/portal-route-roots.json +45 -0
  6. package/dist/agent-hooks/notis-agent-hook.mjs +42323 -18258
  7. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -0
  8. package/dist/base-skills/notis-cli/SKILL.md +51 -280
  9. package/dist/base-skills/notis-cli/references/app-delivery.md +17 -0
  10. package/dist/base-skills/notis-cli/references/intelligence.md +94 -0
  11. package/dist/base-skills/notis-cli/references/native-databases.md +21 -0
  12. package/dist/base-skills/notis-cli/references/tool-examples.md +56 -0
  13. package/dist/base-skills/notis-cli/references/troubleshooting.md +67 -0
  14. package/dist/base-skills/notis-query/.notis-base-skill.json +1 -0
  15. package/dist/base-skills/notis-query/SKILL.md +35 -699
  16. package/dist/base-skills/notis-query/references/database-discovery.md +59 -0
  17. package/dist/base-skills/notis-query/references/documents.md +74 -0
  18. package/dist/base-skills/notis-query/references/query.md +76 -0
  19. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -0
  20. package/dist/base-skills/notis-spaces/SKILL.md +218 -0
  21. package/dist/base-skills/notis-spaces/references/architecture.md +116 -0
  22. package/dist/base-skills/notis-spaces/references/context.md +81 -0
  23. package/dist/base-skills/notis-spaces/references/design.md +141 -0
  24. package/dist/base-skills/notis-spaces/references/fixtures.md +29 -0
  25. package/dist/base-skills/notis-spaces/references/memory.md +58 -0
  26. package/dist/base-skills/notis-spaces/references/reading.md +73 -0
  27. package/dist/base-skills/notis-spaces/references/release.md +120 -0
  28. package/dist/base-skills/notis-spaces/references/reports.md +77 -0
  29. package/dist/base-skills/notis-spaces/references/sdk.md +273 -0
  30. package/dist/base-skills/notis-spaces/references/store.md +118 -0
  31. package/dist/base-skills/notis-spaces/references/troubleshooting.md +28 -0
  32. package/dist/base-skills/notis-spaces/references/views.md +229 -0
  33. package/{template/packages → dist}/sdk/package.json +9 -10
  34. package/dist/sdk/src/agentContext.ts +36 -0
  35. package/dist/sdk/src/bundleModule.ts +175 -0
  36. package/dist/sdk/src/components/Dialog.tsx +103 -0
  37. package/dist/sdk/src/components/DocumentEditor.tsx +113 -0
  38. package/dist/sdk/src/components/DocumentPage.tsx +184 -0
  39. package/{template/packages → dist}/sdk/src/components/Markdown.tsx +9 -3
  40. package/{template/packages → dist}/sdk/src/components/MarkdownEditor.tsx +26 -5
  41. package/{template/packages → dist}/sdk/src/components/MultiSelectActionBar.tsx +95 -12
  42. package/{template/packages → dist}/sdk/src/components/MultiSelectCheckbox.tsx +4 -2
  43. package/dist/sdk/src/components/NotisCommentBoundary.tsx +172 -0
  44. package/{template/packages → dist}/sdk/src/components/NotisSelectionBoundary.tsx +9 -5
  45. package/dist/sdk/src/components/RecordComponents.tsx +111 -0
  46. package/dist/sdk/src/components/Skeleton.tsx +38 -0
  47. package/dist/sdk/src/config.ts +31 -0
  48. package/{template/packages → dist}/sdk/src/documents.ts +21 -6
  49. package/dist/sdk/src/hooks/useAction.ts +28 -0
  50. package/dist/sdk/src/hooks/useAgentContext.ts +23 -0
  51. package/{template/packages → dist}/sdk/src/hooks/useBackend.ts +3 -2
  52. package/dist/sdk/src/hooks/useCloudComputer.ts +94 -0
  53. package/dist/sdk/src/hooks/useCloudComputerShell.ts +114 -0
  54. package/{template/packages → dist}/sdk/src/hooks/useCollectionInteractions.ts +157 -147
  55. package/dist/sdk/src/hooks/useDatabaseSchema.ts +50 -0
  56. package/{template/packages → dist}/sdk/src/hooks/useDatabaseSubscription.ts +2 -2
  57. package/dist/sdk/src/hooks/useDocument.ts +51 -0
  58. package/{template/packages → dist}/sdk/src/hooks/useDocuments.ts +25 -59
  59. package/{template/packages → dist}/sdk/src/hooks/useHandover.ts +7 -7
  60. package/dist/sdk/src/hooks/useLongPressSelection.ts +79 -0
  61. package/dist/sdk/src/hooks/useMarqueeSelection.ts +194 -0
  62. package/{template/packages → dist}/sdk/src/hooks/useMultiSelect.ts +2 -8
  63. package/dist/sdk/src/hooks/useNativeDocumentBody.ts +50 -0
  64. package/dist/sdk/src/hooks/useNativeDocuments.ts +143 -0
  65. package/{template/packages → dist}/sdk/src/hooks/useNotis.ts +6 -1
  66. package/dist/sdk/src/hooks/useNotisNavigation.ts +70 -0
  67. package/dist/sdk/src/hooks/useQuery.ts +81 -0
  68. package/dist/sdk/src/hooks/useToolQuery.ts +12 -0
  69. package/dist/sdk/src/hooks/useTopBarSearch.ts +102 -0
  70. package/dist/sdk/src/hooks/useTopBarTitleLeaf.ts +75 -0
  71. package/{template/packages → dist}/sdk/src/hooks/useUpsertDocument.ts +1 -1
  72. package/dist/sdk/src/hooks/useViewParams.ts +195 -0
  73. package/dist/sdk/src/hooks/useViewerReads.ts +129 -0
  74. package/{template/packages → dist}/sdk/src/index.ts +64 -1
  75. package/{template/packages → dist}/sdk/src/interactions/actions.ts +14 -1
  76. package/{template/packages → dist}/sdk/src/interactions/shortcuts.tsx +129 -23
  77. package/dist/sdk/src/interactions/visibility.ts +13 -0
  78. package/{template/packages → dist}/sdk/src/interactions.ts +5 -1
  79. package/dist/sdk/src/nativeData.ts +39 -0
  80. package/{template/packages → dist}/sdk/src/provider.tsx +9 -4
  81. package/dist/sdk/src/queryCache.ts +292 -0
  82. package/dist/sdk/src/queryErrors.ts +51 -0
  83. package/dist/sdk/src/runtime.ts +675 -0
  84. package/dist/sdk/src/runtimeModules.ts +33 -0
  85. package/dist/sdk/src/space.ts +442 -0
  86. package/dist/sdk/src/standardViewParams.ts +36 -0
  87. package/{template/packages → dist}/sdk/src/styles.css +81 -16
  88. package/dist/sdk/src/tailwind.ts +66 -0
  89. package/dist/sdk/src/ui/charts/RenderChartData.tsx +25 -0
  90. package/dist/sdk/src/ui/engine/core.ts +392 -0
  91. package/dist/sdk/src/ui/engine/dom.ts +183 -0
  92. package/dist/sdk/src/ui/engine/hooks.ts +195 -0
  93. package/dist/sdk/src/ui/engine/instance.ts +63 -0
  94. package/dist/sdk/src/ui/engine/keycapContext.ts +2 -0
  95. package/dist/sdk/src/ui/engine/registry.ts +262 -0
  96. package/dist/sdk/src/ui/engine/types.ts +62 -0
  97. package/dist/sdk/src/ui/icons.tsx +91 -0
  98. package/dist/sdk/src/ui/util.ts +83 -0
  99. package/dist/sdk/src/viewPeriod.ts +26 -0
  100. package/dist/sdk/src/vite.ts +92 -0
  101. package/dist/sdk/src/words/actions.ts +295 -0
  102. package/dist/sdk/src/words/clashes.ts +158 -0
  103. package/dist/sdk/src/words/format.ts +136 -0
  104. package/dist/sdk/src/words/index.ts +13 -0
  105. package/dist/sdk/src/words/keymap.ts +72 -0
  106. package/dist/sdk/src/words/keys.ts +297 -0
  107. package/dist/sdk/src/words/shell.ts +46 -0
  108. package/dist/sdk/src/words/types.ts +65 -0
  109. package/dist/skill-sync/index.js +832 -151
  110. package/dist/skill-sync/index.js.map +4 -4
  111. package/dist/skill-sync-worker.mjs +3941 -0
  112. package/dist/space-harness/host.js +1460 -0
  113. package/dist/space-sdk/dist/chunk-ZSN57ATH.js +5 -0
  114. package/dist/space-sdk/dist/index.js +15 -0
  115. package/dist/space-sdk/dist/ui.js +18 -0
  116. package/dist/space-sdk/package.json +33 -0
  117. package/dist/space-sdk/src/agentContext.d.ts +36 -0
  118. package/dist/space-sdk/src/components/Dialog.d.ts +20 -0
  119. package/dist/space-sdk/src/components/DocumentEditor.d.ts +46 -0
  120. package/dist/space-sdk/src/components/DocumentPage.d.ts +53 -0
  121. package/dist/space-sdk/src/components/Markdown.d.ts +18 -0
  122. package/dist/space-sdk/src/components/MarkdownEditor.d.ts +11 -0
  123. package/dist/space-sdk/src/components/MultiSelectActionBar.d.ts +31 -0
  124. package/dist/space-sdk/src/components/MultiSelectCheckbox.d.ts +14 -0
  125. package/dist/space-sdk/src/components/MultiSelectDragOverlay.d.ts +8 -0
  126. package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +36 -0
  127. package/dist/space-sdk/src/components/NotisSelectionBoundary.d.ts +16 -0
  128. package/dist/space-sdk/src/components/RecordComponents.d.ts +64 -0
  129. package/dist/space-sdk/src/components/ShortcutHints.d.ts +12 -0
  130. package/dist/space-sdk/src/components/Skeleton.d.ts +23 -0
  131. package/dist/space-sdk/src/config.ts +31 -0
  132. package/dist/space-sdk/src/documents.d.ts +59 -0
  133. package/dist/space-sdk/src/hooks/useAction.d.ts +8 -0
  134. package/dist/space-sdk/src/hooks/useActiveResource.d.ts +3 -0
  135. package/dist/space-sdk/src/hooks/useAgentContext.d.ts +7 -0
  136. package/dist/space-sdk/src/hooks/useBackend.d.ts +23 -0
  137. package/dist/space-sdk/src/hooks/useCloudComputer.d.ts +45 -0
  138. package/dist/space-sdk/src/hooks/useCloudComputerShell.d.ts +49 -0
  139. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +118 -0
  140. package/dist/space-sdk/src/hooks/useDatabaseSchema.d.ts +14 -0
  141. package/dist/space-sdk/src/hooks/useDatabaseSubscription.d.ts +26 -0
  142. package/dist/space-sdk/src/hooks/useDocument.d.ts +22 -0
  143. package/dist/space-sdk/src/hooks/useDocuments.d.ts +31 -0
  144. package/dist/space-sdk/src/hooks/useHandover.d.ts +43 -0
  145. package/dist/space-sdk/src/hooks/useLongPressSelection.d.ts +9 -0
  146. package/dist/space-sdk/src/hooks/useMarqueeSelection.d.ts +57 -0
  147. package/dist/space-sdk/src/hooks/useMultiSelect.d.ts +51 -0
  148. package/dist/space-sdk/src/hooks/useNativeDocumentBody.d.ts +24 -0
  149. package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +55 -0
  150. package/dist/space-sdk/src/hooks/useNotis.d.ts +25 -0
  151. package/dist/space-sdk/src/hooks/useNotisNavigation.d.ts +33 -0
  152. package/dist/space-sdk/src/hooks/useQuery.d.ts +22 -0
  153. package/dist/space-sdk/src/hooks/useTool.d.ts +20 -0
  154. package/dist/space-sdk/src/hooks/useToolQuery.d.ts +3 -0
  155. package/dist/space-sdk/src/hooks/useTools.d.ts +15 -0
  156. package/dist/space-sdk/src/hooks/useTopBarSearch.d.ts +48 -0
  157. package/dist/space-sdk/src/hooks/useTopBarTitleLeaf.d.ts +24 -0
  158. package/dist/space-sdk/src/hooks/useUpsertDocument.d.ts +27 -0
  159. package/dist/space-sdk/src/hooks/useViewParams.d.ts +76 -0
  160. package/dist/space-sdk/src/hooks/useViewerReads.d.ts +38 -0
  161. package/dist/space-sdk/src/index.d.ts +98 -0
  162. package/dist/space-sdk/src/interactions/actions.d.ts +33 -0
  163. package/dist/space-sdk/src/interactions/shortcuts.d.ts +42 -0
  164. package/dist/space-sdk/src/interactions/visibility.d.ts +2 -0
  165. package/dist/space-sdk/src/nativeData.d.ts +66 -0
  166. package/dist/space-sdk/src/provider.d.ts +17 -0
  167. package/dist/space-sdk/src/queryCache.d.ts +45 -0
  168. package/dist/space-sdk/src/queryErrors.ts +51 -0
  169. package/dist/space-sdk/src/runtime.d.ts +615 -0
  170. package/dist/space-sdk/src/runtimeModules.ts +33 -0
  171. package/dist/space-sdk/src/space.ts +442 -0
  172. package/dist/space-sdk/src/standardViewParams.d.ts +15 -0
  173. package/dist/space-sdk/src/tailwind-candidates.d.ts +3418 -0
  174. package/dist/space-sdk/src/tailwind.ts +66 -0
  175. package/dist/space-sdk/src/ui/actions/ActionToast.d.ts +15 -0
  176. package/dist/space-sdk/src/ui/actions/actionWords.d.ts +16 -0
  177. package/dist/space-sdk/src/ui/actions/index.d.ts +7 -0
  178. package/dist/space-sdk/src/ui/actions/useActions.d.ts +69 -0
  179. package/dist/space-sdk/src/ui/actions/useToast.d.ts +41 -0
  180. package/dist/space-sdk/src/ui/blocks/Tabs.d.ts +139 -0
  181. package/dist/space-sdk/src/ui/blocks/blocks.d.ts +217 -0
  182. package/dist/space-sdk/src/ui/blocks/index.d.ts +4 -0
  183. package/dist/space-sdk/src/ui/board/BoardView.d.ts +36 -0
  184. package/dist/space-sdk/src/ui/board/boardModel.d.ts +46 -0
  185. package/dist/space-sdk/src/ui/board/boardWords.d.ts +9 -0
  186. package/dist/space-sdk/src/ui/board/index.d.ts +5 -0
  187. package/dist/space-sdk/src/ui/calendar/CalendarView.d.ts +49 -0
  188. package/dist/space-sdk/src/ui/calendar/DayPicker.d.ts +23 -0
  189. package/dist/space-sdk/src/ui/calendar/calendarMath.d.ts +81 -0
  190. package/dist/space-sdk/src/ui/charts/Chart.d.ts +203 -0
  191. package/dist/space-sdk/src/ui/charts/ChartTable.d.ts +37 -0
  192. package/dist/space-sdk/src/ui/charts/RenderChartData.d.ts +16 -0
  193. package/dist/space-sdk/src/ui/charts/StatRow.d.ts +59 -0
  194. package/dist/space-sdk/src/ui/charts/chartData.d.ts +84 -0
  195. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +58 -0
  196. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +157 -0
  197. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +60 -0
  198. package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
  199. package/dist/space-sdk/src/ui/comments/useComments.d.ts +146 -0
  200. package/dist/space-sdk/src/ui/engine/HelpSheet.d.ts +12 -0
  201. package/dist/space-sdk/src/ui/engine/KeyboardEngine.d.ts +27 -0
  202. package/dist/space-sdk/src/ui/engine/core.d.ts +73 -0
  203. package/dist/space-sdk/src/ui/engine/hooks.d.ts +64 -0
  204. package/dist/space-sdk/src/ui/engine/index.d.ts +14 -0
  205. package/dist/space-sdk/src/ui/engine/instance.d.ts +21 -0
  206. package/dist/space-sdk/src/ui/engine/keycapContext.d.ts +2 -0
  207. package/dist/space-sdk/src/ui/engine/registry.d.ts +77 -0
  208. package/dist/space-sdk/src/ui/engine/step.d.ts +11 -0
  209. package/dist/space-sdk/src/ui/engine/types.d.ts +54 -0
  210. package/dist/space-sdk/src/ui/fields/fieldWords.d.ts +56 -0
  211. package/dist/space-sdk/src/ui/fields/fields.d.ts +162 -0
  212. package/dist/space-sdk/src/ui/fields/index.d.ts +5 -0
  213. package/dist/space-sdk/src/ui/fields/useFieldDraft.d.ts +22 -0
  214. package/dist/space-sdk/src/ui/gallery/AttachmentGallery.d.ts +53 -0
  215. package/dist/space-sdk/src/ui/gallery/ImageViewer.d.ts +27 -0
  216. package/dist/space-sdk/src/ui/gallery/galleryWords.d.ts +95 -0
  217. package/dist/space-sdk/src/ui/gallery/index.d.ts +5 -0
  218. package/dist/space-sdk/src/ui/icons.d.ts +13 -0
  219. package/dist/space-sdk/src/ui/index.d.ts +54 -0
  220. package/dist/space-sdk/src/ui/keycap/Keycap.d.ts +22 -0
  221. package/dist/space-sdk/src/ui/keycap/index.d.ts +2 -0
  222. package/dist/space-sdk/src/ui/layout/Panels.d.ts +50 -0
  223. package/dist/space-sdk/src/ui/layout/chatPanelEdge.d.ts +77 -0
  224. package/dist/space-sdk/src/ui/layout/index.d.ts +5 -0
  225. package/dist/space-sdk/src/ui/layout/panelMath.d.ts +91 -0
  226. package/dist/space-sdk/src/ui/list/ListReader.d.ts +380 -0
  227. package/dist/space-sdk/src/ui/list/Row.d.ts +145 -0
  228. package/dist/space-sdk/src/ui/list/SelectionBar.d.ts +65 -0
  229. package/dist/space-sdk/src/ui/list/index.d.ts +14 -0
  230. package/dist/space-sdk/src/ui/list/rowState.d.ts +22 -0
  231. package/dist/space-sdk/src/ui/list/useListKeys.d.ts +89 -0
  232. package/dist/space-sdk/src/ui/list/useReorder.d.ts +86 -0
  233. package/dist/space-sdk/src/ui/list/useSelection.d.ts +90 -0
  234. package/dist/space-sdk/src/ui/open/OpenAsMenu.d.ts +15 -0
  235. package/dist/space-sdk/src/ui/open/index.d.ts +6 -0
  236. package/dist/space-sdk/src/ui/open/openModeStore.d.ts +39 -0
  237. package/dist/space-sdk/src/ui/open/useOpenMode.d.ts +17 -0
  238. package/dist/space-sdk/src/ui/overlay/Menu.d.ts +88 -0
  239. package/dist/space-sdk/src/ui/overlay/Popover.d.ts +28 -0
  240. package/dist/space-sdk/src/ui/overlay/Tooltip.d.ts +19 -0
  241. package/dist/space-sdk/src/ui/overlay/index.d.ts +9 -0
  242. package/dist/space-sdk/src/ui/overlay/layerRoot.d.ts +24 -0
  243. package/dist/space-sdk/src/ui/overlay/position.d.ts +31 -0
  244. package/dist/space-sdk/src/ui/period/PeriodPicker.d.ts +30 -0
  245. package/dist/space-sdk/src/ui/period/dateFormat.d.ts +50 -0
  246. package/dist/space-sdk/src/ui/period/dateWords.d.ts +88 -0
  247. package/dist/space-sdk/src/ui/period/periods.d.ts +70 -0
  248. package/dist/space-sdk/src/ui/period/usePeriod.d.ts +23 -0
  249. package/dist/space-sdk/src/ui/present/index.d.ts +3 -0
  250. package/dist/space-sdk/src/ui/present/presentWords.d.ts +27 -0
  251. package/dist/space-sdk/src/ui/present/screens.d.ts +36 -0
  252. package/dist/space-sdk/src/ui/present/useAudienceScreen.d.ts +38 -0
  253. package/dist/space-sdk/src/ui/styles.d.ts +21 -0
  254. package/dist/space-sdk/src/ui/timeline/TimelineView.d.ts +44 -0
  255. package/dist/space-sdk/src/ui/timeline/timelineMath.d.ts +123 -0
  256. package/dist/space-sdk/src/viewPeriod.d.ts +8 -0
  257. package/dist/space-sdk/src/vite.ts +92 -0
  258. package/dist/space-sdk/src/words/actions.ts +295 -0
  259. package/dist/space-sdk/src/words/clashes.ts +158 -0
  260. package/dist/space-sdk/src/words/format.ts +136 -0
  261. package/dist/space-sdk/src/words/index.ts +13 -0
  262. package/dist/space-sdk/src/words/keymap.ts +72 -0
  263. package/dist/space-sdk/src/words/keys.ts +297 -0
  264. package/dist/space-sdk/src/words/shell.ts +46 -0
  265. package/dist/space-sdk/src/words/types.ts +65 -0
  266. package/dist/view-renderer/dist/host.css +1 -0
  267. package/dist/view-renderer/dist/host.js +2374 -0
  268. package/dist/view-renderer/dist/theme.css +73 -0
  269. package/dist/view-renderer/src/dom.js +212 -0
  270. package/dist/view-renderer/src/errors.js +8 -0
  271. package/dist/view-renderer/src/host.tsx +250 -0
  272. package/dist/view-renderer/src/index.js +4 -0
  273. package/dist/view-renderer/src/png.js +213 -0
  274. package/dist/view-renderer/src/pool.js +110 -0
  275. package/dist/view-renderer/src/remote-broker.js +59 -0
  276. package/dist/view-renderer/src/renderer.js +271 -0
  277. package/package.json +21 -11
  278. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +63 -12
  279. package/skills/notis-onboarding/BRIEF.md +14 -9
  280. package/skills/notis-query/cli.md +1 -1
  281. package/skills/notis-spaces/cli.md +540 -0
  282. package/src/cli.js +8 -8
  283. package/src/command-specs/agents.js +121 -8
  284. package/src/command-specs/auth.js +3 -3
  285. package/src/command-specs/diagnostics.js +97 -20
  286. package/src/command-specs/documents.js +158 -0
  287. package/src/command-specs/files.js +29 -0
  288. package/src/command-specs/handover.js +331 -79
  289. package/src/command-specs/helpers.js +50 -40
  290. package/src/command-specs/index.js +14 -5
  291. package/src/command-specs/meta.js +38 -9
  292. package/src/command-specs/onboarding.js +1 -1
  293. package/src/command-specs/profile.js +42 -1
  294. package/src/command-specs/skills.js +314 -9
  295. package/src/command-specs/smoke.js +16 -4
  296. package/src/command-specs/spaces.js +783 -0
  297. package/src/command-specs/tools.js +118 -21
  298. package/src/command-specs/version-history.js +20 -0
  299. package/src/command-specs/views.js +69 -0
  300. package/src/runtime/agent-browser.js +178 -267
  301. package/src/runtime/agent-setup.js +172 -13
  302. package/src/runtime/app-boundary-validator.js +338 -2
  303. package/src/runtime/app-data-literals.js +82 -0
  304. package/src/runtime/app-platform.js +750 -1568
  305. package/src/runtime/auth-recovery.js +17 -0
  306. package/src/runtime/base-skills.d.ts +11 -0
  307. package/src/runtime/base-skills.js +100 -3
  308. package/src/runtime/computer-identity.d.ts +30 -0
  309. package/src/runtime/computer-identity.js +151 -0
  310. package/src/runtime/config-lock.js +135 -0
  311. package/src/runtime/confined-space-build.js +74 -0
  312. package/src/runtime/confined-space-verify.js +49 -0
  313. package/src/runtime/delegated-context.js +5 -21
  314. package/src/runtime/native-record-files.js +47 -0
  315. package/src/runtime/oauth.js +342 -31
  316. package/src/runtime/profiles.js +19 -112
  317. package/src/runtime/retired-sdk-files.js +24 -0
  318. package/src/runtime/retry.js +150 -0
  319. package/src/runtime/skill-sync/cloud-client.ts +33 -8
  320. package/src/runtime/skill-sync/index.ts +443 -106
  321. package/src/runtime/skill-sync/local-scanner.ts +248 -32
  322. package/src/runtime/skill-sync/native-identity.ts +102 -0
  323. package/src/runtime/skill-sync/native-plan.ts +70 -0
  324. package/src/runtime/skill-sync/symlink-manager.ts +66 -16
  325. package/src/runtime/skill-sync/sync-plan.ts +34 -2
  326. package/src/runtime/skill-sync/types.ts +54 -0
  327. package/src/runtime/skill-sync/write-cloud-skill.ts +4 -4
  328. package/src/runtime/skill-sync-service.js +109 -0
  329. package/src/runtime/source-root.js +32 -0
  330. package/src/runtime/space-collection-scaffold.js +107 -0
  331. package/src/runtime/space-database-structures.js +229 -0
  332. package/src/runtime/space-fixture-broker.js +68 -0
  333. package/src/runtime/space-lock.js +337 -0
  334. package/src/runtime/space-platform.js +133 -0
  335. package/src/runtime/space-source.js +290 -0
  336. package/src/runtime/space-test-server.js +354 -0
  337. package/src/runtime/space-verification.js +94 -0
  338. package/src/runtime/space-verify-browser-worker.js +51 -0
  339. package/src/runtime/space-view-manifest.js +368 -0
  340. package/src/runtime/sync-skills.d.ts +5 -1
  341. package/src/runtime/sync-skills.js +11 -2
  342. package/src/runtime/tool-confirmation.js +138 -0
  343. package/src/runtime/transport.js +118 -24
  344. package/src/runtime/upsell.js +219 -0
  345. package/src/runtime/view-render.js +49 -0
  346. package/src/skill-sync-worker-entry.js +2 -0
  347. package/src/skill-sync-worker.js +114 -0
  348. package/src/space-harness-host.ts +122 -0
  349. package/template/.harness/index.html.tmpl +9 -352
  350. package/template/app/globals.css +29 -3
  351. package/template/app/layout.tsx +2 -6
  352. package/template/components/ui/badge.tsx +7 -4
  353. package/template/components/ui/button.tsx +1 -1
  354. package/template/components/ui/native-select.tsx +24 -0
  355. package/template/notis.config.ts +4 -36
  356. package/template/package-lock.json +1800 -1867
  357. package/template/package.json +16 -14
  358. package/template/postcss.config.mjs +1 -1
  359. package/template/tailwind.config.ts +1 -6
  360. package/template/tsconfig.json +1 -0
  361. package/template/vite.config.ts +2 -2
  362. package/dist/base-skills/notis-apps/SKILL.md +0 -613
  363. package/skills/notis-apps/cli.md +0 -285
  364. package/src/command-specs/apps.js +0 -3000
  365. package/src/runtime/app-changelog.js +0 -79
  366. package/src/runtime/app-dev-consumers.js +0 -154
  367. package/src/runtime/app-dev-host-lock.js +0 -80
  368. package/src/runtime/app-dev-process-identity.js +0 -111
  369. package/src/runtime/app-dev-roots.js +0 -284
  370. package/src/runtime/app-dev-server.js +0 -1140
  371. package/src/runtime/app-dev-sessions.js +0 -185
  372. package/src/runtime/app-registry-scaffolds.js +0 -367
  373. package/src/runtime/assets/store-screenshot-dark.png +0 -0
  374. package/src/runtime/cli-mode.generated.js +0 -5
  375. package/src/runtime/cli-mode.js +0 -34
  376. package/src/runtime/store-screenshot.js +0 -143
  377. package/template/CHANGELOG.md +0 -5
  378. package/template/app/page.tsx +0 -60
  379. package/template/components/ui/card.tsx +0 -56
  380. package/template/packages/sdk/src/components/DocumentEditor.tsx +0 -103
  381. package/template/packages/sdk/src/config.ts +0 -259
  382. package/template/packages/sdk/src/hooks/useCloudComputer.ts +0 -97
  383. package/template/packages/sdk/src/hooks/useDatabaseSchema.ts +0 -85
  384. package/template/packages/sdk/src/hooks/useDocument.ts +0 -78
  385. package/template/packages/sdk/src/hooks/useNotisNavigation.ts +0 -52
  386. package/template/packages/sdk/src/hooks/useTopBarSearch.ts +0 -73
  387. package/template/packages/sdk/src/runtime.ts +0 -439
  388. package/template/packages/sdk/src/vite.ts +0 -56
  389. package/template/packages/sdk/tsconfig.json +0 -15
  390. /package/{template/packages → dist}/sdk/src/components/MultiSelectDragOverlay.tsx +0 -0
  391. /package/{template/packages → dist}/sdk/src/components/ShortcutHints.tsx +0 -0
  392. /package/{template/packages → dist}/sdk/src/hooks/useActiveResource.ts +0 -0
  393. /package/{template/packages → dist}/sdk/src/hooks/useTool.ts +0 -0
  394. /package/{template/packages → dist}/sdk/src/hooks/useTools.ts +0 -0
  395. /package/{template/packages → dist}/sdk/src/ui.ts +0 -0
@@ -0,0 +1,615 @@
1
+ import type { AgentContextContent, AgentContextItem, AgentContextSource } from './agentContext';
2
+ /**
3
+ * NotisRuntime is the bridge between app code running in the browser and the
4
+ * Notis platform. The portal owns the runtime and injects it through
5
+ * `NotisProvider` when the app is rendered.
6
+ *
7
+ * App code should never reach for globals. Use the hooks from `@notis/sdk`
8
+ * (useTool, useNotis, etc.) which read from the NotisProvider context.
9
+ */
10
+ import type { ComponentType, ReactNode } from 'react';
11
+ import type { NotisQueryClient } from './queryCache';
12
+ import type { SpaceRuntimeDescriptor, SpaceActionOptions, SpaceDocumentBodyRequest, SpaceDocumentBodyResult, SpaceViewerReadOperation, SpaceShownOptions, SpaceCloudComputerTransport } from './space';
13
+ export type DatabasePropertyType = 'title' | 'rich_text' | 'text' | 'number' | 'checkbox' | 'date' | 'select' | 'multi_select' | 'status' | 'relation' | 'formula' | 'files' | 'secret';
14
+ /**
15
+ * The value of a `secret` property. The platform stores a pointer to a
16
+ * credential held elsewhere and never the credential itself, so there is
17
+ * deliberately nothing here to read the secret material from — only whether
18
+ * one is attached, which credential it is, and its lifecycle state.
19
+ */
20
+ export interface SecretPropertyValue {
21
+ present: boolean;
22
+ reference: string | null;
23
+ status: string | null;
24
+ metadata: Record<string, unknown> | null;
25
+ }
26
+ export interface DatabasePropertyOption {
27
+ id?: string | null;
28
+ name: string;
29
+ color?: string | null;
30
+ order?: number;
31
+ }
32
+ export interface DatabaseProperty {
33
+ id?: string | null;
34
+ name: string;
35
+ type: DatabasePropertyType;
36
+ description?: string | null;
37
+ options?: DatabasePropertyOption[];
38
+ }
39
+ export interface DatabaseDescriptor {
40
+ slug: string;
41
+ title: string;
42
+ description?: string | null;
43
+ icon?: string | null;
44
+ properties: DatabaseProperty[];
45
+ }
46
+ /**
47
+ * A document's content is typed. `markdown` documents carry rich text as
48
+ * BlockNote JSON (canonical) with a derived markdown projection; `file`
49
+ * documents carry an uploaded file whose format is in `fileType`
50
+ * (pdf, xlsx, pptx, ...). Future content types (canvas, ...) extend this
51
+ * union without changing the component contracts.
52
+ */
53
+ export type DocumentContentType = 'markdown' | 'file' | 'view';
54
+ export interface DocumentRecord {
55
+ id: string;
56
+ recordKey?: string;
57
+ revision?: number;
58
+ title: string;
59
+ properties: Record<string, unknown>;
60
+ url?: string | null;
61
+ icon?: string | null;
62
+ cover?: string | null;
63
+ databaseSlug?: string;
64
+ contentType?: DocumentContentType | null;
65
+ fileType?: string | null;
66
+ contentBlocknote?: Array<Record<string, unknown>> | null;
67
+ contentMarkdown?: string | null;
68
+ plainText?: string | null;
69
+ viewType?: string | null;
70
+ viewState?: Record<string, unknown> | null;
71
+ viewRevision?: number | null;
72
+ createdAt?: string | null;
73
+ lastEditedTime?: string | null;
74
+ }
75
+ export type ToolInputSchema = Record<string, unknown>;
76
+ export interface ToolDescriptor {
77
+ name: string;
78
+ description?: string;
79
+ inputSchema?: ToolInputSchema;
80
+ }
81
+ export interface ToolCallOptions {
82
+ /** Explicitly identifies an idempotent read; never set on a mutation. */
83
+ readOnly?: boolean;
84
+ /**
85
+ * Coalesce an identical in-flight call. Only opt in for idempotent reads;
86
+ * mutations must execute once per invocation.
87
+ */
88
+ dedupe?: boolean;
89
+ }
90
+ export interface RouteDescriptor {
91
+ slug: string;
92
+ path: string;
93
+ name: string;
94
+ icon?: string | null;
95
+ parentSlug?: string | null;
96
+ default?: boolean;
97
+ resourceDeepLinks?: boolean;
98
+ collection?: {
99
+ database: string;
100
+ titleProperty: string;
101
+ parentProperty?: string | null;
102
+ sidebar?: {
103
+ mode: 'flat-list' | 'tree';
104
+ allowCreate: boolean;
105
+ } | null;
106
+ } | null;
107
+ }
108
+ export interface CollectionItem {
109
+ id: string;
110
+ title: string;
111
+ icon?: string | null;
112
+ }
113
+ export interface CollectionItemDetail extends CollectionItem {
114
+ properties: Record<string, unknown>;
115
+ }
116
+ export interface AppDescriptor {
117
+ id: string;
118
+ name: string;
119
+ icon?: string | null;
120
+ description?: string | null;
121
+ }
122
+ export interface QueryFilter {
123
+ filters?: Array<{
124
+ property: string;
125
+ operator: string;
126
+ type?: string;
127
+ value: unknown;
128
+ }>;
129
+ sorts?: Array<{
130
+ property: string;
131
+ direction: 'asc' | 'desc';
132
+ }>;
133
+ page_size?: number;
134
+ }
135
+ export interface NotisRuntimeContext {
136
+ /** Host UI language. */
137
+ locale?: 'en' | 'fr';
138
+ /** Untrusted UI selection, separate from the host's fixed record authority. */
139
+ selection?: string | null;
140
+ /** Raw URL query values; `useViewParams()` keeps only the declared, valid ones. */
141
+ params?: Record<string, string> | null;
142
+ /** Trusted anonymous record-Site pin; no credentials or physical native target. */
143
+ siteRecord?: {
144
+ recordKey: string;
145
+ param: string;
146
+ params: Record<string, string | number | boolean>;
147
+ } | null;
148
+ collectionItem?: CollectionItemDetail | null;
149
+ /** App-owned resource requested through the route's `?resource=<id>` link. */
150
+ resourceId?: string | null;
151
+ }
152
+ export type ContextAttributeValue = string | number | boolean | null;
153
+ /**
154
+ * The specific thing currently in focus inside an app view. The host stamps
155
+ * app/view provenance onto this value before it reaches chat, so apps only
156
+ * describe their own resource rather than impersonating another surface.
157
+ */
158
+ export interface ContextResource extends AgentContextContent {
159
+ additionalContext?: Record<string, unknown>;
160
+ id: string;
161
+ kind: string;
162
+ label: string;
163
+ url?: string | null;
164
+ revision?: string | null;
165
+ attributes?: Record<string, ContextAttributeValue>;
166
+ snapshot?: {
167
+ format: 'text' | 'markdown';
168
+ content: string;
169
+ } | null;
170
+ }
171
+ /** A quote copied from an app, kept separate from the user's prompt. */
172
+ export interface ContextSelection extends AgentContextContent {
173
+ source?: AgentContextSource;
174
+ id: string;
175
+ text: string;
176
+ resource?: ContextResource | null;
177
+ }
178
+ /**
179
+ * Props for the host-provided document editor. The host implementation
180
+ * dispatches on the document's content type (markdown -> rich text editor,
181
+ * file -> matching viewer/editor), so this contract stays stable as new
182
+ * content types ship.
183
+ */
184
+ export interface NotisRecordProps {
185
+ /** Stable native record key, authorized through this Space's declared databases. */
186
+ recordKey: string;
187
+ className?: string;
188
+ }
189
+ export type NotisDocumentEditorProps = ({
190
+ recordKey: string;
191
+ documentId?: never;
192
+ } | {
193
+ /** Legacy Apps only. Spaces use recordKey. */
194
+ documentId: string;
195
+ recordKey?: never;
196
+ }) & {
197
+ /** 'full' renders icon/title/cover above the content; 'body' renders content only. */
198
+ variant?: 'full' | 'body';
199
+ /** Show the database properties above the body (default true). */
200
+ showProperties?: boolean;
201
+ readOnly?: boolean;
202
+ className?: string;
203
+ onDirtyChange?: (dirty: boolean) => void;
204
+ onSavingChange?: (saving: boolean) => void;
205
+ };
206
+ export interface NotisRecordPropertiesProps extends NotisRecordProps {
207
+ readOnly?: boolean;
208
+ onSavingChange?: (saving: boolean) => void;
209
+ }
210
+ /** Inline HTML is useful for declared Site read actions; recordKey loads a signed-in record. */
211
+ export type NotisHtmlFrameProps = ({
212
+ recordKey: string;
213
+ html?: never;
214
+ } | {
215
+ html: string;
216
+ recordKey?: never;
217
+ }) & {
218
+ title?: string;
219
+ className?: string;
220
+ /**
221
+ * Called once each time the frame's page has loaded and painted, or when the record cannot load, so a view
222
+ * (a slide deck) can wait for a frame before showing it.
223
+ */
224
+ onReady?: () => void;
225
+ /**
226
+ * Presentation mode: the pointer inside the page becomes a laser dot and the page stays clickable. The
227
+ * presenter's keys pressed inside the page (arrows, Page Up and Down, Space, Enter, Home, End, Escape), a plain
228
+ * click outside its links, buttons and fields, and a right click reach `onAction`; keys typed into the page's own
229
+ * fields stay there. The page itself can also send these actions, so treat them as navigation only.
230
+ */
231
+ presentation?: {
232
+ onAction: (action: NotisHtmlFramePresentAction) => void;
233
+ };
234
+ };
235
+ /** What the presenter asked for inside a presented HtmlFrame. */
236
+ export type NotisHtmlFramePresentAction = 'next' | 'previous' | 'first' | 'last' | 'stop';
237
+ export interface NotisReportFrameProps extends NotisRecordProps {
238
+ }
239
+ export interface NotisShareControlProps extends NotisRecordProps {
240
+ }
241
+ /**
242
+ * Another Space page (a Space view or record page link on the current Notis origin) shown live inside this view.
243
+ * The host loads only links to a Space page of its own origin; any other link shows a card with an Open link.
244
+ */
245
+ export interface NotisSpacePageFrameProps {
246
+ /** A Space page link: a path such as '/slides/decks?deck=...' or the same link with the current Notis origin. */
247
+ href: string;
248
+ /** Names the frame for assistive technology and the fallback card. */
249
+ title?: string;
250
+ className?: string;
251
+ /**
252
+ * False (the default) ignores clicks and keys inside the page, so the view around it (for example a slide
253
+ * deck) keeps its own navigation. True lets the viewer use the page in place.
254
+ */
255
+ interactive?: boolean;
256
+ }
257
+ /** One breadcrumb before the record title; the title is always the last crumb. */
258
+ export interface NotisDocumentPageCrumb {
259
+ label: string;
260
+ onSelect?: () => void;
261
+ }
262
+ /** An extra entry in the page's '...' menu, after the host's own entries. */
263
+ export interface NotisDocumentPageMenuItem {
264
+ label: string;
265
+ onSelect: () => void;
266
+ /** A toolkit icon name (for example 'archive'): drawn before the label in the menu; a host without the menu shows the icon alone, the label as its name and tooltip. */
267
+ icon?: string;
268
+ destructive?: boolean;
269
+ disabled?: boolean;
270
+ }
271
+ /**
272
+ * The host-bound parts of one document page. They share one editor session and one save queue,
273
+ * so a Space can arrange them (for example the properties in a right column) without a second editor.
274
+ */
275
+ export interface NotisDocumentPageParts {
276
+ /** Breadcrumb, Saving or Saved status, actions, Share and the '...' menu. */
277
+ Toolbar: ComponentType;
278
+ /** Cover, icon and title. */
279
+ Header: ComponentType;
280
+ /** Editable or Read only, type, database, created and updated, with the Configure panel toggle. */
281
+ Meta: ComponentType;
282
+ /** The record's properties, saved automatically with the title, icon and cover. */
283
+ Properties: ComponentType;
284
+ /** The collaborative body (or the matching viewer for files, HTML and reports). */
285
+ Body: ComponentType;
286
+ }
287
+ /**
288
+ * The full page for one record that is the main content of a Space view (a note, a document):
289
+ * the same page Beta's document page showed, inside the Space. Every edit (title, icon, cover,
290
+ * properties, body) goes through the host's single save queue and live collaboration.
291
+ */
292
+ export interface NotisDocumentPageProps extends NotisRecordProps {
293
+ /** Crumbs before the record title, usually a way back to the list. `false` hides the breadcrumb. */
294
+ breadcrumb?: NotisDocumentPageCrumb[] | false;
295
+ /** Extra toolbar buttons, before Share and the '...' menu (for example the Space's own Trash button). */
296
+ actions?: ReactNode;
297
+ /** Extra '...' menu entries (for example a destructive Delete, as Beta's page had). Plain toolbar buttons on hosts without DocumentPage. */
298
+ menuItems?: NotisDocumentPageMenuItem[];
299
+ /**
300
+ * Offer the record's Site: a row of its Space view's top bar Share panel, or a toolbar Share when the page shows in
301
+ * another Space's view. Off by default: only Spaces whose records were shared on Beta turn it on.
302
+ */
303
+ share?: boolean;
304
+ /**
305
+ * Which header parts show. `false` hides the whole header (cover, icon and title). `compact` draws the title at
306
+ * the reader size (20/28 semibold), for a page shown in a reader pane beside a list.
307
+ */
308
+ header?: false | {
309
+ cover?: boolean;
310
+ icon?: boolean;
311
+ title?: boolean;
312
+ compact?: boolean;
313
+ };
314
+ /** Show the meta strip (Editable or Read only, type, database, dates). Default true. */
315
+ meta?: boolean;
316
+ /** 'panel' (default): properties in the Configure panel under the meta strip. 'hidden': none. Or choose and order them by property name. */
317
+ properties?: 'panel' | 'hidden' | {
318
+ include?: string[];
319
+ exclude?: string[];
320
+ order?: string[];
321
+ };
322
+ /** Rendered between the properties and the body. */
323
+ aboveBody?: ReactNode;
324
+ /** Rendered under the body. */
325
+ belowBody?: ReactNode;
326
+ /** Column width: standard (900px, as Beta), wide (1200px) or full. */
327
+ width?: 'standard' | 'wide' | 'full';
328
+ /**
329
+ * 'html': the record's one stored `.html` file is the page. It opens full height under the toolbar,
330
+ * like an HTML record, without the header, meta, properties or body editor.
331
+ */
332
+ viewer?: 'html';
333
+ readOnly?: boolean;
334
+ onDirtyChange?: (dirty: boolean) => void;
335
+ onSavingChange?: (saving: boolean) => void;
336
+ /**
337
+ * Called after a title, icon, cover, property or body save is confirmed, so the Space can refresh its lists.
338
+ * On hosts without DocumentPage it is called when a save finishes, with `title` null.
339
+ */
340
+ onSaved?: (record: {
341
+ recordKey: string;
342
+ title: string | null;
343
+ }) => void;
344
+ /**
345
+ * Put the record's title in the Portal top bar as the last crumb ("Space / Page / Record title") while the page
346
+ * shows, so the view's page becomes a parent crumb. Default: on when `breadcrumb` lists at least one crumb (the
347
+ * page is a record opened from the view), off otherwise (a Space that names the leaf itself passes
348
+ * `breadcrumb={false}` and calls `useTopBarTitleLeaf`). Hosts that do not report the title show no leaf.
349
+ * While the top bar names the record, the last crumb's `onSelect` is the view crumb's way back and the page
350
+ * draws its own breadcrumb only where the top bar shows no crumb (narrow screens).
351
+ */
352
+ topBarTitle?: boolean;
353
+ /**
354
+ * Called by the host with the record's title (empty string when untitled) once it shows and whenever it changes,
355
+ * edits included. Hosts without DocumentPage never call it.
356
+ */
357
+ onTitle?: (title: string) => void;
358
+ /**
359
+ * Rearrange the page. Receives the host-bound parts; the default layout is Toolbar, Header, Meta (with
360
+ * Properties in its panel), Body. With a layout, Meta shows only its strip and Properties shows wherever
361
+ * the layout places it (once), so the record's properties are never edited from two places.
362
+ * aboveBody and belowBody are not drawn: place them in the layout.
363
+ */
364
+ layout?: (parts: NotisDocumentPageParts) => ReactNode;
365
+ }
366
+ export interface NotisMarkdownEditorSavePayload {
367
+ markdown: string;
368
+ expectedRevision?: string | null;
369
+ }
370
+ export interface NotisMarkdownEditorSaveResult {
371
+ revision?: string | null;
372
+ }
373
+ /**
374
+ * Storage-neutral host markdown editor. The app owns persistence through
375
+ * `onSave`; the host only supplies Notis' editing experience.
376
+ */
377
+ export interface NotisMarkdownEditorProps {
378
+ /** Stable identity of the edited resource. Changing it starts a fresh editor. */
379
+ resourceKey?: string;
380
+ value: string;
381
+ revision?: string | null;
382
+ readOnly?: boolean;
383
+ autosaveMs?: number;
384
+ placeholder?: string;
385
+ className?: string;
386
+ onChange?: (markdown: string) => void;
387
+ /** Persist an uploaded media/file block and return its durable URL. */
388
+ onUploadFile?: (file: File) => Promise<string>;
389
+ onSave?: (payload: NotisMarkdownEditorSavePayload) => Promise<NotisMarkdownEditorSaveResult | void>;
390
+ onDirtyChange?: (dirty: boolean) => void;
391
+ onSavingChange?: (saving: boolean) => void;
392
+ }
393
+ /**
394
+ * Components the host (portal) injects through the runtime. Apps consume them
395
+ * via the SDK wrappers (e.g. `DocumentEditor`), which fall back gracefully
396
+ * when a host component is unavailable (standalone dev harness, snapshots).
397
+ */
398
+ export interface NotisRuntimeUI {
399
+ DocumentEditor?: ComponentType<NotisDocumentEditorProps>;
400
+ DocumentPage?: ComponentType<NotisDocumentPageProps>;
401
+ MarkdownEditor?: ComponentType<NotisMarkdownEditorProps>;
402
+ RecordProperties?: ComponentType<NotisRecordPropertiesProps>;
403
+ HtmlFrame?: ComponentType<NotisHtmlFrameProps>;
404
+ ReportFrame?: ComponentType<NotisReportFrameProps>;
405
+ ShareControl?: ComponentType<NotisShareControlProps>;
406
+ SpacePageFrame?: ComponentType<NotisSpacePageFrameProps>;
407
+ /** Starts reading a record (and the page's code) before it opens, for example when a list row is hovered. */
408
+ prefetchRecord?: (recordKey: string) => void;
409
+ }
410
+ /**
411
+ * Options for `NotisRuntime.subscribeDatabase`.
412
+ */
413
+ export interface SubscribeDatabaseOptions {
414
+ /**
415
+ * Called with `true` once a live change feed is attached, and with `false`
416
+ * when it drops or is torn down. Hosts without a change feed (dev harness,
417
+ * screenshot stub, vite preview) never call it, so `live` stays false there.
418
+ */
419
+ onStatusChange?: (live: boolean) => void;
420
+ }
421
+ /**
422
+ * Work an app hands to the Notis manager chat through `NotisRuntime.handover`.
423
+ */
424
+ export interface HandoverPayload {
425
+ /** Optional starter message. Omit it to open a context-only composer. */
426
+ prompt?: string;
427
+ /**
428
+ * Alias of a Skill this Space links (`skills/<alias>/` in its source). The
429
+ * host rejects an alias the Space does not link. Omit to hand over plain work.
430
+ */
431
+ skill?: string;
432
+ /**
433
+ * Space-only selected row context; never overrides the host's access scope. The host reads that row without its
434
+ * body, so `readAction` is a read-only query action that accepts `include_content: false`, such as the database's
435
+ * `query_` action; a `read_record_` action fixed to `include_content: true` is refused.
436
+ */
437
+ record?: {
438
+ binding: string;
439
+ recordKey: string;
440
+ readAction: string;
441
+ };
442
+ /**
443
+ * Submit on an active user gesture when the host supports immediate handover;
444
+ * background calls still open an editable draft.
445
+ */
446
+ autoSend?: boolean;
447
+ }
448
+ export interface HandoverResult {
449
+ /** `drafted` when the user still has to press send, `sent` when it went straight through. */
450
+ status: 'drafted' | 'sent';
451
+ }
452
+ /**
453
+ * The user's cloud computer, as far as an app may see it.
454
+ *
455
+ * `exists` is false when the user has never had a sandbox provisioned. A
456
+ * `status` is the last observed VM state; `freshness` and `observed_at` describe
457
+ * its age. Reading these facts never wakes the VM.
458
+ */
459
+ export interface CloudComputerSandboxFacts {
460
+ exists: boolean;
461
+ status: string | null;
462
+ provider: string | null;
463
+ created_at: string | null;
464
+ updated_at: string | null;
465
+ observed_at?: string | null;
466
+ freshness?: 'fresh' | 'stale' | 'unknown';
467
+ }
468
+ /**
469
+ * Whether a CLI inside the cloud computer is signed in.
470
+ *
471
+ * `authenticated: null` means *unknown*, never *signed out*: the sandbox was
472
+ * not running, or the probe could not answer. `reason` says which
473
+ * (`'sandbox_not_running'`, `'no_sandbox'`, `'sandbox_status_unknown'`,
474
+ * `'probe_failed'`, `'not_signed_in'`).
475
+ */
476
+ export interface CloudComputerCliAuthFacts {
477
+ authenticated: boolean | null;
478
+ account: string | null;
479
+ checked_at: string | null;
480
+ freshness?: 'fresh' | 'stale' | 'unknown';
481
+ reason: string | null;
482
+ }
483
+ export interface CloudComputerFacts {
484
+ /**
485
+ * False when this host cannot answer at all — no cloud computer on the user's
486
+ * plan, or the platform could not resolve the facts. Render whatever the app
487
+ * did before rather than an error.
488
+ */
489
+ available: boolean;
490
+ reason?: string | null;
491
+ sandbox: CloudComputerSandboxFacts | null;
492
+ cli_auth: {
493
+ gh: CloudComputerCliAuthFacts;
494
+ };
495
+ }
496
+ export interface RuntimeResource {
497
+ kind: 'app' | 'report' | 'space';
498
+ /** Host-provided adoption eligibility, never report-authored authority. */
499
+ analytics_eligible?: boolean;
500
+ /** Host-derived report family for adoption analytics, e.g. skill review reports. */
501
+ report_kind?: 'skill_review' | 'custom';
502
+ id: string;
503
+ revision: number;
504
+ name?: string;
505
+ icon?: string | null;
506
+ description?: string | null;
507
+ }
508
+ export interface NotisRuntime {
509
+ space?: SpaceRuntimeDescriptor;
510
+ callAction?<TResult = unknown>(actionId: string, inputs?: Record<string, unknown>, options?: SpaceActionOptions): Promise<TResult>;
511
+ documentBody?(request: SpaceDocumentBodyRequest): Promise<SpaceDocumentBodyResult>;
512
+ /**
513
+ * Space-only declared viewer read (`viewerReads`): what the signed-in viewer can open,
514
+ * with their own authority. Absent on Sites, anonymous links and older hosts.
515
+ */
516
+ viewerRead?<TResult = unknown>(operation: SpaceViewerReadOperation, input?: Record<string, unknown>): Promise<TResult>;
517
+ /**
518
+ * Space-only V4 list (`shows`): runs exactly the declared filter with these params as the
519
+ * signed-in Editor. Absent on Sites and older hosts.
520
+ */
521
+ shown?<TResult = unknown>(name: string, params?: Record<string, unknown>, options?: SpaceShownOptions): Promise<TResult>;
522
+ /** Space-only unsent Manager draft; distinct from legacy App activation. */
523
+ draftHandover?(payload: HandoverPayload): Promise<HandoverResult>;
524
+ /**
525
+ * Space-only cloud computer (`cloudComputer`): the signed-in viewer's own cloud computer after that
526
+ * viewer allows it. Absent on Sites, links, verification harnesses and older hosts.
527
+ */
528
+ spaceCloudComputer?: SpaceCloudComputerTransport;
529
+ /** Authenticated runtime identity; app below is presentation metadata only. */
530
+ resource?: RuntimeResource;
531
+ /** Optional host-scoped in-memory read cache. Older hosts remain supported. */
532
+ queryClient?: NotisQueryClient;
533
+ app: AppDescriptor;
534
+ route: RouteDescriptor;
535
+ databases: DatabaseDescriptor[];
536
+ context: NotisRuntimeContext;
537
+ ui?: NotisRuntimeUI;
538
+ /** Publish or clear the focused resource inside the current app view. */
539
+ contextSource?: AgentContextSource;
540
+ publishActiveResource?(resource: ContextResource | null): void;
541
+ /** Remember a copied quote so the host can recover it across iframe paste. */
542
+ captureContextSelection?(selection: ContextSelection): void;
543
+ addContext?(item: AgentContextItem): Promise<boolean>;
544
+ updateContext?(item: AgentContextItem): Promise<boolean>;
545
+ removeContext?(id: string): Promise<boolean>;
546
+ /**
547
+ * Subscribe to changes on an app-owned database. Returns an unsubscribe.
548
+ *
549
+ * The change notification is only a signal — it carries no rows. Consumers
550
+ * react by refetching through the normal tool path, so app scoping,
551
+ * permissions and billing are unchanged. Use the `useDatabaseSubscription`
552
+ * hook rather than calling this directly. In a Space, `slug` is the database
553
+ * binding alias and the hook is `useNativeDocuments(alias, { subscribe: true })`.
554
+ */
555
+ subscribeDatabase?(slug: string, onChange: () => void, options?: SubscribeDatabaseOptions): () => void;
556
+ /**
557
+ * Hand a piece of work to the Notis manager chat. The app cannot run an
558
+ * agent itself: it describes the job, and the manager surface owns progress,
559
+ * billing, cancellation and the transcript. Results come back to the app
560
+ * through its own databases (see `useDatabaseSubscription`).
561
+ *
562
+ * Use the `useHandover` hook rather than calling this directly. Hosts
563
+ * without a manager chat (the dev harness, the vite preview) leave it
564
+ * undefined, so keep whatever fallback the app already offers.
565
+ */
566
+ handover?(payload: HandoverPayload): Promise<HandoverResult>;
567
+ /**
568
+ * Read-only facts about the viewer's cloud computer. Requires `cloudComputer`
569
+ * in `defineSpace` plus the viewer's approval; resolving it never creates,
570
+ * resumes or commands a sandbox.
571
+ *
572
+ * Use the `useCloudComputer` hook rather than calling this directly. Hosts
573
+ * without a cloud computer (the dev harness, the vite preview) answer
574
+ * `{ available: false }`, so keep whatever fallback the app already has.
575
+ * `{ refresh: true }` bypasses the host's short answer cache — the hook's
576
+ * refresh() sends it so a just-completed sign-in becomes visible.
577
+ */
578
+ cloudComputerFacts?(options?: {
579
+ refresh?: boolean;
580
+ }): Promise<CloudComputerFacts>;
581
+ /**
582
+ * Ask the host to navigate. Use the hooks rather than calling this directly: `useNotisNavigation()` sends
583
+ * `space-reference` (a declared alias, checked by the host on every call), `space`, `route` and `app`;
584
+ * `useViewParams().setParams` sends `view-params` (`{ params, replace? }`): the open Space's own URL params, with the
585
+ * Space and record kept and no destination lookup.
586
+ */
587
+ navigate?: (payload: {
588
+ kind: string;
589
+ [key: string]: unknown;
590
+ }) => void | Promise<void>;
591
+ registerTopBarSearch?: (config: {
592
+ onChange: (value: string) => void;
593
+ placeholder?: string;
594
+ onSubmit?: () => void | Promise<void>;
595
+ } | null) => void;
596
+ setTopBarSearchValue?: (value: string) => void;
597
+ setTopBarSearchLoading?: (loading: boolean) => void;
598
+ /**
599
+ * Set or clear the open record's crumb at the end of the top bar title. Use `useTopBarTitleLeaf()`. `onBack`
600
+ * closes the record: the crumb before the leaf calls it. `recordKey` names the Space collection record the leaf
601
+ * shows, so the host can offer to rename it there.
602
+ */
603
+ setTopBarTitleLeaf?: (leaf: {
604
+ label: string;
605
+ onBack?: () => void;
606
+ recordKey?: string;
607
+ } | null) => void;
608
+ listTools(): Promise<ToolDescriptor[]>;
609
+ callTool<TResult = unknown>(name: string, args?: Record<string, unknown>, options?: ToolCallOptions): Promise<TResult>;
610
+ request(path: string, options?: {
611
+ method?: string;
612
+ headers?: Record<string, string>;
613
+ body?: unknown;
614
+ }): Promise<unknown>;
615
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The runtime contract between a Space bundle and its host (Spaces protocol 2).
3
+ *
4
+ * A Space bundle never contains SDK code. Its build externalizes these
5
+ * specifiers and the host (Portal, Site, CLI verify, view renderer) provides
6
+ * them as window globals, set from the module objects the host itself imports,
7
+ * so every Space on a page shares one SDK instance with the host.
8
+ *
9
+ * React is provided the same way (`window.React`, `window.ReactDOM`,
10
+ * `window.ReactDOMClient`, `window.__ReactJSXRuntime`).
11
+ *
12
+ * Pure data: the Vite config and the bundle loader both read it.
13
+ */
14
+ export const NOTIS_SDK_HOST_MODULES = Object.freeze({
15
+ '@notis/sdk': '__NotisSDK',
16
+ '@notis/sdk/ui': '__NotisSDKUI',
17
+ } as const);
18
+
19
+ export type NotisSdkHostModule = keyof typeof NOTIS_SDK_HOST_MODULES;
20
+ export type NotisSdkHostGlobal = (typeof NOTIS_SDK_HOST_MODULES)[NotisSdkHostModule];
21
+
22
+ export const REACT_HOST_MODULES = Object.freeze([
23
+ 'react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime',
24
+ ] as const);
25
+
26
+ /**
27
+ * The only other `@notis/sdk` entries a Space may import. They are pure or
28
+ * build-time only, so the Space build inlines them (or runs them in Node); a
29
+ * built bundle never imports them at runtime.
30
+ */
31
+ export const NOTIS_SDK_BUNDLED_MODULES = Object.freeze([
32
+ '@notis/sdk/words', '@notis/sdk/config', '@notis/sdk/vite',
33
+ ] as const);