chatluna-plugin-onebot-sandbox 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +20 -0
- package/client/app.tsx +306 -0
- package/client/chat/chat-pane.tsx +303 -0
- package/client/chat/composer.css +635 -0
- package/client/chat/composer.tsx +646 -0
- package/client/chat/details-panel.tsx +196 -0
- package/client/chat/emoji-picker.tsx +70 -0
- package/client/chat/extension-mark.tsx +16 -0
- package/client/chat/forward.tsx +257 -0
- package/client/chat/image-preview.tsx +93 -0
- package/client/chat/member-menu.tsx +64 -0
- package/client/chat/message-list.tsx +617 -0
- package/client/chat/messages.css +1018 -0
- package/client/chat/notifications.tsx +83 -0
- package/client/chat/reactions.tsx +52 -0
- package/client/chat/search-panel.tsx +231 -0
- package/client/chat/sidebar.tsx +424 -0
- package/client/chat/webqq-view.tsx +71 -0
- package/client/environment/avatar-picker.tsx +92 -0
- package/client/environment/create-popover.tsx +228 -0
- package/client/environment/directory-model.ts +63 -0
- package/client/environment/entity-dialog.css +383 -0
- package/client/environment/entity-dialog.tsx +442 -0
- package/client/environment/page.css +14 -0
- package/client/environment/page.tsx +280 -0
- package/client/i18n.ts +19 -0
- package/client/index.ts +17 -0
- package/client/locales/en.yml +617 -0
- package/client/locales/zh.yml +617 -0
- package/client/mcp/capability-catalog.tsx +277 -0
- package/client/mcp/credential-manager.tsx +257 -0
- package/client/onebot-debug/page.tsx +329 -0
- package/client/records/record-layout.tsx +429 -0
- package/client/records/records.css +259 -0
- package/client/settings/about.tsx +43 -0
- package/client/settings/draft.ts +47 -0
- package/client/settings/localize.ts +76 -0
- package/client/settings/page.tsx +210 -0
- package/client/settings/settings.css +47 -0
- package/client/shared/avatar.tsx +35 -0
- package/client/shared/confirm-dialog.tsx +44 -0
- package/client/shared/controls.css +17 -0
- package/client/shared/discard-confirm.tsx +45 -0
- package/client/shared/floating-panel.ts +40 -0
- package/client/shared/format-duration.ts +22 -0
- package/client/shared/format-time.ts +49 -0
- package/client/shared/glass.css +150 -0
- package/client/shared/implementation.ts +12 -0
- package/client/shared/overlay-scrollbar.css +45 -0
- package/client/shared/overlay-scrollbar.tsx +123 -0
- package/client/shared/use-element-width.ts +19 -0
- package/client/shared/use-retained.ts +12 -0
- package/client/test-call/page.tsx +260 -0
- package/client/test-space/agent-visuals.tsx +121 -0
- package/client/test-space/observe-overlay.tsx +42 -0
- package/client/test-space/overview.tsx +267 -0
- package/client/test-space/spaces.css +201 -0
- package/client/test-space/thumbnail-capture.ts +63 -0
- package/client/test-space/thumbnail-scale.ts +21 -0
- package/client/test-space/use-space-list.ts +35 -0
- package/client/test-space/zoom.ts +197 -0
- package/client/webqq/composer-draft-host.ts +578 -0
- package/client/webqq/composer-draft.ts +81 -0
- package/client/webqq/conversation-tree.ts +155 -0
- package/client/webqq/emoji-catalog.ts +78 -0
- package/client/webqq/fork-boundary.ts +28 -0
- package/client/webqq/forward-cluster.ts +20 -0
- package/client/webqq/forward-dialog-stack.ts +74 -0
- package/client/webqq/forward-preview.ts +40 -0
- package/client/webqq/friend-menu.ts +17 -0
- package/client/webqq/group-display.ts +18 -0
- package/client/webqq/group-menu.ts +25 -0
- package/client/webqq/mention.ts +4 -0
- package/client/webqq/message-capabilities.ts +37 -0
- package/client/webqq/message-cluster.ts +68 -0
- package/client/webqq/message-presentation.ts +197 -0
- package/client/webqq/message-reveal.ts +31 -0
- package/client/webqq/message-search-date.ts +40 -0
- package/client/webqq/message-selection.ts +85 -0
- package/client/webqq/notification-requests.ts +20 -0
- package/client/webqq/participant-presentation.ts +128 -0
- package/client/webqq/profile-card.ts +199 -0
- package/client/webqq/relationship-directory.ts +62 -0
- package/client/webqq/thinking-panel.ts +7 -0
- package/client/webqq/user-stack.ts +53 -0
- package/client/workspace/agent-overlay-effect.ts +238 -0
- package/client/workspace/context.tsx +117 -0
- package/client/workspace/overlay-host.tsx +299 -0
- package/client/workspace/profile-card.css +164 -0
- package/client/workspace/state.ts +28 -0
- package/client/workspace/store.ts +388 -0
- package/client/workspace/use-test-spaces.ts +21 -0
- package/dist/.vite/manifest.json +21 -0
- package/dist/app-63rfTh6w.js +85 -0
- package/dist/client.css +4 -0
- package/dist/client.js +1 -0
- package/lib/account-profile.d.ts +17 -0
- package/lib/account-profile.d.ts.map +1 -0
- package/lib/base-dir.d.ts +4 -0
- package/lib/base-dir.d.ts.map +1 -0
- package/lib/bot.d.ts +185 -0
- package/lib/bot.d.ts.map +1 -0
- package/lib/builtin-avatar-options.d.ts +11 -0
- package/lib/builtin-avatar-options.d.ts.map +1 -0
- package/lib/builtin-avatars.d.ts +6 -0
- package/lib/builtin-avatars.d.ts.map +1 -0
- package/lib/channel-assignee.d.ts +52 -0
- package/lib/channel-assignee.d.ts.map +1 -0
- package/lib/chatluna/conversation-lines.d.ts +46 -0
- package/lib/chatluna/conversation-lines.d.ts.map +1 -0
- package/lib/chatluna/runtime.d.ts +26 -0
- package/lib/chatluna/runtime.d.ts.map +1 -0
- package/lib/chatluna/state.d.ts +67 -0
- package/lib/chatluna/state.d.ts.map +1 -0
- package/lib/chatluna/thinking.d.ts +10 -0
- package/lib/chatluna/thinking.d.ts.map +1 -0
- package/lib/chatluna/tools.d.ts +36 -0
- package/lib/chatluna/tools.d.ts.map +1 -0
- package/lib/chatluna/wakeup.d.ts +143 -0
- package/lib/chatluna/wakeup.d.ts.map +1 -0
- package/lib/console-contract.d.ts +131 -0
- package/lib/console-contract.d.ts.map +1 -0
- package/lib/console.d.ts +31 -0
- package/lib/console.d.ts.map +1 -0
- package/lib/control-service.d.ts +425 -0
- package/lib/control-service.d.ts.map +1 -0
- package/lib/conversation-resolution.d.ts +157 -0
- package/lib/conversation-resolution.d.ts.map +1 -0
- package/lib/error-detail.d.ts +3 -0
- package/lib/error-detail.d.ts.map +1 -0
- package/lib/inbound-delivery.d.ts +156 -0
- package/lib/inbound-delivery.d.ts.map +1 -0
- package/lib/index.d.ts +76 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12834 -0
- package/lib/index.js.map +1 -0
- package/lib/lifecycle.d.ts +8 -0
- package/lib/lifecycle.d.ts.map +1 -0
- package/lib/mcp/arguments.d.ts +71 -0
- package/lib/mcp/arguments.d.ts.map +1 -0
- package/lib/mcp/call-records.d.ts +32 -0
- package/lib/mcp/call-records.d.ts.map +1 -0
- package/lib/mcp/http-api.d.ts +147 -0
- package/lib/mcp/http-api.d.ts.map +1 -0
- package/lib/mcp/page-cursor.d.ts +37 -0
- package/lib/mcp/page-cursor.d.ts.map +1 -0
- package/lib/mcp/server.d.ts +60 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/service.d.ts +219 -0
- package/lib/mcp/service.d.ts.map +1 -0
- package/lib/mcp/tool-registry.d.ts +113 -0
- package/lib/mcp/tool-registry.d.ts.map +1 -0
- package/lib/mcp/types.d.ts +144 -0
- package/lib/mcp/types.d.ts.map +1 -0
- package/lib/media-storage.d.ts +33 -0
- package/lib/media-storage.d.ts.map +1 -0
- package/lib/message-capabilities.d.ts +78 -0
- package/lib/message-capabilities.d.ts.map +1 -0
- package/lib/onebot-debug.d.ts +115 -0
- package/lib/onebot-debug.d.ts.map +1 -0
- package/lib/onebot-message.d.ts +23 -0
- package/lib/onebot-message.d.ts.map +1 -0
- package/lib/onebot-profiles.d.ts +45 -0
- package/lib/onebot-profiles.d.ts.map +1 -0
- package/lib/persistence.d.ts +148 -0
- package/lib/persistence.d.ts.map +1 -0
- package/lib/random.d.ts +5 -0
- package/lib/random.d.ts.map +1 -0
- package/lib/record-store.d.ts +80 -0
- package/lib/record-store.d.ts.map +1 -0
- package/lib/relationship-actions.d.ts +157 -0
- package/lib/relationship-actions.d.ts.map +1 -0
- package/lib/scope-directory.d.ts +105 -0
- package/lib/scope-directory.d.ts.map +1 -0
- package/lib/settings.d.ts +33 -0
- package/lib/settings.d.ts.map +1 -0
- package/lib/test-spaces.d.ts +69 -0
- package/lib/test-spaces.d.ts.map +1 -0
- package/lib/types.d.ts +739 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/webui.d.ts +26 -0
- package/lib/webui.d.ts.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AtSignIcon, AwardIcon, CrownIcon, HandIcon, TagIcon, UserMinusIcon, UserPlusIcon } from 'lucide-react'
|
|
2
|
+
import { ContextMenuItem } from '@chatluna/ui-kit'
|
|
3
|
+
import type { SandboxGroupMember } from '../../src/types'
|
|
4
|
+
import { useT } from '../i18n'
|
|
5
|
+
import { getGroupMemberMenuActions } from '../webqq/group-menu'
|
|
6
|
+
import { useSandbox, useWorkspace } from '../workspace/context'
|
|
7
|
+
import { ExtensionMark } from './extension-mark'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 群成员菜单项。可用动作由 `getGroupMemberMenuActions` 按双方群身份判定:普通成员不能管理他人,
|
|
11
|
+
* 管理员不能管理群主或其他管理员,只有群主能授予头衔与转让群主。
|
|
12
|
+
*/
|
|
13
|
+
export function GroupMemberMenuItems({ target, managementOnly, onMention }: {
|
|
14
|
+
target: SandboxGroupMember
|
|
15
|
+
managementOnly?: boolean
|
|
16
|
+
onMention?(participantId: string): void
|
|
17
|
+
}) {
|
|
18
|
+
const t = useT()
|
|
19
|
+
const { store, run, dialogs } = useSandbox()
|
|
20
|
+
const { group, operatorId, conversation } = useWorkspace()
|
|
21
|
+
if (!group) return null
|
|
22
|
+
const actor = group.members.find(({ participantId }) => participantId === operatorId)
|
|
23
|
+
const actions = getGroupMemberMenuActions(actor, target)
|
|
24
|
+
const targetId = target.participantId
|
|
25
|
+
const act = (input: Parameters<typeof store.performGroupAction>[0]) => run(t('sandbox.error.group'), () => store.performGroupAction(input))
|
|
26
|
+
const kickDisabledReason = !actor || actor.participantId === targetId
|
|
27
|
+
? ''
|
|
28
|
+
: actor.role === 'member'
|
|
29
|
+
? t('sandbox.member.kickNeedAdmin')
|
|
30
|
+
: actor.role === 'admin' && target.role !== 'member' ? t('sandbox.member.adminLimit') : ''
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{!managementOnly && actions.includes('mention') && onMention && (
|
|
35
|
+
<ContextMenuItem onClick={() => onMention(targetId)}><AtSignIcon />{t('sandbox.member.mention')}</ContextMenuItem>
|
|
36
|
+
)}
|
|
37
|
+
{!managementOnly && actions.includes('poke') && conversation && (
|
|
38
|
+
<ContextMenuItem onClick={() => act({ action: 'poke', groupId: group.id, targetId, conversationId: conversation.id })}>
|
|
39
|
+
<HandIcon />{t('sandbox.member.poke')}
|
|
40
|
+
</ContextMenuItem>
|
|
41
|
+
)}
|
|
42
|
+
{actions.includes('set-card') && (
|
|
43
|
+
<ContextMenuItem onClick={() => dialogs.openGroupAction('card', targetId, group.id)}><TagIcon />{t('sandbox.member.setCard')}</ContextMenuItem>
|
|
44
|
+
)}
|
|
45
|
+
{actions.includes('set-title') && (
|
|
46
|
+
<ContextMenuItem onClick={() => dialogs.openGroupAction('title', targetId, group.id)}><AwardIcon />{t('sandbox.member.setTitle')}</ContextMenuItem>
|
|
47
|
+
)}
|
|
48
|
+
{actions.includes('set-admin') && (
|
|
49
|
+
<ContextMenuItem onClick={() => act({ action: 'set-admin', groupId: group.id, targetId, enabled: true })}><UserPlusIcon />{t('sandbox.member.setAdmin')}</ContextMenuItem>
|
|
50
|
+
)}
|
|
51
|
+
{actions.includes('unset-admin') && (
|
|
52
|
+
<ContextMenuItem onClick={() => act({ action: 'set-admin', groupId: group.id, targetId, enabled: false })}><UserMinusIcon />{t('sandbox.member.unsetAdmin')}</ContextMenuItem>
|
|
53
|
+
)}
|
|
54
|
+
{actions.includes('transfer-owner') && (
|
|
55
|
+
<ContextMenuItem onClick={() => act({ action: 'transfer-owner', groupId: group.id, targetId })}>
|
|
56
|
+
<CrownIcon />{t('sandbox.member.transferOwner')}<ExtensionMark />
|
|
57
|
+
</ContextMenuItem>
|
|
58
|
+
)}
|
|
59
|
+
{actions.includes('kick')
|
|
60
|
+
? <ContextMenuItem variant="destructive" onClick={() => act({ action: 'kick', groupId: group.id, targetId })}><UserMinusIcon />{t('sandbox.member.kick')}</ContextMenuItem>
|
|
61
|
+
: kickDisabledReason && <ContextMenuItem disabled><UserMinusIcon />{kickDisabledReason}</ContextMenuItem>}
|
|
62
|
+
</>
|
|
63
|
+
)
|
|
64
|
+
}
|