@lobu/runtime-server 20.2.0 → 21.1.0

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 (270) hide show
  1. package/dist/catalogs/automations.json +0 -8
  2. package/dist/component.json +1 -1
  3. package/dist/connectors/README.md +15 -16
  4. package/dist/connectors/github.ts +274 -193
  5. package/dist/connectors/google_calendar.ts +54 -160
  6. package/dist/connectors/google_drive.ts +106 -131
  7. package/dist/connectors/google_gmail.ts +53 -30
  8. package/dist/connectors/hackernews.ts +2 -5
  9. package/dist/connectors/jira.ts +71 -27
  10. package/dist/connectors/linear.ts +55 -21
  11. package/dist/connectors/microsoft_outlook.ts +151 -110
  12. package/dist/connectors/postgres.ts +19 -11
  13. package/dist/connectors/producthunt.ts +11 -7
  14. package/dist/connectors/reddit.ts +36 -6
  15. package/dist/connectors/rss.ts +2 -2
  16. package/dist/connectors/whatsapp_web.ts +5 -4
  17. package/dist/connectors/x.ts +32 -17
  18. package/dist/connectors/youtube.ts +18 -5
  19. package/dist/db/migrations/20260917000000_views.sql +271 -0
  20. package/dist/db/migrations/20260917000001_views_attach_index.sql +14 -0
  21. package/dist/db/migrations/20260918000000_runs_turn_tool_event_uniq.sql +51 -0
  22. package/dist/db/migrations/20260923230000_runs_connector_artifact_hash.sql +32 -0
  23. package/dist/db/migrations/20260924000000_resource_source_files.sql +17 -0
  24. package/dist/db/migrations/20260928120000_classification_consolidation.sql +51 -0
  25. package/dist/dependencies.bun.lock +113 -102
  26. package/dist/guest.bundle.js +78 -10
  27. package/dist/owletto/dist/assets/_-00GgOtdu.js +1 -0
  28. package/dist/owletto/dist/assets/_-XlUwOWCI.js +2 -0
  29. package/dist/owletto/dist/assets/_agentId-B2DrawIk.js +1 -0
  30. package/dist/owletto/dist/assets/_agentId-CS0AcWH2.js +1 -0
  31. package/dist/owletto/dist/assets/_automationId-BLnqLtUv.js +1 -0
  32. package/dist/owletto/dist/assets/{_connectorKey._connectionId-BAJGfcy7.js → _connectorKey._connectionId-DcUWoZ-C.js} +1 -1
  33. package/dist/owletto/dist/assets/{_connectorKey.index-BBF8vGJS.js → _connectorKey.index-C_yKycN_.js} +1 -1
  34. package/dist/owletto/dist/assets/_conversationId-CpuEvflw.js +1 -0
  35. package/dist/owletto/dist/assets/_deploymentId-BL9tnDFl.js +1 -0
  36. package/dist/owletto/dist/assets/_name-DlxjWkKk.js +1 -0
  37. package/dist/owletto/dist/assets/_owner-Cg50UU6m.js +1 -0
  38. package/dist/owletto/dist/assets/_shape-BWZW4mj8.js +1 -0
  39. package/dist/owletto/dist/assets/_skillKey-B25fO0_O.js +1 -0
  40. package/dist/owletto/dist/assets/_slug-DbD-wv2m.js +1 -0
  41. package/dist/owletto/dist/assets/_viewKey-BcTEvQ3N.js +1 -0
  42. package/dist/owletto/dist/assets/_viewKey-W4RjiUWL.js +1 -0
  43. package/dist/owletto/dist/assets/_viewKey-iGPCKSda.js +1 -0
  44. package/dist/owletto/dist/assets/accept-invitation-BmQKbQem.js +1 -0
  45. package/dist/owletto/dist/assets/activity-route-view-BvtAoGVt.js +1 -0
  46. package/dist/owletto/dist/assets/{agent-card-controls-CZO6GI0s.js → agent-card-controls-bhTMPoVi.js} +1 -1
  47. package/dist/owletto/dist/assets/{agent-client-setup-list-_chLOorY.js → agent-client-setup-list-BBbq_2B1.js} +1 -1
  48. package/dist/owletto/dist/assets/{agent-connect-pages-DWBgSIYT.js → agent-connect-pages-DkDlFVY5.js} +1 -1
  49. package/dist/owletto/dist/assets/{agent-editor-form-BTNlg0kQ.js → agent-editor-form-DwHD9j1Y.js} +1 -1
  50. package/dist/owletto/dist/assets/{agent-guardrails-route-B5uoMC6o.js → agent-guardrails-route-0PsTrqMC.js} +1 -1
  51. package/dist/owletto/dist/assets/{agent-loading-shells-CLoLeFcB.js → agent-loading-shells-BQLjzMPy.js} +1 -1
  52. package/dist/owletto/dist/assets/{agent-permissions-matrix-TP00-MYL.js → agent-permissions-matrix-B-Q5rmuB.js} +1 -1
  53. package/dist/owletto/dist/assets/{agent-skill-context-D4a2QCoZ.js → agent-skill-context-s42Q4Wjo.js} +1 -1
  54. package/dist/owletto/dist/assets/{agent-skills-route-KVDDTbJB.js → agent-skills-route-Cwq1QrhW.js} +1 -1
  55. package/dist/owletto/dist/assets/{agent-subpage-shell-DuVYZvBE.js → agent-subpage-shell-DtzoRy6N.js} +1 -1
  56. package/dist/owletto/dist/assets/agent-thread-D7AGGjRV.js +8 -0
  57. package/dist/owletto/dist/assets/agents-BqCKU4CT.js +1 -0
  58. package/dist/owletto/dist/assets/agents-workbench-Cl7FO7b3.js +1 -0
  59. package/dist/owletto/dist/assets/app-bridge-BH3g2mKG.js +127 -0
  60. package/dist/owletto/dist/assets/{app._appId-D0_LQTJU.js → app._appId-CqYz3AOO.js} +1 -1
  61. package/dist/owletto/dist/assets/automation-detail-content-CKSywvzE.js +1 -0
  62. package/dist/owletto/dist/assets/automations-BqCKU4CT.js +1 -0
  63. package/dist/owletto/dist/assets/{calendar-C0XpOHd8.js → calendar-CHXehtu0.js} +1 -1
  64. package/dist/owletto/dist/assets/{callback-CO_K9eR-.js → callback-DZ3YyXeV.js} +1 -1
  65. package/dist/owletto/dist/assets/{card-DeFQuU_J.js → card-4Ull9W6d.js} +1 -1
  66. package/dist/owletto/dist/assets/{claim-CUpWOSie.js → claim-BGLCPLXq.js} +1 -1
  67. package/dist/owletto/dist/assets/clients-C7ubnFsS.js +1 -0
  68. package/dist/owletto/dist/assets/{code-editor-BqGUZFt6.js → code-editor-BHiWR94J.js} +1 -1
  69. package/dist/owletto/dist/assets/connect-BNatqg6j.js +1 -0
  70. package/dist/owletto/dist/assets/connect._clientId-BGG2IqiQ.js +1 -0
  71. package/dist/owletto/dist/assets/connected._clientId-7RU89sVW.js +1 -0
  72. package/dist/owletto/dist/assets/{connection-BgAlYjeV.js → connection-CTaUGXl6.js} +1 -1
  73. package/dist/owletto/dist/assets/{connection-feed-detail-B3ePAinf.js → connection-feed-detail-B1xieiEh.js} +1 -1
  74. package/dist/owletto/dist/assets/{connector-provenance-DgsDg0Z9.js → connector-provenance-DRdUEmQ1.js} +1 -1
  75. package/dist/owletto/dist/assets/{connectors-CqPQPo9U.js → connectors-NBwCLuZg.js} +1 -1
  76. package/dist/owletto/dist/assets/{consent-bswcIzsf.js → consent-fmhPPlpi.js} +1 -1
  77. package/dist/owletto/dist/assets/{core.esm-DsLgjoel.js → core.esm-C-eNiUAl.js} +1 -1
  78. package/dist/owletto/dist/assets/{create-Dwo04oWV.js → create-8bBbQJGY.js} +1 -1
  79. package/dist/owletto/dist/assets/create-Cl6cfNAp.js +1 -0
  80. package/dist/owletto/dist/assets/create-DrVso8O7.js +1 -0
  81. package/dist/owletto/dist/assets/create-automation-form-De8J-JD5.js +2 -0
  82. package/dist/owletto/dist/assets/{create._connectorKey-CCBb2pil.js → create._connectorKey-CHAotlsF.js} +1 -1
  83. package/dist/owletto/dist/assets/{cronstrue-ChFyC9ps.js → cronstrue-C5yTgk5z.js} +1 -1
  84. package/dist/owletto/dist/assets/deployments-C7M3fV5K.js +1 -0
  85. package/dist/owletto/dist/assets/deployments-D1gbQwsy.js +1 -0
  86. package/dist/owletto/dist/assets/deployments-body-DycIGlnL.js +1 -0
  87. package/dist/owletto/dist/assets/device-DyPnQkhO.js +1 -0
  88. package/dist/owletto/dist/assets/{device-pin-tombstone-1ikyqSdb.js → device-pin-tombstone-CwJitllC.js} +1 -1
  89. package/dist/owletto/dist/assets/device-rows-BBhW1C7Y.js +1 -0
  90. package/dist/owletto/dist/assets/{device._deviceId-DTYKGBY8.js → device._deviceId-XswfXHOc.js} +1 -1
  91. package/dist/owletto/dist/assets/entity-options-utGBmFX0.js +1 -0
  92. package/dist/owletto/dist/assets/entity-page-BxwuqqWk.js +1 -0
  93. package/dist/owletto/dist/assets/entity-type-page-BrWqk6so.js +1 -0
  94. package/dist/owletto/dist/assets/event-page-LIm4EDmJ.js +1 -0
  95. package/dist/owletto/dist/assets/events-feed-C4L8mQV7.js +1 -0
  96. package/dist/owletto/dist/assets/{full-page-spinner-BN2G_YiM.js → full-page-spinner-DsU-Cb3L.js} +1 -1
  97. package/dist/owletto/dist/assets/guardrails-CGFWCfbQ.js +1 -0
  98. package/dist/owletto/dist/assets/identity-uPYpPogR.js +1 -0
  99. package/dist/owletto/dist/assets/{index-hSE2E46p.js → index-1YrrvVJ4.js} +1 -1
  100. package/dist/owletto/dist/assets/index-BKMafTe4.js +1 -0
  101. package/dist/owletto/dist/assets/index-BsL1-C2-.js +1 -0
  102. package/dist/owletto/dist/assets/index-C58oW727.js +1 -0
  103. package/dist/owletto/dist/assets/index-C8CR2-Ck.css +1 -0
  104. package/dist/owletto/dist/assets/{index-OUb5Mlez.js → index-CDz3-ieP.js} +10 -10
  105. package/dist/owletto/dist/assets/{index-C6VAJ8Ku.js → index-CQ4s6nzy.js} +1 -1
  106. package/dist/owletto/dist/assets/index-CpWKAAGX.js +1 -0
  107. package/dist/owletto/dist/assets/{index-vdqhlocx.js → index-D2dcENg2.js} +1 -1
  108. package/dist/owletto/dist/assets/{index-C2oCgDX7.js → index-DCK0KhMM.js} +1 -1
  109. package/dist/owletto/dist/assets/{index-C-u4yR8Z.js → index-DXqiRON3.js} +1 -1
  110. package/dist/owletto/dist/assets/index-DgEc5IvT.js +1 -0
  111. package/dist/owletto/dist/assets/index-DtRfQcRH.js +7898 -0
  112. package/dist/owletto/dist/assets/index-DvhM9tuI.js +1 -0
  113. package/dist/owletto/dist/assets/index-DwtfHCHB.js +1 -0
  114. package/dist/owletto/dist/assets/index-DyYFZjh-.js +1 -0
  115. package/dist/owletto/dist/assets/index-nOYvNROJ.js +1 -0
  116. package/dist/owletto/dist/assets/index-oDoJENMF.js +1 -0
  117. package/dist/owletto/dist/assets/index-rPdUEOa3.js +1 -0
  118. package/dist/owletto/dist/assets/{json-diff-DnsW7Pin.js → json-diff-DYeX-xLk.js} +2 -2
  119. package/dist/owletto/dist/assets/{list-skeleton-CHzLN7GK.js → list-skeleton-s4GPSJ8J.js} +1 -1
  120. package/dist/owletto/dist/assets/login-Di5VF2F_.js +1 -0
  121. package/dist/owletto/dist/assets/logout-BuaQGSnw.js +1 -0
  122. package/dist/owletto/dist/assets/member-scope-gate-CJqJZk7T.js +1 -0
  123. package/dist/owletto/dist/assets/memory-browse-page-Bibfs2sK.js +101 -0
  124. package/dist/owletto/dist/assets/missing-view-CD4DOaG8.js +1 -0
  125. package/dist/owletto/dist/assets/{model-selector-DfbmHjLu.js → model-selector-XC5CI2Et.js} +1 -1
  126. package/dist/owletto/dist/assets/models--8mTFOLz.js +1 -0
  127. package/dist/owletto/dist/assets/{new-Df_dY6Z5.js → new-BzkA1sq2.js} +1 -1
  128. package/dist/owletto/dist/assets/new-C3f0BShb.js +1 -0
  129. package/dist/owletto/dist/assets/new-DA5LF6iB.js +1 -0
  130. package/dist/owletto/dist/assets/{oauth-workspace-access-D9GmiMfK.js → oauth-workspace-access-D6epOq0R.js} +1 -1
  131. package/dist/owletto/dist/assets/{organization-uSDYkJpX.js → organization-DOtBRqDQ.js} +1 -1
  132. package/dist/owletto/dist/assets/{permissions-Fe0DP6b8.js → permissions-D8uJHINS.js} +1 -1
  133. package/dist/owletto/dist/assets/{proposal-review-shell-D9HwnDda.js → proposal-review-shell-C3K-JXjb.js} +1 -1
  134. package/dist/owletto/dist/assets/{recent-C03LhMD7.js → recent-CFcWceBl.js} +1 -1
  135. package/dist/owletto/dist/assets/{renderer-CHNejd95.js → renderer-1nRJFMGx.js} +2 -2
  136. package/dist/owletto/dist/assets/{reset-password-CuISnlG_.js → reset-password-9RTWhBEb.js} +1 -1
  137. package/dist/owletto/dist/assets/runs-_yVh6PPB.js +1 -0
  138. package/dist/owletto/dist/assets/{runs-panel-DsdESupx.js → runs-panel-B2852xus.js} +1 -1
  139. package/dist/owletto/dist/assets/runs-table--dnFQatY.js +1 -0
  140. package/dist/owletto/dist/assets/{schema-value-normalization-B--OWDL8.js → schema-value-normalization-BspxVEGy.js} +1 -1
  141. package/dist/owletto/dist/assets/{settings-wGNHtsDP.js → settings-9lDASETT.js} +1 -1
  142. package/dist/owletto/dist/assets/settings-DQo_ZS2P.js +1 -0
  143. package/dist/owletto/dist/assets/skills-a5xQ4RE9.js +1 -0
  144. package/dist/owletto/dist/assets/{switch-Dzse_XFM.js → switch-CxDXvPGE.js} +1 -1
  145. package/dist/owletto/dist/assets/use-applied-views-DvMT3wap.js +1 -0
  146. package/dist/owletto/dist/assets/{use-mention-search-uyW1Uwf6.js → use-mention-search-CeTEE3oE.js} +1 -1
  147. package/dist/owletto/dist/assets/view-frame-HoBawpT2.js +1 -0
  148. package/dist/owletto/dist/index.html +2 -2
  149. package/dist/providers.json +0 -1
  150. package/dist/server-main.bundle.mjs +8997 -7479
  151. package/npm-shrinkwrap.json +543 -485
  152. package/package.json +5 -2
  153. package/vendor/connector-sdk/dist/connector-runtime.d.ts +4 -6
  154. package/vendor/connector-sdk/dist/connector-runtime.js +3 -5
  155. package/vendor/connector-sdk/dist/connector-types.d.ts +28 -15
  156. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -1
  157. package/vendor/connector-sdk/dist/define-connector.js +4 -1
  158. package/vendor/connector-sdk/dist/http-client.d.ts +18 -7
  159. package/vendor/connector-sdk/dist/http-client.js +15 -13
  160. package/vendor/connector-sdk/dist/index.d.ts +1 -1
  161. package/vendor/connector-sdk/dist/retry.d.ts +15 -3
  162. package/vendor/connector-sdk/dist/retry.js +40 -64
  163. package/vendor/connector-sdk/package.json +1 -1
  164. package/vendor/core/dist/agent-policy.js +3 -0
  165. package/vendor/core/dist/connector-query-errors.d.ts +3 -3
  166. package/vendor/core/dist/connector-query-errors.js +8 -3
  167. package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +14 -0
  168. package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +12 -1
  169. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +0 -10
  170. package/vendor/core/dist/contracts/tools/manage-automations.js +0 -33
  171. package/vendor/core/dist/contracts/tools/manage-classifiers.d.ts +4 -34
  172. package/vendor/core/dist/contracts/tools/manage-classifiers.js +13 -44
  173. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +24 -0
  174. package/vendor/core/dist/contracts/tools/manage-connections.js +13 -0
  175. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +15 -25
  176. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +3 -5
  177. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +0 -9
  178. package/vendor/core/dist/contracts/tools/manage-entity.js +0 -6
  179. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +11 -0
  180. package/vendor/core/dist/contracts/tools/manage-feeds.js +12 -1
  181. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +47 -6
  182. package/vendor/core/dist/contracts/tools/manage-operations.js +36 -1
  183. package/vendor/core/dist/contracts/tools/manage-views.d.ts +293 -0
  184. package/vendor/core/dist/contracts/tools/manage-views.js +203 -0
  185. package/vendor/core/dist/contracts/tools/source-files-schema.d.ts +7 -0
  186. package/vendor/core/dist/contracts/tools/source-files-schema.js +19 -0
  187. package/vendor/core/dist/contracts/tools/source-files.d.ts +14 -0
  188. package/vendor/core/dist/contracts/tools/source-files.js +55 -0
  189. package/vendor/core/dist/contracts/tools/view-attach.d.ts +20 -0
  190. package/vendor/core/dist/contracts/tools/view-attach.js +45 -0
  191. package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +37 -0
  192. package/vendor/core/dist/contracts/tools/view-content-hash.js +58 -0
  193. package/vendor/core/dist/contracts/tools/view-path.d.ts +18 -0
  194. package/vendor/core/dist/contracts/tools/view-path.js +24 -0
  195. package/vendor/core/dist/contracts/worker/protocol.d.ts +90 -8
  196. package/vendor/core/dist/contracts/worker/protocol.js +70 -10
  197. package/vendor/core/dist/index.d.ts +1 -1
  198. package/vendor/core/dist/provider-config-types.d.ts +0 -9
  199. package/vendor/core/dist/reserved.d.ts +3 -3
  200. package/vendor/core/dist/reserved.js +9 -1
  201. package/vendor/core/dist/sdk-compat.d.ts +1 -1
  202. package/vendor/core/dist/utils/secret-redaction.js +2 -0
  203. package/vendor/core/package.json +30 -5
  204. package/vendor/views/dist/api.d.ts +184 -0
  205. package/vendor/views/dist/api.js +410 -0
  206. package/vendor/views/dist/bridge.d.ts +141 -0
  207. package/vendor/views/dist/bridge.js +330 -0
  208. package/vendor/views/dist/index.d.ts +12 -0
  209. package/vendor/views/dist/index.js +10 -0
  210. package/vendor/views/package.json +35 -0
  211. package/dist/owletto/dist/assets/_-Ds4DyQjj.js +0 -2
  212. package/dist/owletto/dist/assets/_-VmyR6aN_.js +0 -1
  213. package/dist/owletto/dist/assets/_agentId-BAVnp0c7.js +0 -1
  214. package/dist/owletto/dist/assets/_agentId-Df-3rGi5.js +0 -1
  215. package/dist/owletto/dist/assets/_automationId-D696vOjd.js +0 -1
  216. package/dist/owletto/dist/assets/_conversationId-Ci4rgrHm.js +0 -1
  217. package/dist/owletto/dist/assets/_deploymentId-Iy-D5PDq.js +0 -1
  218. package/dist/owletto/dist/assets/_name-CeGwb0oK.js +0 -1
  219. package/dist/owletto/dist/assets/_owner-CFR1G8OX.js +0 -1
  220. package/dist/owletto/dist/assets/_skillKey-DuLcQWBu.js +0 -1
  221. package/dist/owletto/dist/assets/_slug-CDSO20ac.js +0 -1
  222. package/dist/owletto/dist/assets/accept-invitation-Db5jklHT.js +0 -1
  223. package/dist/owletto/dist/assets/activity-route-view-DVW3DoB7.js +0 -1
  224. package/dist/owletto/dist/assets/agent-thread-CzCJU3-R.js +0 -134
  225. package/dist/owletto/dist/assets/agents-DFs57C3c.js +0 -1
  226. package/dist/owletto/dist/assets/agents-workbench-C2bUlJP2.js +0 -1
  227. package/dist/owletto/dist/assets/automation-detail-content-DWkdhnv2.js +0 -1
  228. package/dist/owletto/dist/assets/automations-DFs57C3c.js +0 -1
  229. package/dist/owletto/dist/assets/clients-DhYr4lyL.js +0 -1
  230. package/dist/owletto/dist/assets/connect-Dtb-E5An.js +0 -1
  231. package/dist/owletto/dist/assets/connect._clientId-DWtceAAw.js +0 -1
  232. package/dist/owletto/dist/assets/connected._clientId-CMe-wTuV.js +0 -1
  233. package/dist/owletto/dist/assets/create-CcXUdke7.js +0 -1
  234. package/dist/owletto/dist/assets/create-Cp6hMoeU.js +0 -1
  235. package/dist/owletto/dist/assets/create-automation-form-CJ4meayB.js +0 -1
  236. package/dist/owletto/dist/assets/deployments-CjfFxyDA.js +0 -1
  237. package/dist/owletto/dist/assets/deployments-body-Cg0KiWGr.js +0 -1
  238. package/dist/owletto/dist/assets/device-DpY67Jaj.js +0 -1
  239. package/dist/owletto/dist/assets/device-rows-Cp3yMcuV.js +0 -1
  240. package/dist/owletto/dist/assets/entity-options-1EaSGMX4.js +0 -1
  241. package/dist/owletto/dist/assets/entity-page-DJmM70dv.js +0 -1
  242. package/dist/owletto/dist/assets/entity-type-page-C3mT7tXn.js +0 -1
  243. package/dist/owletto/dist/assets/events-feed-iliGfjit.js +0 -1
  244. package/dist/owletto/dist/assets/guardrails-CLlnRRy9.js +0 -1
  245. package/dist/owletto/dist/assets/identity-MSLryUi8.js +0 -1
  246. package/dist/owletto/dist/assets/index-3o4Eepb4.js +0 -1
  247. package/dist/owletto/dist/assets/index-BUr8321-.js +0 -7898
  248. package/dist/owletto/dist/assets/index-Bulu5ldM.js +0 -1
  249. package/dist/owletto/dist/assets/index-BvbfITqH.js +0 -1
  250. package/dist/owletto/dist/assets/index-ChcQMdod.css +0 -1
  251. package/dist/owletto/dist/assets/index-Clw9ZBj-.js +0 -1
  252. package/dist/owletto/dist/assets/index-D2oL4Ydo.js +0 -1
  253. package/dist/owletto/dist/assets/index-D7wulT4y.js +0 -1
  254. package/dist/owletto/dist/assets/index-DOLFe19K.js +0 -1
  255. package/dist/owletto/dist/assets/index-DTSA0Xh1.js +0 -1
  256. package/dist/owletto/dist/assets/index-DxXXVPU0.js +0 -1
  257. package/dist/owletto/dist/assets/index-nzvsA3hT.js +0 -1
  258. package/dist/owletto/dist/assets/login-CCKNM0gV.js +0 -1
  259. package/dist/owletto/dist/assets/logout-B-N2aodZ.js +0 -1
  260. package/dist/owletto/dist/assets/member-scope-gate-B560Wg-t.js +0 -1
  261. package/dist/owletto/dist/assets/memory-browse-page-DMDqKJn7.js +0 -101
  262. package/dist/owletto/dist/assets/models-M51OGDRE.js +0 -1
  263. package/dist/owletto/dist/assets/new-BVQS9H-Y.js +0 -1
  264. package/dist/owletto/dist/assets/new-DxDVE9nL.js +0 -1
  265. package/dist/owletto/dist/assets/runs-BnYdToDc.js +0 -1
  266. package/dist/owletto/dist/assets/runs-table-B7jKuILd.js +0 -1
  267. package/dist/owletto/dist/assets/settings-Bg9yCCoN.js +0 -1
  268. package/dist/owletto/dist/assets/skills-CN5Ube7A.js +0 -1
  269. package/vendor/core/dist/contracts/tools/manage-view-templates.d.ts +0 -165
  270. package/vendor/core/dist/contracts/tools/manage-view-templates.js +0 -130
