@shellui/core 0.7.0 → 0.8.1
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 +3 -1
- package/package.json +2 -2
- package/schemas/shellui.config.schema.json +45 -2
- package/src/app.tsx +2 -0
- package/src/features/auth/AuthProvider.tsx +212 -97
- package/src/features/auth/appBackend/configSchema.spec.ts +1 -0
- package/src/features/auth/appBackend/frameAuth.ts +5 -0
- package/src/features/auth/backends/shellui.spec.ts +110 -0
- package/src/features/auth/backends/shellui.ts +47 -20
- package/src/features/auth/backends/types.ts +5 -0
- package/src/features/auth/hooks/useAuth.tsx +6 -1
- package/src/features/auth/types.ts +5 -0
- package/src/features/auth/utils/bffAuthClient.spec.ts +313 -0
- package/src/features/auth/utils/bffAuthClient.ts +171 -49
- package/src/features/auth/utils/buildSessionFromParams.ts +5 -2
- package/src/features/auth/utils/buildSessionFromTokenPayload.spec.ts +12 -0
- package/src/features/auth/utils/buildSessionFromTokenPayload.ts +3 -1
- package/src/features/auth/utils/canRestoreStoredSession.spec.ts +140 -4
- package/src/features/auth/utils/canRestoreStoredSession.ts +47 -0
- package/src/features/auth/utils/cliCallback.ts +5 -0
- package/src/features/auth/utils/identityBrowserLogout.spec.ts +185 -0
- package/src/features/auth/utils/identityBrowserLogout.ts +174 -0
- package/src/features/auth/utils/index.ts +21 -3
- package/src/features/auth/utils/isBffAuthEnabled.ts +10 -2
- package/src/features/auth/utils/normalizeAuthSettings.spec.ts +9 -0
- package/src/features/auth/utils/normalizeAuthSettings.ts +3 -1
- package/src/features/auth/utils/pkce.spec.ts +29 -1
- package/src/features/auth/utils/pkce.ts +106 -2
- package/src/features/config/types.ts +37 -5
- package/src/features/mcp/mcpActivityErrorCodeI18n.spec.ts +32 -0
- package/src/features/mcp/mcpActivityErrorCodeI18n.ts +30 -0
- package/src/features/mcp/mcpAgentActivityMerge.spec.ts +91 -0
- package/src/features/mcp/mcpAgentActivityMerge.ts +53 -0
- package/src/features/mcp/mcpAgentActivityPresentation.spec.ts +129 -0
- package/src/features/mcp/mcpAgentActivityPresentation.ts +201 -0
- package/src/features/mcp/mcpAgentsConnect.spec.ts +215 -0
- package/src/features/mcp/mcpAgentsConnect.ts +189 -0
- package/src/features/mcp/mcpToolActivityRegistry.spec.ts +9 -0
- package/src/features/mcp/mcpToolActivityRegistry.ts +20 -0
- package/src/features/mcp/mcpToolApprovalsApi.spec.ts +113 -0
- package/src/features/mcp/mcpToolApprovalsApi.ts +162 -0
- package/src/features/mcp/personalAgentsApi.spec.ts +661 -0
- package/src/features/mcp/personalAgentsApi.ts +697 -0
- package/src/features/settings/SettingsIcons.tsx +28 -0
- package/src/features/settings/SettingsRoutes.tsx +8 -0
- package/src/features/settings/SettingsView.tsx +90 -26
- package/src/features/settings/components/McpAgentActivitySection.spec.tsx +255 -0
- package/src/features/settings/components/McpAgentActivitySection.tsx +481 -0
- package/src/features/settings/components/McpAgents.spec.tsx +336 -0
- package/src/features/settings/components/McpAgents.tsx +654 -0
- package/src/features/settings/components/McpPendingApprovals.spec.tsx +201 -0
- package/src/features/settings/components/McpPendingApprovals.tsx +168 -0
- package/src/features/settings/components/McpPersonalStatusPrefetch.tsx +21 -0
- package/src/features/settings/hooks/useMcpPendingToolApprovals.ts +69 -0
- package/src/features/settings/hooks/useMcpPersonalStatus.ts +83 -0
- package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +44 -1
- package/src/features/settings/utils/buildSettingsForPropagation.ts +30 -1
- package/src/features/settings/utils/isMcpAgentsSettingsEligible.spec.ts +25 -0
- package/src/features/settings/utils/isMcpAgentsSettingsEligible.ts +14 -0
- package/src/features/settings/utils/loadMcpPersonalStatus.spec.ts +76 -0
- package/src/features/settings/utils/loadMcpPersonalStatus.ts +84 -0
- package/src/features/settings/utils/mcpPersonalStatusCache.spec.ts +77 -0
- package/src/features/settings/utils/mcpPersonalStatusCache.ts +95 -0
- package/src/features/settings/utils/shouldShowMcpAgentsSettings.spec.ts +66 -0
- package/src/features/settings/utils/shouldShowMcpAgentsSettings.ts +16 -0
- package/src/features/storage/StorageBridge.paths.spec.ts +286 -0
- package/src/features/storage/StorageBridge.tsx +25 -5
- package/src/features/storage/resolveStorageBridgeTarget.spec.ts +51 -0
- package/src/features/storage/resolveStorageBridgeTarget.ts +24 -0
- package/src/i18n/translations/en/settings.json +201 -0
- package/src/i18n/translations/fr/settings.json +201 -0
- package/src/index.ts +1 -0
- package/src/service-worker/sw.ts +4 -2
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { act, createElement } from 'react';
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { shellui, type ShellUIMessage } from '@shellui/sdk';
|
|
6
|
+
import type { ShellUIConfig } from '../config/types';
|
|
7
|
+
import type { ResolvedAppBackend } from '../auth/appBackend/identity';
|
|
8
|
+
import {
|
|
9
|
+
addChildFrame,
|
|
10
|
+
clearChildFrames,
|
|
11
|
+
validateChildFrameRegistration,
|
|
12
|
+
} from '../auth/appBackend/childFrames';
|
|
13
|
+
import { StorageBridge } from './StorageBridge';
|
|
14
|
+
|
|
15
|
+
const REGIONAL_STORAGE = 'https://storage.eu.example.com';
|
|
16
|
+
const SHELL_STORAGE = 'https://storage.shell.example';
|
|
17
|
+
const REGIONAL_TOKEN = 'regional-token';
|
|
18
|
+
const SHELL_TOKEN = 'shell-token';
|
|
19
|
+
|
|
20
|
+
const page = vi.hoisted(() => ({
|
|
21
|
+
includeShellStorage: false,
|
|
22
|
+
accessToken: 'shell-token' as string | null,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const ensure = vi.hoisted(() =>
|
|
26
|
+
vi.fn(
|
|
27
|
+
async (_identity: ResolvedAppBackend, _options?: { allowSilent?: boolean }) =>
|
|
28
|
+
'regional-token' as string | null,
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
vi.mock('../config/useConfig', () => ({
|
|
33
|
+
useConfig: () => ({
|
|
34
|
+
loading: false,
|
|
35
|
+
config: {
|
|
36
|
+
navigation: [
|
|
37
|
+
{
|
|
38
|
+
label: 'Dashboard',
|
|
39
|
+
path: '',
|
|
40
|
+
url: 'https://dashboard.example.com/',
|
|
41
|
+
safeForAuthToken: true,
|
|
42
|
+
childFrames: {
|
|
43
|
+
origins: ['https://admin.example.com'],
|
|
44
|
+
backendOrigins: ['https://id.eu.example.com'],
|
|
45
|
+
serviceOrigins: ['https://storage.eu.example.com', 'https://files.example.com'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: 'Companion',
|
|
50
|
+
path: 'companion',
|
|
51
|
+
url: 'https://companion.example.com/',
|
|
52
|
+
safeForAuthToken: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
...(page.includeShellStorage ? { storage: { url: 'https://storage.shell.example' } } : {}),
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
vi.mock('../auth/hooks/useAuth', () => ({
|
|
61
|
+
useAuth: () => ({
|
|
62
|
+
session: page.accessToken ? { accessToken: page.accessToken } : null,
|
|
63
|
+
}),
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
vi.mock('../auth/appBackend/appBackendSessions', () => ({
|
|
67
|
+
ensureAppBackendSession: (identity: ResolvedAppBackend, options?: { allowSilent?: boolean }) =>
|
|
68
|
+
ensure(identity, options),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
|
|
72
|
+
|
|
73
|
+
type StorageReply = {
|
|
74
|
+
id: string;
|
|
75
|
+
data?: unknown;
|
|
76
|
+
error?: { message: string; status: number };
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
function shellConfig(): ShellUIConfig {
|
|
80
|
+
return {
|
|
81
|
+
navigation: [
|
|
82
|
+
{
|
|
83
|
+
label: 'Dashboard',
|
|
84
|
+
path: '',
|
|
85
|
+
url: 'https://dashboard.example.com/',
|
|
86
|
+
safeForAuthToken: true,
|
|
87
|
+
childFrames: {
|
|
88
|
+
origins: ['https://admin.example.com'],
|
|
89
|
+
backendOrigins: ['https://id.eu.example.com'],
|
|
90
|
+
serviceOrigins: [REGIONAL_STORAGE, 'https://files.example.com'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
...(page.includeShellStorage ? { storage: { url: SHELL_STORAGE } } : {}),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
describe('StorageBridge storage target', () => {
|
|
99
|
+
const frames: string[] = [];
|
|
100
|
+
let root: Root | null = null;
|
|
101
|
+
let container: HTMLDivElement | null = null;
|
|
102
|
+
let listener: ((message: ShellUIMessage, event: MessageEvent) => void) | null = null;
|
|
103
|
+
const sent: ShellUIMessage[] = [];
|
|
104
|
+
const fetchMock = vi.fn();
|
|
105
|
+
|
|
106
|
+
function addFrame(src: string): string {
|
|
107
|
+
const iframe = document.createElement('iframe');
|
|
108
|
+
iframe.src = src;
|
|
109
|
+
const uuid = shellui.frameRegistry.addIframe(iframe);
|
|
110
|
+
frames.push(uuid);
|
|
111
|
+
return uuid;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function registerFiles(hostUuid: string, storage: string) {
|
|
115
|
+
const result = validateChildFrameRegistration({
|
|
116
|
+
from: [hostUuid],
|
|
117
|
+
hostSrc: 'https://dashboard.example.com/',
|
|
118
|
+
payload: {
|
|
119
|
+
frameId: 'files-1',
|
|
120
|
+
url: 'https://admin.example.com/',
|
|
121
|
+
backend: {
|
|
122
|
+
url: 'https://id.eu.example.com',
|
|
123
|
+
companyId: 'r1',
|
|
124
|
+
provider: 'upstream',
|
|
125
|
+
},
|
|
126
|
+
services: {
|
|
127
|
+
storage,
|
|
128
|
+
files: 'https://files.example.com',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
config: shellConfig(),
|
|
132
|
+
});
|
|
133
|
+
if (!result.ok) throw new Error(result.reason);
|
|
134
|
+
addChildFrame(result.entry);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function mount() {
|
|
138
|
+
container = document.createElement('div');
|
|
139
|
+
document.body.appendChild(container);
|
|
140
|
+
root = createRoot(container);
|
|
141
|
+
act(() => {
|
|
142
|
+
root?.render(createElement(StorageBridge));
|
|
143
|
+
});
|
|
144
|
+
if (!listener) throw new Error('StorageBridge did not listen for storage requests');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function request(from: string[], id: string): Promise<StorageReply> {
|
|
148
|
+
listener?.(
|
|
149
|
+
{
|
|
150
|
+
type: 'SHELLUI_STORAGE_REQUEST',
|
|
151
|
+
payload: { id, op: 'listBuckets' },
|
|
152
|
+
from,
|
|
153
|
+
},
|
|
154
|
+
new MessageEvent('message'),
|
|
155
|
+
);
|
|
156
|
+
let reply: StorageReply | undefined;
|
|
157
|
+
await vi.waitFor(() => {
|
|
158
|
+
reply = sent.find((message) => (message.payload as StorageReply | undefined)?.id === id)
|
|
159
|
+
?.payload as StorageReply | undefined;
|
|
160
|
+
expect(reply).toBeTruthy();
|
|
161
|
+
});
|
|
162
|
+
if (!reply) throw new Error(`no storage reply for ${id}`);
|
|
163
|
+
return reply;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function expectStorageCall(url: string, token: string) {
|
|
167
|
+
const match = fetchMock.mock.calls.find((call) => call[0] === `${url}/storage/v1/bucket`);
|
|
168
|
+
expect(match).toBeTruthy();
|
|
169
|
+
const init = (match?.[1] ?? {}) as RequestInit;
|
|
170
|
+
expect(new Headers(init.headers).get('Authorization')).toBe(`Bearer ${token}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
beforeEach(() => {
|
|
174
|
+
page.includeShellStorage = false;
|
|
175
|
+
page.accessToken = SHELL_TOKEN;
|
|
176
|
+
ensure.mockReset();
|
|
177
|
+
ensure.mockResolvedValue(REGIONAL_TOKEN);
|
|
178
|
+
listener = null;
|
|
179
|
+
sent.length = 0;
|
|
180
|
+
fetchMock.mockReset();
|
|
181
|
+
fetchMock.mockResolvedValue({
|
|
182
|
+
ok: true,
|
|
183
|
+
status: 200,
|
|
184
|
+
headers: new Headers({ 'Content-Type': 'application/json' }),
|
|
185
|
+
json: async () => [{ name: 'company' }],
|
|
186
|
+
});
|
|
187
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
188
|
+
const add = shellui.addMessageListener.bind(shellui);
|
|
189
|
+
vi.spyOn(shellui, 'addMessageListener').mockImplementation((type, cb) => {
|
|
190
|
+
if (type === 'SHELLUI_STORAGE_REQUEST') listener = cb;
|
|
191
|
+
return add(type, cb);
|
|
192
|
+
});
|
|
193
|
+
vi.spyOn(shellui, 'sendMessage').mockImplementation((message) => {
|
|
194
|
+
sent.push(message);
|
|
195
|
+
return 1;
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
afterEach(() => {
|
|
200
|
+
if (root) {
|
|
201
|
+
act(() => root?.unmount());
|
|
202
|
+
}
|
|
203
|
+
container?.remove();
|
|
204
|
+
root = null;
|
|
205
|
+
container = null;
|
|
206
|
+
for (const uuid of frames) shellui.frameRegistry.removeIframe(uuid);
|
|
207
|
+
frames.length = 0;
|
|
208
|
+
clearChildFrames();
|
|
209
|
+
vi.restoreAllMocks();
|
|
210
|
+
vi.unstubAllGlobals();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('uses the storage URL and regional session registered for a nested admin frame', async () => {
|
|
214
|
+
mount();
|
|
215
|
+
const host = addFrame('https://dashboard.example.com/');
|
|
216
|
+
registerFiles(host, REGIONAL_STORAGE);
|
|
217
|
+
|
|
218
|
+
const reply = await request([host, 'files-1'], 'nested-1');
|
|
219
|
+
|
|
220
|
+
expect(reply).toEqual({ id: 'nested-1', data: [{ name: 'company' }] });
|
|
221
|
+
expectStorageCall(REGIONAL_STORAGE, REGIONAL_TOKEN);
|
|
222
|
+
expect(fetchMock.mock.calls.some((call) => String(call[0]).includes(SHELL_STORAGE))).toBe(
|
|
223
|
+
false,
|
|
224
|
+
);
|
|
225
|
+
expect(ensure).toHaveBeenCalledWith(
|
|
226
|
+
expect.objectContaining({ url: 'https://id.eu.example.com', companyId: 'r1' }),
|
|
227
|
+
{ allowSilent: true },
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('keeps shellui.config storage for a frame the shell hosts directly', async () => {
|
|
232
|
+
page.includeShellStorage = true;
|
|
233
|
+
mount();
|
|
234
|
+
const companion = addFrame('https://companion.example.com/files');
|
|
235
|
+
|
|
236
|
+
const reply = await request([companion], 'direct-1');
|
|
237
|
+
|
|
238
|
+
expect(reply).toEqual({ id: 'direct-1', data: [{ name: 'company' }] });
|
|
239
|
+
expectStorageCall(SHELL_STORAGE, SHELL_TOKEN);
|
|
240
|
+
expect(ensure).not.toHaveBeenCalled();
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('does not use the shell storage URL when the nested frame has no allowed storage URL', async () => {
|
|
244
|
+
page.includeShellStorage = true;
|
|
245
|
+
mount();
|
|
246
|
+
const host = addFrame('https://dashboard.example.com/');
|
|
247
|
+
registerFiles(host, 'https://evil.example.org');
|
|
248
|
+
|
|
249
|
+
const reply = await request([host, 'files-1'], 'rejected-1');
|
|
250
|
+
|
|
251
|
+
expect(reply).toEqual({
|
|
252
|
+
id: 'rejected-1',
|
|
253
|
+
error: { message: 'Storage is not configured', status: 503 },
|
|
254
|
+
});
|
|
255
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('rejects a storage request from a frame the shell did not register', async () => {
|
|
259
|
+
page.includeShellStorage = true;
|
|
260
|
+
mount();
|
|
261
|
+
|
|
262
|
+
const reply = await request(['not-a-frame'], 'untrusted-1');
|
|
263
|
+
|
|
264
|
+
expect(reply.error).toEqual({
|
|
265
|
+
message: 'Storage request rejected: untrusted frame',
|
|
266
|
+
status: 403,
|
|
267
|
+
});
|
|
268
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
269
|
+
expect(ensure).not.toHaveBeenCalled();
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it('does not apply one registered child storage URL to a different frame id', async () => {
|
|
273
|
+
mount();
|
|
274
|
+
const host = addFrame('https://dashboard.example.com/');
|
|
275
|
+
registerFiles(host, REGIONAL_STORAGE);
|
|
276
|
+
|
|
277
|
+
const reply = await request([host, 'other-files'], 'other-1');
|
|
278
|
+
|
|
279
|
+
expect(reply).toEqual({
|
|
280
|
+
id: 'other-1',
|
|
281
|
+
error: { message: 'Storage is not configured', status: 503 },
|
|
282
|
+
});
|
|
283
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
284
|
+
expect(ensure).not.toHaveBeenCalled();
|
|
285
|
+
});
|
|
286
|
+
});
|
|
@@ -5,16 +5,21 @@ import {
|
|
|
5
5
|
type ShellUIMessage,
|
|
6
6
|
type StorageRequestPayload,
|
|
7
7
|
} from '@shellui/sdk';
|
|
8
|
+
import { ensureAppBackendSession } from '../auth/appBackend/appBackendSessions';
|
|
9
|
+
import { findChildFrame } from '../auth/appBackend/childFrames';
|
|
8
10
|
import { useAuth } from '../auth/hooks/useAuth';
|
|
9
11
|
import { useConfig } from '../config/useConfig';
|
|
10
12
|
import { getStorageRequestTrustDenial } from '../security/trustedFrames';
|
|
11
13
|
import { handleStorageRequest } from './handleRequest';
|
|
12
14
|
import { getStorageBaseUrl } from './quota';
|
|
15
|
+
import { resolveStorageBridgeTarget } from './resolveStorageBridgeTarget';
|
|
13
16
|
import { handleTrackedUpload, isUploadPayload } from './uploads/handleTrackedUpload';
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
|
-
* Root-window bridge: iframe `SHELLUI_STORAGE_REQUEST` messages are handled here
|
|
17
|
-
*
|
|
19
|
+
* Root-window bridge: iframe `SHELLUI_STORAGE_REQUEST` messages are handled here.
|
|
20
|
+
* A nested app (dashboard admin, then Files) uses the storage URL and regional
|
|
21
|
+
* session registered for that frame. A frame the shell hosts directly uses
|
|
22
|
+
* `storage.url` from shellui.config and the shell session.
|
|
18
23
|
*/
|
|
19
24
|
export const StorageBridge = () => {
|
|
20
25
|
const { config } = useConfig();
|
|
@@ -47,9 +52,24 @@ export const StorageBridge = () => {
|
|
|
47
52
|
return;
|
|
48
53
|
}
|
|
49
54
|
|
|
50
|
-
const run =
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const run = (async () => {
|
|
56
|
+
const child = findChildFrame(message.from ?? []);
|
|
57
|
+
const nested = child
|
|
58
|
+
? {
|
|
59
|
+
storageUrl: child.services.storage,
|
|
60
|
+
accessToken: child.identity
|
|
61
|
+
? await ensureAppBackendSession(child.identity, { allowSilent: true })
|
|
62
|
+
: null,
|
|
63
|
+
}
|
|
64
|
+
: null;
|
|
65
|
+
const target = resolveStorageBridgeTarget(nested, { storageUrl, accessToken });
|
|
66
|
+
const input = {
|
|
67
|
+
storageUrl: target.storageUrl,
|
|
68
|
+
accessToken: target.accessToken,
|
|
69
|
+
payload,
|
|
70
|
+
};
|
|
71
|
+
return isUploadPayload(payload) ? handleTrackedUpload(input) : handleStorageRequest(input);
|
|
72
|
+
})();
|
|
53
73
|
|
|
54
74
|
void run.then((response) => {
|
|
55
75
|
const reply = {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { resolveStorageBridgeTarget } from './resolveStorageBridgeTarget';
|
|
3
|
+
|
|
4
|
+
const shell = {
|
|
5
|
+
storageUrl: null as string | null,
|
|
6
|
+
accessToken: 'global-token',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
describe('resolveStorageBridgeTarget', () => {
|
|
10
|
+
it('uses the nested frame storage URL and regional token', () => {
|
|
11
|
+
expect(
|
|
12
|
+
resolveStorageBridgeTarget(
|
|
13
|
+
{
|
|
14
|
+
storageUrl: 'https://storage.eu.shellui.com',
|
|
15
|
+
accessToken: 'regional-token',
|
|
16
|
+
},
|
|
17
|
+
shell,
|
|
18
|
+
),
|
|
19
|
+
).toEqual({
|
|
20
|
+
storageUrl: 'https://storage.eu.shellui.com',
|
|
21
|
+
accessToken: 'regional-token',
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('does not fall back to the shell when the nested frame has no storage URL', () => {
|
|
26
|
+
expect(
|
|
27
|
+
resolveStorageBridgeTarget(
|
|
28
|
+
{ storageUrl: null, accessToken: 'regional-token' },
|
|
29
|
+
{
|
|
30
|
+
storageUrl: 'https://storage.shell.example',
|
|
31
|
+
accessToken: 'shell-token',
|
|
32
|
+
},
|
|
33
|
+
),
|
|
34
|
+
).toEqual({
|
|
35
|
+
storageUrl: null,
|
|
36
|
+
accessToken: 'regional-token',
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('keeps the shell storage URL for a frame the shell hosts directly', () => {
|
|
41
|
+
expect(
|
|
42
|
+
resolveStorageBridgeTarget(null, {
|
|
43
|
+
storageUrl: 'https://storage.example',
|
|
44
|
+
accessToken: 'shell-token',
|
|
45
|
+
}),
|
|
46
|
+
).toEqual({
|
|
47
|
+
storageUrl: 'https://storage.example',
|
|
48
|
+
accessToken: 'shell-token',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type StorageBridgeTarget = {
|
|
2
|
+
storageUrl: string | null;
|
|
3
|
+
accessToken: string | null;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Pick the storage URL and token for one `SHELLUI_STORAGE_REQUEST`.
|
|
8
|
+
*
|
|
9
|
+
* A nested frame (the dashboard hosting regional admin, which hosts Files)
|
|
10
|
+
* carries its own storage URL and regional session. Use those, even when the
|
|
11
|
+
* URL is missing: falling back to the shell's storage would call another
|
|
12
|
+
* region. Frames the shell hosts directly keep `storage.url` from
|
|
13
|
+
* shellui.config and the shell session.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveStorageBridgeTarget(
|
|
16
|
+
nested: StorageBridgeTarget | null,
|
|
17
|
+
shell: StorageBridgeTarget,
|
|
18
|
+
): StorageBridgeTarget {
|
|
19
|
+
if (!nested) return shell;
|
|
20
|
+
return {
|
|
21
|
+
storageUrl: nested.storageUrl,
|
|
22
|
+
accessToken: nested.accessToken,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"legalDocuments": "Legal documents",
|
|
18
18
|
"storage": "Storage",
|
|
19
19
|
"ai": "AI",
|
|
20
|
+
"mcpAgents": "MCP / AI agents",
|
|
20
21
|
"develop": "Develop",
|
|
21
22
|
"serviceWorker": "Service Worker"
|
|
22
23
|
},
|
|
@@ -274,6 +275,206 @@
|
|
|
274
275
|
},
|
|
275
276
|
"footnote": "Large models use disk space and can heat the GPU on first load. Treat prompts from apps as untrusted content."
|
|
276
277
|
},
|
|
278
|
+
"mcpAgents": {
|
|
279
|
+
"description": "Connect an AI agent to this company over MCP. The agent signs in with OAuth. Revoke a connection when you stop using that agent.",
|
|
280
|
+
"global": {
|
|
281
|
+
"title": "Connect to Shellui (global MCP)",
|
|
282
|
+
"intro": "You can use two MCP entry points: one on the Shellui dashboard for your account (projects, companies, regions, and plans) and one from this page for this company (regional services and app APIs). They use different URLs and tokens.",
|
|
283
|
+
"scopeAccount": "Global MCP on the Shellui dashboard: OAuth account scope on SaaS. It covers account metadata. It does not read your hosted app data.",
|
|
284
|
+
"scopeRegional": "This page: MCP for this company (regional identity services). Tokens are short-lived and tied to this company.",
|
|
285
|
+
"sessions": "On this page, regional MCP with ask access: identity can grant non-destructive calls for about 60 seconds on this connection without a prompt on each call. That timer is the session grant on this connection, not the token lifetime or how long the connection stays valid. First-company setup can extend non-destructive grants to about 600 to 900 seconds until the server setup step expires. After each window ends, you approve again or refresh the grant. Destructive calls always need approval. Full access does not skip approval for destructive tools.",
|
|
286
|
+
"approvals": "Global MCP uses SaaS approval and fallback endpoints. This page lists regional tool approvals for this company only. It does not list global dashboard approvals.",
|
|
287
|
+
"prerequisite": "You need a Shellui account with accepted Terms of Service before you create a connection.",
|
|
288
|
+
"globalMcpUrlLabel": "Global MCP endpoint (reference only):",
|
|
289
|
+
"globalMcpUrlUnknown": "Identity has not returned the global MCP endpoint yet. It must be the full https or http (local) URL your host publishes, ending with /mcp. Reload after identity is updated.",
|
|
290
|
+
"statusReady": "Your OAuth session includes SaaS (account scope). When the global endpoint appears above, use it for account-wide MCP. Connections you create below stay regional for this company only. They are not interchangeable and this page does not configure the dashboard client.",
|
|
291
|
+
"statusPending": "Your session is regional only. Sign in with a Shellui account that has SaaS if you need global MCP when the endpoint appears above."
|
|
292
|
+
},
|
|
293
|
+
"signInRequired": "Sign in to manage MCP agents.",
|
|
294
|
+
"status": {
|
|
295
|
+
"loading": "Checking MCP status…",
|
|
296
|
+
"error": "Unable to load MCP status.",
|
|
297
|
+
"unavailable": "MCP is not enabled for this company.",
|
|
298
|
+
"retry": "Try again"
|
|
299
|
+
},
|
|
300
|
+
"clipboard": {
|
|
301
|
+
"copyFailedTitle": "Copy failed",
|
|
302
|
+
"unavailable": "Clipboard API is not available in this environment.",
|
|
303
|
+
"copiedTitle": "Copied",
|
|
304
|
+
"copiedDescription": "{{label}} copied to clipboard.",
|
|
305
|
+
"failed": "Unable to copy to the clipboard."
|
|
306
|
+
},
|
|
307
|
+
"connections": {
|
|
308
|
+
"title": "Active connections",
|
|
309
|
+
"empty": "No active connections.",
|
|
310
|
+
"connectedMeta": "{{name}} · Connected {{date}}",
|
|
311
|
+
"connectedMetaWithExpiry": "{{name}} · Connected {{date}} · Expires {{expiry}}",
|
|
312
|
+
"revokedMeta": "{{name}} · Revoked {{date}}",
|
|
313
|
+
"scopeRegional": "All regional services",
|
|
314
|
+
"scopeRegionalSaas": "All regional services + saas",
|
|
315
|
+
"kindOauth": "Signed in with OAuth",
|
|
316
|
+
"kindPersonal": "Static secret",
|
|
317
|
+
"services": "Services: {{services}}",
|
|
318
|
+
"showRevoked": "Show revoked",
|
|
319
|
+
"hideRevoked": "Hide revoked",
|
|
320
|
+
"loading": "Loading connections…",
|
|
321
|
+
"error": "Unable to load connections.",
|
|
322
|
+
"retry": "Try again"
|
|
323
|
+
},
|
|
324
|
+
"connect": {
|
|
325
|
+
"title": "Connect an agent",
|
|
326
|
+
"intro": "Your agent adds this URL as a remote MCP server and signs in with OAuth.",
|
|
327
|
+
"urlLabel": "Company MCP URL",
|
|
328
|
+
"copyUrl": "Copy URL",
|
|
329
|
+
"promptLabel": "Prompt",
|
|
330
|
+
"copyPrompt": "Copy prompt",
|
|
331
|
+
"stepsLead": "What you do:",
|
|
332
|
+
"steps": {
|
|
333
|
+
"paste": "Paste the prompt into your agent.",
|
|
334
|
+
"openLink": "Open the link it shows.",
|
|
335
|
+
"allow": "Check the code and choose Allow."
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"staticSecret": {
|
|
339
|
+
"summary": "Clients that only accept a static secret",
|
|
340
|
+
"helper": "Use this when the client accepts a static secret and cannot sign in with OAuth.",
|
|
341
|
+
"once": "Shellui shows the secret once. The prompt above does not include it."
|
|
342
|
+
},
|
|
343
|
+
"success": {
|
|
344
|
+
"title": "Static secret created",
|
|
345
|
+
"warning": "Copy this secret now. Shellui shows it only once. The prompt above does not include it.",
|
|
346
|
+
"copySecret": "Copy secret",
|
|
347
|
+
"hide": "Hide secret"
|
|
348
|
+
},
|
|
349
|
+
"revoke": {
|
|
350
|
+
"action": "Revoke",
|
|
351
|
+
"title": "Revoke this connection?",
|
|
352
|
+
"description": "The agent stops working with this company until you connect it again.",
|
|
353
|
+
"confirm": "Revoke",
|
|
354
|
+
"cancel": "Cancel",
|
|
355
|
+
"successTitle": "Connection revoked",
|
|
356
|
+
"successDescription": "{{name}} no longer has access.",
|
|
357
|
+
"errorTitle": "Could not revoke the connection"
|
|
358
|
+
},
|
|
359
|
+
"activity": {
|
|
360
|
+
"title": "Recent activity",
|
|
361
|
+
"show": "Show activity",
|
|
362
|
+
"hide": "Hide activity",
|
|
363
|
+
"loading": "Loading activity…",
|
|
364
|
+
"error": "Unable to load activity.",
|
|
365
|
+
"retry": "Try again",
|
|
366
|
+
"empty": "No activity recorded for this connection yet.",
|
|
367
|
+
"callLogsUnavailable": "Tool calls could not be loaded.",
|
|
368
|
+
"callLogsPageUnavailable": "More tool calls could not be loaded.",
|
|
369
|
+
"consentUnavailable": "OAuth consent events could not be loaded.",
|
|
370
|
+
"loadMore": "Load more",
|
|
371
|
+
"loadingMore": "Loading more…",
|
|
372
|
+
"consentOauth": "OAuth consent approved",
|
|
373
|
+
"consentDevice": "Device login approved",
|
|
374
|
+
"destructiveBadge": "Can change data",
|
|
375
|
+
"outcome": {
|
|
376
|
+
"allowed": "Allowed",
|
|
377
|
+
"denied": "Denied",
|
|
378
|
+
"failed": "Failed",
|
|
379
|
+
"pendingApproval": "Pending approval",
|
|
380
|
+
"sessionUsed": "Session used",
|
|
381
|
+
"unknown": "Result not classified"
|
|
382
|
+
},
|
|
383
|
+
"access": {
|
|
384
|
+
"read": "Read",
|
|
385
|
+
"write": "Write",
|
|
386
|
+
"destructive": "Destructive",
|
|
387
|
+
"unknown": "Access not classified"
|
|
388
|
+
},
|
|
389
|
+
"toolUnknown": "Unknown tool",
|
|
390
|
+
"operationSuffix": "Operation",
|
|
391
|
+
"detail": {
|
|
392
|
+
"when": "When",
|
|
393
|
+
"duration": "Duration",
|
|
394
|
+
"notProvided": "Not reported",
|
|
395
|
+
"actor": "Actor",
|
|
396
|
+
"actorUnknown": "Not reported",
|
|
397
|
+
"agent": "Connection",
|
|
398
|
+
"result": "Classified outcome",
|
|
399
|
+
"resultUnknown": "The service sent an outcome code this screen does not map. Use the badges and summary when they apply.",
|
|
400
|
+
"error": "Error code",
|
|
401
|
+
"errorMessage": "Error message",
|
|
402
|
+
"errorUnavailable": "No error code for this row.",
|
|
403
|
+
"viaWrapper": "via {{wrapper}}",
|
|
404
|
+
"approvalOutcome": "Approval",
|
|
405
|
+
"approvalOutcomeValue": {
|
|
406
|
+
"pending": "Pending",
|
|
407
|
+
"denied": "Denied",
|
|
408
|
+
"accepted": "Accepted",
|
|
409
|
+
"sessionUsed": "Session used",
|
|
410
|
+
"expired": "Expired",
|
|
411
|
+
"failed": "Failed"
|
|
412
|
+
},
|
|
413
|
+
"errorCode": {
|
|
414
|
+
"badRequest": "Bad request",
|
|
415
|
+
"unauthorized": "Not authorized",
|
|
416
|
+
"forbidden": "Forbidden",
|
|
417
|
+
"notFound": "Not found",
|
|
418
|
+
"conflict": "Conflict",
|
|
419
|
+
"rateLimited": "Rate limited",
|
|
420
|
+
"denied": "Denied",
|
|
421
|
+
"expired": "Expired",
|
|
422
|
+
"timeout": "Timed out",
|
|
423
|
+
"upstreamError": "Upstream error",
|
|
424
|
+
"internalError": "Internal error",
|
|
425
|
+
"outOfSync": "Out of sync with the server. Refresh the page or update the grant when permissions change.",
|
|
426
|
+
"identityUnreachable": "Identity unreachable",
|
|
427
|
+
"identityUnavailable": "Identity is unavailable. Try again when it responds.",
|
|
428
|
+
"identityInvalid": "Identity rejected the request",
|
|
429
|
+
"invalidGrant": "Invalid grant",
|
|
430
|
+
"permissionChanged": "Permission changed",
|
|
431
|
+
"requestExpired": "Request expired",
|
|
432
|
+
"agentRevoked": "Connection revoked. Create a new connection to use this agent again.",
|
|
433
|
+
"downstreamError": "Downstream error",
|
|
434
|
+
"serverError": "Server error",
|
|
435
|
+
"unknown": "Unknown error"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"link": {
|
|
439
|
+
"openApprovalById": "Jump to pending approvals",
|
|
440
|
+
"openApprovalsSection": "Jump to pending approvals (same tool name)"
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
"pendingApprovals": {
|
|
444
|
+
"title": "Pending approvals",
|
|
445
|
+
"meta": "{{agentName}} · Expires in {{expiresInMinutes}} min",
|
|
446
|
+
"destructiveBadge": "Can change data",
|
|
447
|
+
"approve": "Approve",
|
|
448
|
+
"deny": "Deny",
|
|
449
|
+
"confirmApprove": {
|
|
450
|
+
"title": "Approve {{toolName}}?",
|
|
451
|
+
"description": "This can change data in {{companyName}}.",
|
|
452
|
+
"confirm": "Approve",
|
|
453
|
+
"cancel": "Cancel"
|
|
454
|
+
},
|
|
455
|
+
"toast": {
|
|
456
|
+
"approvedTitle": "Tool approved",
|
|
457
|
+
"deniedTitle": "Tool denied",
|
|
458
|
+
"description": "{{toolName}}",
|
|
459
|
+
"errorTitle": "Could not update the approval"
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
"create": {
|
|
463
|
+
"title": "Create a static secret",
|
|
464
|
+
"nameLabel": "Name",
|
|
465
|
+
"namePlaceholder": "ChatGPT on my laptop",
|
|
466
|
+
"nameHelper": "Shown in this list.",
|
|
467
|
+
"accessHelperGlobal": "This token can call every regional service for this company, and saas.",
|
|
468
|
+
"accessHelperRegional": "This token can call every regional service for this company. Saas is not included; connect from the global dashboard when you need saas.",
|
|
469
|
+
"expiryHelper": "This connection expires in {{days}} days.",
|
|
470
|
+
"submit": "Create secret",
|
|
471
|
+
"submitting": "Creating…",
|
|
472
|
+
"cancel": "Cancel",
|
|
473
|
+
"errorGeneric": "Could not create the connection.",
|
|
474
|
+
"errorExpiryTooLong": "Identity rejected this expiry. It is longer than the maximum lifetime for this connection.",
|
|
475
|
+
"errorMissingMcpUrl": "MCP URL is not configured. Set aiService.url in your Shellui config."
|
|
476
|
+
}
|
|
477
|
+
},
|
|
277
478
|
"dataPrivacy": {
|
|
278
479
|
"title": "Data Privacy",
|
|
279
480
|
"description": "Manage your data privacy settings and cookie preferences.",
|