supernote 0.26.1__tar.gz → 0.27.0__tar.gz

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 (302) hide show
  1. {supernote-0.26.1/supernote.egg-info → supernote-0.27.0}/PKG-INFO +1 -1
  2. {supernote-0.26.1 → supernote-0.27.0}/pyproject.toml +1 -1
  3. supernote-0.27.0/supernote/alembic/versions/a4b5c6d7e8f9_reparent_uncategorized_ai_summaries.py +143 -0
  4. supernote-0.27.0/supernote/alembic/versions/b5c6d7e8f9a0_add_previous_text_to_note_page_content.py +31 -0
  5. supernote-0.27.0/supernote/alembic/versions/c7d8e9f0a1b2_add_oauth_grants_table.py +131 -0
  6. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/events.py +8 -2
  7. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/extended.py +13 -0
  8. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/base.py +1 -0
  9. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/events.py +15 -1
  10. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/extended.py +35 -0
  11. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/webhook.py +2 -2
  12. supernote-0.27.0/supernote/server/ai/models/__init__.py +23 -0
  13. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/models/embedding.py +2 -52
  14. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/models/ocr.py +14 -46
  15. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/models/summary.py +0 -46
  16. supernote-0.27.0/supernote/server/app.py +292 -0
  17. supernote-0.27.0/supernote/server/components/__init__.py +168 -0
  18. supernote-0.27.0/supernote/server/components/ai/__init__.py +239 -0
  19. supernote-0.27.0/supernote/server/components/ai/http.py +61 -0
  20. supernote-0.27.0/supernote/server/components/apple/__init__.py +45 -0
  21. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/apple/ocr.py +9 -1
  22. supernote-0.27.0/supernote/server/components/events/__init__.py +95 -0
  23. supernote-0.27.0/supernote/server/components/events/http.py +123 -0
  24. supernote-0.27.0/supernote/server/components/events/mcp.py +121 -0
  25. supernote-0.27.0/supernote/server/components/events/models.py +114 -0
  26. supernote-0.26.1/supernote/server/services/event_log.py → supernote-0.27.0/supernote/server/components/events/service.py +182 -59
  27. supernote-0.27.0/supernote/server/components/fake_ai/__init__.py +32 -0
  28. supernote-0.27.0/supernote/server/components/fake_ai/embedding.py +123 -0
  29. {supernote-0.26.1/supernote/server/ai/models/fake → supernote-0.27.0/supernote/server/components/fake_ai}/ocr.py +8 -0
  30. {supernote-0.26.1/supernote/server/ai/models/fake → supernote-0.27.0/supernote/server/components/fake_ai}/summary.py +8 -0
  31. supernote-0.27.0/supernote/server/components/gemini/__init__.py +32 -0
  32. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/gemini/embedding.py +8 -0
  33. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/gemini/ocr.py +8 -0
  34. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/gemini/summary.py +8 -0
  35. supernote-0.27.0/supernote/server/components/http/__init__.py +214 -0
  36. supernote-0.27.0/supernote/server/components/mcp/__init__.py +192 -0
  37. supernote-0.27.0/supernote/server/components/mcp/metrics.py +60 -0
  38. supernote-0.27.0/supernote/server/components/mcp/server.py +113 -0
  39. supernote-0.27.0/supernote/server/components/metrics/__init__.py +45 -0
  40. supernote-0.27.0/supernote/server/components/metrics/http.py +125 -0
  41. supernote-0.26.1/supernote/server/services/storage_metrics.py → supernote-0.27.0/supernote/server/components/metrics/storage.py +8 -0
  42. supernote-0.27.0/supernote/server/components/oauth/__init__.py +33 -0
  43. supernote-0.27.0/supernote/server/components/oauth/http.py +236 -0
  44. supernote-0.27.0/supernote/server/components/oauth/models.py +95 -0
  45. supernote-0.27.0/supernote/server/components/oauth/provider.py +236 -0
  46. supernote-0.27.0/supernote/server/components/openai/__init__.py +33 -0
  47. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/openai/backend.py +1 -1
  48. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/openai/embedding.py +8 -0
  49. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/openai/ocr.py +8 -0
  50. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/openai/summary.py +8 -0
  51. supernote-0.27.0/supernote/server/components/schedule/__init__.py +36 -0
  52. supernote-0.26.1/supernote/server/routes/schedule.py → supernote-0.27.0/supernote/server/components/schedule/http.py +13 -5
  53. {supernote-0.26.1/supernote/server/services → supernote-0.27.0/supernote/server/components/schedule}/ical_export.py +9 -3
  54. supernote-0.27.0/supernote/server/components/schedule/mcp.py +405 -0
  55. supernote-0.26.1/supernote/server/services/schedule.py → supernote-0.27.0/supernote/server/components/schedule/service.py +59 -33
  56. supernote-0.27.0/supernote/server/components/search/__init__.py +75 -0
  57. supernote-0.27.0/supernote/server/components/search/http.py +93 -0
  58. supernote-0.27.0/supernote/server/components/search/mcp.py +182 -0
  59. supernote-0.27.0/supernote/server/components/search/models.py +64 -0
  60. supernote-0.27.0/supernote/server/components/search/service.py +223 -0
  61. supernote-0.27.0/supernote/server/components/socketio/__init__.py +40 -0
  62. supernote-0.27.0/supernote/server/components/socketio/http.py +34 -0
  63. supernote-0.26.1/supernote/server/socket.py → supernote-0.27.0/supernote/server/components/socketio/manager.py +40 -24
  64. supernote-0.27.0/supernote/server/components/transcript/__init__.py +54 -0
  65. supernote-0.27.0/supernote/server/components/transcript/http.py +94 -0
  66. supernote-0.27.0/supernote/server/components/transcript/mcp.py +82 -0
  67. supernote-0.27.0/supernote/server/components/transcript/models.py +33 -0
  68. supernote-0.27.0/supernote/server/components/transcript/service.py +197 -0
  69. supernote-0.27.0/supernote/server/components/web_ui/__init__.py +27 -0
  70. supernote-0.27.0/supernote/server/components/web_ui/http.py +44 -0
  71. supernote-0.27.0/supernote/server/components/webhooks/__init__.py +45 -0
  72. supernote-0.27.0/supernote/server/components/webhooks/config.py +68 -0
  73. supernote-0.26.1/supernote/server/services/webhook.py → supernote-0.27.0/supernote/server/components/webhooks/service.py +4 -4
  74. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/config.py +17 -66
  75. supernote-0.27.0/supernote/server/core.py +323 -0
  76. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/__init__.py +5 -2
  77. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/event_log.py +1 -1
  78. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/note_processing.py +10 -1
  79. supernote-0.27.0/supernote/server/db/models/oauth_grant.py +55 -0
  80. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/schedule.py +2 -2
  81. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/events.py +90 -6
  82. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/keys.py +6 -19
  83. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/metrics.py +23 -70
  84. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/__init__.py +0 -2
  85. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/decorators.py +2 -2
  86. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/extended.py +33 -156
  87. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/__init__.py +6 -11
  88. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/coordination.py +1 -1
  89. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor.py +0 -5
  90. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor_modules/ocr.py +92 -65
  91. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor_modules/page_hashing.py +17 -1
  92. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/user.py +305 -4
  93. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/socket_auth.py +1 -1
  94. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/index.html +27 -0
  95. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/api/client.js +159 -1
  96. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/FileBrowserPanel.js +13 -2
  97. supernote-0.27.0/supernote/server/static/js/components/RecycleBinPanel.js +567 -0
  98. supernote-0.27.0/supernote/server/static/js/components/SettingsPanel.js +241 -0
  99. supernote-0.27.0/supernote/server/static/js/composables/useRecycleBin.js +134 -0
  100. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useRouter.js +60 -4
  101. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/main.js +44 -2
  102. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/types.d.ts +35 -0
  103. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/auth_utils.py +1 -1
  104. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/note_content.py +3 -1
  105. {supernote-0.26.1 → supernote-0.27.0/supernote.egg-info}/PKG-INFO +1 -1
  106. {supernote-0.26.1 → supernote-0.27.0}/supernote.egg-info/SOURCES.txt +67 -30
  107. supernote-0.26.1/supernote/server/ai/models/__init__.py +0 -28
  108. supernote-0.26.1/supernote/server/ai/models/apple/__init__.py +0 -11
  109. supernote-0.26.1/supernote/server/ai/models/fake/__init__.py +0 -7
  110. supernote-0.26.1/supernote/server/ai/models/fake/embedding.py +0 -65
  111. supernote-0.26.1/supernote/server/ai/models/gemini/__init__.py +0 -8
  112. supernote-0.26.1/supernote/server/ai/models/openai/__init__.py +0 -13
  113. supernote-0.26.1/supernote/server/app.py +0 -572
  114. supernote-0.26.1/supernote/server/mcp/__init__.py +0 -10
  115. supernote-0.26.1/supernote/server/mcp/auth.py +0 -472
  116. supernote-0.26.1/supernote/server/mcp/models.py +0 -229
  117. supernote-0.26.1/supernote/server/mcp/server.py +0 -369
  118. supernote-0.26.1/supernote/server/routes/events.py +0 -73
  119. supernote-0.26.1/supernote/server/services/search.py +0 -357
  120. {supernote-0.26.1 → supernote-0.27.0}/LICENSE +0 -0
  121. {supernote-0.26.1 → supernote-0.27.0}/NOTICE +0 -0
  122. {supernote-0.26.1 → supernote-0.27.0}/README.md +0 -0
  123. {supernote-0.26.1 → supernote-0.27.0}/setup.cfg +0 -0
  124. {supernote-0.26.1 → supernote-0.27.0}/supernote/__init__.py +0 -0
  125. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/__init__.py +0 -0
  126. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/env.py +0 -0
  127. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/script.py.mako +0 -0
  128. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/0543a383957b_initial_schema.py +0 -0
  129. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/68964804740d_prevent_user_id_reuse.py +0 -0
  130. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/7a8291f043bc_add_links_and_sort_fields_to_schedule_task.py +0 -0
  131. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/a2b3c4d5e6f7_scope_summary_unique_identifier_by_user.py +0 -0
  132. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/b7397248a96b_merge_mixed_case_system_roots.py +0 -0
  133. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/b8e9c0d1e2f3_backfill_summary_md5_and_timestamps.py +0 -0
  134. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/c1d2e3f4a5b6_add_embedding_model_to_note_page_content.py +0 -0
  135. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/c3d4e5f6a7b8_seed_sync_initialized_for_existing_users.py +0 -0
  136. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/d1e2f3a4b5c6_add_client_task_ids.py +0 -0
  137. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/d4e5f6a7b8c9_unify_schedule_ids_as_string.py +0 -0
  138. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/d5e6f7a8b9c0_reset_legacy_default_user_quota.py +0 -0
  139. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/e6f7a8b9c0d1_add_note_and_page_metadata_tables.py +0 -0
  140. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/e7f8a9b0c1d2_add_update_time_to_schedule_task_group.py +0 -0
  141. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/e8f9a0b1c2d3_add_api_keys_table.py +0 -0
  142. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/f1a2b3c4d5e6_make_schedule_task_list_id_nullable.py +0 -0
  143. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/f2a3b4c5d6e7_add_user_event_log_table.py +0 -0
  144. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic/versions/f3b4c5d6e7f8_migrate_generated_summaries_to_ai_category.py +0 -0
  145. {supernote-0.26.1 → supernote-0.27.0}/supernote/alembic.ini +0 -0
  146. {supernote-0.26.1 → supernote-0.27.0}/supernote/cli/__init__.py +0 -0
  147. {supernote-0.26.1 → supernote-0.27.0}/supernote/cli/admin.py +0 -0
  148. {supernote-0.26.1 → supernote-0.27.0}/supernote/cli/client.py +0 -0
  149. {supernote-0.26.1 → supernote-0.27.0}/supernote/cli/main.py +0 -0
  150. {supernote-0.26.1 → supernote-0.27.0}/supernote/cli/notebook.py +0 -0
  151. {supernote-0.26.1 → supernote-0.27.0}/supernote/cli/server.py +0 -0
  152. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/__init__.py +0 -0
  153. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/admin.py +0 -0
  154. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/api.py +0 -0
  155. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/auth.py +0 -0
  156. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/client.py +0 -0
  157. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/device.py +0 -0
  158. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/exceptions.py +0 -0
  159. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/hashing.py +0 -0
  160. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/login_client.py +0 -0
  161. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/schedule.py +0 -0
  162. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/socket.py +0 -0
  163. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/summary.py +0 -0
  164. {supernote-0.26.1 → supernote-0.27.0}/supernote/client/web.py +0 -0
  165. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/__init__.py +0 -0
  166. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/auth.py +0 -0
  167. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/equipment.py +0 -0
  168. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/file_common.py +0 -0
  169. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/file_device.py +0 -0
  170. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/file_web.py +0 -0
  171. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/schedule.py +0 -0
  172. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/socket.py +0 -0
  173. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/summary.py +0 -0
  174. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/system.py +0 -0
  175. {supernote-0.26.1 → supernote-0.27.0}/supernote/models/user.py +0 -0
  176. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/__init__.py +0 -0
  177. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/author.py +0 -0
  178. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/color.py +0 -0
  179. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/converter.py +0 -0
  180. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/decoder.py +0 -0
  181. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/encoder.py +0 -0
  182. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/exceptions.py +0 -0
  183. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/fileformat.py +0 -0
  184. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/manipulator.py +0 -0
  185. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/parser.py +0 -0
  186. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/renderer.py +0 -0
  187. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/__init__.py +0 -0
  188. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/ArchitectsDaughter-Regular.ttf +0 -0
  189. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/Caveat-Variable.ttf +0 -0
  190. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/InstrumentSerif-Italic.ttf +0 -0
  191. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/InstrumentSerif-Regular.ttf +0 -0
  192. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/Karla-Variable.ttf +0 -0
  193. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/OFL-ArchitectsDaughter.txt +0 -0
  194. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/OFL-Caveat.txt +0 -0
  195. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/OFL-InstrumentSerif.txt +0 -0
  196. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/OFL-Karla.txt +0 -0
  197. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/OFL-SpaceMono.txt +0 -0
  198. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/SpaceMono-Bold.ttf +0 -0
  199. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/SpaceMono-Regular.ttf +0 -0
  200. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/resources/fonts/__init__.py +0 -0
  201. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/schema.py +0 -0
  202. {supernote-0.26.1 → supernote-0.27.0}/supernote/notebook/utils.py +0 -0
  203. {supernote-0.26.1 → supernote-0.27.0}/supernote/py.typed +0 -0
  204. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/__init__.py +0 -0
  205. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/__init__.py +0 -0
  206. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/base.py +0 -0
  207. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/eval.py +0 -0
  208. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/ai/prompts.py +0 -0
  209. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/apple/backend.py +0 -0
  210. {supernote-0.26.1/supernote/server/ai/models → supernote-0.27.0/supernote/server/components}/gemini/backend.py +0 -0
  211. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/constants.py +0 -0
  212. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/__init__.py +0 -0
  213. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/base.py +0 -0
  214. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/migrations.py +0 -0
  215. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/api_key.py +0 -0
  216. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/device.py +0 -0
  217. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/file.py +0 -0
  218. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/kv.py +0 -0
  219. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/login_record.py +0 -0
  220. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/summary.py +0 -0
  221. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/models/user.py +0 -0
  222. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/db/session.py +0 -0
  223. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/exceptions.py +0 -0
  224. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/__init__.py +0 -0
  225. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/__init__.py +0 -0
  226. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/ocr/common/context.md +0 -0
  227. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/ocr/common/legend.md +0 -0
  228. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/ocr/daily/prompt.md +0 -0
  229. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/ocr/default/system.md +0 -0
  230. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/ocr/monthly/prompt.md +0 -0
  231. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/ocr/weekly/prompt.md +0 -0
  232. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/summary/common/instruction.md +0 -0
  233. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/summary/daily/prompt.md +0 -0
  234. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/summary/default/prompt.md +0 -0
  235. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/summary/monthly/prompt.md +0 -0
  236. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/resources/prompts/summary/weekly/prompt.md +0 -0
  237. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/admin.py +0 -0
  238. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/auth.py +0 -0
  239. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/file_device.py +0 -0
  240. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/file_web.py +0 -0
  241. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/oss.py +0 -0
  242. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/summary.py +0 -0
  243. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/routes/system.py +0 -0
  244. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/blob.py +0 -0
  245. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/conversion.py +0 -0
  246. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/file.py +0 -0
  247. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/integrity.py +0 -0
  248. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor_modules/__init__.py +0 -0
  249. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor_modules/embedding.py +0 -0
  250. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor_modules/png_conversion.py +0 -0
  251. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/processor_modules/summary.py +0 -0
  252. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/summary.py +0 -0
  253. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/services/vfs.py +0 -0
  254. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/favicon.ico +0 -0
  255. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/api/http.js +0 -0
  256. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/api/schedule.js +0 -0
  257. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/FileCard.js +0 -0
  258. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/FileViewer.js +0 -0
  259. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/LoginCard.js +0 -0
  260. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/MoveModal.js +0 -0
  261. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/OAuthConsentCard.js +0 -0
  262. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/RenameModal.js +0 -0
  263. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/SearchModal.js +0 -0
  264. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/SystemPanel.js +0 -0
  265. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/TaskPanel.js +0 -0
  266. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/tasks/TaskEditorModal.js +0 -0
  267. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/tasks/TaskIcsModal.js +0 -0
  268. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/tasks/TaskRow.js +0 -0
  269. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/tasks/TaskSidebar.js +0 -0
  270. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/viewer/ViewerMediaPreview.js +0 -0
  271. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/viewer/ViewerSidePanel.js +0 -0
  272. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/viewer/ViewerToolbar.js +0 -0
  273. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/components/viewer/noteMeta.js +0 -0
  274. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useCanvasScrollSync.js +0 -0
  275. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useFileSystem.js +0 -0
  276. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useModalEscape.js +0 -0
  277. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useProcessingStatus.js +0 -0
  278. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useSchedule.js +0 -0
  279. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/composables/useToast.js +0 -0
  280. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/utils/clipboard.js +0 -0
  281. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/utils/format.js +0 -0
  282. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/utils/markdown.js +0 -0
  283. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/js/utils/oauth.js +0 -0
  284. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/static/style.css +0 -0
  285. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/trace.py +0 -0
  286. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/__init__.py +0 -0
  287. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/hashing.py +0 -0
  288. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/paths.py +0 -0
  289. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/prompt_loader.py +0 -0
  290. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/rapid_log.py +0 -0
  291. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/rate_limit.py +0 -0
  292. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/tasks.py +0 -0
  293. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/unique_id.py +0 -0
  294. {supernote-0.26.1 → supernote-0.27.0}/supernote/server/utils/url_signer.py +0 -0
  295. {supernote-0.26.1 → supernote-0.27.0}/supernote/testing/__init__.py +0 -0
  296. {supernote-0.26.1 → supernote-0.27.0}/supernote/testing/notebook_fixtures.py +0 -0
  297. {supernote-0.26.1 → supernote-0.27.0}/supernote/testing/server_runner.py +0 -0
  298. {supernote-0.26.1 → supernote-0.27.0}/supernote.egg-info/dependency_links.txt +0 -0
  299. {supernote-0.26.1 → supernote-0.27.0}/supernote.egg-info/entry_points.txt +0 -0
  300. {supernote-0.26.1 → supernote-0.27.0}/supernote.egg-info/requires.txt +0 -0
  301. {supernote-0.26.1 → supernote-0.27.0}/supernote.egg-info/top_level.txt +0 -0
  302. {supernote-0.26.1 → supernote-0.27.0}/tests/test_init.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: supernote
