claude-notification-plugin 1.1.42 → 1.1.49

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-notification-plugin",
3
- "version": "1.1.42",
3
+ "version": "1.1.49",
4
4
  "description": "Claude Code task-completion notifications: Telegram, desktop notifications (Windows/macOS/Linux), sound, and voice",
5
5
  "author": {
6
6
  "name": "Viacheslav Makarov",
package/commit-sha CHANGED
@@ -1 +1 @@
1
- 2d4bb2df655de8cdae7f5f4fbf99a0fe0ae1e78f
1
+ ff5e9a94bfde76173bc7c0b2658c5bb14b4503ea
@@ -6,6 +6,9 @@ const COMMANDS = [
6
6
  '/history', '/stop', '/help',
7
7
  ];
8
8
 
9
+ // Telegram bot commands to silently ignore (not tasks, not our commands)
10
+ const IGNORED_COMMANDS = ['/start'];
11
+
9
12
  /**
10
13
  * Parse a Telegram message into a command or task.
11
14
  *
@@ -32,6 +35,11 @@ export function parseMessage (text) {
32
35
  const parts = trimmed.split(/\s+/);
33
36
  const cmd = parts[0].toLowerCase().replace(/@\w+$/, ''); // strip @botname
34
37
 
38
+ // Telegram built-in commands — silently ignore
39
+ if (IGNORED_COMMANDS.includes(cmd)) {
40
+ return null;
41
+ }
42
+
35
43
  // Known command
36
44
  if (COMMANDS.includes(cmd)) {
37
45
  return {
@@ -233,15 +233,37 @@ export class PtyRunner extends EventEmitter {
233
233
  // Set up marker wait + timeout
234
234
  const markerPromise = this._waitForMarker(pendingId, this.timeout);
235
235
 
236
- // Send the task text to the PTY using bracketed paste mode.
237
- // Without this, newlines in the text are interpreted as Enter keypresses,
238
- // splitting the prompt into multiple submissions and breaking the flow.
239
- session.pty.write(`\x1b[200~${task.text}\x1b[201~\r`);
236
+ // Send the task text to the PTY.
237
+ // Bracketed paste mode (\x1b[200~...\x1b[201~) causes Claude to hang in ConPTY,
238
+ // so we send raw text. For multiline messages, use backslash + Enter as line
239
+ // continuation (Claude Code interprets \ + Enter as a newline within the prompt),
240
+ // with delays between lines so Claude can process each one.
241
+ const lines = task.text.split(/\r?\n/);
242
+ const writeLines = async () => {
243
+ if (lines.length === 1) {
244
+ session.pty.write(`${lines[0]}\r`);
245
+ } else {
246
+ for (let i = 0; i < lines.length; i++) {
247
+ if (i > 0) {
248
+ await new Promise(r => setTimeout(r, 300));
249
+ }
250
+ if (i < lines.length - 1) {
251
+ session.pty.write(`${lines[i]}\\\r`);
252
+ } else {
253
+ session.pty.write(`${lines[i]}\r`);
254
+ }
255
+ }
256
+ // Extra Enter to submit the multiline prompt
257
+ await new Promise(r => setTimeout(r, 300));
258
+ session.pty.write('\r');
259
+ }
260
+ };
261
+ writeLines();
240
262
  this.logger.info(`PTY task sent to ${workDir}: ${task.text.slice(0, 100)}`);
241
263
 
242
264
  // Monitor PTY output for fatal errors that prevent task completion
243
265
  const errorPatterns = [
244
- { pattern: 'auto mode temporarily unavailable', msg: 'Claude auto mode temporarily unavailable' },
266
+ { pattern: 'auto mode temporarily unavailable', msg: 'Claude auto mode temporarily unavailable — retry later' },
245
267
  { pattern: 'Session expired', msg: 'Claude session expired' },
246
268
  { pattern: 'Authentication required', msg: 'Claude authentication required' },
247
269
  ];
@@ -327,6 +349,17 @@ export class PtyRunner extends EventEmitter {
327
349
  args.push('--permission-mode', 'auto');
328
350
  }
329
351
 
352
+ // Reduce PTY output noise: disable animations, progress bar, tips
353
+ if (!args.includes('--settings')) {
354
+ args.push('--settings', JSON.stringify({
355
+ prefersReducedMotion: true,
356
+ outputStyle: 'plain',
357
+ terminalProgressBarEnabled: false,
358
+ spinnerTipsEnabled: false,
359
+ showTurnDuration: false,
360
+ }));
361
+ }
362
+
330
363
  this.logger.info(`Creating PTY session in ${workDir} with args: ${JSON.stringify(args)}`);
331
364
 
332
365
  const shell = process.platform === 'win32' ? 'cmd.exe' : '/bin/bash';
@@ -401,14 +434,26 @@ export class PtyRunner extends EventEmitter {
401
434
 
402
435
  /**
403
436
  * Wait for PTY output to stabilize (Claude has loaded).
437
+ * Automatically answers the workspace trust prompt if it appears.
404
438
  */
405
439
  _waitForReady (session, timeoutMs) {
406
440
  return new Promise((resolve) => {
407
441
  let lastLength = 0;
408
442
  let stableCount = 0;
443
+ let trustAnswered = false;
409
444
  const checkInterval = 500;
410
445
 
411
446
  const timer = setInterval(() => {
447
+ // Detect and auto-answer workspace trust prompt
448
+ if (!trustAnswered) {
449
+ const buf = (session._buffer || '').replace(/\x1b\[[0-9;]*[a-zA-Z]/g, '').replace(/\s/g, '');
450
+ if (buf.includes('trustthisfolder') || buf.includes('Yesiproceed')) {
451
+ trustAnswered = true;
452
+ this.logger.info('Auto-answering workspace trust prompt');
453
+ session.pty.write('\r');
454
+ }
455
+ }
456
+
412
457
  const currentLength = session._buffer.length;
413
458
  if (currentLength > 0 && currentLength === lastLength) {
414
459
  stableCount++;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-notification-plugin",
3
3
  "productName": "claude-notification-plugin",
4
- "version": "1.1.42",
4
+ "version": "1.1.49",
5
5
  "description": "Claude Code task-completion notifications: Telegram, desktop notifications (Windows/macOS/Linux), sound, and voice",
6
6
  "type": "module",
7
7
  "engines": {