@@ -12,7 +12,6 @@ import {
12
12
  createHttpClient,
13
13
  type EventEnvelope,
14
14
  type HttpClient,
15
- paginateByCursor,
16
15
  type FeedReadContext,
17
16
  type FeedReadResult,
18
17
  type RuntimeConnectorDefinition,
@@ -82,7 +81,7 @@ interface CalendarCheckpoint {
82
81
  */
83
82
  scope?: string;
84
83
  /**
85
- * Unfinished bootstrap: the `events.list` query as first issued (so the
84
+ * Unfinished traversal: the `events.list` query as first issued (so the
86
85
  * `timeMin`/`timeMax` window stays fixed across runs, which the page token
87
86
  * requires) plus the token for the page still to fetch. Absent once the
88
87
  * traversal has reached the last page.
@@ -457,7 +456,6 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
457
456
  const lookbackDays = (ctx.config.lookback_days as number) ?? 30;
458
457
 
459
458
  const checkpoint = (ctx.checkpoint ?? {}) as CalendarCheckpoint;
460
- const events: EventEnvelope[] = [];
461
459
  const durableChanges = ctx.feedKey === 'changes';
462
460
 
463
461
  // A checkpoint minted under a different scope (or by an older version that
@@ -467,28 +465,18 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
467
465
  const scope = JSON.stringify([CHECKPOINT_SCOPE_VERSION, calendarId, lookbackDays]);
468
466
  const resumable = checkpoint.scope === scope;
469
467
 
470
- /** Traversal reached the last page: store its cursor and stamp the run. */
471
- const finish = (items: EventEnvelope[], syncToken?: string): SyncResult => {
472
- const result = this.buildResult(items, syncToken);
473
- return { ...result, checkpoint: { ...result.checkpoint, scope } };
468
+ /** Traversal reached the last page: commit it with its cursor and stamp the run. */
469
+ const finish = async (items: EventEnvelope[], syncToken?: string): Promise<SyncResult> => {
470
+ await ctx.commit(items, {
471
+ ...this.completedCheckpoint(syncToken),
472
+ scope,
473
+ } as Record<string, unknown>);
474
+ return { status: 'complete' };
474
475
  };
475
476
 
476
- if (resumable && checkpoint.sync_token) {
477
- const result = await this.syncWithToken(
478
- http,
479
- calendarId,
480
- checkpoint.sync_token,
481
- durableChanges
482
- );
483
- if (result) return finish(result.events, result.nextSyncToken);
484
- // The stored token was rejected (see isSyncTokenRejection). Fall through
485
- // to one complete bootstrap under the current grant — no retry loop. It
486
- // either succeeds and overwrites the checkpoint with a token minted under
487
- // that grant, or throws and the error reaches the run record.
488
- }
489
-
490
- // Bootstrap: walk the configured window, resuming a parked page if one is
491
- // in scope, until the last page hands over a durable cursor.
477
+ const syncToken = resumable ? checkpoint.sync_token : undefined;
478
+ // Bootstrap and incremental traversal share the same page commit boundary.
479
+ // An incremental page keeps its original sync token until the final page.
492
480
  const timeMin = new Date();
493
481
  timeMin.setDate(timeMin.getDate() - lookbackDays);
494
482
  const timeMax = new Date();
@@ -500,32 +488,41 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
500
488
  // run: a page token is only valid against the window that minted it.
501
489
  const params = pending
502
490
  ? new URLSearchParams(pending.params)
503
- : durableChanges
491
+ : syncToken
504
492
  ? new URLSearchParams({
505
493
  maxResults: '250',
506
- singleEvents: 'true',
507
- showDeleted: 'true',
508
- timeMin: timeMin.toISOString(),
494
+ syncToken,
495
+ ...(durableChanges ? { singleEvents: 'true', showDeleted: 'true' } : {}),
509
496
  })
510
- : new URLSearchParams({
511
- maxResults: '250',
512
- orderBy: 'startTime',
513
- singleEvents: 'true',
514
- timeMin: timeMin.toISOString(),
515
- timeMax: timeMax.toISOString(),
516
- });
497
+ : durableChanges
498
+ ? new URLSearchParams({
499
+ maxResults: '250',
500
+ singleEvents: 'true',
501
+ showDeleted: 'true',
502
+ timeMin: timeMin.toISOString(),
503
+ })
504
+ : new URLSearchParams({
505
+ maxResults: '250',
506
+ orderBy: 'startTime',
507
+ singleEvents: 'true',
508
+ timeMin: timeMin.toISOString(),
509
+ timeMax: timeMax.toISOString(),
510
+ });
517
511
  const baseParams = params.toString();
518
512
 
519
513
  /**
520
- * Ran out of budget mid-traversal: park the next page token and return no
521
- * sync token and no `last_sync_at`, so nothing downstream can read this run
522
- * as a completed window. The next scheduled run resumes from `token`.
514
+ * Mid-traversal: preserve the old sync token and completed watermark,
515
+ * alongside the next page and the exact query that minted it.
516
+ * A run that stops here resumes from `token`.
523
517
  */
524
- const park = (token: string): SyncResult => ({
525
- ...this.buildResult(events, undefined),
526
- checkpoint: { scope, pending: { params: baseParams, page_token: token } },
527
- });
528
-
518
+ const parked = (token: string) =>
519
+ ({
520
+ scope,
521
+ ...(syncToken ? { sync_token: syncToken, last_sync_at: checkpoint.last_sync_at } : {}),
522
+ pending: { params: baseParams, page_token: token },
523
+ }) as Record<string, unknown>;
524
+
525
+ let collected = 0;
529
526
  let pageToken = pending?.page_token;
530
527
  const seenTokens = new Set<string>();
531
528
  for (let page = 0; ; page++) {
@@ -537,11 +534,13 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
537
534
  const url = `${this.BASE_URL}/calendars/${encodeURIComponent(calendarId)}/events?${params.toString()}`;
538
535
  const response = await http.raw(url);
539
536
  if (!response.ok) {
540
- // No checkpoint is returned, so the parked token survives and this
541
- // exact page is retried on the next run.
542
- throw new Error(
543
- `Calendar events.list error (${response.status}): ${await response.text()}`
544
- );
537
+ const body = await response.text();
538
+ if (syncToken && isSyncTokenRejection(response.status, body)) {
539
+ // Discard both tokens together. Replayed items keep their origin IDs;
540
+ // a failed bootstrap remains retryable without treating it as complete.
541
+ return this.syncFeed({ ...ctx, checkpoint: { scope } });
542
+ }
543
+ throw new Error(`Calendar events.list error (${response.status}): ${body}`);
545
544
  }
546
545
 
547
546
  const data = (await response.json()) as CalendarEventListResponse;
@@ -549,6 +548,7 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
549
548
  // A provider page is atomic: `max_results` caps how much a run starts,
550
549
  // never how much of a fetched page is stored. Dropping a page's tail
551
550
  // would lose those events for good once the cursor moved past them.
551
+ const events: EventEnvelope[] = [];
552
552
  for (const calEvent of items) {
553
553
  const envelope = durableChanges
554
554
  ? this.calendarEventToChangeEnvelope(calEvent)
@@ -570,17 +570,19 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
570
570
  throw new Error('Google Calendar returned a repeated page token.');
571
571
  }
572
572
  pageToken = data.nextPageToken;
573
+ await ctx.commit(events, parked(pageToken));
574
+ collected += events.length;
573
575
 
574
576
  // Stop once this run has collected its share, once the provider returns
575
577
  // an empty page, or at the hard ceiling — the last of which is the only
576
578
  // bound on a window of nothing but filtered-out items, where
577
- // `events.length` never reaches the cap.
579
+ // `collected` never reaches the cap. The traversal continues next run.
578
580
  if (
579
- events.length >= maxResults ||
581
+ (!syncToken && collected >= maxResults) ||
580
582
  items.length === 0 ||
581
583
  page + 1 >= MAX_SYNC_PAGES
582
584
  ) {
583
- return park(pageToken);
585
+ return { status: 'more' };
584
586
  }
585
587
  }
586
588
  }
@@ -621,100 +623,6 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
621
623
  }
622
624
  }