3
- Version: 0.26.1
3
+ Version: 0.27.0
4
4
  Summary: Unofficial Python toolkit for Ratta Supernote: parse and author .note files, self-host a lightweight SQLite private cloud, and run optional AI synthesis
5
5
  Author-email: Allen Porter <allen.porter@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ requires = ["setuptools>=77.0"]
4
4
 
5
5
  [project]
6
6
  name = "supernote"
7
- version = "0.26.1"
7
+ version = "0.27.0"
8
8
  license = "Apache-2.0"
9
9
  license-files = ["LICENSE", "NOTICE"]
10
10
  description = "Unofficial Python toolkit for Ratta Supernote: parse and author .note files, self-host a lightweight SQLite private cloud, and run optional AI synthesis"
@@ -0,0 +1,143 @@
1
+ """Reparent uncategorized generated AI summaries into AI Summaries category
2
+
3
+ Revision ID: a4b5c6d7e8f9
4
+ Revises: f3b4c5d6e7f8
5
+ Create Date: 2026-11-23 03:55:00.000000
6
+
7
+ """
8
+
9
+ import hashlib
10
+ import time
11
+ import uuid
12
+ from collections.abc import Sequence
13
+
14
+ import sqlalchemy as sa
15
+ from alembic import op
16
+
17
+ # revision identifiers, used by Alembic.
18
+ revision: str = "a4b5c6d7e8f9"
19
+ down_revision: str | Sequence[str] | None = "f3b4c5d6e7f8"
20
+ branch_labels: str | Sequence[str] | None = None
21
+ depends_on: str | Sequence[str] | None = None
22
+
23
+ _AI_SUMMARIES_GROUP_NAME = "AI Summaries"
24
+ _AI_GROUP_MD5 = hashlib.md5(_AI_SUMMARIES_GROUP_NAME.encode("utf-8")).hexdigest()
25
+ _EPOCH_OFFSET_MS = 1609459200000
26
+
27
+
28
+ def _summary_id(user_id: int, file_id: int) -> str:
29
+ return uuid.uuid5(
30
+ uuid.NAMESPACE_URL, f"https://supernote.local/summary/{user_id}/{file_id}"
31
+ ).hex
32
+
33
+
34
+ def _ai_group_id(user_id: int) -> str:
35
+ return uuid.uuid5(
36
+ uuid.NAMESPACE_URL, f"https://supernote.local/ai-summaries-group/{user_id}"
37
+ ).hex
38
+
39
+
40
+ def upgrade() -> None:
41
+ """Move uncategorized server-generated AI summaries into the per-user AI Summaries group."""
42
+ bind = op.get_bind()
43
+ candidates = list(
44
+ bind.execute(
45
+ sa.text(
46
+ "SELECT id, user_id, file_id, unique_identifier, data_source, "
47
+ "last_modified_time, update_time FROM f_summary "
48
+ "WHERE is_deleted = :f AND is_summary_group = :f AND file_id IS NOT NULL "
49
+ "AND (parent_unique_identifier IS NULL OR parent_unique_identifier = '')"
50
+ ),
51
+ {"f": False},
52
+ )
53
+ )
54
+
55
+ to_reparent: list[sa.Row] = []
56
+ for row in candidates:
57
+ user_id = int(row.user_id)
58
+ file_id = int(row.file_id)
59
+ uid = str(row.unique_identifier or "")
60
+ source = (row.data_source or "").strip().upper()
61
+ is_canonical_ai = uid == _summary_id(user_id, file_id)
62
+ is_legacy_ai = (
63
+ uid.endswith("-summary") and bool(source) and source not in {"OCR", "USER"}
64
+ )
65
+ if is_canonical_ai or is_legacy_ai:
66
+ to_reparent.append(row)
67
+
68
+ if not to_reparent:
69
+ return
70
+
71
+ now_ms = int(time.time() * 1000)
72
+ max_existing = int(
73
+ bind.execute(sa.text("SELECT COALESCE(MAX(id), 0) FROM f_summary")).scalar_one()
74
+ )
75
+ next_id = max(max_existing + 1, max(1, (now_ms - _EPOCH_OFFSET_MS) << 22))
76
+ ensured_groups: dict[int, str] = {}
77
+
78
+ def ensure_ai_group(user_id: int) -> str:
79
+ nonlocal next_id
80
+ if user_id in ensured_groups:
81
+ return ensured_groups[user_id]
82
+ group_uuid = _ai_group_id(user_id)
83
+ existing = bind.execute(
84
+ sa.text(
85
+ "SELECT is_deleted, is_summary_group FROM f_summary "
86
+ "WHERE user_id = :uid AND unique_identifier = :uuid"
87
+ ),
88
+ {"uid": user_id, "uuid": group_uuid},
89
+ ).fetchone()
90
+ if existing is None or existing.is_deleted or not existing.is_summary_group:
91
+ if existing is not None:
92
+ bind.execute(
93
+ sa.text(
94
+ "DELETE FROM f_summary WHERE user_id = :uid AND unique_identifier = :uuid"
95
+ ),
96
+ {"uid": user_id, "uuid": group_uuid},
97
+ )
98
+ group_id = next_id
99
+ next_id += 1
100
+ bind.execute(
101
+ sa.text(
102
+ "INSERT INTO f_summary "
103
+ "(id, user_id, name, unique_identifier, is_summary_group, md5_hash, "
104
+ "creation_time, last_modified_time, is_deleted, create_time, update_time) "
105
+ "VALUES (:id, :uid, :name, :uuid, :t, :md5, :now, :now, :f, :now, :now)"
106
+ ),
107
+ {
108
+ "id": group_id,
109
+ "uid": user_id,
110
+ "name": _AI_SUMMARIES_GROUP_NAME,
111
+ "uuid": group_uuid,
112
+ "t": True,
113
+ "f": False,
114
+ "md5": _AI_GROUP_MD5,
115
+ "now": now_ms,
116
+ },
117
+ )
118
+ ensured_groups[user_id] = group_uuid
119
+ return group_uuid
120
+
121
+ for row in to_reparent:
122
+ user_id = int(row.user_id)
123
+ group_uuid = ensure_ai_group(user_id)
124
+ prev_mtime = max(int(row.last_modified_time or 0), int(row.update_time or 0))
125
+ new_mtime = max(now_ms, prev_mtime + 1)
126
+ bind.execute(
127
+ sa.text(
128
+ "UPDATE f_summary SET parent_unique_identifier = :parent, "
129
+ "last_modified_time = :mtime, update_time = :mtime "
130
+ "WHERE user_id = :uid AND id = :id"
131
+ ),
132
+ {
133
+ "parent": group_uuid,
134
+ "mtime": new_mtime,
135
+ "uid": user_id,
136
+ "id": int(row.id),
137
+ },
138
+ )
139
+
140
+
141
+ def downgrade() -> None:
142
+ """Non-destructive data migration; leave category assignments intact on downgrade."""
143
+ pass
@@ -0,0 +1,31 @@
1
+ """Add previous_text column to f_note_page_content
2
+
3
+ Revision ID: b5c6d7e8f9a0
4
+ Revises: a4b5c6d7e8f9
5
+ Create Date: 2026-11-23 05:45:00.000000
6
+
7
+ """
8
+
9
+ from collections.abc import Sequence
10
+
11
+ import sqlalchemy as sa
12
+ from alembic import op
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = "b5c6d7e8f9a0"
16
+ down_revision: str | Sequence[str] | None = "a4b5c6d7e8f9"
17
+ branch_labels: str | Sequence[str] | None = None
18
+ depends_on: str | Sequence[str] | None = None
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Add nullable previous_text column to f_note_page_content."""
23
+ op.add_column(
24
+ "f_note_page_content",
25
+ sa.Column("previous_text", sa.Text(), nullable=True),
26
+ )
27
+
28
+
29
+ def downgrade() -> None:
30
+ """Drop previous_text column from f_note_page_content."""
31
+ op.drop_column("f_note_page_content", "previous_text")
@@ -0,0 +1,131 @@
1
+ """Add oauth_grants and move OAuth refresh tokens out of key_values
2
+
3
+ Revision ID: c7d8e9f0a1b2
4
+ Revises: b5c6d7e8f9a0
5
+ Create Date: 2026-11-23 12:00:00.000000
6
+
7
+ Each live `mcp:refresh_token:*` entry becomes a grant holding the token's SHA-256,
8
+ so connected clients stay connected. Plaintext `mcp:access_token:*` entries are
9
+ dropped: they expire within the hour and clients refresh them. Payloads that
10
+ still carry an email `user_id` are resolved here.
11
+
12
+ Downgrade drops the table, so clients must authorize again.
13
+ """
14
+
15
+ import hashlib
16
+ import json
17
+ import secrets
18
+ import time
19
+ from collections.abc import Sequence
20
+
21
+ import sqlalchemy as sa
22
+ from alembic import op
23
+
24
+ # revision identifiers, used by Alembic.
25
+ revision: str = "c7d8e9f0a1b2"
26
+ down_revision: str | Sequence[str] | None = "b5c6d7e8f9a0"
27
+ branch_labels: str | Sequence[str] | None = None
28
+ depends_on: str | Sequence[str] | None = None
29
+
30
+ _REFRESH_PREFIX = "mcp:refresh_token:"
31
+ _ACCESS_PREFIX = "mcp:access_token:"
32
+
33
+
34
+ def upgrade() -> None:
35
+ """Create oauth_grants and convert stored refresh tokens into grants."""
36
+ op.create_table(
37
+ "oauth_grants",
38
+ sa.Column("user_id", sa.Integer(), nullable=False),
39
+ sa.Column("id", sa.String(length=32), nullable=False),
40
+ sa.Column("client_id", sa.String(length=2048), nullable=False),
41
+ sa.Column("scopes", sa.String(length=1024), nullable=False),
42
+ sa.Column("access_token_hash", sa.String(length=64), nullable=True),
43
+ sa.Column("access_expires_at", sa.Integer(), nullable=True),
44
+ sa.Column("refresh_token_hash", sa.String(length=64), nullable=False),
45
+ sa.Column("created_at", sa.Integer(), nullable=False),
46
+ sa.Column("last_used_at", sa.Integer(), nullable=True),
47
+ sa.Column("expires_at", sa.Integer(), nullable=False),
48
+ sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
49
+ sa.PrimaryKeyConstraint("user_id", "id"),
50
+ )
51
+ op.create_index(
52
+ op.f("ix_oauth_grants_user_id"), "oauth_grants", ["user_id"], unique=False
53
+ )
54
+ op.create_index(
55
+ op.f("ix_oauth_grants_access_token_hash"),
56
+ "oauth_grants",
57
+ ["access_token_hash"],
58
+ unique=False,
59
+ )
60
+ op.create_index(
61
+ op.f("ix_oauth_grants_refresh_token_hash"),
62
+ "oauth_grants",
63
+ ["refresh_token_hash"],
64
+ unique=False,
65
+ )
66
+
67
+ conn = op.get_bind()
68
+ now = int(time.time())
69
+ user_ids: dict[str, int] = {}
70
+ for user_row in conn.execute(sa.text("SELECT id, email FROM users")):
71
+ user_ids[str(user_row.id)] = user_row.id
72
+ user_ids[user_row.email] = user_row.id
73
+ rows = conn.execute(
74
+ sa.text(
75
+ "SELECT key, value, expiry FROM key_values WHERE substr(key, 1, :n) = :p"
76
+ ),
77
+ {"n": len(_REFRESH_PREFIX), "p": _REFRESH_PREFIX},
78
+ ).fetchall()
79
+ for row in rows:
80
+ try:
81
+ payload = json.loads(row.value)
82
+ except (json.JSONDecodeError, TypeError):
83
+ continue
84
+ if not isinstance(payload, dict):
85
+ continue
86
+ user_id = user_ids.get(str(payload.get("user_id")))
87
+ try:
88
+ expires_at = int(payload.get("expires_at") or row.expiry or 0)
89
+ except (TypeError, ValueError):
90
+ continue
91
+ client_id = payload.get("client_id")
92
+ scopes = payload.get("scopes") or []
93
+ if (
94
+ user_id is None
95
+ or expires_at <= now
96
+ or not isinstance(client_id, str)
97
+ or not isinstance(scopes, list)
98
+ ):
99
+ continue
100
+ token = row.key.removeprefix(_REFRESH_PREFIX)
101
+ if not token:
102
+ continue
103
+ conn.execute(
104
+ sa.text(
105
+ "INSERT INTO oauth_grants (user_id, id, client_id, scopes, "
106
+ "refresh_token_hash, created_at, expires_at) "
107
+ "VALUES (:user_id, :id, :client_id, :scopes, :hash, :now, :expires_at)"
108
+ ),
109
+ {
110
+ "user_id": user_id,
111
+ "id": secrets.token_hex(8),
112
+ "client_id": client_id,
113
+ "scopes": " ".join(map(str, scopes)),
114
+ "hash": hashlib.sha256(token.encode("utf-8")).hexdigest(),
115
+ "now": now,
116
+ "expires_at": expires_at,
117
+ },
118
+ )
119
+ for prefix in (_REFRESH_PREFIX, _ACCESS_PREFIX):
120
+ conn.execute(
121
+ sa.text("DELETE FROM key_values WHERE substr(key, 1, :n) = :p"),
122
+ {"n": len(prefix), "p": prefix},
123
+ )
124
+
125
+
126
+ def downgrade() -> None:
127
+ """Drop oauth_grants; clients authorize again."""
128
+ op.drop_index(op.f("ix_oauth_grants_refresh_token_hash"), table_name="oauth_grants")
129
+ op.drop_index(op.f("ix_oauth_grants_access_token_hash"), table_name="oauth_grants")
130
+ op.drop_index(op.f("ix_oauth_grants_user_id"), table_name="oauth_grants")
131
+ op.drop_table("oauth_grants")
@@ -57,14 +57,15 @@ class EventsClient:
57
57
  sync_token: str | None = None,
58
58
  event_types: list[str] | None = None,
59
59
  file_id: int | None = None,
60
+ exclude_actors: list[str] | None = None,
60
61
  limit: int = 200,
61
62
  ) -> EventFeedListVO:
62
63
  """Poll a user's incremental domain event feed (`GET /api/extended/events`).
