@myrialabs/clopen 0.4.46 → 0.4.48
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/README.md +11 -11
- package/backend/artifacts/project/sources.ts +1 -1
- package/backend/auth/auth-service.ts +52 -358
- package/backend/auth/onboarding.test.ts +2 -3
- package/backend/auth/permissions.test.ts +10 -20
- package/backend/auth/permissions.ts +4 -290
- package/backend/auth/rate-limiter.test.ts +8 -9
- package/backend/auth/rate-limiter.ts +0 -2
- package/backend/auth/tokens.ts +1 -8
- package/backend/bootstrap.ts +7 -0
- package/backend/chat/attachments.test.ts +88 -0
- package/backend/chat/attachments.ts +159 -0
- package/backend/chat/engine-handoff.test.ts +0 -2
- package/backend/chat/stream-manager.ts +62 -62
- package/backend/chat/turn-answer.test.ts +64 -0
- package/backend/chat/turn-answer.ts +125 -0
- package/backend/chat-apps/awaiting.test.ts +39 -0
- package/backend/chat-apps/awaiting.ts +49 -0
- package/backend/chat-apps/conversation.ts +746 -0
- package/backend/chat-apps/inbound.ts +324 -0
- package/backend/chat-apps/index.ts +309 -0
- package/backend/chat-apps/link-events.ts +20 -0
- package/backend/chat-apps/media.test.ts +62 -0
- package/backend/chat-apps/media.ts +208 -0
- package/backend/chat-apps/messages.test.ts +229 -0
- package/backend/chat-apps/messages.ts +365 -0
- package/backend/chat-apps/outbound.ts +243 -0
- package/backend/chat-apps/pairing.test.ts +45 -0
- package/backend/chat-apps/pairing.ts +74 -0
- package/backend/chat-apps/platforms/index.ts +20 -0
- package/backend/chat-apps/platforms/telegram.test.ts +35 -0
- package/backend/chat-apps/platforms/telegram.ts +191 -0
- package/backend/chat-apps/platforms/types.ts +114 -0
- package/backend/chat-apps/questions.ts +133 -0
- package/backend/chat-apps/runtime.ts +572 -0
- package/backend/chat-apps/storage.test.ts +201 -0
- package/backend/chat-apps/turns.test.ts +45 -0
- package/backend/chat-apps/turns.ts +208 -0
- package/backend/containers/pty.ts +3 -11
- package/backend/control/actions/accounts.ts +89 -0
- package/backend/control/actions/files.ts +116 -0
- package/backend/control/actions/models.ts +188 -0
- package/backend/control/actions/projects.ts +272 -0
- package/backend/control/actions/sessions.ts +280 -0
- package/backend/control/actions/skills.ts +111 -0
- package/backend/control/control.test.ts +169 -0
- package/backend/control/define.ts +20 -0
- package/backend/control/folders.test.ts +67 -0
- package/backend/control/index.ts +213 -0
- package/backend/control/invoke.ts +44 -0
- package/backend/control/links.ts +35 -0
- package/backend/control/paging.ts +26 -0
- package/backend/control/types.ts +117 -0
- package/backend/control/workspace.ts +127 -0
- package/backend/database/migrations/084_create_channel_links.ts +71 -0
- package/backend/database/migrations/085_add_home_projects.ts +36 -0
- package/backend/database/migrations/086_single_owner.test.ts +170 -0
- package/backend/database/migrations/086_single_owner.ts +418 -0
- package/backend/database/migrations/index.ts +21 -0
- package/backend/database/queries/auth-queries.ts +7 -85
- package/backend/database/queries/channel-queries.ts +270 -0
- package/backend/database/queries/db-client-connection-queries.ts +18 -56
- package/backend/database/queries/file-share-queries.ts +5 -23
- package/backend/database/queries/git-identity-queries.ts +31 -42
- package/backend/database/queries/graph-queries.ts +1 -1
- package/backend/database/queries/index.ts +13 -1
- package/backend/database/queries/message-queries.test.ts +146 -0
- package/backend/database/queries/message-queries.ts +42 -1
- package/backend/database/queries/permission-set-queries.ts +1 -1
- package/backend/database/queries/profile-queries.ts +1 -1
- package/backend/database/queries/project-mcp-trust-queries.ts +1 -1
- package/backend/database/queries/project-queries.ts +50 -63
- package/backend/database/queries/session-queries.ts +28 -56
- package/backend/database/queries/ssh-connection-queries.ts +18 -41
- package/backend/db-client/integrations/projector.ts +0 -5
- package/backend/engine/adapters/claude/message-converter.test.ts +47 -0
- package/backend/engine/adapters/claude/message-converter.ts +25 -2
- package/backend/engine/adapters/cline/message-converter.ts +0 -1
- package/backend/engine/adapters/cline/stream.ts +11 -15
- package/backend/engine/adapters/codex/message-converter.ts +0 -2
- package/backend/engine/adapters/copilot/message-converter.ts +1 -2
- package/backend/engine/adapters/cursor/message-converter.ts +0 -1
- package/backend/engine/adapters/opencode/message-converter.ts +2 -4
- package/backend/engine/adapters/opencode/presets.ts +27 -2
- package/backend/engine/adapters/opencode/server.ts +6 -4
- package/backend/engine/adapters/opencode/stream.ts +11 -0
- package/backend/engine/adapters/parent-scope.test.ts +38 -0
- package/backend/engine/adapters/parent-scope.ts +44 -0
- package/backend/engine/adapters/pi/message-converter.ts +0 -1
- package/backend/engine/adapters/pi/stream.ts +4 -5
- package/backend/engine/adapters/qwen/message-converter.ts +0 -2
- package/backend/engine/bootstrap-default-engine.ts +2 -2
- package/backend/engine/docs/adapter-contract.md +8 -1
- package/backend/engine/install-runner.ts +8 -17
- package/backend/files/file-shares.ts +20 -44
- package/backend/files/file-size-limit.ts +3 -3
- package/backend/files/image-processing.ts +1 -1
- package/backend/files/os-clipboard.ts +2 -2
- package/backend/git/git-executor.ts +25 -5
- package/backend/git/git-service.ts +420 -19
- package/backend/git/identity/credential-helper.test.ts +2 -7
- package/backend/git/identity/import-local.test.ts +11 -16
- package/backend/git/identity/import-local.ts +12 -12
- package/backend/git/identity/index.ts +10 -24
- package/backend/git/identity/resolve.ts +13 -14
- package/backend/git/identity/scope-config.ts +33 -28
- package/backend/git/identity/service.ts +44 -47
- package/backend/git/op-lock.test.ts +111 -0
- package/backend/git/op-lock.ts +180 -0
- package/backend/git/remote-sync.test.ts +249 -0
- package/backend/host/metrics.ts +1 -1
- package/backend/http/bearer-auth.ts +1 -2
- package/backend/http/files-download.test.ts +8 -9
- package/backend/http/files-download.ts +2 -2
- package/backend/http/files-shared.test.ts +62 -89
- package/backend/http/files-shared.ts +2 -2
- package/backend/http/files-upload.test.ts +3 -7
- package/backend/http/files-upload.ts +3 -3
- package/backend/http/notes-images.test.ts +15 -38
- package/backend/http/notes-images.ts +6 -8
- package/backend/http/ssh-sftp.ts +5 -10
- package/backend/index.ts +21 -7
- package/backend/integrations/accounts.ts +61 -3
- package/backend/integrations/index.ts +2 -2
- package/backend/integrations/registry/define.ts +15 -0
- package/backend/integrations/registry/index.ts +2 -0
- package/backend/integrations/registry/providers/telegram.ts +54 -0
- package/backend/integrations/registry/types.ts +21 -1
- package/backend/integrations/webhooks/gateway.ts +7 -6
- package/backend/integrations/webhooks/verify.test.ts +30 -0
- package/backend/integrations/webhooks/verify.ts +4 -0
- package/backend/mcp/external/project.ts +1 -1
- package/backend/mcp/internal/remote-server.test.ts +1 -3
- package/backend/mcp/internal/remote-server.ts +4 -4
- package/backend/mcp/internal/servers/browser-automation/actions/dialogs.ts +67 -0
- package/backend/mcp/internal/servers/browser-automation/actions/index.ts +3 -1
- package/backend/mcp/internal/servers/browser-automation/actions/input.ts +5 -5
- package/backend/mcp/internal/servers/browser-automation/actions/tabs.ts +157 -28
- package/backend/mcp/internal/servers/browser-automation/context.ts +1 -0
- package/backend/mcp/internal/servers/browser-automation/description.ts +5 -2
- package/backend/mcp/internal/servers/browser-automation/format.ts +24 -1
- package/backend/mcp/internal/servers/browser-automation/runner.ts +68 -3
- package/backend/memory/redact.ts +1 -1
- package/backend/notes/access.test.ts +28 -29
- package/backend/notes/access.ts +6 -11
- package/backend/permissions/service.ts +1 -1
- package/backend/preview/browser/browser-clipboard.test.ts +46 -0
- package/backend/preview/browser/browser-clipboard.ts +67 -0
- package/backend/preview/browser/browser-dialog-handler.ts +95 -6
- package/backend/preview/browser/browser-host-bridge.ts +9 -0
- package/backend/preview/browser/browser-interaction-handler.ts +316 -86
- package/backend/preview/browser/browser-mcp-control.ts +34 -0
- package/backend/preview/browser/browser-pool.ts +67 -6
- package/backend/preview/browser/browser-preview-service.ts +361 -25
- package/backend/preview/browser/browser-tab-manager.ts +66 -23
- package/backend/preview/browser/browser-video-capture.ts +92 -5
- package/backend/preview/browser/element-locator.ts +190 -17
- package/backend/preview/browser/keyboard-chords.test.ts +68 -0
- package/backend/preview/browser/keyboard-chords.ts +132 -0
- package/backend/preview/browser/paste.ts +81 -0
- package/backend/preview/browser/process-usage.ts +142 -0
- package/backend/preview/browser/profile-lock.ts +209 -0
- package/backend/preview/browser/scripts/host-bridge.ts +59 -0
- package/backend/preview/browser/scripts/video-stream.ts +58 -0
- package/backend/preview/browser/types.ts +40 -2
- package/backend/preview/browser/viewport.test.ts +45 -0
- package/backend/preview/browser/viewport.ts +96 -0
- package/backend/profiles/service.ts +2 -2
- package/backend/project/status-manager.ts +43 -172
- package/backend/projects/home.ts +61 -0
- package/backend/projects/project-cleanup.integration.test.ts +2 -2
- package/backend/projects/project-cleanup.ts +0 -8
- package/backend/skills/service.ts +2 -3
- package/backend/snapshot/helpers.ts +0 -1
- package/backend/snapshot/restore.ts +252 -0
- package/backend/ssh/ptykit.ts +1 -2
- package/backend/terminal/ptykit.ts +5 -8
- package/backend/tunnel/public-origin.ts +31 -20
- package/backend/utils/user-helpers.ts +0 -55
- package/backend/utils/ws.ts +61 -154
- package/backend/worktrees/branching/engine.ts +3 -16
- package/backend/worktrees/branching/index.ts +1 -1
- package/backend/worktrees/branching/projector.ts +1 -1
- package/backend/worktrees/branching/service.ts +13 -25
- package/backend/ws/access.ts +12 -21
- package/backend/ws/artifacts/generate.ts +2 -2
- package/backend/ws/auth/device.ts +16 -71
- package/backend/ws/auth/index.ts +4 -22
- package/backend/ws/auth/login.test.ts +14 -60
- package/backend/ws/auth/login.ts +24 -124
- package/backend/ws/auth/status.ts +0 -1
- package/backend/ws/chat/composer.ts +118 -118
- package/backend/ws/chat/stream.ts +64 -47
- package/backend/ws/chat-apps/index.ts +117 -0
- package/backend/ws/containers/actions.ts +11 -25
- package/backend/ws/containers/index.ts +3 -4
- package/backend/ws/containers/list.ts +10 -36
- package/backend/ws/containers/logs.ts +2 -2
- package/backend/ws/containers/tunnel.ts +1 -2
- package/backend/ws/db-client/access.ts +2 -16
- package/backend/ws/db-client/accounts.ts +5 -15
- package/backend/ws/db-client/connections.ts +17 -25
- package/backend/ws/db-client/context.ts +1 -1
- package/backend/ws/db-client/env.ts +7 -10
- package/backend/ws/db-client/index.ts +2 -2
- package/backend/ws/db-client/io.ts +5 -5
- package/backend/ws/db-client/query-history-retention.test.ts +8 -8
- package/backend/ws/db-client/query.ts +18 -17
- package/backend/ws/db-client/schema.ts +13 -13
- package/backend/ws/db-client/structure.ts +35 -35
- package/backend/ws/db-client/supabase.ts +4 -21
- package/backend/ws/deployments/context.ts +1 -1
- package/backend/ws/deployments/crud.ts +0 -5
- package/backend/ws/engine/access.ts +7 -20
- package/backend/ws/engine/claude/accounts.ts +4 -4
- package/backend/ws/engine/cline/accounts.ts +5 -5
- package/backend/ws/engine/codex/accounts.ts +3 -3
- package/backend/ws/engine/opencode/providers.ts +2 -1
- package/backend/ws/engine/pi/accounts.ts +5 -5
- package/backend/ws/files/clipboard.ts +8 -27
- package/backend/ws/files/image-edit.ts +6 -6
- package/backend/ws/files/index.ts +1 -1
- package/backend/ws/files/path-access.test.ts +32 -131
- package/backend/ws/files/path-access.ts +8 -87
- package/backend/ws/files/read.ts +15 -19
- package/backend/ws/files/reveal.ts +3 -3
- package/backend/ws/files/search.ts +7 -7
- package/backend/ws/files/share.ts +9 -13
- package/backend/ws/files/state.ts +9 -12
- package/backend/ws/files/watch.ts +3 -3
- package/backend/ws/files/write.ts +30 -31
- package/backend/ws/git/branch.ts +80 -59
- package/backend/ws/git/commit.ts +63 -44
- package/backend/ws/git/conflict.ts +16 -18
- package/backend/ws/git/identity-context.ts +8 -17
- package/backend/ws/git/identity.ts +17 -27
- package/backend/ws/git/index.ts +3 -1
- package/backend/ws/git/op-state.ts +139 -0
- package/backend/ws/git/remote.ts +241 -141
- package/backend/ws/git/repo-context.ts +67 -0
- package/backend/ws/git/staging.ts +18 -28
- package/backend/ws/git/status.ts +5 -2
- package/backend/ws/index.ts +5 -1
- package/backend/ws/instructions/crud.ts +1 -1
- package/backend/ws/integrations/crud.ts +1 -3
- package/backend/ws/mcp/crud.ts +3 -5
- package/backend/ws/mcp/tools.ts +1 -1
- package/backend/ws/memory/crud.ts +14 -46
- package/backend/ws/memory/index.ts +2 -2
- package/backend/ws/messages/crud.ts +29 -8
- package/backend/ws/notes/index.ts +33 -39
- package/backend/ws/permissions/crud.ts +3 -4
- package/backend/ws/ports/index.ts +1 -2
- package/backend/ws/ports/kill.ts +5 -10
- package/backend/ws/ports/list.ts +4 -10
- package/backend/ws/preview/access.ts +1 -1
- package/backend/ws/preview/browser/interact.ts +52 -79
- package/backend/ws/preview/browser/native-ui.ts +24 -0
- package/backend/ws/preview/browser/stats.ts +98 -1
- package/backend/ws/preview/browser/tab-info.ts +15 -0
- package/backend/ws/preview/browser/tab.ts +19 -4
- package/backend/ws/preview/index.ts +27 -0
- package/backend/ws/profiles/crud.ts +6 -8
- package/backend/ws/project-artifacts/index.ts +30 -31
- package/backend/ws/projects/crud.ts +33 -35
- package/backend/ws/projects/index.ts +3 -8
- package/backend/ws/projects/info.ts +3 -3
- package/backend/ws/projects/overview.ts +19 -30
- package/backend/ws/projects/status.ts +17 -57
- package/backend/ws/sessions/crud.ts +34 -45
- package/backend/ws/sessions/index.ts +1 -1
- package/backend/ws/settings/crud.ts +1 -1
- package/backend/ws/skills/crud.ts +3 -4
- package/backend/ws/skills/index.ts +1 -1
- package/backend/ws/snapshot/changes.ts +7 -7
- package/backend/ws/snapshot/restore.ts +11 -295
- package/backend/ws/snapshot/timeline.ts +2 -4
- package/backend/ws/ssh/access.ts +6 -21
- package/backend/ws/ssh/connections.ts +21 -31
- package/backend/ws/ssh/forwards.ts +12 -12
- package/backend/ws/ssh/sftp.ts +34 -34
- package/backend/ws/ssh/tunnel.ts +1 -2
- package/backend/ws/stack/install.ts +7 -17
- package/backend/ws/subagents/crud.ts +1 -1
- package/backend/ws/tunnel/share.ts +0 -2
- package/backend/ws/user/crud.ts +1 -59
- package/backend/ws/user/index.ts +1 -1
- package/backend/ws/work/context.ts +1 -1
- package/backend/ws/work/crud.ts +0 -5
- package/backend/ws/workspace/state.ts +10 -13
- package/backend/ws/worktrees/branching.ts +7 -36
- package/backend/ws/worktrees/crud.ts +2 -2
- package/bin/clopen.ts +10 -11
- package/dist/assets/{index-CwuKQelV.js → index-CONlwAXZ.js} +1 -1
- package/dist/assets/{index-BTcR1byF.js → index-DJzwt-hq.js} +1 -1
- package/dist/assets/main-BUiUL3eZ.css +1 -0
- package/dist/assets/main-nBOb9YOA.js +1240 -0
- package/dist/index.html +2 -2
- package/package.json +2 -1
- package/shared/constants/attachments.ts +14 -0
- package/shared/constants/engine-tools.ts +1 -1
- package/shared/constants/preview.test.ts +259 -0
- package/shared/constants/preview.ts +1018 -57
- package/shared/constants/tool-icons.ts +5 -0
- package/shared/types/containers/container.ts +1 -1
- package/shared/types/database/schema.ts +9 -6
- package/shared/types/git-identity.ts +1 -1
- package/shared/types/git.ts +116 -0
- package/shared/types/integrations.ts +7 -0
- package/shared/types/stores/settings.ts +1 -1
- package/shared/types/unified/index.ts +1 -1
- package/shared/types/unified/message.ts +0 -7
- package/shared/types/unified/stream.ts +2 -4
- package/shared/types/unified/tool.ts +15 -1
- package/shared/utils/ask-user-question.test.ts +319 -0
- package/shared/utils/ask-user-question.ts +154 -0
- package/shared/utils/home-project.ts +25 -0
- package/shared/utils/logger.ts +2 -0
- package/shared/utils/ws-server.ts +32 -7
- package/backend/auth/session-invalidation.test.ts +0 -112
- package/backend/auth/session-invalidation.ts +0 -77
- package/backend/project/status-manager.test.ts +0 -32
- package/backend/ws/auth/invites.ts +0 -94
- package/backend/ws/auth/users.ts +0 -112
- package/backend/ws/projects/presence.ts +0 -46
- package/backend/ws/stack/access.ts +0 -31
- package/dist/assets/main-BiDNMWb3.css +0 -1
- package/dist/assets/main-BlhKWz2B.js +0 -1241
package/backend/ws/ports/list.ts
CHANGED
|
@@ -17,23 +17,17 @@ import { portMonitor } from '../../ports/monitor';
|
|
|
17
17
|
import { sshConnectionQueries } from '../../database/queries';
|
|
18
18
|
import { ws } from '../../utils/ws';
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
* machine is watchable by anyone signed in — it is the machine they are
|
|
23
|
-
* already using Clopen on.
|
|
24
|
-
*/
|
|
25
|
-
function requireHostAccess(conn: Parameters<typeof ws.getUserId>[0], hostId: string): void {
|
|
20
|
+
/** The local machine, or a saved SSH host that still exists. */
|
|
21
|
+
function requireHost(hostId: string): void {
|
|
26
22
|
if (hostId === LOCAL_PORT_HOST) return;
|
|
27
|
-
|
|
28
|
-
const isAdmin = ws.getRole(conn) === 'admin';
|
|
29
|
-
sshConnectionQueries.ensureAccess(hostId, userId, isAdmin);
|
|
23
|
+
sshConnectionQueries.require(hostId);
|
|
30
24
|
}
|
|
31
25
|
|
|
32
26
|
const hostSchema = t.Object({ hostId: t.String({ minLength: 1 }) });
|
|
33
27
|
|
|
34
28
|
export const portsListHandler = createRouter()
|
|
35
29
|
.http('ports:watch', { data: hostSchema, response: t.Any() }, async ({ data, conn }) => {
|
|
36
|
-
|
|
30
|
+
requireHost(data.hostId);
|
|
37
31
|
const userId = ws.getUserId(conn);
|
|
38
32
|
|
|
39
33
|
const result = await portMonitor.watch(data.hostId, userId);
|
|
@@ -48,7 +48,7 @@ export function requireBrowserPreviewAccessFor(
|
|
|
48
48
|
// The caller passes a workspace scope key; membership is always decided on
|
|
49
49
|
// the project it belongs to.
|
|
50
50
|
const projectId = scopeProjectId(scopeKey);
|
|
51
|
-
requireProjectAccess(
|
|
51
|
+
requireProjectAccess(projectId); // throws if the caller isn't a member
|
|
52
52
|
const userId = ws.getUserId(conn);
|
|
53
53
|
const previewService = browserPreviewServiceManager.getService(scopeKey);
|
|
54
54
|
return { userId, projectId, previewService };
|
|
@@ -12,6 +12,9 @@ import { debug } from '$shared/utils/logger';
|
|
|
12
12
|
import { sleep } from '$shared/utils/async';
|
|
13
13
|
import { requireBrowserPreviewAccess, requireBrowserTabAccess } from '../access';
|
|
14
14
|
import { resolveFrameTarget } from '$backend/preview/browser/frame-targeting';
|
|
15
|
+
import { isPasteChord, pressChord, selectAll, type Modifier } from '$backend/preview/browser/keyboard-chords';
|
|
16
|
+
import { pasteText } from '$backend/preview/browser/paste';
|
|
17
|
+
import { isDeviceSize } from '$shared/constants/preview';
|
|
15
18
|
|
|
16
19
|
// Throttle cursor detection evaluate calls per session (100ms = ~10/sec is plenty)
|
|
17
20
|
const lastCursorEvalTime = new Map<string, number>();
|
|
@@ -27,6 +30,16 @@ function isNavigationError(error: Error): boolean {
|
|
|
27
30
|
msg.includes('cannot find context');
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
/** The held modifiers of a forwarded key event, in press order. */
|
|
34
|
+
function modifiersOf(action: { ctrlKey?: boolean; metaKey?: boolean; altKey?: boolean; shiftKey?: boolean }): Modifier[] {
|
|
35
|
+
const modifiers: Modifier[] = [];
|
|
36
|
+
if (action.ctrlKey) modifiers.push('Control');
|
|
37
|
+
if (action.metaKey) modifiers.push('Meta');
|
|
38
|
+
if (action.altKey) modifiers.push('Alt');
|
|
39
|
+
if (action.shiftKey) modifiers.push('Shift');
|
|
40
|
+
return modifiers;
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
export const interactPreviewHandler = createRouter()
|
|
31
44
|
// Action: Client requests browser interaction
|
|
32
45
|
.on('preview:browser-interact', {
|
|
@@ -61,7 +74,8 @@ export const interactPreviewHandler = createRouter()
|
|
|
61
74
|
width: t.Optional(t.Number()),
|
|
62
75
|
height: t.Optional(t.Number()),
|
|
63
76
|
deviceSize: t.Optional(t.String()),
|
|
64
|
-
rotation: t.Optional(t.String())
|
|
77
|
+
rotation: t.Optional(t.String()),
|
|
78
|
+
deviceModel: t.Optional(t.String())
|
|
65
79
|
}),
|
|
66
80
|
/**
|
|
67
81
|
* The tab the viewer is looking at.
|
|
@@ -207,10 +221,9 @@ export const interactPreviewHandler = createRouter()
|
|
|
207
221
|
const shouldClear = action.clearFirst === true; // default false for user
|
|
208
222
|
|
|
209
223
|
if (shouldClear) {
|
|
210
|
-
// Select all
|
|
211
|
-
|
|
212
|
-
await session.page
|
|
213
|
-
await session.page.keyboard.up('Control');
|
|
224
|
+
// Select all, then typing overwrites it. Platform-aware: a
|
|
225
|
+
// bare Ctrl+A selects nothing on a macOS host.
|
|
226
|
+
await selectAll(session.page);
|
|
214
227
|
await sleep(50); // Small delay for selection
|
|
215
228
|
}
|
|
216
229
|
|
|
@@ -230,23 +243,16 @@ export const interactPreviewHandler = createRouter()
|
|
|
230
243
|
case 'key':
|
|
231
244
|
if (action.key) {
|
|
232
245
|
try {
|
|
233
|
-
|
|
234
|
-
const modifiers: string[] = [];
|
|
235
|
-
if (action.ctrlKey) modifiers.push('Control');
|
|
236
|
-
if (action.metaKey) modifiers.push('Meta');
|
|
237
|
-
if (action.altKey) modifiers.push('Alt');
|
|
238
|
-
if (action.shiftKey) modifiers.push('Shift');
|
|
246
|
+
const modifiers = modifiersOf(action);
|
|
239
247
|
|
|
240
248
|
if (modifiers.length > 0) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
await session.page.
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
for (const mod of modifiers.reverse()) {
|
|
249
|
-
await session.page.keyboard.up(mod as KeyInput);
|
|
249
|
+
if (isPasteChord(modifiers, action.key)) {
|
|
250
|
+
// Never the headless clipboard: paste what the workspace holds.
|
|
251
|
+
await pasteText(session.page, previewService.getClipboardText());
|
|
252
|
+
} else {
|
|
253
|
+
// Editing shortcuts carry their command where the host
|
|
254
|
+
// would otherwise ignore them (⌘A on macOS).
|
|
255
|
+
await pressChord(session.page, modifiers, action.key);
|
|
250
256
|
}
|
|
251
257
|
} else {
|
|
252
258
|
// No modifiers, just press the key
|
|
@@ -312,39 +318,13 @@ export const interactPreviewHandler = createRouter()
|
|
|
312
318
|
break;
|
|
313
319
|
|
|
314
320
|
case 'paste':
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
//
|
|
321
|
+
// What the user pasted is what their device's clipboard holds,
|
|
322
|
+
// so the workspace clipboard learns it too. The paste itself
|
|
323
|
+
// raises a real `paste` event first — spreadsheets and rich
|
|
324
|
+
// editors only listen for that.
|
|
318
325
|
if (typeof action.text === 'string') {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
const inserted = await frame.evaluate((text: string) => {
|
|
322
|
-
const active = document.activeElement as HTMLElement | null;
|
|
323
|
-
if (!active) return false;
|
|
324
|
-
|
|
325
|
-
const isField = active.tagName === 'INPUT' || active.tagName === 'TEXTAREA';
|
|
326
|
-
if (!isField && !active.isContentEditable) return false;
|
|
327
|
-
|
|
328
|
-
if (isField) {
|
|
329
|
-
const field = active as HTMLInputElement | HTMLTextAreaElement;
|
|
330
|
-
const start = field.selectionStart ?? field.value.length;
|
|
331
|
-
const end = field.selectionEnd ?? field.value.length;
|
|
332
|
-
field.value = field.value.slice(0, start) + text + field.value.slice(end);
|
|
333
|
-
const caret = start + text.length;
|
|
334
|
-
field.setSelectionRange(caret, caret);
|
|
335
|
-
} else {
|
|
336
|
-
document.execCommand('insertText', false, text);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
active.dispatchEvent(new Event('input', { bubbles: true }));
|
|
340
|
-
active.dispatchEvent(new Event('change', { bubbles: true }));
|
|
341
|
-
return true;
|
|
342
|
-
}, action.text);
|
|
343
|
-
if (inserted) break;
|
|
344
|
-
} catch {
|
|
345
|
-
// Frame detached mid-paste; try the next one.
|
|
346
|
-
}
|
|
347
|
-
}
|
|
326
|
+
previewService.setClipboardText(action.text, 'device');
|
|
327
|
+
await pasteText(session.page, action.text);
|
|
348
328
|
}
|
|
349
329
|
break;
|
|
350
330
|
|
|
@@ -450,20 +430,10 @@ export const interactPreviewHandler = createRouter()
|
|
|
450
430
|
|
|
451
431
|
case 'keynav':
|
|
452
432
|
if (action.key) {
|
|
453
|
-
const modifiers
|
|
454
|
-
if (action.ctrlKey) modifiers.push('Control');
|
|
455
|
-
if (action.metaKey) modifiers.push('Meta');
|
|
456
|
-
if (action.altKey) modifiers.push('Alt');
|
|
457
|
-
if (action.shiftKey) modifiers.push('Shift');
|
|
433
|
+
const modifiers = modifiersOf(action);
|
|
458
434
|
|
|
459
435
|
if (modifiers.length > 0) {
|
|
460
|
-
|
|
461
|
-
await session.page.keyboard.down(mod as KeyInput);
|
|
462
|
-
}
|
|
463
|
-
await session.page.keyboard.press(action.key as KeyInput);
|
|
464
|
-
for (const mod of modifiers.reverse()) {
|
|
465
|
-
await session.page.keyboard.up(mod as KeyInput);
|
|
466
|
-
}
|
|
436
|
+
await pressChord(session.page, modifiers, action.key);
|
|
467
437
|
} else {
|
|
468
438
|
await session.page.keyboard.press(action.key as KeyInput);
|
|
469
439
|
}
|
|
@@ -555,7 +525,7 @@ export const interactPreviewHandler = createRouter()
|
|
|
555
525
|
break;
|
|
556
526
|
|
|
557
527
|
case 'viewport-update':
|
|
558
|
-
// Handle viewport change (device/rotation) without reconnection
|
|
528
|
+
// Handle viewport change (device/rotation/exact size) without reconnection
|
|
559
529
|
if (action.width && action.height && action.scale && action.scale > 0 && action.scale <= 1) {
|
|
560
530
|
session.scale = action.scale;
|
|
561
531
|
|
|
@@ -567,22 +537,25 @@ export const interactPreviewHandler = createRouter()
|
|
|
567
537
|
// the tab's metadata — which nothing told them had changed.
|
|
568
538
|
// So a phone switched to Tablet from a laptop went on
|
|
569
539
|
// drawing a laptop frame around a tablet-shaped picture.
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
540
|
+
//
|
|
541
|
+
// The width and height are the tab's exact size now, not a
|
|
542
|
+
// restatement of the device class — a preset or a drag can
|
|
543
|
+
// put any size on any class. The service also rebuilds the
|
|
544
|
+
// capture around it.
|
|
545
|
+
const deviceSize = isDeviceSize(action.deviceSize) ? action.deviceSize : session.deviceSize;
|
|
546
|
+
const rotation =
|
|
547
|
+
action.rotation === 'portrait' || action.rotation === 'landscape'
|
|
548
|
+
? action.rotation
|
|
549
|
+
: session.rotation;
|
|
550
|
+
|
|
551
|
+
const updated = await previewService.setViewport(session.id, {
|
|
552
|
+
deviceSize,
|
|
553
|
+
rotation,
|
|
554
|
+
size: { width: action.width, height: action.height },
|
|
555
|
+
deviceModel: action.deviceModel
|
|
556
|
+
});
|
|
577
557
|
|
|
578
558
|
debug.log('preview', `📱 Viewport updated for tab ${tabId}: ${action.width}x${action.height}`);
|
|
579
|
-
|
|
580
|
-
// The hot-swap recomputes capture geometry from the new
|
|
581
|
-
// viewport and the viewers' own display metrics, which
|
|
582
|
-
// each of them reports separately.
|
|
583
|
-
|
|
584
|
-
// Hot-swap viewport without reconnection
|
|
585
|
-
const updated = await previewService.updateWebCodecsViewport(session.id, action.width, action.height);
|
|
586
559
|
if (!updated) {
|
|
587
560
|
debug.warn('preview', `⚠️ Viewport hot-swap failed`);
|
|
588
561
|
}
|
|
@@ -37,6 +37,22 @@ export const nativeUIPreviewHandler = createRouter()
|
|
|
37
37
|
return { success };
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The device's clipboard, as the viewer just read it.
|
|
42
|
+
*
|
|
43
|
+
* Sent on focus and on every copy or paste the user makes, so a paste in
|
|
44
|
+
* the preview — by the user or by an agent — pastes what the user last
|
|
45
|
+
* copied anywhere, not what the headless browser happens to hold.
|
|
46
|
+
*/
|
|
47
|
+
.on('preview:browser-clipboard-set', {
|
|
48
|
+
data: t.Object({
|
|
49
|
+
text: t.String()
|
|
50
|
+
})
|
|
51
|
+
}, async ({ data, conn }) => {
|
|
52
|
+
const { previewService } = requireBrowserPreviewAccess(conn);
|
|
53
|
+
previewService.setClipboardText(data.text, 'device');
|
|
54
|
+
})
|
|
55
|
+
|
|
40
56
|
// Action: Client responds to a dialog (alert, confirm, prompt)
|
|
41
57
|
.on('preview:browser-dialog-input', {
|
|
42
58
|
data: t.Object({
|
|
@@ -250,6 +266,14 @@ export const nativeUIPreviewHandler = createRouter()
|
|
|
250
266
|
text: t.String()
|
|
251
267
|
}))
|
|
252
268
|
|
|
269
|
+
// The workspace clipboard changed somewhere other than this device.
|
|
270
|
+
.emit('preview:browser-clipboard-sync', t.Object({
|
|
271
|
+
text: t.String(),
|
|
272
|
+
source: t.String(),
|
|
273
|
+
timestamp: t.Number(),
|
|
274
|
+
projectId: t.String()
|
|
275
|
+
}))
|
|
276
|
+
|
|
253
277
|
.emit('preview:browser-open-url-new-tab', t.Object({
|
|
254
278
|
url: t.String()
|
|
255
279
|
}))
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { t } from 'elysia';
|
|
8
|
+
import { cpus, freemem, loadavg, totalmem } from 'os';
|
|
8
9
|
import { createRouter } from '$shared/utils/ws-server';
|
|
9
|
-
import { requireBrowserTabAccess } from '../access';
|
|
10
|
+
import { requireBrowserPreviewAccess, requireBrowserTabAccess } from '../access';
|
|
11
|
+
import { browserPool } from '$backend/preview/browser/browser-pool';
|
|
12
|
+
import { availableMemoryBytes, measureProcessTrees } from '$backend/preview/browser/process-usage';
|
|
10
13
|
|
|
11
14
|
export const statsPreviewHandler = createRouter()
|
|
12
15
|
.http('preview:browser-tab-stats', {
|
|
@@ -42,4 +45,98 @@ export const statsPreviewHandler = createRouter()
|
|
|
42
45
|
stats: stats ?? null,
|
|
43
46
|
timestamp: new Date().toISOString()
|
|
44
47
|
};
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Everything the diagnostics panel shows: what the host has left, what
|
|
52
|
+
* every preview Chrome costs, and what each of this workspace's tabs is
|
|
53
|
+
* doing. Polled only while the panel is open.
|
|
54
|
+
*/
|
|
55
|
+
.http('preview:browser-diagnostics', {
|
|
56
|
+
data: t.Object({}),
|
|
57
|
+
response: t.Object({
|
|
58
|
+
host: t.Object({
|
|
59
|
+
platform: t.String(),
|
|
60
|
+
cpuCount: t.Number(),
|
|
61
|
+
loadAverage: t.Array(t.Number()),
|
|
62
|
+
totalMemBytes: t.Number(),
|
|
63
|
+
availableMemBytes: t.Number()
|
|
64
|
+
}),
|
|
65
|
+
browsers: t.Array(t.Object({
|
|
66
|
+
current: t.Boolean(),
|
|
67
|
+
tabs: t.Number(),
|
|
68
|
+
pid: t.Union([t.Number(), t.Null()]),
|
|
69
|
+
processes: t.Number(),
|
|
70
|
+
rssBytes: t.Number(),
|
|
71
|
+
cpuPercent: t.Union([t.Number(), t.Null()])
|
|
72
|
+
})),
|
|
73
|
+
tabs: t.Array(t.Object({
|
|
74
|
+
id: t.String(),
|
|
75
|
+
title: t.String(),
|
|
76
|
+
url: t.String(),
|
|
77
|
+
state: t.Union([t.Literal('active'), t.Literal('frozen')]),
|
|
78
|
+
watched: t.Boolean(),
|
|
79
|
+
isLoading: t.Boolean(),
|
|
80
|
+
openedBy: t.Union([t.Literal('agent'), t.Literal('user')]),
|
|
81
|
+
agentHeld: t.Boolean(),
|
|
82
|
+
dialog: t.Union([t.Object({ type: t.String(), message: t.String() }), t.Null()]),
|
|
83
|
+
createdAt: t.Number(),
|
|
84
|
+
lastAccessedAt: t.Number(),
|
|
85
|
+
jsHeapUsedBytes: t.Union([t.Number(), t.Null()]),
|
|
86
|
+
domNodes: t.Union([t.Number(), t.Null()]),
|
|
87
|
+
stream: t.Union([
|
|
88
|
+
t.Object({
|
|
89
|
+
videoBytesSent: t.Number(),
|
|
90
|
+
videoFramesEncoded: t.Number(),
|
|
91
|
+
connectionState: t.String()
|
|
92
|
+
}),
|
|
93
|
+
t.Null()
|
|
94
|
+
])
|
|
95
|
+
})),
|
|
96
|
+
clipboard: t.Object({
|
|
97
|
+
length: t.Number(),
|
|
98
|
+
source: t.Union([t.String(), t.Null()]),
|
|
99
|
+
updatedAt: t.Number()
|
|
100
|
+
}),
|
|
101
|
+
timestamp: t.Number()
|
|
102
|
+
})
|
|
103
|
+
}, async ({ conn }) => {
|
|
104
|
+
const { previewService } = requireBrowserPreviewAccess(conn);
|
|
105
|
+
const scope = previewService.getProjectId();
|
|
106
|
+
|
|
107
|
+
const running = browserPool.getRunningBrowsers();
|
|
108
|
+
const usage = measureProcessTrees(running.map((entry) => entry.pid).filter((pid): pid is number => pid !== null));
|
|
109
|
+
|
|
110
|
+
// Other workspaces' Chromes are reported without naming them: the cost is
|
|
111
|
+
// shared by the machine, but which projects they belong to is not this
|
|
112
|
+
// viewer's business.
|
|
113
|
+
const browsers = running
|
|
114
|
+
.map((entry) => {
|
|
115
|
+
const tree = entry.pid !== null ? usage.get(entry.pid) : undefined;
|
|
116
|
+
return {
|
|
117
|
+
current: entry.profileKey === scope,
|
|
118
|
+
tabs: entry.sessions,
|
|
119
|
+
pid: entry.pid,
|
|
120
|
+
processes: tree?.processes ?? 0,
|
|
121
|
+
rssBytes: tree?.rssBytes ?? 0,
|
|
122
|
+
cpuPercent: tree?.cpuPercent ?? null
|
|
123
|
+
};
|
|
124
|
+
})
|
|
125
|
+
.sort((a, b) => Number(b.current) - Number(a.current) || b.rssBytes - a.rssBytes);
|
|
126
|
+
|
|
127
|
+
const { tabs, clipboard } = await previewService.getDiagnostics();
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
host: {
|
|
131
|
+
platform: process.platform,
|
|
132
|
+
cpuCount: cpus().length,
|
|
133
|
+
loadAverage: loadavg(),
|
|
134
|
+
totalMemBytes: totalmem(),
|
|
135
|
+
availableMemBytes: availableMemoryBytes(freemem())
|
|
136
|
+
},
|
|
137
|
+
browsers,
|
|
138
|
+
tabs,
|
|
139
|
+
clipboard,
|
|
140
|
+
timestamp: Date.now()
|
|
141
|
+
};
|
|
45
142
|
});
|
|
@@ -25,6 +25,15 @@ export const tabInfoPreviewHandler = createRouter()
|
|
|
25
25
|
isStreaming: t.Boolean(),
|
|
26
26
|
deviceSize: t.String(),
|
|
27
27
|
rotation: t.String(),
|
|
28
|
+
width: t.Number(),
|
|
29
|
+
height: t.Number(),
|
|
30
|
+
deviceModel: t.Union([t.String(), t.Null()]),
|
|
31
|
+
emulation: t.Object({
|
|
32
|
+
touch: t.Optional(t.Boolean()),
|
|
33
|
+
mobile: t.Optional(t.Boolean()),
|
|
34
|
+
colorScheme: t.Optional(t.String()),
|
|
35
|
+
reducedMotion: t.Optional(t.String())
|
|
36
|
+
}),
|
|
28
37
|
isActive: t.Boolean(),
|
|
29
38
|
canGoBack: t.Boolean(),
|
|
30
39
|
canGoForward: t.Boolean(),
|
|
@@ -61,6 +70,9 @@ export const tabInfoPreviewHandler = createRouter()
|
|
|
61
70
|
isStreaming: t.Boolean(),
|
|
62
71
|
deviceSize: t.String(),
|
|
63
72
|
rotation: t.String(),
|
|
73
|
+
width: t.Number(),
|
|
74
|
+
height: t.Number(),
|
|
75
|
+
deviceModel: t.Union([t.String(), t.Null()]),
|
|
64
76
|
isActive: t.Boolean(),
|
|
65
77
|
canGoBack: t.Boolean(),
|
|
66
78
|
canGoForward: t.Boolean(),
|
|
@@ -123,6 +135,9 @@ export const tabInfoPreviewHandler = createRouter()
|
|
|
123
135
|
isStreaming: tab.isStreaming,
|
|
124
136
|
deviceSize: tab.deviceSize,
|
|
125
137
|
rotation: tab.rotation,
|
|
138
|
+
width: tab.width,
|
|
139
|
+
height: tab.height,
|
|
140
|
+
deviceModel: tab.deviceModel,
|
|
126
141
|
isActive: tab.isActive,
|
|
127
142
|
canGoBack: tab.canGoBack,
|
|
128
143
|
canGoForward: tab.canGoForward,
|
|
@@ -22,12 +22,22 @@ export const tabPreviewHandler = createRouter()
|
|
|
22
22
|
t.Literal('desktop'),
|
|
23
23
|
t.Literal('laptop'),
|
|
24
24
|
t.Literal('tablet'),
|
|
25
|
-
t.Literal('mobile')
|
|
25
|
+
t.Literal('mobile'),
|
|
26
|
+
t.Literal('responsive')
|
|
26
27
|
])),
|
|
27
28
|
rotation: t.Optional(t.Union([
|
|
28
29
|
t.Literal('portrait'),
|
|
29
30
|
t.Literal('landscape')
|
|
30
31
|
])),
|
|
32
|
+
/**
|
|
33
|
+
* Exact viewport size, when the tab was given one (a preset that is
|
|
34
|
+
* not its class's default, or a responsive size). The class default
|
|
35
|
+
* when omitted.
|
|
36
|
+
*/
|
|
37
|
+
width: t.Optional(t.Number()),
|
|
38
|
+
height: t.Optional(t.Number()),
|
|
39
|
+
/** The device model; the class default when omitted. */
|
|
40
|
+
deviceModel: t.Optional(t.String()),
|
|
31
41
|
/**
|
|
32
42
|
* Client-minted name for this launch.
|
|
33
43
|
*
|
|
@@ -60,6 +70,9 @@ export const tabPreviewHandler = createRouter()
|
|
|
60
70
|
url,
|
|
61
71
|
deviceSize = 'laptop',
|
|
62
72
|
rotation = 'portrait',
|
|
73
|
+
width,
|
|
74
|
+
height,
|
|
75
|
+
deviceModel,
|
|
63
76
|
launchId
|
|
64
77
|
} = data;
|
|
65
78
|
|
|
@@ -68,9 +81,11 @@ export const tabPreviewHandler = createRouter()
|
|
|
68
81
|
// Create browser tab
|
|
69
82
|
const tabPromise = previewService.createTab(
|
|
70
83
|
url, // Can be undefined for blank tab
|
|
71
|
-
deviceSize
|
|
72
|
-
rotation
|
|
73
|
-
launchId
|
|
84
|
+
deviceSize,
|
|
85
|
+
rotation,
|
|
86
|
+
launchId,
|
|
87
|
+
width && height ? { width, height } : null,
|
|
88
|
+
{ deviceModel }
|
|
74
89
|
);
|
|
75
90
|
const timeoutPromise = new Promise((_, reject) => {
|
|
76
91
|
setTimeout(() => reject(new Error('Browser tab open timeout - took longer than 60 seconds')), OPEN_TIMEOUT);
|
|
@@ -79,6 +79,11 @@ export const previewRouter = createRouter()
|
|
|
79
79
|
url: t.String(),
|
|
80
80
|
title: t.String(),
|
|
81
81
|
isActive: t.Boolean(),
|
|
82
|
+
deviceSize: t.Optional(t.String()),
|
|
83
|
+
rotation: t.Optional(t.String()),
|
|
84
|
+
width: t.Optional(t.Number()),
|
|
85
|
+
height: t.Optional(t.Number()),
|
|
86
|
+
deviceModel: t.Optional(t.Union([t.String(), t.Null()])),
|
|
82
87
|
/**
|
|
83
88
|
* The launch this tab came from, when a client started it. Absent for
|
|
84
89
|
* tabs the backend opened on its own (an agent, a popup).
|
|
@@ -188,6 +193,18 @@ export const previewRouter = createRouter()
|
|
|
188
193
|
timestamp: t.Number(),
|
|
189
194
|
source: t.Literal('mcp')
|
|
190
195
|
}))
|
|
196
|
+
// A whole pointer movement, animated by the viewer — see publishGlide.
|
|
197
|
+
.emit('preview:browser-mcp-cursor-glide', t.Object({
|
|
198
|
+
sessionId: t.String(),
|
|
199
|
+
from: t.Object({ x: t.Number(), y: t.Number() }),
|
|
200
|
+
control: t.Object({ x: t.Number(), y: t.Number() }),
|
|
201
|
+
to: t.Object({ x: t.Number(), y: t.Number() }),
|
|
202
|
+
durationMs: t.Number(),
|
|
203
|
+
pressed: t.Boolean(),
|
|
204
|
+
easing: t.Union([t.Literal('out'), t.Literal('linear')]),
|
|
205
|
+
timestamp: t.Number(),
|
|
206
|
+
source: t.Literal('mcp')
|
|
207
|
+
}))
|
|
191
208
|
.emit('preview:browser-mcp-cursor-click', t.Object({
|
|
192
209
|
sessionId: t.String(),
|
|
193
210
|
x: t.Number(),
|
|
@@ -217,6 +234,16 @@ export const previewRouter = createRouter()
|
|
|
217
234
|
rotation: t.String(),
|
|
218
235
|
width: t.Number(),
|
|
219
236
|
height: t.Number(),
|
|
237
|
+
deviceModel: t.Optional(t.Union([t.String(), t.Null()])),
|
|
238
|
+
timestamp: t.Number()
|
|
239
|
+
}))
|
|
240
|
+
// The colours a phone or tablet page asks to be framed in — its
|
|
241
|
+
// theme-color and background — for the system bands drawn around it.
|
|
242
|
+
.emit('preview:browser-page-colors', t.Object({
|
|
243
|
+
projectId: t.String(),
|
|
244
|
+
tabId: t.String(),
|
|
245
|
+
statusBar: t.String(),
|
|
246
|
+
background: t.String(),
|
|
220
247
|
timestamp: t.Number()
|
|
221
248
|
}))
|
|
222
249
|
// Live tab metadata: the page's own title and favicon plus whether
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Profiles Handlers (Settings → Profiles) + per-session picker + project default.
|
|
3
3
|
*
|
|
4
|
-
* - profiles:list / get / inventory / create / update / delete
|
|
5
|
-
* - profiles:get-permissions / save-permissions
|
|
6
|
-
* - profiles:set-project-default
|
|
7
|
-
* - profiles:available / project-default
|
|
4
|
+
* - profiles:list / get / inventory / create / update / delete
|
|
5
|
+
* - profiles:get-permissions / save-permissions
|
|
6
|
+
* - profiles:set-project-default
|
|
7
|
+
* - profiles:available / project-default
|
|
8
8
|
*
|
|
9
9
|
* A Profile bundles references to existing artifacts (Skills, Commands,
|
|
10
10
|
* Subagents, Integrations) by slug plus an optional per-engine allow/deny
|
|
11
|
-
* overlay. Nothing is duplicated — see `backend/profiles`.
|
|
12
|
-
* `backend/auth/permissions.ts`; the picker/default-read routes stay non-admin
|
|
13
|
-
* (choosing a profile for a session is a run choice like the model).
|
|
11
|
+
* overlay. Nothing is duplicated — see `backend/profiles`.
|
|
14
12
|
*/
|
|
15
13
|
|
|
16
14
|
import { t } from 'elysia';
|
|
@@ -129,7 +127,7 @@ export const profilesCrudHandler = createRouter()
|
|
|
129
127
|
return { success: true };
|
|
130
128
|
})
|
|
131
129
|
|
|
132
|
-
// ──
|
|
130
|
+
// ── Per-session picker + default read ──────────────────────────────────────
|
|
133
131
|
.http('profiles:available', {
|
|
134
132
|
data: t.Object({}),
|
|
135
133
|
response: t.Object({
|