@myrialabs/clopen 0.2.2 → 0.2.3
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/.dockerignore +5 -0
- package/.env.example +2 -5
- package/CONTRIBUTING.md +4 -0
- package/README.md +4 -2
- package/backend/database/queries/message-queries.ts +42 -0
- package/backend/database/utils/connection.ts +5 -5
- package/backend/engine/adapters/claude/environment.ts +3 -4
- package/backend/engine/adapters/opencode/server.ts +7 -1
- package/backend/git/git-executor.ts +2 -1
- package/backend/index.ts +10 -10
- package/backend/snapshot/blob-store.ts +2 -2
- package/backend/utils/env.ts +13 -15
- package/backend/utils/index.ts +4 -1
- package/backend/utils/paths.ts +11 -0
- package/backend/utils/port-utils.ts +19 -6
- package/backend/ws/messages/crud.ts +52 -0
- package/bin/clopen.ts +15 -15
- package/docker-compose.yml +31 -0
- package/frontend/components/auth/SetupPage.svelte +43 -11
- package/frontend/components/chat/widgets/FloatingTodoList.svelte +124 -10
- package/frontend/components/common/feedback/UpdateBanner.svelte +2 -2
- package/frontend/components/history/HistoryModal.svelte +30 -78
- package/frontend/components/history/HistoryView.svelte +45 -92
- package/frontend/components/settings/appearance/AppearanceSettings.svelte +2 -2
- package/frontend/components/workspace/panels/FilesPanel.svelte +41 -3
- package/frontend/components/workspace/panels/GitPanel.svelte +41 -3
- package/frontend/stores/features/auth.svelte.ts +28 -0
- package/frontend/stores/ui/update.svelte.ts +6 -0
- package/package.json +2 -2
- package/scripts/dev.ts +3 -2
- package/scripts/start.ts +24 -0
- package/vite.config.ts +2 -2
|
@@ -187,6 +187,34 @@ export const authStore = {
|
|
|
187
187
|
debug.log('auth', `No-auth setup complete: ${result.user.name}`);
|
|
188
188
|
},
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Switch to with-auth mode mid-wizard (e.g. user changed selection after refresh).
|
|
192
|
+
* Regenerates PAT for the existing no-auth admin and updates authMode setting.
|
|
193
|
+
*/
|
|
194
|
+
async switchToWithAuth() {
|
|
195
|
+
const { loadSystemSettings, updateSystemSettings } = await import('$frontend/stores/features/settings.svelte');
|
|
196
|
+
await loadSystemSettings();
|
|
197
|
+
await updateSystemSettings({ authMode: 'required' });
|
|
198
|
+
|
|
199
|
+
const result = await ws.http('auth:regenerate-pat', {});
|
|
200
|
+
personalAccessToken = result.personalAccessToken;
|
|
201
|
+
authMode = 'required';
|
|
202
|
+
debug.log('auth', 'Switched to with-auth mode, PAT regenerated');
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Switch to no-auth mode mid-wizard (e.g. user changed selection after refresh).
|
|
207
|
+
* Only updates the authMode setting; existing user remains unchanged.
|
|
208
|
+
*/
|
|
209
|
+
async switchToNoAuth() {
|
|
210
|
+
const { loadSystemSettings, updateSystemSettings } = await import('$frontend/stores/features/settings.svelte');
|
|
211
|
+
await loadSystemSettings();
|
|
212
|
+
await updateSystemSettings({ authMode: 'none' });
|
|
213
|
+
|
|
214
|
+
authMode = 'none';
|
|
215
|
+
debug.log('auth', 'Switched to no-auth mode');
|
|
216
|
+
},
|
|
217
|
+
|
|
190
218
|
/**
|
|
191
219
|
* Complete setup — transition to ready state after wizard is done.
|
|
192
220
|
* Saves onboardingComplete flag so wizard won't show again.
|
|
@@ -15,6 +15,7 @@ interface UpdateState {
|
|
|
15
15
|
updating: boolean;
|
|
16
16
|
dismissed: boolean;
|
|
17
17
|
error: string | null;
|
|
18
|
+
errorType: 'check' | 'update' | null;
|
|
18
19
|
updateOutput: string | null;
|
|
19
20
|
updateSuccess: boolean;
|
|
20
21
|
}
|
|
@@ -27,6 +28,7 @@ export const updateState = $state<UpdateState>({
|
|
|
27
28
|
updating: false,
|
|
28
29
|
dismissed: false,
|
|
29
30
|
error: null,
|
|
31
|
+
errorType: null,
|
|
30
32
|
updateOutput: null,
|
|
31
33
|
updateSuccess: false
|
|
32
34
|
});
|
|
@@ -39,6 +41,7 @@ export async function checkForUpdate(): Promise<void> {
|
|
|
39
41
|
|
|
40
42
|
updateState.checking = true;
|
|
41
43
|
updateState.error = null;
|
|
44
|
+
updateState.errorType = null;
|
|
42
45
|
|
|
43
46
|
try {
|
|
44
47
|
const result = await ws.http('system:check-update', {});
|
|
@@ -53,6 +56,7 @@ export async function checkForUpdate(): Promise<void> {
|
|
|
53
56
|
}
|
|
54
57
|
} catch (err) {
|
|
55
58
|
updateState.error = err instanceof Error ? err.message : 'Failed to check for updates';
|
|
59
|
+
updateState.errorType = 'check';
|
|
56
60
|
debug.error('server', 'Update check failed:', err);
|
|
57
61
|
} finally {
|
|
58
62
|
updateState.checking = false;
|
|
@@ -65,6 +69,7 @@ export async function runUpdate(): Promise<void> {
|
|
|
65
69
|
|
|
66
70
|
updateState.updating = true;
|
|
67
71
|
updateState.error = null;
|
|
72
|
+
updateState.errorType = null;
|
|
68
73
|
updateState.updateOutput = null;
|
|
69
74
|
|
|
70
75
|
try {
|
|
@@ -77,6 +82,7 @@ export async function runUpdate(): Promise<void> {
|
|
|
77
82
|
debug.log('server', 'Update completed successfully');
|
|
78
83
|
} catch (err) {
|
|
79
84
|
updateState.error = err instanceof Error ? err.message : 'Update failed';
|
|
85
|
+
updateState.errorType = 'update';
|
|
80
86
|
debug.error('server', 'Update failed:', err);
|
|
81
87
|
} finally {
|
|
82
88
|
updateState.updating = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrialabs/clopen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "All-in-one web workspace for Claude Code & OpenCode — chat, terminal, git, browser preview, checkpoints, and real-time collaboration",
|
|
5
5
|
"author": "Myria Labs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dev:backend": "bun --watch backend/index.ts",
|
|
50
50
|
"dev:frontend": "bunx vite dev",
|
|
51
51
|
"build": "vite build",
|
|
52
|
-
"start": "
|
|
52
|
+
"start": "bun scripts/start.ts",
|
|
53
53
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
54
54
|
"lint": "eslint .",
|
|
55
55
|
"lint:fix": "eslint . --fix",
|
package/scripts/dev.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import concurrently from 'concurrently';
|
|
10
10
|
import { findAvailablePort } from '../backend/utils/port-utils';
|
|
11
11
|
|
|
12
|
-
const desiredBackend = process.env.PORT_BACKEND ? parseInt(process.env.PORT_BACKEND) :
|
|
13
|
-
const desiredFrontend = process.env.PORT_FRONTEND ? parseInt(process.env.PORT_FRONTEND) :
|
|
12
|
+
const desiredBackend = process.env.PORT_BACKEND ? parseInt(process.env.PORT_BACKEND) : 9161;
|
|
13
|
+
const desiredFrontend = process.env.PORT_FRONTEND ? parseInt(process.env.PORT_FRONTEND) : 9151;
|
|
14
14
|
|
|
15
15
|
// Resolve available ports
|
|
16
16
|
const backendPort = await findAvailablePort(desiredBackend);
|
|
@@ -33,6 +33,7 @@ console.log(`Frontend: http://localhost:${frontendPort}`);
|
|
|
33
33
|
console.log();
|
|
34
34
|
|
|
35
35
|
const portEnv = {
|
|
36
|
+
NODE_ENV: 'development',
|
|
36
37
|
PORT_BACKEND: String(backendPort),
|
|
37
38
|
PORT_FRONTEND: String(frontendPort),
|
|
38
39
|
};
|
package/scripts/start.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Production start script — resolves available port before starting backend.
|
|
5
|
+
* Mirrors scripts/dev.ts: ensures port is truly available (IPv4 + IPv6)
|
|
6
|
+
* before the backend binds, avoiding silent hangs from zombie processes.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { findAvailablePort } from '../backend/utils/port-utils';
|
|
10
|
+
|
|
11
|
+
const desiredPort = process.env.PORT ? parseInt(process.env.PORT) : 9141;
|
|
12
|
+
|
|
13
|
+
const port = await findAvailablePort(desiredPort);
|
|
14
|
+
|
|
15
|
+
if (port !== desiredPort) {
|
|
16
|
+
console.log(`⚠️ Port ${desiredPort} in use, using ${port}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Set resolved values before importing backend (env.ts reads at import time)
|
|
20
|
+
process.env.PORT = String(port);
|
|
21
|
+
process.env.HOST = process.env.HOST || 'localhost';
|
|
22
|
+
process.env.NODE_ENV = 'production';
|
|
23
|
+
|
|
24
|
+
await import('../backend/index.ts');
|
package/vite.config.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { defineConfig } from 'vite';
|
|
|
3
3
|
import tailwindcss from '@tailwindcss/vite';
|
|
4
4
|
import { resolve } from 'path';
|
|
5
5
|
|
|
6
|
-
const frontendPort = parseInt(process.env.PORT_FRONTEND || '
|
|
7
|
-
const backendPort = parseInt(process.env.PORT_BACKEND || '
|
|
6
|
+
const frontendPort = parseInt(process.env.PORT_FRONTEND || '9151');
|
|
7
|
+
const backendPort = parseInt(process.env.PORT_BACKEND || '9161');
|
|
8
8
|
|
|
9
9
|
export default defineConfig({
|
|
10
10
|
plugins: [tailwindcss(), svelte()],
|