63
64
 
64
65
  When called with `sync_token=None`, returns retained events starting
65
66
  from the oldest entry in the retention window in chronological order
66
- (optionally narrowed by `event_types` or `file_id`). Callers can page
67
- forward while `has_more` is `True` using each response's
67
+ (optionally narrowed by `event_types`, `file_id`, or `exclude_actors`).
68
+ Callers can page forward while `has_more` is `True` using each response's
68
69
  `next_sync_token` until caught up to the most recent events, then reuse
69
70
  that `next_sync_token` on subsequent polls to fetch only newly recorded
70
71
  events.
@@ -77,6 +78,10 @@ class EventsClient:
77
78
  e.g. `DomainEventType.NOTE_PAGE_TRANSCRIBED`) or namespace prefix
78
79
  globs (`'vfs.*'`, `'note.*'`, `'schedule.*'`, `'summary.*'`).
79
80
  file_id: Optional VFS file ID to scope events to a single file/notebook.
81
+ exclude_actors: Optional list of actor identifiers to exclude from
82
+ results. Pass `['self']` to suppress events authored by the
83
+ currently authenticated credential (API key, OAuth client, device,
84
+ or web session).
80
85
  limit: Maximum number of events per page (`1..1000`, default `200`).
81
86
 
82
87
  Returns:
