@myrialabs/clopen 0.4.9 → 0.4.11

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/dist/index.html CHANGED
@@ -58,8 +58,8 @@
58
58
  }
59
59
  })();
60
60
  </script>
61
- <script type="module" crossorigin src="/assets/main-Cf8SUfQ1.js"></script>
62
- <link rel="stylesheet" crossorigin href="/assets/main-D4pdkiQK.css">
61
+ <script type="module" crossorigin src="/assets/main-CpHuyjKj.js"></script>
62
+ <link rel="stylesheet" crossorigin href="/assets/main-BuHGZ-di.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.4.9",
3
+ "version": "0.4.11",
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",
@@ -93,35 +93,35 @@
93
93
  "dependencies": {
94
94
  "@anthropic-ai/claude-agent-sdk": "0.3.158",
95
95
  "@anthropic-ai/sdk": "0.100.1",
96
- "@elysiajs/cors": "^1.4.0",
96
+ "@elysiajs/cors": "1.4.1",
97
97
  "@github/copilot-sdk": "1.0.0-beta.9",
98
- "@iconify-json/lucide": "^1.2.57",
99
- "@iconify-json/material-icon-theme": "^1.2.16",
98
+ "@iconify-json/lucide": "1.2.96",
99
+ "@iconify-json/material-icon-theme": "1.2.55",
100
100
  "@modelcontextprotocol/sdk": "1.29.0",
101
- "@monaco-editor/loader": "^1.5.0",
102
- "@myrialabs/ptykit": "^0.0.5",
103
- "@myrialabs/tunnelkit": "^0.0.15",
104
- "@myrialabs/zipkit": "^0.0.11",
101
+ "@monaco-editor/loader": "1.7.0",
102
+ "@myrialabs/ptykit": "0.0.5",
103
+ "@myrialabs/tunnelkit": "0.0.15",
104
+ "@myrialabs/zipkit": "0.0.11",
105
105
  "@openai/codex-sdk": "0.135.0",
106
106
  "@opencode-ai/sdk": "1.15.12",
107
107
  "@qwen-code/sdk": "0.1.7",
108
108
  "@sinclair/typebox": "0.34.48",
109
- "bun-pty": "^0.4.2",
110
- "dompurify": "^3.4.9",
111
- "elysia": "^1.4.19",
112
- "file-type": "^21.0.0",
113
- "is-text-path": "^3.0.0",
114
- "marked": "^16.1.1",
115
- "monaco-editor": "^0.52.2",
116
- "mongodb": "^7.2.0",
117
- "nanoid": "^5.1.6",
118
- "puppeteer": "^24.37.5",
119
- "puppeteer-extra": "^3.3.6",
120
- "puppeteer-extra-plugin-stealth": "^2.11.2",
121
- "qrcode": "^1.5.4",
122
- "sharp": "^0.34.5",
123
- "ssh2": "^1.17.0",
124
- "xz-decompress": "^0.2.3"
109
+ "bson": "7.2.0",
110
+ "bun-pty": "0.4.8",
111
+ "dompurify": "3.4.9",
112
+ "elysia": "1.4.27",
113
+ "file-type": "21.3.1",
114
+ "is-text-path": "3.0.0",
115
+ "marked": "16.4.2",
116
+ "monaco-editor": "0.52.2",
117
+ "mongodb": "7.2.0",
118
+ "nanoid": "5.1.6",
119
+ "puppeteer": "24.38.0",
120
+ "puppeteer-extra": "3.3.6",
121
+ "puppeteer-extra-plugin-stealth": "2.11.2",
122
+ "qrcode": "1.5.4",
123
+ "sharp": "0.34.5",
124
+ "ssh2": "1.17.0"
125
125
  },
