Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

Merge origin/master into codex-issue-1507-permissions

Max591acf0a5a78
diff --cc ui/src/components/workbench/ShowPageShareControl.test.tsx
index d212b59b3,b62d00a42..f97e81131
--- a/ui/src/components/workbench/ShowPageShareControl.test.tsx
+++ b/ui/src/components/workbench/ShowPageShareControl.test.tsx
@@@ -167,64 -132,10 +167,64 @@@ describe('ShowPageShareControl payload
});
});
+ it('keeps Link access usable while Workspace access is still loading', async () => {
+ const organizationAccess = showPageAccess({
+ mode: 'organization',
+ ownership_status: 'unchanged',
+ instance_id: 'inst-1',
+ organization_id: 'org-1',
+ policy_organization_id: 'org-1',
+ can_manage: true,
+ can_publish_public: true,
+ });
+ const pending = new Promise(() => undefined);
+ permissionsApi.getPermissions.mockReturnValue(pending);
+ permissionsApi.getResourceAccess.mockReturnValue(pending);
+ api.getShowPageAccess.mockResolvedValue(organizationAccess);
+ api.ensureShowPage.mockResolvedValue({
+ session_id: 'ses-1',
+ visibility: 'private',
+ active_url: '/show/ses-1/',
+ share_id: null,
+ url_available: true,
+ offline: false,
+ title: null,
+ });
+ api.getShowAccessSettings.mockResolvedValue({
+ show_access: {
+ page_id: 'ses-1',
+ access_mode: 'private',
+ share_id: null,
+ revision: 3,
+ normalized_emails: [],
+ },
+ });
+
+ render(
+ <I18nextProvider i18n={i18n}>
+ <ShowPageShareControl
+ sessionId="ses-1"
+ initialAccess={organizationAccess}
+ canManageInstance
+ />
+ </I18nextProvider>,
+ );
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }));
+
- expect(await screen.findByRole('radiogroup', { name: 'Link access' })).toBeTruthy();
++ expect(await screen.findByRole('button', { name: 'Access: Private' })).toBeTruthy();
+ expect(screen.getByText('Loading Workspace access…')).toBeTruthy();
+ expect(api.getShowAccessSettings).toHaveBeenCalledWith('ses-1');
+ expect(permissionsApi.getPermissions).toHaveBeenCalledOnce();
+ expect(permissionsApi.getResourceAccess).toHaveBeenCalledWith({
+ resource_kind: 'show_page',
+ resource_id: 'ses-1',
+ });
+ const popover = document.querySelector('.overflow-y-auto');
+ expect(popover?.classList.contains('max-h-[var(--radix-popover-content-available-height)]')).toBe(true);
+ });
+
it('never loads the payload when access resolves without page use', async () => {
- api.getShowPageAccess.mockResolvedValue({
- ok: true,
- mode: 'local',
+ api.getShowPageAccess.mockResolvedValue(showPageAccess({
can_use: false,
can_manage: true,
can_publish_public: false,
@@@ -290,8 -205,10 +290,8 @@@
});
});
- it('does not present a Limited shared link before guest admission exists', async () => {
+ it('presents the Limited guest-admission link', async () => {
- api.getShowPageAccess.mockResolvedValue({
- ok: true,
- mode: 'local',
+ api.getShowPageAccess.mockResolvedValue(showPageAccess({
can_use: true,
can_manage: false,
can_publish_public: false,
@@@ -313,11 -231,82 +314,91 @@@
);
fireEvent.click(screen.getByRole('button', { name: 'Share' }));
- expect(await screen.findByText(
- 'Configure the email audience now; the shared link is not active yet.',
- )).toBeTruthy();
- expect(screen.queryByRole('button', { name: 'Copy link' })).toBeNull();
- expect(screen.queryByDisplayValue('/p/stable-link/')).toBeNull();
+ expect(await screen.findByDisplayValue('https://alice.avibe.bot/p/stable-link/')).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'Copy link' })).toBeTruthy();
+ });
+
+ it('keeps the Limited share action disabled without Cloud identity', async () => {
- api.getShowPageAccess.mockResolvedValue({
- ok: true,
- mode: 'local',
++ api.getShowPageAccess.mockResolvedValue(showPageAccess({
+ can_use: true,
+ can_manage: false,
+ can_publish_public: false,
- });
++ }));
+ api.ensureShowPage.mockResolvedValue({
+ session_id: 'ses-1',
+ visibility: 'limited',
+ active_url: null,
+ public_url: null,
+ share_id: 'stable-link',
+ url_available: false,
+ offline: false,
+ title: null,
+ });
+
+ render(
+ <I18nextProvider i18n={i18n}>
+ <ShowPageShareControl sessionId="ses-1" />
+ </I18nextProvider>,
+ );
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }));
+
+ await waitFor(() => expect(api.ensureShowPage).toHaveBeenCalledWith('ses-1'));
+ expect((screen.getByRole('button', { name: 'Copy link' }) as HTMLButtonElement).disabled).toBe(
+ true,
+ );
+ expect(screen.queryByDisplayValue(/\/p\/stable-link\/$/)).toBeNull();
+ });
+
- it('keeps online state and Workspace access out of the share popover', async () => {
- api.getShowPageAccess.mockResolvedValue({
- ok: true,
- mode: 'local',
++ it('keeps the online toggle and custom link out while showing Workspace access', async () => {
++ const organizationAccess = showPageAccess({
++ mode: 'organization',
++ ownership_status: 'unchanged',
++ instance_id: 'inst-1',
++ organization_id: 'org-1',
++ policy_organization_id: 'org-1',
+ can_use: true,
+ can_manage: true,
+ can_publish_public: true,
+ });
++ const pending = new Promise(() => undefined);
++ permissionsApi.getPermissions.mockReturnValue(pending);
++ permissionsApi.getResourceAccess.mockReturnValue(pending);
++ api.getShowPageAccess.mockResolvedValue(organizationAccess);
+ api.ensureShowPage.mockResolvedValue({
+ session_id: 'ses-1',
+ visibility: 'private',
+ active_url: '/show/ses-1/',
+ share_id: 'stable-link',
+ url_available: true,
+ offline: false,
+ title: null,
+ });
+ api.getShowAccessSettings.mockResolvedValue({
+ show_access: {
+ page_id: 'ses-1',
+ access_mode: 'private',
+ share_id: 'stable-link',
+ revision: 0,
+ normalized_emails: [],
+ },
+ });
+
+ render(
+ <I18nextProvider i18n={i18n}>
- <ShowPageShareControl sessionId="ses-1" canManageInstance />
++ <ShowPageShareControl
++ sessionId="ses-1"
++ initialAccess={organizationAccess}
++ canManageInstance
++ />
+ </I18nextProvider>,
+ );
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }));
+
+ expect(await screen.findByRole('button', { name: 'Access: Private' })).toBeTruthy();
- expect(screen.queryByText('Workspace access')).toBeNull();
++ expect(screen.getByText('Workspace access')).toBeTruthy();
+ expect(screen.queryByText('Page online')).toBeNull();
+ expect(screen.queryByRole('textbox', { name: 'Custom link' })).toBeNull();
+ expect(api.setShowPageAvailability).not.toHaveBeenCalled();
});
it('shows the loading state while a first access read is pending', async () => {
diff --cc ui/src/components/workbench/ShowPageShareControl.tsx
index 1e8ccb922,6d1d879c4..5896805e4
--- a/ui/src/components/workbench/ShowPageShareControl.tsx
+++ b/ui/src/components/workbench/ShowPageShareControl.tsx
@@@ -223,11 -206,8 +207,8 @@@ export const ShowPageShareControl: Reac
</PopoverTrigger>
<PopoverContent
align="end"
- className="max-h-[var(--radix-popover-content-available-height)] w-[min(22rem,calc(100vw-1rem))] space-y-3 overflow-y-auto"
- className="w-[min(27rem,calc(100vw-1rem))] space-y-3"
++ className="max-h-[var(--radix-popover-content-available-height)] w-[min(27rem,calc(100vw-1rem))] space-y-3 overflow-y-auto"
data-window-owner-id={ownerWindowId}
- onInteractOutside={(event) => {
- if (confirmationOpen) event.preventDefault();
- }}
>
<div className="text-sm font-medium">{t('chat.showPage.shareTitle')}</div>
@@@ -295,34 -269,10 +270,21 @@@
</div>
) : null}
+ {access ? (
+ <div className="border-t border-border pt-3">
+ <ShowPageWorkspaceAccessControl
+ access={access}
+ active={open}
+ canManageInstance={canManageInstance}
+ sessionId={sessionId}
+ />
+ </div>
+ ) : null}
+
- {payload ? (
- <div className="border-t border-border pt-3">
- <div className="flex items-center justify-between gap-3">
- <div className="min-w-0">
- <div className="text-sm font-medium">{t('chat.showPage.availability')}</div>
- <p className="mt-0.5 text-[11px] leading-snug text-muted">
- {t(offline ? 'chat.showPage.availabilityOffline' : 'chat.showPage.availabilityOnline')}
- </p>
- </div>
- <Switch
- checked={Boolean(offline)}
- disabled={availabilityBusy || (offline ? !access?.can_publish_public : !access?.can_manage)}
- onCheckedChange={setOffline}
- label={t('chat.showPage.offline')}
- />
- </div>
- </div>
+ {accessError ? (
+ <p className="border-t border-border pt-3 text-[11px] leading-snug text-destructive-ink">
+ {t('chat.showPage.accessLoadError')}
+ </p>
) : null}
{showAddToHome ? (
diff --cc ui/src/i18n/en.json
index 0277ca4b1,3ca5b890b..78caa6e4b
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@@ -3545,62 -3545,63 +3545,62 @@@
"copyLink": "Copy link",
"nativeShare": "Share…",
"access": "Access",
- "sharingAccess": "Link access",
- "sharingAccessDesc": "Controls the shared /p link independently from Workspace access.",
- "loadingSharingAccess": "Loading link access…",
+ "sharingAccess": "Access",
+ "sharingModeCurrent": "Access: {{mode}}",
+ "sharingAutoSave": "Changes save automatically",
+ "loadingSharingAccess": "Loading access…",
+ "sharingModes": {
+ "private": "Private",
+ "limited": "Limited",
+ "public": "Fully public"
+ },
+ "sharingHelp": {
+ "private": "Only you can access this page",
+ "limited": "Only people in the list can access",
+ "public": "Anyone can access without signing in"
+ },
+ "limitedEmails": "People with access",
+ "limitedEmailRequired": "Add at least one email address.",
+ "limitedEmailHint": "Enter an email and press Enter to add · up to {{count}}",
+ "keepOneLimitedEmail": "Switch to Private to remove the last email",
+ "shareIdAutoSaveHint": "Press Enter or leave the field to save",
+ "sharingErrors": {
+ "conflict": "Link access changed elsewhere. The latest version has been loaded.",
+ "invalid": "Review the mode, link, and email list.",
+ "error": "Link access could not be loaded."
+ },
"workspaceAccess": "Workspace access",
- "workspaceAccessDesc": "Who can open this page after signing in.",
- "workspaceLevels": {
+ "workspaceAccessDesc": "Controls authenticated access inside this Avibe. Link access remains separate.",
+ "loadingWorkspaceAccess": "Loading Workspace access…",
+ "workspacePersonal": "This Show Page belongs to a Personal Avibe.",
+ "workspaceUnmanaged": "Workspace access is unavailable until this Avibe is paired.",
+ "workspacePending": "Organization ownership is known, but its exact binding is temporarily unavailable. Access remains private.",
+ "workspaceOwnershipConflict": "This Show Page is bound to a different ownership domain. Access remains private until the conflict is resolved.",
+ "workspaceModes": {
"private": "Private",
- "public": "Organization",
+ "organization": "Organization",
"scope": "Selected groups"
},
"workspaceHelp": {
- "private": "Only the Show Page owner can open it through this access rule.",
- "public": "Any active Organization member may open it, subject to their Avibe and Project access.",
- "scope": "Only active members of the selected groups may open it, subject to their Avibe and Project access."
+ "private": "Only the page owner and Instance Owner can use it.",
+ "public": "Authenticated members of this Organization can use it.",
+ "scope": "Only members of the selected Organization groups can use it."
},
- "selectedGroups": "Selected groups",
- "archivedGroup": "Archived",
- "groupRequired": "Select at least one group.",
+ "workspaceGroups": "Organization groups",
+ "workspaceArchived": "Archived",
+ "workspaceNoGroups": "No active groups are available.",
+ "workspaceGroupRequired": "Select at least one group.",
+ "workspaceRevisionConflict": "Workspace access changed elsewhere. Your draft was kept on the latest revision.",
+ "workspaceOffline": "The last known policy is shown while Permissions is offline. Editing is disabled.",
+ "workspaceReadOnly": "Avibe Cloud owns this policy. Edit it in Avibe Cloud.",
+ "workspaceOwnerOnly": "Only the Instance Owner can change Workspace access.",
+ "workspaceLoadError": "Workspace access could not be loaded.",
"applyWorkspaceAccess": "Apply",
- "loadingWorkspaceAccess": "Loading Organization access…",
- "workspaceReadOnly": "Only the Show Page owner or an Organization manager can change this audience.",
- "organizationSignIn": "Sign in",
- "organizationSignInAgain": "Sign in again",
- "organizationSignInDesc": "Sign in to avibe.bot to change the Organization audience.",
- "organizationUnavailable": "This Avibe is not connected to avibe.bot Organization management.",
- "organizationSubjectMismatch": "The signed-in avibe.bot account does not match this Avibe session.",
- "workspaceErrors": {
- "conflict": "This audience changed elsewhere. Reload the latest version.",
- "unreachable": "Organization access is temporarily unavailable.",
- "error": "Organization access could not be loaded."
- },
"workspaceSync": {
- "pending": "This audience change is waiting to be applied on this Avibe.",
- "offline": "This Avibe is offline. The audience change will apply after it reconnects.",
- "error": "This Avibe could not apply the audience change."
+ "pending": "The policy is waiting for this Avibe to apply it.",
+ "offline": "This Avibe has not acknowledged the latest policy.",
+ "error": "The latest policy could not be applied."
},
- "sharingModes": {
- "private": "Private",
- "limited": "Limited",
- "public": "Fully public"
- },
- "sharingHelp": {
- "private": "The shared link is disabled.",
- "limited": "Configure the email audience now; the shared link is not active yet.",
- "public": "Anyone with the link can open the shared page."
- },
- "limitedEmails": "Limited access emails",
- "limitedEmailRequired": "Add at least one email address.",
- "limitedEmailLimit": "Up to {{count}} email addresses.",
- "sharingErrors": {
- "conflict": "Link access changed elsewhere. The latest version has been loaded.",
- "invalid": "Review the mode, link, and email list.",
- "error": "Link access could not be loaded."
- },
- "applySharingAccess": "Apply",
- "narrowSharingTitle": "Restrict link access?",
- "narrowSharingBody": "People who lose access will be denied on their next page request.",
"emailPlaceholder": "[email protected]",
"addEmail": "Add email",
"removeEmail": "Remove {{email}}",
diff --cc ui/src/i18n/zh.json
index f27aae0bd,d2a8bafd0..84ba0697e
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@@ -3545,62 -3545,63 +3545,62 @@@
"copyLink": "复制链接",
"nativeShare": "系统分享",
"access": "权限",
- "sharingAccess": "链接访问",
- "sharingAccessDesc": "独立控制分享链接 /p,不改变 Workspace 权限。",
- "loadingSharingAccess": "正在加载链接访问设置…",
+ "sharingAccess": "访问范围",
+ "sharingModeCurrent": "访问范围:{{mode}}",
+ "sharingAutoSave": "更改会自动保存",
+ "loadingSharingAccess": "正在加载访问范围…",
+ "sharingModes": {
+ "private": "私有",
+ "limited": "有限访问",
+ "public": "完全公开"
+ },
+ "sharingHelp": {
+ "private": "仅你可以访问此页面",
+ "limited": "仅允许列表中的用户访问",
+ "public": "任何人无需登录即可访问"
+ },
+ "limitedEmails": "允许访问的用户",
+ "limitedEmailRequired": "请至少添加一个邮箱。",
+ "limitedEmailHint": "输入邮箱后按回车添加 · 最多 {{count}} 个",
+ "keepOneLimitedEmail": "切换为私有后可移除最后一个邮箱",
+ "shareIdAutoSaveHint": "按回车或离开输入框后自动保存",
+ "sharingErrors": {
+ "conflict": "链接访问设置已在其他位置更新,已载入最新版本。",
+ "invalid": "请检查访问模式、链接和邮箱列表。",
+ "error": "无法加载链接访问设置。"
+ },
- "workspaceAccess": "登录访问范围",
- "workspaceAccessDesc": "控制登录后哪些人可以打开此页面。",
- "workspaceLevels": {
+ "workspaceAccess": "Workspace 访问",
+ "workspaceAccessDesc": "控制此 Avibe 内的已登录访问;与链接访问相互独立。",
+ "loadingWorkspaceAccess": "正在加载 Workspace 访问设置…",
+ "workspacePersonal": "此 Show Page 属于 Personal Avibe。",
+ "workspaceUnmanaged": "此 Avibe 配对后才能使用 Workspace 访问。",
+ "workspacePending": "已知此 Avibe 属于 Organization,但暂时无法取得精确绑定;访问保持私有。",
+ "workspaceOwnershipConflict": "此 Show Page 绑定到了其他所有权域;解决冲突前访问保持私有。",
+ "workspaceModes": {
"private": "私有",
- "public": "组织",
+ "organization": "Organization",
"scope": "指定群组"
},
"workspaceHelp": {
- "private": "此规则下只有页面所有者可以打开。",
- "public": "组织内所有活跃成员均可打开,同时仍受 Avibe 和项目权限限制。",
- "scope": "只有指定群组的活跃成员可以打开,同时仍受 Avibe 和项目权限限制。"
+ "private": "只有页面所有者和 Instance Owner 可以使用。",
+ "public": "此 Organization 的已登录成员可以使用。",
+ "scope": "只有所选 Organization 群组的成员可以使用。"
},
- "selectedGroups": "指定群组",
- "archivedGroup": "已归档",
- "groupRequired": "至少选择一个群组。",
+ "workspaceGroups": "Organization 群组",
+ "workspaceArchived": "已归档",
+ "workspaceNoGroups": "暂无可选的活跃群组。",
+ "workspaceGroupRequired": "请至少选择一个群组。",
+ "workspaceRevisionConflict": "Workspace 访问已在其他位置更新;你的草稿已保留到最新版本。",
+ "workspaceOffline": "Permissions 离线时显示上次已知策略,暂不可编辑。",
+ "workspaceReadOnly": "此策略由 Avibe Cloud 管理,请前往 Avibe Cloud 修改。",
+ "workspaceOwnerOnly": "只有 Instance Owner 可以修改 Workspace 访问。",
+ "workspaceLoadError": "无法加载 Workspace 访问设置。",
"applyWorkspaceAccess": "应用",
- "loadingWorkspaceAccess": "正在加载组织权限…",
- "workspaceReadOnly": "只有页面所有者或组织管理者可以修改此访问范围。",
- "organizationSignIn": "登录",
- "organizationSignInAgain": "重新登录",
- "organizationSignInDesc": "登录 avibe.bot 后才能修改组织访问范围。",
- "organizationUnavailable": "当前 Avibe 尚未连接 avibe.bot 的组织管理功能。",
- "organizationSubjectMismatch": "当前登录的 avibe.bot 账号与此 Avibe 会话不一致。",
- "workspaceErrors": {
- "conflict": "访问范围已在其他位置更新,请重新加载最新版本。",
- "unreachable": "组织权限暂时不可用。",
- "error": "无法加载组织权限。"
- },
"workspaceSync": {
- "pending": "访问范围变更正在等待应用到当前 Avibe。",
- "offline": "当前 Avibe 已离线,重新连接后会应用访问范围变更。",
- "error": "当前 Avibe 无法应用访问范围变更。"
+ "pending": "策略正在等待此 Avibe 应用。",
+ "offline": "此 Avibe 尚未确认最新策略。",
+ "error": "无法应用最新策略。"
},
- "sharingModes": {
- "private": "私有",
- "limited": "指定用户",
- "public": "完全公开"
- },
- "sharingHelp": {
- "private": "分享链接已停用。",
- "limited": "可先配置邮箱名单;分享链接暂未启用。",
- "public": "任何拿到链接的人都可以打开分享页面。"
- },
- "limitedEmails": "指定用户邮箱",
- "limitedEmailRequired": "请至少添加一个邮箱。",
- "limitedEmailLimit": "最多添加 {{count}} 个邮箱。",
- "sharingErrors": {
- "conflict": "链接访问设置已在其他位置更新,已载入最新版本。",
- "invalid": "请检查访问模式、链接和邮箱列表。",
- "error": "无法加载链接访问设置。"
- },
- "applySharingAccess": "应用",
- "narrowSharingTitle": "收紧链接访问范围?",
- "narrowSharingBody": "失去权限的用户在下一次请求页面时将被拒绝。",
"emailPlaceholder": "[email protected]",
"addEmail": "添加邮箱",
"removeEmail": "移除 {{email}}",