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,424 @@
1
+ /**
2
+ * HTTP transport for every Standalone endpoint in contract v0.
3
+ *
4
+ * - `Feedback-Client` on every request, `Idempotency-Key` on every POST/PATCH except ws-tickets.
5
+ * - One serialized body per logical write, reused byte-for-byte (and with the same key) on retry.
6
+ * - Retries only retryable failures (network, 429, 5xx, `idempotency_in_progress`) with
7
+ * exponential backoff and full jitter, honoring `Retry-After` (README sections 6, 8.6, 9).
8
+ * - Contract error envelopes become {@link ApiError}; secrets never appear in errors or events.
9
+ */
10
+ import { ApiError, NetworkError, ProtocolError } from './errors.js';
11
+ import { newIdempotencyKey } from './ids.js';
12
+ export const CLIENT_PRODUCT = 'feedback-reference-client';
13
+ export const CLIENT_VERSION = '0.2.0';
14
+ const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]']);
15
+ /**
16
+ * `baseUrl` is mandatory: there is deliberately no default host. Credentials travel only over
17
+ * HTTPS, or plain HTTP to a loopback address in development (README section 2.3).
18
+ * @param {unknown} baseUrl
19
+ */
20
+ export function normalizeBaseUrl(baseUrl) {
21
+ if (typeof baseUrl !== 'string' || baseUrl === '')
22
+ throw new TypeError('baseUrl is required (the API base URL, for example https://api.example.com)');
23
+ let url;
24
+ try {
25
+ url = new URL(baseUrl);
26
+ }
27
+ catch {
28
+ throw new TypeError('baseUrl is not a valid URL');
29
+ }
30
+ if (url.username || url.password || url.search || url.hash)
31
+ throw new TypeError('baseUrl must not contain credentials, a query, or a fragment');
32
+ if (url.protocol !== 'https:' && !(url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname))) {
33
+ throw new TypeError('baseUrl must be https:// (plain http:// is allowed only for 127.0.0.1, localhost, or [::1])');
34
+ }
35
+ return url.href.replace(/\/+$/, '');
36
+ }
37
+ /**
38
+ * @typedef {object} RetryOptions
39
+ * @property {number} [maxAttempts] Total attempts per request, first included. Default 5.
40
+ * @property {number} [baseDelayMs] Backoff base: retry n waits random in [0, min(maxDelayMs, base * 2^n)]. Default 1000.
41
+ * @property {number} [maxDelayMs] Default 30000.
42
+ * @property {number} [maxRetryAfterMs] A longer `Retry-After` is not waited out; the error is thrown. Default 60000.
43
+ */
44
+ /**
45
+ * @typedef {object} ClientOptions
46
+ * @property {string} baseUrl
47
+ * @property {typeof fetch} [fetch]
48
+ * @property {string} [product] `Feedback-Client` product, `[a-z][a-z0-9-]{0,63}`.
49
+ * @property {string} [version] Full SemVer.
50
+ * @property {RetryOptions} [retry]
51
+ * @property {number} [timeoutMs] Per attempt. Default 30000.
52
+ * @property {(ms: number) => Promise<void>} [sleep]
53
+ * @property {() => number} [random] In [0, 1).
54
+ * @property {(event: RequestEvent) => void} [onRequest] Observability hook; receives no secrets.
55
+ */
56
+ /**
57
+ * @typedef {object} RequestEvent
58
+ * @property {string} method @property {string} path @property {number} attempt
59
+ * @property {number} [status] @property {string} [requestId] @property {string} [error]
60
+ */
61
+ /** @typedef {{ idempotencyKey?: string }} WriteOptions */
62
+ /**
63
+ * The request credential: Standalone derived keys, or (Cloud) an account token or participant
64
+ * credential holder. Only `authorizationHeader()` is used by the transport.
65
+ * @typedef {{ authorizationHeader(): string }} RequestAuth
66
+ */
67
+ export class FeedbackClient {
68
+ /** @param {ClientOptions} options */
69
+ constructor(options) {
70
+ this.baseUrl = normalizeBaseUrl(options.baseUrl);
71
+ // Window.fetch requires its browser-global receiver; this client calls a stored transport.
72
+ this.fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
73
+ this.userAgent = `${options.product ?? CLIENT_PRODUCT}/${options.version ?? CLIENT_VERSION}`;
74
+ this.timeoutMs = options.timeoutMs ?? 30000;
75
+ this.retry = { maxAttempts: 5, baseDelayMs: 1000, maxDelayMs: 30000, maxRetryAfterMs: 60000, ...options.retry };
76
+ this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
77
+ this.random = options.random ?? Math.random;
78
+ this.onRequest = options.onRequest;
79
+ }
80
+ /**
81
+ * Low-level request with retries. `auth` is the credential for the project in the path.
82
+ * @param {string} method
83
+ * @param {string} path Starts with /v0.
84
+ * @param {{ auth?: RequestAuth, body?: unknown, idempotencyKey?: string, query?: Record<string, string | number | undefined>, headers?: Record<string, string>, allowStatus?: number[] }} [options]
85
+ * @returns {Promise<{ status: number, body: any, headers: Headers }>}
86
+ */
87
+ async request(method, path, { auth, body, idempotencyKey, query, headers = {}, allowStatus = [] } = {}) {
88
+ const search = new URLSearchParams();
89
+ for (const [name, value] of Object.entries(query ?? {}))
90
+ if (value !== undefined)
91
+ search.set(name, String(value));
92
+ const url = `${this.baseUrl}${path}${search.size > 0 ? `?${search}` : ''}`;
93
+ // Serialized once: a retry sends the identical bytes with the identical Idempotency-Key.
94
+ const payload = body === undefined ? undefined : JSON.stringify(body);
95
+ const attemptsAllowed = Math.max(1, this.retry.maxAttempts);
96
+ for (let attempt = 1;; attempt += 1) {
97
+ /** @type {ApiError | NetworkError} */
98
+ let failure;
99
+ try {
100
+ const { error, ...response } = await this.#send(method, url, { auth, payload, idempotencyKey, headers });
101
+ this.onRequest?.({ method, path, attempt, status: response.status, requestId: response.headers.get('request-id') ?? undefined });
102
+ if (error === undefined || allowStatus.includes(response.status))
103
+ return response;
104
+ failure = error;
105
+ }
106
+ catch (error) {
107
+ if (!(error instanceof NetworkError))
108
+ throw error;
109
+ this.onRequest?.({ method, path, attempt, error: error.message });
110
+ failure = error;
111
+ }
112
+ const retryable = failure instanceof NetworkError || failure.retryable;
113
+ if (!retryable || attempt >= attemptsAllowed)
114
+ throw failure;
115
+ const delay = this.#retryDelay(attempt - 1, failure);
116
+ if (delay === undefined)
117
+ throw failure;
118
+ await this.sleep(delay);
119
+ }
120
+ }
121
+ /** @returns {number | undefined} undefined when the server asks for a wait longer than we accept. */
122
+ #retryDelay(/** @type {number} */ retryIndex, /** @type {ApiError | NetworkError} */ failure) {
123
+ const { baseDelayMs, maxDelayMs, maxRetryAfterMs } = this.retry;
124
+ if (failure instanceof ApiError && failure.retryAfterSeconds !== undefined) {
125
+ const wait = failure.retryAfterSeconds * 1000;
126
+ return wait > (maxRetryAfterMs ?? Infinity) ? undefined : wait;
127
+ }
128
+ return this.random() * Math.min(maxDelayMs, baseDelayMs * 2 ** retryIndex);
129
+ }
130
+ /**
131
+ * One HTTP attempt. Resolves with the parsed response (an error status carries `error`) or
132
+ * throws NetworkError.
133
+ * @returns {Promise<{ status: number, headers: Headers, body: any, error?: ApiError }>}
134
+ */
135
+ async #send(
136
+ /** @type {string} */ method, /** @type {string} */ url,
137
+ /** @type {{ auth?: RequestAuth, payload?: string, idempotencyKey?: string, headers: Record<string, string> }} */ { auth, payload, idempotencyKey, headers }) {
138
+ /** @type {Record<string, string>} */
139
+ const requestHeaders = { accept: 'application/json', 'feedback-client': this.userAgent, ...headers };
140
+ if (payload !== undefined)
141
+ requestHeaders['content-type'] = 'application/json; charset=utf-8';
142
+ if (idempotencyKey !== undefined)
143
+ requestHeaders['idempotency-key'] = idempotencyKey;
144
+ if (auth)
145
+ requestHeaders.authorization = auth.authorizationHeader();
146
+ let response;
147
+ let text;
148
+ try {
149
+ response = await this.fetch(url, {
150
+ method,
151
+ headers: requestHeaders,
152
+ body: payload,
153
+ redirect: 'error',
154
+ signal: AbortSignal.timeout(this.timeoutMs),
155
+ });
156
+ text = await response.text();
157
+ }
158
+ catch (error) {
159
+ throw new NetworkError(`${method} ${new URL(url).pathname} failed: ${error instanceof Error ? error.name : 'error'}`, error);
160
+ }
161
+ let parsed;
162
+ if (text !== '') {
163
+ try {
164
+ parsed = JSON.parse(text);
165
+ }
166
+ catch {
167
+ parsed = undefined;
168
+ }
169
+ }
170
+ if (response.ok || response.status === 304) {
171
+ if (response.status !== 304 && parsed === undefined)
172
+ throw new ProtocolError(`${method} ${new URL(url).pathname}: ${response.status} response is not JSON`);
173
+ return { status: response.status, headers: response.headers, body: parsed };
174
+ }
175
+ return { status: response.status, headers: response.headers, body: parsed, error: parseError(response, parsed) };
176
+ }
177
+ // --- Meta -------------------------------------------------------------------------------
178
+ /**
179
+ * `GET /v0/health`. A 503 still carries a health document (`status: "unavailable"`), returned
180
+ * rather than thrown. Public; no credential.
181
+ * @returns {Promise<import('./types.js').Health>}
182
+ */
183
+ async health() {
184
+ const { body } = await this.request('GET', '/v0/health', { allowStatus: [503] });
185
+ return body;
186
+ }
187
+ /**
188
+ * `GET /v0/markdown-spec?format=…`, with `If-None-Match` support. Public.
189
+ * @param {{ formats?: number[], etag?: string }} [options]
190
+ * @returns {Promise<{ notModified: true, etag?: string } | { notModified: false, etag?: string, spec: any }>}
191
+ */
192
+ async markdownSpec({ formats = [1], etag } = {}) {
193
+ const { status, body, headers } = await this.request('GET', '/v0/markdown-spec', {
194
+ query: { format: formats.join(',') },
195
+ headers: etag ? { 'if-none-match': etag } : {},
196
+ allowStatus: [304],
197
+ });
198
+ const newEtag = headers.get('etag') ?? etag;
199
+ return status === 304 ? { notModified: true, etag: newEtag } : { notModified: false, etag: newEtag, spec: body };
200
+ }
201
+ /** Single-use exchange. Never retry an uncertain acceptance automatically.
202
+ * @param {string} projectId @param {string} sessionId @param {string} token
203
+ */
204
+ async acceptInvite(projectId, sessionId, token) {
205
+ const client = new FeedbackClient({ baseUrl: this.baseUrl, fetch: this.fetch,
206
+ product: this.userAgent.split('/')[0], version: this.userAgent.split('/')[1], retry: { maxAttempts: 1 } });
207
+ return (await client.request('POST', `/v0/projects/${encodeURIComponent(projectId)}/sessions/${encodeURIComponent(sessionId)}/invites/accept`, { body: { token } })).body;
208
+ }
209
+ // --- Projects -----------------------------------------------------------------------------
210
+ /**
211
+ * `POST /v0/standalone/projects`: registers the verifier of `keys` (never the key itself).
212
+ * @param {import('./keys.js').DerivedKeys} keys
213
+ * @param {WriteOptions} [options]
214
+ * @returns {Promise<import('./types.js').Project>}
215
+ */
216
+ async createStandaloneProject(keys, { idempotencyKey = newIdempotencyKey() } = {}) {
217
+ const { body } = await this.request('POST', '/v0/standalone/projects', {
218
+ body: { auth: { keyVersion: keys.keyVersion, verifier: keys.verifier } },
219
+ idempotencyKey,
220
+ });
221
+ return body.project;
222
+ }
223
+ /**
224
+ * Authenticated calls for one project.
225
+ * @template {RequestAuth} Auth
226
+ * @param {string} projectId @param {Auth} keys
227
+ */
228
+ project(projectId, keys) {
229
+ return new ProjectApi(this, projectId, keys);
230
+ }
231
+ }
232
+ /**
233
+ * Calls scoped to one project and its credential (derived from its key on Standalone).
234
+ * @template {RequestAuth} [Auth = RequestAuth]
235
+ */
236
+ export class ProjectApi {
237
+ /** @param {FeedbackClient} client @param {string} projectId @param {Auth} keys */
238
+ constructor(client, projectId, keys) {
239
+ this.client = client;
240
+ this.projectId = projectId;
241
+ this.keys = keys;
242
+ }
243
+ /** @param {string} [suffix] */
244
+ #path(suffix = '') {
245
+ return `/v0/projects/${encodeURIComponent(this.projectId)}${suffix}`;
246
+ }
247
+ /** @param {string} sessionId @param {string} [suffix] */
248
+ #session(sessionId, suffix = '') {
249
+ return this.#path(`/sessions/${encodeURIComponent(sessionId)}${suffix}`);
250
+ }
251
+ /** @param {string} method @param {string} path @param {{ body?: unknown, idempotencyKey?: string, query?: Record<string, string | number | undefined> }} [options] */
252
+ #call(method, path, options) {
253
+ return this.client.request(method, path, { auth: this.keys, ...options });
254
+ }
255
+ /** @param {string} sessionId @param {{ displayName: string, origin: string, ttlDays?: number }} invite */
256
+ async createInvite(sessionId, { displayName, origin, ttlDays }) {
257
+ return (await this.#call('POST', this.#session(sessionId, '/invites'), { body: { displayName, origin, ...(ttlDays === undefined ? {} : { ttlDays }) } })).body;
258
+ }
259
+ /** @param {string} sessionId */
260
+ async listParticipants(sessionId) {
261
+ return (await this.#call('GET', this.#session(sessionId, '/participants'))).body.participants;
262
+ }
263
+ /** @param {string} sessionId @param {string} participantId */
264
+ async revokeParticipant(sessionId, participantId) {
265
+ return (await this.#call('POST', this.#session(sessionId, '/participants/revoke'), { body: { participantId } })).body.participant;
266
+ }
267
+ /** @returns {Promise<import('./types.js').Project>} */
268
+ async getProject() {
269
+ return (await this.#call('GET', this.#path())).body.project;
270
+ }
271
+ /**
272
+ * Standalone: `expiresAt` is fixed at creation (createdAt + server-configured days, default 7).
273
+ * @param {{ branchId?: string } & WriteOptions} [options]
274
+ * @returns {Promise<import('./types.js').Session>}
275
+ */
276
+ async createSession({ branchId, idempotencyKey = newIdempotencyKey() } = {}) {
277
+ const { body } = await this.#call('POST', this.#path('/sessions'), { body: branchId === undefined ? {} : { branchId }, idempotencyKey });
278
+ return body.session;
279
+ }
280
+ /**
281
+ * @param {{ cursor?: string, limit?: number }} [options]
282
+ * @returns {Promise<{ sessions: import('./types.js').Session[], nextCursor: string | null }>}
283
+ */
284
+ async listSessions({ cursor, limit } = {}) {
285
+ return (await this.#call('GET', this.#path('/sessions'), { query: { cursor, limit } })).body;
286
+ }
287
+ /** @param {string} sessionId @returns {Promise<import('./types.js').Session>} */
288
+ async getSession(sessionId) {
289
+ return (await this.#call('GET', this.#session(sessionId))).body.session;
290
+ }
291
+ /**
292
+ * Creates a comment with a client-generated ID. The envelope must be bound to that ID, so a
293
+ * caller that supplies `id` must have sealed against it. Cloud projects take plaintext `content`
294
+ * instead of `envelope` (README section 4.6), and may carry the `branch` label (section 4.7).
295
+ * @param {string} sessionId
296
+ * @param {{ id: string, authorId: string, envelope?: import('./types.js').Envelope, content?: object, status?: 'open' | 'resolved', branch?: string, attachmentIds?: string[] } & WriteOptions} comment
297
+ * @returns {Promise<import('./types.js').Comment>}
298
+ */
299
+ async createComment(sessionId, { id, authorId, envelope, content, status, branch, attachmentIds, idempotencyKey = newIdempotencyKey() }) {
300
+ const body = { id, authorId, ...(status === undefined ? {} : { status }), ...sealed(envelope, content), ...(branch === undefined ? {} : { branch }), ...(attachmentIds === undefined ? {} : { attachmentIds }) };
301
+ return (await this.#call('POST', this.#session(sessionId, '/comments'), { body, idempotencyKey })).body.comment;
302
+ }
303
+ /**
304
+ * Edits a comment's envelope, status, or both, as one revision. `baseRevision` is the comment
305
+ * revision the caller last saw (409 `conflict` otherwise).
306
+ * @param {string} sessionId @param {string} commentId
307
+ * @param {{ actorId: string, baseRevision: number, envelope?: import('./types.js').Envelope, content?: object, status?: 'open' | 'resolved' } & WriteOptions} update
308
+ * @returns {Promise<import('./types.js').Comment>}
309
+ */
310
+ async updateComment(sessionId, commentId, { actorId, baseRevision, envelope, content, status, idempotencyKey = newIdempotencyKey() }) {
311
+ if (envelope === undefined && content === undefined && status === undefined)
312
+ throw new TypeError('updateComment needs content, a status, or both');
313
+ const body = { actorId, ...sealed(envelope, content), ...(status === undefined ? {} : { status }), baseRevision };
314
+ return (await this.#call('PATCH', this.#session(sessionId, `/comments/${encodeURIComponent(commentId)}`), { body, idempotencyKey })).body.comment;
315
+ }
316
+ /**
317
+ * Status-only change. Setting the current status again is a 200 no-op without a revision.
318
+ * @param {string} sessionId @param {string} commentId
319
+ * @param {{ actorId: string, status: 'open' | 'resolved', baseRevision: number } & WriteOptions} change
320
+ */
321
+ setCommentStatus(sessionId, commentId, { actorId, status, baseRevision, idempotencyKey }) {
322
+ return this.updateComment(sessionId, commentId, { actorId, status, baseRevision, idempotencyKey });
323
+ }
324
+ /**
325
+ * @param {string} sessionId @param {string} commentId
326
+ * @param {{ id: string, authorId: string, envelope?: import('./types.js').Envelope, content?: object, attachmentIds?: string[] } & WriteOptions} reply
327
+ * @returns {Promise<import('./types.js').Reply>}
328
+ */
329
+ async createReply(sessionId, commentId, { id, authorId, envelope, content, attachmentIds, idempotencyKey = newIdempotencyKey() }) {
330
+ const path = this.#session(sessionId, `/comments/${encodeURIComponent(commentId)}/replies`);
331
+ return (await this.#call('POST', path, { body: { id, authorId, ...sealed(envelope, content), ...(attachmentIds === undefined ? {} : { attachmentIds }) }, idempotencyKey })).body.reply;
332
+ }
333
+ /**
334
+ * @param {string} sessionId @param {string} commentId @param {string} replyId
335
+ * @param {{ actorId: string, baseRevision: number, envelope?: import('./types.js').Envelope, content?: object } & WriteOptions} update
336
+ * @returns {Promise<import('./types.js').Reply>}
337
+ */
338
+ async updateReply(sessionId, commentId, replyId, { actorId, baseRevision, envelope, content, idempotencyKey = newIdempotencyKey() }) {
339
+ const path = this.#session(sessionId, `/comments/${encodeURIComponent(commentId)}/replies/${encodeURIComponent(replyId)}`);
340
+ return (await this.#call('PATCH', path, { body: { actorId, ...sealed(envelope, content), baseRevision }, idempotencyKey })).body.reply;
341
+ }
342
+ /**
343
+ * @param {string} sessionId @param {string} commentId
344
+ * @param {{ actorId: string, baseRevision: number } & WriteOptions} deletion
345
+ * @returns {Promise<import('./types.js').Tombstone>}
346
+ */
347
+ async deleteComment(sessionId, commentId, { actorId, baseRevision, idempotencyKey = newIdempotencyKey() }) {
348
+ return (await this.#call('DELETE', this.#session(sessionId, `/comments/${encodeURIComponent(commentId)}`), {
349
+ body: { actorId, baseRevision }, idempotencyKey,
350
+ })).body.tombstone;
351
+ }
352
+ /**
353
+ * @param {string} sessionId @param {string} commentId @param {string} replyId
354
+ * @param {{ actorId: string, baseRevision: number } & WriteOptions} deletion
355
+ * @returns {Promise<import('./types.js').Tombstone>}
356
+ */
357
+ async deleteReply(sessionId, commentId, replyId, { actorId, baseRevision, idempotencyKey = newIdempotencyKey() }) {
358
+ return (await this.#call('DELETE', this.#session(sessionId, `/comments/${encodeURIComponent(commentId)}/replies/${encodeURIComponent(replyId)}`), {
359
+ body: { actorId, baseRevision }, idempotencyKey,
360
+ })).body.tombstone;
361
+ }
362
+ /**
363
+ * `GET …/changes?after&limit`. 409 `snapshot_required` is thrown as an {@link ApiError}.
364
+ * @param {string} sessionId @param {{ after?: number, limit?: number }} [options]
365
+ * @returns {Promise<import('./types.js').ChangesPage>}
366
+ */
367
+ async getChanges(sessionId, { after = 0, limit } = {}) {
368
+ return (await this.#call('GET', this.#session(sessionId, '/changes'), { query: { after, limit } })).body;
369
+ }
370
+ /**
371
+ * `GET …/snapshot?after&limit`.
372
+ * @param {string} sessionId @param {{ after?: number, limit?: number }} [options]
373
+ * @returns {Promise<import('./types.js').SnapshotPage>}
374
+ */
375
+ async getSnapshot(sessionId, { after = 0, limit } = {}) {
376
+ return (await this.#call('GET', this.#session(sessionId, '/snapshot'), { query: { after, limit } })).body;
377
+ }
378
+ /**
379
+ * `POST …/ws-tickets`: a single-use ticket (30 s) for one WebSocket upgrade. No Idempotency-Key
380
+ * (every call mints a new ticket).
381
+ * @param {string} sessionId
382
+ * @returns {Promise<import('./types.js').WsTicket>}
383
+ */
384
+ async createWsTicket(sessionId) {
385
+ return (await this.#call('POST', this.#session(sessionId, '/ws-tickets'))).body;
386
+ }
387
+ }
388
+ /**
389
+ * The content field of a write: `envelope` (Standalone) or `content` (Cloud), never both.
390
+ * @param {unknown} envelope @param {unknown} content
391
+ */
392
+ function sealed(envelope, content) {
393
+ if (envelope !== undefined && content !== undefined)
394
+ throw new TypeError('a write carries an envelope or plaintext content, not both');
395
+ return envelope !== undefined ? { envelope } : content !== undefined ? { content } : {};
396
+ }
397
+ /**
398
+ * Contract error envelope (section 9); anything else falls back on the HTTP status.
399
+ * @param {Response} response @param {any} parsed
400
+ */
401
+ function parseError(response, parsed) {
402
+ const error = parsed?.error;
403
+ const retryAfterHeader = response.headers.get('retry-after');
404
+ const headerSeconds = retryAfterHeader !== null && /^\d+$/.test(retryAfterHeader) ? Number(retryAfterHeader) : undefined;
405
+ const detailSeconds = Number.isFinite(error?.details?.retryAfterSeconds) ? Number(error.details.retryAfterSeconds) : undefined;
406
+ if (error && typeof error.code === 'string') {
407
+ return new ApiError({
408
+ status: response.status,
409
+ code: error.code,
410
+ message: typeof error.message === 'string' ? error.message : '',
411
+ requestId: typeof error.requestId === 'string' ? error.requestId : (response.headers.get('request-id') ?? undefined),
412
+ details: error.details && typeof error.details === 'object' ? error.details : undefined,
413
+ retryAfterSeconds: headerSeconds ?? detailSeconds,
414
+ });
415
+ }
416
+ return new ApiError({
417
+ status: response.status,
418
+ code: `http_${response.status}`,
419
+ message: response.statusText || 'unexpected response',
420
+ requestId: response.headers.get('request-id') ?? undefined,
421
+ retryAfterSeconds: headerSeconds,
422
+ });
423
+ }
424
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/remote/client.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC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AC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/H,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,IAAI,QAAQ,CAAC;YAClB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC/D,SAAS,EAAE,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC;YACpH,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;YACvF,iBAAiB,EAAE,aAAa,IAAI,aAAa;SAClD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC;QAClB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,QAAQ,CAAC,MAAM,EAAE;QAC/B,OAAO,EAAE,QAAQ,CAAC,UAAU,IAAI,qBAAqB;QACrD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,SAAS;QAC1D,iBAAiB,EAAE,aAAa;KACjC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The Cloud calls the CLI and sidecar make beyond the shared session endpoints (contract sections
3
+ * 2.5, 3 and 5): sign-in, the current account, projects, branches, sessions and members. Every one
4
+ * goes through {@link FeedbackClient}, so retries, timeouts and error envelopes are the same as for
5
+ * Standalone.
6
+ */
7
+ import { FeedbackClient, ProjectApi } from './index.js';
8
+ import type { Account, AccountRecord } from './account.js';
9
+ type Auth = {
10
+ authorizationHeader(): string;
11
+ };
12
+ export type CloudProject = {
13
+ id: string;
14
+ plan: 'cloud';
15
+ name: string;
16
+ role: 'owner' | 'reviewer';
17
+ createdAt: string;
18
+ };
19
+ export type CloudBranch = {
20
+ id: string;
21
+ name: string;
22
+ isDefault: boolean;
23
+ createdAt: string;
24
+ };
25
+ export type CloudSession = {
26
+ id: string;
27
+ projectId: string;
28
+ branchId: string;
29
+ revision: number;
30
+ createdAt: string;
31
+ expiresAt: string | null;
32
+ };
33
+ export type CloudMember = {
34
+ accountId: string;
35
+ email: string;
36
+ name: string;
37
+ role: 'owner' | 'reviewer';
38
+ joinedAt: string;
39
+ };
40
+ export declare const cloudClient: (apiUrl: string, options?: {
41
+ fetch?: typeof fetch;
42
+ maxAttempts?: number;
43
+ }) => FeedbackClient;
44
+ /** Always `{accepted: true}`, whether or not a code was sent (no account enumeration). */
45
+ export declare function requestSignInCode(client: FeedbackClient, email: string): Promise<void>;
46
+ /**
47
+ * Single attempt: a verification whose answer was lost has consumed the code, and a retry would
48
+ * only count as a failed attempt. The caller asks for a new code instead.
49
+ */
50
+ export declare function verifySignInCode(client: FeedbackClient, email: string, code: string): Promise<AccountRecord>;
51
+ /** `POST /v0/auth/sign-out` answers 204 with no body, which the JSON transport treats as an error. */
52
+ export declare function signOut(client: FeedbackClient, auth: Auth): Promise<void>;
53
+ export declare function currentAccount(client: FeedbackClient, auth: Auth): Promise<Account>;
54
+ export declare function listCloudProjects(client: FeedbackClient, auth: Auth): Promise<CloudProject[]>;
55
+ export declare function createCloudProject(client: FeedbackClient, auth: Auth, name: string): Promise<CloudProject>;
56
+ /** Project calls with an account token. `keys` is only the request credential on Cloud. */
57
+ export declare const cloudProject: (client: FeedbackClient, projectId: string, auth: Auth) => ProjectApi<Auth>;
58
+ export declare function getCloudProject(api: ProjectApi): Promise<CloudProject & {
59
+ branches: CloudBranch[];
60
+ }>;
61
+ /**
62
+ * The project's session (contract section 4.7): one per project, because a comment's branch is a
63
+ * label on the comment rather than a session per branch. The same rule as the dashboard's review
64
+ * links: select the newest default-branch session, then the newest project session.
65
+ * If neither exists, owners can create a session on the default branch.
66
+ */
67
+ export declare function findOrCreateProjectSession(api: ProjectApi, project: {
68
+ role: CloudProject['role'];
69
+ branches: CloudBranch[];
70
+ }): Promise<CloudSession>;
71
+ export declare function listCloudMembers(api: ProjectApi): Promise<CloudMember[]>;
72
+ export {};
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The Cloud calls the CLI and sidecar make beyond the shared session endpoints (contract sections
3
+ * 2.5, 3 and 5): sign-in, the current account, projects, branches, sessions and members. Every one
4
+ * goes through {@link FeedbackClient}, so retries, timeouts and error envelopes are the same as for
5
+ * Standalone.
6
+ */
7
+ import { FeedbackClient, newIdempotencyKey } from './index.js';
8
+ export const cloudClient = (apiUrl, options = {}) => new FeedbackClient({ baseUrl: apiUrl, product: 'feedback-cli', fetch: options.fetch, retry: { maxAttempts: options.maxAttempts ?? 3 } });
9
+ /** Always `{accepted: true}`, whether or not a code was sent (no account enumeration). */
10
+ export async function requestSignInCode(client, email) {
11
+ await client.request('POST', '/v0/auth/email-code', { body: { email } });
12
+ }
13
+ /**
14
+ * Single attempt: a verification whose answer was lost has consumed the code, and a retry would
15
+ * only count as a failed attempt. The caller asks for a new code instead.
16
+ */
17
+ export async function verifySignInCode(client, email, code) {
18
+ const single = new FeedbackClient({ baseUrl: client.baseUrl, fetch: client.fetch, product: 'feedback-cli', retry: { maxAttempts: 1 } });
19
+ const { body } = await single.request('POST', '/v0/auth/email-code/verify', { body: { email, code } });
20
+ return { token: body.token, expiresAt: body.expiresAt, account: body.account };
21
+ }
22
+ /** `POST /v0/auth/sign-out` answers 204 with no body, which the JSON transport treats as an error. */
23
+ export async function signOut(client, auth) {
24
+ const response = await client.fetch(`${client.baseUrl}/v0/auth/sign-out`, {
25
+ method: 'POST', headers: { authorization: auth.authorizationHeader(), 'feedback-client': client.userAgent }, redirect: 'error',
26
+ signal: AbortSignal.timeout(client.timeoutMs),
27
+ });
28
+ await response.body?.cancel();
29
+ if (response.status !== 204 && response.status !== 401)
30
+ throw new Error(`Sign-out failed (HTTP ${response.status})`);
31
+ }
32
+ export async function currentAccount(client, auth) {
33
+ return (await client.request('GET', '/v0/me', { auth })).body.account;
34
+ }
35
+ export async function listCloudProjects(client, auth) {
36
+ const projects = [];
37
+ let cursor;
38
+ do {
39
+ const { body } = await client.request('GET', '/v0/cloud/projects', { auth, query: { cursor, limit: 100 } });
40
+ projects.push(...body.projects);
41
+ cursor = body.nextCursor ?? undefined;
42
+ } while (cursor);
43
+ return projects;
44
+ }
45
+ export async function createCloudProject(client, auth, name) {
46
+ return (await client.request('POST', '/v0/cloud/projects', { auth, body: { name }, idempotencyKey: newIdempotencyKey() })).body.project;
47
+ }
48
+ /** Project calls with an account token. `keys` is only the request credential on Cloud. */
49
+ export const cloudProject = (client, projectId, auth) => client.project(projectId, auth);
50
+ export async function getCloudProject(api) {
51
+ return api.getProject();
52
+ }
53
+ /**
54
+ * The project's session (contract section 4.7): one per project, because a comment's branch is a
55
+ * label on the comment rather than a session per branch. The same rule as the dashboard's review
56
+ * links: select the newest default-branch session, then the newest project session.
57
+ * If neither exists, owners can create a session on the default branch.
58
+ */
59
+ export async function findOrCreateProjectSession(api, project) {
60
+ const newest = async (branchId) => (await api.client.request('GET', `/v0/projects/${encodeURIComponent(api.projectId)}/sessions`, { auth: api.keys, query: { limit: 1, ...(branchId ? { branchId } : {}) } })).body.sessions[0];
61
+ const defaultBranch = project.branches.find((branch) => branch.isDefault);
62
+ const found = (defaultBranch && await newest(defaultBranch.id)) || await newest();
63
+ if (found)
64
+ return found;
65
+ if (project.role !== 'owner')
66
+ throw new Error('This Cloud project has no session yet, and only an owner can create one. Ask an owner to link it first.');
67
+ return api.createSession({});
68
+ }
69
+ export async function listCloudMembers(api) {
70
+ return (await api.client.request('GET', `/v0/projects/${encodeURIComponent(api.projectId)}/members`, { auth: api.keys })).body.members;
71
+ }
72
+ //# sourceMappingURL=cloudApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudApi.js","sourceRoot":"","sources":["../../src/remote/cloudApi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAc,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAS3E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,UAA0D,EAAE,EAAE,EAAE,CAC1G,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAE3I,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAsB,EAAE,KAAa;IAC3E,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAsB,EAAE,KAAa,EAAE,IAAY;IACxF,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACxI,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,4BAA4B,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE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