623
625
 
624
- // -------------------------------------------------------------------------
625
- // Incremental sync
626
- // -------------------------------------------------------------------------
627
-
628
- private async syncWithToken(
629
- http: HttpClient,
630
- calendarId: string,
631
- syncToken: string,
632
- durableChanges: boolean
633
- ): Promise<{ events: EventEnvelope[]; nextSyncToken?: string } | null> {
634
- const events: EventEnvelope[] = [];
635
- let nextSyncToken: string | undefined;
636
- let unreadPage: string | undefined;
637
- const seenTokens = new Set<string>();
638
- // The stored syncToken was rejected (410 expired, or 403 because it was
639
- // minted under a superseded grant) — abort and let the caller drop it and
640
- // fall through to a full sync. Signalled out of the generator via this flag.
641
- let syncTokenRejected = false;
642
-
643
- const pages = paginateByCursor<CalendarEvent, string>(
644
- async (pageToken) => {
645
- if (pageToken) {
646
- if (seenTokens.has(pageToken)) {
647
- throw new Error('Google Calendar returned a repeated page token.');
648
- }
649
- seenTokens.add(pageToken);
650
- }
651
- // Consume every incremental change before advancing the durable token,
652
- // so the page size is fixed rather than derived from `max_results`,
653
- // which limits only the historical bootstrap.
654
- const params = durableChanges
655
- ? new URLSearchParams({
656
- maxResults: '250',
657
- syncToken,
658
- singleEvents: 'true',
659
- showDeleted: 'true',
660
- })
661
- : new URLSearchParams({
662
- maxResults: '250',
663
- syncToken,
664
- });
665
- if (pageToken) {
666
- params.set('pageToken', pageToken);
667
- }
668
-
669
- const url = `${this.BASE_URL}/calendars/${encodeURIComponent(calendarId)}/events?${params.toString()}`;
670
- const response = await http.raw(url);
671
-
672
- if (!response.ok) {
673
- const body = await response.text();
674
- if (isSyncTokenRejection(response.status, body)) {
675
- syncTokenRejected = true;
676
- return { items: [], nextCursor: undefined };
677
- }
678
- throw new Error(`Calendar events.list error (${response.status}): ${body}`);
679
- }
680
-
681
- const data = (await response.json()) as CalendarEventListResponse;
682
- // Capture the trailing nextSyncToken; generator pages until exhausted.
683
- nextSyncToken = data.nextSyncToken;
684
- unreadPage = data.nextPageToken;
685
- return { items: data.items ?? [], nextCursor: data.nextPageToken };
686
- },
687
- { maxPages: MAX_SYNC_PAGES }
688
- );
689
-
690
- for await (const items of pages) {
691
- for (const calEvent of items) {
692
- const envelope = durableChanges
693
- ? this.calendarEventToChangeEnvelope(calEvent)
694
- : this.calendarEventToEnvelope(calEvent);
695
- if (envelope) events.push(envelope);
696
- }
697
- }
698
-
699
- if (syncTokenRejected) return null;
700
- // The generator stopped at MAX_SYNC_PAGES with a page still unread. Unlike
701
- // the bootstrap there is nothing to park — an incremental cursor advances
702
- // only on the last page — so fail the run and keep the stored token, rather
703
- // than returning a silently partial batch.
704
- if (unreadPage) {
705
- throw new Error(
706
- 'Google Calendar incremental traversal exceeded its page bound before completing.'
707
- );
708
- }
709
- if (durableChanges && !nextSyncToken) {
710
- throw new Error(
711
- 'Google Calendar incremental changes traversal completed without a durable sync token.'
712
- );
713
- }
714
-
715
- return { events, nextSyncToken };
716
- }
717
-
718
626
  // -------------------------------------------------------------------------
