@myrialabs/clopen 0.3.12 → 0.3.13
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/backend/auth/session-invalidation.test.ts +45 -1
- package/backend/auth/session-invalidation.ts +35 -1
- package/backend/database/migrations/037_repair_auth_audit_log_schema.ts +38 -0
- package/backend/database/migrations/index.ts +7 -0
- package/backend/engine/README.md +101 -29
- package/backend/engine/adapters/codex/stream.ts +54 -1
- package/backend/engine/adapters/copilot/stream.ts +79 -19
- package/backend/engine/adapters/opencode/stream.ts +23 -23
- package/backend/engine/adapters/qwen/stream.ts +83 -1
- package/backend/engine/structured-helpers.ts +59 -0
- package/backend/files/file-archive.ts +191 -0
- package/backend/files/file-operations.ts +18 -65
- package/backend/files/file-size-limit.test.ts +71 -15
- package/backend/files/file-size-limit.ts +36 -8
- package/backend/http/files-upload.ts +168 -0
- package/backend/index.ts +8 -0
- package/backend/mcp/servers/helper.ts +5 -1
- package/backend/terminal/pty-session-manager.ts +3 -0
- package/backend/terminal/stream-manager.ts +1 -1
- package/backend/ws/auth/users.ts +1 -1
- package/backend/ws/files/path-access.test.ts +166 -0
- package/backend/ws/files/path-access.ts +56 -22
- package/backend/ws/files/read.ts +5 -5
- package/backend/ws/files/write.ts +47 -25
- package/backend/ws/git/commit-message.ts +12 -5
- package/backend/ws/terminal/session.ts +1 -0
- package/dist/assets/main-BqiSLc8F.css +1 -0
- package/dist/assets/{main-HIDO3ugS.js → main-DOVudc3_.js} +232 -231
- package/dist/index.html +2 -2
- package/package.json +8 -7
- package/shared/types/git.ts +4 -2
- package/shared/types/stores/settings.ts +2 -0
- package/shared/utils/ws-server.ts +6 -0
- package/backend/engine/adapters/copilot/session-fork.ts +0 -111
- package/dist/assets/main-C2JiGYnx.css +0 -1
package/dist/index.html
CHANGED
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
})();
|
|
60
60
|
</script>
|
|
61
|
-
<script type="module" crossorigin src="/assets/main-
|
|
62
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
61
|
+
<script type="module" crossorigin src="/assets/main-DOVudc3_.js"></script>
|
|
62
|
+
<link rel="stylesheet" crossorigin href="/assets/main-BqiSLc8F.css">
|
|
63
63
|
</head>
|
|
64
64
|
<body
|
|
65
65
|
class="min-h-dvh bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100 transition-colors duration-200"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrialabs/clopen",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
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",
|
|
@@ -87,16 +87,16 @@
|
|
|
87
87
|
"vite": "^7.0.4"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@anthropic-ai/claude-agent-sdk": "^0.
|
|
91
|
-
"@anthropic-ai/sdk": "^0.
|
|
90
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.148",
|
|
91
|
+
"@anthropic-ai/sdk": "^0.98.0",
|
|
92
92
|
"@elysiajs/cors": "^1.4.0",
|
|
93
|
-
"@github/copilot-sdk": "^0.
|
|
93
|
+
"@github/copilot-sdk": "^1.0.0-beta.4",
|
|
94
94
|
"@iconify-json/lucide": "^1.2.57",
|
|
95
95
|
"@iconify-json/material-icon-theme": "^1.2.16",
|
|
96
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
96
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
97
97
|
"@monaco-editor/loader": "^1.5.0",
|
|
98
|
-
"@openai/codex-sdk": "^0.
|
|
99
|
-
"@opencode-ai/sdk": "^1.
|
|
98
|
+
"@openai/codex-sdk": "^0.133.0",
|
|
99
|
+
"@opencode-ai/sdk": "^1.15.7",
|
|
100
100
|
"@qwen-code/sdk": "^0.1.7",
|
|
101
101
|
"@xterm/addon-clipboard": "^0.2.0",
|
|
102
102
|
"@xterm/addon-fit": "^0.11.0",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"@xterm/xterm": "^6.0.0",
|
|
109
109
|
"bun-pty": "^0.4.2",
|
|
110
110
|
"elysia": "^1.4.19",
|
|
111
|
+
"fflate": "^0.8.3",
|
|
111
112
|
"file-type": "^21.0.0",
|
|
112
113
|
"is-text-path": "^3.0.0",
|
|
113
114
|
"marked": "^16.1.1",
|
package/shared/types/git.ts
CHANGED
|
@@ -180,7 +180,9 @@ export type CommitMessageFormat = 'single-line' | 'multi-line';
|
|
|
180
180
|
/** Structured commit message output from AI */
|
|
181
181
|
export interface GeneratedCommitMessage {
|
|
182
182
|
type: string;
|
|
183
|
-
scope
|
|
183
|
+
/** Null when no scope applies — strict-schema engines (Codex) require explicit null over omission. */
|
|
184
|
+
scope: string | null;
|
|
184
185
|
subject: string;
|
|
185
|
-
|
|
186
|
+
/** Null for single-line commits — strict-schema engines (Codex) require explicit null over omission. */
|
|
187
|
+
body: string | null;
|
|
186
188
|
}
|
|
@@ -50,4 +50,6 @@ export interface SystemSettings {
|
|
|
50
50
|
autoUpdate: boolean;
|
|
51
51
|
/** Session lifetime in days. Default: 30. */
|
|
52
52
|
sessionLifetimeDays: number;
|
|
53
|
+
/** Maximum file size (megabytes) for write, upload, zip, and extract operations. Default: 500. */
|
|
54
|
+
maxFileSizeMB: number;
|
|
53
55
|
}
|
|
@@ -668,6 +668,12 @@ export class WSRouter<
|
|
|
668
668
|
asPlugin(path: string = '/ws') {
|
|
669
669
|
return (app: Elysia) => {
|
|
670
670
|
return app.ws(path, {
|
|
671
|
+
// Allow large binary frames (file uploads, zip extracts).
|
|
672
|
+
// Bun/uWS default is 16MB which trips EPIPE on the dev proxy
|
|
673
|
+
// long before the configurable per-file limit kicks in.
|
|
674
|
+
maxPayloadLength: 1024 * 1024 * 1024, // 1 GiB
|
|
675
|
+
// Disable inactivity disconnects during long binary transfers.
|
|
676
|
+
idleTimeout: 960, // seconds (max allowed by uWS)
|
|
671
677
|
message: (conn, message) => {
|
|
672
678
|
this.handleMessage(conn, message);
|
|
673
679
|
},
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copilot Session Fork (workaround)
|
|
3
|
-
*
|
|
4
|
-
* The Copilot SDK does not yet expose a native `forkSession()` API
|
|
5
|
-
* (tracking issues: github/copilot-cli#1313, #1697, #2058). To support our
|
|
6
|
-
* multi-branch checkpoints feature — which lets the user replay an earlier
|
|
7
|
-
* point in the conversation as a sibling branch — we replicate the SDK's
|
|
8
|
-
* own recommended workaround: copy the on-disk session state directory to
|
|
9
|
-
* a fresh ID and patch the embedded session identifiers.
|
|
10
|
-
*
|
|
11
|
-
* On-disk layout (`~/.copilot/session-state/<sessionId>/`):
|
|
12
|
-
* ├── workspace.yaml — first line is `id: <sessionId>`
|
|
13
|
-
* ├── events.jsonl — first event is `session.start { data.sessionId }`
|
|
14
|
-
* ├── checkpoints/
|
|
15
|
-
* ├── files/
|
|
16
|
-
* └── research/
|
|
17
|
-
*
|
|
18
|
-
* Both `workspace.yaml#id` and the first `events.jsonl` line's
|
|
19
|
-
* `data.sessionId` must be rewritten to the new ID so that resume picks the
|
|
20
|
-
* fork up as an independent session.
|
|
21
|
-
*
|
|
22
|
-
* TODO: When @github/copilot-sdk gains a native `forkSession()` (or an
|
|
23
|
-
* equivalent like `client.session.fork()`), delete this helper and switch
|
|
24
|
-
* `CopilotEngine.streamQuery` to use the SDK API directly — the same way
|
|
25
|
-
* the Claude adapter passes `forkSession: true` and the OpenCode adapter
|
|
26
|
-
* calls `client.session.fork({ path: { id } })`.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import fs from 'node:fs';
|
|
30
|
-
import path from 'node:path';
|
|
31
|
-
import os from 'node:os';
|
|
32
|
-
import { debug } from '$shared/utils/logger';
|
|
33
|
-
|
|
34
|
-
const SESSION_STATE_DIR = path.join(os.homedir(), '.copilot', 'session-state');
|
|
35
|
-
|
|
36
|
-
export function getSessionStatePath(sessionId: string): string {
|
|
37
|
-
return path.join(SESSION_STATE_DIR, sessionId);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function sessionStateExists(sessionId: string): boolean {
|
|
41
|
-
return fs.existsSync(getSessionStatePath(sessionId));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Copy `sourceSessionId`'s state directory to `forkSessionId` and patch the
|
|
46
|
-
* session identifiers stored inside. Returns true on success, false if the
|
|
47
|
-
* source directory is missing (caller should fall back to a fresh session).
|
|
48
|
-
*
|
|
49
|
-
* The destination is removed first if it already exists so a re-fork from
|
|
50
|
-
* the same source produces a clean copy.
|
|
51
|
-
*/
|
|
52
|
-
export function forkCopilotSessionState(sourceSessionId: string, forkSessionId: string): boolean {
|
|
53
|
-
const srcDir = getSessionStatePath(sourceSessionId);
|
|
54
|
-
const dstDir = getSessionStatePath(forkSessionId);
|
|
55
|
-
|
|
56
|
-
if (!fs.existsSync(srcDir)) {
|
|
57
|
-
debug.warn('engine', `Copilot fork: source session ${sourceSessionId} not found on disk`);
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (fs.existsSync(dstDir)) {
|
|
62
|
-
fs.rmSync(dstDir, { recursive: true, force: true });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
fs.cpSync(srcDir, dstDir, { recursive: true });
|
|
66
|
-
patchWorkspaceYaml(dstDir, forkSessionId);
|
|
67
|
-
patchEventsJsonl(dstDir, forkSessionId);
|
|
68
|
-
|
|
69
|
-
debug.log('engine', `Copilot fork: ${sourceSessionId} → ${forkSessionId}`);
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Replace the `id:` field at the top of workspace.yaml with the fork ID.
|
|
75
|
-
* The file is a small YAML map written by the SDK with one key per line, so
|
|
76
|
-
* a targeted regex replace is safer than parsing & re-serialising YAML
|
|
77
|
-
* (which would lose comments / formatting).
|
|
78
|
-
*/
|
|
79
|
-
function patchWorkspaceYaml(dstDir: string, forkSessionId: string): void {
|
|
80
|
-
const wsPath = path.join(dstDir, 'workspace.yaml');
|
|
81
|
-
if (!fs.existsSync(wsPath)) return;
|
|
82
|
-
|
|
83
|
-
const original = fs.readFileSync(wsPath, 'utf-8');
|
|
84
|
-
const patched = original.replace(/^id:\s*.*$/m, `id: ${forkSessionId}`);
|
|
85
|
-
fs.writeFileSync(wsPath, patched);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Rewrite `data.sessionId` on the first line of events.jsonl (the
|
|
90
|
-
* `session.start` event) so the SDK's resume path treats this directory
|
|
91
|
-
* as the fork's own history.
|
|
92
|
-
*/
|
|
93
|
-
function patchEventsJsonl(dstDir: string, forkSessionId: string): void {
|
|
94
|
-
const evPath = path.join(dstDir, 'events.jsonl');
|
|
95
|
-
if (!fs.existsSync(evPath)) return;
|
|
96
|
-
|
|
97
|
-
const raw = fs.readFileSync(evPath, 'utf-8');
|
|
98
|
-
const newlineIdx = raw.indexOf('\n');
|
|
99
|
-
const firstLine = newlineIdx === -1 ? raw : raw.slice(0, newlineIdx);
|
|
100
|
-
const rest = newlineIdx === -1 ? '' : raw.slice(newlineIdx);
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
const parsed = JSON.parse(firstLine) as { data?: { sessionId?: string } };
|
|
104
|
-
if (parsed?.data) {
|
|
105
|
-
parsed.data.sessionId = forkSessionId;
|
|
106
|
-
fs.writeFileSync(evPath, JSON.stringify(parsed) + rest);
|
|
107
|
-
}
|
|
108
|
-
} catch (err) {
|
|
109
|
-
debug.warn('engine', `Copilot fork: failed to patch events.jsonl session.start (non-fatal):`, err);
|
|
110
|
-
}
|
|
111
|
-
}
|