diff --git a/.github/workflows/fork-principals.yml b/.github/workflows/fork-principals.yml index 1f1dd255d721..c1f7ecf050a3 100644 --- a/.github/workflows/fork-principals.yml +++ b/.github/workflows/fork-principals.yml @@ -5,7 +5,7 @@ name: Fork principals on: pull_request: - branches: [main] + branches: [main, "feat/**"] workflow_dispatch: permissions: @@ -38,10 +38,16 @@ jobs: run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium - name: Typecheck - run: vp run --filter @t3tools/contracts --filter t3 typecheck + run: vp run --filter @t3tools/contracts --filter @t3tools/client-runtime --filter @t3tools/web --filter t3 typecheck - name: Test contracts run: vp run --filter @t3tools/contracts test - name: Test server run: vp run --filter t3 test + + - name: Test session-sharing web and client-runtime code + if: ${{ !cancelled() }} + run: | + (cd packages/client-runtime && vp test run src/state/sessionAccess.test.ts) + (cd apps/web && vp test run src/sidebarProjectGrouping.test.ts src/components/chat/ShareThreadDialog.browser.test.tsx) diff --git a/apps/server/src/auth/EnvironmentAuth.ts b/apps/server/src/auth/EnvironmentAuth.ts index 4124b3657627..5e36bec08332 100644 --- a/apps/server/src/auth/EnvironmentAuth.ts +++ b/apps/server/src/auth/EnvironmentAuth.ts @@ -854,6 +854,9 @@ export const make = Effect.gen(function* () { ...authScopeResponse(session.scopes), sessionMethod: session.method, ...(session.expiresAt ? { expiresAt: DateTime.toUtc(session.expiresAt) } : {}), + ...(principalOfSubject(session.subject) !== DEFAULT_PRINCIPAL_ID + ? { principal: principalOfSubject(session.subject) } + : {}), }) satisfies AuthSessionState, ), Effect.catchIf(isServerAuthCredentialError, () => diff --git a/apps/server/src/auth/RpcAuthorization.ts b/apps/server/src/auth/RpcAuthorization.ts index 8f692534d140..b5e39f72577e 100644 --- a/apps/server/src/auth/RpcAuthorization.ts +++ b/apps/server/src/auth/RpcAuthorization.ts @@ -61,6 +61,8 @@ export const RPC_REQUIRED_SCOPES = { [ORCHESTRATION_V2_WS_METHODS.subscribeThread]: AuthOrchestrationReadScope, [ORCHESTRATION_V2_WS_METHODS.subscribeCommandOutput]: AuthOrchestrationReadScope, [WS_METHODS.projectsMutate]: AuthOrchestrationOperateScope, + [WS_METHODS.sessionAccessList]: AuthOrchestrationReadScope, + [WS_METHODS.sessionAccessThreadShares]: AuthOrchestrationReadScope, [WS_METHODS.serverProbe]: AuthOrchestrationReadScope, [WS_METHODS.serverGetConfig]: AuthOrchestrationReadScope, [WS_METHODS.serverGetNpmRelease]: AuthOrchestrationReadScope, diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 6fd54db6bd52..485f9052e05e 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -227,6 +227,7 @@ import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../termina import { useKnownTerminalSessions, useThreadRunningTerminalIds } from "../state/terminalSessions"; import { useEnvironmentQuery } from "../state/query"; import { useEnvironmentScope } from "~/state/session"; +import { useThreadAccessRole } from "~/state/sessionAccess"; import { primaryServerAvailableEditorsAtom, primaryServerKeybindingsAtom, @@ -423,7 +424,11 @@ export default function ChatView(props: ChatViewProps) { embedded: parentPanel, } = props; const embedded = parentPanel !== undefined; - const canOperateThread = useEnvironmentScope(environmentId, AuthOrchestrationOperateScope); + const hasOperateScope = useEnvironmentScope(environmentId, AuthOrchestrationOperateScope); + const isSessionViewer = + useThreadAccessRole(routeKind === "server" ? scopeThreadRef(environmentId, threadId) : null) === + "viewer"; + const canOperateThread = hasOperateScope && !isSessionViewer; const canOperateTerminal = useEnvironmentScope(environmentId, AuthTerminalOperateScope); const draftId = routeKind === "draft" ? props.draftId : null; const handleNewThread = useNewThreadHandler(); diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 068808707b4f..c6b11e7a88e1 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -243,6 +243,8 @@ import { ProjectFilePicker } from "./files/ProjectFilePicker"; import { openLinkPullRequestDialog } from "./pullRequest/LinkPullRequestDialog"; import { canShareWithGuestAtom } from "./chat/guestShareAvailability"; import { openGuestShareDialog } from "./chat/guestShareDialogState"; +import { openShareThreadDialog } from "./chat/shareThreadDialogState"; +import { readCanShareThread } from "../state/sessionAccess"; import { ProjectContentSearchDialog } from "./search/ProjectContentSearchDialog"; import { settingsForThisPlatform, SETTINGS_SECTION_LABELS } from "./settings/settingsSearch"; import { primaryServerKeybindingsAtom } from "../state/server"; @@ -1412,6 +1414,22 @@ function OpenCommandPaletteDialog(props: { }); } + if (activeThread !== null) { + const threadRef = scopeThreadRef(activeThread.environmentId, activeThread.id); + if (readCanShareThread(threadRef, activeThread.source.ownerPrincipal)) { + actionItems.push({ + kind: "action", + value: "action:share-thread-with-principal", + searchTerms: ["share", "invite", "viewer", "participant", "session", "group"], + title: "Share…", + icon: , + run: async () => { + openShareThreadDialog(threadRef); + }, + }); + } + } + if (activeThread !== null) { const thread = activeThread; actionItems.push({ diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index deede26763fd..df91d68da49b 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -112,6 +112,7 @@ import { projectGroupsSpanEnvironments, resolveSidebarProjectScopeKeys, getSidebarProjectSettingsKey, + partitionSharedThreads, type SidebarProjectSnapshot, } from "../sidebarProjectGrouping"; import { resolveProjectExpanded, useUiStateStore } from "../uiStateStore"; @@ -128,6 +129,8 @@ import { useHandleNewThread } from "../hooks/useHandleNewThread"; import { useOrderWhileOpen } from "../hooks/useOrderWhileOpen"; import { useProjectPin } from "../hooks/useProjectGroupUpdate"; import { useSidebarProjectGroups } from "../hooks/useSidebarProjectGroups"; +import { readCanShareThread, useSharedSidebarInput } from "../state/sessionAccess"; +import { SidebarSharedThreads } from "./sidebar/SidebarSharedThreads"; import { useTerminalFocus } from "../hooks/useTerminalFocus"; import { isCommandPaletteOpen, openCommandPalette } from "../commandPaletteBus"; import { registerSettleAndAdvance } from "../settleAndAdvance"; @@ -162,6 +165,7 @@ import { readEnvironmentScope, useEnvironmentScope } from "../state/session"; import { appAtomRegistry } from "../rpc/atomRegistry"; import { canShareWithGuestAtom } from "./chat/guestShareAvailability"; import { openGuestShareDialog } from "./chat/guestShareDialogState"; +import { openShareThreadDialog } from "./chat/shareThreadDialogState"; import { buildThreadRouteParams, resolveActiveThreadRouteRef, @@ -1116,7 +1120,11 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve ), ), ); - const threads = useQuietThreadShells(); + const allThreads = useQuietThreadShells(); + const { mine: threads, shared: sharedThreadSections } = partitionSharedThreads({ + threads: allThreads, + ...useSharedSidebarInput(useEnvironmentIdentities().map(({ environmentId }) => environmentId)), + }); const routeRowThreadKey = routeThreadRef === null ? null @@ -2644,6 +2652,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve canShareWithGuest: appAtomRegistry.get( canShareWithGuestAtom(threadRef.environmentId), ), + canShareSession: readCanShareThread(threadRef, thread.source.ownerPrincipal), canTurnIntoProject: canTurnThreadIntoProject(threadRef), supports: { settlement: configLoaded, @@ -2766,6 +2775,9 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve case "rename": startThreadRename(threadRef, thread.title); return; + case "share-session": + openShareThreadDialog(threadRef); + return; case "share-guest": openGuestShareDialog(threadRef); return; @@ -3638,6 +3650,13 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve )} ) : null} + {!isSearchingThreads ? ( + + ) : null} diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx index 8bedc8b2e711..c73ce5605ef5 100644 --- a/apps/web/src/components/auth/PairingRouteSurface.tsx +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx @@ -6,10 +6,13 @@ import React, { startTransition, useEffect, useEffectEvent, useRef, useState } f import { connectPairing } from "../../connection/onboarding"; import { peekPairingTokenFromUrl, + resolvePrimaryEnvironmentHttpUrl, stripPairingTokenFromUrl, submitServerAuthCredential, } from "../../environments/primary"; +import { isElectron } from "../../env"; import { readHostedPairingRequest } from "../../hostedPairing"; +import { ensureLocalApi } from "../../localApi"; import { Button } from "../ui/button"; import { Input } from "../ui/input"; import { StandalonePage, StandalonePageHeader } from "../ui/standalone-page"; @@ -62,6 +65,19 @@ export function PairingRouteSurface({ }); }; + const signInWithOidc = async () => { + const url = resolvePrimaryEnvironmentHttpUrl("/auth/oidc/start", { + client: isElectron ? "desktop" : "web", + }); + if (!isElectron) { + window.location.assign(url); + return; + } + await ensureLocalApi() + .shell.openExternal(url) + .catch((error) => setErrorMessage(errorMessageFromUnknown(error))); + }; + const handleSubmit = async (event?: React.SubmitEvent) => { event?.preventDefault(); await submitCredential(credential); @@ -89,6 +105,19 @@ export function PairingRouteSurface({ description={describeAuthGate(auth.bootstrapMethods)} /> + {auth.oidcSignIn ? ( + + void signInWithOidc()} size="sm"> + Sign in with Kanidm + + + {isElectron + ? "Opens your browser; the app signs in when you return." + : "Or pair this device with a token below."} + + + ) : null} + void handleSubmit(event)}> diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index 9ad9158cd4da..bb85f5e56b11 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -118,6 +118,7 @@ import { } from "./composerContextUndo"; import type { ThreadSyncPhase } from "../../threadSync"; import { ComposerBanner } from "./ComposerBanner"; +import { ComposerSessionViewerBanner } from "./ComposerSessionViewerBanner"; import { ComposerSurface } from "./ComposerSurface"; import { ComposerBannerStack, type ComposerBannerStackItem } from "./ComposerBannerStack"; import { @@ -3194,6 +3195,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) + {showComposerTopDrawer ? ( diff --git a/apps/web/src/components/chat/ComposerSessionViewerBanner.tsx b/apps/web/src/components/chat/ComposerSessionViewerBanner.tsx new file mode 100644 index 000000000000..bb7b14f59402 --- /dev/null +++ b/apps/web/src/components/chat/ComposerSessionViewerBanner.tsx @@ -0,0 +1,27 @@ +import type { ScopedThreadRef } from "@t3tools/contracts"; + +import { useThreadAccessRole } from "../../state/sessionAccess"; +import { ComposerBanner } from "./ComposerBanner"; + +/** Tells a viewer why the composer is off; its owner must make them a participant to let them send. */ +export function ComposerSessionViewerBanner({ + threadRef, +}: { + readonly threadRef: ScopedThreadRef | null; +}) { + if (useThreadAccessRole(threadRef) !== "viewer") return null; + return ( + + + + + + + You can read this session. Ask its owner for participant access to send messages. + + + + + + ); +} diff --git a/apps/web/src/components/chat/ShareThreadDialog.browser.test.tsx b/apps/web/src/components/chat/ShareThreadDialog.browser.test.tsx new file mode 100644 index 000000000000..2678acb11b66 --- /dev/null +++ b/apps/web/src/components/chat/ShareThreadDialog.browser.test.tsx @@ -0,0 +1,59 @@ +import { EnvironmentId, ThreadId } from "@t3tools/contracts"; +import { expect, it, vi } from "vite-plus/test"; +import { page, userEvent } from "vite-plus/test/browser"; + +import { act, render } from "../../../test/render"; +import { AppAtomRegistryProvider } from "../../rpc/atomRegistry"; + +const access = vi.hoisted(() => ({ mutate: vi.fn() })); + +vi.mock(import("~/state/sessionAccess"), async (original) => ({ + ...(await original()), + useSessionAccess: (() => ({ principal: "can", snapshot: null, refresh: vi.fn() })) as never, + useSessionAccessMutation: (() => ({ canMutate: true, mutate: access.mutate })) as never, +})); +vi.mock(import("~/state/query"), async (original) => ({ + ...(await original()), + useEnvironmentQuery: (() => ({ + data: { shares: [{ principal: "dejana", role: "participant" }] }, + })) as never, +})); + +import { ShareThreadDialogHost } from "./ShareThreadDialog"; +import { openShareThreadDialog } from "./shareThreadDialogState"; + +const environmentId = EnvironmentId.make("env-1"); +const threadId = ThreadId.make("thread-1"); + +it("shares a session with a person and removes an existing share", async () => { + access.mutate.mockReset().mockResolvedValue(true); + // The dialog needs no route. + await using _screen = await render( + + + , + { router: false }, + ); + await act(async () => openShareThreadDialog({ environmentId, threadId })); + + const share = page.getByRole("button", { name: "Share", exact: true }); + await userEvent.type(page.getByLabelText("Person"), "Not A Name"); + await expect.element(share).toBeDisabled(); + + await userEvent.clear(page.getByLabelText("Person")); + await userEvent.type(page.getByLabelText("Person"), "kemal"); + await userEvent.click(share); + expect(access.mutate).toHaveBeenCalledWith({ + type: "thread.share", + threadId, + principal: "kemal", + role: "viewer", + }); + + await userEvent.click(page.getByRole("button", { name: "Remove dejana" })); + expect(access.mutate).toHaveBeenLastCalledWith({ + type: "thread.unshare", + threadId, + principal: "dejana", + }); +}); diff --git a/apps/web/src/components/chat/ShareThreadDialog.tsx b/apps/web/src/components/chat/ShareThreadDialog.tsx new file mode 100644 index 000000000000..5d62a3020fee --- /dev/null +++ b/apps/web/src/components/chat/ShareThreadDialog.tsx @@ -0,0 +1,172 @@ +import { useAtomValue } from "@effect/atom-react"; +import type { ScopedThreadRef } from "@t3tools/contracts"; +import { useState } from "react"; + +import { appAtomRegistry } from "~/rpc/atomRegistry"; +import { useEnvironmentQuery } from "~/state/query"; +import { + sessionAccessEnvironment, + useSessionAccess, + useSessionAccessMutation, +} from "~/state/sessionAccess"; +import { PrincipalRoleForm, ROLE_LABELS } from "../sessionAccess/PrincipalRoleForm"; +import { Button } from "../ui/button"; +import { + Dialog, + DialogDescription, + DialogFooter, + DialogHeader, + DialogPanel, + DialogPopup, + DialogTitle, +} from "../ui/dialog"; +import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select"; +import { shareThreadDialogThreadAtom } from "./shareThreadDialogState"; + +const NO_GROUP = "none"; + +export function ShareThreadDialogHost() { + const threadRef = useAtomValue(shareThreadDialogThreadAtom); + if (threadRef === null) return null; + return ( + appAtomRegistry.set(shareThreadDialogThreadAtom, null)} + /> + ); +} + +function ShareThreadDialog({ + threadRef, + onClose, +}: { + readonly threadRef: ScopedThreadRef; + readonly onClose: () => void; +}) { + const { environmentId, threadId } = threadRef; + const { canMutate, mutate } = useSessionAccessMutation(environmentId); + const { snapshot } = useSessionAccess(environmentId); + const shares = useEnvironmentQuery( + sessionAccessEnvironment.threadShares({ environmentId, input: { threadId } }), + ); + const ownedGroups = snapshot?.groups.filter((group) => group.callerRole === "owner") ?? []; + const currentGroup = ownedGroups.find((group) => group.threadIds.includes(threadId)); + const [movingGroup, setMovingGroup] = useState(false); + + const moveToGroup = async (groupId: string) => { + setMovingGroup(true); + if (currentGroup !== undefined) { + const removed = await mutate({ + type: "group.thread.remove", + groupId: currentGroup.id, + threadId, + }); + if (!removed) return setMovingGroup(false); + } + const target = ownedGroups.find((group) => group.id === groupId); + if (target !== undefined) { + await mutate({ type: "group.thread.add", groupId: target.id, threadId }); + } + setMovingGroup(false); + }; + + return ( + !open && onClose()}> + + + Share session + + Viewers read this session. Participants can also send messages; their turns run as you. + + + + + + mutate({ type: "thread.share", threadId, principal, role }) + } + /> + {shares.data !== null && shares.data.shares.length > 0 ? ( + + {shares.data.shares.map((share) => ( + + {share.principal} + {ROLE_LABELS[share.role]} + + void mutate({ + type: "thread.unshare", + threadId, + principal: share.principal, + }) + } + > + Remove + + + ))} + + ) : ( + Not shared with anyone yet. + )} + {ownedGroups.length > 0 ? ( + + Session group + { + if (value !== null && value !== NO_GROUP) void moveToGroup(value); + }} + > + + {currentGroup?.name ?? "None"} + + + {currentGroup === undefined ? ( + + None + + ) : null} + {ownedGroups.map((group) => ( + + {group.name} + + ))} + + + {currentGroup !== undefined ? ( + + void mutate({ + type: "group.thread.remove", + groupId: currentGroup.id, + threadId, + }) + } + > + Remove from group + + ) : null} + + ) : null} + + + + + Done + + + + + ); +} diff --git a/apps/web/src/components/chat/TimelineUserMessageRow.tsx b/apps/web/src/components/chat/TimelineUserMessageRow.tsx index bf52aad538e1..c18ca4c1f716 100644 --- a/apps/web/src/components/chat/TimelineUserMessageRow.tsx +++ b/apps/web/src/components/chat/TimelineUserMessageRow.tsx @@ -13,6 +13,7 @@ import { Link } from "@tanstack/react-router"; import { useQuietThreadShell } from "../../state/entities"; import { useEnvironmentQuery } from "../../state/query"; import { serverEnvironment } from "../../state/server"; +import { useViewerPrincipal } from "../../state/sessionAccess"; import { replaceComposerContextReferences } from "@t3tools/shared/composerContextReferences"; import { memo, use, useState, type ReactNode } from "react"; import { @@ -425,6 +426,11 @@ function UserTimelineRow({ row }: { row: Extract ) : null} + {senderPrincipal !== null ? ( + {senderPrincipal} + ) : null} }> {formatDayAwareTimestamp(row.message.createdAt, ctx.timestampFormat)} diff --git a/apps/web/src/components/chat/shareThreadDialogState.ts b/apps/web/src/components/chat/shareThreadDialogState.ts new file mode 100644 index 000000000000..a9b243c8b8b2 --- /dev/null +++ b/apps/web/src/components/chat/shareThreadDialogState.ts @@ -0,0 +1,14 @@ +import type { ScopedThreadRef } from "@t3tools/contracts"; +import { Atom } from "effect/reactivity"; + +import { appAtomRegistry } from "~/rpc/atomRegistry"; + +/** Which thread has the share dialog open; the thread menu and the command palette both close as they run. */ +export const shareThreadDialogThreadAtom = Atom.make(null).pipe( + Atom.keepAlive, + Atom.withLabel("share-thread:dialog-thread"), +); + +export function openShareThreadDialog(threadRef: ScopedThreadRef): void { + appAtomRegistry.set(shareThreadDialogThreadAtom, threadRef); +} diff --git a/apps/web/src/components/sessionAccess/PrincipalRoleForm.tsx b/apps/web/src/components/sessionAccess/PrincipalRoleForm.tsx new file mode 100644 index 000000000000..aaa2bc9b3065 --- /dev/null +++ b/apps/web/src/components/sessionAccess/PrincipalRoleForm.tsx @@ -0,0 +1,78 @@ +import { PrincipalId, type SessionRole } from "@t3tools/contracts"; +import * as Schema from "effect/Schema"; +import { useState } from "react"; + +import { Button } from "../ui/button"; +import { Input } from "../ui/input"; +import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select"; + +const isPrincipalId = Schema.is(PrincipalId); + +const ROLE_LABELS = { viewer: "Viewer", participant: "Participant" } as const; + +/** A person's sign-in name and the role to give them. */ +export function PrincipalRoleForm(props: { + readonly submitLabel: string; + readonly disabled: boolean; + readonly onSubmit: (principal: string, role: SessionRole) => Promise; +}) { + const [principal, setPrincipal] = useState(""); + const [role, setRole] = useState("viewer"); + const [submitting, setSubmitting] = useState(false); + const valid = isPrincipalId(principal); + + return ( + { + event.preventDefault(); + if (!valid) return; + setSubmitting(true); + const done = await props.onSubmit(principal, role); + setSubmitting(false); + if (done) setPrincipal(""); + }} + > + setPrincipal(event.currentTarget.value.trim())} + placeholder="Sign-in name, such as dejana" + spellCheck={false} + value={principal} + /> + { + if (value === "viewer" || value === "participant") setRole(value); + }} + > + + {ROLE_LABELS[role]} + + + + Viewer reads + + + Participant sends too + + + + + {props.submitLabel} + + + ); +} + +export { ROLE_LABELS }; diff --git a/apps/web/src/components/settings/SessionAccessSettings.tsx b/apps/web/src/components/settings/SessionAccessSettings.tsx new file mode 100644 index 000000000000..226d4557d556 --- /dev/null +++ b/apps/web/src/components/settings/SessionAccessSettings.tsx @@ -0,0 +1,143 @@ +import { + type EnvironmentId, + type SessionGroup, + SessionGroupId, + TrimmedNonEmptyString, +} from "@t3tools/contracts"; +import { useState } from "react"; + +import { randomUUID } from "~/lib/utils"; +import { usePrimaryEnvironmentId } from "~/state/environments"; +import { useSessionAccess, useSessionAccessMutation } from "~/state/sessionAccess"; +import { PrincipalRoleForm, ROLE_LABELS } from "../sessionAccess/PrincipalRoleForm"; +import { Button } from "../ui/button"; +import { Input } from "../ui/input"; +import { SettingsSection } from "./settingsLayout"; + +/** The signed-in principal and its session groups; single-user installs have neither. */ +export function SessionAccessSettings() { + const environmentId = usePrimaryEnvironmentId(); + const { principal, snapshot } = useSessionAccess(environmentId); + if (environmentId === null || principal === "owner") return null; + return ( + <> + + + Signed in as {principal} + + + + + {snapshot?.groups.map((group) => ( + + ))} + {snapshot?.groups.length === 0 ? ( + + Group sessions to share them with the same people at once. + + ) : null} + + + + > + ); +} + +function CreateGroupForm({ environmentId }: { readonly environmentId: EnvironmentId }) { + const { canMutate, mutate } = useSessionAccessMutation(environmentId); + const [name, setName] = useState(""); + return ( + { + event.preventDefault(); + if (name.trim() === "") return; + const created = await mutate({ + type: "group.create", + groupId: SessionGroupId.make(randomUUID()), + name: TrimmedNonEmptyString.make(name.trim()), + }); + if (created) setName(""); + }} + > + setName(event.currentTarget.value)} + placeholder="New group name" + value={name} + /> + + Create group + + + ); +} + +function SessionGroupRow({ + group, + environmentId, +}: { + readonly group: SessionGroup; + readonly environmentId: EnvironmentId; +}) { + const { canMutate, mutate } = useSessionAccessMutation(environmentId); + const isOwner = group.callerRole === "owner"; + return ( + + + {group.name} + + {isOwner + ? `${group.threadIds.length} sessions` + : `${group.ownerPrincipal} · ${ROLE_LABELS[group.callerRole as "viewer" | "participant"]}`} + + {isOwner ? ( + void mutate({ type: "group.delete", groupId: group.id })} + > + Delete group + + ) : null} + + + {group.members.map((member) => ( + + {member.principal} + {ROLE_LABELS[member.role]} + {isOwner ? ( + + void mutate({ + type: "group.member.remove", + groupId: group.id, + principal: member.principal, + }) + } + > + Remove + + ) : null} + + ))} + + {isOwner ? ( + + mutate({ type: "group.member.invite", groupId: group.id, principal: invitee, role }) + } + /> + ) : null} + + ); +} diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx index 362210f96eee..2f27cb5a7728 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx @@ -97,6 +97,7 @@ import { SettingsRow, SettingsSection, } from "./settingsLayout"; +import { SessionAccessSettings } from "./SessionAccessSettings"; import { searchableSetting } from "./settingsSearch"; import { BackgroundActivitySettingsRow } from "./BackgroundActivitySettings"; import { AdvancedSettings } from "./AdvancedSettings"; @@ -787,6 +788,7 @@ export function GeneralSettingsPanel() { return ( + >; + routeThreadKey: string | null; + onOpenThread: (threadRef: ScopedThreadRef) => void; +}) { + const [expanded, setExpanded] = useState(true); + if (props.sections.length === 0) return null; + return ( + + setExpanded(!expanded)}> + Shared with me + + {expanded + ? props.sections.map((section) => ( + + + {section.ownerPrincipal} + + {section.groups.map((group) => ( + + {group.groupName === null ? null : ( + {group.groupName} + )} + + {group.threads.map((thread) => { + const threadRef = scopeThreadRef(thread.environmentId, thread.id); + const key = scopedThreadKey(threadRef); + return ( + + props.onOpenThread(threadRef)} + className={cn( + "flex h-8 w-full cursor-pointer items-center rounded-md px-2.5 text-left text-sm outline-none hover:bg-sidebar-row-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", + props.routeThreadKey === key && "bg-sidebar-row-hover", + )} + > + {thread.title} + + + ); + })} + + + ))} + + )) + : null} + + ); +} diff --git a/apps/web/src/components/threadActionMenu.logic.ts b/apps/web/src/components/threadActionMenu.logic.ts index ac4ef649ed07..af426cc5c0e0 100644 --- a/apps/web/src/components/threadActionMenu.logic.ts +++ b/apps/web/src/components/threadActionMenu.logic.ts @@ -21,6 +21,7 @@ export type ThreadActionMenuId = | "regenerate-title" | "mark-unread" | "share-guest" + | "share-session" | "copy" | "copy-path" | "copy-branch" @@ -93,6 +94,8 @@ export interface ThreadActionMenuState { readonly snoozePresets: ReadonlyArray; /** Guest links need their own grant, so the caller checks it instead of `canOperate`. */ readonly canShareWithGuest?: boolean; + /** The caller owns this thread as a signed-in principal and may share it with other principals. */ + readonly canShareSession?: boolean; /** A No project thread with its own folder, on a server that can promote it. */ readonly canTurnIntoProject?: boolean; } @@ -181,6 +184,9 @@ export function buildThreadActionMenuItems( ...(state.canShareWithGuest ? [{ id: "share-guest" as const, label: "Share with guest", icon: "user-plus" }] : []), + ...(state.canShareSession + ? [{ id: "share-session" as const, label: "Share…", icon: "user-plus" }] + : []), ...(state.projectFilter ? [ { diff --git a/apps/web/src/hooks/useThreadActionMenu.ts b/apps/web/src/hooks/useThreadActionMenu.ts index cddef6046cf8..6de9792930c7 100644 --- a/apps/web/src/hooks/useThreadActionMenu.ts +++ b/apps/web/src/hooks/useThreadActionMenu.ts @@ -1,6 +1,8 @@ import { scopeProjectRef } from "@t3tools/client-runtime/environment"; import { requestCustomSnooze } from "../components/CustomSnoozeDialog"; import { openGuestShareDialog } from "../components/chat/guestShareDialogState"; +import { openShareThreadDialog } from "../components/chat/shareThreadDialogState"; +import { readCanShareThread } from "../state/sessionAccess"; import { type AtomCommandResult, isAtomCommandInterrupted, @@ -147,6 +149,7 @@ export function useThreadActionMenu(input: { supports, snoozePresets, canShareWithGuest, + canShareSession: readCanShareThread(threadRef, thread.source.ownerPrincipal), canTurnIntoProject: canTurnThreadIntoProject(threadRef), }); const clicked = await settlePromise(() => api.contextMenu.show(items, position)); @@ -261,6 +264,9 @@ export function useThreadActionMenu(input: { case "share-guest": openGuestShareDialog(threadRef); return; + case "share-session": + openShareThreadDialog(threadRef); + return; case "turn-into-project": { const result = await turnThreadIntoProject(threadRef); if (result._tag === "Success") { diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx index 1207b5017100..dacf3a4977a1 100644 --- a/apps/web/src/routes/__root.tsx +++ b/apps/web/src/routes/__root.tsx @@ -18,6 +18,7 @@ import { AppSidebarLayout } from "../components/AppSidebarLayout"; import { CommandPalette } from "../components/CommandPalette"; import { CustomSnoozeDialogHost } from "../components/CustomSnoozeDialog"; import { GuestShareDialogHost } from "../components/chat/GuestShareControls"; +import { ShareThreadDialogHost } from "../components/chat/ShareThreadDialog"; import { AddProjectToMachineDialogHost } from "../components/AddProjectToMachineDialog"; import { ConfirmDialogHost } from "../components/ConfirmDialogHost"; import { DevReplayHost } from "../components/DevReplayHost"; @@ -169,6 +170,7 @@ function RootRouteBranch() { <> + @@ -210,6 +212,7 @@ function RootRouteBranch() { + {import.meta.env.DEV && primaryEnvironmentAuthenticated ? : null} diff --git a/apps/web/src/session-logic.ts b/apps/web/src/session-logic.ts index 6cf2761d3d6d..ecfb42196b6f 100644 --- a/apps/web/src/session-logic.ts +++ b/apps/web/src/session-logic.ts @@ -653,6 +653,9 @@ export function deriveTimelineEntriesFromVisibleTurnItems( createdBy: item.createdBy, creationSource: item.creationSource, ...(item.senderThreadId !== undefined ? { senderThreadId: item.senderThreadId } : {}), + ...(item.senderPrincipal !== undefined + ? { senderPrincipal: item.senderPrincipal } + : {}), ...(item.idleCompaction !== undefined ? { idleCompaction: item.idleCompaction } : {}), ...(item.scheduledTaskId !== undefined ? { scheduledTaskId: item.scheduledTaskId } diff --git a/apps/web/src/sidebarProjectGrouping.test.ts b/apps/web/src/sidebarProjectGrouping.test.ts new file mode 100644 index 000000000000..f7abdfd54b90 --- /dev/null +++ b/apps/web/src/sidebarProjectGrouping.test.ts @@ -0,0 +1,52 @@ +import { EnvironmentId, type SessionAccessSnapshot } from "@t3tools/contracts"; +import { describe, expect, it } from "vite-plus/test"; + +import { partitionSharedThreads } from "./sidebarProjectGrouping"; + +const env = EnvironmentId.make("env-1"); +const thread = (id: string, ownerPrincipal?: string) => ({ + environmentId: env, + id, + source: { ownerPrincipal }, +}); +const snapshot = { + groups: [{ name: "Lab", threadIds: ["t3"] }], + sharedThreads: [], +} as unknown as SessionAccessSnapshot; + +describe("partitionSharedThreads", () => { + const threads = [thread("t1", "dejana"), thread("t2", "can"), thread("t3", "can"), thread("t4")]; + + it("leaves a default-principal session untouched", () => { + const result = partitionSharedThreads({ + threads, + principalByEnvironment: new Map(), + snapshotByEnvironment: new Map(), + }); + expect(result).toEqual({ mine: threads, shared: [] }); + }); + + it("splits a signed-in session by owner, then session group", () => { + const result = partitionSharedThreads({ + threads, + principalByEnvironment: new Map([[env, "dejana"]]), + snapshotByEnvironment: new Map([[env, snapshot]]), + }); + expect(result.mine.map((t) => t.id)).toEqual(["t1"]); + expect( + result.shared.map((section) => [ + section.ownerPrincipal, + section.groups.map((g) => [g.groupName, g.threads.map((t) => t.id)]), + ]), + ).toEqual([ + [ + "can", + [ + ["Lab", ["t3"]], + [null, ["t2"]], + ], + ], + ["owner", [[null, ["t4"]]]], + ]); + }); +}); diff --git a/apps/web/src/sidebarProjectGrouping.ts b/apps/web/src/sidebarProjectGrouping.ts index 4dbd65b0abc5..63f8c3b6a1c2 100644 --- a/apps/web/src/sidebarProjectGrouping.ts +++ b/apps/web/src/sidebarProjectGrouping.ts @@ -1,4 +1,9 @@ -import type { EnvironmentId, ScopedProjectRef } from "@t3tools/contracts"; +import { + DEFAULT_PRINCIPAL_ID, + type EnvironmentId, + type ScopedProjectRef, + type SessionAccessSnapshot, +} from "@t3tools/contracts"; import { buildProjectGroups, derivePhysicalProjectKey, @@ -225,3 +230,54 @@ export function buildSidebarProjectPickerEntries(input: { const pinnedCount = rest.filter((entry) => entry.group.pinned).length; return [...rest.slice(0, pinnedCount), preferred, ...rest.slice(pinnedCount)]; } + +export interface SharedThreadSection { + readonly ownerPrincipal: string; + /** `groupName` is null for threads shared directly rather than through a session group. */ + readonly groups: ReadonlyArray<{ readonly groupName: string | null; readonly threads: T[] }>; +} + +/** + * Splits threads into the viewer's own and those shared with it, grouped by owner and + * then session group. Environments absent from `principalByEnvironment` (the default + * principal sees every thread) keep all their threads in `mine`. + */ +export function partitionSharedThreads< + T extends { + readonly environmentId: EnvironmentId; + readonly id: string; + readonly source: { readonly ownerPrincipal?: string | undefined }; + }, +>(input: { + threads: ReadonlyArray; + principalByEnvironment: ReadonlyMap; + snapshotByEnvironment: ReadonlyMap; +}): { mine: ReadonlyArray; shared: ReadonlyArray> } { + if (input.principalByEnvironment.size === 0) return { mine: input.threads, shared: [] }; + const mine: T[] = []; + const byOwner = new Map>(); + for (const thread of input.threads) { + const principal = input.principalByEnvironment.get(thread.environmentId); + const owner = thread.source.ownerPrincipal ?? DEFAULT_PRINCIPAL_ID; + if (principal === undefined || owner === principal) { + mine.push(thread); + continue; + } + const groupName = + input.snapshotByEnvironment + .get(thread.environmentId) + ?.groups.find((group) => group.threadIds.some((id) => id === thread.id))?.name ?? null; + const groups = byOwner.get(owner) ?? new Map(); + groups.set(groupName, [...(groups.get(groupName) ?? []), thread]); + byOwner.set(owner, groups); + } + const shared = [...byOwner] + .toSorted(([a], [b]) => a.localeCompare(b)) + .map(([ownerPrincipal, groups]) => ({ + ownerPrincipal, + groups: [...groups] + .toSorted(([a], [b]) => (a === null ? 1 : b === null ? -1 : a.localeCompare(b))) + .map(([groupName, threads]) => ({ groupName, threads })), + })); + return { mine, shared }; +} diff --git a/apps/web/src/state/sessionAccess.ts b/apps/web/src/state/sessionAccess.ts new file mode 100644 index 000000000000..bade2c91a71c --- /dev/null +++ b/apps/web/src/state/sessionAccess.ts @@ -0,0 +1,112 @@ +import { useAtomValue } from "@effect/atom-react"; +import { + createSessionAccessEnvironmentAtoms, + threadAccessRole, +} from "@t3tools/client-runtime/state/sessionAccess"; +import { + DEFAULT_PRINCIPAL_ID, + type EnvironmentId, + type ScopedThreadRef, + type SessionAccessMutation, + type SessionAccessSnapshot, +} from "@t3tools/contracts"; +import { AsyncResult, Atom } from "effect/reactivity"; + +import { connectionAtomRuntime } from "../connection/runtime"; +import { appAtomRegistry } from "../rpc/atomRegistry"; +import { useThreadShell } from "./entities"; +import { environmentIdsKey } from "./environmentAtomList"; +import { useEnvironmentQuery } from "./query"; +import { environmentSession } from "./session"; +import { useAtomCommand } from "./use-atom-command"; + +export const sessionAccessEnvironment = createSessionAccessEnvironmentAtoms(connectionAtomRuntime); + +const viewerPrincipalAtom = Atom.family((environmentId: EnvironmentId) => + Atom.make( + (get) => + get(environmentSession.sessionStateValueAtom(environmentId))?.principal ?? + DEFAULT_PRINCIPAL_ID, + ).pipe(Atom.withLabel(`web-viewer-principal:${environmentId}`)), +); + +const EMPTY_PRINCIPAL_ATOM = Atom.make(DEFAULT_PRINCIPAL_ID).pipe( + Atom.withLabel("web-viewer-principal:empty"), +); + +/** The signed-in principal on an environment; the default principal for single-user installs. */ +export function useViewerPrincipal(environmentId: EnvironmentId | null): string { + return useAtomValue( + environmentId === null ? EMPTY_PRINCIPAL_ATOM : viewerPrincipalAtom(environmentId), + ); +} + +/** The session groups and shares of the signed-in principal; nothing is fetched for the default one. */ +export function useSessionAccess(environmentId: EnvironmentId | null) { + const principal = useViewerPrincipal(environmentId); + const query = useEnvironmentQuery( + environmentId !== null && principal !== DEFAULT_PRINCIPAL_ID + ? sessionAccessEnvironment.list({ environmentId, input: {} }) + : null, + ); + return { principal, snapshot: query.data, refresh: query.refresh }; +} + +/** What the signed-in principal may do in a thread; `null` when nothing says (the server decides). */ +export function useThreadAccessRole(ref: ScopedThreadRef | null) { + const { principal, snapshot } = useSessionAccess(ref?.environmentId ?? null); + const shell = useThreadShell(ref); + return ref === null + ? null + : threadAccessRole({ + principal, + ownerPrincipal: shell?.source.ownerPrincipal, + threadId: ref.threadId, + snapshot, + }); +} + +const sharedSidebarInputAtom = Atom.family((key: string) => { + const ids = key === "" ? [] : (key.split("\n") as EnvironmentId[]); + return Atom.make((get) => { + const principalByEnvironment = new Map(); + const snapshotByEnvironment = new Map(); + for (const environmentId of ids) { + const principal = get(viewerPrincipalAtom(environmentId)); + if (principal === DEFAULT_PRINCIPAL_ID) continue; + principalByEnvironment.set(environmentId, principal); + const snapshot = AsyncResult.getOrElse( + get(sessionAccessEnvironment.list({ environmentId, input: {} })), + () => null, + ); + if (snapshot !== null) snapshotByEnvironment.set(environmentId, snapshot); + } + return { principalByEnvironment, snapshotByEnvironment }; + }).pipe(Atom.withLabel(`web-shared-sidebar-input:${key}`)); +}); + +/** Principals and session groups for the environments a sidebar lists. */ +export function useSharedSidebarInput(environmentIds: ReadonlyArray) { + return useAtomValue(sharedSidebarInputAtom(environmentIdsKey(environmentIds))); +} + +/** Whether the signed-in principal owns the thread and may share it with other principals. */ +export function readCanShareThread( + ref: ScopedThreadRef, + ownerPrincipal: string | undefined, +): boolean { + const principal = appAtomRegistry.get(viewerPrincipalAtom(ref.environmentId)); + return ( + principal !== DEFAULT_PRINCIPAL_ID && principal === (ownerPrincipal ?? DEFAULT_PRINCIPAL_ID) + ); +} + +export function useSessionAccessMutation(environmentId: EnvironmentId) { + const run = useAtomCommand(sessionAccessEnvironment.mutate, { label: "update sharing" }); + const canMutate = useAtomValue(sessionAccessEnvironment.mutate.permissionAtom(environmentId)); + return { + canMutate, + mutate: async (mutation: SessionAccessMutation) => + (await run({ environmentId, input: mutation }))._tag === "Success", + }; +} diff --git a/apps/web/src/types.ts b/apps/web/src/types.ts index cbfdf2a6adf4..ecb9129f11c1 100644 --- a/apps/web/src/types.ts +++ b/apps/web/src/types.ts @@ -83,6 +83,7 @@ export interface ChatMessage { readonly creationSource?: OrchestrationV2CreationSource; readonly scheduledTaskId?: ScheduledTaskId; readonly senderThreadId?: ThreadId; + readonly senderPrincipal?: string; readonly idleCompaction?: import("@t3tools/contracts").OrchestrationV2IdleCompaction; readonly createdAt: string; readonly updatedAt: string; diff --git a/packages/client-runtime/package.json b/packages/client-runtime/package.json index d1b48e1d76f4..b0196899f93f 100644 --- a/packages/client-runtime/package.json +++ b/packages/client-runtime/package.json @@ -231,6 +231,10 @@ "types": "./src/state/peerLinks.ts", "default": "./src/state/peerLinks.ts" }, + "./state/sessionAccess": { + "types": "./src/state/sessionAccess.ts", + "default": "./src/state/sessionAccess.ts" + }, "./state/peerPairingCode": { "types": "./src/state/peerPairingCode.ts", "default": "./src/state/peerPairingCode.ts" diff --git a/packages/client-runtime/src/state/sessionAccess.test.ts b/packages/client-runtime/src/state/sessionAccess.test.ts new file mode 100644 index 000000000000..09071d25ffc8 --- /dev/null +++ b/packages/client-runtime/src/state/sessionAccess.test.ts @@ -0,0 +1,49 @@ +import { type SessionAccessSnapshot, ThreadId } from "@t3tools/contracts"; +import * as DateTime from "effect/DateTime"; +import { describe, expect, it } from "vite-plus/test"; + +import { threadAccessRole } from "./sessionAccess.ts"; + +const threadId = ThreadId.make("thread-1"); +const group = (callerRole: "owner" | "viewer" | "participant", threadIds: ThreadId[]) => + ({ + id: "g1", + name: "Group", + ownerPrincipal: "can", + createdAt: DateTime.makeUnsafe(0), + members: [], + threadIds, + callerRole, + }) as unknown as SessionAccessSnapshot["groups"][number]; +const snapshot = ( + groups: SessionAccessSnapshot["groups"], + sharedThreads: SessionAccessSnapshot["sharedThreads"] = [], +): SessionAccessSnapshot => ({ groups, sharedThreads }); + +describe("threadAccessRole", () => { + it.each([ + ["the default principal", "owner", undefined, null, "owner"], + ["the thread owner", "can", "can", null, "owner"], + ["unknown while loading", "dejana", "can", null, null], + ["unshared", "dejana", "can", snapshot([]), null], + [ + "a direct viewer share", + "dejana", + "can", + snapshot([], [{ threadId, role: "viewer" }]), + "viewer", + ], + ["a group viewer", "dejana", "can", snapshot([group("viewer", [threadId])]), "viewer"], + [ + "the best of a share and a group", + "dejana", + "can", + snapshot([group("participant", [threadId])], [{ threadId, role: "viewer" }]), + "participant", + ], + ] as const)("%s", (_name, principal, ownerPrincipal, snap, expected) => { + expect(threadAccessRole({ principal, ownerPrincipal, threadId, snapshot: snap })).toBe( + expected, + ); + }); +}); diff --git a/packages/client-runtime/src/state/sessionAccess.ts b/packages/client-runtime/src/state/sessionAccess.ts new file mode 100644 index 000000000000..65fef2a79e1f --- /dev/null +++ b/packages/client-runtime/src/state/sessionAccess.ts @@ -0,0 +1,73 @@ +import { + DEFAULT_PRINCIPAL_ID, + type SessionAccessSnapshot, + type SessionRole, + type ThreadId, + WS_METHODS, +} from "@t3tools/contracts"; +import * as Effect from "effect/Effect"; +import { Atom } from "effect/reactivity"; + +import type { EnvironmentRegistry } from "../connection/registry.ts"; +import { createEnvironmentRpcCommand, createEnvironmentRpcQueryAtomFamily } from "./runtime.ts"; + +export function createSessionAccessEnvironmentAtoms( + runtime: Atom.AtomRuntime, +) { + const list = createEnvironmentRpcQueryAtomFamily(runtime, { + label: "environment-data:session-access:list", + tag: WS_METHODS.sessionAccessList, + staleTimeMs: 10_000, + // The shell stream does not announce a newly shared thread, so recipients poll for it. + refreshIntervalMs: 30_000, + }); + const threadShares = createEnvironmentRpcQueryAtomFamily(runtime, { + label: "environment-data:session-access:thread-shares", + tag: WS_METHODS.sessionAccessThreadShares, + }); + return { + list, + threadShares, + mutate: createEnvironmentRpcCommand(runtime, { + label: "environment-data:session-access:mutate", + tag: WS_METHODS.sessionAccessMutate, + onSuccess: ({ environmentId, input }, registry) => + Effect.sync(() => { + registry.refresh(list({ environmentId, input: {} })); + if ("threadId" in input) { + registry.refresh(threadShares({ environmentId, input: { threadId: input.threadId } })); + } + }), + }), + }; +} + +/** + * What `principal` may do in a thread: its owner (the default principal reaches every + * thread), or the best role a share or group gives it. `null` while the snapshot is unknown. + */ +export function threadAccessRole(input: { + readonly principal: string; + readonly ownerPrincipal: string | undefined; + readonly threadId: ThreadId; + readonly snapshot: SessionAccessSnapshot | null; +}): "owner" | SessionRole | null { + if ( + input.principal === DEFAULT_PRINCIPAL_ID || + input.principal === (input.ownerPrincipal ?? DEFAULT_PRINCIPAL_ID) + ) { + return "owner"; + } + if (input.snapshot === null) return null; + const roles: SessionRole[] = [ + ...input.snapshot.sharedThreads.flatMap((share) => + share.threadId === input.threadId ? [share.role] : [], + ), + ...input.snapshot.groups.flatMap((group) => + group.threadIds.includes(input.threadId) + ? [group.callerRole === "owner" ? ("participant" as const) : group.callerRole] + : [], + ), + ]; + return roles.includes("participant") ? "participant" : (roles[0] ?? null); +} diff --git a/packages/contracts/src/auth.ts b/packages/contracts/src/auth.ts index 731198ba7f87..8d2fc3104c58 100644 --- a/packages/contracts/src/auth.ts +++ b/packages/contracts/src/auth.ts @@ -430,6 +430,8 @@ export const AuthSessionState = Schema.Struct({ permissions: authScopeResponseFields.permissions, sessionMethod: Schema.optionalKey(ServerAuthSessionMethod), expiresAt: Schema.optionalKey(Schema.DateTimeUtc), + /** The signed-in principal; absent for the default `owner`. */ + principal: Schema.optionalKey(PrincipalId), }); export type AuthSessionState = typeof AuthSessionState.Type; diff --git a/packages/contracts/src/clientRpcPermissions.ts b/packages/contracts/src/clientRpcPermissions.ts index bcfcade104d2..68275e65dad7 100644 --- a/packages/contracts/src/clientRpcPermissions.ts +++ b/packages/contracts/src/clientRpcPermissions.ts @@ -63,8 +63,6 @@ export const CLIENT_GUARDED_RPC_SCOPES = { // Force stop kills agent processes, as Stop on a terminal does. [ORCHESTRATION_V2_WS_METHODS.forceStopThread]: AuthOrchestrationOperateScope, // Sharing hands thread access to another principal, so it needs the same scope as working in a thread. - [WS_METHODS.sessionAccessList]: AuthOrchestrationReadScope, - [WS_METHODS.sessionAccessThreadShares]: AuthOrchestrationReadScope, [WS_METHODS.sessionAccessMutate]: AuthOrchestrationOperateScope, // A guest link hands thread access to someone outside, like a pairing link. [WS_METHODS.guestShareCreate]: AuthAccessWriteScope,
+ {isElectron + ? "Opens your browser; the app signs in when you return." + : "Or pair this device with a token below."} +
Not shared with anyone yet.
{senderPrincipal}
+ Group sessions to share them with the same people at once. +
+ {section.ownerPrincipal} +
{group.groupName}