126
126
  "trustedDependencies": [
127
127
  "puppeteer",
@@ -141,6 +141,12 @@ export interface GitLogResult {
141
141
  hasMore: boolean;
142
142
  }
143
143
 
144
+ export interface GitCommitDiff {
145
+ files: GitFileDiff[];
146
+ subject: string;
147
+ body: string;
148
+ }
149
+
144
150
  // ============================================
145
151
  // Conflict Types
146
152
  // ============================================
@@ -114,6 +114,19 @@ export function getDetailedFileDiffs(
114
114
  return diffs;
115
115
  }
116
116
 
117
+ /**
118
+ * Count only the lines that actually changed between two strings, using the
119
+ * same LCS-based diff as git — identical (context) lines are excluded. Use this
120
+ * for +/- badges instead of naively counting every line of each side.
121
+ */
122
+ export function countLineChanges(
123
+ oldContent: string,
124
+ newContent: string
125
+ ): { additions: number; deletions: number } {
126
+ const { insertions, deletions } = calculateLineDiff(oldContent, newContent);
127
+ return { additions: insertions, deletions };
128
+ }
129
+
117
130
  /**
118
131
  * Calculate line-level diff between two file contents
119
132
  * Uses simple line-by-line comparison (similar to diff -u)
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Single source of truth for the "is this conversation waiting for user input?"
3
+ * derivation. Both the backend presence layer (status-manager) and the frontend
4
+ * chat service consume this so the logic can never drift between them.
5
+ *
6
+ * Historically this logic was duplicated in three places with subtly different
7
+ * rules, which let the "Needs input" status get stuck after an interrupt →
8
+ * continue flow. Keeping one pure function here removes that class of bug.
9
+ */
10
+
11
+ /** Tools that block the stream waiting for a user response. */
12
+ export const INTERACTIVE_TOOLS = new Set(['AskUserQuestion']);
13
+
14
+ /** Minimal structural shape shared by UnifiedMessage and its frontend supersets. */
15
+ interface WaitingInputMessage {
16
+ type: string;
17
+ stopReason?: string | null;
18
+ content?: unknown;
19
+ }
20
+
21
+ interface WaitingInputBlock {
22
+ type: string;
23
+ name?: string;
24
+ interrupted?: boolean;
25
+ }
26
+
27
+ /**
28
+ * A conversation is "waiting for user input" if and only if its trailing turn
29
+ * contains an unanswered, non-interrupted interactive tool_use.
30
+ *
31
+ * The rule is intentionally derived from message ordering rather than tracked
32
+ * imperatively, so it stays correct across every entry path:
33
+ * - Answered normally → the tool_result (a user message) lands after the
34
+ * question, so the question is no longer trailing.
35
+ * - Interrupted → continue → the follow-up user message lands after the
36
+ * question, so it is no longer trailing (was the bug).
37
+ * - Interrupted, no follow → the question turn is marked interrupted (via the
38
+ * message stopReason or the block flag) and skipped.
39
+ * - Genuinely pending → the question is the trailing turn and counts.
40
+ *
41
+ * Both interrupted representations are honored (message `stopReason` set by the
42
+ * backend, block `interrupted` set by the frontend) so the reader tolerates
43
+ * either signal regardless of which side produced the messages.
44
+ */
45
+ export function isWaitingForInteractiveInput(messages: readonly WaitingInputMessage[]): boolean {
46
+ // Find the index of the last user message — anything before it has already
47
+ // been superseded by subsequent user activity and cannot be pending.
48
+ let lastUserIndex = -1;
49
+ for (let i = 0; i < messages.length; i++) {
50
+ if (messages[i]?.type === 'user') lastUserIndex = i;
51
+ }
52
+
53
+ for (let i = lastUserIndex + 1; i < messages.length; i++) {
54
+ const msg = messages[i];
55
+ if (!msg || msg.type !== 'assistant') continue;
56
+ // An interrupted assistant turn never counts as waiting.
57
+ if (msg.stopReason === 'interrupted') continue;
58
+ if (!Array.isArray(msg.content)) continue;
59
+
60
+ const hasPending = (msg.content as WaitingInputBlock[]).some(
61
+ block =>
62
+ block?.type === 'tool_use' &&
63
+ !!block.name &&
64
+ INTERACTIVE_TOOLS.has(block.name) &&
65
+ !block.interrupted
66
+ );
67
+ if (hasPending) return true;
68
+ }
69
+
70
+ return false;
71
+ }