@@ -88,6 +93,7 @@ class EventsClient:
88
93
  sync_token=sync_token,
89
94
  event_types=",".join(event_types) if event_types else None,
90
95
  file_id=file_id,
96
+ exclude_actors=",".join(exclude_actors) if exclude_actors else None,
91
97
  limit=limit,
92
98
  )
93
99
  params = {k: str(v) for k, v in dto.to_dict().items()}
@@ -14,6 +14,7 @@ from supernote.models.extended import (
14
14
  CreateApiKeyResponseVO,
15
15
  FileProcessingStatusDTO,
16
16
  FileProcessingStatusVO,
17
+ OAuthGrantListResponseVO,
17
18
  SystemTaskListVO,
18
19
  WebAiStatusVO,
19
20
  WebNoteCoverRequestDTO,
@@ -117,6 +118,18 @@ class ExtendedClient:
117
118
  f"/api/extended/keys/{key_id}", BaseResponse
118
119
  )
119
120
 
121
+ async def list_oauth_grants(self) -> OAuthGrantListResponseVO:
122
+ """List MCP OAuth clients the current user has authorized (Extension)."""
123
+ return await self._client.get_json(
124
+ "/api/extended/oauth/grants", OAuthGrantListResponseVO
125
+ )
126
+
127
+ async def revoke_oauth_grant(self, grant_id: str) -> BaseResponse:
128
+ """Disconnect an authorized MCP OAuth client (Extension)."""
129
+ return await self._client.delete_json(
130
+ f"/api/extended/oauth/grants/{grant_id}", BaseResponse
131
+ )
132
+
120
133
  async def get_ai_status(self) -> WebAiStatusVO:
