mattermost-claude-code 0.7.1 → 0.7.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/claude/session.d.ts
CHANGED
package/dist/claude/session.js
CHANGED
|
@@ -131,6 +131,7 @@ export class SessionManager {
|
|
|
131
131
|
updateTimer: null,
|
|
132
132
|
typingTimer: null,
|
|
133
133
|
timeoutWarningPosted: false,
|
|
134
|
+
isRestarting: false,
|
|
134
135
|
};
|
|
135
136
|
// Register session
|
|
136
137
|
this.sessions.set(actualThreadId, session);
|
|
@@ -710,6 +711,11 @@ export class SessionManager {
|
|
|
710
711
|
const session = this.sessions.get(threadId);
|
|
711
712
|
if (!session)
|
|
712
713
|
return;
|
|
714
|
+
// If we're intentionally restarting (e.g., !cd), don't clean up or post exit message
|
|
715
|
+
if (session.isRestarting) {
|
|
716
|
+
session.isRestarting = false; // Reset flag here, after the exit event fires
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
713
719
|
this.stopTyping(session);
|
|
714
720
|
if (session.updateTimer) {
|
|
715
721
|
clearTimeout(session.updateTimer);
|
|
@@ -810,6 +816,7 @@ export class SessionManager {
|
|
|
810
816
|
console.log(` 📂 Session (${shortId}…) changing directory to ${shortDir}`);
|
|
811
817
|
// Stop the current Claude CLI
|
|
812
818
|
this.stopTyping(session);
|
|
819
|
+
session.isRestarting = true; // Suppress exit message during restart
|
|
813
820
|
session.claude.kill();
|
|
814
821
|
// Flush any pending content
|
|
815
822
|
await this.flush(session);
|
|
@@ -830,8 +837,10 @@ export class SessionManager {
|
|
|
830
837
|
// Start the new Claude CLI
|
|
831
838
|
try {
|
|
832
839
|
session.claude.start();
|
|
840
|
+
// Note: isRestarting is reset in handleExit when the old process exit event fires
|
|
833
841
|
}
|
|
834
842
|
catch (err) {
|
|
843
|
+
session.isRestarting = false; // Reset flag on failure since exit won't fire
|
|
835
844
|
console.error(' ❌ Failed to restart Claude:', err);
|
|
836
845
|
await this.mattermost.createPost(`❌ Failed to restart Claude: ${err}`, threadId);
|
|
837
846
|
return;
|