ontrackd 0.0.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (684) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +133 -2
  3. package/dist/cli/build.d.ts +1 -0
  4. package/dist/cli/build.js +172 -0
  5. package/dist/cli/build.js.map +1 -0
  6. package/dist/cli/cloud.d.ts +20 -0
  7. package/dist/cli/cloud.js +395 -0
  8. package/dist/cli/cloud.js.map +1 -0
  9. package/dist/cli/feedback.d.ts +4 -0
  10. package/dist/cli/feedback.js +90 -0
  11. package/dist/cli/feedback.js.map +1 -0
  12. package/dist/cli/hugo.d.ts +1 -0
  13. package/dist/cli/hugo.js +396 -0
  14. package/dist/cli/hugo.js.map +1 -0
  15. package/dist/cli/init.d.ts +8 -0
  16. package/dist/cli/init.js +346 -0
  17. package/dist/cli/init.js.map +1 -0
  18. package/dist/cli/invite.d.ts +2 -0
  19. package/dist/cli/invite.js +65 -0
  20. package/dist/cli/invite.js.map +1 -0
  21. package/dist/cli/link.d.ts +20 -0
  22. package/dist/cli/link.js +287 -0
  23. package/dist/cli/link.js.map +1 -0
  24. package/dist/cli/pull.d.ts +31 -0
  25. package/dist/cli/pull.js +273 -0
  26. package/dist/cli/pull.js.map +1 -0
  27. package/dist/cli/push.d.ts +9 -0
  28. package/dist/cli/push.js +57 -0
  29. package/dist/cli/push.js.map +1 -0
  30. package/dist/cli/remote.d.ts +1 -0
  31. package/dist/cli/remote.js +114 -0
  32. package/dist/cli/remote.js.map +1 -0
  33. package/dist/cli/serve.d.ts +1 -0
  34. package/dist/cli/serve.js +178 -0
  35. package/dist/cli/serve.js.map +1 -0
  36. package/dist/cli/sidecar.d.ts +9 -0
  37. package/dist/cli/sidecar.js +23 -0
  38. package/dist/cli/sidecar.js.map +1 -0
  39. package/dist/core/anchorId.d.ts +42 -0
  40. package/dist/core/anchorId.js +50 -0
  41. package/dist/core/anchorId.js.map +1 -0
  42. package/dist/core/apiKind.d.ts +42 -0
  43. package/dist/core/apiKind.js +83 -0
  44. package/dist/core/apiKind.js.map +1 -0
  45. package/dist/core/astroAnchors.d.ts +39 -0
  46. package/dist/core/astroAnchors.js +217 -0
  47. package/dist/core/astroAnchors.js.map +1 -0
  48. package/dist/core/attachmentTypes.d.ts +74 -0
  49. package/dist/core/attachmentTypes.js +199 -0
  50. package/dist/core/attachmentTypes.js.map +1 -0
  51. package/dist/core/elementHints.d.ts +40 -0
  52. package/dist/core/elementHints.js +116 -0
  53. package/dist/core/elementHints.js.map +1 -0
  54. package/dist/core/exportTaskDoc.d.ts +81 -0
  55. package/dist/core/exportTaskDoc.js +828 -0
  56. package/dist/core/exportTaskDoc.js.map +1 -0
  57. package/dist/core/feedbackTypes.d.ts +241 -0
  58. package/dist/core/feedbackTypes.js +2 -0
  59. package/dist/core/feedbackTypes.js.map +1 -0
  60. package/dist/core/fingerprint.d.ts +12 -0
  61. package/dist/core/fingerprint.js +24 -0
  62. package/dist/core/fingerprint.js.map +1 -0
  63. package/dist/core/htmlAnchors.d.ts +18 -0
  64. package/dist/core/htmlAnchors.js +157 -0
  65. package/dist/core/htmlAnchors.js.map +1 -0
  66. package/dist/core/imageSniff.d.ts +7 -0
  67. package/dist/core/imageSniff.js +12 -0
  68. package/dist/core/imageSniff.js.map +1 -0
  69. package/dist/core/ordering.d.ts +16 -0
  70. package/dist/core/ordering.js +10 -0
  71. package/dist/core/ordering.js.map +1 -0
  72. package/dist/core/oxcAst.d.ts +39 -0
  73. package/dist/core/oxcAst.js +147 -0
  74. package/dist/core/oxcAst.js.map +1 -0
  75. package/dist/core/pageUrl.d.ts +10 -0
  76. package/dist/core/pageUrl.js +27 -0
  77. package/dist/core/pageUrl.js.map +1 -0
  78. package/dist/core/participants.d.ts +14 -0
  79. package/dist/core/participants.js +38 -0
  80. package/dist/core/participants.js.map +1 -0
  81. package/dist/core/ports.d.ts +86 -0
  82. package/dist/core/ports.js +2 -0
  83. package/dist/core/ports.js.map +1 -0
  84. package/dist/core/projectSecret.d.ts +9 -0
  85. package/dist/core/projectSecret.js +57 -0
  86. package/dist/core/projectSecret.js.map +1 -0
  87. package/dist/core/recipe.d.ts +117 -0
  88. package/dist/core/recipe.js +181 -0
  89. package/dist/core/recipe.js.map +1 -0
  90. package/dist/core/recordingSummary.d.ts +12 -0
  91. package/dist/core/recordingSummary.js +150 -0
  92. package/dist/core/recordingSummary.js.map +1 -0
  93. package/dist/core/resolveAnchors.d.ts +70 -0
  94. package/dist/core/resolveAnchors.js +101 -0
  95. package/dist/core/resolveAnchors.js.map +1 -0
  96. package/dist/core/scriptImport.d.ts +10 -0
  97. package/dist/core/scriptImport.js +18 -0
  98. package/dist/core/scriptImport.js.map +1 -0
  99. package/dist/core/sourceAnchors.d.ts +62 -0
  100. package/dist/core/sourceAnchors.js +82 -0
  101. package/dist/core/sourceAnchors.js.map +1 -0
  102. package/dist/core/sourceContext.d.ts +62 -0
  103. package/dist/core/sourceContext.js +182 -0
  104. package/dist/core/sourceContext.js.map +1 -0
  105. package/dist/core/sourcePath.d.ts +2 -0
  106. package/dist/core/sourcePath.js +11 -0
  107. package/dist/core/sourcePath.js.map +1 -0
  108. package/dist/core/staleness.d.ts +118 -0
  109. package/dist/core/staleness.js +155 -0
  110. package/dist/core/staleness.js.map +1 -0
  111. package/dist/core/styleOrigin.d.ts +98 -0
  112. package/dist/core/styleOrigin.js +142 -0
  113. package/dist/core/styleOrigin.js.map +1 -0
  114. package/dist/core/svelteAnchors.d.ts +18 -0
  115. package/dist/core/svelteAnchors.js +125 -0
  116. package/dist/core/svelteAnchors.js.map +1 -0
  117. package/dist/core/taskFiles.d.ts +31 -0
  118. package/dist/core/taskFiles.js +55 -0
  119. package/dist/core/taskFiles.js.map +1 -0
  120. package/dist/core/untrusted.d.ts +57 -0
  121. package/dist/core/untrusted.js +268 -0
  122. package/dist/core/untrusted.js.map +1 -0
  123. package/dist/core/vueAnchors.d.ts +21 -0
  124. package/dist/core/vueAnchors.js +130 -0
  125. package/dist/core/vueAnchors.js.map +1 -0
  126. package/dist/expo/app/Avatar.d.ts +6 -0
  127. package/dist/expo/app/Avatar.js +12 -0
  128. package/dist/expo/app/Avatar.js.map +1 -0
  129. package/dist/expo/app/Bars.d.ts +9 -0
  130. package/dist/expo/app/Bars.js +38 -0
  131. package/dist/expo/app/Bars.js.map +1 -0
  132. package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
  133. package/dist/expo/app/CommentThreadSheet.js +200 -0
  134. package/dist/expo/app/CommentThreadSheet.js.map +1 -0
  135. package/dist/expo/app/CommentsSheet.d.ts +22 -0
  136. package/dist/expo/app/CommentsSheet.js +76 -0
  137. package/dist/expo/app/CommentsSheet.js.map +1 -0
  138. package/dist/expo/app/Files.d.ts +16 -0
  139. package/dist/expo/app/Files.js +62 -0
  140. package/dist/expo/app/Files.js.map +1 -0
  141. package/dist/expo/app/Highlight.d.ts +5 -0
  142. package/dist/expo/app/Highlight.js +12 -0
  143. package/dist/expo/app/Highlight.js.map +1 -0
  144. package/dist/expo/app/Icon.d.ts +9 -0
  145. package/dist/expo/app/Icon.js +22 -0
  146. package/dist/expo/app/Icon.js.map +1 -0
  147. package/dist/expo/app/MarkerPins.d.ts +10 -0
  148. package/dist/expo/app/MarkerPins.js +70 -0
  149. package/dist/expo/app/MarkerPins.js.map +1 -0
  150. package/dist/expo/app/Provider.d.ts +13 -0
  151. package/dist/expo/app/Provider.js +597 -0
  152. package/dist/expo/app/Provider.js.map +1 -0
  153. package/dist/expo/app/Sheet.d.ts +53 -0
  154. package/dist/expo/app/Sheet.js +106 -0
  155. package/dist/expo/app/Sheet.js.map +1 -0
  156. package/dist/expo/app/Toolbar.d.ts +26 -0
  157. package/dist/expo/app/Toolbar.js +71 -0
  158. package/dist/expo/app/Toolbar.js.map +1 -0
  159. package/dist/expo/app/adapter.d.ts +55 -0
  160. package/dist/expo/app/adapter.js +145 -0
  161. package/dist/expo/app/adapter.js.map +1 -0
  162. package/dist/expo/app/api.d.ts +68 -0
  163. package/dist/expo/app/api.js +86 -0
  164. package/dist/expo/app/api.js.map +1 -0
  165. package/dist/expo/app/assets/attach.png +0 -0
  166. package/dist/expo/app/assets/close.png +0 -0
  167. package/dist/expo/app/assets/comment.png +0 -0
  168. package/dist/expo/app/assets/edit.png +0 -0
  169. package/dist/expo/app/assets/file.png +0 -0
  170. package/dist/expo/app/assets/narrow.png +0 -0
  171. package/dist/expo/app/assets/panel.png +0 -0
  172. package/dist/expo/app/assets/pins.png +0 -0
  173. package/dist/expo/app/assets/pinsOff.png +0 -0
  174. package/dist/expo/app/assets/remove.png +0 -0
  175. package/dist/expo/app/assets/reopen.png +0 -0
  176. package/dist/expo/app/assets/resolve.png +0 -0
  177. package/dist/expo/app/assets/send.png +0 -0
  178. package/dist/expo/app/assets/widen.png +0 -0
  179. package/dist/expo/app/attachments.d.ts +93 -0
  180. package/dist/expo/app/attachments.js +181 -0
  181. package/dist/expo/app/attachments.js.map +1 -0
  182. package/dist/expo/app/cloudApi.d.ts +63 -0
  183. package/dist/expo/app/cloudApi.js +330 -0
  184. package/dist/expo/app/cloudApi.js.map +1 -0
  185. package/dist/expo/app/cloudAuth.d.ts +20 -0
  186. package/dist/expo/app/cloudAuth.js +71 -0
  187. package/dist/expo/app/cloudAuth.js.map +1 -0
  188. package/dist/expo/app/cloudHttp.d.ts +20 -0
  189. package/dist/expo/app/cloudHttp.js +46 -0
  190. package/dist/expo/app/cloudHttp.js.map +1 -0
  191. package/dist/expo/app/cloudSession.d.ts +30 -0
  192. package/dist/expo/app/cloudSession.js +72 -0
  193. package/dist/expo/app/cloudSession.js.map +1 -0
  194. package/dist/expo/app/comments.d.ts +20 -0
  195. package/dist/expo/app/comments.js +131 -0
  196. package/dist/expo/app/comments.js.map +1 -0
  197. package/dist/expo/app/devMenuNone.d.ts +5 -0
  198. package/dist/expo/app/devMenuNone.js +3 -0
  199. package/dist/expo/app/devMenuNone.js.map +1 -0
  200. package/dist/expo/app/devServerNone.d.ts +4 -0
  201. package/dist/expo/app/devServerNone.js +4 -0
  202. package/dist/expo/app/devServerNone.js.map +1 -0
  203. package/dist/expo/app/embeddedConfig.d.ts +1 -0
  204. package/dist/expo/app/embeddedConfig.js +12 -0
  205. package/dist/expo/app/embeddedConfig.js.map +1 -0
  206. package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
  207. package/dist/expo/app/embeddedConfigCloud.js +8 -0
  208. package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
  209. package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
  210. package/dist/expo/app/embeddedConfigNone.js +3 -0
  211. package/dist/expo/app/embeddedConfigNone.js.map +1 -0
  212. package/dist/expo/app/expo.d.ts +4 -0
  213. package/dist/expo/app/expo.js +35 -0
  214. package/dist/expo/app/expo.js.map +1 -0
  215. package/dist/expo/app/expoGo.d.ts +4 -0
  216. package/dist/expo/app/expoGo.js +33 -0
  217. package/dist/expo/app/expoGo.js.map +1 -0
  218. package/dist/expo/app/expoPickers.d.ts +11 -0
  219. package/dist/expo/app/expoPickers.js +91 -0
  220. package/dist/expo/app/expoPickers.js.map +1 -0
  221. package/dist/expo/app/expoRandom.d.ts +6 -0
  222. package/dist/expo/app/expoRandom.js +21 -0
  223. package/dist/expo/app/expoRandom.js.map +1 -0
  224. package/dist/expo/app/idle.d.ts +4 -0
  225. package/dist/expo/app/idle.js +7 -0
  226. package/dist/expo/app/idle.js.map +1 -0
  227. package/dist/expo/app/index.d.ts +3 -0
  228. package/dist/expo/app/index.js +3 -0
  229. package/dist/expo/app/index.js.map +1 -0
  230. package/dist/expo/app/interactions.d.ts +38 -0
  231. package/dist/expo/app/interactions.js +40 -0
  232. package/dist/expo/app/interactions.js.map +1 -0
  233. package/dist/expo/app/markers.d.ts +28 -0
  234. package/dist/expo/app/markers.js +187 -0
  235. package/dist/expo/app/markers.js.map +1 -0
  236. package/dist/expo/app/movedAnchors.d.ts +46 -0
  237. package/dist/expo/app/movedAnchors.js +39 -0
  238. package/dist/expo/app/movedAnchors.js.map +1 -0
  239. package/dist/expo/app/native.d.ts +12 -0
  240. package/dist/expo/app/native.js +78 -0
  241. package/dist/expo/app/native.js.map +1 -0
  242. package/dist/expo/app/panel.d.ts +27 -0
  243. package/dist/expo/app/panel.js +37 -0
  244. package/dist/expo/app/panel.js.map +1 -0
  245. package/dist/expo/app/payload.d.ts +43 -0
  246. package/dist/expo/app/payload.js +22 -0
  247. package/dist/expo/app/payload.js.map +1 -0
  248. package/dist/expo/app/pick.d.ts +14 -0
  249. package/dist/expo/app/pick.js +124 -0
  250. package/dist/expo/app/pick.js.map +1 -0
  251. package/dist/expo/app/pickerNone.d.ts +1 -0
  252. package/dist/expo/app/pickerNone.js +2 -0
  253. package/dist/expo/app/pickerNone.js.map +1 -0
  254. package/dist/expo/app/placement.d.ts +53 -0
  255. package/dist/expo/app/placement.js +100 -0
  256. package/dist/expo/app/placement.js.map +1 -0
  257. package/dist/expo/app/random.d.ts +13 -0
  258. package/dist/expo/app/random.js +56 -0
  259. package/dist/expo/app/random.js.map +1 -0
  260. package/dist/expo/app/reactNative.d.ts +2 -0
  261. package/dist/expo/app/reactNative.js +3 -0
  262. package/dist/expo/app/reactNative.js.map +1 -0
  263. package/dist/expo/app/runtimeConfig.d.ts +30 -0
  264. package/dist/expo/app/runtimeConfig.js +104 -0
  265. package/dist/expo/app/runtimeConfig.js.map +1 -0
  266. package/dist/expo/app/sheetMotion.d.ts +22 -0
  267. package/dist/expo/app/sheetMotion.js +39 -0
  268. package/dist/expo/app/sheetMotion.js.map +1 -0
  269. package/dist/expo/app/signIn.d.ts +32 -0
  270. package/dist/expo/app/signIn.js +28 -0
  271. package/dist/expo/app/signIn.js.map +1 -0
  272. package/dist/expo/app/state.d.ts +45 -0
  273. package/dist/expo/app/state.js +32 -0
  274. package/dist/expo/app/state.js.map +1 -0
  275. package/dist/expo/app/theme.d.ts +15 -0
  276. package/dist/expo/app/theme.js +9 -0
  277. package/dist/expo/app/theme.js.map +1 -0
  278. package/dist/expo/app/types.d.ts +87 -0
  279. package/dist/expo/app/types.js +2 -0
  280. package/dist/expo/app/types.js.map +1 -0
  281. package/dist/expo/app/useCloudReviewer.d.ts +75 -0
  282. package/dist/expo/app/useCloudReviewer.js +211 -0
  283. package/dist/expo/app/useCloudReviewer.js.map +1 -0
  284. package/dist/expo/app/useComments.d.ts +64 -0
  285. package/dist/expo/app/useComments.js +156 -0
  286. package/dist/expo/app/useComments.js.map +1 -0
  287. package/dist/expo/app/useUploads.d.ts +32 -0
  288. package/dist/expo/app/useUploads.js +106 -0
  289. package/dist/expo/app/useUploads.js.map +1 -0
  290. package/dist/expo/expoGoMetro.cjs +83 -0
  291. package/dist/expo/expoMetro.cjs +86 -0
  292. package/dist/expo/metro.cjs +304 -0
  293. package/dist/expo/metroBuild.d.ts +22 -0
  294. package/dist/expo/metroBuild.js +169 -0
  295. package/dist/expo/metroBuild.js.map +1 -0
  296. package/dist/expo/middleware.d.ts +11 -0
  297. package/dist/expo/middleware.js +26 -0
  298. package/dist/expo/middleware.js.map +1 -0
  299. package/dist/expo/mode.d.ts +20 -0
  300. package/dist/expo/mode.js +37 -0
  301. package/dist/expo/mode.js.map +1 -0
  302. package/dist/expo/publicConfig.d.ts +37 -0
  303. package/dist/expo/publicConfig.js +87 -0
  304. package/dist/expo/publicConfig.js.map +1 -0
  305. package/dist/expo/transform.d.ts +22 -0
  306. package/dist/expo/transform.js +38 -0
  307. package/dist/expo/transform.js.map +1 -0
  308. package/dist/expo/transformer.cjs +73 -0
  309. package/dist/index.d.ts +21 -0
  310. package/dist/index.js +17 -0
  311. package/dist/index.js.map +1 -0
  312. package/dist/integration/apiRoutes.d.ts +2 -0
  313. package/dist/integration/apiRoutes.js +3 -0
  314. package/dist/integration/apiRoutes.js.map +1 -0
  315. package/dist/integration/buildCredentials.d.ts +12 -0
  316. package/dist/integration/buildCredentials.js +97 -0
  317. package/dist/integration/buildCredentials.js.map +1 -0
  318. package/dist/integration/buildSession.d.ts +8 -0
  319. package/dist/integration/buildSession.js +96 -0
  320. package/dist/integration/buildSession.js.map +1 -0
  321. package/dist/integration/bundleCheck.d.ts +43 -0
  322. package/dist/integration/bundleCheck.js +111 -0
  323. package/dist/integration/bundleCheck.js.map +1 -0
  324. package/dist/integration/commentPull.d.ts +134 -0
  325. package/dist/integration/commentPull.js +260 -0
  326. package/dist/integration/commentPull.js.map +1 -0
  327. package/dist/integration/configuredApi.d.ts +7 -0
  328. package/dist/integration/configuredApi.js +24 -0
  329. package/dist/integration/configuredApi.js.map +1 -0
  330. package/dist/integration/devCloud.d.ts +27 -0
  331. package/dist/integration/devCloud.js +56 -0
  332. package/dist/integration/devCloud.js.map +1 -0
  333. package/dist/integration/devReviewLinks.d.ts +2 -0
  334. package/dist/integration/devReviewLinks.js +10 -0
  335. package/dist/integration/devReviewLinks.js.map +1 -0
  336. package/dist/integration/gitBranch.d.ts +19 -0
  337. package/dist/integration/gitBranch.js +56 -0
  338. package/dist/integration/gitBranch.js.map +1 -0
  339. package/dist/integration/importPlan.d.ts +19 -0
  340. package/dist/integration/importPlan.js +90 -0
  341. package/dist/integration/importPlan.js.map +1 -0
  342. package/dist/integration/index.d.ts +14 -0
  343. package/dist/integration/index.js +13 -0
  344. package/dist/integration/index.js.map +1 -0
  345. package/dist/integration/manifest.d.ts +120 -0
  346. package/dist/integration/manifest.js +147 -0
  347. package/dist/integration/manifest.js.map +1 -0
  348. package/dist/integration/manifestParts.d.ts +29 -0
  349. package/dist/integration/manifestParts.js +65 -0
  350. package/dist/integration/manifestParts.js.map +1 -0
  351. package/dist/integration/manifestSink.d.ts +75 -0
  352. package/dist/integration/manifestSink.js +157 -0
  353. package/dist/integration/manifestSink.js.map +1 -0
  354. package/dist/integration/manifestUpload.d.ts +64 -0
  355. package/dist/integration/manifestUpload.js +177 -0
  356. package/dist/integration/manifestUpload.js.map +1 -0
  357. package/dist/integration/middleware.d.ts +55 -0
  358. package/dist/integration/middleware.js +379 -0
  359. package/dist/integration/middleware.js.map +1 -0
  360. package/dist/integration/nextStyles.d.ts +4 -0
  361. package/dist/integration/nextStyles.js +121 -0
  362. package/dist/integration/nextStyles.js.map +1 -0
  363. package/dist/integration/requestGuards.d.ts +71 -0
  364. package/dist/integration/requestGuards.js +255 -0
  365. package/dist/integration/requestGuards.js.map +1 -0
  366. package/dist/integration/sharedBuild.d.ts +71 -0
  367. package/dist/integration/sharedBuild.js +105 -0
  368. package/dist/integration/sharedBuild.js.map +1 -0
  369. package/dist/integration/sharedInject.d.ts +88 -0
  370. package/dist/integration/sharedInject.js +164 -0
  371. package/dist/integration/sharedInject.js.map +1 -0
  372. package/dist/integration/sidecarProcess.d.ts +26 -0
  373. package/dist/integration/sidecarProcess.js +137 -0
  374. package/dist/integration/sidecarProcess.js.map +1 -0
  375. package/dist/integration/styleCollector.d.ts +49 -0
  376. package/dist/integration/styleCollector.js +220 -0
  377. package/dist/integration/styleCollector.js.map +1 -0
  378. package/dist/integration/transform.d.ts +24 -0
  379. package/dist/integration/transform.js +36 -0
  380. package/dist/integration/transform.js.map +1 -0
  381. package/dist/integration/tunnelClient.d.ts +44 -0
  382. package/dist/integration/tunnelClient.js +148 -0
  383. package/dist/integration/tunnelClient.js.map +1 -0
  384. package/dist/integration/tunnelProtocol.d.ts +152 -0
  385. package/dist/integration/tunnelProtocol.js +110 -0
  386. package/dist/integration/tunnelProtocol.js.map +1 -0
  387. package/dist/mcp/cli.d.ts +2 -0
  388. package/dist/mcp/cli.js +327 -0
  389. package/dist/mcp/cli.js.map +1 -0
  390. package/dist/mcp/cloudRefresh.d.ts +36 -0
  391. package/dist/mcp/cloudRefresh.js +52 -0
  392. package/dist/mcp/cloudRefresh.js.map +1 -0
  393. package/dist/mcp/context.d.ts +7 -0
  394. package/dist/mcp/context.js +18 -0
  395. package/dist/mcp/context.js.map +1 -0
  396. package/dist/mcp/files.d.ts +66 -0
  397. package/dist/mcp/files.js +157 -0
  398. package/dist/mcp/files.js.map +1 -0
  399. package/dist/mcp/search.d.ts +3 -0
  400. package/dist/mcp/search.js +9 -0
  401. package/dist/mcp/search.js.map +1 -0
  402. package/dist/mcp/server.d.ts +50 -0
  403. package/dist/mcp/server.js +555 -0
  404. package/dist/mcp/server.js.map +1 -0
  405. package/dist/overlay/anchors.d.ts +130 -0
  406. package/dist/overlay/anchors.js +365 -0
  407. package/dist/overlay/anchors.js.map +1 -0
  408. package/dist/overlay/api.d.ts +150 -0
  409. package/dist/overlay/api.js +259 -0
  410. package/dist/overlay/api.js.map +1 -0
  411. package/dist/overlay/attachments.d.ts +60 -0
  412. package/dist/overlay/attachments.js +163 -0
  413. package/dist/overlay/attachments.js.map +1 -0
  414. package/dist/overlay/browser.d.ts +1 -0
  415. package/dist/overlay/browser.js +203 -0
  416. package/dist/overlay/browser.js.map +1 -0
  417. package/dist/overlay/chip.d.ts +27 -0
  418. package/dist/overlay/chip.js +31 -0
  419. package/dist/overlay/chip.js.map +1 -0
  420. package/dist/overlay/compact.d.ts +11 -0
  421. package/dist/overlay/compact.js +21 -0
  422. package/dist/overlay/compact.js.map +1 -0
  423. package/dist/overlay/cssScope.d.ts +46 -0
  424. package/dist/overlay/cssScope.js +180 -0
  425. package/dist/overlay/cssScope.js.map +1 -0
  426. package/dist/overlay/cursor.d.ts +2 -0
  427. package/dist/overlay/cursor.js +68 -0
  428. package/dist/overlay/cursor.js.map +1 -0
  429. package/dist/overlay/devBrowser.d.ts +1 -0
  430. package/dist/overlay/devBrowser.js +18 -0
  431. package/dist/overlay/devBrowser.js.map +1 -0
  432. package/dist/overlay/devReview.d.ts +4 -0
  433. package/dist/overlay/devReview.js +18 -0
  434. package/dist/overlay/devReview.js.map +1 -0
  435. package/dist/overlay/directReviewer.d.ts +149 -0
  436. package/dist/overlay/directReviewer.js +448 -0
  437. package/dist/overlay/directReviewer.js.map +1 -0
  438. package/dist/overlay/elementDescription.d.ts +10 -0
  439. package/dist/overlay/elementDescription.js +251 -0
  440. package/dist/overlay/elementDescription.js.map +1 -0
  441. package/dist/overlay/icons.d.ts +8 -0
  442. package/dist/overlay/icons.js +36 -0
  443. package/dist/overlay/icons.js.map +1 -0
  444. package/dist/overlay/identity.d.ts +48 -0
  445. package/dist/overlay/identity.js +125 -0
  446. package/dist/overlay/identity.js.map +1 -0
  447. package/dist/overlay/localMachine.d.ts +23 -0
  448. package/dist/overlay/localMachine.js +40 -0
  449. package/dist/overlay/localMachine.js.map +1 -0
  450. package/dist/overlay/magicLink.d.ts +10 -0
  451. package/dist/overlay/magicLink.js +87 -0
  452. package/dist/overlay/magicLink.js.map +1 -0
  453. package/dist/overlay/modern-screenshot.js +1676 -0
  454. package/dist/overlay/movedAnchors.d.ts +30 -0
  455. package/dist/overlay/movedAnchors.js +128 -0
  456. package/dist/overlay/movedAnchors.js.map +1 -0
  457. package/dist/overlay/notificationGroups.d.ts +2 -0
  458. package/dist/overlay/notificationGroups.js +41 -0
  459. package/dist/overlay/notificationGroups.js.map +1 -0
  460. package/dist/overlay/permissions.d.ts +10 -0
  461. package/dist/overlay/permissions.js +9 -0
  462. package/dist/overlay/permissions.js.map +1 -0
  463. package/dist/overlay/pinGroups.d.ts +16 -0
  464. package/dist/overlay/pinGroups.js +17 -0
  465. package/dist/overlay/pinGroups.js.map +1 -0
  466. package/dist/overlay/presence.d.ts +50 -0
  467. package/dist/overlay/presence.js +258 -0
  468. package/dist/overlay/presence.js.map +1 -0
  469. package/dist/overlay/projectChannel.d.ts +11 -0
  470. package/dist/overlay/projectChannel.js +111 -0
  471. package/dist/overlay/projectChannel.js.map +1 -0
  472. package/dist/overlay/recorder.d.ts +56 -0
  473. package/dist/overlay/recorder.js +130 -0
  474. package/dist/overlay/recorder.js.map +1 -0
  475. package/dist/overlay/reviewMode.d.ts +21 -0
  476. package/dist/overlay/reviewMode.js +59 -0
  477. package/dist/overlay/reviewMode.js.map +1 -0
  478. package/dist/overlay/reviewerAuth.d.ts +131 -0
  479. package/dist/overlay/reviewerAuth.js +279 -0
  480. package/dist/overlay/reviewerAuth.js.map +1 -0
  481. package/dist/overlay/route.d.ts +18 -0
  482. package/dist/overlay/route.js +56 -0
  483. package/dist/overlay/route.js.map +1 -0
  484. package/dist/overlay/rrweb-record.js +63 -0
  485. package/dist/overlay/runtime.d.ts +1 -0
  486. package/dist/overlay/runtime.js +4857 -0
  487. package/dist/overlay/runtime.js.map +1 -0
  488. package/dist/overlay/session.d.ts +32 -0
  489. package/dist/overlay/session.js +76 -0
  490. package/dist/overlay/session.js.map +1 -0
  491. package/dist/overlay/sharedMode.d.ts +38 -0
  492. package/dist/overlay/sharedMode.js +37 -0
  493. package/dist/overlay/sharedMode.js.map +1 -0
  494. package/dist/overlay/sheet.d.ts +73 -0
  495. package/dist/overlay/sheet.js +278 -0
  496. package/dist/overlay/sheet.js.map +1 -0
  497. package/dist/overlay/snapshot.d.ts +26 -0
  498. package/dist/overlay/snapshot.js +185 -0
  499. package/dist/overlay/snapshot.js.map +1 -0
  500. package/dist/overlay/state.d.ts +63 -0
  501. package/dist/overlay/state.js +241 -0
  502. package/dist/overlay/state.js.map +1 -0
  503. package/dist/overlay/steps.d.ts +22 -0
  504. package/dist/overlay/steps.js +34 -0
  505. package/dist/overlay/steps.js.map +1 -0
  506. package/dist/overlay/styles.d.ts +7 -0
  507. package/dist/overlay/styles.js +1449 -0
  508. package/dist/overlay/styles.js.map +1 -0
  509. package/dist/overlay/trace.d.ts +19 -0
  510. package/dist/overlay/trace.js +29 -0
  511. package/dist/overlay/trace.js.map +1 -0
  512. package/dist/overlay/upload.d.ts +35 -0
  513. package/dist/overlay/upload.js +99 -0
  514. package/dist/overlay/upload.js.map +1 -0
  515. package/dist/plugin/astro.d.ts +31 -0
  516. package/dist/plugin/astro.js +22 -0
  517. package/dist/plugin/astro.js.map +1 -0
  518. package/dist/plugin/eleventy.d.ts +44 -0
  519. package/dist/plugin/eleventy.js +186 -0
  520. package/dist/plugin/eleventy.js.map +1 -0
  521. package/dist/plugin/next-loader.cjs +11 -0
  522. package/dist/plugin/next.d.ts +29 -0
  523. package/dist/plugin/next.js +176 -0
  524. package/dist/plugin/next.js.map +1 -0
  525. package/dist/plugin/nextOverlay.d.ts +2 -0
  526. package/dist/plugin/nextOverlay.js +22 -0
  527. package/dist/plugin/nextOverlay.js.map +1 -0
  528. package/dist/plugin/nextTransform.d.ts +19 -0
  529. package/dist/plugin/nextTransform.js +29 -0
  530. package/dist/plugin/nextTransform.js.map +1 -0
  531. package/dist/plugin/rsbuild.d.ts +25 -0
  532. package/dist/plugin/rsbuild.js +56 -0
  533. package/dist/plugin/rsbuild.js.map +1 -0
  534. package/dist/plugin/vite.d.ts +40 -0
  535. package/dist/plugin/vite.js +585 -0
  536. package/dist/plugin/vite.js.map +1 -0
  537. package/dist/plugin/webpack.d.ts +69 -0
  538. package/dist/plugin/webpack.js +192 -0
  539. package/dist/plugin/webpack.js.map +1 -0
  540. package/dist/remote/account.d.ts +41 -0
  541. package/dist/remote/account.js +177 -0
  542. package/dist/remote/account.js.map +1 -0
  543. package/dist/remote/base64url.d.ts +14 -0
  544. package/dist/remote/base64url.js +71 -0
  545. package/dist/remote/base64url.js.map +1 -0
  546. package/dist/remote/branchLabel.d.ts +12 -0
  547. package/dist/remote/branchLabel.js +20 -0
  548. package/dist/remote/branchLabel.js.map +1 -0
  549. package/dist/remote/client.d.ts +340 -0
  550. package/dist/remote/client.js +424 -0
  551. package/dist/remote/client.js.map +1 -0
  552. package/dist/remote/cloudApi.d.ts +72 -0
  553. package/dist/remote/cloudApi.js +72 -0
  554. package/dist/remote/cloudApi.js.map +1 -0
  555. package/dist/remote/codec.d.ts +54 -0
  556. package/dist/remote/codec.js +62 -0
  557. package/dist/remote/codec.js.map +1 -0
  558. package/dist/remote/config.d.ts +30 -0
  559. package/dist/remote/config.js +112 -0
  560. package/dist/remote/config.js.map +1 -0
  561. package/dist/remote/content-schema.d.ts +428 -0
  562. package/dist/remote/content-schema.js +209 -0
  563. package/dist/remote/content-schema.js.map +1 -0
  564. package/dist/remote/content.d.ts +44 -0
  565. package/dist/remote/content.js +75 -0
  566. package/dist/remote/content.js.map +1 -0
  567. package/dist/remote/envelope.d.ts +76 -0
  568. package/dist/remote/envelope.js +109 -0
  569. package/dist/remote/envelope.js.map +1 -0
  570. package/dist/remote/errors.d.ts +55 -0
  571. package/dist/remote/errors.js +63 -0
  572. package/dist/remote/errors.js.map +1 -0
  573. package/dist/remote/ids.d.ts +8 -0
  574. package/dist/remote/ids.js +25 -0
  575. package/dist/remote/ids.js.map +1 -0
  576. package/dist/remote/index.d.ts +7 -0
  577. package/dist/remote/index.js +8 -0
  578. package/dist/remote/index.js.map +1 -0
  579. package/dist/remote/keys.d.ts +62 -0
  580. package/dist/remote/keys.js +162 -0
  581. package/dist/remote/keys.js.map +1 -0
  582. package/dist/remote/localAnchors.d.ts +4 -0
  583. package/dist/remote/localAnchors.js +23 -0
  584. package/dist/remote/localAnchors.js.map +1 -0
  585. package/dist/remote/mapping.d.ts +11 -0
  586. package/dist/remote/mapping.js +22 -0
  587. package/dist/remote/mapping.js.map +1 -0
  588. package/dist/remote/presence.d.ts +63 -0
  589. package/dist/remote/presence.js +143 -0
  590. package/dist/remote/presence.js.map +1 -0
  591. package/dist/remote/realtime.d.ts +142 -0
  592. package/dist/remote/realtime.js +326 -0
  593. package/dist/remote/realtime.js.map +1 -0
  594. package/dist/remote/store.d.ts +183 -0
  595. package/dist/remote/store.js +907 -0
  596. package/dist/remote/store.js.map +1 -0
  597. package/dist/remote/sync.d.ts +113 -0
  598. package/dist/remote/sync.js +370 -0
  599. package/dist/remote/sync.js.map +1 -0
  600. package/dist/remote/types.d.ts +99 -0
  601. package/dist/remote/types.js +6 -0
  602. package/dist/remote/types.js.map +1 -0
  603. package/dist/setup/agents.d.ts +23 -0
  604. package/dist/setup/agents.js +80 -0
  605. package/dist/setup/agents.js.map +1 -0
  606. package/dist/setup/configure.d.ts +27 -0
  607. package/dist/setup/configure.js +201 -0
  608. package/dist/setup/configure.js.map +1 -0
  609. package/dist/setup/connect.d.ts +60 -0
  610. package/dist/setup/connect.js +244 -0
  611. package/dist/setup/connect.js.map +1 -0
  612. package/dist/setup/detect.d.ts +67 -0
  613. package/dist/setup/detect.js +168 -0
  614. package/dist/setup/detect.js.map +1 -0
  615. package/dist/setup/frameworks.d.ts +41 -0
  616. package/dist/setup/frameworks.js +81 -0
  617. package/dist/setup/frameworks.js.map +1 -0
  618. package/dist/sidecar/cli.d.ts +1 -0
  619. package/dist/sidecar/cli.js +70 -0
  620. package/dist/sidecar/cli.js.map +1 -0
  621. package/dist/sidecar/cloudSync.d.ts +33 -0
  622. package/dist/sidecar/cloudSync.js +139 -0
  623. package/dist/sidecar/cloudSync.js.map +1 -0
  624. package/dist/sidecar/commentFiles.d.ts +59 -0
  625. package/dist/sidecar/commentFiles.js +217 -0
  626. package/dist/sidecar/commentFiles.js.map +1 -0
  627. package/dist/sidecar/cssAttribution.d.ts +26 -0
  628. package/dist/sidecar/cssAttribution.js +114 -0
  629. package/dist/sidecar/cssAttribution.js.map +1 -0
  630. package/dist/sidecar/exportTasks.d.ts +38 -0
  631. package/dist/sidecar/exportTasks.js +249 -0
  632. package/dist/sidecar/exportTasks.js.map +1 -0
  633. package/dist/sidecar/http.d.ts +20 -0
  634. package/dist/sidecar/http.js +904 -0
  635. package/dist/sidecar/http.js.map +1 -0
  636. package/dist/sidecar/inviteTarget.d.ts +4 -0
  637. package/dist/sidecar/inviteTarget.js +32 -0
  638. package/dist/sidecar/inviteTarget.js.map +1 -0
  639. package/dist/sidecar/presence.d.ts +4 -0
  640. package/dist/sidecar/presence.js +92 -0
  641. package/dist/sidecar/presence.js.map +1 -0
  642. package/dist/storage/cliSession.d.ts +8 -0
  643. package/dist/storage/cliSession.js +41 -0
  644. package/dist/storage/cliSession.js.map +1 -0
  645. package/dist/storage/devStyleMap.d.ts +12 -0
  646. package/dist/storage/devStyleMap.js +31 -0
  647. package/dist/storage/devStyleMap.js.map +1 -0
  648. package/dist/storage/fileCache.d.ts +34 -0
  649. package/dist/storage/fileCache.js +122 -0
  650. package/dist/storage/fileCache.js.map +1 -0
  651. package/dist/storage/localAttachments.d.ts +82 -0
  652. package/dist/storage/localAttachments.js +276 -0
  653. package/dist/storage/localAttachments.js.map +1 -0
  654. package/dist/storage/localComments.d.ts +31 -0
  655. package/dist/storage/localComments.js +159 -0
  656. package/dist/storage/localComments.js.map +1 -0
  657. package/dist/storage/localCredentials.d.ts +74 -0
  658. package/dist/storage/localCredentials.js +210 -0
  659. package/dist/storage/localCredentials.js.map +1 -0
  660. package/dist/storage/localParticipants.d.ts +33 -0
  661. package/dist/storage/localParticipants.js +110 -0
  662. package/dist/storage/localParticipants.js.map +1 -0
  663. package/dist/storage/localRecipe.d.ts +22 -0
  664. package/dist/storage/localRecipe.js +46 -0
  665. package/dist/storage/localRecipe.js.map +1 -0
  666. package/dist/storage/localScreenshots.d.ts +23 -0
  667. package/dist/storage/localScreenshots.js +55 -0
  668. package/dist/storage/localScreenshots.js.map +1 -0
  669. package/dist/storage/localSource.d.ts +31 -0
  670. package/dist/storage/localSource.js +175 -0
  671. package/dist/storage/localSource.js.map +1 -0
  672. package/dist/storage/pulledComments.d.ts +81 -0
  673. package/dist/storage/pulledComments.js +107 -0
  674. package/dist/storage/pulledComments.js.map +1 -0
  675. package/dist/storage/remoteRecipe.d.ts +7 -0
  676. package/dist/storage/remoteRecipe.js +85 -0
  677. package/dist/storage/remoteRecipe.js.map +1 -0
  678. package/dist/storage/savedRemote.d.ts +2 -0
  679. package/dist/storage/savedRemote.js +22 -0
  680. package/dist/storage/savedRemote.js.map +1 -0
  681. package/dist/storage/sidecarAccess.d.ts +7 -0
  682. package/dist/storage/sidecarAccess.js +68 -0
  683. package/dist/storage/sidecarAccess.js.map +1 -0
  684. package/package.json +306 -4
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { devReviewerMode } from './devReview.js';
2
+ // Served only by an opted-in dev server with encrypted remote configuration.
3
+ const query = new URL(import.meta.url).searchParams;
4
+ const config = { projectId: query.get('p'), sessionId: query.get('s'), apiBase: query.get('a'), ...(query.get('cursors') === '1' ? { presence: true } : {}),
5
+ // The dev server says which Git branch is checked out when a reviewer comments.
6
+ branchUrl: new URL('../branch', import.meta.url).href };
7
+ let storage;
8
+ try {
9
+ storage = localStorage;
10
+ }
11
+ catch { /* An invitation still enters reviewer mode and reports the storage failure there. */ }
12
+ const reviewer = devReviewerMode(config, window, storage);
13
+ if (reviewer)
14
+ window.__feedback = reviewer;
15
+ if (config.presence)
16
+ window.__feedbackPresence = true;
17
+ await import('./browser.js');
18
+ //# sourceMappingURL=devBrowser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devBrowser.js","sourceRoot":"","sources":["../../src/overlay/devBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,6EAA6E;AAC7E,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC;AACpD,MAAM,MAAM,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5J,gFAAgF;IAChF,SAAS,EAAE,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1D,IAAI,OAA4B,CAAC;AACjC,IAAI,CAAC;IAAC,OAAO,GAAG,YAAY,CAAC;AAAC,CAAC;AAAC,MAAM,CAAC,CAAC,qFAAqF,CAAC,CAAC;AAC/H,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1D,IAAI,QAAQ;IAAG,MAAqD,CAAC,UAAU,GAAG,QAAQ,CAAC;AAC3F,IAAI,MAAM,CAAC,QAAQ;IAAG,MAAsD,CAAC,kBAAkB,GAAG,IAAI,CAAC;AACvG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ReviewerConfig } from './directReviewer.js';
2
+ import type { SharedConfig } from './sharedMode.js';
3
+ /** A link selects reviewer mode for this load; saved reviewer state resumes on reload. */
4
+ export declare function devReviewerMode(config: ReviewerConfig, browser: Pick<Window, 'location' | 'history'>, storage?: Storage): SharedConfig | null;
@@ -0,0 +1,18 @@
1
+ import { captureMagicLink, hasSavedReviewer } from './magicLink.js';
2
+ /** A link selects reviewer mode for this load; saved reviewer state resumes on reload. */
3
+ export function devReviewerMode(config, browser, storage) {
4
+ const invited = new URLSearchParams(browser.location.hash.slice(1)).has('fb');
5
+ if (invited)
6
+ captureMagicLink(browser);
7
+ let saved = false;
8
+ if (!invited && storage) {
9
+ try {
10
+ saved = hasSavedReviewer(config, storage);
11
+ }
12
+ catch { /* Blocked storage keeps ordinary developer mode usable. */ }
13
+ }
14
+ if (!invited && !saved)
15
+ return null;
16
+ return { ...config, buildId: '', devReviewLinks: true };
17
+ }
18
+ //# sourceMappingURL=devReview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devReview.js","sourceRoot":"","sources":["../../src/overlay/devReview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIpE,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,MAAsB,EAAE,OAA6C,EAAE,OAAiB;IACtH,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9E,IAAI,OAAO;QAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC;YAAC,KAAK,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,2DAA2D,CAAC,CAAC;IAC1H,CAAC;IACD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,149 @@
1
+ import type { Comment, Reply } from '../core/feedbackTypes.js';
2
+ import { SessionSync, SessionWatcher } from '../remote/index.js';
3
+ import { type ContentCodec } from '../remote/codec.js';
4
+ import { commentContent } from '../remote/mapping.js';
5
+ import type { RecordingLimit } from './recorder.js';
6
+ import { type Upload } from './upload.js';
7
+ import type { Translation } from './movedAnchors.js';
8
+ /** `branch`: the branch the preview was built from, when the build recorded one. */
9
+ export type ReviewerConfig = {
10
+ apiBase: string;
11
+ projectId: string;
12
+ sessionId: string;
13
+ buildId?: string;
14
+ presence?: boolean;
15
+ branch?: string;
16
+ /** Dev-server review links: the dev server's `/__feedback/branch`, asked when a comment is written. */
17
+ branchUrl?: string;
18
+ };
19
+ /** `contentKey` is null for a Cloud session: its link carries no key and content is plaintext. */
20
+ export type ReviewerRecord = {
21
+ credential: string;
22
+ contentKey: string | null;
23
+ keyVersion: number;
24
+ participantId: string;
25
+ displayName: string;
26
+ };
27
+ /** Uses the same HTTP, crypto and sync modules as the developer sidecar. */
28
+ export declare class DirectReviewer {
29
+ readonly config: ReviewerConfig;
30
+ readonly record: ReviewerRecord;
31
+ readonly codec: ContentCodec;
32
+ readonly api: import("../remote/client.js").ProjectApi<{
33
+ authorizationHeader(): string;
34
+ }>;
35
+ readonly sync: SessionSync;
36
+ readonly watcher: SessionWatcher;
37
+ private cache;
38
+ private closed;
39
+ /**
40
+ * May change every comment (owner or admin), not only their own. A Standalone participant may: the
41
+ * API limits changes to their author on Cloud only.
42
+ */
43
+ moderates: boolean;
44
+ private threads;
45
+ onChanged: () => void;
46
+ onRevoked: () => void;
47
+ /** The socket can never work for this client (protocol or version): the host reads on a slow timer instead. */
48
+ onDegraded: () => void;
49
+ /** A thread's session was revoked: its comments leave the view now, and reads that began earlier must not bring them back. */
50
+ onThreadRevoked: (_ids: string[]) => void;
51
+ private revokedIds;
52
+ private constructor();
53
+ /** An announced revision this reviewer already holds needs no read: the first frame of every connection, and own writes. */
54
+ private announced;
55
+ static open(config: ReviewerConfig, record: ReviewerRecord): Promise<DirectReviewer>;
56
+ /** A v0 Cloud account uses the same plaintext comments/sync path as a keyless reviewer. */
57
+ static openAccount(config: ReviewerConfig, session: import('./session.js').Session): Promise<DirectReviewer>;
58
+ get account(): boolean;
59
+ notifications(): Promise<any>;
60
+ /** A ticket for the project change channel, which tells an account when its notifications may have changed. Not guarded: a refusal only means no channel. */
61
+ projectChannelTicket(): Promise<{
62
+ url: string;
63
+ }>;
64
+ markNotificationsRead(ids: string[]): Promise<any>;
65
+ /**
66
+ * Where elements commented on other builds are on `build` (contract section 19.6): their ids
67
+ * here, null when their code is gone, absent when a build is unknown. Opaque ids only. An API
68
+ * without the route answers 404, which is an empty answer, never a reason to sign out.
69
+ */
70
+ translateAnchors(build: string, from: Array<{
71
+ buildId: string;
72
+ anchorId: string;
73
+ }>): Promise<Map<string, Translation> | null>;
74
+ private notificationPath;
75
+ /** A Cloud session: plaintext content, and the element screenshots that go with it. */
76
+ get cloud(): boolean;
77
+ start(): void;
78
+ /** The page goes into the browser's back/forward cache: its sockets stop (a cached page must hold none), the reviewer stays. */
79
+ suspend(): void;
80
+ /** The page came back from it: reconnect, and read what happened meanwhile. */
81
+ resume(): void;
82
+ /**
83
+ * The picture of the element, sent once the comment exists (Cloud only: Standalone content is
84
+ * end-to-end encrypted and there is no encrypted image endpoint). The API takes it only from the
85
+ * comment's author, once, shortly after posting; a refusal is quiet, as on the local path.
86
+ */
87
+ uploadScreenshot(commentId: string, snapshot: {
88
+ blob: Blob;
89
+ width: number;
90
+ height: number;
91
+ incomplete: string[];
92
+ }): Promise<void>;
93
+ private sessionUrl;
94
+ private fileHeaders;
95
+ /** A file for a message being written (Cloud only), sent as soon as it is added; the message claims it by id. */
96
+ uploadAttachment(file: File, onProgress: (fraction: number) => void): Promise<Upload>;
97
+ /**
98
+ * What the workspace's plan lets a recording be (`features.recording` on the session read). Null where there is
99
+ * nothing to record to: Standalone, an older Worker, or a read that failed. Not guarded: a failure only hides Record.
100
+ */
101
+ recordingLimit(): Promise<RecordingLimit | null>;
102
+ /** A file taken out before sending. Best effort: it expires within the hour anyway. */
103
+ discardUpload(id: string): Promise<void>;
104
+ /** A sent file's bytes, through the session that holds its comment. */
105
+ attachmentBlob(commentId: string, attachmentId: string): Promise<Blob>;
106
+ close(): Promise<void>;
107
+ private invalidate;
108
+ private guard;
109
+ private where;
110
+ private content;
111
+ /**
112
+ * Reviewers cannot read the participant list, so only this reviewer's own name is confirmed (the
113
+ * server issued it at join). Other names are the sealed ones their authors chose; they are shown
114
+ * as they are, because marking every name would carry no information. Known residual: a key
115
+ * holder can spoof a name in other reviewers' views.
116
+ */
117
+ private authorOf;
118
+ listComments(): Promise<Comment[]>;
119
+ /**
120
+ * What the sync already holds, decrypted, with no request. A write has just applied the
121
+ * server's answer to the sync, so reading it back needs no catch-up: that was a second
122
+ * round trip to the API on every comment, edit and resolve, for nothing the write did not
123
+ * already return.
124
+ */
125
+ private materialize;
126
+ /** Load a notification's full thread through that session's authorized sync path. */
127
+ loadThread(sessionId: string, commentId: string): Promise<Comment | undefined>;
128
+ private dropThread;
129
+ private threadOwner;
130
+ /**
131
+ * Whether a reply in this thread may carry files. Uploads always go to this session, and a
132
+ * thread another session holds (a notification's, routed by `threadOwner`) would refuse the claim.
133
+ */
134
+ takesFilesFor(commentId: string): boolean;
135
+ createComment(input: Parameters<typeof commentContent>[0] & {
136
+ attachmentIds?: string[];
137
+ }): Promise<Comment>;
138
+ /** The dev server's current branch, from this page's own origin only; never a reason to fail a comment. */
139
+ private devServerBranch;
140
+ updateComment(id: string, patch: {
141
+ body?: string;
142
+ status?: 'open' | 'resolved';
143
+ }): Promise<Comment>;
144
+ deleteComment(id: string): Promise<void>;
145
+ addReply(commentId: string, input: Omit<Reply, 'id' | 'createdAt'> & {
146
+ attachmentIds?: string[];
147
+ }): Promise<Reply>;
148
+ updateReply(commentId: string, replyId: string, body: string): Promise<Reply>;
149
+ }
@@ -0,0 +1,448 @@
1
+ import { ApiError, FeedbackClient, ParticipantKeys, SessionSync, SessionWatcher, newId } from '../remote/index.js';
2
+ import { BearerAuth, envelopeCodec, plaintextCodec } from '../remote/codec.js';
3
+ import { commentContent, replyContent, localContent } from '../remote/mapping.js';
4
+ import { pageUrl } from '../core/pageUrl.js';
5
+ import { isBranchLabel } from '../remote/branchLabel.js';
6
+ import { NotAllowedError, SessionExpiredError } from './api.js';
7
+ import { refusalOf, sendFile, uploadOf, UploadRefused } from './upload.js';
8
+ /** Uses the same HTTP, crypto and sync modules as the developer sidecar. */
9
+ export class DirectReviewer {
10
+ config;
11
+ record;
12
+ codec;
13
+ api;
14
+ sync;
15
+ watcher;
16
+ cache = new Map();
17
+ closed = false;
18
+ /**
19
+ * May change every comment (owner or admin), not only their own. A Standalone participant may: the
20
+ * API limits changes to their author on Cloud only.
21
+ */
22
+ moderates = true;
23
+ threads = new Map();
24
+ onChanged = () => { };
25
+ onRevoked = () => { };
26
+ /** The socket can never work for this client (protocol or version): the host reads on a slow timer instead. */
27
+ onDegraded = () => { };
28
+ /** A thread's session was revoked: its comments leave the view now, and reads that began earlier must not bring them back. */
29
+ onThreadRevoked = (_ids) => { };
30
+ revokedIds = new Set();
31
+ constructor(config, record, keys, codec) {
32
+ this.config = config;
33
+ this.record = record;
34
+ this.codec = codec;
35
+ this.api = new FeedbackClient({ baseUrl: config.apiBase, product: 'feedback-overlay', retry: { maxAttempts: 2 }, timeoutMs: 5000 }).project(config.projectId, keys);
36
+ this.sync = new SessionSync({ api: this.api, sessionId: config.sessionId, callbacks: { onExpired: () => this.invalidate() } });
37
+ this.watcher = new SessionWatcher({ api: this.api, sessionId: config.sessionId,
38
+ onReady: (revision) => this.announced(revision), onChanged: (revision) => this.announced(revision), onPoll: () => this.onChanged(),
39
+ onClosed: () => this.invalidate(), onStopped: ({ reason }) => {
40
+ if (['unauthorized', 'forbidden', 'session_expired', 'session_closed', 'access_revoked', 'ticket_rejected'].includes(reason))
41
+ this.invalidate();
42
+ else if (['unsupported_protocol', 'client_upgrade_required', 'protocol_violation'].includes(reason) && !this.closed)
43
+ this.onDegraded();
44
+ },
45
+ });
46
+ }
47
+ /** An announced revision this reviewer already holds needs no read: the first frame of every connection, and own writes. */
48
+ announced(revision) { if (revision === undefined || revision > this.sync.localRevision)
49
+ this.onChanged(); }
50
+ static async open(config, record) {
51
+ if (record.contentKey) {
52
+ const keys = await ParticipantKeys.import(record.contentKey, record.credential, record.keyVersion);
53
+ return new DirectReviewer(config, record, keys, envelopeCodec(keys));
54
+ }
55
+ if (!/^pc1\.[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/.test(record.credential))
56
+ throw new Error('invalid participant credential');
57
+ const participant = new DirectReviewer(config, record, new BearerAuth(record.credential), plaintextCodec);
58
+ participant.moderates = false; // A Cloud link participant changes only their own comments.
59
+ return participant;
60
+ }
61
+ /** A v0 Cloud account uses the same plaintext comments/sync path as a keyless reviewer. */
62
+ static async openAccount(config, session) {
63
+ if (!session.account || !/^[A-Za-z0-9_-]{43}$/.test(session.token))
64
+ throw new SessionExpiredError();
65
+ const record = { credential: session.token, contentKey: null, keyVersion: 1,
66
+ participantId: session.account.id, displayName: session.account.name || session.account.email.split('@')[0] || 'you' };
67
+ const reviewer = new DirectReviewer(config, record, new BearerAuth(session.token), plaintextCodec);
68
+ const [, project] = await Promise.all([
69
+ reviewer.guard(() => reviewer.api.getSession(config.sessionId)),
70
+ // The role only hides buttons; when it cannot be read they stay, and the API still answers.
71
+ reviewer.api.getProject().catch(() => null),
72
+ ]);
73
+ reviewer.moderates = project?.role ? ['owner', 'admin'].includes(project.role) : true;
74
+ return reviewer;
75
+ }
76
+ get account() { return !this.record.credential.startsWith('pc1.'); }
77
+ async notifications() {
78
+ if (!this.account)
79
+ return { events: [], unread: 0, readThrough: null };
80
+ return this.guard(async () => {
81
+ const { body: view } = await this.api.client.request('GET', this.notificationPath(), { auth: this.api.keys, query: { limit: 100 } });
82
+ return { ...view, events: view.events.map((e) => ({ id: e.id, sessionId: e.sessionId, commentId: e.commentId, kind: e.kind,
83
+ actor: e.author?.name || 'someone', actorId: e.author?.id ?? null, body: e.excerpt, route: e.route, createdAt: e.createdAt, unread: e.unread })) };
84
+ });
85
+ }
86
+ /** A ticket for the project change channel, which tells an account when its notifications may have changed. Not guarded: a refusal only means no channel. */
87
+ async projectChannelTicket() {
88
+ if (!this.account || this.closed)
89
+ throw new SessionExpiredError();
90
+ return (await this.api.client.request('POST', `/v0/projects/${this.config.projectId}/ws-tickets`, { auth: this.api.keys })).body;
91
+ }
92
+ async markNotificationsRead(ids) {
93
+ if (!ids.length)
94
+ return;
95
+ return this.guard(async () => (await this.api.client.request('POST', `${this.notificationPath()}/read`, { auth: this.api.keys, body: { ids } })).body);
96
+ }
97
+ /**
98
+ * Where elements commented on other builds are on `build` (contract section 19.6): their ids
99
+ * here, null when their code is gone, absent when a build is unknown. Opaque ids only. An API
100
+ * without the route answers 404, which is an empty answer, never a reason to sign out.
101
+ */
102
+ async translateAnchors(build, from) {
103
+ const answers = new Map();
104
+ for (let at = 0; at < from.length; at += 50) {
105
+ const search = new URLSearchParams({ build });
106
+ for (const entry of from.slice(at, at + 50))
107
+ search.append('from', `${entry.buildId}:${entry.anchorId}`);
108
+ const path = `/v0/projects/${encodeURIComponent(this.config.projectId)}/sessions/${encodeURIComponent(this.config.sessionId)}/anchors?${search}`;
109
+ const { body, status } = await this.guard(() => this.api.client.request('GET', path, { auth: this.api.keys, allowStatus: [404] }));
110
+ if (status === 404 || !body?.available || !Array.isArray(body.anchors))
111
+ return null;
112
+ for (const answer of body.anchors) {
113
+ if (typeof answer?.from !== 'string' || !(typeof answer.id === 'string' || answer.id === null))
114
+ continue;
115
+ // With a null id, the ids the element's file has here: the part of the page it was in.
116
+ const region = answer.id === null && Array.isArray(answer.region)
117
+ ? answer.region.filter((id) => typeof id === 'string' && id.length > 0).slice(0, 200) : [];
118
+ answers.set(answer.from, region.length > 0 ? { id: null, region } : { id: answer.id });
119
+ }
120
+ }
121
+ return answers;
122
+ }
123
+ notificationPath() { return `/v0/projects/${this.config.projectId}/sessions/${this.config.sessionId}/notifications`; }
124
+ /** A Cloud session: plaintext content, and the element screenshots that go with it. */
125
+ get cloud() { return !this.codec.keys; }
126
+ start() { void this.watcher.start(); }
127
+ /** The page goes into the browser's back/forward cache: its sockets stop (a cached page must hold none), the reviewer stays. */
128
+ suspend() { void this.watcher.stop(); }
129
+ /** The page came back from it: reconnect, and read what happened meanwhile. */
130
+ resume() { if (!this.closed) {
131
+ void this.watcher.restart();
132
+ this.onChanged();
133
+ } }
134
+ /**
135
+ * The picture of the element, sent once the comment exists (Cloud only: Standalone content is
136
+ * end-to-end encrypted and there is no encrypted image endpoint). The API takes it only from the
137
+ * comment's author, once, shortly after posting; a refusal is quiet, as on the local path.
138
+ */
139
+ async uploadScreenshot(commentId, snapshot) {
140
+ if (!this.cloud || this.closed)
141
+ return;
142
+ const query = new URLSearchParams({ width: String(Math.max(1, Math.min(10000, Math.round(snapshot.width)))), height: String(Math.max(1, Math.min(10000, Math.round(snapshot.height)))) });
143
+ for (const note of snapshot.incomplete.slice(0, 5))
144
+ if (note)
145
+ query.append('incomplete', note.slice(0, 120));
146
+ const path = `/v0/projects/${encodeURIComponent(this.config.projectId)}/sessions/${encodeURIComponent(this.config.sessionId)}/comments/${encodeURIComponent(commentId)}/screenshot?${query}`;
147
+ const response = await this.api.client.fetch(`${this.api.client.baseUrl}${path}`, {
148
+ method: 'PUT', body: snapshot.blob, redirect: 'error', signal: AbortSignal.timeout(15000),
149
+ headers: { authorization: this.api.keys.authorizationHeader(), 'content-type': snapshot.blob.type, 'feedback-client': this.api.client.userAgent },
150
+ });
151
+ await response.body?.cancel();
152
+ if (!response.ok)
153
+ throw new Error(`screenshot refused (HTTP ${response.status})`);
154
+ }
155
+ sessionUrl(rest) {
156
+ return `${this.api.client.baseUrl}/v0/projects/${encodeURIComponent(this.config.projectId)}/sessions/${encodeURIComponent(this.config.sessionId)}${rest}`;
157
+ }
158
+ fileHeaders() { return { authorization: this.api.keys.authorizationHeader(), 'feedback-client': this.api.client.userAgent }; }
159
+ /** A file for a message being written (Cloud only), sent as soon as it is added; the message claims it by id. */
160
+ async uploadAttachment(file, onProgress) {
161
+ if (!this.cloud)
162
+ throw new UploadRefused('unavailable');
163
+ if (this.closed)
164
+ throw new SessionExpiredError();
165
+ const { status, body } = await sendFile(this.sessionUrl(`/uploads?name=${encodeURIComponent(file.name || 'file')}`), this.fileHeaders(), file, onProgress);
166
+ if (status === 401 || status === 410) {
167
+ this.invalidate();
168
+ throw new SessionExpiredError();
169
+ }
170
+ if (status !== 201)
171
+ throw refusalOf(status, body, file);
172
+ return uploadOf(body);
173
+ }
174
+ /**
175
+ * What the workspace's plan lets a recording be (`features.recording` on the session read). Null where there is
176
+ * nothing to record to: Standalone, an older Worker, or a read that failed. Not guarded: a failure only hides Record.
177
+ */
178
+ async recordingLimit() {
179
+ if (!this.cloud || this.closed)
180
+ return null;
181
+ try {
182
+ const { body } = await this.api.client.request('GET', `/v0/projects/${this.config.projectId}/sessions/${this.config.sessionId}`, { auth: this.api.keys });
183
+ const found = body?.features?.recording;
184
+ return found && typeof found.available === 'boolean' && Number.isFinite(found.seconds) && Number.isFinite(found.bytes)
185
+ ? { available: found.available, seconds: Number(found.seconds), bytes: Number(found.bytes) } : null;
186
+ }
187
+ catch {
188
+ return null;
189
+ }
190
+ }
191
+ /** A file taken out before sending. Best effort: it expires within the hour anyway. */
192
+ async discardUpload(id) {
193
+ if (!this.cloud || this.closed)
194
+ return;
195
+ try {
196
+ const response = await this.api.client.fetch(this.sessionUrl(`/uploads/${encodeURIComponent(id)}`), {
197
+ method: 'DELETE', redirect: 'error', signal: AbortSignal.timeout(10_000), headers: this.fileHeaders()
198
+ });
199
+ await response.body?.cancel();
200
+ }
201
+ catch { /* It expires. */ }
202
+ }
203
+ /** A sent file's bytes, through the session that holds its comment. */
204
+ async attachmentBlob(commentId, attachmentId) {
205
+ const owner = this.threadOwner(commentId);
206
+ if (owner)
207
+ return owner.attachmentBlob(commentId, attachmentId);
208
+ return this.guard(async () => {
209
+ const response = await this.api.client.fetch(this.sessionUrl(`/attachments/${encodeURIComponent(attachmentId)}`), {
210
+ redirect: 'error', signal: AbortSignal.timeout(30_000), headers: this.fileHeaders()
211
+ });
212
+ if (!response.ok) {
213
+ await response.body?.cancel();
214
+ throw new Error(`file not available (HTTP ${response.status})`);
215
+ }
216
+ return response.blob();
217
+ });
218
+ }
219
+ async close() { this.closed = true; this.cache.clear(); await Promise.all([...this.threads.values()].map(({ reviewer }) => reviewer.close())); this.threads.clear(); await this.watcher.stop(); }
220
+ invalidate() { if (this.closed)
221
+ return; void this.close(); this.onRevoked(); }
222
+ async guard(work) {
223
+ if (this.closed)
224
+ throw new SessionExpiredError();
225
+ try {
226
+ return await work();
227
+ }
228
+ catch (error) {
229
+ if (error instanceof ApiError && [401, 410].includes(error.status)) {
230
+ this.invalidate();
231
+ throw new SessionExpiredError();
232
+ }
233
+ // A refusal of this one action (someone else's comment): the sign-in is still good.
234
+ if (error instanceof ApiError && error.status === 403)
235
+ throw new NotAllowedError(error.message);
236
+ throw error;
237
+ }
238
+ }
239
+ where(id) { return { projectId: this.config.projectId, sessionId: this.config.sessionId, commentId: id }; }
240
+ async content(entity) {
241
+ const cached = this.cache.get(entity.id);
242
+ if (cached?.revision === entity.revision)
243
+ return cached.content;
244
+ const value = await this.codec.open(entity);
245
+ this.cache.set(entity.id, { revision: entity.revision, content: value });
246
+ return value;
247
+ }
248
+ /**
249
+ * Reviewers cannot read the participant list, so only this reviewer's own name is confirmed (the
250
+ * server issued it at join). Other names are the sealed ones their authors chose; they are shown
251
+ * as they are, because marking every name would carry no information. Known residual: a key
252
+ * holder can spoof a name in other reviewers' views.
253
+ */
254
+ authorOf(authorId, sealed) {
255
+ return { author: authorId === this.record.participantId ? this.record.displayName : sealed };
256
+ }
257
+ async listComments() {
258
+ return this.guard(async () => {
259
+ await this.sync.catchUp();
260
+ return this.materialize();
261
+ });
262
+ }
263
+ /**
264
+ * What the sync already holds, decrypted, with no request. A write has just applied the
265
+ * server's answer to the sync, so reading it back needs no catch-up: that was a second
266
+ * round trip to the API on every comment, edit and resolve, for nothing the write did not
267
+ * already return.
268
+ */
269
+ async materialize() {
270
+ if (this.closed || this.sync.state !== 'active')
271
+ throw new SessionExpiredError();
272
+ const { comments, replies } = this.sync.snapshot();
273
+ const live = new Set([...comments, ...replies].map((e) => e.id));
274
+ for (const id of this.cache.keys())
275
+ if (!live.has(id))
276
+ this.cache.delete(id);
277
+ const result = [];
278
+ for (const c of comments) {
279
+ try {
280
+ const children = [];
281
+ for (const r of replies.filter((r) => r.commentId === c.id)) {
282
+ try {
283
+ const fields = localContent(await this.content(r));
284
+ children.push({ ...fields, ...this.authorOf(r.authorId, fields.author), id: r.id, authorId: r.authorId, createdAt: r.createdAt, editedAt: r.editedAt, attachments: r.attachments });
285
+ }
286
+ catch {
287
+ children.push({ id: r.id, authorId: r.authorId, author: 'Unreadable', body: `[${this.codec.keys ? 'Encrypted reply' : 'Reply'} cannot be read]`, anchor: emptyAnchor, createdAt: r.createdAt });
288
+ }
289
+ }
290
+ const fields = localContent(await this.content(c));
291
+ result.push({ ...fields, ...this.authorOf(c.authorId, fields.author), id: c.id, authorId: c.authorId, createdAt: c.createdAt, editedAt: c.editedAt, status: c.status, replies: children, attachments: c.attachments });
292
+ }
293
+ catch {
294
+ result.push({ id: c.id, authorId: c.authorId, author: 'Unreadable', body: `[${this.codec.keys ? 'Encrypted comment' : 'Comment'} cannot be read]`, anchor: emptyAnchor, leafAnchor: null, context: { route: '/', viewport: { w: 0, h: 0 } }, createdAt: c.createdAt, status: c.status, replies: [] });
295
+ }
296
+ }
297
+ for (const [sessionId, thread] of this.threads) {
298
+ try {
299
+ result.push(...(await thread.reviewer.listComments()).filter((c) => thread.ids.has(c.id)));
300
+ }
301
+ catch (error) {
302
+ if (!(error instanceof SessionExpiredError))
303
+ throw error;
304
+ this.dropThread(sessionId, thread.reviewer);
305
+ }
306
+ }
307
+ return result.filter((c) => !this.revokedIds.has(c.id));
308
+ }
309
+ /** Load a notification's full thread through that session's authorized sync path. */
310
+ async loadThread(sessionId, commentId) {
311
+ if (this.closed)
312
+ throw new SessionExpiredError();
313
+ if (!this.account || !/^ses_[0-7][0-9a-hjkmnp-tv-z]{25}$/.test(sessionId) || !/^cmt_[0-7][0-9a-hjkmnp-tv-z]{25}$/.test(commentId))
314
+ return;
315
+ if (sessionId === this.config.sessionId)
316
+ return (await this.listComments()).find((c) => c.id === commentId);
317
+ let thread = this.threads.get(sessionId);
318
+ if (!thread) {
319
+ const reviewer = new DirectReviewer({ ...this.config, sessionId }, this.record, this.api.keys, this.codec);
320
+ reviewer.onChanged = () => this.onChanged();
321
+ reviewer.onDegraded = () => this.onDegraded();
322
+ reviewer.onRevoked = () => this.dropThread(sessionId, reviewer);
323
+ reviewer.start();
324
+ thread = { reviewer, ids: new Set() };
325
+ this.threads.set(sessionId, thread);
326
+ }
327
+ const comment = (await thread.reviewer.listComments()).find((c) => c.id === commentId);
328
+ if (comment) {
329
+ thread.ids.add(commentId);
330
+ this.revokedIds.delete(commentId);
331
+ }
332
+ return comment;
333
+ }
334
+ dropThread(sessionId, reviewer) {
335
+ const held = this.threads.get(sessionId);
336
+ if (held?.reviewer !== reviewer)
337
+ return;
338
+ this.threads.delete(sessionId);
339
+ for (const id of held.ids)
340
+ this.revokedIds.add(id);
341
+ this.onThreadRevoked([...held.ids]);
342
+ this.onChanged();
343
+ }
344
+ threadOwner(commentId) {
345
+ return [...this.threads.values()].find(({ ids }) => ids.has(commentId))?.reviewer;
346
+ }
347
+ /**
348
+ * Whether a reply in this thread may carry files. Uploads always go to this session, and a
349
+ * thread another session holds (a notification's, routed by `threadOwner`) would refuse the claim.
350
+ */
351
+ takesFilesFor(commentId) { return this.cloud && !this.threadOwner(commentId); }
352
+ async createComment(input) {
353
+ return this.guard(async () => {
354
+ const id = newId('cmt');
355
+ const { attachmentIds, ...fields } = input;
356
+ const content = { ...commentContent({ ...fields, author: this.record.displayName, authorId: this.record.participantId }), ...(this.config.buildId ? { buildId: this.config.buildId } : {}) };
357
+ // Cloud content is readable on the server: the page without its query string.
358
+ if (!this.codec.keys && content.context && 'url' in content.context)
359
+ content.context = { ...content.context, url: pageUrl(content.context.url, { query: false }) };
360
+ // Cloud: labelled with the branch the preview was built from, when the build recorded one, or
361
+ // on a dev-server review page the branch the dev server has checked out now; without either
362
+ // the API labels the comment `default`. Standalone: nothing in plaintext beside the sealed content.
363
+ const label = this.codec.keys ? undefined : isBranchLabel(this.config.branch) ? this.config.branch : await this.devServerBranch();
364
+ const branch = label ? { branch: label } : {};
365
+ const c = await this.api.createComment(this.config.sessionId, { id, authorId: this.record.participantId, ...await this.codec.seal(this.where(id), content), ...branch, ...(attachmentIds?.length && this.cloud ? { attachmentIds } : {}) });
366
+ this.sync.applyComment(c);
367
+ this.onChanged();
368
+ return (await this.materialize()).find((c) => c.id === id);
369
+ });
370
+ }
371
+ /** The dev server's current branch, from this page's own origin only; never a reason to fail a comment. */
372
+ async devServerBranch() {
373
+ if (!this.config.branchUrl)
374
+ return undefined;
375
+ try {
376
+ const url = new URL(this.config.branchUrl, location.href);
377
+ if (url.origin !== location.origin)
378
+ return undefined;
379
+ const response = await fetch(url, { cache: 'no-store', credentials: 'omit', signal: AbortSignal.timeout(2000) });
380
+ const body = response.ok ? await response.json() : null;
381
+ return isBranchLabel(body?.branch) ? body.branch : undefined;
382
+ }
383
+ catch {
384
+ return undefined;
385
+ }
386
+ }
387
+ async updateComment(id, patch) {
388
+ const owner = this.threadOwner(id);
389
+ if (owner)
390
+ return owner.updateComment(id, patch);
391
+ return this.guard(async () => {
392
+ await this.sync.catchUp();
393
+ const c = this.sync.snapshot().comments.find((c) => c.id === id);
394
+ if (!c)
395
+ throw new Error('Comment no longer exists');
396
+ const sealed = patch.body === undefined ? {} : await this.codec.seal(this.where(id), { ...await this.content(c), body: patch.body });
397
+ const updated = await this.api.updateComment(this.config.sessionId, id, { actorId: this.record.participantId, baseRevision: c.revision, ...sealed, status: patch.status });
398
+ this.sync.applyComment(updated);
399
+ this.onChanged();
400
+ return (await this.materialize()).find((c) => c.id === id);
401
+ });
402
+ }
403
+ async deleteComment(id) {
404
+ const owner = this.threadOwner(id);
405
+ if (owner)
406
+ return owner.deleteComment(id);
407
+ return this.guard(async () => {
408
+ await this.sync.catchUp();
409
+ const c = this.sync.snapshot().comments.find((c) => c.id === id);
410
+ if (!c)
411
+ return;
412
+ this.sync.applyTombstone(await this.api.deleteComment(this.config.sessionId, id, { actorId: this.record.participantId, baseRevision: c.revision }));
413
+ this.onChanged();
414
+ });
415
+ }
416
+ async addReply(commentId, input) {
417
+ const owner = this.threadOwner(commentId);
418
+ if (owner)
419
+ return owner.addReply(commentId, input);
420
+ return this.guard(async () => {
421
+ const id = newId('rpl');
422
+ const { attachmentIds, ...fields } = input;
423
+ const sealed = await this.codec.seal({ ...this.where(commentId), replyId: id }, replyContent({ ...fields, author: this.record.displayName, authorId: this.record.participantId }));
424
+ const reply = await this.api.createReply(this.config.sessionId, commentId, { id, authorId: this.record.participantId, ...sealed, ...(attachmentIds?.length && this.cloud ? { attachmentIds } : {}) });
425
+ this.sync.applyReply(reply);
426
+ this.onChanged();
427
+ return { ...localContent(await this.content(reply)), id, createdAt: reply.createdAt, authorId: reply.authorId, attachments: reply.attachments };
428
+ });
429
+ }
430
+ async updateReply(commentId, replyId, body) {
431
+ const owner = this.threadOwner(commentId);
432
+ if (owner)
433
+ return owner.updateReply(commentId, replyId, body);
434
+ return this.guard(async () => {
435
+ await this.sync.catchUp();
436
+ const r = this.sync.snapshot().replies.find((r) => r.id === replyId && r.commentId === commentId);
437
+ if (!r)
438
+ throw new Error('Reply no longer exists');
439
+ const sealed = await this.codec.seal({ ...this.where(commentId), replyId }, { ...await this.content(r), body });
440
+ const reply = await this.api.updateReply(this.config.sessionId, commentId, replyId, { actorId: this.record.participantId, baseRevision: r.revision, ...sealed });
441
+ this.sync.applyReply(reply);
442
+ this.onChanged();
443
+ return { ...localContent(await this.content(reply)), id: replyId, createdAt: reply.createdAt, authorId: reply.authorId };
444
+ });
445
+ }
446
+ }
447
+ const emptyAnchor = { file: '', line: 0, column: 0, componentName: null, domPath: '', textSnippet: null };
448
+ //# sourceMappingURL=directReviewer.js.map