mattermost-claude-code 0.7.0 → 0.7.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.
@@ -220,14 +220,11 @@ export class SessionManager {
220
220
  }
221
221
  }
222
222
  async handleExitPlanMode(session) {
223
- // If already approved in this session, auto-continue
223
+ // If already approved in this session, silently ignore subsequent ExitPlanMode calls
224
+ // (Don't send another message - that causes Claude to loop)
224
225
  if (session.planApproved) {
225
226
  if (this.debug)
226
- console.log(' ↪ Plan already approved, auto-continuing');
227
- if (session.claude.isRunning()) {
228
- session.claude.sendMessage('Continue with the implementation.');
229
- this.startTyping(session);
230
- }
227
+ console.log(' ↪ Plan already approved, ignoring ExitPlanMode');
231
228
  return;
232
229
  }
233
230
  // If we already have a pending approval, don't post another one
@@ -29,6 +29,7 @@ export declare class MattermostClient extends EventEmitter {
29
29
  createPost(message: string, threadId?: string): Promise<MattermostPost>;
30
30
  updatePost(postId: string, message: string): Promise<MattermostPost>;
31
31
  addReaction(postId: string, emojiName: string): Promise<void>;
32
+ downloadFile(fileId: string): Promise<Buffer>;
32
33
  connect(): Promise<void>;
33
34
  private handleEvent;
34
35
  private scheduleReconnect;
@@ -88,6 +88,20 @@ export class MattermostClient extends EventEmitter {
88
88
  emoji_name: emojiName,
89
89
  });
90
90
  }
91
+ // Download a file attachment
92
+ async downloadFile(fileId) {
93
+ const url = `${this.config.mattermost.url}/api/v4/files/${fileId}`;
94
+ const response = await fetch(url, {
95
+ headers: {
96
+ Authorization: `Bearer ${this.config.mattermost.token}`,
97
+ },
98
+ });
99
+ if (!response.ok) {
100
+ throw new Error(`Failed to download file ${fileId}: ${response.status}`);
101
+ }
102
+ const arrayBuffer = await response.arrayBuffer();
103
+ return Buffer.from(arrayBuffer);
104
+ }
91
105
  // Connect to WebSocket
92
106
  async connect() {
93
107
  // Get bot user first
@@ -8,6 +8,15 @@ export interface MattermostWebSocketEvent {
8
8
  };
9
9
  seq: number;
10
10
  }
11
+ export interface MattermostFile {
12
+ id: string;
13
+ name: string;
14
+ size: number;
15
+ mime_type: string;
16
+ extension: string;
17
+ width?: number;
18
+ height?: number;
19
+ }
11
20
  export interface MattermostPost {
12
21
  id: string;
13
22
  create_at: number;
@@ -21,7 +30,7 @@ export interface MattermostPost {
21
30
  props: Record<string, unknown>;
22
31
  metadata?: {
23
32
  embeds?: unknown[];
24
- files?: unknown[];
33
+ files?: MattermostFile[];
25
34
  };
26
35
  }
27
36
  export interface MattermostUser {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-claude-code",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Share Claude Code sessions live in a Mattermost channel with interactive features",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",