121
134
  """Query server AI processing configuration and status (Extension)."""
122
135
  return await self._client.get_json("/api/extended/ai/status", WebAiStatusVO)
@@ -157,6 +157,7 @@ class ErrorCode(str, Enum):
157
157
  FORBIDDEN = ("403", "Forbidden")
158
158
  NOT_FOUND = ("404", "Not Found")
159
159
  CONFLICT = ("409", "Conflict")
160
+ GONE = ("410", "Gone")
160
161
  INTERNAL_ERROR = ("500", "Internal Server Error")
161
162
 
162
163
  # Specific Error Codes from legacy system
@@ -98,6 +98,11 @@ class EventFeedRequestDTO(DataClassJSONMixin):
98
98
  )
99
99
  """Optional VFS file ID filter."""
100
100
 
101
+ exclude_actors: str | None = field(
102
+ metadata=field_options(alias="excludeActors"), default=None
103
+ )
104
+ """Optional comma-separated actor identifiers to omit from results (e.g. `'self'` or `'api_key:<id>'`)."""
105
+
101
106
  limit: int = 200
102
107
  """Maximum number of events to return (`1..1000`, default `200`)."""
103
108
 
@@ -110,6 +115,15 @@ class EventFeedRequestDTO(DataClassJSONMixin):
110
115
  part.strip() for part in self.event_types.split(",") if part.strip()
