;
+}) {
+ const model = useQuickShare(token, beforeShare);
+ const { snapshot, progress, error } = model;
+ const url = safeShareUrl(snapshot?.share.url ?? "");
+ const manageUrl = safeShareUrl(snapshot?.share.manageUrl ?? "");
+ return (
+
+
+
Share project
+
Share the latest saved project.
+
+ {snapshot ? (
+ <>
+
+
+
+
+
+ >
+ ) : null}
+ {!snapshot && !error ?
Loading sharing…
: null}
+ {progress ? (
+
{progress} You can close this panel; keep Studio running.
+ ) : null}
+
+ {error ? (
+
+ {error}
+
+ ) : null}
+
+
+ );
+}
diff --git a/packages/studio/src/components/share/QuickShareControls.tsx b/packages/studio/src/components/share/QuickShareControls.tsx
new file mode 100644
index 0000000000..bb1603707b
--- /dev/null
+++ b/packages/studio/src/components/share/QuickShareControls.tsx
@@ -0,0 +1,243 @@
+import type { LocalShareSnapshot } from "@hyperframes/studio-server";
+import { Button } from "../ui";
+import { ShareAudience } from "./ShareAudience";
+import { Link, ArrowUpRight } from "@phosphor-icons/react";
+import type { QuickShareModel } from "./useQuickShare";
+
+type Props = { model: QuickShareModel; snapshot: LocalShareSnapshot };
+export function ShareSettings({ model, snapshot }: Props) {
+ return ;
+}
+export function ShareNotices({ model, snapshot }: Props) {
+ const { share } = snapshot;
+ const messages = [
+ model.audience === "invite" ? "Add people from Manage sharing after creating the link." : null,
+ share.changed
+ ? "Local changes aren’t shared yet. Update the shared version when you’re ready."
+ : share.changed === null
+ ? "Changes after your last upload aren’t shared automatically. Update to share the current project."
+ : null,
+ share.state === "link_off" ? "The link is off. Updating the video keeps it off." : null,
+ share.state === "processing" && !model.busy && snapshot.job?.state !== "failed"
+ ? "The shared video is still being prepared. Reopen sharing to check its status."
+ : null,
+ share.state === "unavailable" ? "Sharing is paused. Open Manage sharing for details." : null,
+ !snapshot.versionSharing && share.state === "not_shared"
+ ? "Sharing isn’t available for this account yet."
+ : null,
+ ];
+ return (
+ <>
+ {share.state === "failed" && share.failure ? (
+
+ {share.failure}
+
+ ) : null}
+ {messages.filter(Boolean).map((message) => (
+
+ {message}
+
+ ))}
+ >
+ );
+}
+export function ShareActions({ model, snapshot, url }: Props & { url: string | null }) {
+ if (snapshot.share.state === "not_shared")
+ return ;
+ return (
+ <>
+ {url ? : null}
+ {snapshot.versionSharing && snapshot.share.state !== "unavailable" ? (
+
+ ) : null}
+
+ >
+ );
+}
+function CreateShare({ model, snapshot }: Props) {
+ const space = snapshot.spaces.find((item) => item.id === model.spaceId);
+ const canCreate = snapshot.versionSharing && space?.canCreate && model.audience !== "";
+ return (
+ <>
+ {!space || !space.canCreate ? (
+
+ Sharing isn’t available in the workspace selected at sign-in. Sign in with an accessible
+ workspace to continue.
+
+ ) : null}
+
+ >
+ );
+}
+function CopyShare({ model, snapshot, url }: Props & { url: string }) {
+ const label = model.copied
+ ? "Copied"
+ : snapshot.share.changed !== false
+ ? "Copy current shared link"
+ : "Copy link";
+ return (
+
+
+ {url.replace(/^https:\/\//, "")}
+
+
+
+ );
+}
+function ManageShare({ model, snapshot, url }: Props & { url: string | null }) {
+ return (
+
+ {model.audience && model.audience !== snapshot.share.audience ? (
+
+ ) : null}
+ {snapshot.share.state === "link_off" ? (
+
+ ) : null}
+ {url ? (
+
+ ) : null}
+
+ );
+}
+
+export function ShareSourceStatus({ model, snapshot }: Props) {
+ const last = snapshot.job?.result;
+ const recover = snapshot.job?.error?.code === "source_unavailable";
+ let message = "Project files are checked when you share.";
+ if (last?.source === "video_only")
+ message = "Last Studio upload: video only. Project files weren’t included.";
+ if (last?.source === "ready")
+ message =
+ last.state === "ready"
+ ? "Last Studio upload: project files included."
+ : "Project files are ready; sharing is still processing.";
+ return (
+ <>
+ {message}
+ {recover ? (
+
+ ) : null}
+ >
+ );
+}
+
+export function ShareLogin({ model }: { model: QuickShareModel }) {
+ if (
+ !model.errorCode ||
+ ![
+ "not_configured",
+ "unauthenticated",
+ "login_expired",
+ "login_changed",
+ "refresh_failed",
+ "device_auth_failed",
+ ].includes(model.errorCode)
+ )
+ return null;
+ return (
+ <>
+
+
+ Or run hyperframes auth login in your terminal, then return to Studio. Sharing
+ reconnects automatically.
+
+ >
+ );
+}
+
+export function SharePlan({ model, snapshot }: Props) {
+ const space = snapshot.spaces.find((item) => item.id === model.spaceId);
+ const upgrade = space?.upgradeUrl;
+ const allowed =
+ upgrade &&
+ ["https://hyperframes.dev/pricing", "https://dev.hyperframes.dev/pricing"].includes(upgrade);
+ return (
+
+ {space && space.limit !== null && space.used !== null ? (
+
+ {space.used} of {space.limit} free share links used
+
+ ) : null}
+ {space?.plan === "free" && allowed ? (
+
+ Upgrade to Pro
+
+
+ ) : null}
+
+ );
+}
diff --git a/packages/studio/src/components/share/ShareAudience.tsx b/packages/studio/src/components/share/ShareAudience.tsx
new file mode 100644
index 0000000000..46d9667e81
--- /dev/null
+++ b/packages/studio/src/components/share/ShareAudience.tsx
@@ -0,0 +1,92 @@
+import { CaretDown, Globe, Lock, Users, UserPlus } from "@phosphor-icons/react";
+import type { LocalShareAudience, LocalShareSnapshot } from "@hyperframes/studio-server";
+import { Menu, MenuRadioGroup, MenuRadioItem } from "../ui";
+import { isAudience } from "./localShareClient";
+import type { QuickShareModel } from "./useQuickShare";
+
+const AUDIENCES = {
+ public: { label: "Anyone with the link", detail: "Anyone you send the link to", icon: Globe },
+ team: {
+ label: "Anyone in this workspace",
+ detail: "People in your signed-in workspace",
+ icon: Users,
+ },
+ invite: {
+ label: "Only invited people",
+ detail: "People you add in Manage sharing",
+ icon: UserPlus,
+ },
+ private: { label: "Only you", detail: "This existing share is private", icon: Lock },
+};
+
+export function ShareAudience({
+ model,
+ snapshot,
+}: {
+ model: QuickShareModel;
+ snapshot: LocalShareSnapshot;
+}) {
+ const selected = model.audience ? AUDIENCES[model.audience] : null;
+ const Icon = selected?.icon ?? Lock;
+ const space = snapshot.spaces.find((item) => item.id === model.spaceId);
+ const choices: LocalShareAudience[] = ["public", "team", "invite"];
+ if (snapshot.share.audience === "private") choices.push("private");
+ return (
+
+ );
+}
diff --git a/packages/studio/src/components/share/localShareClient.ts b/packages/studio/src/components/share/localShareClient.ts
new file mode 100644
index 0000000000..c2002fdc0e
--- /dev/null
+++ b/packages/studio/src/components/share/localShareClient.ts
@@ -0,0 +1,171 @@
+import type {
+ LocalShareAction,
+ LocalShareAudience,
+ LocalShareJob,
+ LocalShareSnapshot,
+ LocalShareState,
+ LocalShareSpace,
+} from "@hyperframes/studio-server";
+import { studioApiFetch } from "../../utils/studioApiFetch";
+
+const audiences: readonly LocalShareAudience[] = ["public", "team", "invite", "private"];
+const record = (value: unknown): value is Record =>
+ typeof value === "object" && value !== null && !Array.isArray(value);
+const text = (value: unknown): value is string => typeof value === "string";
+const nullableText = (value: unknown): value is string | null => value === null || text(value);
+const nullableBoolean = (value: unknown): value is boolean | null =>
+ value === null || typeof value === "boolean";
+const nullableNumber = (value: unknown): value is number | null =>
+ value === null || (typeof value === "number" && Number.isFinite(value));
+export const isAudience = (value: unknown): value is LocalShareAudience =>
+ audiences.some((mode) => mode === value);
+function isState(value: unknown): value is LocalShareState {
+ return (
+ record(value) &&
+ ["not_shared", "link_off", "ready", "processing", "failed", "unavailable"].includes(
+ String(value.state),
+ ) &&
+ optionalFailure(value.failure) &&
+ nullableText(value.url) &&
+ text(value.manageUrl) &&
+ nullableBoolean(value.changed) &&
+ nullableAudience(value.audience) &&
+ nullableText(value.spaceId) &&
+ ["not_checked", "ready", "video_only"].includes(String(value.source))
+ );
+}
+function isSpace(value: unknown): value is LocalShareSpace {
+ return (
+ record(value) &&
+ text(value.id) &&
+ text(value.name) &&
+ typeof value.bound === "boolean" &&
+ typeof value.canCreate === "boolean" &&
+ Array.isArray(value.audiences) &&
+ value.audiences.every(isAudience) &&
+ nullableNumber(value.used) &&
+ nullableNumber(value.limit)
+ );
+}
+function isError(value: unknown): boolean {
+ return value === null || (record(value) && text(value.code) && text(value.message));
+}
+
+function isJob(value: unknown): value is LocalShareJob {
+ return (
+ record(value) &&
+ text(value.id) &&
+ ["running", "done", "failed"].includes(String(value.state)) &&
+ text(value.step) &&
+ (value.result === null || isState(value.result)) &&
+ isError(value.error)
+ );
+}
+function isSnapshot(value: unknown): value is LocalShareSnapshot {
+ return (
+ record(value) &&
+ typeof value.versionSharing === "boolean" &&
+ isState(value.share) &&
+ Array.isArray(value.spaces) &&
+ value.spaces.every(isSpace) &&
+ (value.job === null || isJob(value.job))
+ );
+}
+export class LocalShareError extends Error {
+ constructor(
+ public readonly code: string,
+ message: string,
+ public readonly job: LocalShareJob | null = null,
+ ) {
+ super(message);
+ }
+}
+async function json(
+ path: string,
+ token: string | null,
+ signal: AbortSignal,
+ action?: LocalShareAction,
+): Promise {
+ const response = await studioApiFetch(`/api/share/${path}`, {
+ method: action ? "POST" : "GET",
+ signal: AbortSignal.any([signal, AbortSignal.timeout(30_000)]),
+ headers: {
+ ...(token ? { "X-Hyperframes-Share-CSRF": token } : {}),
+ ...(action ? { "Content-Type": "application/json" } : {}),
+ },
+ ...(action ? { body: JSON.stringify(action) } : {}),
+ });
+ const body: unknown = await response.json().catch(() => null);
+ if (!response.ok) throw responseError(body);
+ return body;
+}
+function responseError(body: unknown): LocalShareError {
+ const code = record(body) && text(body.code) ? body.code : "unavailable";
+ const message =
+ record(body) && text(body.message)
+ ? body.message
+ : "Sharing is unavailable. Try again from a local Studio preview.";
+ const job = record(body) && isJob(body.job) ? body.job : null;
+ return new LocalShareError(code, message, job);
+}
+
+export async function shareBootstrap(signal: AbortSignal): Promise {
+ const value = await json("bootstrap", null, signal);
+ if (!record(value) || !text(value.csrf) || !/^[A-Za-z0-9_-]{43}$/.test(value.csrf))
+ throw new LocalShareError("unavailable", "Sharing is not available in this Studio host.");
+ return value.csrf;
+}
+export async function shareSnapshot(
+ token: string,
+ signal: AbortSignal,
+): Promise {
+ const value = await json("snapshot", token, signal);
+ if (!isSnapshot(value))
+ throw new LocalShareError(
+ "unavailable",
+ "Sharing returned an unreadable response. Refresh Studio.",
+ );
+ return value;
+}
+export async function shareAction(
+ token: string,
+ action: LocalShareAction,
+ signal: AbortSignal,
+): Promise {
+ const value = await json("actions", token, signal, action);
+ if (!isJob(value))
+ throw new LocalShareError(
+ "unavailable",
+ "Could not start sharing. Refresh to check its status.",
+ );
+ return value;
+}
+export async function shareJob(
+ token: string,
+ id: string,
+ signal: AbortSignal,
+): Promise {
+ const value = await json(`jobs/${encodeURIComponent(id)}`, token, signal);
+ if (!isJob(value))
+ throw new LocalShareError(
+ "unavailable",
+ "Could not read sharing progress. Refresh to check its status.",
+ );
+ return value;
+}
+export function safeShareUrl(value: string): string | null {
+ try {
+ const url = new URL(value);
+ return url.protocol === "https:" && !url.username && !url.password ? url.href : null;
+ } catch {
+ return null;
+ }
+}
+
+function optionalFailure(value: unknown): boolean {
+ return value === undefined || nullableText(value);
+}
+
+function nullableAudience(value: unknown): boolean {
+ return value === null || isAudience(value);
+}
diff --git a/packages/studio/src/components/share/localShareTelemetry.test.ts b/packages/studio/src/components/share/localShareTelemetry.test.ts
new file mode 100644
index 0000000000..b98659de7a
--- /dev/null
+++ b/packages/studio/src/components/share/localShareTelemetry.test.ts
@@ -0,0 +1,22 @@
+import { afterEach, expect, it, vi } from "vitest";
+const policy = vi.hoisted(() => vi.fn());
+vi.mock("../../telemetry/policy", () => ({ browserTelemetryAllowed: policy }));
+import { shareInteraction } from "./localShareTelemetry";
+afterEach(() => vi.unstubAllGlobals());
+it("obeys browser opt-out before calling the guarded local bridge", async () => {
+ const fetch = vi.fn(async () => new Response(null, { status: 204 }));
+ vi.stubGlobal("fetch", fetch);
+ policy.mockReturnValue(false);
+ shareInteraction("token", { event: "share_opened", link: "none" });
+ expect(fetch).not.toHaveBeenCalled();
+ policy.mockReturnValue(true);
+ shareInteraction("token", { event: "share_link_copied", via: "copy" });
+ expect(fetch).toHaveBeenCalledWith(
+ "/api/share/events",
+ expect.objectContaining({
+ method: "POST",
+ headers: { "Content-Type": "application/json", "X-Hyperframes-Share-CSRF": "token" },
+ body: JSON.stringify({ event: "share_link_copied", via: "copy" }),
+ }),
+ );
+});
diff --git a/packages/studio/src/components/share/localShareTelemetry.ts b/packages/studio/src/components/share/localShareTelemetry.ts
new file mode 100644
index 0000000000..965b2ca8bb
--- /dev/null
+++ b/packages/studio/src/components/share/localShareTelemetry.ts
@@ -0,0 +1,13 @@
+import type { LocalShareInteraction } from "@hyperframes/studio-server";
+import { browserTelemetryAllowed } from "../../telemetry/policy";
+import { studioApiFetch } from "../../utils/studioApiFetch";
+
+export function shareInteraction(token: string, event: LocalShareInteraction): void {
+ if (!browserTelemetryAllowed()) return;
+ void studioApiFetch("/api/share/events", {
+ method: "POST",
+ signal: AbortSignal.timeout(5000),
+ headers: { "Content-Type": "application/json", "X-Hyperframes-Share-CSRF": token },
+ body: JSON.stringify(event),
+ }).catch(() => {});
+}
diff --git a/packages/studio/src/components/share/useQuickShare.ts b/packages/studio/src/components/share/useQuickShare.ts
new file mode 100644
index 0000000000..0015be0144
--- /dev/null
+++ b/packages/studio/src/components/share/useQuickShare.ts
@@ -0,0 +1,189 @@
+import { useRef, useState } from "react";
+import type {
+ LocalShareAction,
+ LocalShareAudience,
+ LocalShareJob,
+ LocalShareSnapshot,
+} from "@hyperframes/studio-server";
+import { useMountEffect } from "../../hooks/useMountEffect";
+import { LocalShareError, shareAction, shareJob, shareSnapshot } from "./localShareClient";
+import { shareInteraction } from "./localShareTelemetry";
+const STEP_LABELS: Record = {
+ preparing: "Preparing your video…",
+ signing_in: "Finish signing in in your browser…",
+ uploading: "Uploading your video…",
+ processing: "Processing your video…",
+ checking: "Checking your video…",
+};
+const failure = (error: unknown) =>
+ error instanceof LocalShareError
+ ? error.message
+ : "Sharing couldn’t finish. Try again to check its status.";
+
+export function useQuickShare(token: string, beforeShare?: () => Promise) {
+ const [snapshot, setSnapshot] = useState(null);
+ const [audience, setAudience] = useState("");
+ const [spaceId, setSpaceId] = useState("");
+ const [busy, setBusyState] = useState(false);
+ const working = useRef(false);
+ const reconnectOnReturn = useRef(false);
+ const [error, setError] = useState(null);
+ const [errorCode, setErrorCode] = useState(null);
+ const [copied, setCopied] = useState(false);
+ const opened = useRef(false);
+ const lifetime = useRef(null);
+ const timer = useRef | null>(null);
+ const [progress, setProgress] = useState("");
+
+ function setWorking(value: boolean) {
+ working.current = value;
+ setBusyState(value);
+ }
+
+ async function poll(job: LocalShareJob, signal: AbortSignal) {
+ if (signal.aborted) return;
+ if (job.state === "running") {
+ setWorking(true);
+ setProgress(STEP_LABELS[job.step] ?? "Preparing share…");
+ timer.current = setTimeout(() => {
+ void shareJob(token, job.id, signal)
+ .then((next) => poll(next, signal))
+ .catch((cause) => {
+ reportFailure(cause, signal);
+ });
+ }, 1000);
+ return;
+ }
+ setWorking(false);
+ setProgress("");
+ const result = job.result;
+ if (result) setSnapshot((prior) => (prior ? { ...prior, share: result, job } : prior));
+ await refresh(signal, job.state === "failed");
+ }
+ async function refresh(signal: AbortSignal, preserveSelection = false) {
+ setError(null);
+ setErrorCode(null);
+ setWorking(true);
+ if (timer.current) clearTimeout(timer.current);
+ try {
+ const next = await shareSnapshot(token, signal);
+ if (signal.aborted) return;
+ recordOpen(next);
+ reconnectOnReturn.current = false;
+ setSnapshot(next);
+ if (!preserveSelection) resetSelection(next);
+ if (next.job?.error) {
+ setError(next.job.error.message);
+ setErrorCode(next.job.error.code);
+ }
+ if (next.job?.state === "running") await poll(next.job, signal);
+ else setWorking(false);
+ return true;
+ } catch (cause) {
+ reportFailure(cause, signal);
+ return false;
+ }
+ }
+ useMountEffect(() => {
+ const controller = new AbortController();
+ lifetime.current = controller;
+ const resume = () => {
+ if (document.visibilityState !== "hidden" && reconnectOnReturn.current && !working.current)
+ void refresh(controller.signal);
+ };
+ window.addEventListener("focus", resume);
+ document.addEventListener("visibilitychange", resume);
+ void refresh(controller.signal);
+ return () => {
+ window.removeEventListener("focus", resume);
+ document.removeEventListener("visibilitychange", resume);
+ controller.abort();
+ if (timer.current) clearTimeout(timer.current);
+ };
+ });
+ async function run(action: LocalShareAction) {
+ const signal = lifetime.current?.signal;
+ if (!signal || signal.aborted || working.current) return;
+ setWorking(true);
+ setError(null);
+ setErrorCode(null);
+ setCopied(false);
+ setProgress("Preparing share…");
+ try {
+ if (["share", "update"].includes(action.action)) await beforeShare?.();
+ if (!signal.aborted) await poll(await shareAction(token, action, signal), signal);
+ } catch (cause) {
+ await recoverActionFailure(cause, signal);
+ }
+ }
+ async function recoverActionFailure(cause: unknown, signal: AbortSignal) {
+ if (
+ cause instanceof LocalShareError &&
+ [
+ "login_changed",
+ "login_expired",
+ "unauthenticated",
+ "refresh_failed",
+ "not_configured",
+ ].includes(cause.code)
+ ) {
+ reportFailure(cause, signal);
+ return;
+ }
+ setProgress("");
+ const recovered = await refresh(signal, true);
+ if (recovered && !signal.aborted) {
+ setError(failure(cause));
+ setErrorCode(cause instanceof LocalShareError ? cause.code : null);
+ }
+ }
+ function recordOpen(value: LocalShareSnapshot | null) {
+ if (opened.current) return;
+ opened.current = true;
+ const share = value?.share;
+ const link = share?.url ? (share.changed ? "changed" : "live") : "none";
+ shareInteraction(token, { event: "share_opened", link });
+ }
+ function resetSelection(next: LocalShareSnapshot) {
+ setAudience(next.share.audience ?? "");
+ setSpaceId(next.share.spaceId ?? next.spaces.find((space) => space.bound)?.id ?? "");
+ }
+ function reportFailure(cause: unknown, signal: AbortSignal) {
+ if (signal.aborted) return;
+ recordOpen(null);
+ reconnectOnReturn.current = true;
+ setSnapshot(null);
+ setCopied(false);
+ setError(failure(cause));
+ setErrorCode(cause instanceof LocalShareError ? cause.code : null);
+ if (cause instanceof LocalShareError && cause.job?.state === "running") {
+ void poll(cause.job, signal);
+ return;
+ }
+ setWorking(false);
+ setProgress("");
+ }
+ async function copy(url: string) {
+ try {
+ await navigator.clipboard.writeText(url);
+ setCopied(true);
+ shareInteraction(token, { event: "share_link_copied", via: "copy" });
+ } catch {
+ setError("Couldn’t copy. Open the shared page and copy its address.");
+ }
+ }
+ return {
+ snapshot,
+ audience,
+ setAudience,
+ spaceId,
+ busy,
+ error,
+ errorCode,
+ copied,
+ progress,
+ run,
+ copy,
+ };
+}
+export type QuickShareModel = ReturnType;
diff --git a/scripts/check-cli-share-capture.mjs b/scripts/check-cli-share-capture.mjs
new file mode 100644
index 0000000000..4406f01a7f
--- /dev/null
+++ b/scripts/check-cli-share-capture.mjs
@@ -0,0 +1,28 @@
+import assert from "node:assert/strict";
+import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { pathToFileURL } from "node:url";
+
+// Exercise the bundled CLI, whose import.meta.url differs from the share source tree.
+const dist = resolve(process.argv[2]);
+const chunk = readdirSync(dist).find((name) => {
+ if (!name.endsWith(".js")) return false;
+ const source = readFileSync(join(dist, name), "utf8");
+ return /export\s*\{[^}]*\bshareContentFingerprint\b/s.test(source);
+});
+assert.ok(chunk, "CLI must expose its bundled source fingerprint to the share command");
+const { shareContentFingerprint } = await import(pathToFileURL(join(dist, chunk)).href);
+const project = mkdtempSync(join(tmpdir(), "hyperframes-packed-share-"));
+try {
+ writeFileSync(join(project, "index.html"), "Video");
+ const asset = join(project, "café.txt");
+ writeFileSync(asset, "first");
+ const before = await shareContentFingerprint(project);
+ assert.match(before, /^[a-f0-9]{64}$/);
+ writeFileSync(asset, "second");
+ assert.notEqual(await shareContentFingerprint(project), before);
+ console.log("Bundled CLI captures portable source with its policy and Unicode registries.");
+} finally {
+ rmSync(project, { recursive: true, force: true });
+}
diff --git a/scripts/package-size-budgets.json b/scripts/package-size-budgets.json
index fa4f9fe216..f981c5dd93 100644
--- a/scripts/package-size-budgets.json
+++ b/scripts/package-size-budgets.json
@@ -4,7 +4,7 @@
"unpacked": 290508
},
"@hyperframes/cli": {
- "packed": 8062664,
+ "packed": 8577627,
"unpacked": 25159107
},
"@hyperframes/core": {
diff --git a/scripts/studio-runtime-smoke.mjs b/scripts/studio-runtime-smoke.mjs
index 4d2843042a..ff9af88220 100644
--- a/scripts/studio-runtime-smoke.mjs
+++ b/scripts/studio-runtime-smoke.mjs
@@ -23,6 +23,7 @@ function text(body, contentType = "text/plain") {
const PROJECT_PATH = `/api/projects/${PROJECT_ID}`;
const GET_RESPONSES = new Map([
+ ["/api/share/bootstrap", json({ csrf: "s".repeat(43) })],
[
"/api/projects",
json({ projects: [{ id: PROJECT_ID, dir: "/tmp/smoke-test", title: "Smoke test" }] }),
diff --git a/scripts/studio-runtime-smoke.test.mjs b/scripts/studio-runtime-smoke.test.mjs
index 3b687069ba..23d37ad3f6 100644
--- a/scripts/studio-runtime-smoke.test.mjs
+++ b/scripts/studio-runtime-smoke.test.mjs
@@ -13,6 +13,9 @@ function bodyOf(method, path) {
}
describe("Studio runtime smoke fixtures", () => {
+ it("bootstraps the sharing entry point without credentials", () => {
+ assert.deepEqual(bodyOf("GET", "/api/share/bootstrap"), { csrf: "s".repeat(43) });
+ });
it("matches the collection and project-detail API schemas", () => {
assert.deepEqual(bodyOf("GET", "/api/projects"), {
projects: [{ id: "smoke-test", dir: "/tmp/smoke-test", title: "Smoke test" }],
diff --git a/scripts/verify-packed-manifests.mjs b/scripts/verify-packed-manifests.mjs
index b9827bbc2e..8d964bc233 100644
--- a/scripts/verify-packed-manifests.mjs
+++ b/scripts/verify-packed-manifests.mjs
@@ -558,6 +558,14 @@ function verifyPackedConsumer(packDir, packedWorkspaces) {
if (!cliOutput.toLowerCase().includes("hyperframes")) {
throw new Error("Packed CLI help did not identify HyperFrames");
}
+ execFileSync(
+ "node",
+ [
+ join(ROOT, "scripts", "check-cli-share-capture.mjs"),
+ join(fixtureDir, "node_modules", "@hyperframes", "cli", "dist"),
+ ],
+ { cwd: fixtureDir, stdio: "inherit", timeout: 30_000 },
+ );
console.log(smokeOutput.trim());
console.log(
"Verified clean packed consumer install, Node execution, NodeNext declaration check, Vite resolution, and CLI startup.",