shiva-code 0.8.1 → 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 +32 -9
- 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";
|
|
@@ -4225,6 +4225,25 @@ async function spawnInTmux(projects, sessionName) {
|
|
|
4225
4225
|
"-c",
|
|
4226
4226
|
project.projectPath
|
|
4227
4227
|
], { stdio: "inherit" });
|
|
4228
|
+
const tmuxStyleCommands = [
|
|
4229
|
+
// Status bar background: dark with orange accent
|
|
4230
|
+
["set-option", "-t", tmuxSession, "status-style", "bg=#1a1a1a,fg=#00D4FF"],
|
|
4231
|
+
// Left side: SHIVA branding
|
|
4232
|
+
["set-option", "-t", tmuxSession, "status-left", "#[fg=#FF6B2C,bold][shiva-#{session_id}:#{window_name}] "],
|
|
4233
|
+
["set-option", "-t", tmuxSession, "status-left-length", "30"],
|
|
4234
|
+
// Right side: info
|
|
4235
|
+
["set-option", "-t", tmuxSession, "status-right", '#[fg=#00D4FF]"#{pane_title}" #[fg=#FF6B2C]%H:%M %d-%b-%y'],
|
|
4236
|
+
["set-option", "-t", tmuxSession, "status-right-length", "50"],
|
|
4237
|
+
// Window status styling
|
|
4238
|
+
["set-option", "-t", tmuxSession, "window-status-current-style", "fg=#FF6B2C,bold"],
|
|
4239
|
+
["set-option", "-t", tmuxSession, "window-status-style", "fg=#666666"],
|
|
4240
|
+
// Pane border colors
|
|
4241
|
+
["set-option", "-t", tmuxSession, "pane-border-style", "fg=#333333"],
|
|
4242
|
+
["set-option", "-t", tmuxSession, "pane-active-border-style", "fg=#FF6B2C"]
|
|
4243
|
+
];
|
|
4244
|
+
for (const cmd of tmuxStyleCommands) {
|
|
4245
|
+
spawnSync2("tmux", cmd, { stdio: "ignore" });
|
|
4246
|
+
}
|
|
4228
4247
|
} else {
|
|
4229
4248
|
spawnSync2("tmux", [
|
|
4230
4249
|
"new-window",
|
|
@@ -7655,13 +7674,13 @@ githubCommand.command("map").description("Aktuellen Branch mit einer Session ver
|
|
|
7655
7674
|
initShivaDir(cwd);
|
|
7656
7675
|
}
|
|
7657
7676
|
if (!sessionId) {
|
|
7658
|
-
const { findProject: findProject3 } = await import("./manager-
|
|
7677
|
+
const { findProject: findProject3 } = await import("./manager-A6WMCVEP.js");
|
|
7659
7678
|
const project = await findProject3(cwd);
|
|
7660
7679
|
if (!project || project.sessions.length === 0) {
|
|
7661
7680
|
log.error("Keine Sessions f\xFCr dieses Projekt gefunden");
|
|
7662
7681
|
return;
|
|
7663
7682
|
}
|
|
7664
|
-
const { formatDate: formatDate2 } = await import("./manager-
|
|
7683
|
+
const { formatDate: formatDate2 } = await import("./manager-A6WMCVEP.js");
|
|
7665
7684
|
const choices = project.sessions.slice(0, 10).map((s) => {
|
|
7666
7685
|
const time = formatDate2(s.modified);
|
|
7667
7686
|
const msgs = `${s.messageCount} msgs`;
|
|
@@ -12701,7 +12720,7 @@ function detectInstallationType() {
|
|
|
12701
12720
|
}
|
|
12702
12721
|
return "npm";
|
|
12703
12722
|
}
|
|
12704
|
-
var CLI_VERSION = "0.8.
|
|
12723
|
+
var CLI_VERSION = "0.8.2";
|
|
12705
12724
|
function getCurrentVersion() {
|
|
12706
12725
|
try {
|
|
12707
12726
|
const output = execSync3(`npm list -g ${PACKAGE_NAME} --depth=0 --json 2>/dev/null`, {
|
|
@@ -15856,7 +15875,7 @@ hookCommand.command("branch-switch").description("Branch-Wechsel behandeln (f\xF
|
|
|
15856
15875
|
}
|
|
15857
15876
|
const { getCurrentBranch: getCurrentBranch2 } = await import("./api-OEHQTBH7.js");
|
|
15858
15877
|
const { getSessionForBranch: getSessionForBranch2, hasShivaDir: hasShivaDir3 } = await import("./config-D6M6LI6U.js");
|
|
15859
|
-
const { findProject: findProject3, findSessionByBranch: findSessionByBranch2, formatRelativeTime: formatRelativeTime2 } = await import("./manager-
|
|
15878
|
+
const { findProject: findProject3, findSessionByBranch: findSessionByBranch2, formatRelativeTime: formatRelativeTime2 } = await import("./manager-A6WMCVEP.js");
|
|
15860
15879
|
const projectPath = process.cwd();
|
|
15861
15880
|
const newBranch = getCurrentBranch2(projectPath);
|
|
15862
15881
|
let sessionInfo = null;
|
|
@@ -17017,7 +17036,7 @@ sandboxCommand.command("delete <id>").description("Sandbox l\xF6schen").option("
|
|
|
17017
17036
|
|
|
17018
17037
|
// src/index.ts
|
|
17019
17038
|
var program = new Command44();
|
|
17020
|
-
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) => {
|
|
17021
17040
|
const opts = thisCommand.opts();
|
|
17022
17041
|
if (opts.debug) {
|
|
17023
17042
|
enableDebug();
|
|
@@ -17202,7 +17221,11 @@ async function showDashboard() {
|
|
|
17202
17221
|
}
|
|
17203
17222
|
const projects = await getAllClaudeProjects();
|
|
17204
17223
|
const packages = getAllPackages();
|
|
17205
|
-
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);
|
|
17206
17229
|
if (recentProjects.length === 0 && packages.length === 0) {
|
|
17207
17230
|
console.log(colors.dim(" Keine Sessions gefunden."));
|
|
17208
17231
|
log.newline();
|
|
@@ -17286,7 +17309,7 @@ async function showDashboard() {
|
|
|
17286
17309
|
const packageName = selected.data;
|
|
17287
17310
|
log.newline();
|
|
17288
17311
|
log.success(`Starte Package ${packageName}...`);
|
|
17289
|
-
const { getPackageLaunchConfig: getPackageLaunchConfig2 } = await import("./package-manager-
|
|
17312
|
+
const { getPackageLaunchConfig: getPackageLaunchConfig2 } = await import("./package-manager-T2HVNPEA.js");
|
|
17290
17313
|
const launches = await getPackageLaunchConfig2(packageName);
|
|
17291
17314
|
if (launches.length > 0) {
|
|
17292
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 {
|