kiro-mobile-bridge 1.0.0 → 1.0.1
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/package.json +1 -1
- package/src/server.js +7 -26
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -739,11 +739,7 @@ async function captureTerminal(cdp) {
|
|
|
739
739
|
returnByValue: true
|
|
740
740
|
});
|
|
741
741
|
if (result.result && result.result.value) {
|
|
742
|
-
|
|
743
|
-
if (data.hasContent) {
|
|
744
|
-
console.log(`[Terminal] Captured ${data.textContent.length} chars of output`);
|
|
745
|
-
}
|
|
746
|
-
return data;
|
|
742
|
+
return result.result.value;
|
|
747
743
|
}
|
|
748
744
|
} catch (err) {
|
|
749
745
|
console.error('[Terminal] Failed to capture:', err.message);
|
|
@@ -1132,9 +1128,7 @@ async function pollSnapshots() {
|
|
|
1132
1128
|
|
|
1133
1129
|
// Capture CSS once if not already captured
|
|
1134
1130
|
if (cascade.css === null) {
|
|
1135
|
-
console.log(`[Snapshot] Capturing CSS for cascade ${cascadeId}...`);
|
|
1136
1131
|
cascade.css = await captureCSS(cdp);
|
|
1137
|
-
console.log(`[Snapshot] CSS captured: ${cascade.css.length} chars`);
|
|
1138
1132
|
}
|
|
1139
1133
|
|
|
1140
1134
|
// Capture metadata
|
|
@@ -1146,20 +1140,12 @@ async function pollSnapshots() {
|
|
|
1146
1140
|
const snapshot = await captureSnapshot(cdp);
|
|
1147
1141
|
|
|
1148
1142
|
if (snapshot) {
|
|
1149
|
-
// Log debug info for troubleshooting
|
|
1150
|
-
if (snapshot.debug) {
|
|
1151
|
-
console.log(`[Snapshot] Debug for ${cascadeId}:`, JSON.stringify(snapshot.debug, null, 2));
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
1143
|
const newHash = computeHash(snapshot.html);
|
|
1155
1144
|
if (newHash !== cascade.snapshotHash) {
|
|
1156
|
-
console.log(`[Snapshot] Chat content changed for cascade ${cascadeId} (${snapshot.html.length} chars)`);
|
|
1157
1145
|
cascade.snapshot = snapshot;
|
|
1158
1146
|
cascade.snapshotHash = newHash;
|
|
1159
1147
|
broadcastSnapshotUpdate(cascadeId, 'chat');
|
|
1160
1148
|
}
|
|
1161
|
-
} else {
|
|
1162
|
-
console.log(`[Snapshot] captureSnapshot returned null for cascade ${cascadeId}`);
|
|
1163
1149
|
}
|
|
1164
1150
|
|
|
1165
1151
|
// Use main window CDP for terminal/sidebar/editor
|
|
@@ -1170,7 +1156,6 @@ async function pollSnapshots() {
|
|
|
1170
1156
|
if (terminal && terminal.hasContent) {
|
|
1171
1157
|
const termHash = computeHash(terminal.html || terminal.textContent || '');
|
|
1172
1158
|
if (termHash !== cascade.terminalHash) {
|
|
1173
|
-
console.log(`[Snapshot] Terminal content changed for cascade ${cascadeId}`);
|
|
1174
1159
|
cascade.terminal = terminal;
|
|
1175
1160
|
cascade.terminalHash = termHash;
|
|
1176
1161
|
broadcastSnapshotUpdate(cascadeId, 'terminal');
|
|
@@ -1182,7 +1167,6 @@ async function pollSnapshots() {
|
|
|
1182
1167
|
if (sidebar && sidebar.hasContent) {
|
|
1183
1168
|
const sideHash = computeHash(JSON.stringify(sidebar.files) + sidebar.html);
|
|
1184
1169
|
if (sideHash !== cascade.sidebarHash) {
|
|
1185
|
-
console.log(`[Snapshot] Sidebar content changed for cascade ${cascadeId}`);
|
|
1186
1170
|
cascade.sidebar = sidebar;
|
|
1187
1171
|
cascade.sidebarHash = sideHash;
|
|
1188
1172
|
broadcastSnapshotUpdate(cascadeId, 'sidebar');
|
|
@@ -1194,14 +1178,12 @@ async function pollSnapshots() {
|
|
|
1194
1178
|
if (editor && editor.hasContent) {
|
|
1195
1179
|
const editorHash = computeHash(editor.content + editor.fileName);
|
|
1196
1180
|
if (editorHash !== cascade.editorHash) {
|
|
1197
|
-
console.log(`[Snapshot] Editor content changed for cascade ${cascadeId}`);
|
|
1198
1181
|
cascade.editor = editor;
|
|
1199
1182
|
cascade.editorHash = editorHash;
|
|
1200
1183
|
broadcastSnapshotUpdate(cascadeId, 'editor');
|
|
1201
1184
|
}
|
|
1202
1185
|
} else if (cascade.editor && cascade.editor.hasContent) {
|
|
1203
1186
|
// Clear stale editor data when no file is open
|
|
1204
|
-
console.log(`[Snapshot] Editor closed/no file open for cascade ${cascadeId}`);
|
|
1205
1187
|
cascade.editor = { hasContent: false, fileName: '', content: '' };
|
|
1206
1188
|
cascade.editorHash = '';
|
|
1207
1189
|
broadcastSnapshotUpdate(cascadeId, 'editor');
|
|
@@ -1571,8 +1553,7 @@ async function discoverTargets() {
|
|
|
1571
1553
|
}
|
|
1572
1554
|
}
|
|
1573
1555
|
} catch (err) {
|
|
1574
|
-
// Port not available or no CDP server
|
|
1575
|
-
console.log(`[Discovery] Port ${port}: ${err.message}`);
|
|
1556
|
+
// Port not available or no CDP server - silent unless debugging
|
|
1576
1557
|
}
|
|
1577
1558
|
}
|
|
1578
1559
|
|
|
@@ -1588,7 +1569,7 @@ async function discoverTargets() {
|
|
|
1588
1569
|
}
|
|
1589
1570
|
}
|
|
1590
1571
|
|
|
1591
|
-
console.log(`[Discovery] Active cascades: ${cascades.size}`);
|
|
1572
|
+
console.log(`[Discovery] Active cascades: ${cascades.size}${foundMainWindow ? ' (main window connected)' : ''}`);
|
|
1592
1573
|
}
|
|
1593
1574
|
|
|
1594
1575
|
/**
|
|
@@ -1867,10 +1848,10 @@ app.post('/readFile/:id', async (req, res) => {
|
|
|
1867
1848
|
}
|
|
1868
1849
|
}
|
|
1869
1850
|
|
|
1870
|
-
// Then search subdirectories (skip node_modules, .git, etc.)
|
|
1851
|
+
// Then search subdirectories (skip node_modules, .git, etc. but allow .kiro)
|
|
1871
1852
|
for (const entry of entries) {
|
|
1872
1853
|
if (entry.isDirectory() &&
|
|
1873
|
-
!entry.name.startsWith('.') &&
|
|
1854
|
+
(!entry.name.startsWith('.') || entry.name === '.kiro') &&
|
|
1874
1855
|
entry.name !== 'node_modules' &&
|
|
1875
1856
|
entry.name !== 'dist' &&
|
|
1876
1857
|
entry.name !== 'build' &&
|
|
@@ -2110,8 +2091,8 @@ app.get('/files/:id', async (req, res) => {
|
|
|
2110
2091
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
2111
2092
|
|
|
2112
2093
|
for (const entry of entries) {
|
|
2113
|
-
// Skip hidden files/folders and common non-code directories
|
|
2114
|
-
if (entry.name.startsWith('.') ||
|
|
2094
|
+
// Skip hidden files/folders EXCEPT .kiro, and common non-code directories
|
|
2095
|
+
if ((entry.name.startsWith('.') && entry.name !== '.kiro') ||
|
|
2115
2096
|
entry.name === 'node_modules' ||
|
|
2116
2097
|
entry.name === 'dist' ||
|
|
2117
2098
|
entry.name === 'build' ||
|