111
116
  ] or None
112
117
 
118
+ @property
119
+ def exclude_actor_list(self) -> list[str] | None:
120
+ """Return parsed excluded actor strings, or `None` when unset."""
121
+ if not self.exclude_actors:
122
+ return None
123
+ return [
124
+ part.strip() for part in self.exclude_actors.split(",") if part.strip()
125
+ ] or None
126
+
113
127
  class Config(BaseConfig):
114
128
  serialize_by_alias = True
115
129
  omit_none = True
@@ -132,7 +146,7 @@ class DomainEventVO(DataClassJSONMixin):
132
146
  """Domain event type identifier (see `DomainEventType` in `supernote.models.events`)."""
133
147
 
134
148
  actor: str
135
- """Originating mutation source (`'user:web'`, `'device:<equipment_no>'`, or `'system:processor'`)."""
149
+ """Originating mutation source (`'user:web'`, `'device:<equipment_no>'`, `'api_key:<id>'`, `'oauth:<client_id>'`, or `'system:processor'`)."""
136
150
 
137
151
  entity_type: str = field(metadata=field_options(alias="entityType"))
138
152
  """Target entity category (see `DomainEntityType` in `supernote.models.events`)."""
@@ -295,6 +295,41 @@ class ApiKeyListResponseVO(BaseResponse):
295
295
  serialize_by_alias = True
