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.
- package/LICENSE +14 -0
- package/README.md +133 -2
- package/dist/cli/build.d.ts +1 -0
- package/dist/cli/build.js +172 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cloud.d.ts +20 -0
- package/dist/cli/cloud.js +395 -0
- package/dist/cli/cloud.js.map +1 -0
- package/dist/cli/feedback.d.ts +4 -0
- package/dist/cli/feedback.js +90 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/hugo.d.ts +1 -0
- package/dist/cli/hugo.js +396 -0
- package/dist/cli/hugo.js.map +1 -0
- package/dist/cli/init.d.ts +8 -0
- package/dist/cli/init.js +346 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/invite.d.ts +2 -0
- package/dist/cli/invite.js +65 -0
- package/dist/cli/invite.js.map +1 -0
- package/dist/cli/link.d.ts +20 -0
- package/dist/cli/link.js +287 -0
- package/dist/cli/link.js.map +1 -0
- package/dist/cli/pull.d.ts +31 -0
- package/dist/cli/pull.js +273 -0
- package/dist/cli/pull.js.map +1 -0
- package/dist/cli/push.d.ts +9 -0
- package/dist/cli/push.js +57 -0
- package/dist/cli/push.js.map +1 -0
- package/dist/cli/remote.d.ts +1 -0
- package/dist/cli/remote.js +114 -0
- package/dist/cli/remote.js.map +1 -0
- package/dist/cli/serve.d.ts +1 -0
- package/dist/cli/serve.js +178 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/sidecar.d.ts +9 -0
- package/dist/cli/sidecar.js +23 -0
- package/dist/cli/sidecar.js.map +1 -0
- package/dist/core/anchorId.d.ts +42 -0
- package/dist/core/anchorId.js +50 -0
- package/dist/core/anchorId.js.map +1 -0
- package/dist/core/apiKind.d.ts +42 -0
- package/dist/core/apiKind.js +83 -0
- package/dist/core/apiKind.js.map +1 -0
- package/dist/core/astroAnchors.d.ts +39 -0
- package/dist/core/astroAnchors.js +217 -0
- package/dist/core/astroAnchors.js.map +1 -0
- package/dist/core/attachmentTypes.d.ts +74 -0
- package/dist/core/attachmentTypes.js +199 -0
- package/dist/core/attachmentTypes.js.map +1 -0
- package/dist/core/elementHints.d.ts +40 -0
- package/dist/core/elementHints.js +116 -0
- package/dist/core/elementHints.js.map +1 -0
- package/dist/core/exportTaskDoc.d.ts +81 -0
- package/dist/core/exportTaskDoc.js +828 -0
- package/dist/core/exportTaskDoc.js.map +1 -0
- package/dist/core/feedbackTypes.d.ts +241 -0
- package/dist/core/feedbackTypes.js +2 -0
- package/dist/core/feedbackTypes.js.map +1 -0
- package/dist/core/fingerprint.d.ts +12 -0
- package/dist/core/fingerprint.js +24 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/htmlAnchors.d.ts +18 -0
- package/dist/core/htmlAnchors.js +157 -0
- package/dist/core/htmlAnchors.js.map +1 -0
- package/dist/core/imageSniff.d.ts +7 -0
- package/dist/core/imageSniff.js +12 -0
- package/dist/core/imageSniff.js.map +1 -0
- package/dist/core/ordering.d.ts +16 -0
- package/dist/core/ordering.js +10 -0
- package/dist/core/ordering.js.map +1 -0
- package/dist/core/oxcAst.d.ts +39 -0
- package/dist/core/oxcAst.js +147 -0
- package/dist/core/oxcAst.js.map +1 -0
- package/dist/core/pageUrl.d.ts +10 -0
- package/dist/core/pageUrl.js +27 -0
- package/dist/core/pageUrl.js.map +1 -0
- package/dist/core/participants.d.ts +14 -0
- package/dist/core/participants.js +38 -0
- package/dist/core/participants.js.map +1 -0
- package/dist/core/ports.d.ts +86 -0
- package/dist/core/ports.js +2 -0
- package/dist/core/ports.js.map +1 -0
- package/dist/core/projectSecret.d.ts +9 -0
- package/dist/core/projectSecret.js +57 -0
- package/dist/core/projectSecret.js.map +1 -0
- package/dist/core/recipe.d.ts +117 -0
- package/dist/core/recipe.js +181 -0
- package/dist/core/recipe.js.map +1 -0
- package/dist/core/recordingSummary.d.ts +12 -0
- package/dist/core/recordingSummary.js +150 -0
- package/dist/core/recordingSummary.js.map +1 -0
- package/dist/core/resolveAnchors.d.ts +70 -0
- package/dist/core/resolveAnchors.js +101 -0
- package/dist/core/resolveAnchors.js.map +1 -0
- package/dist/core/scriptImport.d.ts +10 -0
- package/dist/core/scriptImport.js +18 -0
- package/dist/core/scriptImport.js.map +1 -0
- package/dist/core/sourceAnchors.d.ts +62 -0
- package/dist/core/sourceAnchors.js +82 -0
- package/dist/core/sourceAnchors.js.map +1 -0
- package/dist/core/sourceContext.d.ts +62 -0
- package/dist/core/sourceContext.js +182 -0
- package/dist/core/sourceContext.js.map +1 -0
- package/dist/core/sourcePath.d.ts +2 -0
- package/dist/core/sourcePath.js +11 -0
- package/dist/core/sourcePath.js.map +1 -0
- package/dist/core/staleness.d.ts +118 -0
- package/dist/core/staleness.js +155 -0
- package/dist/core/staleness.js.map +1 -0
- package/dist/core/styleOrigin.d.ts +98 -0
- package/dist/core/styleOrigin.js +142 -0
- package/dist/core/styleOrigin.js.map +1 -0
- package/dist/core/svelteAnchors.d.ts +18 -0
- package/dist/core/svelteAnchors.js +125 -0
- package/dist/core/svelteAnchors.js.map +1 -0
- package/dist/core/taskFiles.d.ts +31 -0
- package/dist/core/taskFiles.js +55 -0
- package/dist/core/taskFiles.js.map +1 -0
- package/dist/core/untrusted.d.ts +57 -0
- package/dist/core/untrusted.js +268 -0
- package/dist/core/untrusted.js.map +1 -0
- package/dist/core/vueAnchors.d.ts +21 -0
- package/dist/core/vueAnchors.js +130 -0
- package/dist/core/vueAnchors.js.map +1 -0
- package/dist/expo/app/Avatar.d.ts +6 -0
- package/dist/expo/app/Avatar.js +12 -0
- package/dist/expo/app/Avatar.js.map +1 -0
- package/dist/expo/app/Bars.d.ts +9 -0
- package/dist/expo/app/Bars.js +38 -0
- package/dist/expo/app/Bars.js.map +1 -0
- package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
- package/dist/expo/app/CommentThreadSheet.js +200 -0
- package/dist/expo/app/CommentThreadSheet.js.map +1 -0
- package/dist/expo/app/CommentsSheet.d.ts +22 -0
- package/dist/expo/app/CommentsSheet.js +76 -0
- package/dist/expo/app/CommentsSheet.js.map +1 -0
- package/dist/expo/app/Files.d.ts +16 -0
- package/dist/expo/app/Files.js +62 -0
- package/dist/expo/app/Files.js.map +1 -0
- package/dist/expo/app/Highlight.d.ts +5 -0
- package/dist/expo/app/Highlight.js +12 -0
- package/dist/expo/app/Highlight.js.map +1 -0
- package/dist/expo/app/Icon.d.ts +9 -0
- package/dist/expo/app/Icon.js +22 -0
- package/dist/expo/app/Icon.js.map +1 -0
- package/dist/expo/app/MarkerPins.d.ts +10 -0
- package/dist/expo/app/MarkerPins.js +70 -0
- package/dist/expo/app/MarkerPins.js.map +1 -0
- package/dist/expo/app/Provider.d.ts +13 -0
- package/dist/expo/app/Provider.js +597 -0
- package/dist/expo/app/Provider.js.map +1 -0
- package/dist/expo/app/Sheet.d.ts +53 -0
- package/dist/expo/app/Sheet.js +106 -0
- package/dist/expo/app/Sheet.js.map +1 -0
- package/dist/expo/app/Toolbar.d.ts +26 -0
- package/dist/expo/app/Toolbar.js +71 -0
- package/dist/expo/app/Toolbar.js.map +1 -0
- package/dist/expo/app/adapter.d.ts +55 -0
- package/dist/expo/app/adapter.js +145 -0
- package/dist/expo/app/adapter.js.map +1 -0
- package/dist/expo/app/api.d.ts +68 -0
- package/dist/expo/app/api.js +86 -0
- package/dist/expo/app/api.js.map +1 -0
- package/dist/expo/app/assets/attach.png +0 -0
- package/dist/expo/app/assets/close.png +0 -0
- package/dist/expo/app/assets/comment.png +0 -0
- package/dist/expo/app/assets/edit.png +0 -0
- package/dist/expo/app/assets/file.png +0 -0
- package/dist/expo/app/assets/narrow.png +0 -0
- package/dist/expo/app/assets/panel.png +0 -0
- package/dist/expo/app/assets/pins.png +0 -0
- package/dist/expo/app/assets/pinsOff.png +0 -0
- package/dist/expo/app/assets/remove.png +0 -0
- package/dist/expo/app/assets/reopen.png +0 -0
- package/dist/expo/app/assets/resolve.png +0 -0
- package/dist/expo/app/assets/send.png +0 -0
- package/dist/expo/app/assets/widen.png +0 -0
- package/dist/expo/app/attachments.d.ts +93 -0
- package/dist/expo/app/attachments.js +181 -0
- package/dist/expo/app/attachments.js.map +1 -0
- package/dist/expo/app/cloudApi.d.ts +63 -0
- package/dist/expo/app/cloudApi.js +330 -0
- package/dist/expo/app/cloudApi.js.map +1 -0
- package/dist/expo/app/cloudAuth.d.ts +20 -0
- package/dist/expo/app/cloudAuth.js +71 -0
- package/dist/expo/app/cloudAuth.js.map +1 -0
- package/dist/expo/app/cloudHttp.d.ts +20 -0
- package/dist/expo/app/cloudHttp.js +46 -0
- package/dist/expo/app/cloudHttp.js.map +1 -0
- package/dist/expo/app/cloudSession.d.ts +30 -0
- package/dist/expo/app/cloudSession.js +72 -0
- package/dist/expo/app/cloudSession.js.map +1 -0
- package/dist/expo/app/comments.d.ts +20 -0
- package/dist/expo/app/comments.js +131 -0
- package/dist/expo/app/comments.js.map +1 -0
- package/dist/expo/app/devMenuNone.d.ts +5 -0
- package/dist/expo/app/devMenuNone.js +3 -0
- package/dist/expo/app/devMenuNone.js.map +1 -0
- package/dist/expo/app/devServerNone.d.ts +4 -0
- package/dist/expo/app/devServerNone.js +4 -0
- package/dist/expo/app/devServerNone.js.map +1 -0
- package/dist/expo/app/embeddedConfig.d.ts +1 -0
- package/dist/expo/app/embeddedConfig.js +12 -0
- package/dist/expo/app/embeddedConfig.js.map +1 -0
- package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
- package/dist/expo/app/embeddedConfigCloud.js +8 -0
- package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
- package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
- package/dist/expo/app/embeddedConfigNone.js +3 -0
- package/dist/expo/app/embeddedConfigNone.js.map +1 -0
- package/dist/expo/app/expo.d.ts +4 -0
- package/dist/expo/app/expo.js +35 -0
- package/dist/expo/app/expo.js.map +1 -0
- package/dist/expo/app/expoGo.d.ts +4 -0
- package/dist/expo/app/expoGo.js +33 -0
- package/dist/expo/app/expoGo.js.map +1 -0
- package/dist/expo/app/expoPickers.d.ts +11 -0
- package/dist/expo/app/expoPickers.js +91 -0
- package/dist/expo/app/expoPickers.js.map +1 -0
- package/dist/expo/app/expoRandom.d.ts +6 -0
- package/dist/expo/app/expoRandom.js +21 -0
- package/dist/expo/app/expoRandom.js.map +1 -0
- package/dist/expo/app/idle.d.ts +4 -0
- package/dist/expo/app/idle.js +7 -0
- package/dist/expo/app/idle.js.map +1 -0
- package/dist/expo/app/index.d.ts +3 -0
- package/dist/expo/app/index.js +3 -0
- package/dist/expo/app/index.js.map +1 -0
- package/dist/expo/app/interactions.d.ts +38 -0
- package/dist/expo/app/interactions.js +40 -0
- package/dist/expo/app/interactions.js.map +1 -0
- package/dist/expo/app/markers.d.ts +28 -0
- package/dist/expo/app/markers.js +187 -0
- package/dist/expo/app/markers.js.map +1 -0
- package/dist/expo/app/movedAnchors.d.ts +46 -0
- package/dist/expo/app/movedAnchors.js +39 -0
- package/dist/expo/app/movedAnchors.js.map +1 -0
- package/dist/expo/app/native.d.ts +12 -0
- package/dist/expo/app/native.js +78 -0
- package/dist/expo/app/native.js.map +1 -0
- package/dist/expo/app/panel.d.ts +27 -0
- package/dist/expo/app/panel.js +37 -0
- package/dist/expo/app/panel.js.map +1 -0
- package/dist/expo/app/payload.d.ts +43 -0
- package/dist/expo/app/payload.js +22 -0
- package/dist/expo/app/payload.js.map +1 -0
- package/dist/expo/app/pick.d.ts +14 -0
- package/dist/expo/app/pick.js +124 -0
- package/dist/expo/app/pick.js.map +1 -0
- package/dist/expo/app/pickerNone.d.ts +1 -0
- package/dist/expo/app/pickerNone.js +2 -0
- package/dist/expo/app/pickerNone.js.map +1 -0
- package/dist/expo/app/placement.d.ts +53 -0
- package/dist/expo/app/placement.js +100 -0
- package/dist/expo/app/placement.js.map +1 -0
- package/dist/expo/app/random.d.ts +13 -0
- package/dist/expo/app/random.js +56 -0
- package/dist/expo/app/random.js.map +1 -0
- package/dist/expo/app/reactNative.d.ts +2 -0
- package/dist/expo/app/reactNative.js +3 -0
- package/dist/expo/app/reactNative.js.map +1 -0
- package/dist/expo/app/runtimeConfig.d.ts +30 -0
- package/dist/expo/app/runtimeConfig.js +104 -0
- package/dist/expo/app/runtimeConfig.js.map +1 -0
- package/dist/expo/app/sheetMotion.d.ts +22 -0
- package/dist/expo/app/sheetMotion.js +39 -0
- package/dist/expo/app/sheetMotion.js.map +1 -0
- package/dist/expo/app/signIn.d.ts +32 -0
- package/dist/expo/app/signIn.js +28 -0
- package/dist/expo/app/signIn.js.map +1 -0
- package/dist/expo/app/state.d.ts +45 -0
- package/dist/expo/app/state.js +32 -0
- package/dist/expo/app/state.js.map +1 -0
- package/dist/expo/app/theme.d.ts +15 -0
- package/dist/expo/app/theme.js +9 -0
- package/dist/expo/app/theme.js.map +1 -0
- package/dist/expo/app/types.d.ts +87 -0
- package/dist/expo/app/types.js +2 -0
- package/dist/expo/app/types.js.map +1 -0
- package/dist/expo/app/useCloudReviewer.d.ts +75 -0
- package/dist/expo/app/useCloudReviewer.js +211 -0
- package/dist/expo/app/useCloudReviewer.js.map +1 -0
- package/dist/expo/app/useComments.d.ts +64 -0
- package/dist/expo/app/useComments.js +156 -0
- package/dist/expo/app/useComments.js.map +1 -0
- package/dist/expo/app/useUploads.d.ts +32 -0
- package/dist/expo/app/useUploads.js +106 -0
- package/dist/expo/app/useUploads.js.map +1 -0
- package/dist/expo/expoGoMetro.cjs +83 -0
- package/dist/expo/expoMetro.cjs +86 -0
- package/dist/expo/metro.cjs +304 -0
- package/dist/expo/metroBuild.d.ts +22 -0
- package/dist/expo/metroBuild.js +169 -0
- package/dist/expo/metroBuild.js.map +1 -0
- package/dist/expo/middleware.d.ts +11 -0
- package/dist/expo/middleware.js +26 -0
- package/dist/expo/middleware.js.map +1 -0
- package/dist/expo/mode.d.ts +20 -0
- package/dist/expo/mode.js +37 -0
- package/dist/expo/mode.js.map +1 -0
- package/dist/expo/publicConfig.d.ts +37 -0
- package/dist/expo/publicConfig.js +87 -0
- package/dist/expo/publicConfig.js.map +1 -0
- package/dist/expo/transform.d.ts +22 -0
- package/dist/expo/transform.js +38 -0
- package/dist/expo/transform.js.map +1 -0
- package/dist/expo/transformer.cjs +73 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/apiRoutes.d.ts +2 -0
- package/dist/integration/apiRoutes.js +3 -0
- package/dist/integration/apiRoutes.js.map +1 -0
- package/dist/integration/buildCredentials.d.ts +12 -0
- package/dist/integration/buildCredentials.js +97 -0
- package/dist/integration/buildCredentials.js.map +1 -0
- package/dist/integration/buildSession.d.ts +8 -0
- package/dist/integration/buildSession.js +96 -0
- package/dist/integration/buildSession.js.map +1 -0
- package/dist/integration/bundleCheck.d.ts +43 -0
- package/dist/integration/bundleCheck.js +111 -0
- package/dist/integration/bundleCheck.js.map +1 -0
- package/dist/integration/commentPull.d.ts +134 -0
- package/dist/integration/commentPull.js +260 -0
- package/dist/integration/commentPull.js.map +1 -0
- package/dist/integration/configuredApi.d.ts +7 -0
- package/dist/integration/configuredApi.js +24 -0
- package/dist/integration/configuredApi.js.map +1 -0
- package/dist/integration/devCloud.d.ts +27 -0
- package/dist/integration/devCloud.js +56 -0
- package/dist/integration/devCloud.js.map +1 -0
- package/dist/integration/devReviewLinks.d.ts +2 -0
- package/dist/integration/devReviewLinks.js +10 -0
- package/dist/integration/devReviewLinks.js.map +1 -0
- package/dist/integration/gitBranch.d.ts +19 -0
- package/dist/integration/gitBranch.js +56 -0
- package/dist/integration/gitBranch.js.map +1 -0
- package/dist/integration/importPlan.d.ts +19 -0
- package/dist/integration/importPlan.js +90 -0
- package/dist/integration/importPlan.js.map +1 -0
- package/dist/integration/index.d.ts +14 -0
- package/dist/integration/index.js +13 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/manifest.d.ts +120 -0
- package/dist/integration/manifest.js +147 -0
- package/dist/integration/manifest.js.map +1 -0
- package/dist/integration/manifestParts.d.ts +29 -0
- package/dist/integration/manifestParts.js +65 -0
- package/dist/integration/manifestParts.js.map +1 -0
- package/dist/integration/manifestSink.d.ts +75 -0
- package/dist/integration/manifestSink.js +157 -0
- package/dist/integration/manifestSink.js.map +1 -0
- package/dist/integration/manifestUpload.d.ts +64 -0
- package/dist/integration/manifestUpload.js +177 -0
- package/dist/integration/manifestUpload.js.map +1 -0
- package/dist/integration/middleware.d.ts +55 -0
- package/dist/integration/middleware.js +379 -0
- package/dist/integration/middleware.js.map +1 -0
- package/dist/integration/nextStyles.d.ts +4 -0
- package/dist/integration/nextStyles.js +121 -0
- package/dist/integration/nextStyles.js.map +1 -0
- package/dist/integration/requestGuards.d.ts +71 -0
- package/dist/integration/requestGuards.js +255 -0
- package/dist/integration/requestGuards.js.map +1 -0
- package/dist/integration/sharedBuild.d.ts +71 -0
- package/dist/integration/sharedBuild.js +105 -0
- package/dist/integration/sharedBuild.js.map +1 -0
- package/dist/integration/sharedInject.d.ts +88 -0
- package/dist/integration/sharedInject.js +164 -0
- package/dist/integration/sharedInject.js.map +1 -0
- package/dist/integration/sidecarProcess.d.ts +26 -0
- package/dist/integration/sidecarProcess.js +137 -0
- package/dist/integration/sidecarProcess.js.map +1 -0
- package/dist/integration/styleCollector.d.ts +49 -0
- package/dist/integration/styleCollector.js +220 -0
- package/dist/integration/styleCollector.js.map +1 -0
- package/dist/integration/transform.d.ts +24 -0
- package/dist/integration/transform.js +36 -0
- package/dist/integration/transform.js.map +1 -0
- package/dist/integration/tunnelClient.d.ts +44 -0
- package/dist/integration/tunnelClient.js +148 -0
- package/dist/integration/tunnelClient.js.map +1 -0
- package/dist/integration/tunnelProtocol.d.ts +152 -0
- package/dist/integration/tunnelProtocol.js +110 -0
- package/dist/integration/tunnelProtocol.js.map +1 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +327 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/cloudRefresh.d.ts +36 -0
- package/dist/mcp/cloudRefresh.js +52 -0
- package/dist/mcp/cloudRefresh.js.map +1 -0
- package/dist/mcp/context.d.ts +7 -0
- package/dist/mcp/context.js +18 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/files.d.ts +66 -0
- package/dist/mcp/files.js +157 -0
- package/dist/mcp/files.js.map +1 -0
- package/dist/mcp/search.d.ts +3 -0
- package/dist/mcp/search.js +9 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +50 -0
- package/dist/mcp/server.js +555 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/overlay/anchors.d.ts +130 -0
- package/dist/overlay/anchors.js +365 -0
- package/dist/overlay/anchors.js.map +1 -0
- package/dist/overlay/api.d.ts +150 -0
- package/dist/overlay/api.js +259 -0
- package/dist/overlay/api.js.map +1 -0
- package/dist/overlay/attachments.d.ts +60 -0
- package/dist/overlay/attachments.js +163 -0
- package/dist/overlay/attachments.js.map +1 -0
- package/dist/overlay/browser.d.ts +1 -0
- package/dist/overlay/browser.js +203 -0
- package/dist/overlay/browser.js.map +1 -0
- package/dist/overlay/chip.d.ts +27 -0
- package/dist/overlay/chip.js +31 -0
- package/dist/overlay/chip.js.map +1 -0
- package/dist/overlay/compact.d.ts +11 -0
- package/dist/overlay/compact.js +21 -0
- package/dist/overlay/compact.js.map +1 -0
- package/dist/overlay/cssScope.d.ts +46 -0
- package/dist/overlay/cssScope.js +180 -0
- package/dist/overlay/cssScope.js.map +1 -0
- package/dist/overlay/cursor.d.ts +2 -0
- package/dist/overlay/cursor.js +68 -0
- package/dist/overlay/cursor.js.map +1 -0
- package/dist/overlay/devBrowser.d.ts +1 -0
- package/dist/overlay/devBrowser.js +18 -0
- package/dist/overlay/devBrowser.js.map +1 -0
- package/dist/overlay/devReview.d.ts +4 -0
- package/dist/overlay/devReview.js +18 -0
- package/dist/overlay/devReview.js.map +1 -0
- package/dist/overlay/directReviewer.d.ts +149 -0
- package/dist/overlay/directReviewer.js +448 -0
- package/dist/overlay/directReviewer.js.map +1 -0
- package/dist/overlay/elementDescription.d.ts +10 -0
- package/dist/overlay/elementDescription.js +251 -0
- package/dist/overlay/elementDescription.js.map +1 -0
- package/dist/overlay/icons.d.ts +8 -0
- package/dist/overlay/icons.js +36 -0
- package/dist/overlay/icons.js.map +1 -0
- package/dist/overlay/identity.d.ts +48 -0
- package/dist/overlay/identity.js +125 -0
- package/dist/overlay/identity.js.map +1 -0
- package/dist/overlay/localMachine.d.ts +23 -0
- package/dist/overlay/localMachine.js +40 -0
- package/dist/overlay/localMachine.js.map +1 -0
- package/dist/overlay/magicLink.d.ts +10 -0
- package/dist/overlay/magicLink.js +87 -0
- package/dist/overlay/magicLink.js.map +1 -0
- package/dist/overlay/modern-screenshot.js +1676 -0
- package/dist/overlay/movedAnchors.d.ts +30 -0
- package/dist/overlay/movedAnchors.js +128 -0
- package/dist/overlay/movedAnchors.js.map +1 -0
- package/dist/overlay/notificationGroups.d.ts +2 -0
- package/dist/overlay/notificationGroups.js +41 -0
- package/dist/overlay/notificationGroups.js.map +1 -0
- package/dist/overlay/permissions.d.ts +10 -0
- package/dist/overlay/permissions.js +9 -0
- package/dist/overlay/permissions.js.map +1 -0
- package/dist/overlay/pinGroups.d.ts +16 -0
- package/dist/overlay/pinGroups.js +17 -0
- package/dist/overlay/pinGroups.js.map +1 -0
- package/dist/overlay/presence.d.ts +50 -0
- package/dist/overlay/presence.js +258 -0
- package/dist/overlay/presence.js.map +1 -0
- package/dist/overlay/projectChannel.d.ts +11 -0
- package/dist/overlay/projectChannel.js +111 -0
- package/dist/overlay/projectChannel.js.map +1 -0
- package/dist/overlay/recorder.d.ts +56 -0
- package/dist/overlay/recorder.js +130 -0
- package/dist/overlay/recorder.js.map +1 -0
- package/dist/overlay/reviewMode.d.ts +21 -0
- package/dist/overlay/reviewMode.js +59 -0
- package/dist/overlay/reviewMode.js.map +1 -0
- package/dist/overlay/reviewerAuth.d.ts +131 -0
- package/dist/overlay/reviewerAuth.js +279 -0
- package/dist/overlay/reviewerAuth.js.map +1 -0
- package/dist/overlay/route.d.ts +18 -0
- package/dist/overlay/route.js +56 -0
- package/dist/overlay/route.js.map +1 -0
- package/dist/overlay/rrweb-record.js +63 -0
- package/dist/overlay/runtime.d.ts +1 -0
- package/dist/overlay/runtime.js +4857 -0
- package/dist/overlay/runtime.js.map +1 -0
- package/dist/overlay/session.d.ts +32 -0
- package/dist/overlay/session.js +76 -0
- package/dist/overlay/session.js.map +1 -0
- package/dist/overlay/sharedMode.d.ts +38 -0
- package/dist/overlay/sharedMode.js +37 -0
- package/dist/overlay/sharedMode.js.map +1 -0
- package/dist/overlay/sheet.d.ts +73 -0
- package/dist/overlay/sheet.js +278 -0
- package/dist/overlay/sheet.js.map +1 -0
- package/dist/overlay/snapshot.d.ts +26 -0
- package/dist/overlay/snapshot.js +185 -0
- package/dist/overlay/snapshot.js.map +1 -0
- package/dist/overlay/state.d.ts +63 -0
- package/dist/overlay/state.js +241 -0
- package/dist/overlay/state.js.map +1 -0
- package/dist/overlay/steps.d.ts +22 -0
- package/dist/overlay/steps.js +34 -0
- package/dist/overlay/steps.js.map +1 -0
- package/dist/overlay/styles.d.ts +7 -0
- package/dist/overlay/styles.js +1449 -0
- package/dist/overlay/styles.js.map +1 -0
- package/dist/overlay/trace.d.ts +19 -0
- package/dist/overlay/trace.js +29 -0
- package/dist/overlay/trace.js.map +1 -0
- package/dist/overlay/upload.d.ts +35 -0
- package/dist/overlay/upload.js +99 -0
- package/dist/overlay/upload.js.map +1 -0
- package/dist/plugin/astro.d.ts +31 -0
- package/dist/plugin/astro.js +22 -0
- package/dist/plugin/astro.js.map +1 -0
- package/dist/plugin/eleventy.d.ts +44 -0
- package/dist/plugin/eleventy.js +186 -0
- package/dist/plugin/eleventy.js.map +1 -0
- package/dist/plugin/next-loader.cjs +11 -0
- package/dist/plugin/next.d.ts +29 -0
- package/dist/plugin/next.js +176 -0
- package/dist/plugin/next.js.map +1 -0
- package/dist/plugin/nextOverlay.d.ts +2 -0
- package/dist/plugin/nextOverlay.js +22 -0
- package/dist/plugin/nextOverlay.js.map +1 -0
- package/dist/plugin/nextTransform.d.ts +19 -0
- package/dist/plugin/nextTransform.js +29 -0
- package/dist/plugin/nextTransform.js.map +1 -0
- package/dist/plugin/rsbuild.d.ts +25 -0
- package/dist/plugin/rsbuild.js +56 -0
- package/dist/plugin/rsbuild.js.map +1 -0
- package/dist/plugin/vite.d.ts +40 -0
- package/dist/plugin/vite.js +585 -0
- package/dist/plugin/vite.js.map +1 -0
- package/dist/plugin/webpack.d.ts +69 -0
- package/dist/plugin/webpack.js +192 -0
- package/dist/plugin/webpack.js.map +1 -0
- package/dist/remote/account.d.ts +41 -0
- package/dist/remote/account.js +177 -0
- package/dist/remote/account.js.map +1 -0
- package/dist/remote/base64url.d.ts +14 -0
- package/dist/remote/base64url.js +71 -0
- package/dist/remote/base64url.js.map +1 -0
- package/dist/remote/branchLabel.d.ts +12 -0
- package/dist/remote/branchLabel.js +20 -0
- package/dist/remote/branchLabel.js.map +1 -0
- package/dist/remote/client.d.ts +340 -0
- package/dist/remote/client.js +424 -0
- package/dist/remote/client.js.map +1 -0
- package/dist/remote/cloudApi.d.ts +72 -0
- package/dist/remote/cloudApi.js +72 -0
- package/dist/remote/cloudApi.js.map +1 -0
- package/dist/remote/codec.d.ts +54 -0
- package/dist/remote/codec.js +62 -0
- package/dist/remote/codec.js.map +1 -0
- package/dist/remote/config.d.ts +30 -0
- package/dist/remote/config.js +112 -0
- package/dist/remote/config.js.map +1 -0
- package/dist/remote/content-schema.d.ts +428 -0
- package/dist/remote/content-schema.js +209 -0
- package/dist/remote/content-schema.js.map +1 -0
- package/dist/remote/content.d.ts +44 -0
- package/dist/remote/content.js +75 -0
- package/dist/remote/content.js.map +1 -0
- package/dist/remote/envelope.d.ts +76 -0
- package/dist/remote/envelope.js +109 -0
- package/dist/remote/envelope.js.map +1 -0
- package/dist/remote/errors.d.ts +55 -0
- package/dist/remote/errors.js +63 -0
- package/dist/remote/errors.js.map +1 -0
- package/dist/remote/ids.d.ts +8 -0
- package/dist/remote/ids.js +25 -0
- package/dist/remote/ids.js.map +1 -0
- package/dist/remote/index.d.ts +7 -0
- package/dist/remote/index.js +8 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/keys.d.ts +62 -0
- package/dist/remote/keys.js +162 -0
- package/dist/remote/keys.js.map +1 -0
- package/dist/remote/localAnchors.d.ts +4 -0
- package/dist/remote/localAnchors.js +23 -0
- package/dist/remote/localAnchors.js.map +1 -0
- package/dist/remote/mapping.d.ts +11 -0
- package/dist/remote/mapping.js +22 -0
- package/dist/remote/mapping.js.map +1 -0
- package/dist/remote/presence.d.ts +63 -0
- package/dist/remote/presence.js +143 -0
- package/dist/remote/presence.js.map +1 -0
- package/dist/remote/realtime.d.ts +142 -0
- package/dist/remote/realtime.js +326 -0
- package/dist/remote/realtime.js.map +1 -0
- package/dist/remote/store.d.ts +183 -0
- package/dist/remote/store.js +907 -0
- package/dist/remote/store.js.map +1 -0
- package/dist/remote/sync.d.ts +113 -0
- package/dist/remote/sync.js +370 -0
- package/dist/remote/sync.js.map +1 -0
- package/dist/remote/types.d.ts +99 -0
- package/dist/remote/types.js +6 -0
- package/dist/remote/types.js.map +1 -0
- package/dist/setup/agents.d.ts +23 -0
- package/dist/setup/agents.js +80 -0
- package/dist/setup/agents.js.map +1 -0
- package/dist/setup/configure.d.ts +27 -0
- package/dist/setup/configure.js +201 -0
- package/dist/setup/configure.js.map +1 -0
- package/dist/setup/connect.d.ts +60 -0
- package/dist/setup/connect.js +244 -0
- package/dist/setup/connect.js.map +1 -0
- package/dist/setup/detect.d.ts +67 -0
- package/dist/setup/detect.js +168 -0
- package/dist/setup/detect.js.map +1 -0
- package/dist/setup/frameworks.d.ts +41 -0
- package/dist/setup/frameworks.js +81 -0
- package/dist/setup/frameworks.js.map +1 -0
- package/dist/sidecar/cli.d.ts +1 -0
- package/dist/sidecar/cli.js +70 -0
- package/dist/sidecar/cli.js.map +1 -0
- package/dist/sidecar/cloudSync.d.ts +33 -0
- package/dist/sidecar/cloudSync.js +139 -0
- package/dist/sidecar/cloudSync.js.map +1 -0
- package/dist/sidecar/commentFiles.d.ts +59 -0
- package/dist/sidecar/commentFiles.js +217 -0
- package/dist/sidecar/commentFiles.js.map +1 -0
- package/dist/sidecar/cssAttribution.d.ts +26 -0
- package/dist/sidecar/cssAttribution.js +114 -0
- package/dist/sidecar/cssAttribution.js.map +1 -0
- package/dist/sidecar/exportTasks.d.ts +38 -0
- package/dist/sidecar/exportTasks.js +249 -0
- package/dist/sidecar/exportTasks.js.map +1 -0
- package/dist/sidecar/http.d.ts +20 -0
- package/dist/sidecar/http.js +904 -0
- package/dist/sidecar/http.js.map +1 -0
- package/dist/sidecar/inviteTarget.d.ts +4 -0
- package/dist/sidecar/inviteTarget.js +32 -0
- package/dist/sidecar/inviteTarget.js.map +1 -0
- package/dist/sidecar/presence.d.ts +4 -0
- package/dist/sidecar/presence.js +92 -0
- package/dist/sidecar/presence.js.map +1 -0
- package/dist/storage/cliSession.d.ts +8 -0
- package/dist/storage/cliSession.js +41 -0
- package/dist/storage/cliSession.js.map +1 -0
- package/dist/storage/devStyleMap.d.ts +12 -0
- package/dist/storage/devStyleMap.js +31 -0
- package/dist/storage/devStyleMap.js.map +1 -0
- package/dist/storage/fileCache.d.ts +34 -0
- package/dist/storage/fileCache.js +122 -0
- package/dist/storage/fileCache.js.map +1 -0
- package/dist/storage/localAttachments.d.ts +82 -0
- package/dist/storage/localAttachments.js +276 -0
- package/dist/storage/localAttachments.js.map +1 -0
- package/dist/storage/localComments.d.ts +31 -0
- package/dist/storage/localComments.js +159 -0
- package/dist/storage/localComments.js.map +1 -0
- package/dist/storage/localCredentials.d.ts +74 -0
- package/dist/storage/localCredentials.js +210 -0
- package/dist/storage/localCredentials.js.map +1 -0
- package/dist/storage/localParticipants.d.ts +33 -0
- package/dist/storage/localParticipants.js +110 -0
- package/dist/storage/localParticipants.js.map +1 -0
- package/dist/storage/localRecipe.d.ts +22 -0
- package/dist/storage/localRecipe.js +46 -0
- package/dist/storage/localRecipe.js.map +1 -0
- package/dist/storage/localScreenshots.d.ts +23 -0
- package/dist/storage/localScreenshots.js +55 -0
- package/dist/storage/localScreenshots.js.map +1 -0
- package/dist/storage/localSource.d.ts +31 -0
- package/dist/storage/localSource.js +175 -0
- package/dist/storage/localSource.js.map +1 -0
- package/dist/storage/pulledComments.d.ts +81 -0
- package/dist/storage/pulledComments.js +107 -0
- package/dist/storage/pulledComments.js.map +1 -0
- package/dist/storage/remoteRecipe.d.ts +7 -0
- package/dist/storage/remoteRecipe.js +85 -0
- package/dist/storage/remoteRecipe.js.map +1 -0
- package/dist/storage/savedRemote.d.ts +2 -0
- package/dist/storage/savedRemote.js +22 -0
- package/dist/storage/savedRemote.js.map +1 -0
- package/dist/storage/sidecarAccess.d.ts +7 -0
- package/dist/storage/sidecarAccess.js +68 -0
- package/dist/storage/sidecarAccess.js.map +1 -0
- package/package.json +306 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { astroFilePattern } from '../core/astroAnchors.js';
|
|
2
|
+
import { vueFilePattern } from '../core/vueAnchors.js';
|
|
3
|
+
import { svelteFilePattern } from '../core/svelteAnchors.js';
|
|
4
|
+
export declare const jsxFilePattern: RegExp;
|
|
5
|
+
/** Every file type that can carry an anchor, whatever parses it. */
|
|
6
|
+
export declare const anchorableFilePattern: RegExp;
|
|
7
|
+
export { astroFilePattern, vueFilePattern, svelteFilePattern };
|
|
8
|
+
/**
|
|
9
|
+
* Builder-agnostic anchor injection. Any builder with a transform hook can call this;
|
|
10
|
+
* nothing here depends on Vite.
|
|
11
|
+
*
|
|
12
|
+
* Four parsers behind one door. `.jsx`/`.tsx` go through oxc, `.astro` through Astro's own
|
|
13
|
+
* compiler, `.vue` and `.svelte` through the project's own Vue and Svelte, and all come back as
|
|
14
|
+
* the same result - so a caller collects anchors, builds a
|
|
15
|
+
* manifest and uploads it without knowing which syntax produced them.
|
|
16
|
+
*
|
|
17
|
+
* With a secret, the file is stamped with opaque ids and the anchors it produced come back
|
|
18
|
+
* so the caller can record them. Without one, it behaves exactly as it always has.
|
|
19
|
+
*/
|
|
20
|
+
export declare function injectSourceAnchors(code: string, filename: string, projectRoot: string, secret?: string): Promise<{
|
|
21
|
+
code: string;
|
|
22
|
+
map: import("../core/sourceAnchors.js").RawSourceMap;
|
|
23
|
+
anchors: import("../core/sourceAnchors.js").AnchorRecord[];
|
|
24
|
+
} | null>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { injectSourceAnchors as injectAnchors } from '../core/sourceAnchors.js';
|
|
2
|
+
import { injectAstroAnchors, astroFilePattern } from '../core/astroAnchors.js';
|
|
3
|
+
import { injectVueAnchors, vueFilePattern } from '../core/vueAnchors.js';
|
|
4
|
+
import { injectSvelteAnchors, svelteFilePattern } from '../core/svelteAnchors.js';
|
|
5
|
+
import { sourceIdForFile } from '../core/sourcePath.js';
|
|
6
|
+
export const jsxFilePattern = /\.[jt]sx$/;
|
|
7
|
+
/** Every file type that can carry an anchor, whatever parses it. */
|
|
8
|
+
export const anchorableFilePattern = /\.([jt]sx|astro|vue|svelte)$/;
|
|
9
|
+
export { astroFilePattern, vueFilePattern, svelteFilePattern };
|
|
10
|
+
/**
|
|
11
|
+
* Builder-agnostic anchor injection. Any builder with a transform hook can call this;
|
|
12
|
+
* nothing here depends on Vite.
|
|
13
|
+
*
|
|
14
|
+
* Four parsers behind one door. `.jsx`/`.tsx` go through oxc, `.astro` through Astro's own
|
|
15
|
+
* compiler, `.vue` and `.svelte` through the project's own Vue and Svelte, and all come back as
|
|
16
|
+
* the same result - so a caller collects anchors, builds a
|
|
17
|
+
* manifest and uploads it without knowing which syntax produced them.
|
|
18
|
+
*
|
|
19
|
+
* With a secret, the file is stamped with opaque ids and the anchors it produced come back
|
|
20
|
+
* so the caller can record them. Without one, it behaves exactly as it always has.
|
|
21
|
+
*/
|
|
22
|
+
export async function injectSourceAnchors(code, filename, projectRoot, secret) {
|
|
23
|
+
const sourceId = sourceIdForFile(projectRoot, filename);
|
|
24
|
+
const result = astroFilePattern.test(filename)
|
|
25
|
+
? await injectAstroAnchors(code, filename, { sourceId, secret })
|
|
26
|
+
: vueFilePattern.test(filename)
|
|
27
|
+
? await injectVueAnchors(code, filename, { sourceId, secret })
|
|
28
|
+
: svelteFilePattern.test(filename)
|
|
29
|
+
? await injectSvelteAnchors(code, filename, { sourceId, secret })
|
|
30
|
+
: injectAnchors(code, filename, { sourceId, secret });
|
|
31
|
+
if (!result || result.injected === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return { code: result.code, map: result.map, anchors: result.anchors };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/integration/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C,oEAAoE;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,QAAgB,EAChB,WAAmB,EACnB,MAAe;IAEf,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC5C,CAAC,CAAC,MAAM,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QAChE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC7B,CAAC,CAAC,MAAM,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAC9D,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAChC,CAAC,CAAC,MAAM,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACjE,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAE5D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dev machine's end of a live session.
|
|
3
|
+
*
|
|
4
|
+
* Holds one **outbound** WebSocket to the relay and serves whatever arrives on it from the local
|
|
5
|
+
* dev server. Outbound is the whole point: the machine is behind NAT and a laptop firewall, and
|
|
6
|
+
* nothing here asks it to accept a connection.
|
|
7
|
+
*
|
|
8
|
+
* It proves who it is by signing with the project secret, exactly as manifest upload and pull
|
|
9
|
+
* do, under its own purpose string - so a signature captured from a pull cannot open a tunnel.
|
|
10
|
+
*/
|
|
11
|
+
export type TunnelEvents = {
|
|
12
|
+
/** The session is live. */
|
|
13
|
+
ready?: (info: {
|
|
14
|
+
sessionId: string;
|
|
15
|
+
url: string;
|
|
16
|
+
expiresAt: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
/** The cap is approaching, or the room has gone quiet. `canExtend` drives the button. */
|
|
19
|
+
warn?: (info: {
|
|
20
|
+
secondsLeft: number;
|
|
21
|
+
canExtend: boolean;
|
|
22
|
+
}) => void;
|
|
23
|
+
/** It is over, with the reason for the developer. */
|
|
24
|
+
closed?: (reason: string) => void;
|
|
25
|
+
};
|
|
26
|
+
export type TunnelOptions = {
|
|
27
|
+
relayUrl: string;
|
|
28
|
+
projectId: string;
|
|
29
|
+
secret: string;
|
|
30
|
+
/** Where the dev server is, on this machine. */
|
|
31
|
+
localPort: number;
|
|
32
|
+
localHost?: string;
|
|
33
|
+
events?: TunnelEvents;
|
|
34
|
+
now?: () => Date;
|
|
35
|
+
/** Injected so tests can drive a real socket without a real network. */
|
|
36
|
+
WebSocketImpl?: typeof WebSocket;
|
|
37
|
+
};
|
|
38
|
+
export type Tunnel = {
|
|
39
|
+
close(): void;
|
|
40
|
+
/** Asks the relay for more time. Only meaningful after a warning offering it. */
|
|
41
|
+
extend(): void;
|
|
42
|
+
};
|
|
43
|
+
export declare function signTunnelOpen(secret: string, projectId: string, issuedAt: string): string;
|
|
44
|
+
export declare function openTunnel(options: TunnelOptions): Promise<Tunnel>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
import { request as httpRequest } from 'node:http';
|
|
3
|
+
import { decodeControl, encodeControl, encodeBody, decodeBody, forwardableHeaders, tunnelPurpose, tunnelProtocolVersion, } from './tunnelProtocol.js';
|
|
4
|
+
export function signTunnelOpen(secret, projectId, issuedAt) {
|
|
5
|
+
return createHmac('sha256', secret)
|
|
6
|
+
.update([`feedback:${tunnelPurpose}`, projectId, issuedAt].join('\n'))
|
|
7
|
+
.digest('hex');
|
|
8
|
+
}
|
|
9
|
+
export async function openTunnel(options) {
|
|
10
|
+
const Impl = options.WebSocketImpl ?? WebSocket;
|
|
11
|
+
const socket = new Impl(`${options.relayUrl.replace(/^http/, 'ws').replace(/\/$/, '')}/agent`);
|
|
12
|
+
socket.binaryType = 'arraybuffer';
|
|
13
|
+
/**
|
|
14
|
+
* Requests in flight, by id.
|
|
15
|
+
*
|
|
16
|
+
* A request arrives as a head frame, then zero or more binary body frames, then `end`. It is
|
|
17
|
+
* forwarded on `end` rather than streamed through, because the body has to be complete before
|
|
18
|
+
* the local request can carry it - and a review session's traffic is a page and its modules,
|
|
19
|
+
* which are GETs with no body at all.
|
|
20
|
+
*/
|
|
21
|
+
const inflight = new Map();
|
|
22
|
+
const send = (frame) => {
|
|
23
|
+
if (socket.readyState === socket.OPEN)
|
|
24
|
+
socket.send(encodeControl(frame));
|
|
25
|
+
};
|
|
26
|
+
await new Promise((resolve, reject) => {
|
|
27
|
+
socket.addEventListener('open', () => resolve(), { once: true });
|
|
28
|
+
socket.addEventListener('error', () => reject(new Error('could not reach the relay')), { once: true });
|
|
29
|
+
});
|
|
30
|
+
const issuedAt = (options.now?.() ?? new Date()).toISOString();
|
|
31
|
+
send({
|
|
32
|
+
t: 'hello',
|
|
33
|
+
version: tunnelProtocolVersion,
|
|
34
|
+
projectId: options.projectId,
|
|
35
|
+
issuedAt,
|
|
36
|
+
signature: signTunnelOpen(options.secret, options.projectId, issuedAt),
|
|
37
|
+
});
|
|
38
|
+
socket.addEventListener('message', (event) => {
|
|
39
|
+
if (typeof event.data !== 'string') {
|
|
40
|
+
const body = decodeBody(new Uint8Array(event.data));
|
|
41
|
+
const pending = body && inflight.get(body.id);
|
|
42
|
+
if (pending && body)
|
|
43
|
+
pending.body.push(body.chunk);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const frame = decodeControl(event.data);
|
|
47
|
+
if (!frame)
|
|
48
|
+
return;
|
|
49
|
+
switch (frame.t) {
|
|
50
|
+
case 'ready':
|
|
51
|
+
options.events?.ready?.({
|
|
52
|
+
sessionId: frame.sessionId, url: frame.url, expiresAt: frame.expiresAt,
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
case 'warn':
|
|
56
|
+
options.events?.warn?.({ secondsLeft: frame.secondsLeft, canExtend: frame.canExtend });
|
|
57
|
+
return;
|
|
58
|
+
case 'closed':
|
|
59
|
+
options.events?.closed?.(frame.reason);
|
|
60
|
+
socket.close();
|
|
61
|
+
return;
|
|
62
|
+
case 'ping':
|
|
63
|
+
send({ t: 'pong' });
|
|
64
|
+
return;
|
|
65
|
+
case 'req':
|
|
66
|
+
inflight.set(frame.id, { head: frame, body: [] });
|
|
67
|
+
return;
|
|
68
|
+
case 'abort':
|
|
69
|
+
// The reviewer went away. Dropping the entry is the whole cleanup: nothing has been
|
|
70
|
+
// issued locally yet, because nothing is issued until `end`.
|
|
71
|
+
inflight.delete(frame.id);
|
|
72
|
+
return;
|
|
73
|
+
case 'end': {
|
|
74
|
+
const pending = inflight.get(frame.id);
|
|
75
|
+
if (!pending)
|
|
76
|
+
return;
|
|
77
|
+
inflight.delete(frame.id);
|
|
78
|
+
void forward(pending.head, concat(pending.body), options, send, (chunk) => {
|
|
79
|
+
if (socket.readyState === socket.OPEN)
|
|
80
|
+
socket.send(encodeBody(frame.id, chunk));
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
default:
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
close: () => socket.close(),
|
|
90
|
+
extend: () => send({ t: 'extend' }),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Joins the body frames for one request. Null when there were none, which is the usual case. */
|
|
94
|
+
function concat(chunks) {
|
|
95
|
+
if (chunks.length === 0)
|
|
96
|
+
return null;
|
|
97
|
+
const total = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
98
|
+
const out = new Uint8Array(total);
|
|
99
|
+
let at = 0;
|
|
100
|
+
for (const chunk of chunks) {
|
|
101
|
+
out.set(chunk, at);
|
|
102
|
+
at += chunk.length;
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Issues one reviewer request against the local dev server and streams the answer back.
|
|
108
|
+
*
|
|
109
|
+
* Errors become a 502 rather than a thrown exception: the reviewer is looking at a page, and a
|
|
110
|
+
* dev server that is restarting should show them a failed asset, not a hung tab.
|
|
111
|
+
*/
|
|
112
|
+
function forward(head, body, options, send, writeBody) {
|
|
113
|
+
return new Promise((resolve) => {
|
|
114
|
+
const upstream = httpRequest({
|
|
115
|
+
host: options.localHost ?? '127.0.0.1',
|
|
116
|
+
port: options.localPort,
|
|
117
|
+
method: head.method,
|
|
118
|
+
path: head.path,
|
|
119
|
+
headers: {
|
|
120
|
+
...forwardableHeaders(head.headers),
|
|
121
|
+
// The dev server must see its own host. Passing the session's subdomain through makes
|
|
122
|
+
// Vite refuse the request as a cross-origin one, which surfaces to the reviewer as a
|
|
123
|
+
// blank page with nothing in the log to explain it.
|
|
124
|
+
host: `${options.localHost ?? '127.0.0.1'}:${options.localPort}`,
|
|
125
|
+
// That loopback Host is ours, not the reviewer's: the feedback proxy must not mistake a
|
|
126
|
+
// relayed request for the developer's own browser.
|
|
127
|
+
'x-feedback-tunnel': '1',
|
|
128
|
+
},
|
|
129
|
+
}, (response) => {
|
|
130
|
+
send({
|
|
131
|
+
t: 'res',
|
|
132
|
+
id: head.id,
|
|
133
|
+
status: response.statusCode ?? 502,
|
|
134
|
+
headers: forwardableHeaders(response.headers),
|
|
135
|
+
});
|
|
136
|
+
response.on('data', (chunk) => writeBody(new Uint8Array(chunk)));
|
|
137
|
+
response.on('end', () => { send({ t: 'end', id: head.id }); resolve(); });
|
|
138
|
+
});
|
|
139
|
+
upstream.on('error', (error) => {
|
|
140
|
+
send({ t: 'abort', id: head.id, reason: error.message });
|
|
141
|
+
resolve();
|
|
142
|
+
});
|
|
143
|
+
if (body)
|
|
144
|
+
upstream.write(body);
|
|
145
|
+
upstream.end();
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=tunnelClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnelClient.js","sourceRoot":"","sources":["../../src/integration/tunnelClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EACxE,aAAa,EAAE,qBAAqB,GAErC,MAAM,qBAAqB,CAAC;AAyC7B,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,SAAiB,EAAE,QAAgB;IAChF,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;SAChC,MAAM,CAAC,CAAC,YAAY,aAAa,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrE,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAsB;IACrD,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,IAAI,SAAS,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC/F,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC;IAElC;;;;;;;OAOG;IACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA2E,CAAC;IAEpG,MAAM,IAAI,GAAG,CAAC,KAAkB,EAAE,EAAE;QAClC,IAAI,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,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E,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACzD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI;YAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,QAAQ,CAAC,GAAG,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frames a live session speaks, defined once for both ends.
|
|
3
|
+
*
|
|
4
|
+
* **One definition, not two agreeing definitions.** The relay imports this module rather than
|
|
5
|
+
* restating it, which is a stronger guarantee than the contract test that would otherwise be
|
|
6
|
+
* needed: there is no second copy to drift. Where two copies are unavoidable - the signed
|
|
7
|
+
* machine payload, which the cloud cannot import from here - the test drives one real end
|
|
8
|
+
* against the other (RAW-POLICY rule 7).
|
|
9
|
+
*
|
|
10
|
+
* ## Shape
|
|
11
|
+
*
|
|
12
|
+
* A dev machine holds **one outbound WebSocket** to the relay. Every reviewer request is
|
|
13
|
+
* multiplexed over it, tagged with a request id the relay allocates. Outbound-only matters: the
|
|
14
|
+
* dev machine is behind NAT and a laptop firewall, and nothing about this asks it to accept a
|
|
15
|
+
* connection.
|
|
16
|
+
*
|
|
17
|
+
* **Control frames are text (JSON); body bytes are binary.** Bodies are not base64 inside JSON
|
|
18
|
+
* because a dev-mode page is an unbundled ES module graph - several megabytes on a cold load -
|
|
19
|
+
* and base64 would add a third to every byte of it for no benefit. A binary frame is a 4-byte
|
|
20
|
+
* big-endian request id followed by the bytes.
|
|
21
|
+
*
|
|
22
|
+
* Direction disambiguates a body without a type byte: relay to client is a *request* body,
|
|
23
|
+
* client to relay is a *response* body. The same id can have both in flight and they cannot be
|
|
24
|
+
* confused.
|
|
25
|
+
*/
|
|
26
|
+
export declare const tunnelProtocolVersion = 1;
|
|
27
|
+
/** Dev machine to relay. */
|
|
28
|
+
export type ClientFrame =
|
|
29
|
+
/**
|
|
30
|
+
* Authenticate and claim a session.
|
|
31
|
+
*
|
|
32
|
+
* Signed with the project secret over the machine payload, the same scheme as pull and
|
|
33
|
+
* manifest upload: the secret proves possession and never travels.
|
|
34
|
+
*/
|
|
35
|
+
{
|
|
36
|
+
t: 'hello';
|
|
37
|
+
version: number;
|
|
38
|
+
projectId: string;
|
|
39
|
+
issuedAt: string;
|
|
40
|
+
signature: string;
|
|
41
|
+
}
|
|
42
|
+
/** Head of a response. Body follows as binary frames, then `end`. */
|
|
43
|
+
| {
|
|
44
|
+
t: 'res';
|
|
45
|
+
id: number;
|
|
46
|
+
status: number;
|
|
47
|
+
headers: Record<string, string>;
|
|
48
|
+
}
|
|
49
|
+
/** No more body for this id, in whichever direction the sender is writing. */
|
|
50
|
+
| {
|
|
51
|
+
t: 'end';
|
|
52
|
+
id: number;
|
|
53
|
+
}
|
|
54
|
+
/** This exchange cannot continue. The reason is for the developer's log, never the reviewer. */
|
|
55
|
+
| {
|
|
56
|
+
t: 'abort';
|
|
57
|
+
id: number;
|
|
58
|
+
reason: string;
|
|
59
|
+
}
|
|
60
|
+
/** The developer accepted the offer to keep the session open. */
|
|
61
|
+
| {
|
|
62
|
+
t: 'extend';
|
|
63
|
+
} | {
|
|
64
|
+
t: 'pong';
|
|
65
|
+
};
|
|
66
|
+
/** Relay to dev machine. */
|
|
67
|
+
export type RelayFrame =
|
|
68
|
+
/** Authenticated. The session is live at `url` until `expiresAt`. */
|
|
69
|
+
{
|
|
70
|
+
t: 'ready';
|
|
71
|
+
sessionId: string;
|
|
72
|
+
url: string;
|
|
73
|
+
expiresAt: string;
|
|
74
|
+
}
|
|
75
|
+
/** Head of a reviewer's request. Body follows as binary frames, then `end`. */
|
|
76
|
+
| {
|
|
77
|
+
t: 'req';
|
|
78
|
+
id: number;
|
|
79
|
+
method: string;
|
|
80
|
+
path: string;
|
|
81
|
+
headers: Record<string, string>;
|
|
82
|
+
} | {
|
|
83
|
+
t: 'end';
|
|
84
|
+
id: number;
|
|
85
|
+
} | {
|
|
86
|
+
t: 'abort';
|
|
87
|
+
id: number;
|
|
88
|
+
reason: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The cap is approaching. `secondsLeft` is what the developer is shown.
|
|
92
|
+
*
|
|
93
|
+
* Part of the cap rather than a nicety: a cut nobody saw coming reads as the tool crashing in
|
|
94
|
+
* front of the people they invited. See spec 11.2.
|
|
95
|
+
*/
|
|
96
|
+
| {
|
|
97
|
+
t: 'warn';
|
|
98
|
+
secondsLeft: number;
|
|
99
|
+
canExtend: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** The session is over. `reason` is shown to the developer, never to a reviewer. */
|
|
102
|
+
| {
|
|
103
|
+
t: 'closed';
|
|
104
|
+
reason: string;
|
|
105
|
+
} | {
|
|
106
|
+
t: 'ping';
|
|
107
|
+
};
|
|
108
|
+
export type AnyFrame = ClientFrame | RelayFrame;
|
|
109
|
+
export declare function encodeControl(frame: AnyFrame): string;
|
|
110
|
+
/**
|
|
111
|
+
* Parses a control frame, returning null rather than throwing on anything malformed.
|
|
112
|
+
*
|
|
113
|
+
* Null because this is parsing bytes from the network. A relay that throws on a bad frame gives
|
|
114
|
+
* a stranger a way to end someone else's session, and a stack trace in the logs for every port
|
|
115
|
+
* scanner that finds the WebSocket.
|
|
116
|
+
*/
|
|
117
|
+
export declare function decodeControl(raw: string): AnyFrame | null;
|
|
118
|
+
/** A body chunk: 4-byte big-endian request id, then the bytes. */
|
|
119
|
+
export declare function encodeBody(id: number, chunk: Uint8Array): Uint8Array;
|
|
120
|
+
export declare function decodeBody(frame: Uint8Array): {
|
|
121
|
+
id: number;
|
|
122
|
+
chunk: Uint8Array;
|
|
123
|
+
} | null;
|
|
124
|
+
/**
|
|
125
|
+
* Headers a reviewer's request must not carry through to the dev server, and vice versa.
|
|
126
|
+
*
|
|
127
|
+
* Hop-by-hop headers describe the connection between two adjacent parties, not the message, so
|
|
128
|
+
* forwarding them across the tunnel describes a connection that does not exist. `connection`
|
|
129
|
+
* and `upgrade` in particular would make the dev server try to negotiate a protocol switch with
|
|
130
|
+
* the relay's socket rather than the reviewer's.
|
|
131
|
+
*
|
|
132
|
+
* `host` is dropped separately and deliberately: the dev server must see its own host, not the
|
|
133
|
+
* session's subdomain, or Vite's own origin checks refuse the request.
|
|
134
|
+
*/
|
|
135
|
+
export declare const hopByHopHeaders: Set<string>;
|
|
136
|
+
export declare function forwardableHeaders(headers: Record<string, string>): Record<string, string>;
|
|
137
|
+
/**
|
|
138
|
+
* The string a dev machine signs to open a session.
|
|
139
|
+
*
|
|
140
|
+
* Its own purpose, so a signature captured from a pull cannot open a tunnel. Must agree with the
|
|
141
|
+
* cloud's `machinePayload`; the shared shape is `feedback:<purpose>\n<projectId>\n<issuedAt>`.
|
|
142
|
+
*/
|
|
143
|
+
export declare const tunnelPurpose = "tunnel-open:v1";
|
|
144
|
+
/**
|
|
145
|
+
* The path the overlay pings while a reviewer has the page open.
|
|
146
|
+
*
|
|
147
|
+
* Presence over HTTP is not a connection, so it has to be asserted. This is the only request the
|
|
148
|
+
* relay treats as "someone is here" without also treating it as "someone is doing something" -
|
|
149
|
+
* see `seen` against `touch` in the relay's session rules. Conflating them would make the
|
|
150
|
+
* quiet-room rule unreachable: a page left open would hold the session forever.
|
|
151
|
+
*/
|
|
152
|
+
export declare const livePingPath = "/__fb/live";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frames a live session speaks, defined once for both ends.
|
|
3
|
+
*
|
|
4
|
+
* **One definition, not two agreeing definitions.** The relay imports this module rather than
|
|
5
|
+
* restating it, which is a stronger guarantee than the contract test that would otherwise be
|
|
6
|
+
* needed: there is no second copy to drift. Where two copies are unavoidable - the signed
|
|
7
|
+
* machine payload, which the cloud cannot import from here - the test drives one real end
|
|
8
|
+
* against the other (RAW-POLICY rule 7).
|
|
9
|
+
*
|
|
10
|
+
* ## Shape
|
|
11
|
+
*
|
|
12
|
+
* A dev machine holds **one outbound WebSocket** to the relay. Every reviewer request is
|
|
13
|
+
* multiplexed over it, tagged with a request id the relay allocates. Outbound-only matters: the
|
|
14
|
+
* dev machine is behind NAT and a laptop firewall, and nothing about this asks it to accept a
|
|
15
|
+
* connection.
|
|
16
|
+
*
|
|
17
|
+
* **Control frames are text (JSON); body bytes are binary.** Bodies are not base64 inside JSON
|
|
18
|
+
* because a dev-mode page is an unbundled ES module graph - several megabytes on a cold load -
|
|
19
|
+
* and base64 would add a third to every byte of it for no benefit. A binary frame is a 4-byte
|
|
20
|
+
* big-endian request id followed by the bytes.
|
|
21
|
+
*
|
|
22
|
+
* Direction disambiguates a body without a type byte: relay to client is a *request* body,
|
|
23
|
+
* client to relay is a *response* body. The same id can have both in flight and they cannot be
|
|
24
|
+
* confused.
|
|
25
|
+
*/
|
|
26
|
+
export const tunnelProtocolVersion = 1;
|
|
27
|
+
export function encodeControl(frame) {
|
|
28
|
+
return JSON.stringify(frame);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parses a control frame, returning null rather than throwing on anything malformed.
|
|
32
|
+
*
|
|
33
|
+
* Null because this is parsing bytes from the network. A relay that throws on a bad frame gives
|
|
34
|
+
* a stranger a way to end someone else's session, and a stack trace in the logs for every port
|
|
35
|
+
* scanner that finds the WebSocket.
|
|
36
|
+
*/
|
|
37
|
+
export function decodeControl(raw) {
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(raw);
|
|
40
|
+
return typeof parsed?.t === 'string' ? parsed : null;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** A body chunk: 4-byte big-endian request id, then the bytes. */
|
|
47
|
+
export function encodeBody(id, chunk) {
|
|
48
|
+
const out = new Uint8Array(4 + chunk.length);
|
|
49
|
+
new DataView(out.buffer).setUint32(0, id, false);
|
|
50
|
+
out.set(chunk, 4);
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
export function decodeBody(frame) {
|
|
54
|
+
// A frame shorter than the header is not an empty body - it is a malformed frame, and the
|
|
55
|
+
// difference matters: an empty body is legitimate and terminates with `end`, not with a
|
|
56
|
+
// zero-length binary frame.
|
|
57
|
+
if (frame.length < 4)
|
|
58
|
+
return null;
|
|
59
|
+
const id = new DataView(frame.buffer, frame.byteOffset, frame.byteLength).getUint32(0, false);
|
|
60
|
+
return { id, chunk: frame.subarray(4) };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Headers a reviewer's request must not carry through to the dev server, and vice versa.
|
|
64
|
+
*
|
|
65
|
+
* Hop-by-hop headers describe the connection between two adjacent parties, not the message, so
|
|
66
|
+
* forwarding them across the tunnel describes a connection that does not exist. `connection`
|
|
67
|
+
* and `upgrade` in particular would make the dev server try to negotiate a protocol switch with
|
|
68
|
+
* the relay's socket rather than the reviewer's.
|
|
69
|
+
*
|
|
70
|
+
* `host` is dropped separately and deliberately: the dev server must see its own host, not the
|
|
71
|
+
* session's subdomain, or Vite's own origin checks refuse the request.
|
|
72
|
+
*/
|
|
73
|
+
export const hopByHopHeaders = new Set([
|
|
74
|
+
'connection',
|
|
75
|
+
'keep-alive',
|
|
76
|
+
'proxy-authenticate',
|
|
77
|
+
'proxy-authorization',
|
|
78
|
+
'te',
|
|
79
|
+
'trailer',
|
|
80
|
+
'transfer-encoding',
|
|
81
|
+
'upgrade',
|
|
82
|
+
'host',
|
|
83
|
+
// Length is recomputed by whichever side writes the body; a stale one truncates the response.
|
|
84
|
+
'content-length',
|
|
85
|
+
]);
|
|
86
|
+
export function forwardableHeaders(headers) {
|
|
87
|
+
const out = {};
|
|
88
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
89
|
+
if (!hopByHopHeaders.has(name.toLowerCase()))
|
|
90
|
+
out[name] = value;
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The string a dev machine signs to open a session.
|
|
96
|
+
*
|
|
97
|
+
* Its own purpose, so a signature captured from a pull cannot open a tunnel. Must agree with the
|
|
98
|
+
* cloud's `machinePayload`; the shared shape is `feedback:<purpose>\n<projectId>\n<issuedAt>`.
|
|
99
|
+
*/
|
|
100
|
+
export const tunnelPurpose = 'tunnel-open:v1';
|
|
101
|
+
/**
|
|
102
|
+
* The path the overlay pings while a reviewer has the page open.
|
|
103
|
+
*
|
|
104
|
+
* Presence over HTTP is not a connection, so it has to be asserted. This is the only request the
|
|
105
|
+
* relay treats as "someone is here" without also treating it as "someone is doing something" -
|
|
106
|
+
* see `seen` against `touch` in the relay's session rules. Conflating them would make the
|
|
107
|
+
* quiet-room rule unreachable: a page left open would hold the session forever.
|
|
108
|
+
*/
|
|
109
|
+
export const livePingPath = '/__fb/live';
|
|
110
|
+
//# sourceMappingURL=tunnelProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnelProtocol.js","sourceRoot":"","sources":["../../src/integration/tunnelProtocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AA6CvC,MAAM,UAAU,aAAa,CAAC,KAAe;IAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAoB,CAAC;QAClD,OAAO,OAAO,MAAM,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,K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