From 489f3e2395dd142602c998a944c4362a9afea120 Mon Sep 17 00:00:00 2001
From: Renfei Zhou
Date: Thu, 19 Nov 2026 05:10:34 +0000
Subject: [PATCH] feat(fork): offer a Zulip page as a right-panel tab
A machine that sets T3CODE_ZULIP_PANEL_URL offers Zulip in the right
panel's "+" menu and empty launcher. The tab shows that page in a
frame, with a reload button and a new-tab link.
Each person signs in to Zulip in their own browser. T3 Code holds no
Zulip credential and learns only the URL.
The tab is offered only on a top-level page whose hostname is a
sibling of the URL's hostname. Zulip's login cookie is SameSite=Lax,
and a browser sends it to a frame only on the page's own site, so
anywhere else the tab could not be logged in.
Without the variable nothing changes.
Co-Authored-By: Claude Fable 5.2
---
README.md | 1 +
.../src/environment/ServerEnvironment.ts | 2 +
apps/server/src/fork/zulipPanel.ts | 17 +++++
apps/web/src/closedViewStore.ts | 1 +
apps/web/src/components/RightPanelTabs.tsx | 2 +
.../chat/RightPanelSurfaceContent.tsx | 3 +
.../src/fork/dashboard/dashboardSurface.ts | 11 ++-
.../rightPanelMenu/RightPanelMenuSettings.tsx | 5 +-
.../web/src/fork/rightPanelMenu/menu.logic.ts | 1 +
apps/web/src/fork/zulip/ZulipPanel.tsx | 76 +++++++++++++++++++
apps/web/src/fork/zulip/zulipPanel.ts | 30 ++++++++
apps/web/src/rightPanelStore.ts | 6 +-
packages/contracts/src/environment.ts | 3 +
.../contracts/src/fork/zulipPanel.test.ts | 57 ++++++++++++++
packages/contracts/src/fork/zulipPanel.ts | 68 +++++++++++++++++
packages/contracts/src/index.ts | 1 +
16 files changed, 279 insertions(+), 5 deletions(-)
create mode 100644 apps/server/src/fork/zulipPanel.ts
create mode 100644 apps/web/src/fork/zulip/ZulipPanel.tsx
create mode 100644 apps/web/src/fork/zulip/zulipPanel.ts
create mode 100644 packages/contracts/src/fork/zulipPanel.test.ts
create mode 100644 packages/contracts/src/fork/zulipPanel.ts
diff --git a/README.md b/README.md
index 4ff4bb6eb64cc..a81ac365918b1 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@ This is a fork of T3 Code that integrates a few additional features, including:
- **Whiteboard:** A tldraw whiteboard that sits side-by-side with T3 Code, allowing users to interact with agents (or other users) by editing and pointing to the whiteboard. Both the user and the agents can conveniently write links that point to a rectangular region on the whiteboard. Agents can also draw Mermaid diagrams on it, such as flowcharts and statecharts.
- When the whiteboard's config maps T3 Code's hostname to `"app"`, that hostname opens T3 Code itself, and the project's board opens as a Whiteboard tab in its right panel (+ → Whiteboard). There, Settings → Right panel lets each browser hide items of the + menu or change their letters, over machine defaults set in the whiteboard's config.
+- **Zulip tab:** When the machine sets `T3CODE_ZULIP_PANEL_URL` to a Zulip page, the right panel offers that page as a Zulip tab (+ → Zulip). Each person signs in to Zulip in their own browser. The tab shows only when T3 Code is opened from a sibling hostname of that page (such as `t3.example.com` beside `zulip.example.com`), and the page must allow T3 Code to frame it, which a stock Zulip server does not.
- **Better support for manually switching accounts mid-session:**
- After hitting the usage limit of an account, the thread now retries after 2 minutes and 30 minutes in addition to the default retry behavior of T3 Code. This allows the thread to recover earlier if the user manually switches the account.
- New Codex/Antigravity logins are picked up mid-session without a full restart.
diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts
index 4cb94fadc9d6b..ac355cb5e72e8 100644
--- a/apps/server/src/environment/ServerEnvironment.ts
+++ b/apps/server/src/environment/ServerEnvironment.ts
@@ -25,6 +25,7 @@ import * as ProcessRunner from "../processRunner.ts";
import { isSpeechPlatformSupported } from "../speech/platform.ts";
import { fastCheckoutCapabilities } from "../fork/reflinkWorktrees/fastCheckoutSetting.ts";
import { whiteboardPanelCapabilities } from "../fork/whiteboardPanel.ts";
+import { zulipPanelCapabilities } from "../fork/zulipPanel.ts";
import { resolveServerEnvironmentLabel } from "./ServerEnvironmentLabel.ts";
import { detectServerEnvironmentMachineKind } from "./ServerEnvironmentMachine.ts";
@@ -305,6 +306,7 @@ export const make = Effect.gen(function* () {
shellThreadFamilies: true,
shellOlderSettled: true,
...(yield* whiteboardPanelCapabilities()),
+ ...(yield* zulipPanelCapabilities()),
},
};
diff --git a/apps/server/src/fork/zulipPanel.ts b/apps/server/src/fork/zulipPanel.ts
new file mode 100644
index 0000000000000..fc60bf9875eb6
--- /dev/null
+++ b/apps/server/src/fork/zulipPanel.ts
@@ -0,0 +1,17 @@
+import { parseZulipPanelUrl } from "@t3tools/contracts";
+import * as HostProcess from "@t3tools/shared/HostProcess";
+import * as Effect from "effect/Effect";
+
+// The warning names the variable only, never its value.
+export const zulipPanelCapabilities = Effect.fn("zulipPanel.capabilities")(function* () {
+ const raw = (yield* HostProcess.Environment).T3CODE_ZULIP_PANEL_URL;
+ if (raw === undefined) return {};
+ const url = parseZulipPanelUrl(raw);
+ if (url === undefined) {
+ yield* Effect.logWarning(
+ "T3CODE_ZULIP_PANEL_URL is not an https URL (or http on loopback); the Zulip tab is off",
+ );
+ return {};
+ }
+ return { zulipPanel: { url } };
+});
diff --git a/apps/web/src/closedViewStore.ts b/apps/web/src/closedViewStore.ts
index 1e9e7dabf5422..2d385f591c575 100644
--- a/apps/web/src/closedViewStore.ts
+++ b/apps/web/src/closedViewStore.ts
@@ -66,6 +66,7 @@ const isClosedViewEntry = (entry: unknown): entry is ClosedViewEntry => {
case "dashboard":
case "replies":
case "whiteboard":
+ case "zulip":
return surface.id === surface.kind;
case "preview":
return surface.resourceId === null || typeof surface.resourceId === "string";
diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx
index f6734ad67a883..ef92773f84117 100644
--- a/apps/web/src/components/RightPanelTabs.tsx
+++ b/apps/web/src/components/RightPanelTabs.tsx
@@ -641,6 +641,7 @@ function surfaceTitle(
case "dashboard":
case "replies":
case "whiteboard":
+ case "zulip":
return modeSurfaceLabel(surface.kind);
case "preview": {
const snapshot = surface.resourceId ? sessions[surface.resourceId] : null;
@@ -737,6 +738,7 @@ function SurfaceIcon({
case "dashboard":
case "replies":
case "whiteboard":
+ case "zulip":
return ;
case "device":
return surface.target?.platform === "ios" ? (
diff --git a/apps/web/src/components/chat/RightPanelSurfaceContent.tsx b/apps/web/src/components/chat/RightPanelSurfaceContent.tsx
index 93c63812375f5..44448f458e7c3 100644
--- a/apps/web/src/components/chat/RightPanelSurfaceContent.tsx
+++ b/apps/web/src/components/chat/RightPanelSurfaceContent.tsx
@@ -17,6 +17,7 @@ import { ThreadDashboardPanel } from "../../fork/dashboard/ThreadDashboardPanel"
import type { CiteAssistantText } from "../../fork/dashboard/dashboardCitation";
import { SubThreadsPanel } from "../../fork/subThreads/SubThreadsPanel";
import { WhiteboardPanel } from "../../fork/whiteboard/WhiteboardPanel";
+import { ZulipPanel } from "../../fork/zulip/ZulipPanel";
import type { ComposerImageAttachment, DraftId } from "../../composerDraftStore";
import type { ShortcutMatchContext } from "../../keybindings";
import type { SideChatParentPanel } from "../../lib/sideChatPane";
@@ -236,6 +237,8 @@ export function RightPanelSurfaceContent(props: {
);
case "whiteboard":
return ;
+ case "zulip":
+ return ;
case "side-chat":
// Not lazy: revealing a suspended tiptap editor tears down its view and crashes the composer.
return (
diff --git a/apps/web/src/fork/dashboard/dashboardSurface.ts b/apps/web/src/fork/dashboard/dashboardSurface.ts
index aad0f3c71a595..fad64fa8d913a 100644
--- a/apps/web/src/fork/dashboard/dashboardSurface.ts
+++ b/apps/web/src/fork/dashboard/dashboardSurface.ts
@@ -1,5 +1,5 @@
import type { ScopedThreadRef } from "@t3tools/contracts";
-import { LayoutDashboard, MessageSquareReply, Presentation } from "lucide-react";
+import { LayoutDashboard, MessageSquareReply, MessageSquareText, Presentation } from "lucide-react";
import { createElement } from "react";
import { useStableCallback } from "../../hooks/useStableCallback";
@@ -19,13 +19,15 @@ import {
useBoardOfferedFor,
useThreadProjectRoot,
} from "../whiteboard/role";
+import { isZulipPanelOffered, readZulipPanelOffered, useZulipPanelRole } from "../zulip/zulipPanel";
/** The fork's right-panel tabs. `shortcut` is the built-in menu letter; "" is none. */
export const FORK_SURFACES = {
dashboard: { label: "Dashboard", icon: LayoutDashboard, shortcut: "" },
replies: { label: "Replies", icon: MessageSquareReply, shortcut: "" },
whiteboard: { label: "Whiteboard", icon: Presentation, shortcut: "W" },
-} as const satisfies Record;
+ zulip: { label: "Zulip", icon: MessageSquareText, shortcut: "Z" },
+} as const satisfies Record;
type ForkSurfaceKind = keyof typeof FORK_SURFACES;
@@ -50,11 +52,12 @@ export const ModeSurfaceIcon = (props: { readonly kind: ForkSurfaceKind }) =>
/** Whether the thread offers the tab `kind`, read outside React. Upstream tabs always pass. */
export function threadHasModeSurface(threadRef: ScopedThreadRef, kind: string): boolean {
if (kind === "whiteboard") return boardOfferedFor(threadRef, readThreadProjectRoot(threadRef));
+ if (kind === "zulip") return readZulipPanelOffered();
if (!(kind in FORK_SURFACES)) return true;
return modeSurfaces(readThreadDisplay(threadRef)).some((surface) => surface === kind);
}
-/** The fork's "+" items: the display's Replies and Dashboard, then Whiteboard on a board host. */
+/** The fork's "+" items: the display's Replies and Dashboard, then Whiteboard and Zulip where offered. */
export function useModeSurfaceActions(
threadRef: ScopedThreadRef | null,
): ReadonlyArray {
@@ -62,6 +65,7 @@ export function useModeSurfaceActions(
const boardPanel = isBoardHost(useBoardHostRole()) && isTopWindow();
const projectRoot = useThreadProjectRoot(boardPanel ? threadRef : null);
const boardOffered = useBoardOfferedFor(threadRef, projectRoot);
+ const zulipOffered = isZulipPanelOffered(useZulipPanelRole());
const open = useStableCallback((kind: ForkSurfaceKind) => {
if (threadRef !== null) useRightPanelStore.getState().open(threadRef, kind);
});
@@ -70,5 +74,6 @@ export function useModeSurfaceActions(
...(boardPanel
? [forkSurfaceAction("whiteboard", boardOffered, () => open("whiteboard"))]
: []),
+ ...(zulipOffered ? [forkSurfaceAction("zulip", true, () => open("zulip"))] : []),
];
}
diff --git a/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx b/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx
index b01ea066094a6..0efbc84702a1f 100644
--- a/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx
+++ b/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx
@@ -26,6 +26,7 @@ import {
import { FORK_SURFACES } from "../dashboard/dashboardSurface";
import { RIGHT_PANEL_SETTINGS_COPY as COPY } from "../forkCopy";
import { isBoardHost, useBoardHostRole } from "../whiteboard/role";
+import { isZulipPanelOffered, useZulipPanelRole } from "../zulip/zulipPanel";
import {
parseMenuLayer,
RIGHT_PANEL_MENU_ITEM_IDS,
@@ -60,6 +61,7 @@ const MENU_ITEM_ROWS = {
replies: forkRow("replies"),
dashboard: forkRow("dashboard"),
whiteboard: forkRow("whiteboard"),
+ zulip: forkRow("zulip"),
} satisfies Record>;
const MENU_ITEMS: ReadonlyArray = RIGHT_PANEL_MENU_ITEM_IDS.map((id) => ({
@@ -174,6 +176,7 @@ function MenuItemSettingsRow(props: {
export function RightPanelMenuSettingsPanel() {
const role = useBoardHostRole();
+ const zulipOffered = isZulipPanelOffered(useZulipPanelRole());
const overrides = useClientSettings((settings) => settings.rightPanelMenuOverrides);
if (role === "unknown") return null;
if (!isBoardHost(role)) return ;
@@ -196,7 +199,7 @@ export function RightPanelMenuSettingsPanel() {
}
>
- {MENU_ITEMS.map((item) => (
+ {MENU_ITEMS.filter((item) => item.id !== "zulip" || zulipOffered).map((item) => (
Zulip is not available here.
+ );
+ }
+ return ;
+}
+
+function ZulipFrame(props: { readonly url: string }) {
+ const [generation, setGeneration] = useState(0);
+ return (
+
+
+
+ setGeneration((current) => current + 1)}
+ />
+ }
+ >
+
+
+ {RELOAD}
+
+
+ }
+ />
+ }
+ >
+
+
+ {OPEN_IN_NEW_TAB}
+
+
+
+
+ );
+}
diff --git a/apps/web/src/fork/zulip/zulipPanel.ts b/apps/web/src/fork/zulip/zulipPanel.ts
new file mode 100644
index 0000000000000..a57f164c20ae7
--- /dev/null
+++ b/apps/web/src/fork/zulip/zulipPanel.ts
@@ -0,0 +1,30 @@
+import { useAtomValue } from "@effect/atom-react";
+import { zulipPanelFrameSource } from "@t3tools/contracts";
+import { Atom } from "effect/reactivity";
+
+import { appAtomRegistry } from "../../rpc/atomRegistry";
+import { primaryServerConfigAtom } from "../../state/server";
+import { isTopWindow } from "../whiteboard/role";
+
+/**
+ * "unknown" until the primary server config arrives. `url` is the page this window may frame;
+ * "off" when the machine set none, or this page cannot frame it (see `zulipPanelFrameSource`).
+ */
+export type ZulipPanelRole = "unknown" | "off" | { readonly url: string };
+
+const zulipPanelRoleAtom = Atom.make((get): ZulipPanelRole => {
+ const config = get(primaryServerConfigAtom);
+ if (config === null) return "unknown";
+ const raw = config.environment.capabilities.zulipPanel?.url;
+ if (raw === undefined || !isTopWindow()) return "off";
+ const url = zulipPanelFrameSource(raw, window.location.origin);
+ return url === undefined ? "off" : { url };
+}).pipe(Atom.withLabel("fork-zulip-panel-role"));
+
+export const useZulipPanelRole = (): ZulipPanelRole => useAtomValue(zulipPanelRoleAtom);
+
+export const isZulipPanelOffered = (role: ZulipPanelRole): role is { readonly url: string } =>
+ typeof role === "object";
+
+export const readZulipPanelOffered = (): boolean =>
+ isZulipPanelOffered(appAtomRegistry.get(zulipPanelRoleAtom));
diff --git a/apps/web/src/rightPanelStore.ts b/apps/web/src/rightPanelStore.ts
index 49aac0b0997c0..fd3623fc04d54 100644
--- a/apps/web/src/rightPanelStore.ts
+++ b/apps/web/src/rightPanelStore.ts
@@ -39,6 +39,7 @@ const RIGHT_PANEL_KINDS = [
"dashboard",
"replies",
"whiteboard",
+ "zulip",
] as const;
export type RightPanelKind = (typeof RIGHT_PANEL_KINDS)[number];
@@ -113,7 +114,8 @@ export type RightPanelSurface =
| { id: `side-chat:${string}`; kind: "side-chat"; threadId: ThreadId }
| { id: "dashboard"; kind: "dashboard" }
| { id: "replies"; kind: "replies" }
- | { id: "whiteboard"; kind: "whiteboard" };
+ | { id: "whiteboard"; kind: "whiteboard" }
+ | { id: "zulip"; kind: "zulip" };
const RIGHT_PANEL_STORAGE_KEY = "t3code:right-panel-state:v2";
const RIGHT_PANEL_STORAGE_VERSION = 15;
@@ -284,6 +286,8 @@ const singletonSurface = (
return { id: "replies", kind };
case "whiteboard":
return { id: "whiteboard", kind };
+ case "zulip":
+ return { id: "zulip", kind };
}
};
diff --git a/packages/contracts/src/environment.ts b/packages/contracts/src/environment.ts
index 81019a8529ee3..cce0a924b829e 100644
--- a/packages/contracts/src/environment.ts
+++ b/packages/contracts/src/environment.ts
@@ -9,6 +9,7 @@ import {
TrimmedNonEmptyString,
} from "./baseSchemas.ts";
import { WhiteboardPanelCapability } from "./fork/rightPanelMenu.ts";
+import { ZulipPanelCapability } from "./fork/zulipPanel.ts";
import { SourceControlProviderKind } from "./sourceControl.ts";
export const ORCHESTRATION_PROTOCOL_VERSION = 2;
@@ -218,6 +219,8 @@ export const ExecutionEnvironmentCapabilities = Schema.Struct({
linkedThreadRefreshes: Schema.optionalKey(Schema.Boolean),
/** Sent only by a whiteboard board host: the panel board and the machine's menu defaults. */
whiteboardPanel: Schema.optionalKey(WhiteboardPanelCapability),
+ /** Sent only by a machine that sets a Zulip page for the right panel's Zulip tab. */
+ zulipPanel: Schema.optionalKey(ZulipPanelCapability),
});
export type ExecutionEnvironmentCapabilities = typeof ExecutionEnvironmentCapabilities.Type;
diff --git a/packages/contracts/src/fork/zulipPanel.test.ts b/packages/contracts/src/fork/zulipPanel.test.ts
new file mode 100644
index 0000000000000..7cebab54ebf41
--- /dev/null
+++ b/packages/contracts/src/fork/zulipPanel.test.ts
@@ -0,0 +1,57 @@
+import { describe, expect, it } from "@effect/vitest";
+
+import { parseZulipPanelUrl, zulipPanelFrameSource } from "./zulipPanel.ts";
+
+describe("parseZulipPanelUrl", () => {
+ it.each<[raw: string, url: string | undefined]>([
+ ["https://zulip.example.com/", "https://zulip.example.com/"],
+ ["https://zulip.example.com", "https://zulip.example.com/"],
+ ["http://localhost:6310/", "http://localhost:6310/"],
+ ["http://127.0.0.1:6310/", "http://127.0.0.1:6310/"],
+ ["http://[::1]:6310/", "http://[::1]:6310/"],
+ ["http://zulip.example.com/", undefined],
+ ["https://user:pw@zulip.example.com/", undefined],
+ ["javascript:alert(1)", undefined],
+ ["data:text/html,x", undefined],
+ ["", undefined],
+ ["zulip.example.com", undefined],
+ ])("%j gives %j", (raw, url) => {
+ expect(parseZulipPanelUrl(raw)).toBe(url);
+ });
+});
+
+describe("zulipPanelFrameSource", () => {
+ const ZULIP = "https://zulip.example.com/";
+
+ it.each<[why: string, rawUrl: string, pageOrigin: string, source: string | undefined]>([
+ ["sibling names under a two-label parent", ZULIP, "https://t3.example.com", ZULIP],
+ [
+ "sibling names under a longer parent",
+ "https://zulip.team.example.com/",
+ "https://t3.team.example.com",
+ "https://zulip.team.example.com/",
+ ],
+ [
+ "one name on two ports",
+ "http://localhost:6310/",
+ "http://localhost:3773",
+ "http://localhost:6310/",
+ ],
+ ["the page's own origin", "https://t3.example.com/", "https://t3.example.com", undefined],
+ ["another parent domain", ZULIP, "https://t3.example.org", undefined],
+ ["a longer look-alike name", ZULIP, "https://t3.example.com.evil.example", undefined],
+ ["names under a one-label parent", "https://b.com/", "https://a.com", undefined],
+ [
+ "names that end with the root dot",
+ "https://zulip.example.com./",
+ "https://t3.example.com.",
+ undefined,
+ ],
+ ["two addresses", "http://127.0.0.2:6310/", "http://127.0.0.1:3773", undefined],
+ ["an https URL from an http page", ZULIP, "http://t3.example.com", undefined],
+ ["the desktop app's page", ZULIP, "t3code://app", undefined],
+ ["a URL the parser rejects", "http://zulip.example.com/", "http://t3.example.com", undefined],
+ ])("%s: %j framed from %j gives %j", (_why, rawUrl, pageOrigin, source) => {
+ expect(zulipPanelFrameSource(rawUrl, pageOrigin)).toBe(source);
+ });
+});
diff --git a/packages/contracts/src/fork/zulipPanel.ts b/packages/contracts/src/fork/zulipPanel.ts
new file mode 100644
index 0000000000000..562337c9c5924
--- /dev/null
+++ b/packages/contracts/src/fork/zulipPanel.ts
@@ -0,0 +1,68 @@
+import * as Schema from "effect/Schema";
+
+/**
+ * Sent only by a machine that sets `T3CODE_ZULIP_PANEL_URL`: the page the Zulip tab frames.
+ * The URL stays a plain string here, so a bad value can never fail the server config's decoding.
+ */
+export const ZulipPanelCapability = Schema.Struct({ url: Schema.String });
+export type ZulipPanelCapability = typeof ZulipPanelCapability.Type;
+
+function parseUrl(raw: string): URL | undefined {
+ try {
+ return new URL(raw);
+ } catch {
+ return undefined;
+ }
+}
+
+const isLoopbackHost = (hostname: string): boolean =>
+ hostname === "localhost" || hostname === "[::1]" || /^127(\.\d+){3}$/.test(hostname);
+
+/**
+ * The URL in normal form, or undefined when the tab must stay off.
+ *
+ * Accepts an absolute `https:` URL with no user name or password, and `http:` only for
+ * `localhost` and loopback addresses. `javascript:` and `data:` can never become a frame source.
+ */
+export function parseZulipPanelUrl(raw: string): string | undefined {
+ const url = parseUrl(raw);
+ if (url === undefined || url.username !== "" || url.password !== "") return undefined;
+ const allowed =
+ url.protocol === "https:" || (url.protocol === "http:" && isLoopbackHost(url.hostname));
+ return allowed ? url.href : undefined;
+}
+
+/** The host name without its first label, when that parent has at least two labels. */
+function parentDomain(hostname: string): string | undefined {
+ const labels = hostname.split(".");
+ if (labels.length < 3 || labels.includes("")) return undefined;
+ // A parsed host whose last label is a number is an IPv4 address, which has no parent.
+ if (/^\d+$/.test(labels.at(-1) ?? "")) return undefined;
+ return labels.slice(1).join(".");
+}
+
+/**
+ * Sibling hosts: the same name (then the ports differ), or two names with the same parent domain
+ * (`t3.example.com` and `zulip.example.com` give `example.com`). This stands in for "same site"
+ * without a public suffix list.
+ */
+function isSiblingHost(left: string, right: string): boolean {
+ if (left === right) return true;
+ const parent = parentDomain(left);
+ return parent !== undefined && parent === parentDomain(right);
+}
+
+/**
+ * The URL a page at `pageOrigin` may frame, or undefined: `parseZulipPanelUrl`, plus the page is
+ * another origin (a same-origin frame with scripts could reach into T3 Code's own page) with the
+ * same scheme on a sibling host. Zulip's login cookie is `SameSite=Lax`, sent to a frame only on
+ * the page's own site, so from the desktop app or another domain the tab could never be logged in.
+ */
+export function zulipPanelFrameSource(rawUrl: string, pageOrigin: string): string | undefined {
+ const source = parseZulipPanelUrl(rawUrl);
+ const page = parseUrl(pageOrigin);
+ if (source === undefined || page === undefined) return undefined;
+ const frame = new URL(source);
+ if (page.protocol !== frame.protocol || page.origin === frame.origin) return undefined;
+ return isSiblingHost(page.hostname, frame.hostname) ? source : undefined;
+}
diff --git a/packages/contracts/src/index.ts b/packages/contracts/src/index.ts
index a254f6c62afce..a0c7b889e13df 100644
--- a/packages/contracts/src/index.ts
+++ b/packages/contracts/src/index.ts
@@ -41,6 +41,7 @@ export * from "./fork/threadSubThreads.ts";
export * from "./fork/threadUserView.ts";
export * from "./fork/fyi.ts";
export * from "./fork/rightPanelMenu.ts";
+export * from "./fork/zulipPanel.ts";
export * from "./managedPolicy.ts";
export * from "./git.ts";
export * from "./vcs.ts";