296
296
 
297
297
 
298
+ @dataclass
299
+ class OAuthGrantVO(DataClassJSONMixin):
300
+ """VO representing an OAuth client the user has authorized.
301
+
302
+ Used by: GET /api/extended/oauth/grants
303
+ """
304
+
305
+ id: str
306
+ client_id: str = field(metadata=field_options(alias="clientId"))
307
+ """IndieAuth client URL that requested access."""
308
+
309
+ scopes: list[str]
310
+ created_at: int = field(metadata=field_options(alias="createdAt"))
311
+ expires_at: int = field(metadata=field_options(alias="expiresAt"))
312
+ last_used_at: int | None = field(
313
+ metadata=field_options(alias="lastUsedAt"), default=None
314
+ )
315
+
316
+ class Config(BaseConfig):
317
+ serialize_by_alias = True
318
+
319
+
320
+ @dataclass
321
+ class OAuthGrantListResponseVO(BaseResponse):
322
+ """Response VO listing authorized OAuth clients.
323
+
324
+ Used by: GET /api/extended/oauth/grants
325
+ """
326
+
327
+ grants: list[OAuthGrantVO] = field(default_factory=list)
328
+
329
+ class Config(BaseConfig):
330
+ serialize_by_alias = True
331
+
332
+
298
333
  @dataclass
299
334
  class WebNoteCoverRequestDTO(DataClassJSONMixin):
300
335
  """Request DTO for retrieving a single-page cover preview URL for a notebook."""
@@ -44,7 +44,7 @@ class NoteSyncCompletedPayload(WebhookPayload):
44
44
  """Payload sent for the `note.sync_completed` outbound webhook event.
45
45
 
46
46
  Corresponds to `EVENT_NOTE_SYNC_COMPLETED` in
47
- `supernote.server.services.webhook`.
47
+ `supernote.server.components.webhooks.service`.
48
48
 
49
49
  Intentionally excludes the internal `user_id` (a private, per-user
50
50
  database identifier) -- see that module for discussion.
@@ -59,7 +59,7 @@ class NoteProcessingCompletedPayload(WebhookPayload):
59
59
  """Payload sent for the `note.processing_completed` outbound webhook event.
