@fluxmail/core 0.24.0 → 0.26.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/access/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './rules.js';
2
+ export * from './conformance.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/access/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Member, mailbox and credential access rules shared by self-hosted Fluxmail and
3
+ * Fluxmail Cloud. Pure functions with no storage: each product loads its own rows,
4
+ * maps them to these types and asks for a decision.
5
+ *
6
+ * The promise both products keep: no workspace role can read another member's
7
+ * private mail through Fluxmail, or give itself that ability. The one exception is
8
+ * removing a member, which is permanent and hands their mailboxes to someone else.
9
+ */
10
+ export declare const MEMBER_ROLES: readonly ["owner", "admin", "member"];
11
+ export type MemberRole = (typeof MEMBER_ROLES)[number];
12
+ /**
13
+ * Removed members are absent; a lookup for them returns undefined. Removal is
14
+ * permanent: someone invited again gets a new member id.
15
+ */
16
+ export declare const MEMBER_STATUSES: readonly ["pending", "active", "suspended"];
17
+ export type MemberStatus = (typeof MEMBER_STATUSES)[number];
18
+ /** Workspace powers. None of them adds a mailbox to anyone's reach. */
19
+ export declare const ADMIN_CAPABILITIES: readonly ["admin.accounts", "admin.members", "admin.api_keys", "admin.license", "admin.audit"];
20
+ export type AdminCapability = (typeof ADMIN_CAPABILITIES)[number];
21
+ /**
22
+ * The workspace powers each role holds while active. An owner differs from an
23
+ * admin only in that nobody can remove or demote the owner, and only the owner
24
+ * can hand ownership to someone else.
25
+ */
26
+ export declare const ROLE_CAPABILITIES: Readonly<Record<MemberRole, readonly AdminCapability[]>>;
27
+ /** The role the previous owner takes, in the same change, when ownership moves. */
28
+ export declare const PREVIOUS_OWNER_ROLE: MemberRole;
29
+ export interface AccessMember {
30
+ id: string;
31
+ role: MemberRole;
32
+ status: MemberStatus;
33
+ }
34
+ export type MailboxAccess = {
35
+ kind: 'private';
36
+ }
37
+ /** Every active member, including members added later. */
38
+ | {
39
+ kind: 'workspace';
40
+ }
41
+ /** The owner plus these members. */
42
+ | {
43
+ kind: 'members';
44
+ memberIds: readonly string[];
45
+ };
46
+ export interface AccessMailbox {
47
+ id: string;
48
+ ownerId: string;
49
+ access: MailboxAccess;
50
+ }
51
+ /** An API key or OAuth grant. */
52
+ export interface AccessCredential {
53
+ id: string;
54
+ /** The member the credential acts as. */
55
+ ownerId: string;
56
+ /**
57
+ * The member who created it, or null when the owner created it. A product must
58
+ * revoke the credential when its issuer is removed: clearing the reference would
59
+ * widen the credential to the owner's full reach.
60
+ */
61
+ issuerId: string | null;
62
+ /** Mailbox allowlist, or null for every mailbox the credential can otherwise reach. */
63
+ mailboxIds: readonly string[] | null;
64
+ }
65
+ export type MemberLookup = (memberId: string) => AccessMember | undefined;
66
+ export declare const ACCESS_DENIAL_REASONS: readonly ["inactive_actor", "no_mailbox_access", "not_mailbox_owner", "missing_capability", "inactive_owner", "unknown_member", "outside_issuer_reach", "owner_protected"];
67
+ export type AccessDenialReason = (typeof ACCESS_DENIAL_REASONS)[number];
68
+ export type AccessDecision = {
69
+ allowed: true;
70
+ } | {
71
+ allowed: false;
72
+ reason: AccessDenialReason;
73
+ };
74
+ export declare function isActive(member: AccessMember | undefined): member is AccessMember;
75
+ /**
76
+ * Whether a member can be given a mailbox or a credential: active, or invited and
77
+ * not enrolled yet.
78
+ */
79
+ export declare function canHoldMailbox(member: AccessMember | undefined): member is AccessMember;
80
+ /** Maps self-hosted's `sharedWithAll` and grant list, or Cloud's `shared` flag, to an access value. */
81
+ export declare function mailboxAccessFromFlags(sharedWithAll: boolean, memberIds?: readonly string[]): MailboxAccess;
82
+ export declare function hasAdminCapability(member: AccessMember | undefined, capability: AdminCapability): boolean;
83
+ /** Reading depends only on ownership and sharing. Role never matters. */
84
+ export declare function memberCanReadMailbox(member: AccessMember | undefined, mailbox: AccessMailbox): boolean;
85
+ /**
86
+ * A credential reaches mailboxes its owner can read, that its issuer can also
87
+ * read, and that are on its allowlist. Checked on every request, so a credential
88
+ * shrinks as soon as either member loses access.
89
+ */
90
+ export declare function credentialCanReadMailbox(credential: AccessCredential, mailbox: AccessMailbox, findMember: MemberLookup): boolean;
91
+ /** Address, provider, owner and status: for seat counts and offboarding, never content. */
92
+ export declare function canSeeMailboxMetadata(actor: AccessMember | undefined, mailbox: AccessMailbox): AccessDecision;
93
+ /**
94
+ * Remove a mailbox, change its folder mappings, or edit its allowed sender
95
+ * addresses. None of these sends mail anywhere new, so admins may do them on any
96
+ * mailbox.
97
+ */
98
+ export declare function canManageMailbox(actor: AccessMember | undefined, mailbox: AccessMailbox): AccessDecision;
99
+ /**
100
+ * Reauthorize a mailbox or change its provider credentials or IMAP and SMTP
101
+ * server settings. Whoever controls these controls where the mailbox's mail is
102
+ * read from and sent through, so only the active owner may change them.
103
+ */
104
+ export declare function canChangeMailboxConnection(actor: AccessMember | undefined, mailbox: AccessMailbox): AccessDecision;
105
+ /**
106
+ * Only the active owner decides who else can read a mailbox. Grantees cannot
107
+ * re-share it, and every listed member must belong to the workspace.
108
+ */
109
+ export declare function canChangeMailboxAccess(actor: AccessMember | undefined, mailbox: AccessMailbox, access: MailboxAccess, findMember: MemberLookup): AccessDecision;
110
+ /**
111
+ * Only the active owner can hand a mailbox to another member. Admins move a
112
+ * mailbox only by removing its owner with {@link canRemoveMember}, which is
113
+ * permanent, so they cannot borrow a mailbox and quietly give it back.
114
+ */
115
+ export declare function canReassignMailbox(actor: AccessMember | undefined, mailbox: AccessMailbox, newOwnerId: string, findMember: MemberLookup): AccessDecision;
116
+ /**
117
+ * Whoever supplies a new mailbox's provider credentials can choose its owner and
118
+ * initial access: they already hold the credentials, so this grants nothing new.
119
+ * Connecting for someone else needs `admin.accounts` and an owner who is active or
120
+ * has not enrolled yet.
121
+ */
122
+ export declare function canConnectMailbox(actor: AccessMember | undefined, ownerId: string, findMember: MemberLookup): AccessDecision;
123
+ /**
124
+ * Members create credentials for themselves. An admin can create one for another
125
+ * active member only when its allowlist stays inside mailboxes the admin can read.
126
+ * A credential without an allowlist is still limited to the issuer's reach at
127
+ * request time by {@link credentialCanReadMailbox}.
128
+ */
129
+ export declare function canIssueCredential(actor: AccessMember | undefined, ownerId: string, mailboxes: readonly AccessMailbox[] | null, findMember: MemberLookup): AccessDecision;
130
+ /** Suspend, reactivate, reset a password, or list and revoke sessions. */
131
+ export declare function canManageMember(actor: AccessMember | undefined, target: AccessMember): AccessDecision;
132
+ /**
133
+ * Remove a member permanently. Their mailboxes go to `newOwnerId` in the same
134
+ * change, or are deleted when it is null. Credentials they own or issued are
135
+ * revoked. This is the only way an admin can move another member's mailbox.
136
+ */
137
+ export declare function canRemoveMember(actor: AccessMember | undefined, target: AccessMember, newOwnerId: string | null, findMember: MemberLookup): AccessDecision;
138
+ /**
139
+ * Change a member's role between admin and member. Nobody can make someone the
140
+ * owner this way; use {@link canTransferOwnership}.
141
+ */
142
+ export declare function canAssignRole(actor: AccessMember | undefined, target: AccessMember, role: MemberRole): AccessDecision;
143
+ /**
144
+ * The owner hands ownership to another active member. In the same change the
145
+ * product makes the target the owner and moves the previous owner to
146
+ * {@link PREVIOUS_OWNER_ROLE}, so a workspace never has two owners.
147
+ */
148
+ export declare function canTransferOwnership(actor: AccessMember | undefined, target: AccessMember): AccessDecision;
149
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/access/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,YAAY,uCAAwC,CAAC;AAClE,M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,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,cAAc,CAI1G"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * Member, mailbox and credential access rules shared by self-hosted Fluxmail and
3
+ * Fluxmail Cloud. Pure functions with no storage: each product loads its own rows,
4
+ * maps them to these types and asks for a decision.
5
+ *
6
+ * The promise both products keep: no workspace role can read another member's
7
+ * private mail through Fluxmail, or give itself that ability. The one exception is
8
+ * removing a member, which is permanent and hands their mailboxes to someone else.
9
+ */
10
+ export const MEMBER_ROLES = ['owner', 'admin', 'member'];
11
+ /**
12
+ * Removed members are absent; a lookup for them returns undefined. Removal is
13
+ * permanent: someone invited again gets a new member id.
14
+ */
15
+ export const MEMBER_STATUSES = ['pending', 'active', 'suspended'];
16
+ /** Workspace powers. None of them adds a mailbox to anyone's reach. */
17
+ export const ADMIN_CAPABILITIES = [
18
+ 'admin.accounts',
19
+ 'admin.members',
20
+ 'admin.api_keys',
21
+ 'admin.license',
22
+ 'admin.audit',
23
+ ];
24
+ /**
25
+ * The workspace powers each role holds while active. An owner differs from an
26
+ * admin only in that nobody can remove or demote the owner, and only the owner
27
+ * can hand ownership to someone else.
28
+ */
29
+ export const ROLE_CAPABILITIES = {
30
+ owner: ADMIN_CAPABILITIES,
31
+ admin: ADMIN_CAPABILITIES,
32
+ member: [],
33
+ };
34
+ /** The role the previous owner takes, in the same change, when ownership moves. */
35
+ export const PREVIOUS_OWNER_ROLE = 'admin';
36
+ export const ACCESS_DENIAL_REASONS = [
37
+ /** The acting member is missing, pending or suspended. */
38
+ 'inactive_actor',
39
+ /** The actor can't read the mailbox, or for other actions can't see it at all. */
40
+ 'no_mailbox_access',
41
+ 'not_mailbox_owner',
42
+ 'missing_capability',
43
+ /** The member who would own the mailbox or credential is missing or suspended. */
44
+ 'inactive_owner',
45
+ /** A member named in a sharing list is not in the workspace. */
46
+ 'unknown_member',
47
+ 'outside_issuer_reach',
48
+ /** Nobody can remove or demote the owner, and ownership moves only by transfer. */
49
+ 'owner_protected',
50
+ ];
51
+ const ALLOW = Object.freeze({ allowed: true });
52
+ const deny = (reason) => ({ allowed: false, reason });
53
+ export function isActive(member) {
54
+ return member?.status === 'active';
55
+ }
56
+ /**
57
+ * Whether a member can be given a mailbox or a credential: active, or invited and
58
+ * not enrolled yet.
59
+ */
60
+ export function canHoldMailbox(member) {
61
+ return member !== undefined && member.status !== 'suspended';
62
+ }
63
+ /** Maps self-hosted's `sharedWithAll` and grant list, or Cloud's `shared` flag, to an access value. */
64
+ export function mailboxAccessFromFlags(sharedWithAll, memberIds = []) {
65
+ if (sharedWithAll)
66
+ return { kind: 'workspace' };
67
+ return memberIds.length > 0 ? { kind: 'members', memberIds: [...memberIds] } : { kind: 'private' };
68
+ }
69
+ export function hasAdminCapability(member, capability) {
70
+ return isActive(member) && ROLE_CAPABILITIES[member.role].includes(capability);
71
+ }
72
+ /** Reading depends only on ownership and sharing. Role never matters. */
73
+ export function memberCanReadMailbox(member, mailbox) {
74
+ if (!isActive(member))
75
+ return false;
76
+ if (mailbox.ownerId === member.id)
77
+ return true;
78
+ switch (mailbox.access.kind) {
79
+ case 'private':
80
+ return false;
81
+ case 'workspace':
82
+ return true;
83
+ case 'members':
84
+ return mailbox.access.memberIds.includes(member.id);
85
+ }
86
+ }
87
+ /**
88
+ * A credential reaches mailboxes its owner can read, that its issuer can also
89
+ * read, and that are on its allowlist. Checked on every request, so a credential
90
+ * shrinks as soon as either member loses access.
91
+ */
92
+ export function credentialCanReadMailbox(credential, mailbox, findMember) {
93
+ if (credential.mailboxIds !== null && !credential.mailboxIds.includes(mailbox.id))
94
+ return false;
95
+ if (!memberCanReadMailbox(findMember(credential.ownerId), mailbox))
96
+ return false;
97
+ if (credential.issuerId === null || credential.issuerId === credential.ownerId)
98
+ return true;
99
+ return memberCanReadMailbox(findMember(credential.issuerId), mailbox);
100
+ }
101
+ /** Address, provider, owner and status: for seat counts and offboarding, never content. */
102
+ export function canSeeMailboxMetadata(actor, mailbox) {
103
+ if (!isActive(actor))
104
+ return deny('inactive_actor');
105
+ if (memberCanReadMailbox(actor, mailbox) || hasAdminCapability(actor, 'admin.accounts'))
106
+ return ALLOW;
107
+ return deny('no_mailbox_access');
108
+ }
109
+ /**
110
+ * The refusal for an action on a mailbox the actor doesn't control. Someone who
111
+ * can't see the mailbox at all is told it doesn't exist, so a refusal never
112
+ * confirms that another member's private mailbox is there.
113
+ */
114
+ function refuseOnMailbox(actor, mailbox, reason) {
115
+ return canSeeMailboxMetadata(actor, mailbox).allowed ? deny(reason) : deny('no_mailbox_access');
116
+ }
117
+ /**
118
+ * Remove a mailbox, change its folder mappings, or edit its allowed sender
119
+ * addresses. None of these sends mail anywhere new, so admins may do them on any
120
+ * mailbox.
121
+ */
122
+ export function canManageMailbox(actor, mailbox) {
123
+ if (!isActive(actor))
124
+ return deny('inactive_actor');
125
+ if (actor.id === mailbox.ownerId || hasAdminCapability(actor, 'admin.accounts'))
126
+ return ALLOW;
127
+ return refuseOnMailbox(actor, mailbox, 'missing_capability');
128
+ }
129
+ /**
130
+ * Reauthorize a mailbox or change its provider credentials or IMAP and SMTP
131
+ * server settings. Whoever controls these controls where the mailbox's mail is
132
+ * read from and sent through, so only the active owner may change them.
133
+ */
134
+ export function canChangeMailboxConnection(actor, mailbox) {
135
+ if (!isActive(actor))
136
+ return deny('inactive_actor');
137
+ return actor.id === mailbox.ownerId ? ALLOW : refuseOnMailbox(actor, mailbox, 'not_mailbox_owner');
138
+ }
139
+ /**
140
+ * Only the active owner decides who else can read a mailbox. Grantees cannot
141
+ * re-share it, and every listed member must belong to the workspace.
142
+ */
143
+ export function canChangeMailboxAccess(actor, mailbox, access, findMember) {
144
+ if (!isActive(actor))
145
+ return deny('inactive_actor');
146
+ if (actor.id !== mailbox.ownerId)
147
+ return refuseOnMailbox(actor, mailbox, 'not_mailbox_owner');
148
+ if (access.kind === 'members' && access.memberIds.some((id) => findMember(id) === undefined)) {
149
+ return deny('unknown_member');
150
+ }
151
+ return ALLOW;
152
+ }
153
+ /**
154
+ * Only the active owner can hand a mailbox to another member. Admins move a
155
+ * mailbox only by removing its owner with {@link canRemoveMember}, which is
156
+ * permanent, so they cannot borrow a mailbox and quietly give it back.
157
+ */
158
+ export function canReassignMailbox(actor, mailbox, newOwnerId, findMember) {
159
+ if (!isActive(actor))
160
+ return deny('inactive_actor');
161
+ if (actor.id !== mailbox.ownerId)
162
+ return refuseOnMailbox(actor, mailbox, 'not_mailbox_owner');
163
+ return canHoldMailbox(findMember(newOwnerId)) ? ALLOW : deny('inactive_owner');
164
+ }
165
+ /**
166
+ * Whoever supplies a new mailbox's provider credentials can choose its owner and
167
+ * initial access: they already hold the credentials, so this grants nothing new.
168
+ * Connecting for someone else needs `admin.accounts` and an owner who is active or
169
+ * has not enrolled yet.
170
+ */
171
+ export function canConnectMailbox(actor, ownerId, findMember) {
172
+ if (!isActive(actor))
173
+ return deny('inactive_actor');
174
+ if (actor.id === ownerId)
175
+ return ALLOW;
176
+ if (!hasAdminCapability(actor, 'admin.accounts'))
177
+ return deny('missing_capability');
178
+ return canHoldMailbox(findMember(ownerId)) ? ALLOW : deny('inactive_owner');
179
+ }
180
+ /**
181
+ * Members create credentials for themselves. An admin can create one for another
182
+ * active member only when its allowlist stays inside mailboxes the admin can read.
183
+ * A credential without an allowlist is still limited to the issuer's reach at
184
+ * request time by {@link credentialCanReadMailbox}.
185
+ */
186
+ export function canIssueCredential(actor, ownerId, mailboxes, findMember) {
187
+ if (!isActive(actor))
188
+ return deny('inactive_actor');
189
+ if (actor.id === ownerId)
190
+ return ALLOW;
191
+ if (!hasAdminCapability(actor, 'admin.api_keys'))
192
+ return deny('missing_capability');
193
+ if (!isActive(findMember(ownerId)))
194
+ return deny('inactive_owner');
195
+ if (mailboxes?.some((mailbox) => !memberCanReadMailbox(actor, mailbox)))
196
+ return deny('outside_issuer_reach');
197
+ return ALLOW;
198
+ }
199
+ /** Suspend, reactivate, reset a password, or list and revoke sessions. */
200
+ export function canManageMember(actor, target) {
201
+ if (!isActive(actor))
202
+ return deny('inactive_actor');
203
+ if (target.role === 'owner')
204
+ return deny('owner_protected');
205
+ return hasAdminCapability(actor, 'admin.members') ? ALLOW : deny('missing_capability');
206
+ }
207
+ /**
208
+ * Remove a member permanently. Their mailboxes go to `newOwnerId` in the same
209
+ * change, or are deleted when it is null. Credentials they own or issued are
210
+ * revoked. This is the only way an admin can move another member's mailbox.
211
+ */
212
+ export function canRemoveMember(actor, target, newOwnerId, findMember) {
213
+ const managed = canManageMember(actor, target);
214
+ if (!managed.allowed || newOwnerId === null)
215
+ return managed;
216
+ if (newOwnerId === target.id || !canHoldMailbox(findMember(newOwnerId)))
217
+ return deny('inactive_owner');
218
+ return ALLOW;
219
+ }
220
+ /**
221
+ * Change a member's role between admin and member. Nobody can make someone the
222
+ * owner this way; use {@link canTransferOwnership}.
223
+ */
224
+ export function canAssignRole(actor, target, role) {
225
+ if (!isActive(actor))
226
+ return deny('inactive_actor');
227
+ if (role === 'owner')
228
+ return deny('owner_protected');
229
+ return canManageMember(actor, target);
230
+ }
231
+ /**
232
+ * The owner hands ownership to another active member. In the same change the
233
+ * product makes the target the owner and moves the previous owner to
234
+ * {@link PREVIOUS_OWNER_ROLE}, so a workspace never has two owners.
235
+ */
236
+ export function canTransferOwnership(actor, target) {
237
+ if (!isActive(actor))
238
+ return deny('inactive_actor');
239
+ if (actor.role !== 'owner' || actor.id === target.id)
240
+ return deny('owner_protected');
241
+ return isActive(target) ? ALLOW : deny('inactive_owner');
242
+ }
243
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/access/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAGlE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CA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C,iBAAiB,CAAC,CAAC;IACrF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../src/mcp/clients.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,eAAO,MAAM,UAAU,2KAgBb,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAwBpD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAQ1D;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,SAAS,CAAC;IACtB,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAOD,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAYjG"}
1
+ {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../src/mcp/clients.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,eAAO,MAAM,UAAU,2KAgBb,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AA4BpD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAQ1D;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,SAAS,CAAC;IACtB,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAOD,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAYjG"}
@@ -19,10 +19,13 @@ export const mcpClients = [
19
19
  const aliases = new Map([
20
20
  ['claude', 'claude'],
21
21
  ['claude_ai', 'claude'],
22
+ ['anthropic/claudeai', 'claude'],
23
+ ['anthropic/toolbox', 'claude'],
22
24
  ['claude_desktop', 'claude_desktop'],
23
25
  ['claude_code', 'claude_code'],
24
26
  ['codex', 'codex'],
25
27
  ['codex_mcp_client', 'codex'],
28
+ ['openai_mcp_(codex)', 'codex'],
26
29
  ['cursor', 'cursor'],
27
30
  ['cursor_vscode', 'cursor'],
28
31
  ['chatgpt', 'chatgpt'],
@@ -35,6 +38,7 @@ const aliases = new Map([
35
38
  ['goose', 'goose'],
36
39
  ['zed', 'zed'],
37
40
  ['muse', 'muse'],
41
+ ['muse_custom_connector', 'muse'],
38
42
  ]);
39
43
  // Client names are untrusted. Classify them into fixed labels for stable grouping.
40
44
  export function classifyMcpClient(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../src/mcp/clients.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ;IACR,gBAAgB;IAChB,aAAa;IACb,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,UAAU;IACV,OAAO;IACP,UAAU;IACV,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;IACP,SAAS;CACD,CAAC;AAGX,MAAM,OAAO,GAAmC,IAAI,GAAG,CAAC;IACtD,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,WAAW,EAAE,QAAQ,CAAC;IACvB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IACpC,CAAC,aAAa,EAAE,aAAa,CAAC;IAC9B,CAAC,O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AAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CAAC,IAAa,EAAE,eAAyB;IAC1E,MAAM,MAAM,GAA0C,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACnG,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChD,OAAO;QACL,UAAU,EAAE,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,eAAe,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,eAAe,CAAC;YACpF,CAAC,CAAC,EAAE,oBAAoB,EAAE,eAAe,EAAE;YAC3C,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
@@ -6,7 +6,7 @@ export interface SharedToolAnnotations {
6
6
  idempotentHint?: boolean;
7
7
  openWorldHint: boolean;
8
8
  }
9
- export declare const SHARED_TOOL_NAMES: readonly ["send_feedback", "list_accounts", "list_folders", "list_labels", "list_send_as", "list_emails", "search_emails", "list_emails_batch", "search_emails_batch", "get_email", "get_email_body", "get_thread", "get_draft", "create_draft", "update_draft", "delete_draft", "preview_send", "send_email", "get_delivery_operation", "forward_email", "mark_emails_read", "mark_emails_unread", "star_emails", "unstar_emails", "archive_emails", "move_emails", "add_labels", "remove_labels", "trash_emails", "restore_emails", "delete_emails", "download_attachment"];
9
+ export declare const SHARED_TOOL_NAMES: readonly ["send_feedback", "list_accounts", "list_folders", "list_labels", "list_send_as", "list_emails", "search_emails", "list_emails_batch", "search_emails_batch", "get_email", "get_email_body", "get_thread", "get_draft", "create_draft", "update_draft", "delete_draft", "preview_send", "send_email", "get_delivery_operation", "list_scheduled_emails", "cancel_scheduled_email", "forward_email", "mark_emails_read", "mark_emails_unread", "star_emails", "unstar_emails", "archive_emails", "move_emails", "add_labels", "remove_labels", "trash_emails", "restore_emails", "delete_emails", "download_attachment"];
10
10
  export type SharedToolName = (typeof SHARED_TOOL_NAMES)[number];
11
11
  export interface SharedTool {
12
12
  name: SharedToolName;
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,+iBAiCpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,wHAAwH;IACxH,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC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AAC;IACd,wHAAwH;IACxH,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,WAAW,EAAE,qBAAqB,CAAC;IACnC,4FAA4F;IAC5F,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,wCAAwC;AACxC,eAAO,MAAM,mBAAmB;;;CAGoC,CAAC;AAErE,0CAA0C;AAC1C,KAAK,eAAe,GAAG,OAAO,CAAC,cAAc,EAAE,MAAM,OAAO,mBAAmB,CAAC,CAAC;AACjF,uGAAuG;AACvG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,CAAC;AACxE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;AA0PvD,0GAA0G;AAC1G,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAU5C,CAAC;AAIH,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,CAE3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.generated.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.generated.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2zDvF,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA6rDxF,CAAC"}
1
+ {"version":3,"file":"tools.generated.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.generated.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAm4DvF,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2vDxF,CAAC"}