@myrialabs/clopen 0.4.39 → 0.4.41
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/.env.example +1 -1
- package/backend/artifacts/detect.ts +15 -3
- package/backend/artifacts/generate.ts +2 -2
- package/backend/artifacts/index.ts +12 -4
- package/backend/artifacts/markers.ts +24 -1
- package/backend/artifacts/matrix.ts +47 -3
- package/backend/artifacts/sync.test.ts +3 -3
- package/backend/artifacts/sync.ts +8 -20
- package/backend/artifacts/types.ts +9 -3
- package/backend/auth/permissions.ts +29 -11
- package/backend/auth/session-cleanup.ts +10 -1
- package/backend/auth/tokens.ts +9 -1
- package/backend/chat/stream-manager.ts +42 -0
- package/backend/database/crypto/secret-columns.ts +5 -1
- package/backend/database/migrations/078_create_worktree_branch_tables.ts +158 -0
- package/backend/database/migrations/079_merge_commands_into_skills.ts +222 -0
- package/backend/database/migrations/080_create_file_shares.ts +111 -0
- package/backend/database/migrations/081_create_push_subscriptions.ts +32 -0
- package/backend/database/migrations/index.ts +28 -0
- package/backend/database/queries/file-share-queries.ts +163 -0
- package/backend/database/queries/index.ts +12 -4
- package/backend/database/queries/profile-queries.ts +5 -3
- package/backend/database/queries/push-subscription-queries.test.ts +90 -0
- package/backend/database/queries/push-subscription-queries.ts +99 -0
- package/backend/database/queries/skill-queries.ts +96 -18
- package/backend/database/queries/worktree-branch-queries.ts +331 -0
- package/backend/db-client/cloning.test.ts +161 -0
- package/backend/db-client/cloning.ts +672 -0
- package/backend/db-client/connection-url.test.ts +117 -0
- package/backend/db-client/connection-url.ts +126 -0
- package/backend/db-client/drivers/mongodb.ts +2 -14
- package/backend/db-client/drivers/mysql.ts +2 -8
- package/backend/db-client/drivers/postgres.ts +10 -13
- package/backend/db-client/drivers/redis.ts +2 -6
- package/backend/db-client/env/detect.ts +438 -0
- package/backend/db-client/env/diff.ts +94 -0
- package/backend/db-client/env/env.test.ts +574 -0
- package/backend/db-client/env/index.ts +15 -0
- package/backend/db-client/env/naming.ts +202 -0
- package/backend/db-client/env/service.ts +487 -0
- package/backend/db-client/integrations/index.ts +7 -0
- package/backend/db-client/integrations/links.ts +41 -10
- package/backend/db-client/providers/neon/adapter.ts +522 -0
- package/backend/db-client/providers/neon/api-types.ts +182 -0
- package/backend/db-client/providers/neon/client.ts +298 -0
- package/backend/db-client/providers/neon/endpoints.test.ts +201 -0
- package/backend/db-client/providers/neon/endpoints.ts +314 -0
- package/backend/db-client/providers/neon/list.test.ts +181 -0
- package/backend/db-client/providers/supabase/adapter.ts +25 -2
- package/backend/db-client/providers/types.ts +57 -0
- package/backend/engine/adapters/claude/stream.ts +2 -1
- package/backend/engine/adapters/cline/stream.ts +3 -3
- package/backend/engine/adapters/codex/stream.ts +3 -3
- package/backend/engine/adapters/copilot/stream.ts +3 -3
- package/backend/engine/adapters/cursor/stream.ts +25 -3
- package/backend/engine/adapters/opencode/stream.ts +4 -6
- package/backend/engine/adapters/pi/stream.ts +2 -2
- package/backend/engine/adapters/qwen/stream.ts +2 -2
- package/backend/engine/artifact-sync.ts +26 -20
- package/backend/engine/docs/artifacts.md +81 -22
- package/backend/engine/docs/quick-reference.md +2 -1
- package/backend/engine/resolve-model.test.ts +108 -0
- package/backend/engine/resolve-model.ts +53 -10
- package/backend/engine/structured-helpers.ts +22 -0
- package/backend/env-files/discovery.ts +48 -0
- package/backend/env-files/edit.ts +213 -0
- package/backend/env-files/env-files.test.ts +515 -0
- package/backend/env-files/git.ts +27 -0
- package/backend/env-files/index.ts +44 -0
- package/backend/env-files/keys.ts +69 -0
- package/backend/env-files/parse.ts +157 -0
- package/backend/env-files/write.ts +229 -0
- package/backend/files/file-shares.ts +369 -0
- package/backend/files/path-browsing.ts +27 -21
- package/backend/http/files-shared.test.ts +505 -0
- package/backend/http/files-shared.ts +351 -0
- package/backend/http/push.ts +150 -0
- package/backend/index.ts +8 -0
- package/backend/instructions/index.ts +1 -1
- package/backend/instructions/sync.ts +30 -6
- package/backend/integrations/health.ts +18 -4
- package/backend/integrations/projections/types.ts +9 -2
- package/backend/integrations/registry/index.ts +3 -0
- package/backend/integrations/registry/providers/context7.ts +1 -0
- package/backend/integrations/registry/providers/firecrawl.ts +1 -0
- package/backend/integrations/registry/providers/github.ts +1 -0
- package/backend/integrations/registry/providers/neon.ts +55 -0
- package/backend/integrations/registry/providers/supabase.ts +1 -0
- package/backend/integrations/registry/providers/vercel.ts +1 -0
- package/backend/integrations/registry/types.ts +2 -0
- package/backend/memory/compose.ts +2 -2
- package/backend/memory/consolidate.ts +2 -2
- package/backend/memory/extract/episodic.ts +2 -2
- package/backend/memory/judge.ts +2 -2
- package/backend/profiles/service.ts +7 -6
- package/backend/push/sender.ts +172 -0
- package/backend/push/tags.ts +25 -0
- package/backend/push/vapid-keys.ts +77 -0
- package/backend/push/webpush-crypto.test.ts +200 -0
- package/backend/push/webpush-crypto.ts +231 -0
- package/backend/skills/detect.ts +28 -0
- package/backend/skills/index.ts +22 -4
- package/backend/skills/invoke.test.ts +114 -0
- package/backend/skills/invoke.ts +222 -0
- package/backend/skills/service.ts +194 -44
- package/backend/skills/spec.ts +35 -0
- package/backend/skills/sync.ts +85 -55
- package/backend/subagents/detect.ts +2 -3
- package/backend/subagents/sync.ts +15 -8
- package/backend/work/pull-requests.ts +2 -2
- package/backend/work/start-work.ts +4 -0
- package/backend/worktrees/branching/engine.ts +557 -0
- package/backend/worktrees/branching/index.ts +56 -0
- package/backend/worktrees/branching/naming.test.ts +118 -0
- package/backend/worktrees/branching/naming.ts +97 -0
- package/backend/worktrees/branching/projector.test.ts +229 -0
- package/backend/worktrees/branching/projector.ts +139 -0
- package/backend/worktrees/branching/providers/neon.ts +220 -0
- package/backend/worktrees/branching/registry.ts +27 -0
- package/backend/worktrees/branching/service.ts +620 -0
- package/backend/worktrees/branching/suggest.test.ts +154 -0
- package/backend/worktrees/branching/suggest.ts +202 -0
- package/backend/worktrees/branching/types.ts +88 -0
- package/backend/worktrees/index.ts +7 -0
- package/backend/worktrees/service.ts +48 -1
- package/backend/ws/chat/stream.ts +100 -8
- package/backend/ws/db-client/env.ts +142 -0
- package/backend/ws/db-client/index.ts +2 -0
- package/backend/ws/files/index.ts +4 -0
- package/backend/ws/files/share.ts +95 -0
- package/backend/ws/git/branch-name.ts +2 -2
- package/backend/ws/git/commit-message.ts +2 -2
- package/backend/ws/index.ts +3 -4
- package/backend/ws/profiles/crud.ts +2 -3
- package/backend/ws/projects/index.ts +6 -1
- package/backend/ws/projects/info.ts +70 -6
- package/backend/ws/projects/overview.test.ts +108 -0
- package/backend/ws/projects/overview.ts +300 -0
- package/backend/ws/skills/catalog.ts +5 -1
- package/backend/ws/skills/crud.ts +128 -22
- package/backend/ws/skills/index.ts +4 -1
- package/backend/ws/system/device-info.ts +307 -76
- package/backend/ws/user/crud.ts +12 -3
- package/backend/ws/worktrees/branching.ts +212 -0
- package/backend/ws/worktrees/crud.ts +33 -7
- package/backend/ws/worktrees/index.ts +14 -0
- package/dist/assets/{index-C8Gi-b6U.js → index-CeNKKSDR.js} +1 -1
- package/dist/assets/{index-BrF6nqld.js → index-DW89566K.js} +1 -1
- package/dist/assets/main-Cy5DXWPT.js +1207 -0
- package/dist/assets/main-DJKj_4By.css +1 -0
- package/dist/index.html +7 -2
- package/dist/sw.js +112 -0
- package/package.json +1 -1
- package/shared/constants/engine-tools.ts +31 -6
- package/shared/constants/notification-messages.ts +142 -0
- package/shared/constants/tool-icons.ts +6 -2
- package/shared/types/db-client/env.ts +192 -0
- package/shared/types/db-client/index.ts +1 -0
- package/shared/types/db-client/integrations.ts +30 -0
- package/shared/types/integrations.ts +9 -0
- package/shared/types/unified/stream.ts +7 -0
- package/shared/types/worktree-branching.ts +315 -0
- package/shared/utils/logger.ts +1 -0
- package/backend/commands/detect.ts +0 -25
- package/backend/commands/index.ts +0 -9
- package/backend/commands/service.ts +0 -178
- package/backend/commands/store.ts +0 -45
- package/backend/commands/sync.ts +0 -94
- package/backend/database/queries/command-queries.ts +0 -82
- package/backend/ws/commands/crud.ts +0 -157
- package/backend/ws/commands/index.ts +0 -8
- package/dist/assets/main-Bd3gb79F.css +0 -1
- package/dist/assets/main-Bo1hD7mt.js +0 -1191
package/dist/index.html
CHANGED
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
content="Clopen - Modern web UI for Claude Code & OpenCode with real browser preview, git management, multi-account support, file management, checkpoints, collaboration, and integrated terminal. Built with Bun and Svelte 5."
|
|
11
11
|
/>
|
|
12
12
|
<meta name="theme-color" content="#0e172b" />
|
|
13
|
+
<!-- PWA installability: iOS only delivers web notifications to an
|
|
14
|
+
installed web app opened from the home screen. -->
|
|
15
|
+
<meta name="mobile-web-app-capable" content="yes" />
|
|
16
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
17
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
13
18
|
<title>Clopen</title>
|
|
14
19
|
|
|
15
20
|
<!-- DM Sans - Local self-hosted font -->
|
|
@@ -58,8 +63,8 @@
|
|
|
58
63
|
}
|
|
59
64
|
})();
|
|
60
65
|
</script>
|
|
61
|
-
<script type="module" crossorigin src="/assets/main-
|
|
62
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
66
|
+
<script type="module" crossorigin src="/assets/main-Cy5DXWPT.js"></script>
|
|
67
|
+
<link rel="stylesheet" crossorigin href="/assets/main-DJKj_4By.css">
|
|
63
68
|
</head>
|
|
64
69
|
<body
|
|
65
70
|
class="min-h-dvh bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100 transition-colors duration-200"
|
package/dist/sw.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clopen service worker.
|
|
3
|
+
*
|
|
4
|
+
* Exists for one reason: mobile notifications. Chrome on Android does not
|
|
5
|
+
* support `new Notification()` from a page — construction throws — and only
|
|
6
|
+
* a service worker's `registration.showNotification()` can raise a native
|
|
7
|
+
* toast there. iOS (16.4+) likewise only displays web notifications for an
|
|
8
|
+
* installed web app via its service worker. Desktop keeps using
|
|
9
|
+
* `new Notification()` directly and never touches this file.
|
|
10
|
+
*
|
|
11
|
+
* This worker has no fetch handler and caches nothing of its own. It only:
|
|
12
|
+
* - raises a toast for a server-sent `push` (the one path that works with
|
|
13
|
+
* the tab closed) and for explicit `showNotification()` calls from the page,
|
|
14
|
+
* - focuses or opens the app when a notification is tapped,
|
|
15
|
+
* - dismisses cleanly on swipe.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
self.addEventListener('notificationclick', (event) => {
|
|
19
|
+
event.notification.close();
|
|
20
|
+
|
|
21
|
+
const url = (event.notification.data && event.notification.data.url) || '/';
|
|
22
|
+
|
|
23
|
+
event.waitUntil(
|
|
24
|
+
(async () => {
|
|
25
|
+
const allClients = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
|
|
26
|
+
for (const client of allClients) {
|
|
27
|
+
// Reuse the open tab instead of spawning a duplicate.
|
|
28
|
+
if ('focus' in client) {
|
|
29
|
+
try {
|
|
30
|
+
await client.focus();
|
|
31
|
+
} catch {
|
|
32
|
+
// A closed or detached client — try the next one.
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if ('navigate' in client && client.url !== url) {
|
|
36
|
+
try {
|
|
37
|
+
await client.navigate(url);
|
|
38
|
+
} catch {
|
|
39
|
+
// Navigation is best-effort; the focused tab is enough.
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (self.clients.openWindow) {
|
|
46
|
+
await self.clients.openWindow(url);
|
|
47
|
+
}
|
|
48
|
+
})()
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
self.addEventListener('notificationclose', () => {
|
|
53
|
+
// No bookkeeping to do — present so a dismissed toast settles quietly.
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The notification icon, as a PNG data URL the page rasterised and left in
|
|
58
|
+
* the Cache API.
|
|
59
|
+
*
|
|
60
|
+
* `/favicon.svg` cannot be used directly: Chromium decodes notification
|
|
61
|
+
* images with its raster decoders, which have no SVG support, so an Android
|
|
62
|
+
* push would arrive with no icon — the same gap `notification-icon.ts`
|
|
63
|
+
* already closes for desktop. Reading it here (rather than holding it in a
|
|
64
|
+
* variable) is deliberate: the worker is torn down between push events, so
|
|
65
|
+
* in-memory state would never survive to the one delivery that matters.
|
|
66
|
+
*/
|
|
67
|
+
async function notificationIconUrl() {
|
|
68
|
+
try {
|
|
69
|
+
const cached = await caches.match('/__clopen/notification-icon');
|
|
70
|
+
if (!cached) return '/favicon.svg';
|
|
71
|
+
const dataUrl = await cached.text();
|
|
72
|
+
return dataUrl.startsWith('data:') ? dataUrl : '/favicon.svg';
|
|
73
|
+
} catch {
|
|
74
|
+
return '/favicon.svg';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
self.addEventListener('push', (event) => {
|
|
79
|
+
// Server-sent push (chat completions, waiting-for-input, test pushes).
|
|
80
|
+
// This is what wakes the device when Chrome is closed: the page is gone,
|
|
81
|
+
// but the worker still runs and raises the native toast. A malformed
|
|
82
|
+
// payload must never crash the worker.
|
|
83
|
+
let data = null;
|
|
84
|
+
try {
|
|
85
|
+
data = event.data ? event.data.json() : null;
|
|
86
|
+
} catch {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!data || typeof data.title !== 'string' || !data.title) return;
|
|
90
|
+
|
|
91
|
+
// The tag is identity: it matches the local toast the open tab shows for
|
|
92
|
+
// the same event, so the two collapse into one instead of stacking.
|
|
93
|
+
const tag =
|
|
94
|
+
typeof data.tag === 'string' && data.tag ? data.tag : `push-${Date.now()}`;
|
|
95
|
+
|
|
96
|
+
event.waitUntil(
|
|
97
|
+
(async () => {
|
|
98
|
+
const icon = await notificationIconUrl();
|
|
99
|
+
await self.registration.showNotification(data.title, {
|
|
100
|
+
body: typeof data.body === 'string' ? data.body : '',
|
|
101
|
+
tag,
|
|
102
|
+
icon,
|
|
103
|
+
badge: icon,
|
|
104
|
+
// Buzz on Android; silently ignored where unsupported (iOS/desktop).
|
|
105
|
+
vibrate: [100, 50, 100],
|
|
106
|
+
renotify: false,
|
|
107
|
+
requireInteraction: false,
|
|
108
|
+
data: { url: typeof data.url === 'string' && data.url ? data.url : '/' }
|
|
109
|
+
});
|
|
110
|
+
})()
|
|
111
|
+
);
|
|
112
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrialabs/clopen",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.41",
|
|
4
4
|
"description": "All-in-one web workspace for AI coding agents — Claude Code, OpenCode, Codex, Copilot, Qwen Code, Pi, Cline, and Cursor — with chat, terminal, git, browser preview, database client, checkpoints, and real-time collaboration",
|
|
5
5
|
"author": "Myria Labs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,14 +46,38 @@ export const ENGINE_BUILTIN_TOOLS: Record<EngineType, string[]> = {
|
|
|
46
46
|
// Cline — @cline/sdk default tool names, enforced via `toolPolicies` (a denied
|
|
47
47
|
// tool is set `{ enabled: false }`, hiding it from the model entirely).
|
|
48
48
|
cline: ['read_files', 'search_codebase', 'run_commands', 'fetch_web_content', 'apply_patch', 'editor', 'skills', 'ask_question'],
|
|
49
|
-
// Cursor — @cursor/sdk
|
|
50
|
-
//
|
|
51
|
-
|
|
49
|
+
// Cursor — names from @cursor/sdk's public tool vocabulary (`ToolName`),
|
|
50
|
+
// enforced by passing the blocked set as `disallowedTools` on Agent
|
|
51
|
+
// create/resume. The SDK REJECTS unknown names with a ConfigurationError, so
|
|
52
|
+
// these must stay spelled exactly as the SDK spells them (`webSearch`, not
|
|
53
|
+
// `web_search`). `mcp` is deliberately absent: it is a capability group whose
|
|
54
|
+
// removal would also kill Clopen's in-process custom tools (AskUserQuestion),
|
|
55
|
+
// so it is not offered as a per-tool target.
|
|
56
|
+
cursor: [
|
|
57
|
+
'shell',
|
|
58
|
+
'read',
|
|
59
|
+
'edit',
|
|
60
|
+
'delete',
|
|
61
|
+
'ls',
|
|
62
|
+
'glob',
|
|
63
|
+
'grep',
|
|
64
|
+
'semSearch',
|
|
65
|
+
'task',
|
|
66
|
+
'webSearch',
|
|
67
|
+
'webFetch',
|
|
68
|
+
'readLints',
|
|
69
|
+
'updateTodos',
|
|
70
|
+
'readTodos',
|
|
71
|
+
'generateImage',
|
|
72
|
+
'applyAgentDiff'
|
|
73
|
+
]
|
|
52
74
|
};
|
|
53
75
|
|
|
54
76
|
/**
|
|
55
77
|
* Engines whose permission enforcement is best-effort. Only Codex — it has no
|
|
56
|
-
* per-call permission hook
|
|
78
|
+
* per-call permission hook; every other engine enforces at runtime, either at a
|
|
79
|
+
* per-call surface (Claude/Qwen/Copilot/OpenCode/Pi) or by withholding the tool
|
|
80
|
+
* from the model entirely (Cline `toolPolicies`, Cursor `disallowedTools`).
|
|
57
81
|
*/
|
|
58
82
|
export const ENGINE_TOOLS_BEST_EFFORT: Record<EngineType, boolean> = {
|
|
59
83
|
'claude-code': false,
|
|
@@ -65,6 +89,7 @@ export const ENGINE_TOOLS_BEST_EFFORT: Record<EngineType, boolean> = {
|
|
|
65
89
|
pi: false,
|
|
66
90
|
// Cline enforces allow/deny via `toolPolicies` (`{ enabled: false }` = real).
|
|
67
91
|
cline: false,
|
|
68
|
-
// Cursor
|
|
69
|
-
|
|
92
|
+
// Cursor enforces allow/deny through `AgentOptions.disallowedTools` (a blocked
|
|
93
|
+
// tool is never offered to the model) — real, not best-effort.
|
|
94
|
+
cursor: false
|
|
70
95
|
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification wording — the single source of truth for every notification
|
|
3
|
+
* Clopen raises, on both sides of the wire.
|
|
4
|
+
*
|
|
5
|
+
* Every chat event is announced twice: the open tab raises a local toast, and
|
|
6
|
+
* the server pushes to the user's registered devices so the notice survives a
|
|
7
|
+
* closed tab. The two copies share a tag, which means the server copy
|
|
8
|
+
* *replaces* the local one rather than stacking beside it — and a replacement
|
|
9
|
+
* is only invisible when both say exactly the same thing. Four separate
|
|
10
|
+
* copies of these strings (two per side) is what let them drift apart before.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Chat lifecycle moments worth interrupting the user for. */
|
|
14
|
+
export type ChatNotificationEvent = 'completed' | 'cancelled' | 'error' | 'waiting-input';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Where the event happened. Both fields are optional because both can be
|
|
18
|
+
* genuinely unknown — a project row deleted mid-stream, a session whose title
|
|
19
|
+
* has not been derived from the first message yet.
|
|
20
|
+
*/
|
|
21
|
+
export interface ChatNotificationContext {
|
|
22
|
+
projectName?: string;
|
|
23
|
+
sessionTitle?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* How long a push service holds a notification for a device it cannot reach.
|
|
28
|
+
*
|
|
29
|
+
* This is the whole mechanism behind "notify me even though I closed the
|
|
30
|
+
* browser". A phone with the screen off, or a laptop whose browser is not
|
|
31
|
+
* running, is simply unreachable: the push service queues the message and
|
|
32
|
+
* replays it the moment that device reconnects. A TTL shorter than the gap
|
|
33
|
+
* throws the notification away instead — which is the one outcome this
|
|
34
|
+
* feature exists to prevent.
|
|
35
|
+
*
|
|
36
|
+
* Twelve hours covers a laptop closed overnight or a phone left face-down
|
|
37
|
+
* through a working day, and still expires before a completion notice turns
|
|
38
|
+
* into archaeology.
|
|
39
|
+
*
|
|
40
|
+
* Lives here rather than with the sender because the settings panel quotes the
|
|
41
|
+
* duration back to the user; two hand-maintained copies of "12 hours" is a
|
|
42
|
+
* promise the code can silently stop keeping.
|
|
43
|
+
*/
|
|
44
|
+
export const PUSH_TTL_SECONDS = 12 * 3600;
|
|
45
|
+
|
|
46
|
+
/** Human form of {@link PUSH_TTL_SECONDS}, for prose that quotes it. */
|
|
47
|
+
export function pushTtlLabel(): string {
|
|
48
|
+
const hours = Math.round(PUSH_TTL_SECONDS / 3600);
|
|
49
|
+
return hours === 1 ? '1 hour' : `${hours} hours`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A session title is free text from the user's first message, so it is
|
|
54
|
+
* unbounded. Notification centres give the body a line or two before they
|
|
55
|
+
* truncate, and they truncate the *end* — which is where the project name
|
|
56
|
+
* would be if the title ran long.
|
|
57
|
+
*/
|
|
58
|
+
const MAX_SESSION_TITLE_CHARS = 40;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The title states what happened; the body states where.
|
|
62
|
+
*
|
|
63
|
+
* Titles used to name the engine ("Claude Response Complete") on a product
|
|
64
|
+
* that runs eight of them, and the cancelled case contradicted its own body by
|
|
65
|
+
* announcing a completion. They also never truncate: every OS clips the title
|
|
66
|
+
* around forty characters, and a title that leads with an unbounded project
|
|
67
|
+
* name loses the status first — the one thing the notification exists to say.
|
|
68
|
+
*/
|
|
69
|
+
const CHAT_TITLES: Record<ChatNotificationEvent, string> = {
|
|
70
|
+
completed: 'Response ready',
|
|
71
|
+
cancelled: 'Response stopped',
|
|
72
|
+
error: 'Response failed',
|
|
73
|
+
'waiting-input': 'Needs your input'
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* What the body says when neither the project nor the session could be
|
|
78
|
+
* resolved. Never empty: a notification with no body renders as a bare title
|
|
79
|
+
* strip on most platforms.
|
|
80
|
+
*/
|
|
81
|
+
const CHAT_FALLBACK_BODIES: Record<ChatNotificationEvent, string> = {
|
|
82
|
+
completed: 'Your chat response is ready.',
|
|
83
|
+
cancelled: 'The response stopped before it finished.',
|
|
84
|
+
error: 'The engine reported an error.',
|
|
85
|
+
'waiting-input': 'A question is waiting for your answer.'
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
function truncate(value: string, max: number): string {
|
|
89
|
+
return value.length <= max ? value : `${value.slice(0, max - 1).trimEnd()}…`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Compose the body from whatever context resolved.
|
|
94
|
+
*
|
|
95
|
+
* An absent segment is dropped rather than filled in: the old `"Unknown"`
|
|
96
|
+
* placeholder was shown to the user as though it were a project name, and told
|
|
97
|
+
* them strictly less than leaving it out.
|
|
98
|
+
*/
|
|
99
|
+
function chatNotificationBody(
|
|
100
|
+
event: ChatNotificationEvent,
|
|
101
|
+
context: ChatNotificationContext
|
|
102
|
+
): string {
|
|
103
|
+
const project = context.projectName?.trim();
|
|
104
|
+
const session = context.sessionTitle?.trim();
|
|
105
|
+
const quotedSession = session ? `"${truncate(session, MAX_SESSION_TITLE_CHARS)}"` : '';
|
|
106
|
+
|
|
107
|
+
if (project && quotedSession) return `${project} — ${quotedSession}`;
|
|
108
|
+
if (project) return project;
|
|
109
|
+
if (quotedSession) return quotedSession;
|
|
110
|
+
return CHAT_FALLBACK_BODIES[event];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Title and body for one chat event. Identical on the server and in the tab. */
|
|
114
|
+
export function chatNotificationMessage(
|
|
115
|
+
event: ChatNotificationEvent,
|
|
116
|
+
context: ChatNotificationContext = {}
|
|
117
|
+
): { title: string; body: string } {
|
|
118
|
+
return {
|
|
119
|
+
title: CHAT_TITLES[event],
|
|
120
|
+
body: chatNotificationBody(event, context)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Test Push wording, split by the route that actually carried it.
|
|
126
|
+
*
|
|
127
|
+
* Both routes end at the same OS notification centre, so an identical body
|
|
128
|
+
* ("Push notifications are working correctly") left the user unable to tell
|
|
129
|
+
* whether the network leg was proven or whether the test had quietly fallen
|
|
130
|
+
* back to a toast the open tab raised itself — which proves nothing about
|
|
131
|
+
* delivery with the tab closed.
|
|
132
|
+
*/
|
|
133
|
+
export const TEST_PUSH_MESSAGES = {
|
|
134
|
+
background: {
|
|
135
|
+
title: 'Test notification',
|
|
136
|
+
body: 'Delivered through the background push service.'
|
|
137
|
+
},
|
|
138
|
+
local: {
|
|
139
|
+
title: 'Test notification',
|
|
140
|
+
body: 'Shown by this browser tab.'
|
|
141
|
+
}
|
|
142
|
+
} as const;
|
|
@@ -75,13 +75,17 @@ export const PROVIDER_ICONS: Record<string, ToolIcon> = {
|
|
|
75
75
|
firecrawl: { light: '<svg width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="8 34 560 560" xmlns="http://www.w3.org/2000/svg"><g><g transform=" translate(293.035, 553.013) scale(0.97724, 0.97724) translate(-533.035, -800.013)"><path d=" M603.4 416.3 C581,433 586.6,450.2 583.9,466.6 C583.2,470.5 577.8,469.2 576.5,465.7 C559.5,447 549.5,423.6 559.3,394.4 C577.2,340.8 614.2,311.2 594.2,288.4 C591,284.8 591.8,284.3 590.2,288.8 C572.5,339 363,338 428,536 C430.9,544.8 430.2,555.2 429.5,565.8 C429.3,569 427.1,571.3 424.2,570.1 C401.5,560.8 395.4,525.8 390.4,516.3 C389,513.6 387.5,514.5 385.7,518 C381,524.1 377.9,532.3 374.2,538.5 C336.9,600.7 343.6,664.3 368,715 C368.9,716.9 369.9,718.7 370.9,720.6 C371.9,722.7 373.1,724.8 374.2,726.8 C391.8,758.3 416,783.8 439.8,799.3 C442.6,801.2 446.3,798.5 445.3,795.2 C437.1,767.6 642.8,744.8 634.7,795.2 C634.1,798.6 637.3,801.3 640.2,799.4 C659.9,786.5 680.2,766.8 695.2,742 C696.4,740 697.6,738 698.7,735.9 C699.5,734.5 700.2,733.1 701,731.6 C711.2,711.6 717.8,688.8 718.1,663.6 C718.3,643.8 714.6,622.5 705.5,600.1 C703.8,595.8 700.2,616.5 684.4,613.3 C682.9,613 691.2,586.1 692.1,570.6 C692.4,563.3 690.7,544.7 683.2,524.1 C667.8,481.1 615.5,466.2 609.6,417.3 C609.2,414.6 605.5,414.7 603.4,416.3z " fill="#fa5d19" fill-opacity="1" fill-rule="nonzero"></animate></path></g><g transform=" translate(300, 470.504) scale(0.9650799999999999, 0.9650799999999999) translate(-510.283, -685.815)"><path d=" M410.1 771.9 C412.9,773.7 416.6,771.1 415.6,767.8 C407.4,740.2 411.5,708.6 427.7,684.6 C455.3,643.2 510.6,603.1 501.8,548.7 C501.2,545.3 505.3,543 507.9,545.4 C546.9,581 554.6,629 548.2,672 C547.6,675.7 552.3,677.7 554.7,674.8 C560.6,667.3 567.9,660.7 575.9,655.8 C577.8,654.6 580.5,655.5 581.2,657.7 C594.2,695.6 617.7,725.6 605,767.8 C604,771.1 607.6,773.8 610.5,771.9 C610.5,771.9 610.5,827.2 610.5,827.2 C610.5,827.2 410.1,827.2 410.1,827.2 C410.1,827.2 410.1,771.9 410.1,771.9z " fill="#ffffff" fill-opacity="1" fill-rule="nonzero"></path></g></g></svg>', dark: '<svg width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="8 34 560 560" xmlns="http://www.w3.org/2000/svg"><g><g transform=" translate(293.035, 553.013) scale(0.97724, 0.97724) translate(-533.035, -800.013)"><path d=" M603.4 416.3 C581,433 586.6,450.2 583.9,466.6 C583.2,470.5 577.8,469.2 576.5,465.7 C559.5,447 549.5,423.6 559.3,394.4 C577.2,340.8 614.2,311.2 594.2,288.4 C591,284.8 591.8,284.3 590.2,288.8 C572.5,339 363,338 428,536 C430.9,544.8 430.2,555.2 429.5,565.8 C429.3,569 427.1,571.3 424.2,570.1 C401.5,560.8 395.4,525.8 390.4,516.3 C389,513.6 387.5,514.5 385.7,518 C381,524.1 377.9,532.3 374.2,538.5 C336.9,600.7 343.6,664.3 368,715 C368.9,716.9 369.9,718.7 370.9,720.6 C371.9,722.7 373.1,724.8 374.2,726.8 C391.8,758.3 416,783.8 439.8,799.3 C442.6,801.2 446.3,798.5 445.3,795.2 C437.1,767.6 642.8,744.8 634.7,795.2 C634.1,798.6 637.3,801.3 640.2,799.4 C659.9,786.5 680.2,766.8 695.2,742 C696.4,740 697.6,738 698.7,735.9 C699.5,734.5 700.2,733.1 701,731.6 C711.2,711.6 717.8,688.8 718.1,663.6 C718.3,643.8 714.6,622.5 705.5,600.1 C703.8,595.8 700.2,616.5 684.4,613.3 C682.9,613 691.2,586.1 692.1,570.6 C692.4,563.3 690.7,544.7 683.2,524.1 C667.8,481.1 615.5,466.2 609.6,417.3 C609.2,414.6 605.5,414.7 603.4,416.3z " fill="#fa5d19" fill-opacity="1" fill-rule="nonzero"></animate></path></g><g transform=" translate(300, 470.504) scale(0.9650799999999999, 0.9650799999999999) translate(-510.283, -685.815)"><path d=" M410.1 771.9 C412.9,773.7 416.6,771.1 415.6,767.8 C407.4,740.2 411.5,708.6 427.7,684.6 C455.3,643.2 510.6,603.1 501.8,548.7 C501.2,545.3 505.3,543 507.9,545.4 C546.9,581 554.6,629 548.2,672 C547.6,675.7 552.3,677.7 554.7,674.8 C560.6,667.3 567.9,660.7 575.9,655.8 C577.8,654.6 580.5,655.5 581.2,657.7 C594.2,695.6 617.7,725.6 605,767.8 C604,771.1 607.6,773.8 610.5,771.9 C610.5,771.9 610.5,827.2 610.5,827.2 C610.5,827.2 410.1,827.2 410.1,827.2 C410.1,827.2 410.1,771.9 410.1,771.9z " fill="#0f172a" fill-opacity="1" fill-rule="nonzero"></path></g></g></svg>' },
|
|
76
76
|
// Vercel's mark is one triangle whose fill flips with the theme — their brand
|
|
77
77
|
// guidance is black on light and white on dark, so the two variants differ
|
|
78
|
-
// only in that fill
|
|
78
|
+
// only in that fill, and the viewBox is the one their own asset pack ships
|
|
79
|
+
// (1155x1000) rather than a re-typed approximation of it.
|
|
79
80
|
// Supabase's mark is one artwork for both themes — the green reads on light
|
|
80
81
|
// and dark alike, which is what their own guidance assumes. Its gradient ids
|
|
81
82
|
// are namespaced: an inline SVG's `id` is document-global, so a bare
|
|
82
83
|
// `paint0_linear` would be captured by whichever mark rendered first.
|
|
83
84
|
supabase: { light: '<svg width="24" height="24" viewBox="0 0 109 113" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0625L99.1935 40.0625C107.384 40.0625 111.952 49.5226 106.859 55.9372L63.7076 110.284Z" fill="url(#supabase_a)"/><path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0625L99.1935 40.0625C107.384 40.0625 111.952 49.5226 106.859 55.9372L63.7076 110.284Z" fill="url(#supabase_b)" fill-opacity="0.2"/><path d="M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.4849 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z" fill="#3ECF8E"/><defs><linearGradient id="supabase_a" x1="53.9738" y1="54.9738" x2="94.1635" y2="71.8293" gradientUnits="userSpaceOnUse"><stop stop-color="#249361"/><stop offset="1" stop-color="#3ECF8E"/></linearGradient><linearGradient id="supabase_b" x1="36.1558" y1="30.5779" x2="54.4844" y2="65.0804" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-opacity="0"/></linearGradient></defs></svg>', dark: '<svg width="24" height="24" viewBox="0 0 109 113" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0625L99.1935 40.0625C107.384 40.0625 111.952 49.5226 106.859 55.9372L63.7076 110.284Z" fill="url(#supabase_a)"/><path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0625L99.1935 40.0625C107.384 40.0625 111.952 49.5226 106.859 55.9372L63.7076 110.284Z" fill="url(#supabase_b)" fill-opacity="0.2"/><path d="M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.4849 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z" fill="#3ECF8E"/><defs><linearGradient id="supabase_a" x1="53.9738" y1="54.9738" x2="94.1635" y2="71.8293" gradientUnits="userSpaceOnUse"><stop stop-color="#249361"/><stop offset="1" stop-color="#3ECF8E"/></linearGradient><linearGradient id="supabase_b" x1="36.1558" y1="30.5779" x2="54.4844" y2="65.0804" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-opacity="0"/></linearGradient></defs></svg>' },
|
|
84
|
-
vercel: { light: '<svg width="24" height="24" viewBox="0 0
|
|
85
|
+
vercel: { light: '<svg width="24" height="24" viewBox="0 0 1155 1000" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M577.344 0L1154.69 1000H0L577.344 0Z" fill="black"/></svg>', dark: '<svg width="24" height="24" viewBox="0 0 1155 1000" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M577.344 0L1154.69 1000H0L577.344 0Z" fill="white"/></svg>' },
|
|
86
|
+
// Neon ships one logomark in two greens — #37C38F for a light background,
|
|
87
|
+
// #34D59A for a dark one — which is the pair, not a tint we chose.
|
|
88
|
+
neon: { light: '<svg width="24" height="24" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M63 0.0177909V63.5526L38.4178 42.2501V63.5526H0V0L63 0.0177909ZM7.72251 55.8389H30.6953V25.3238L55.2779 47.0476V7.72922L7.72251 7.71559V55.8389Z" fill="#37C38F"/></svg>', dark: '<svg width="24" height="24" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M63 0.0177909V63.5526L38.4178 42.2501V63.5526H0V0L63 0.0177909ZM7.72251 55.8389H30.6953V25.3238L55.2779 47.0476V7.72922L7.72251 7.71559V55.8389Z" fill="#34D59A"/></svg>' },
|
|
85
89
|
github: { light: '<svg width="24" height="24" viewBox="0 0 98 96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>', dark: '<svg width="24" height="24" viewBox="0 0 98 96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#ffffff"/></svg>' }
|
|
86
90
|
};
|
|
87
91
|
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* db-client — the connection as environment variables.
|
|
3
|
+
*
|
|
4
|
+
* A database is only useful to the project sitting next to it, and the step
|
|
5
|
+
* between "Clopen can reach this" and "my app can reach this" was a user
|
|
6
|
+
* retyping a host, a port, a password and an SSL mode into a dotenv file. This
|
|
7
|
+
* is the vocabulary for closing that gap: what the variables are called, which
|
|
8
|
+
* file they belong in, and what changing that file would do.
|
|
9
|
+
*
|
|
10
|
+
* The naming is the hard part, and it is NOT guessed. Projects split a database
|
|
11
|
+
* across `DB_HOST`/`DB_PASSWORD`, fold it into one `DATABASE_URL`, or call the
|
|
12
|
+
* same thing `POSTGRES_URL` because Vercel does — so the project's own files
|
|
13
|
+
* are read first and what they already use is what gets offered. A preset is
|
|
14
|
+
* the fallback for a project that has nothing yet, not the default answer.
|
|
15
|
+
*
|
|
16
|
+
* VALUES CROSS THIS LINE, unlike every other db-client type. A connection
|
|
17
|
+
* string the user cannot copy is a connection string that solves nothing, so
|
|
18
|
+
* the routes behind these shapes are access-gated instead — see
|
|
19
|
+
* `backend/ws/db-client/env.ts`.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import type { DbDriver } from './connection';
|
|
23
|
+
|
|
24
|
+
/** One variable holding everything, or one variable per field. */
|
|
25
|
+
export type DbEnvShape = 'url' | 'split';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* What one variable HOLDS, independent of what it is called.
|
|
29
|
+
*
|
|
30
|
+
* The naming picker offers shapes and nothing else. An earlier version offered
|
|
31
|
+
* frameworks — Laravel, Prisma, libpq, Vercel — which was a list of guesses
|
|
32
|
+
* about projects it had already read: the real answer to "what are these
|
|
33
|
+
* called here" comes from `DbEnvExistingGroup`, which carries the project's own
|
|
34
|
+
* key names. A framework in a dropdown is that answer asserted instead.
|
|
35
|
+
*/
|
|
36
|
+
export type DbEnvRole =
|
|
37
|
+
| 'url'
|
|
38
|
+
| 'altUrl'
|
|
39
|
+
| 'host'
|
|
40
|
+
| 'port'
|
|
41
|
+
| 'user'
|
|
42
|
+
| 'password'
|
|
43
|
+
| 'database'
|
|
44
|
+
| 'sslMode';
|
|
45
|
+
|
|
46
|
+
/** One of the two shapes, as the picker renders it. */
|
|
47
|
+
export interface DbEnvShapeInfo {
|
|
48
|
+
id: DbEnvShape;
|
|
49
|
+
label: string;
|
|
50
|
+
description: string;
|
|
51
|
+
/** The keys it writes, with the current prefix, for the picker to show. */
|
|
52
|
+
sampleKeys: string[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DbEnvVar {
|
|
56
|
+
key: string;
|
|
57
|
+
value: string;
|
|
58
|
+
/** True when the value carries a credential, so the panel masks it. */
|
|
59
|
+
isSecret: boolean;
|
|
60
|
+
/** One short clause, when the variable needs explaining. */
|
|
61
|
+
note?: string | null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface DbEnvFileInfo {
|
|
65
|
+
name: string;
|
|
66
|
+
/** Read for its shape, never written — `.env.example` and friends. */
|
|
67
|
+
isTemplate: boolean;
|
|
68
|
+
/** git tracks it, so writing a password into it would commit one. */
|
|
69
|
+
isTracked: boolean;
|
|
70
|
+
/** Lower wins: `.env.local` beats `.env` in Next.js and Vite. */
|
|
71
|
+
precedence: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A naming convention the project is ALREADY using.
|
|
76
|
+
*
|
|
77
|
+
* The whole reason detection exists: offering to update `POSTGRES_URL` where
|
|
78
|
+
* the project has one beats adding a `DATABASE_URL` nothing reads.
|
|
79
|
+
*/
|
|
80
|
+
export interface DbEnvExistingGroup {
|
|
81
|
+
prefix: string;
|
|
82
|
+
shape: DbEnvShape;
|
|
83
|
+
keys: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Which of this group's keys holds what.
|
|
86
|
+
*
|
|
87
|
+
* The whole point of detection, and what replaced the framework presets: a
|
|
88
|
+
* project with `DB_USERNAME` gets `DB_USERNAME` written, not a `DB_USER`
|
|
89
|
+
* beside it that nothing reads.
|
|
90
|
+
*/
|
|
91
|
+
keyMap: Partial<Record<DbEnvRole, string>>;
|
|
92
|
+
/** Which files carry these keys, most-precedent first. */
|
|
93
|
+
files: string[];
|
|
94
|
+
/** True when every occurrence is commented out — a template's documentation. */
|
|
95
|
+
isTemplateOnly: boolean;
|
|
96
|
+
/** How the row reads: "DATABASE_URL · .env.local". */
|
|
97
|
+
label: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface DbEnvDetection {
|
|
101
|
+
/** Null when no project is in scope; the panel then only offers copying. */
|
|
102
|
+
projectId: string | null;
|
|
103
|
+
projectName: string | null;
|
|
104
|
+
files: DbEnvFileInfo[];
|
|
105
|
+
/** What the project already uses, best first. Empty for a fresh project. */
|
|
106
|
+
existing: DbEnvExistingGroup[];
|
|
107
|
+
/** Where the names came from, for the sentence the panel shows. */
|
|
108
|
+
sources: string[];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Everything the panel needs to open. */
|
|
112
|
+
export interface DbEnvState {
|
|
113
|
+
connectionId: string;
|
|
114
|
+
connectionName: string;
|
|
115
|
+
driver: DbDriver;
|
|
116
|
+
/** The database in scope, when the panel was opened inside one. */
|
|
117
|
+
database: string | null;
|
|
118
|
+
shapes: DbEnvShapeInfo[];
|
|
119
|
+
detection: DbEnvDetection;
|
|
120
|
+
/** The shape, names and file the panel opens on. */
|
|
121
|
+
suggestion: {
|
|
122
|
+
shape: DbEnvShape;
|
|
123
|
+
prefix: string;
|
|
124
|
+
fileName: string | null;
|
|
125
|
+
/** The project's own names, when detection found a group to follow. */
|
|
126
|
+
keyMap: Partial<Record<DbEnvRole, string>> | null;
|
|
127
|
+
};
|
|
128
|
+
/** True when the provider can also hand back a direct/unpooled counterpart. */
|
|
129
|
+
hasAlternate: boolean;
|
|
130
|
+
/** What the counterpart is called where it exists — "Direct (unpooled)". */
|
|
131
|
+
alternateLabel: string | null;
|
|
132
|
+
/** Sentences shown above the variables: tunnels, localhost, derived rows. */
|
|
133
|
+
warnings: string[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type DbEnvDiffKind = 'context' | 'added' | 'removed';
|
|
137
|
+
|
|
138
|
+
export interface DbEnvDiffLine {
|
|
139
|
+
kind: DbEnvDiffKind;
|
|
140
|
+
text: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** What applying would do, worked out without touching the file. */
|
|
144
|
+
export interface DbEnvPlan {
|
|
145
|
+
vars: DbEnvVar[];
|
|
146
|
+
/** The rendered fragment, ready to paste. */
|
|
147
|
+
text: string;
|
|
148
|
+
fileName: string | null;
|
|
149
|
+
fileExists: boolean;
|
|
150
|
+
/** git tracks the target, so applying needs an explicit override. */
|
|
151
|
+
fileTracked: boolean;
|
|
152
|
+
/** Keys replaced where the project already had them. */
|
|
153
|
+
updated: string[];
|
|
154
|
+
/** Keys the project lacks, bound for the managed block. */
|
|
155
|
+
appended: string[];
|
|
156
|
+
/** Keys already holding exactly this value. */
|
|
157
|
+
unchanged: string[];
|
|
158
|
+
diff: DbEnvDiffLine[];
|
|
159
|
+
warnings: string[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface DbEnvApplyResult {
|
|
163
|
+
status: 'written' | 'unchanged' | 'skipped-tracked' | 'failed';
|
|
164
|
+
/** One sentence, naming what happened and what to do. Null when it worked. */
|
|
165
|
+
detail: string | null;
|
|
166
|
+
fileName: string;
|
|
167
|
+
updated: string[];
|
|
168
|
+
appended: string[];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** What the panel sends for a preview, an apply, or an undo. */
|
|
172
|
+
export interface DbEnvRequest {
|
|
173
|
+
connectionId: string;
|
|
174
|
+
projectId?: string;
|
|
175
|
+
/**
|
|
176
|
+
* The database in scope.
|
|
177
|
+
*
|
|
178
|
+
* A connection with no database of its own browses one, and it is THAT one
|
|
179
|
+
* the project needs a URL for — the connection's own empty field would
|
|
180
|
+
* produce a string pointing at the server and no database.
|
|
181
|
+
*/
|
|
182
|
+
database?: string;
|
|
183
|
+
shape: DbEnvShape;
|
|
184
|
+
prefix: string;
|
|
185
|
+
/** Exact names to use, overriding what the prefix would produce. */
|
|
186
|
+
keyMap?: Partial<Record<DbEnvRole, string>>;
|
|
187
|
+
fileName?: string;
|
|
188
|
+
/** Include the provider's direct/unpooled counterpart where one exists. */
|
|
189
|
+
includeAlternate?: boolean;
|
|
190
|
+
/** Write even though git tracks the file. The user has to have confirmed. */
|
|
191
|
+
allowTracked?: boolean;
|
|
192
|
+
}
|
|
@@ -52,6 +52,26 @@ export interface DbProviderInfo {
|
|
|
52
52
|
secretFields: DbLinkSecretField[];
|
|
53
53
|
/** Copy shown above the picker — where to find things, what will happen. */
|
|
54
54
|
description: string;
|
|
55
|
+
/**
|
|
56
|
+
* Where this provider's credential is created.
|
|
57
|
+
*
|
|
58
|
+
* Filled from the INTEGRATION registry rather than declared twice: the hub
|
|
59
|
+
* already knows every provider's `docsUrl`, and a second copy here would be
|
|
60
|
+
* the one that goes stale. It exists so the link dialog can point a user at
|
|
61
|
+
* the right page without naming a vendor in its own markup — which is how it
|
|
62
|
+
* ended up telling someone connecting Neon where Supabase tokens live.
|
|
63
|
+
*/
|
|
64
|
+
docsUrl?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The provider's dashboard, for the things Clopen cannot do.
|
|
67
|
+
*
|
|
68
|
+
* Every provider has some — Neon has no organisation endpoints at all,
|
|
69
|
+
* Supabase exposes no organisation update — and until now the dialog only
|
|
70
|
+
* SAID so. A sentence that names a place without offering to go there leaves
|
|
71
|
+
* the user to find it, which is the read-only-window feeling this surface
|
|
72
|
+
* exists to remove. Filled from the integration registry, like `docsUrl`.
|
|
73
|
+
*/
|
|
74
|
+
consoleUrl?: string;
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
/** A remote database an account can reach but has not necessarily linked. */
|
|
@@ -122,6 +142,16 @@ export interface DbProviderCreateOptions {
|
|
|
122
142
|
canCreateGroup: boolean;
|
|
123
143
|
/** One sentence naming what creating a container costs. */
|
|
124
144
|
createGroupNotice: string;
|
|
145
|
+
/**
|
|
146
|
+
* What can and cannot be done to a container from here, in one sentence.
|
|
147
|
+
*
|
|
148
|
+
* Provider-declared because the answer is provider-specific and the reason
|
|
149
|
+
* is too: Supabase exposes no PATCH or DELETE for an organisation, so no
|
|
150
|
+
* permission would help, while Neon exposes no create either. Hard-coding
|
|
151
|
+
* one vendor's sentence made the dialog send a Neon user to Supabase's
|
|
152
|
+
* dashboard.
|
|
153
|
+
*/
|
|
154
|
+
groupManagementNotice: string;
|
|
125
155
|
}
|
|
126
156
|
|
|
127
157
|
/** A link, as the panel sees it. Secret VALUES never cross this line. */
|
|
@@ -78,6 +78,15 @@ export interface IntegrationProviderInfo {
|
|
|
78
78
|
category: IntegrationCategory;
|
|
79
79
|
description: string;
|
|
80
80
|
docsUrl?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The provider's own dashboard.
|
|
83
|
+
*
|
|
84
|
+
* Separate from `docsUrl`, which points at where a CREDENTIAL is created.
|
|
85
|
+
* This is where the things Clopen cannot manage actually live — an
|
|
86
|
+
* organisation Neon has no API for, a billing plan — so a surface that has
|
|
87
|
+
* to say "do this at the vendor" can offer the trip instead of describing it.
|
|
88
|
+
*/
|
|
89
|
+
consoleUrl?: string;
|
|
81
90
|
authMethod: IntegrationAuthMethod;
|
|
82
91
|
credentialFields: IntegrationCredentialField[];
|
|
83
92
|
capabilities: IntegrationCapability[];
|
|
@@ -182,6 +182,13 @@ export interface StreamRequest {
|
|
|
182
182
|
prompt: UserMessage;
|
|
183
183
|
engine: MessageEngine;
|
|
184
184
|
sender: MessageSender;
|
|
185
|
+
/**
|
|
186
|
+
* Server-trusted id of the user who started the stream (from the WS
|
|
187
|
+
* connection, never the client-supplied `sender`). Used to route Web Push
|
|
188
|
+
* notifications to the requester's devices when Chrome is closed.
|
|
189
|
+
* Absent for streams started before this field existed.
|
|
190
|
+
*/
|
|
191
|
+
requestedByUserId?: string;
|
|
185
192
|
/**
|
|
186
193
|
* Reasoning/thinking level token chosen for this session (native per engine).
|
|
187
194
|
* `null`/absent → the engine's own default applies. Persisted to
|