60
60
 
61
61
  Corresponds to `EVENT_NOTE_PROCESSING_COMPLETED` in
62
- `supernote.server.services.webhook`.
62
+ `supernote.server.components.webhooks.service`.
63
63
  """
64
64
 
65
65
  file: WebhookFileVO
@@ -0,0 +1,23 @@
1
+ """Task-based AI model interfaces and cross-cutting wrappers.
2
+
3
+ Models are split by capability (`ocr`, `summary`, `embedding`) rather than
4
+ bundled into a single monolithic service so each task can be configured,
5
+ concurrency-limited, or replaced independently.
6
+
7
+ ## Adding a New Model Provider
8
+
9
+ To add a new provider (e.g., `<provider>`):
10
+
11
+ 1. **Create a provider component** under `supernote/server/components/<provider>/`:
12
+ - `__init__.py`: Define `<Name>Component` with `domain = "<provider>"`, `dependencies = ("ai",)`, and `platforms` listing its supported capabilities (e.g., `("ocr", "summary", "embedding")` or `("ocr",)`).
13
+ - `backend.py`: Shared transport/client wrapper and `create_<provider>_backend(providers: Mapping[str, ProviderConfig], provider: str)` helper. Translate SDK or HTTP failures into `AIError` (`supernote.server.ai.base.AIError`).
14
+ - `ocr.py` / `summary.py` / `embedding.py`: Implement the corresponding model subclass (`OcrModel`, `SummaryModel`, `EmbeddingModel`) and expose `async_setup_<platform>(core, registrar)` calling `registrar.register_<platform>("<provider>", create_<platform>_model)`.
15
+ 2. **Register the component** in `BUILTIN_COMPONENTS` (`supernote/server/components/__init__.py`, `default_enabled=False`) and gate it on `configured_ai_providers` in `supernote/server/app.py`. Vector norm validation (`ValidatingEmbeddingModel`), Prometheus telemetry (`Instrumented*Model`), and concurrency limiting (`ModelConfig.max_concurrency`) are applied automatically by `AiRegistrar`.
16
+ 3. **Add unit tests** with 1:1 file parity under `tests/server/components/<provider>/`.
17
+ """
18
+
19
+ __all__ = [
20
+ "embedding",
21
+ "ocr",
22
+ "summary",
23
+ ]
@@ -3,8 +3,8 @@
3
3
  An embedding model maps text into a fixed-length vector of floating-point
4
4
  numbers representing its semantic meaning, allowing notebook pages and search
5
5
  queries to be compared by cosine similarity. Models built by
6
- `create_embedding_model` are wrapped in `ValidatingEmbeddingModel`, which
7
- guarantees that returned vectors are non-empty and have a finite non-zero norm.
6
+ `AiRegistrar.create_embedding_model` are wrapped in `ValidatingEmbeddingModel`,
7
+ which guarantees that returned vectors are non-empty and have a finite non-zero norm.
8
8
  """
9
9
 
10
10
  from __future__ import annotations
@@ -14,21 +14,16 @@ import math
14
14
  from abc import ABC, abstractmethod
15
15
  from collections.abc import Sequence
16
16
  from enum import StrEnum
17
- from typing import TYPE_CHECKING
18
17
 
19
18
  from supernote.server.ai.base import AIError
20
19
  from supernote.server.metrics import AIStage, init_ai_metrics, track_ai_request
21
20
 
22
- if TYPE_CHECKING:
23
- from supernote.server.config import ServerConfig
24
-
25
21
  __all__ = [
26
22
  "ConcurrencyLimitedEmbeddingModel",
27
23
  "EmbeddingModel",
28
24
  "EmbeddingTaskType",
29
25
  "InstrumentedEmbeddingModel",
30
26
  "ValidatingEmbeddingModel",
31
- "create_embedding_model",
32
27
  "validate_embedding_vector",
33
28
  ]
34
29
 
@@ -162,48 +157,3 @@ class ConcurrencyLimitedEmbeddingModel(EmbeddingModel):
162
157
  ) -> list[float]:
163
158
  async with self._semaphore:
164
159
  return await self._model.embed(text, task_type=task_type)
165
-
166
-
167
- def create_embedding_model(config: ServerConfig) -> EmbeddingModel | None:
168
- """Create the configured `EmbeddingModel` with validation, telemetry, and concurrency limiting.
169
-
170
- Wrapper order matters: `ConcurrencyLimitedEmbeddingModel` is outermost so
171
- semaphore queue wait is excluded from `InstrumentedEmbeddingModel` latency,
172
- and `ValidatingEmbeddingModel` is innermost so rejected vectors are recorded
173
- as `status="failure"`.
174
- """
175
- model_cfg = config.ai.embedding
176
- if model_cfg is None:
177
- return None
178
-
179
- model: EmbeddingModel | None
180
- provider_type = config.ai.provider_type(model_cfg.provider)
181
- if provider_type == "gemini":
182
- from supernote.server.ai.models.gemini.embedding import ( # noqa: PLC0415
183
- create_embedding_model as create_gemini_embedding_model,
184
- )
185
-
186
- model = create_gemini_embedding_model(config)
187
- elif provider_type == "openai":
188
- from supernote.server.ai.models.openai.embedding import ( # noqa: PLC0415
189
- create_embedding_model as create_openai_embedding_model,
190
- )
191
-
192
- model = create_openai_embedding_model(config)
193
- elif provider_type == "fake":
194
- from supernote.server.ai.models.fake.embedding import ( # noqa: PLC0415
195
- create_embedding_model as create_fake_embedding_model,
196
- )
197
-
198
- model = create_fake_embedding_model(config)
199
- else:
200
- raise ValueError(
201
- f"Unsupported embedding model provider type: {provider_type!r}"
202
- )
203
-
204
- if model is None:
205
- return None
206
- return ConcurrencyLimitedEmbeddingModel(
207
- InstrumentedEmbeddingModel(ValidatingEmbeddingModel(model)),
208
- max_concurrency=model_cfg.max_concurrency,
209
- )