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,111 @@
1
+ import { readdir, readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ const textFile = /\.(js|mjs|cjs|css|html|json|map|txt)$/i;
4
+ /**
5
+ * The attributes local mode stamps. In a shared build their presence is unambiguous: the
6
+ * only thing that emits them is this transform, so finding one is always our fault and
7
+ * always the leak this whole scheme exists to prevent.
8
+ */
9
+ const localAttributes = ['data-fb-src=', 'data-fb-component='];
10
+ /**
11
+ * Every string the bundle must not contain.
12
+ *
13
+ * Paths are checked without their extension as well: `src/pages/Pricing` is as much of a
14
+ * file tree as `src/pages/Pricing.tsx`, and a bundler that rewrites extensions would
15
+ * otherwise slip through.
16
+ *
17
+ * Component names are deliberately NOT needles, which took a failing check to notice. A
18
+ * component's name is an identifier in the developer's own code: an unminified bundle
19
+ * contains `function PricingCard()` whatever this tool does, so searching for the bare name
20
+ * reports a leak on every such build. A check that fires when nothing is wrong gets turned
21
+ * off, and then it is not protecting anything. What is actually ours to leak is the
22
+ * attribute carrying the name, so that is what is looked for.
23
+ */
24
+ export function needlesFrom(manifest, secret) {
25
+ const paths = new Set();
26
+ for (const entry of manifest.entries) {
27
+ paths.add(entry.file);
28
+ const withoutExtension = entry.file.replace(/\.[jt]sx?$/, '');
29
+ if (withoutExtension !== entry.file) {
30
+ paths.add(withoutExtension);
31
+ }
32
+ }
33
+ return {
34
+ paths: [...paths],
35
+ attributes: localAttributes,
36
+ secrets: secret ? [secret] : [],
37
+ };
38
+ }
39
+ export async function checkBundle(outputDirectory, manifest, secret) {
40
+ const needles = needlesFrom(manifest, secret);
41
+ const files = await listFiles(outputDirectory);
42
+ const leaks = [];
43
+ let bytesScanned = 0;
44
+ for (const file of files) {
45
+ const relative = path.relative(outputDirectory, file);
46
+ const text = await readFile(file, 'utf8').catch(() => null);
47
+ if (text === null) {
48
+ continue;
49
+ }
50
+ bytesScanned += text.length;
51
+ // A source map beside the bundle carries the paths and the source itself, so its mere
52
+ // presence is the finding; there is no need to look inside it.
53
+ if (file.endsWith('.map')) {
54
+ leaks.push({ kind: 'sourcemap', needle: relative, file: relative, context: 'source map emitted' });
55
+ continue;
56
+ }
57
+ for (const [kind, list] of [
58
+ ['attribute', needles.attributes],
59
+ ['path', needles.paths],
60
+ ['secret', needles.secrets],
61
+ ]) {
62
+ for (const needle of list) {
63
+ const at = text.indexOf(needle);
64
+ if (at !== -1) {
65
+ leaks.push({
66
+ kind,
67
+ // Never echo the secret itself into a report that may be pasted into an issue.
68
+ needle: kind === 'secret' ? '«project secret»' : needle,
69
+ file: relative,
70
+ context: kind === 'secret' ? '«redacted»' : text.slice(Math.max(0, at - 40), at + needle.length + 40),
71
+ });
72
+ }
73
+ }
74
+ }
75
+ }
76
+ return {
77
+ filesScanned: files.length,
78
+ bytesScanned,
79
+ needles: needles.paths.length + needles.attributes.length + needles.secrets.length,
80
+ leaks,
81
+ };
82
+ }
83
+ async function listFiles(directory) {
84
+ const entries = await readdir(directory, { withFileTypes: true }).catch(() => []);
85
+ const found = [];
86
+ for (const entry of entries) {
87
+ const full = path.join(directory, entry.name);
88
+ if (entry.isDirectory()) {
89
+ found.push(...(await listFiles(full)));
90
+ }
91
+ else if (textFile.test(entry.name)) {
92
+ found.push(full);
93
+ }
94
+ }
95
+ return found;
96
+ }
97
+ export function formatReport(report) {
98
+ if (report.leaks.length === 0) {
99
+ return `feedback: ${report.filesScanned} files, ${report.needles} needles, nothing leaked.`;
100
+ }
101
+ const lines = [`feedback: ${report.leaks.length} leak(s) in the built bundle.`];
102
+ for (const leak of report.leaks.slice(0, 20)) {
103
+ lines.push(` ${leak.kind}: ${leak.needle}`);
104
+ lines.push(` in ${leak.file}: …${leak.context.replace(/\s+/g, ' ')}…`);
105
+ }
106
+ if (report.leaks.length > 20) {
107
+ lines.push(` …and ${report.leaks.length - 20} more.`);
108
+ }
109
+ return lines.join('\n');
110
+ }
111
+ //# sourceMappingURL=bundleCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundleCheck.js","sourceRoot":"","sources":["../../src/integration/bundleCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AA2B7B,MAAM,QAAQ,GAAG,wCAAwC,CAAC;AAE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,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,134 @@
1
+ import type { Manifest } from './manifest.js';
2
+ /**
3
+ * Fetching comments, and the manifests needed to read them.
4
+ *
5
+ * The mirror of `manifestUpload`, and it signs the same way and for the same reason: the secret
6
+ * never travels, the request proves possession of it. A GET has no body, so the request's own
7
+ * parameters are signed - see `pullPayload` in the cloud, which must agree with this byte for
8
+ * byte. The test drives this client against that server rather than restating either, because a
9
+ * contract asserted from one end is not asserted at all (RAW-POLICY rule 7).
10
+ *
11
+ * `have` is the list of builds already on this machine. Without it every pull would re-download
12
+ * every manifest a project has ever produced, which for a busy repository is megabytes per
13
+ * invocation to learn nothing new.
14
+ */
15
+ export type PulledComment = {
16
+ id: string;
17
+ projectId: string;
18
+ buildId: string;
19
+ authorId: string;
20
+ author: string;
21
+ body: string;
22
+ status: 'open' | 'resolved';
23
+ createdAt: string;
24
+ editedAt: string | null;
25
+ [key: string]: unknown;
26
+ };
27
+ export type PullOutcome = {
28
+ ok: true;
29
+ comments: PulledComment[];
30
+ manifests: Record<string, Manifest>;
31
+ truncated: boolean;
32
+ } | {
33
+ ok: false;
34
+ reason: string;
35
+ retryable: boolean;
36
+ };
37
+ export type PullOptions = {
38
+ apiBase: string;
39
+ projectId: string;
40
+ secret: string;
41
+ /** Builds whose manifests are already on disk, so the server need not send them again. */
42
+ have?: string[];
43
+ buildId?: string;
44
+ timeoutMs?: number;
45
+ fetchImpl?: typeof fetch;
46
+ now?: () => Date;
47
+ };
48
+ /**
49
+ * The string both ends sign. Must agree with the cloud's `machinePayload` byte for byte.
50
+ *
51
+ * `purpose` is inside the signed string rather than beside it: otherwise a signature proving
52
+ * "this machine may read comments" would also prove "this machine may resolve one", because the
53
+ * signed bytes would be identical.
54
+ */
55
+ export declare function machinePayload(purpose: string, projectId: string, issuedAt: string, parts: string[]): string;
56
+ export declare function signMachine(secret: string, purpose: string, projectId: string, issuedAt: string, parts: string[]): string;
57
+ export declare function pullPayload(projectId: string, issuedAt: string, have: string[]): string;
58
+ export declare function signPull(secret: string, projectId: string, issuedAt: string, have: string[]): string;
59
+ export type StatusOutcome = {
60
+ ok: true;
61
+ }
62
+ /**
63
+ * `gone` means the comment is not in the cloud any more - deleted by its author, or the
64
+ * project reset. There is nothing left to synchronise, so the caller must stop retrying and
65
+ * forget the record. Without this a deleted comment produces a warning on every pull, forever,
66
+ * about work that can never complete; and a warning that can never be acted on is one people
67
+ * learn to scroll past, which costs the warnings that matter.
68
+ */
69
+ | {
70
+ ok: false;
71
+ reason: string;
72
+ gone?: boolean;
73
+ };
74
+ /**
75
+ * Tells the cloud a comment is resolved, so the reviewer's screen moves.
76
+ *
77
+ * Kept separate from the local record on purpose. The agent's work is done whether or not this
78
+ * request succeeds, so a failure here must not undo the local resolution - but it must also not
79
+ * be swallowed, because a comment that is closed here and open there is precisely the silent
80
+ * divergence this project keeps producing. The caller records the outcome and `pull` retries
81
+ * what did not land.
82
+ */
83
+ export declare function pushCommentStatus(options: {
84
+ apiBase: string;
85
+ projectId: string;
86
+ secret: string;
87
+ commentId: string;
88
+ status: 'open' | 'resolved';
89
+ timeoutMs?: number;
90
+ fetchImpl?: typeof fetch;
91
+ now?: () => Date;
92
+ }): Promise<StatusOutcome>;
93
+ export type FileOutcome = {
94
+ ok: true;
95
+ bytes: Uint8Array;
96
+ } | {
97
+ ok: false;
98
+ reason: string;
99
+ };
100
+ /**
101
+ * One file of a pulled comment (contract section 19.3, `comment-file:v1`): the comment and the file
102
+ * are both signed, so a captured request fetches that one file. v0 only: the legacy API never had
103
+ * files. Never more than `maxBytes` is read (the size Cloud listed).
104
+ */
105
+ export declare function fetchCommentFile(options: {
106
+ apiBase: string;
107
+ projectId: string;
108
+ secret: string;
109
+ commentId: string;
110
+ fileId: string;
111
+ maxBytes: number;
112
+ timeoutMs?: number;
113
+ fetchImpl?: typeof fetch;
114
+ now?: () => Date;
115
+ }): Promise<FileOutcome>;
116
+ /** The body, or null as soon as it passes `max` bytes. */
117
+ export declare function readCapped(response: Response, max: number): Promise<Uint8Array | null>;
118
+ export declare function pullComments(options: PullOptions): Promise<PullOutcome>;
119
+ /**
120
+ * Fetches the work-order recipe.
121
+ *
122
+ * Returns null rather than throwing on anything at all. The caller has a recipe already - the
123
+ * one bundled with the package - so a failure here is not an error, it is simply no upgrade.
124
+ * Making our server's availability a precondition for someone exporting their own comments would
125
+ * be the wrong trade by a wide margin.
126
+ */
127
+ export declare function fetchRecipe(options: {
128
+ apiBase: string;
129
+ projectId: string;
130
+ secret: string;
131
+ timeoutMs?: number;
132
+ fetchImpl?: typeof fetch;
133
+ now?: () => Date;
134
+ }): Promise<unknown | null>;
@@ -0,0 +1,260 @@
1
+ import { createHmac } from 'node:crypto';
2
+ import { pluginPath, routedFetch } from './apiRoutes.js';
3
+ /**
4
+ * The string both ends sign. Must agree with the cloud's `machinePayload` byte for byte.
5
+ *
6
+ * `purpose` is inside the signed string rather than beside it: otherwise a signature proving
7
+ * "this machine may read comments" would also prove "this machine may resolve one", because the
8
+ * signed bytes would be identical.
9
+ */
10
+ export function machinePayload(purpose, projectId, issuedAt, parts) {
11
+ return [`feedback:${purpose}`, projectId, issuedAt, ...parts].join('\n');
12
+ }
13
+ export function signMachine(secret, purpose, projectId, issuedAt, parts) {
14
+ return createHmac('sha256', secret)
15
+ .update(machinePayload(purpose, projectId, issuedAt, parts)).digest('hex');
16
+ }
17
+ export function pullPayload(projectId, issuedAt, have) {
18
+ return machinePayload('pull:v1', projectId, issuedAt, [[...have].sort().join(',')]);
19
+ }
20
+ export function signPull(secret, projectId, issuedAt, have) {
21
+ return createHmac('sha256', secret).update(pullPayload(projectId, issuedAt, have)).digest('hex');
22
+ }
23
+ /**
24
+ * Tells the cloud a comment is resolved, so the reviewer's screen moves.
25
+ *
26
+ * Kept separate from the local record on purpose. The agent's work is done whether or not this
27
+ * request succeeds, so a failure here must not undo the local resolution - but it must also not
28
+ * be swallowed, because a comment that is closed here and open there is precisely the silent
29
+ * divergence this project keeps producing. The caller records the outcome and `pull` retries
30
+ * what did not land.
31
+ */
32
+ export async function pushCommentStatus(options) {
33
+ const fetchImpl = options.fetchImpl ?? fetch;
34
+ const issuedAt = (options.now?.() ?? new Date()).toISOString();
35
+ const signature = signMachine(options.secret, 'comment-status:v1', options.projectId, issuedAt, [options.commentId, options.status]);
36
+ const controller = new AbortController();
37
+ const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 8000);
38
+ try {
39
+ // The route set the API speaks: see apiRoutes.ts. Only the path differs.
40
+ const { response } = await routedFetch(options.apiBase, fetchImpl, (legacy) => ({
41
+ url: `${options.apiBase.replace(/\/$/, '')}${pluginPath(legacy, 'comment', options.commentId)}`,
42
+ init: {
43
+ method: 'PATCH',
44
+ // Signed: a redirect would replay the signature and body to wherever it points.
45
+ redirect: 'error',
46
+ headers: {
47
+ 'content-type': 'application/json',
48
+ 'x-feedback-project': options.projectId,
49
+ 'x-feedback-signature': signature,
50
+ 'x-feedback-timestamp': issuedAt,
51
+ },
52
+ body: JSON.stringify({ status: options.status }),
53
+ signal: controller.signal,
54
+ },
55
+ }));
56
+ if (response.ok)
57
+ return { ok: true };
58
+ /**
59
+ * A 404 is two different things and they need opposite responses.
60
+ *
61
+ * "No such comment" means it was deleted in the cloud: nothing left to synchronise, so the
62
+ * record should be forgotten. But a deployment that does not have this route yet answers 404
63
+ * as well - and the first version of this code read that as "deleted" and dropped a perfectly
64
+ * good record, permanently, because the API was one deploy behind.
65
+ *
66
+ * So the body has to say so. Only the handler's own message counts as gone; anything else
67
+ * stays retryable, which is the safe direction: a retry costs one request, a wrongly
68
+ * forgotten resolution never reaches the reviewer and nobody finds out.
69
+ */
70
+ if (response.status === 404) {
71
+ // The legacy body is `{"error": "no such comment"}`; the Worker's v0 envelope says it in
72
+ // `error.details.reason` (contract v0 section 19.3).
73
+ const body = await response.json().catch(() => null);
74
+ if (body?.error === 'no such comment'
75
+ || (typeof body?.error === 'object' && body.error?.details?.reason === 'comment_not_found')) {
76
+ return { ok: false, gone: true, reason: 'that comment no longer exists in the cloud' };
77
+ }
78
+ return {
79
+ ok: false,
80
+ reason: 'the API has no route for this - it is probably running an older deployment',
81
+ };
82
+ }
83
+ return { ok: false, reason: `the API answered ${response.status}` };
84
+ }
85
+ catch (error) {
86
+ return { ok: false, reason: describe(error) };
87
+ }
88
+ finally {
89
+ clearTimeout(timeout);
90
+ }
91
+ }
92
+ /**
93
+ * One file of a pulled comment (contract section 19.3, `comment-file:v1`): the comment and the file
94
+ * are both signed, so a captured request fetches that one file. v0 only: the legacy API never had
95
+ * files. Never more than `maxBytes` is read (the size Cloud listed).
96
+ */
97
+ export async function fetchCommentFile(options) {
98
+ const fetchImpl = options.fetchImpl ?? fetch;
99
+ const issuedAt = (options.now?.() ?? new Date()).toISOString();
100
+ const signature = signMachine(options.secret, 'comment-file:v1', options.projectId, issuedAt, [options.commentId, options.fileId]);
101
+ const controller = new AbortController();
102
+ const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 60_000);
103
+ try {
104
+ const response = await fetchImpl(`${options.apiBase.replace(/\/$/, '')}/v0/plugin/comments/${encodeURIComponent(options.commentId)}/files/${encodeURIComponent(options.fileId)}`, {
105
+ // Signed: a redirect would replay the signature to wherever it points.
106
+ redirect: 'error',
107
+ headers: { 'x-feedback-project': options.projectId, 'x-feedback-signature': signature, 'x-feedback-timestamp': issuedAt },
108
+ signal: controller.signal,
109
+ });
110
+ if (!response.ok) {
111
+ const body = await response.json().catch(() => null);
112
+ const reason = body?.error?.details?.reason;
113
+ if (response.status === 404) {
114
+ return { ok: false, reason: reason === 'file_not_found' ? 'it is no longer in the cloud' : 'the API has no route for files (an older deployment)' };
115
+ }
116
+ if (response.status === 401)
117
+ return { ok: false, reason: 'the API refused this machine\'s project secret' };
118
+ if (response.status === 403 && reason === 'media_disabled')
119
+ return { ok: false, reason: 'this deployment stores no files' };
120
+ return { ok: false, reason: `the API answered ${response.status}` };
121
+ }
122
+ if (Number(response.headers.get('content-length') ?? 0) > options.maxBytes) {
123
+ await response.body?.cancel();
124
+ return { ok: false, reason: 'it is larger than Cloud listed' };
125
+ }
126
+ const bytes = await readCapped(response, options.maxBytes);
127
+ return bytes ? { ok: true, bytes } : { ok: false, reason: 'it is larger than Cloud listed' };
128
+ }
129
+ catch (error) {
130
+ return { ok: false, reason: describe(error) };
131
+ }
132
+ finally {
133
+ clearTimeout(timeout);
134
+ }
135
+ }
136
+ /** The body, or null as soon as it passes `max` bytes. */
137
+ export async function readCapped(response, max) {
138
+ const reader = response.body?.getReader();
139
+ if (!reader)
140
+ return new Uint8Array();
141
+ const chunks = [];
142
+ let size = 0;
143
+ for (;;) {
144
+ const { done, value } = await reader.read();
145
+ if (done)
146
+ break;
147
+ size += value.byteLength;
148
+ if (size > max) {
149
+ await reader.cancel();
150
+ return null;
151
+ }
152
+ chunks.push(value);
153
+ }
154
+ return new Uint8Array(Buffer.concat(chunks));
155
+ }
156
+ export async function pullComments(options) {
157
+ const fetchImpl = options.fetchImpl ?? fetch;
158
+ const have = options.have ?? [];
159
+ const issuedAt = (options.now?.() ?? new Date()).toISOString();
160
+ const signature = signPull(options.secret, options.projectId, issuedAt, have);
161
+ const urlFor = (legacy) => {
162
+ const url = new URL(`${options.apiBase.replace(/\/$/, '')}${pluginPath(legacy, 'pull')}`);
163
+ // Sorted here as well as in the payload: the signature covers the sorted list, so sending an
164
+ // unsorted one would verify on a server that re-sorts and fail on one that does not. One
165
+ // order, decided in one place.
166
+ if (have.length > 0)
167
+ url.searchParams.set('have', [...have].sort().join(','));
168
+ if (options.buildId)
169
+ url.searchParams.set('buildId', options.buildId);
170
+ return url.toString();
171
+ };
172
+ const controller = new AbortController();
173
+ const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 15_000);
174
+ try {
175
+ const { response } = await routedFetch(options.apiBase, fetchImpl, (legacy) => ({ url: urlFor(legacy), init: {
176
+ redirect: 'error',
177
+ headers: {
178
+ 'x-feedback-project': options.projectId,
179
+ 'x-feedback-signature': signature,
180
+ 'x-feedback-timestamp': issuedAt,
181
+ },
182
+ signal: controller.signal,
183
+ } }));
184
+ if (response.status === 401) {
185
+ return {
186
+ ok: false,
187
+ retryable: false,
188
+ reason: 'the API refused the request. Either this project is not linked to that deployment, '
189
+ + 'or the secret on this machine is stale - re-link the project and try again.',
190
+ };
191
+ }
192
+ if (!response.ok) {
193
+ // A 5xx may pass; a 4xx will not become valid on a second attempt.
194
+ return {
195
+ ok: false,
196
+ retryable: response.status >= 500,
197
+ reason: `the API answered ${response.status}`,
198
+ };
199
+ }
200
+ const body = await response.json();
201
+ return {
202
+ ok: true,
203
+ comments: body.comments ?? [],
204
+ manifests: body.manifests ?? {},
205
+ truncated: Boolean(body.truncated),
206
+ };
207
+ }
208
+ catch (error) {
209
+ return { ok: false, retryable: true, reason: describe(error) };
210
+ }
211
+ finally {
212
+ clearTimeout(timeout);
213
+ }
214
+ }
215
+ /** Walks the cause chain, because a bare "fetch failed" tells a developer nothing. */
216
+ function describe(error) {
217
+ const parts = [];
218
+ let current = error;
219
+ while (current instanceof Error) {
220
+ parts.push(current.message);
221
+ current = current.cause;
222
+ }
223
+ return parts.join(': ') || String(error);
224
+ }
225
+ /**
226
+ * Fetches the work-order recipe.
227
+ *
228
+ * Returns null rather than throwing on anything at all. The caller has a recipe already - the
229
+ * one bundled with the package - so a failure here is not an error, it is simply no upgrade.
230
+ * Making our server's availability a precondition for someone exporting their own comments would
231
+ * be the wrong trade by a wide margin.
232
+ */
233
+ export async function fetchRecipe(options) {
234
+ const fetchImpl = options.fetchImpl ?? fetch;
235
+ const issuedAt = (options.now?.() ?? new Date()).toISOString();
236
+ const signature = signMachine(options.secret, 'recipe:v1', options.projectId, issuedAt, []);
237
+ const controller = new AbortController();
238
+ const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 5000);
239
+ try {
240
+ const { response } = await routedFetch(options.apiBase, fetchImpl, (legacy) => ({ url: `${options.apiBase.replace(/\/$/, '')}${pluginPath(legacy, 'recipe')}`, init: {
241
+ redirect: 'error',
242
+ headers: {
243
+ 'x-feedback-project': options.projectId,
244
+ 'x-feedback-signature': signature,
245
+ 'x-feedback-timestamp': issuedAt,
246
+ },
247
+ signal: controller.signal,
248
+ } }));
249
+ if (!response.ok)
250
+ return null;
251
+ return await response.json();
252
+ }
253
+ catch {
254
+ return null;
255
+ }
256
+ finally {
257
+ clearTimeout(timeout);
258
+ }
259
+ }
260
+ //# sourceMappingURL=commentPull.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commentPull.js","sourceRoot":"","sources":["../../src/integration/commentPull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA6CzD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EAAE,SAAiB,EAAE,QAAgB,EAAE,KAAe;IAErE,OAAO,CAAC,YAAY,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,W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,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE;gBACnK,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE;oBACP,oBAAoB,EAAE,OAAO,CAAC,SAAS;oBACvC,sBAAsB,EAAE,SAAS;oBACjC,sBAAsB,EAAE,QAAQ;iBACjC;gBACD,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,EAAE,CAAC,CAAC,CAAC;QACN,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * An environment override, the origin recorded by `feedback link`, the API of this project's saved
3
+ * remote (`.feedback/remote.json`: a Cloud session build must reach the deployment it is linked to,
4
+ * never fall through to the default), else the default. Every shared-build adapter resolves its API
5
+ * here.
6
+ */
7
+ export declare function configuredApi(projectRoot: string, env: NodeJS.ProcessEnv, usage?: 'machine' | 'browser'): Promise<string>;
@@ -0,0 +1,24 @@
1
+ import { readCredentials } from '../storage/localCredentials.js';
2
+ import { readSavedRemote } from '../storage/savedRemote.js';
3
+ import { SharedBuildError } from './sharedBuild.js';
4
+ import { apiBaseFor, defaultApiBase } from './sharedInject.js';
5
+ /**
6
+ * An environment override, the origin recorded by `feedback link`, the API of this project's saved
7
+ * remote (`.feedback/remote.json`: a Cloud session build must reach the deployment it is linked to,
8
+ * never fall through to the default), else the default. Every shared-build adapter resolves its API
9
+ * here.
10
+ */
11
+ export async function configuredApi(projectRoot, env, usage = 'machine') {
12
+ const saved = (await readSavedRemote(projectRoot))?.apiUrl;
13
+ const remote = typeof saved === 'string' && saved.trim() ? saved.trim().replace(/\/$/, '') : undefined;
14
+ const override = env.FEEDBACK_API_URL?.trim();
15
+ const origin = override || (await readCredentials(projectRoot))?.cloudOrigin || remote;
16
+ const resolved = apiBaseFor({ FEEDBACK_API_URL: origin ?? undefined }, { machine: usage === 'machine' });
17
+ // Only an explicit override may send a remote-linked project to the default service.
18
+ if (!override && remote && resolved === defaultApiBase && remote !== defaultApiBase) {
19
+ throw new SharedBuildError(`feedback: this project is linked to ${remote} (.feedback/remote.json), but its API would resolve to ${defaultApiBase}. `
20
+ + 'Set FEEDBACK_API_URL explicitly, or re-run `feedback link` against the linked API.');
21
+ }
22
+ return resolved;
23
+ }
24
+ //# sourceMappingURL=configuredApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuredApi.js","sourceRoot":"","sources":["../../src/integration/configuredApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAmB,EAAE,GAAsB,EAAE,QAA+B,SAAS;IAErF,MAAM,KAAK,GAAG,CAAC,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC;IAC3D,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,MAAM,QAAQ,GAAG,GAAG,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAG,QAAQ,IAAI,CAAC,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,IAAI,MAAM,CAAC;IACvF,MAAM,QAAQ,GAAG,UAAU,CAAC,EAAE,gBAAgB,EAAE,MAAM,IAAI,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC,CAAC;IACzG,qFAAqF;IACrF,IAAI,CAAC,QAAQ,IAAI,MAAM,IAAI,QAAQ,KAAK,cAAc,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;QACpF,MAAM,IAAI,gBAAgB,CAAC,uCAAuC,MAAM,0DAA0D,cAAc,IAAI;cAChJ,oFAAoF,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What a dev server tells its overlay about the cloud.
3
+ *
4
+ * A project whose dev server can read `FEEDBACK_SECRET` (the environment, `.env.local`, `.env`, or
5
+ * the cache `feedback link` writes) is linked to the cloud, so its local page runs the same widget
6
+ * as its previews: the developer signs in, and comments are read and written in the cloud, anchored
7
+ * to the file and line the dev server stamped. Without a secret the answer is `null` and the page
8
+ * keeps local mode exactly as it was: a nickname, comments in `.feedback/`, no account.
9
+ *
10
+ * Only public routing goes to the browser (the project id, the session, the API), the same values
11
+ * every preview carries. The secret signs one request here, for the session, and stays here.
12
+ */
13
+ export type DevCloud = {
14
+ projectId: string;
15
+ sessionId: string;
16
+ apiBase: string;
17
+ };
18
+ export type DevCloudAnswer = {
19
+ cloud: DevCloud | null;
20
+ notice?: string;
21
+ };
22
+ export declare function devCloud(projectRoot: string, env?: NodeJS.ProcessEnv, fetchImpl?: typeof fetch): Promise<DevCloudAnswer>;
23
+ /**
24
+ * One answer per minute at most, shared by concurrent requests: every page load asks, and a signed
25
+ * request to the API per reload would be noise. A secret added to `.env` is seen within a minute.
26
+ */
27
+ export declare function cachedDevCloud(projectRoot: string, ttlMs?: number, load?: () => Promise<DevCloudAnswer>): () => Promise<DevCloudAnswer>;
@@ -0,0 +1,56 @@
1
+ import { resolveSecret, withProjectEnv } from '../storage/localCredentials.js';
2
+ import { projectIdFromSecret } from '../core/projectSecret.js';
3
+ import { readRemoteConfig } from '../remote/config.js';
4
+ import { resolveBuildSession } from './buildSession.js';
5
+ import { configuredApi } from './configuredApi.js';
6
+ const cloudProject = /^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$/;
7
+ const configurationNotice = '[Ontrackd feedback] FEEDBACK_SECRET is set, but cloud configuration could not be resolved, so this page is in local mode.';
8
+ const unavailableNotice = '[Ontrackd feedback] FEEDBACK_SECRET is set, but the cloud could not be reached, so this page is in local mode.';
9
+ export async function devCloud(projectRoot, env = process.env, fetchImpl = fetch) {
10
+ // The switch that keeps a linked project local on purpose (cloudSync.ts, the MCP server) keeps its page local too.
11
+ if (env.FEEDBACK_CLOUD_SYNC === '0')
12
+ return { cloud: null };
13
+ const projectEnv = await withProjectEnv(projectRoot, env);
14
+ const configuredSecret = projectEnv.FEEDBACK_SECRET?.trim();
15
+ const explicitLegacyProject = projectEnv.FEEDBACK_PROJECT_ID?.trim();
16
+ if (configuredSecret && !projectIdFromSecret(configuredSecret)) {
17
+ // Legacy two-variable projects use the older sidecar path and remain local intentionally.
18
+ if (explicitLegacyProject)
19
+ return { cloud: null };
20
+ return { cloud: null, notice: configurationNotice };
21
+ }
22
+ const { projectId, secret } = await resolveSecret(projectRoot, env);
23
+ if (!projectId && !secret)
24
+ return { cloud: null };
25
+ // `feedback remote init` linked this project the older way, with its own sidecar sync: left alone.
26
+ if (await readRemoteConfig(projectRoot, env).catch(() => null))
27
+ return { cloud: null };
28
+ if (!projectId || !secret || projectIdFromSecret(secret) !== projectId || !cloudProject.test(projectId)) {
29
+ return { cloud: null, notice: configurationNotice };
30
+ }
31
+ try {
32
+ const apiBase = await configuredApi(projectRoot, env);
33
+ const { sessionId } = await resolveBuildSession(projectRoot, { projectId, secret }, env, fetchImpl);
34
+ if (!sessionId)
35
+ return { cloud: null, notice: configurationNotice };
36
+ return { cloud: { projectId, sessionId, apiBase } };
37
+ }
38
+ catch {
39
+ // The web endpoint keeps its existing local fallback and notice. Native config treats the
40
+ // notice as a failed configuration response rather than selecting local against cloud anchors.
41
+ return { cloud: null, notice: unavailableNotice };
42
+ }
43
+ }
44
+ /**
45
+ * One answer per minute at most, shared by concurrent requests: every page load asks, and a signed
46
+ * request to the API per reload would be noise. A secret added to `.env` is seen within a minute.
47
+ */
48
+ export function cachedDevCloud(projectRoot, ttlMs = 60_000, load = () => devCloud(projectRoot)) {
49
+ let cached = null;
50
+ return () => {
51
+ if (!cached || Date.now() - cached.at >= ttlMs)
52
+ cached = { at: Date.now(), value: load() };
53
+ return cached.value;
54
+ };
55
+ }
56
+ //# sourceMappingURL=devCloud.js.map