719
627
  // Actions
720
628
  // -------------------------------------------------------------------------
@@ -985,29 +893,15 @@ export default class GoogleCalendarConnector extends ConnectorRuntime<Record<str
985
893
  };
986
894
  }
987
895
 
988
- private buildResult(
989
- events: EventEnvelope[],
990
- syncToken: string | undefined
991
- ): SyncResult {
992
- // Sort events by occurred_at descending
993
- events.sort((a, b) => b.occurred_at.getTime() - a.occurred_at.getTime());
994
-
896
+ private completedCheckpoint(syncToken: string | undefined): CalendarCheckpoint {
995
897
  // Built fresh rather than spread over the previous checkpoint: the whole
996
898
  // object replaces the stored one, so a run that recovered from a rejected
997
899
  // token cannot leave that token behind. When the sync produced no new token
998
900
  // the key is absent, and the next run correctly starts from a full sync.
999
- const newCheckpoint: CalendarCheckpoint = {
901
+ return {
1000
902
  ...(syncToken ? { sync_token: syncToken } : {}),
1001
903
  last_sync_at: new Date().toISOString(),
1002
904
  };
1003
-
1004
- return {
1005
- events,
1006
- checkpoint: newCheckpoint as Record<string, unknown>,
1007
- metadata: {
1008
- items_found: events.length,
1009
- },
1010
- };
1011
905
  }
1012
906
 
1013
907
  // Auth-aware client (Bearer + retry/backoff on transient 429/5xx). Built per
@@ -286,6 +286,27 @@ function buildListQuery(config: DriveConfig): string {
286
286
  // Connector
287
287
  // ---------------------------------------------------------------------------
288
288
 
289
+ type DriveCommit = (events: EventEnvelope[], checkpoint: DriveCheckpoint) => Promise<void>;
290
+
291
+ /**
292
+ * Checkpoint for a bootstrap with list pages still unread.
293
+ *
294
+ * `page_token` is deliberately absent: while it is missing the feed cannot go
295
+ * incremental, which is exactly the property that keeps the unread files
296
+ * reachable.
297
+ */
298
+ function bootstrapCheckpoint(
299
+ pendingPageToken: string,
300
+ listPageToken: string,
301
+ startedAt: string
302
+ ): DriveCheckpoint {
303
+ return {
304
+ pending_page_token: pendingPageToken,
305
+ list_page_token: listPageToken,
306
+ last_sync_at: startedAt,
307
+ };
308
+ }
309
+
289
310
  export default class GoogleDriveConnector extends ConnectorRuntime<
290
311
  Record<string, unknown>,
291
312
  DriveConfig
@@ -493,8 +514,11 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
493
514
 
494
515
  // An unfinished bootstrap outranks everything: going incremental with pages
495
516
  // still unread would strand every file the traversal never reached.
517
+ const commit = (events: EventEnvelope[], next: DriveCheckpoint) =>
518
+ ctx.commit(events, next as Record<string, unknown>);
519
+
496
520
  if (checkpoint.list_page_token && checkpoint.pending_page_token) {
497
- return this.fullSync(http, config, {
521
+ return this.fullSync(http, config, commit, {
498
522
  startToken: checkpoint.pending_page_token,
499
523
  listPageToken: checkpoint.list_page_token,
500
524
  startedAt: checkpoint.last_sync_at,
@@ -506,25 +530,15 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
506
530
  http,
507
531
  checkpoint.page_token,
508
532
  config,
533
+ commit,
509
534
  checkpoint.last_sync_at
510
535
  );
511
- if (result) {
512
- // A partial run must NOT advance `last_sync_at`. The view-churn guard
513
- // skips content for files modified before that stamp, so stamping now
514
- // would make the next run treat the unread backlog as already-stored
515
- // and drop its content on the floor.
516
- return this.buildResult(
517
- result.events,
518
- result.nextPageToken,
519
- result.partial ? checkpoint.last_sync_at : undefined,
520
- { changesPending: result.partial }
521
- );
522
- }
536
+ if (result) return result;
523
537
  // Token rejected (see isPageTokenRejection). Fall through to ONE full
524
538
  // re-list, exactly as the Calendar connector does — never a retry loop.
525
539
  }
526
540
 
527
- return this.fullSync(http, config);
541
+ return this.fullSync(http, config, commit);
528
542
  }
529
543
 
530
544
  /**
@@ -539,6 +553,7 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
539
553
  private async fullSync(
540
554
  http: HttpClient,
541
555
  config: DriveConfig,
556
+ commit: DriveCommit,
542
557
  resume?: { startToken: string; listPageToken: string; startedAt?: string }
543
558
  ): Promise<SyncResult> {
544
559
  // A resumed bootstrap keeps the token minted when the traversal STARTED —
@@ -555,7 +570,7 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
555
570
  const maxResults = Math.min(config.max_results ?? 500, 2000);
556
571
  const includeContent = config.include_content !== false;
557
572
  const q = buildListQuery(config);
558
- const events: EventEnvelope[] = [];
573
+ let collected = 0;
559
574
 
560
575
  // 1000 is Drive's max pageSize, so 200 pages is 200k files — far past any
561
576
  // configurable max_results. Defensive bound against a self-referential
@@ -605,43 +620,53 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
605
620
  { maxPages: MAX_PAGES, initialCursor: resume?.listPageToken ?? null }
606
621
  );
607
622
 
623
+ // A Drive `q` has no equivalent on `changes.list` and cannot be re-evaluated
624
+ // client-side against a change record, so the only way to keep honouring it
625
+ // is to keep listing. Withholding the token re-lists next run; promoting it
626
+ // would silently widen the feed to every changed file in the Drive.
627
+ const hasCustomQuery = typeof config.query === 'string' && config.query.trim() !== '';
628
+
608
629
  const deadline = this.now() + SYNC_TIME_BUDGET_MS;
609
630
  for await (const items of pages) {
631
+ const events: EventEnvelope[] = [];
610
632
  for (const file of items) {
611
633
  events.push(await this.driveFileToEnvelope(http, file, includeContent, 'upserted'));
612
634
  }
613
- // Tested only BETWEEN pages: a page is consumed whole or not at all, so
614
- // `nextListPageToken` always addresses the first file we have not read.
615
- // Stopping on the clock parks a checkpoint; being killed on it does not.
616
- if (events.length >= maxResults || this.now() >= deadline) break;
617
- }
618
-
619
- // Unread pages mean the bootstrap is unfinished, and WHY it stopped is
620
- // irrelevant: the item cap, the clock, and the paginator's own MAX_PAGES
621
- // ceiling all leave files the change feed will never replay. Only Drive
622
- // withholding a nextPageToken proves the traversal exhausted, so that —
623
- // not the reason for stopping — is what may promote the change token.
624
- if (nextListPageToken) {
625
- return this.buildBootstrapResult(
626
- events,
627
- startToken,
628
- nextListPageToken,
629
- bootstrapStartedAt,
630
- searchIncomplete
631
- );
635
+ collected += events.length;
636
+ // Only Drive withholding a nextPageToken proves the traversal exhausted,
637
+ // so that — not the reason a run stops — is what may promote the change
638
+ // token. Until then each page commits with the bootstrap parked on the
639
+ // next unread page: a page is consumed whole or not at all, so the list
640
+ // token always addresses the first file not yet stored.
641
+ if (!nextListPageToken) {
642
+ await commit(events, {
643
+ ...(hasCustomQuery ? {} : { page_token: startToken }),
644
+ last_sync_at: bootstrapStartedAt,
645
+ });
646
+ return {
647
+ status: 'complete',
648
+ metadata: {
649
+ items_found: collected,
650
+ bootstrap_complete: true,
651
+ ...(searchIncomplete ? { search_incomplete: true } : {}),
652
+ },
653
+ };
654
+ }
655
+ await commit(events, bootstrapCheckpoint(startToken, nextListPageToken, bootstrapStartedAt));
656
+ if (collected >= maxResults || this.now() >= deadline) break;
632
657
  }
633
658
 
634
- // A Drive `q` has no equivalent on `changes.list` and cannot be re-evaluated
635
- // client-side against a change record, so the only way to keep honouring it
636
- // is to keep listing. Withholding the token re-lists next run; promoting it
637
- // would silently widen the feed to every changed file in the Drive.
638
- const hasCustomQuery = typeof config.query === 'string' && config.query.trim() !== '';
639
- return this.buildResult(
640
- events,
641
- hasCustomQuery ? undefined : startToken,
642
- bootstrapStartedAt,
643
- { searchIncomplete }
644
- );
659
+ // Unread pages remain, and WHY this run stopped is irrelevant: the item
660
+ // cap, the clock, and the paginator's own MAX_PAGES ceiling all leave files
661
+ // the change feed will never replay. The bootstrap resumes next run.
662
+ return {
663
+ status: 'more',
664
+ metadata: {
665
+ items_found: collected,
666
+ bootstrap_complete: false,
667
+ ...(searchIncomplete ? { search_incomplete: true } : {}),
668
+ },
669
+ };
645
670
  }
646
671
 
647
672
  /**
@@ -654,12 +679,9 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
654
679
  http: HttpClient,
655
680
  pageToken: string,
656
681
  config: DriveConfig,
682
+ commit: DriveCommit,
657
683
  lastSyncAt?: string
658
- ): Promise<{
659
- events: EventEnvelope[];
660
- nextPageToken?: string;
661
- partial: boolean;
662
- } | null> {
684
+ ): Promise<SyncResult | null> {
663
685
  const includeContent = config.include_content !== false;
664
686
  const includeTrashed = Boolean(config.include_trashed);
665
687
  const folderId =
@@ -667,7 +689,7 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
667
689
  ? config.folder_id.trim()
668
690
  : undefined;
669
691
  const maxResults = Math.min(config.max_results ?? 500, 2000);
670
- const events: EventEnvelope[] = [];
692
+ let collected = 0;
671
693
  let nextPageToken: string | undefined;
672
694
  // The cursor for the page AFTER the one just consumed. A run that stops
673
695
  // early persists this instead of dropping back to a full re-list — a
@@ -718,8 +740,9 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
718
740
  // start of the next page, so stopping part-way through one would skip the
719
741
  // changes still in it.
720
742
  const deadline = this.now() + SYNC_TIME_BUDGET_MS;
721
- let stoppedEarly = false;
722
743
  for await (const items of pages) {
744
+ if (rejected) return null;
745
+ const events: EventEnvelope[] = [];
723
746
  for (const change of items) {
724
747
  const envelope = await this.changeToEnvelope(
725
748
  http,
@@ -731,25 +754,41 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
731
754
  );
732
755
  if (envelope) events.push(envelope);
733
756
  }
734
- if (rejected) break;
735
- if ((events.length >= maxResults || this.now() >= deadline) && resumeCursor) {
736
- stoppedEarly = true;
737
- break;
757
+ collected += events.length;
758
+ if (!resumeCursor) {
759
+ // The stream is caught up: the page that carried `newStartPageToken`
760
+ // commits it and stamps the run. Rebuilt rather than spread over the
761
+ // previous checkpoint so a run that recovered from a rejected token
762
+ // cannot leave that token behind; without a new token the key is
763
+ // absent and the next run correctly re-lists.
764
+ await commit(events, {
765
+ ...(nextPageToken ? { page_token: nextPageToken } : {}),
766
+ last_sync_at: new Date().toISOString(),
767
+ });
768
+ return {
769
+ status: 'complete',
770
+ metadata: { items_found: collected, bootstrap_complete: true },
771
+ };
738
772
  }
773
+ // Mid-stream: commit with the cursor of the next page, a resumable
774
+ // position in the change stream. `last_sync_at` does NOT advance — the
775
+ // view-churn guard skips content for files modified before that stamp,
776
+ // so stamping now would make the next run treat the unread backlog as
777
+ // already stored and drop its content on the floor.
778
+ await commit(events, {
779
+ page_token: resumeCursor,
780
+ ...(lastSyncAt ? { last_sync_at: lastSyncAt } : {}),
781
+ });
782
+ if (collected >= maxResults || this.now() >= deadline) break;
739
783
  }
740
-
741
784
  if (rejected) return null;
742
785
 
743
- // Either we stopped on the cap, or the paginator ran out of pages with the
744
- // stream still open (MAX_PAGES). Both leave changes unread, and both must
745
- // hand back the cursor: discarding it would silently demote the next run to
746
- // a full re-list and restart the whole bootstrap.
747
- const unread = stoppedEarly || (!nextPageToken && Boolean(resumeCursor));
748
- if (unread && resumeCursor) {
749
- return { events, nextPageToken: resumeCursor, partial: true };
750
- }
751
-
752
- return { events, nextPageToken, partial: false };
786
+ // Stopped on the cap or the clock, or the paginator ran out of pages
787
+ // (MAX_PAGES) with the stream still open. The committed cursor resumes it.
788
+ return {
789
+ status: 'more',
790
+ metadata: { items_found: collected, bootstrap_complete: true, changes_pending: true },
791
+ };
753
792
  }
754
793
 
755
794
  private async fetchStartPageToken(http: HttpClient): Promise<string> {
@@ -1219,70 +1258,6 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
1219
1258
  };
1220
1259
  }
1221
1260
 
1222
- /**
1223
- * Checkpoint for a bootstrap that stopped on `max_results` with pages left.
1224
- *
1225
- * `page_token` is deliberately absent: while it is missing the feed cannot go
1226
- * incremental, which is exactly the property that keeps the unread files
1227
- * reachable. `bootstrap_complete: false` is surfaced in metadata so an
1228
- * operator can see the traversal is still catching up rather than guessing
1229
- * from a suspiciously round item count.
1230
- */
1231
- private buildBootstrapResult(
1232
- events: EventEnvelope[],
1233
- pendingPageToken: string,
1234
- listPageToken: string,
1235
- startedAt: string,
1236
- searchIncomplete = false
1237
- ): SyncResult {
1238
- events.sort((a, b) => b.occurred_at.getTime() - a.occurred_at.getTime());
1239
-
1240
- const checkpoint: DriveCheckpoint = {
1241
- pending_page_token: pendingPageToken,
1242
- list_page_token: listPageToken,
1243
- last_sync_at: startedAt,
1244
- };
1245
-
1246
- return {
1247
- events,
1248
- checkpoint: checkpoint as Record<string, unknown>,
1249
- metadata: {
1250
- items_found: events.length,
1251
- bootstrap_complete: false,
1252
- ...(searchIncomplete ? { search_incomplete: true } : {}),
1253
- },
1254
- };
1255
- }
1256
-
1257
- private buildResult(
1258
- events: EventEnvelope[],
1259
- pageToken: string | undefined,
1260
- /** Stamp to persist as-is; omit to advance `last_sync_at` to now. */
1261
- keepLastSyncAt: string | undefined,
1262
- flags: { changesPending?: boolean; searchIncomplete?: boolean } = {}
1263
- ): SyncResult {
1264
- events.sort((a, b) => b.occurred_at.getTime() - a.occurred_at.getTime());
1265
-
1266
- // Rebuilt rather than spread over the previous checkpoint so a run that
1267
- // recovered from a rejected token cannot leave that token behind. Without a
1268
- // new token the key is absent and the next run correctly re-lists.
1269
- const newCheckpoint: DriveCheckpoint = {
1270
- ...(pageToken ? { page_token: pageToken } : {}),
1271
- last_sync_at: keepLastSyncAt ?? new Date().toISOString(),
1272
- };
1273
-
1274
- return {
1275
- events,
1276
- checkpoint: newCheckpoint as Record<string, unknown>,
1277
- metadata: {
1278
- items_found: events.length,
1279
- bootstrap_complete: true,
1280
- ...(flags.changesPending ? { changes_pending: true } : {}),
1281
- ...(flags.searchIncomplete ? { search_incomplete: true } : {}),
1282
- },
1283
- };
1284
- }
1285
-
1286
1261
  /** Overridable so a test can drive the time budget without sleeping. */
1287
1262
  protected now(): number {
1288
1263
  return Date.now();