shiva-code 0.8.2 → 0.8.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/dist/{chunk-HNIWPFMY.js → chunk-MCUAYZK2.js} +1 -1
- package/dist/{chunk-GHGMDDLO.js → chunk-XAWMZ6JB.js} +60 -1
- package/dist/index.js +12 -8
- package/dist/{manager-UAYJV6E3.js → manager-A6WMCVEP.js} +3 -1
- package/dist/{package-manager-U3IHQIDC.js → package-manager-T2HVNPEA.js} +2 -2
- package/package.json +1 -1
|
@@ -262,6 +262,15 @@ function isSessionCorruptedQuick(session) {
|
|
|
262
262
|
return true;
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
+
var API_ERROR_PATTERNS = [
|
|
266
|
+
"invalid_request_error",
|
|
267
|
+
"thinking.*blocks.*cannot be modified",
|
|
268
|
+
"redacted_thinking.*blocks.*cannot be modified",
|
|
269
|
+
"blocks must remain as they were in the original response",
|
|
270
|
+
"context_length_exceeded",
|
|
271
|
+
"rate_limit_exceeded",
|
|
272
|
+
"server_error.*500"
|
|
273
|
+
];
|
|
265
274
|
function isSessionCorrupted(session) {
|
|
266
275
|
const filePath = getSessionFilePath(session);
|
|
267
276
|
if (!fs.existsSync(filePath)) {
|
|
@@ -275,17 +284,66 @@ function isSessionCorrupted(session) {
|
|
|
275
284
|
const fd = fs.openSync(filePath, "r");
|
|
276
285
|
const buffer = Buffer.alloc(4096);
|
|
277
286
|
const bytesRead = fs.readSync(fd, buffer, 0, 4096, 0);
|
|
278
|
-
fs.closeSync(fd);
|
|
279
287
|
if (bytesRead === 0) {
|
|
288
|
+
fs.closeSync(fd);
|
|
280
289
|
return true;
|
|
281
290
|
}
|
|
282
291
|
const firstLine = buffer.toString("utf-8").split("\n")[0];
|
|
283
292
|
JSON.parse(firstLine);
|
|
293
|
+
const lastChunkSize = Math.min(32768, stats.size);
|
|
294
|
+
const lastBuffer = Buffer.alloc(lastChunkSize);
|
|
295
|
+
const lastBytesRead = fs.readSync(fd, lastBuffer, 0, lastChunkSize, Math.max(0, stats.size - lastChunkSize));
|
|
296
|
+
fs.closeSync(fd);
|
|
297
|
+
if (lastBytesRead > 0) {
|
|
298
|
+
const lastContent = lastBuffer.toString("utf-8");
|
|
299
|
+
for (const pattern of API_ERROR_PATTERNS) {
|
|
300
|
+
const regex = new RegExp(pattern, "i");
|
|
301
|
+
if (regex.test(lastContent)) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
284
306
|
return false;
|
|
285
307
|
} catch {
|
|
286
308
|
return true;
|
|
287
309
|
}
|
|
288
310
|
}
|
|
311
|
+
function getSessionCorruptionReason(session) {
|
|
312
|
+
const filePath = getSessionFilePath(session);
|
|
313
|
+
if (!fs.existsSync(filePath)) {
|
|
314
|
+
return "Datei nicht gefunden";
|
|
315
|
+
}
|
|
316
|
+
try {
|
|
317
|
+
const stats = fs.statSync(filePath);
|
|
318
|
+
if (stats.size > 100 * 1024 * 1024) {
|
|
319
|
+
return "Datei zu gro\xDF (>100MB)";
|
|
320
|
+
}
|
|
321
|
+
if (stats.size === 0) {
|
|
322
|
+
return "Datei ist leer";
|
|
323
|
+
}
|
|
324
|
+
const fd = fs.openSync(filePath, "r");
|
|
325
|
+
const lastChunkSize = Math.min(32768, stats.size);
|
|
326
|
+
const lastBuffer = Buffer.alloc(lastChunkSize);
|
|
327
|
+
fs.readSync(fd, lastBuffer, 0, lastChunkSize, Math.max(0, stats.size - lastChunkSize));
|
|
328
|
+
fs.closeSync(fd);
|
|
329
|
+
const lastContent = lastBuffer.toString("utf-8");
|
|
330
|
+
if (/thinking.*blocks.*cannot be modified|redacted_thinking/i.test(lastContent)) {
|
|
331
|
+
return "API Error: Thinking blocks corrupted";
|
|
332
|
+
}
|
|
333
|
+
if (/invalid_request_error/i.test(lastContent)) {
|
|
334
|
+
return "API Error: Invalid request";
|
|
335
|
+
}
|
|
336
|
+
if (/context_length_exceeded/i.test(lastContent)) {
|
|
337
|
+
return "Context overflow";
|
|
338
|
+
}
|
|
339
|
+
if (/rate_limit_exceeded/i.test(lastContent)) {
|
|
340
|
+
return "Rate limit erreicht";
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
} catch (e) {
|
|
344
|
+
return "Datei nicht lesbar";
|
|
345
|
+
}
|
|
346
|
+
}
|
|
289
347
|
function isSessionActive(session) {
|
|
290
348
|
const filePath = getSessionFilePath(session);
|
|
291
349
|
if (!fs.existsSync(filePath)) {
|
|
@@ -472,6 +530,7 @@ export {
|
|
|
472
530
|
getSessionFilePath,
|
|
473
531
|
isSessionCorruptedQuick,
|
|
474
532
|
isSessionCorrupted,
|
|
533
|
+
getSessionCorruptionReason,
|
|
475
534
|
isSessionActive,
|
|
476
535
|
parseSessionFile,
|
|
477
536
|
getRecoveredContext,
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
getPackageLaunchConfig,
|
|
35
35
|
getPackageStats,
|
|
36
36
|
removeProjectFromPackage
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-MCUAYZK2.js";
|
|
38
38
|
import {
|
|
39
39
|
containsShellMetacharacters,
|
|
40
40
|
encodeProjectPath,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
maskSecret,
|
|
59
59
|
sanitizeForLog,
|
|
60
60
|
saveRecoveredContext
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-XAWMZ6JB.js";
|
|
62
62
|
import {
|
|
63
63
|
cache
|
|
64
64
|
} from "./chunk-HIQO2DBA.js";
|
|
@@ -7674,13 +7674,13 @@ githubCommand.command("map").description("Aktuellen Branch mit einer Session ver
|
|
|
7674
7674
|
initShivaDir(cwd);
|
|
7675
7675
|
}
|
|
7676
7676
|
if (!sessionId) {
|
|
7677
|
-
const { findProject: findProject3 } = await import("./manager-
|
|
7677
|
+
const { findProject: findProject3 } = await import("./manager-A6WMCVEP.js");
|
|
7678
7678
|
const project = await findProject3(cwd);
|
|
7679
7679
|
if (!project || project.sessions.length === 0) {
|
|
7680
7680
|
log.error("Keine Sessions f\xFCr dieses Projekt gefunden");
|
|
7681
7681
|
return;
|
|
7682
7682
|
}
|
|
7683
|
-
const { formatDate: formatDate2 } = await import("./manager-
|
|
7683
|
+
const { formatDate: formatDate2 } = await import("./manager-A6WMCVEP.js");
|
|
7684
7684
|
const choices = project.sessions.slice(0, 10).map((s) => {
|
|
7685
7685
|
const time = formatDate2(s.modified);
|
|
7686
7686
|
const msgs = `${s.messageCount} msgs`;
|
|
@@ -15875,7 +15875,7 @@ hookCommand.command("branch-switch").description("Branch-Wechsel behandeln (f\xF
|
|
|
15875
15875
|
}
|
|
15876
15876
|
const { getCurrentBranch: getCurrentBranch2 } = await import("./api-OEHQTBH7.js");
|
|
15877
15877
|
const { getSessionForBranch: getSessionForBranch2, hasShivaDir: hasShivaDir3 } = await import("./config-D6M6LI6U.js");
|
|
15878
|
-
const { findProject: findProject3, findSessionByBranch: findSessionByBranch2, formatRelativeTime: formatRelativeTime2 } = await import("./manager-
|
|
15878
|
+
const { findProject: findProject3, findSessionByBranch: findSessionByBranch2, formatRelativeTime: formatRelativeTime2 } = await import("./manager-A6WMCVEP.js");
|
|
15879
15879
|
const projectPath = process.cwd();
|
|
15880
15880
|
const newBranch = getCurrentBranch2(projectPath);
|
|
15881
15881
|
let sessionInfo = null;
|
|
@@ -17036,7 +17036,7 @@ sandboxCommand.command("delete <id>").description("Sandbox l\xF6schen").option("
|
|
|
17036
17036
|
|
|
17037
17037
|
// src/index.ts
|
|
17038
17038
|
var program = new Command44();
|
|
17039
|
-
program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.8.
|
|
17039
|
+
program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.8.2").option("--debug", "Debug-Modus aktivieren").hook("preAction", (thisCommand) => {
|
|
17040
17040
|
const opts = thisCommand.opts();
|
|
17041
17041
|
if (opts.debug) {
|
|
17042
17042
|
enableDebug();
|
|
@@ -17221,7 +17221,11 @@ async function showDashboard() {
|
|
|
17221
17221
|
}
|
|
17222
17222
|
const projects = await getAllClaudeProjects();
|
|
17223
17223
|
const packages = getAllPackages();
|
|
17224
|
-
const recentProjects = projects.filter((p) =>
|
|
17224
|
+
const recentProjects = projects.filter((p) => {
|
|
17225
|
+
if (p.sessions.length === 0) return false;
|
|
17226
|
+
if (p.latestSession && isSessionCorrupted(p.latestSession)) return false;
|
|
17227
|
+
return true;
|
|
17228
|
+
}).slice(0, 5);
|
|
17225
17229
|
if (recentProjects.length === 0 && packages.length === 0) {
|
|
17226
17230
|
console.log(colors.dim(" Keine Sessions gefunden."));
|
|
17227
17231
|
log.newline();
|
|
@@ -17305,7 +17309,7 @@ async function showDashboard() {
|
|
|
17305
17309
|
const packageName = selected.data;
|
|
17306
17310
|
log.newline();
|
|
17307
17311
|
log.success(`Starte Package ${packageName}...`);
|
|
17308
|
-
const { getPackageLaunchConfig: getPackageLaunchConfig2 } = await import("./package-manager-
|
|
17312
|
+
const { getPackageLaunchConfig: getPackageLaunchConfig2 } = await import("./package-manager-T2HVNPEA.js");
|
|
17309
17313
|
const launches = await getPackageLaunchConfig2(packageName);
|
|
17310
17314
|
if (launches.length > 0) {
|
|
17311
17315
|
await spawnProjects(launches, detectTerminal());
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getClaudeProjectsPath,
|
|
13
13
|
getProjectName,
|
|
14
14
|
getRecoveredContext,
|
|
15
|
+
getSessionCorruptionReason,
|
|
15
16
|
getSessionFilePath,
|
|
16
17
|
getSessionIndex,
|
|
17
18
|
getSessionIndexAsync,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
isSessionCorruptedQuick,
|
|
23
24
|
parseSessionFile,
|
|
24
25
|
saveRecoveredContext
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-XAWMZ6JB.js";
|
|
26
27
|
import "./chunk-HIQO2DBA.js";
|
|
27
28
|
import "./chunk-3RG5ZIWI.js";
|
|
28
29
|
export {
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
getClaudeProjectsPath,
|
|
40
41
|
getProjectName,
|
|
41
42
|
getRecoveredContext,
|
|
43
|
+
getSessionCorruptionReason,
|
|
42
44
|
getSessionFilePath,
|
|
43
45
|
getSessionIndex,
|
|
44
46
|
getSessionIndexAsync,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
getPackageStats,
|
|
10
10
|
removeProjectFromPackage,
|
|
11
11
|
updatePackage
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-MCUAYZK2.js";
|
|
13
|
+
import "./chunk-XAWMZ6JB.js";
|
|
14
14
|
import "./chunk-HIQO2DBA.js";
|
|
15
15
|
import "./chunk-3RG5ZIWI.js";
|
|
16
16
|
export {
|