claude-threads 1.9.2 → 1.9.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/CHANGELOG.md +9 -0
- package/dist/index.js +479 -431
- package/dist/mcp/permission-server.js +74 -48
- package/package.json +1 -1
|
@@ -52902,6 +52902,32 @@ class MessageManager {
|
|
|
52902
52902
|
this.reset();
|
|
52903
52903
|
}
|
|
52904
52904
|
}
|
|
52905
|
+
// src/session/lifecycle-fsm.ts
|
|
52906
|
+
var log4 = createLogger("fsm");
|
|
52907
|
+
var ALLOWED_TRANSITIONS = {
|
|
52908
|
+
starting: new Set(["active", "paused", "interrupted", "cancelling", "restarting"]),
|
|
52909
|
+
active: new Set([
|
|
52910
|
+
"active",
|
|
52911
|
+
"processing",
|
|
52912
|
+
"paused",
|
|
52913
|
+
"interrupted",
|
|
52914
|
+
"restarting",
|
|
52915
|
+
"cancelling",
|
|
52916
|
+
"ending"
|
|
52917
|
+
]),
|
|
52918
|
+
processing: new Set([
|
|
52919
|
+
"active",
|
|
52920
|
+
"paused",
|
|
52921
|
+
"interrupted",
|
|
52922
|
+
"restarting",
|
|
52923
|
+
"cancelling"
|
|
52924
|
+
]),
|
|
52925
|
+
paused: new Set(["active", "cancelling", "restarting"]),
|
|
52926
|
+
interrupted: new Set(["active", "cancelling", "restarting", "paused"]),
|
|
52927
|
+
restarting: new Set(["active", "paused", "cancelling"]),
|
|
52928
|
+
cancelling: new Set(["ending"]),
|
|
52929
|
+
ending: new Set
|
|
52930
|
+
};
|
|
52905
52931
|
// src/config/index.ts
|
|
52906
52932
|
import { resolve as resolve2, dirname as dirname2 } from "path";
|
|
52907
52933
|
import { homedir } from "os";
|
|
@@ -55659,7 +55685,7 @@ function formatReleaseNotes(notes, formatter) {
|
|
|
55659
55685
|
|
|
55660
55686
|
// src/utils/keep-alive.ts
|
|
55661
55687
|
import { spawn } from "child_process";
|
|
55662
|
-
var
|
|
55688
|
+
var log5 = createLogger("keepalive");
|
|
55663
55689
|
|
|
55664
55690
|
class KeepAliveManager {
|
|
55665
55691
|
activeSessionCount = 0;
|
|
@@ -55674,7 +55700,7 @@ class KeepAliveManager {
|
|
|
55674
55700
|
if (!enabled && this.keepAliveProcess) {
|
|
55675
55701
|
this.stopKeepAlive();
|
|
55676
55702
|
}
|
|
55677
|
-
|
|
55703
|
+
log5.debug(`Keep-alive ${enabled ? "enabled" : "disabled"}`);
|
|
55678
55704
|
}
|
|
55679
55705
|
isEnabled() {
|
|
55680
55706
|
return this.enabled;
|
|
@@ -55684,7 +55710,7 @@ class KeepAliveManager {
|
|
|
55684
55710
|
}
|
|
55685
55711
|
sessionStarted() {
|
|
55686
55712
|
this.activeSessionCount++;
|
|
55687
|
-
|
|
55713
|
+
log5.debug(`Session started (${this.activeSessionCount} active)`);
|
|
55688
55714
|
if (this.activeSessionCount === 1) {
|
|
55689
55715
|
this.startKeepAlive();
|
|
55690
55716
|
}
|
|
@@ -55693,7 +55719,7 @@ class KeepAliveManager {
|
|
|
55693
55719
|
if (this.activeSessionCount > 0) {
|
|
55694
55720
|
this.activeSessionCount--;
|
|
55695
55721
|
}
|
|
55696
|
-
|
|
55722
|
+
log5.debug(`Session ended (${this.activeSessionCount} active)`);
|
|
55697
55723
|
if (this.activeSessionCount === 0) {
|
|
55698
55724
|
this.stopKeepAlive();
|
|
55699
55725
|
}
|
|
@@ -55707,11 +55733,11 @@ class KeepAliveManager {
|
|
|
55707
55733
|
}
|
|
55708
55734
|
startKeepAlive() {
|
|
55709
55735
|
if (!this.enabled) {
|
|
55710
|
-
|
|
55736
|
+
log5.debug("Keep-alive disabled, skipping");
|
|
55711
55737
|
return;
|
|
55712
55738
|
}
|
|
55713
55739
|
if (this.keepAliveProcess) {
|
|
55714
|
-
|
|
55740
|
+
log5.debug("Keep-alive already running");
|
|
55715
55741
|
return;
|
|
55716
55742
|
}
|
|
55717
55743
|
switch (this.platform) {
|
|
@@ -55725,12 +55751,12 @@ class KeepAliveManager {
|
|
|
55725
55751
|
this.startWindowsKeepAlive();
|
|
55726
55752
|
break;
|
|
55727
55753
|
default:
|
|
55728
|
-
|
|
55754
|
+
log5.warn(`Keep-alive not supported on ${this.platform}`);
|
|
55729
55755
|
}
|
|
55730
55756
|
}
|
|
55731
55757
|
stopKeepAlive() {
|
|
55732
55758
|
if (this.keepAliveProcess) {
|
|
55733
|
-
|
|
55759
|
+
log5.debug("Stopping keep-alive");
|
|
55734
55760
|
this.keepAliveProcess.kill();
|
|
55735
55761
|
this.keepAliveProcess = null;
|
|
55736
55762
|
}
|
|
@@ -55742,18 +55768,18 @@ class KeepAliveManager {
|
|
|
55742
55768
|
detached: false
|
|
55743
55769
|
});
|
|
55744
55770
|
this.keepAliveProcess.on("error", (err) => {
|
|
55745
|
-
|
|
55771
|
+
log5.error(`Failed to start caffeinate: ${err.message}`);
|
|
55746
55772
|
this.keepAliveProcess = null;
|
|
55747
55773
|
});
|
|
55748
55774
|
this.keepAliveProcess.on("exit", (code) => {
|
|
55749
55775
|
if (code !== null && code !== 0 && this.activeSessionCount > 0) {
|
|
55750
|
-
|
|
55776
|
+
log5.debug(`caffeinate exited with code ${code}`);
|
|
55751
55777
|
}
|
|
55752
55778
|
this.keepAliveProcess = null;
|
|
55753
55779
|
});
|
|
55754
|
-
|
|
55780
|
+
log5.info("Sleep prevention active (caffeinate)");
|
|
55755
55781
|
} catch (err) {
|
|
55756
|
-
|
|
55782
|
+
log5.error(`Failed to start caffeinate: ${err}`);
|
|
55757
55783
|
}
|
|
55758
55784
|
}
|
|
55759
55785
|
startLinuxKeepAlive() {
|
|
@@ -55769,19 +55795,19 @@ class KeepAliveManager {
|
|
|
55769
55795
|
detached: false
|
|
55770
55796
|
});
|
|
55771
55797
|
this.keepAliveProcess.on("error", (err) => {
|
|
55772
|
-
|
|
55798
|
+
log5.debug(`systemd-inhibit not available: ${err.message}`);
|
|
55773
55799
|
this.keepAliveProcess = null;
|
|
55774
55800
|
this.startLinuxKeepAliveFallback();
|
|
55775
55801
|
});
|
|
55776
55802
|
this.keepAliveProcess.on("exit", (code) => {
|
|
55777
55803
|
if (code !== null && code !== 0 && this.activeSessionCount > 0) {
|
|
55778
|
-
|
|
55804
|
+
log5.debug(`systemd-inhibit exited with code ${code}`);
|
|
55779
55805
|
}
|
|
55780
55806
|
this.keepAliveProcess = null;
|
|
55781
55807
|
});
|
|
55782
|
-
|
|
55808
|
+
log5.info("Sleep prevention active (systemd-inhibit)");
|
|
55783
55809
|
} catch (err) {
|
|
55784
|
-
|
|
55810
|
+
log5.debug(`Failed to start systemd-inhibit: ${err}`);
|
|
55785
55811
|
this.startLinuxKeepAliveFallback();
|
|
55786
55812
|
}
|
|
55787
55813
|
}
|
|
@@ -55795,15 +55821,15 @@ class KeepAliveManager {
|
|
|
55795
55821
|
detached: false
|
|
55796
55822
|
});
|
|
55797
55823
|
this.keepAliveProcess.on("error", (err) => {
|
|
55798
|
-
|
|
55824
|
+
log5.warn(`Linux keep-alive fallback not available: ${err.message}`);
|
|
55799
55825
|
this.keepAliveProcess = null;
|
|
55800
55826
|
});
|
|
55801
55827
|
this.keepAliveProcess.on("exit", () => {
|
|
55802
55828
|
this.keepAliveProcess = null;
|
|
55803
55829
|
});
|
|
55804
|
-
|
|
55830
|
+
log5.info("Sleep prevention active (xdg-screensaver)");
|
|
55805
55831
|
} catch (err) {
|
|
55806
|
-
|
|
55832
|
+
log5.warn(`Linux keep-alive not available: ${err}`);
|
|
55807
55833
|
}
|
|
55808
55834
|
}
|
|
55809
55835
|
startWindowsKeepAlive() {
|
|
@@ -55828,25 +55854,25 @@ class KeepAliveManager {
|
|
|
55828
55854
|
windowsHide: true
|
|
55829
55855
|
});
|
|
55830
55856
|
this.keepAliveProcess.on("error", (err) => {
|
|
55831
|
-
|
|
55857
|
+
log5.warn(`Windows keep-alive not available: ${err.message}`);
|
|
55832
55858
|
this.keepAliveProcess = null;
|
|
55833
55859
|
});
|
|
55834
55860
|
this.keepAliveProcess.on("exit", (code) => {
|
|
55835
55861
|
if (code !== null && code !== 0 && this.activeSessionCount > 0) {
|
|
55836
|
-
|
|
55862
|
+
log5.debug(`PowerShell keep-alive exited with code ${code}`);
|
|
55837
55863
|
}
|
|
55838
55864
|
this.keepAliveProcess = null;
|
|
55839
55865
|
});
|
|
55840
|
-
|
|
55866
|
+
log5.info("Sleep prevention active (SetThreadExecutionState)");
|
|
55841
55867
|
} catch (err) {
|
|
55842
|
-
|
|
55868
|
+
log5.warn(`Windows keep-alive not available: ${err}`);
|
|
55843
55869
|
}
|
|
55844
55870
|
}
|
|
55845
55871
|
}
|
|
55846
55872
|
var keepAlive = new KeepAliveManager;
|
|
55847
55873
|
|
|
55848
55874
|
// src/operations/sticky-message/handler.ts
|
|
55849
|
-
var
|
|
55875
|
+
var log6 = createLogger("sticky");
|
|
55850
55876
|
var botStartedAt = new Date;
|
|
55851
55877
|
var stickyPostIds = new Map;
|
|
55852
55878
|
var needsBump = new Map;
|
|
@@ -56086,7 +56112,7 @@ class Redactor {
|
|
|
56086
56112
|
// src/persistence/thread-logger.ts
|
|
56087
56113
|
import { homedir as homedir2 } from "os";
|
|
56088
56114
|
import { join as join2, dirname as dirname4 } from "path";
|
|
56089
|
-
var
|
|
56115
|
+
var log7 = createLogger("thread-log");
|
|
56090
56116
|
var LOGS_BASE_DIR = join2(homedir2(), ".claude-threads", "logs");
|
|
56091
56117
|
|
|
56092
56118
|
// src/operations/bug-report/handler.ts
|
|
@@ -56190,7 +56216,7 @@ function extractResetAt(text, now) {
|
|
|
56190
56216
|
}
|
|
56191
56217
|
|
|
56192
56218
|
// src/claude/cli.ts
|
|
56193
|
-
var
|
|
56219
|
+
var log8 = createLogger("claude");
|
|
56194
56220
|
function cleanupBrowserBridgeSockets() {
|
|
56195
56221
|
try {
|
|
56196
56222
|
const tempDir = tmpdir();
|
|
@@ -56202,13 +56228,13 @@ function cleanupBrowserBridgeSockets() {
|
|
|
56202
56228
|
const stats = statSync(filePath);
|
|
56203
56229
|
if (stats.isSocket()) {
|
|
56204
56230
|
unlinkSync(filePath);
|
|
56205
|
-
|
|
56231
|
+
log8.debug(`Removed stale browser bridge socket: ${file2}`);
|
|
56206
56232
|
}
|
|
56207
56233
|
} catch {}
|
|
56208
56234
|
}
|
|
56209
56235
|
}
|
|
56210
56236
|
} catch (err) {
|
|
56211
|
-
|
|
56237
|
+
log8.debug(`Browser bridge cleanup failed: ${err}`);
|
|
56212
56238
|
}
|
|
56213
56239
|
}
|
|
56214
56240
|
function buildClaudeChildEnv(parentEnv, account) {
|
|
@@ -56239,7 +56265,7 @@ function isErrorResultEvent(event) {
|
|
|
56239
56265
|
return false;
|
|
56240
56266
|
}
|
|
56241
56267
|
function materializeMcpConfig(config3, sessionId, opts = {}) {
|
|
56242
|
-
if (opts.inline
|
|
56268
|
+
if (opts.inline) {
|
|
56243
56269
|
return { mode: "inline", value: JSON.stringify(config3) };
|
|
56244
56270
|
}
|
|
56245
56271
|
const dir = opts.tmpDirOverride ?? tmpdir();
|
|
@@ -57181,7 +57207,7 @@ ${avoidCommands.map((c) => `- \`!${c.command}\` - ${c.reason}`).join(`
|
|
|
57181
57207
|
`.trim();
|
|
57182
57208
|
}
|
|
57183
57209
|
// src/utils/error-handler/index.ts
|
|
57184
|
-
var
|
|
57210
|
+
var log9 = createLogger("error");
|
|
57185
57211
|
|
|
57186
57212
|
// src/utils/session-log.ts
|
|
57187
57213
|
function createSessionLog(baseLog) {
|
|
@@ -57199,32 +57225,32 @@ init_emoji();
|
|
|
57199
57225
|
// src/git/worktree.ts
|
|
57200
57226
|
import * as path from "path";
|
|
57201
57227
|
import { homedir as homedir3 } from "os";
|
|
57202
|
-
var
|
|
57228
|
+
var log10 = createLogger("git-wt");
|
|
57203
57229
|
var WORKTREES_DIR = path.join(homedir3(), ".claude-threads", "worktrees");
|
|
57204
57230
|
var METADATA_STORE_PATH = path.join(homedir3(), ".claude-threads", "worktree-metadata.json");
|
|
57205
57231
|
|
|
57206
57232
|
// src/operations/post-helpers/index.ts
|
|
57207
|
-
var
|
|
57208
|
-
var sessionLog = createSessionLog(
|
|
57233
|
+
var log11 = createLogger("helpers");
|
|
57234
|
+
var sessionLog = createSessionLog(log11);
|
|
57209
57235
|
|
|
57210
57236
|
// src/claude/quick-query.ts
|
|
57211
|
-
var
|
|
57237
|
+
var log12 = createLogger("query");
|
|
57212
57238
|
|
|
57213
57239
|
// src/operations/suggestions/title.ts
|
|
57214
|
-
var
|
|
57240
|
+
var log13 = createLogger("title");
|
|
57215
57241
|
|
|
57216
57242
|
// src/operations/suggestions/tag.ts
|
|
57217
|
-
var
|
|
57243
|
+
var log14 = createLogger("tags");
|
|
57218
57244
|
|
|
57219
57245
|
// src/operations/context-prompt/handler.ts
|
|
57220
57246
|
init_emoji();
|
|
57221
|
-
var
|
|
57222
|
-
var sessionLog2 = createSessionLog(
|
|
57247
|
+
var log15 = createLogger("context");
|
|
57248
|
+
var sessionLog2 = createSessionLog(log15);
|
|
57223
57249
|
var contextPromptTimeouts = new Map;
|
|
57224
57250
|
var contextPromptFiles = new Map;
|
|
57225
57251
|
// src/session/lifecycle.ts
|
|
57226
|
-
var
|
|
57227
|
-
var sessionLog3 = createSessionLog(
|
|
57252
|
+
var log16 = createLogger("lifecycle");
|
|
57253
|
+
var sessionLog3 = createSessionLog(log16);
|
|
57228
57254
|
var CHAT_PLATFORM_PROMPT = generateChatPlatformPrompt();
|
|
57229
57255
|
|
|
57230
57256
|
// src/update-notifier.ts
|
|
@@ -57232,22 +57258,22 @@ var import_semver2 = __toESM(require_semver2(), 1);
|
|
|
57232
57258
|
|
|
57233
57259
|
// src/operations/commands/handler.ts
|
|
57234
57260
|
init_emoji();
|
|
57235
|
-
var
|
|
57236
|
-
var sessionLog4 = createSessionLog(
|
|
57261
|
+
var log17 = createLogger("commands");
|
|
57262
|
+
var sessionLog4 = createSessionLog(log17);
|
|
57237
57263
|
// src/operations/suggestions/branch.ts
|
|
57238
57264
|
import { exec as exec2 } from "child_process";
|
|
57239
57265
|
import { promisify as promisify2 } from "util";
|
|
57240
57266
|
var execAsync2 = promisify2(exec2);
|
|
57241
|
-
var
|
|
57267
|
+
var log18 = createLogger("branch");
|
|
57242
57268
|
|
|
57243
57269
|
// src/operations/worktree/handler.ts
|
|
57244
|
-
var
|
|
57245
|
-
var sessionLog5 = createSessionLog(
|
|
57270
|
+
var log19 = createLogger("worktree");
|
|
57271
|
+
var sessionLog5 = createSessionLog(log19);
|
|
57246
57272
|
// src/operations/events/handler.ts
|
|
57247
|
-
var
|
|
57248
|
-
var sessionLog6 = createSessionLog(
|
|
57273
|
+
var log20 = createLogger("events");
|
|
57274
|
+
var sessionLog6 = createSessionLog(log20);
|
|
57249
57275
|
// src/operations/monitor/handler.ts
|
|
57250
|
-
var
|
|
57276
|
+
var log21 = createLogger("monitor");
|
|
57251
57277
|
var DEFAULT_INTERVAL_MS = 60 * 1000;
|
|
57252
57278
|
// src/utils/websocket.ts
|
|
57253
57279
|
var WS;
|