@otto-assistant/otto 0.7.18 → 0.7.19

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.
@@ -1000,7 +1000,12 @@ export class ThreadSessionRuntime {
1000
1000
  })();
1001
1001
  logger.log(`[EVENT] type=${event.type} eventSessionId=${eventSessionId || 'none'} activeSessionId=${sessionId || 'none'} ${this.formatRunStateForLog()}${eventDetails}`);
1002
1002
  }
1003
- const isGlobalEvent = event.type === 'tui.toast.show';
1003
+ // permission.asked and question.asked must always reach the handler
1004
+ // so they get forwarded to Discord/Telegram even when the requesting
1005
+ // session is a subagent whose metadata has been cleared from the buffer.
1006
+ const isGlobalEvent = event.type === 'tui.toast.show' ||
1007
+ event.type === 'permission.asked' ||
1008
+ event.type === 'question.asked';
1004
1009
  const isScopedToastEvent = Boolean(toastSessionId);
1005
1010
  // Drop events that don't match current session (stale events from
1006
1011
  // previous sessions), unless it's a global event or a subtask session.
@@ -1818,8 +1823,11 @@ export class ThreadSessionRuntime {
1818
1823
  const isMainSession = permission.sessionID === sessionId;
1819
1824
  const isSubtaskSession = Boolean(subtaskInfo);
1820
1825
  if (!isMainSession && !isSubtaskSession) {
1821
- logger.log(`[PERMISSION IGNORED] Permission for unknown session (expected: ${sessionId} or subtask, got: ${permission.sessionID})`);
1822
- return;
1826
+ logger.log(`[PERMISSION] Permission for non-main session (expected: ${sessionId} or subtask, got: ${permission.sessionID}) — forwarding to Discord`);
1827
+ // Do not return — still show buttons for the Discord thread.
1828
+ // The session mismatch usually happens when the event buffer has
1829
+ // been cleared and a subagent's permission.asked arrives without
1830
+ // subtask metadata in the buffer. The user needs to see these.
1823
1831
  }
1824
1832
  // Auto-deny external_directory permissions for paths that do not exist
1825
1833
  // on the filesystem. There is no point asking the user to approve access
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "module": "index.ts",
9
9
  "type": "module",
10
- "version": "0.7.18",
10
+ "version": "0.7.19",
11
11
  "scripts": {
12
12
  "dev": "tsx src/bin.ts",
13
13
  "prepublishOnly": "pnpm build",
@@ -1452,7 +1452,13 @@ export class ThreadSessionRuntime {
1452
1452
  )
1453
1453
  }
1454
1454
 
1455
- const isGlobalEvent = event.type === 'tui.toast.show'
1455
+ // permission.asked and question.asked must always reach the handler
1456
+ // so they get forwarded to Discord/Telegram even when the requesting
1457
+ // session is a subagent whose metadata has been cleared from the buffer.
1458
+ const isGlobalEvent =
1459
+ event.type === 'tui.toast.show' ||
1460
+ event.type === 'permission.asked' ||
1461
+ event.type === 'question.asked'
1456
1462
  const isScopedToastEvent = Boolean(toastSessionId)
1457
1463
 
1458
1464
  // Drop events that don't match current session (stale events from
@@ -2490,9 +2496,12 @@ export class ThreadSessionRuntime {
2490
2496
 
2491
2497
  if (!isMainSession && !isSubtaskSession) {
2492
2498
  logger.log(
2493
- `[PERMISSION IGNORED] Permission for unknown session (expected: ${sessionId} or subtask, got: ${permission.sessionID})`,
2499
+ `[PERMISSION] Permission for non-main session (expected: ${sessionId} or subtask, got: ${permission.sessionID}) — forwarding to Discord`,
2494
2500
  )
2495
- return
2501
+ // Do not return — still show buttons for the Discord thread.
2502
+ // The session mismatch usually happens when the event buffer has
2503
+ // been cleared and a subagent's permission.asked arrives without
2504
+ // subtask metadata in the buffer. The user needs to see these.
2496
2505
  }
2497
2506
 
2498
2507
  // Auto-deny external_directory permissions for paths that do not exist