@otto-assistant/otto 0.7.19 → 0.7.20

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.
@@ -57,7 +57,6 @@ function takePendingPermissionContext(contextHash) {
57
57
  function renderPermissionContext(permission) {
58
58
  const tool = permission.permission.toLowerCase();
59
59
  const meta = permission.metadata ?? {};
60
- // Read a string value from metadata, trying multiple key names
61
60
  const getStr = (keys, fallback = '') => {
62
61
  for (const key of keys) {
63
62
  const val = meta[key];
@@ -66,7 +65,6 @@ function renderPermissionContext(permission) {
66
65
  }
67
66
  return fallback;
68
67
  };
69
- const truncate = (s, maxLen = 500) => s.length > maxLen ? s.slice(0, maxLen - 1) + '…' : s;
70
68
  const clipBlock = (s, limit) => s.length > limit ? s.slice(0, limit - 1) + '…' : s;
71
69
  switch (tool) {
72
70
  case 'bash':
@@ -116,9 +114,8 @@ function renderPermissionContext(permission) {
116
114
  const parts = [];
117
115
  if (filePath)
118
116
  parts.push(`**File:** \`${filePath}\``);
119
- if (content) {
117
+ if (content)
120
118
  parts.push(`\`\`\`\n${clipBlock(content, 600)}\n\`\`\``);
121
- }
122
119
  return parts.join('\n');
123
120
  }
124
121
  case 'webfetch':
@@ -180,7 +177,6 @@ function renderPermissionContext(permission) {
180
177
  return `> ${clipBlock(description, 300)}`;
181
178
  }
182
179
  default: {
183
- // Generic: show description or first meaningful metadata field
184
180
  const description = getStr(['description', 'action', 'operation', 'command']);
185
181
  if (description)
186
182
  return `> *${clipBlock(description, 300)}*`;
@@ -1001,8 +1001,8 @@ export class ThreadSessionRuntime {
1001
1001
  logger.log(`[EVENT] type=${event.type} eventSessionId=${eventSessionId || 'none'} activeSessionId=${sessionId || 'none'} ${this.formatRunStateForLog()}${eventDetails}`);
1002
1002
  }
1003
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.
1004
+ // so they get forwarded to Discord even when the requesting session
1005
+ // is a subagent whose metadata has been cleared from the buffer.
1006
1006
  const isGlobalEvent = event.type === 'tui.toast.show' ||
1007
1007
  event.type === 'permission.asked' ||
1008
1008
  event.type === 'question.asked';
@@ -1823,7 +1823,7 @@ export class ThreadSessionRuntime {
1823
1823
  const isMainSession = permission.sessionID === sessionId;
1824
1824
  const isSubtaskSession = Boolean(subtaskInfo);
1825
1825
  if (!isMainSession && !isSubtaskSession) {
1826
- logger.log(`[PERMISSION] Permission for non-main session (expected: ${sessionId} or subtask, got: ${permission.sessionID}) — forwarding to Discord`);
1826
+ logger.log(`[PERMISSION] Permission for non-main session (expected: ${sessionId} or subtask, got: ${permission.sessionID}) — forwarding to Discord anyway`);
1827
1827
  // Do not return — still show buttons for the Discord thread.
1828
1828
  // The session mismatch usually happens when the event buffer has
1829
1829
  // been cleared and a subagent's permission.asked arrives without
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "module": "index.ts",
9
9
  "type": "module",
10
- "version": "0.7.19",
10
+ "version": "0.7.20",
11
11
  "scripts": {
12
12
  "dev": "tsx src/bin.ts",
13
13
  "prepublishOnly": "pnpm build",
@@ -101,7 +101,6 @@ function renderPermissionContext(permission: PermissionRequest): string {
101
101
  const tool = permission.permission.toLowerCase()
102
102
  const meta = permission.metadata ?? {}
103
103
 
104
- // Read a string value from metadata, trying multiple key names
105
104
  const getStr = (keys: string[], fallback = ''): string => {
106
105
  for (const key of keys) {
107
106
  const val = meta[key]
@@ -110,9 +109,6 @@ function renderPermissionContext(permission: PermissionRequest): string {
110
109
  return fallback
111
110
  }
112
111
 
113
- const truncate = (s: string, maxLen = 500): string =>
114
- s.length > maxLen ? s.slice(0, maxLen - 1) + '…' : s
115
-
116
112
  const clipBlock = (s: string, limit: number): string =>
117
113
  s.length > limit ? s.slice(0, limit - 1) + '…' : s
118
114
 
@@ -158,9 +154,7 @@ function renderPermissionContext(permission: PermissionRequest): string {
158
154
  if (!filePath && !content) return ''
159
155
  const parts: string[] = []
160
156
  if (filePath) parts.push(`**File:** \`${filePath}\``)
161
- if (content) {
162
- parts.push(`\`\`\`\n${clipBlock(content, 600)}\n\`\`\``)
163
- }
157
+ if (content) parts.push(`\`\`\`\n${clipBlock(content, 600)}\n\`\`\``)
164
158
  return parts.join('\n')
165
159
  }
166
160
 
@@ -220,7 +214,6 @@ function renderPermissionContext(permission: PermissionRequest): string {
220
214
  }
221
215
 
222
216
  default: {
223
- // Generic: show description or first meaningful metadata field
224
217
  const description = getStr(['description', 'action', 'operation', 'command'])
225
218
  if (description) return `> *${clipBlock(description, 300)}*`
226
219
  const relevantKeys = Object.keys(meta).filter(
@@ -1453,8 +1453,8 @@ export class ThreadSessionRuntime {
1453
1453
  }
1454
1454
 
1455
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.
1456
+ // so they get forwarded to Discord even when the requesting session
1457
+ // is a subagent whose metadata has been cleared from the buffer.
1458
1458
  const isGlobalEvent =
1459
1459
  event.type === 'tui.toast.show' ||
1460
1460
  event.type === 'permission.asked' ||
@@ -2496,7 +2496,7 @@ export class ThreadSessionRuntime {
2496
2496
 
2497
2497
  if (!isMainSession && !isSubtaskSession) {
2498
2498
  logger.log(
2499
- `[PERMISSION] Permission for non-main session (expected: ${sessionId} or subtask, got: ${permission.sessionID}) — forwarding to Discord`,
2499
+ `[PERMISSION] Permission for non-main session (expected: ${sessionId} or subtask, got: ${permission.sessionID}) — forwarding to Discord anyway`,
2500
2500
  )
2501
2501
  // Do not return — still show buttons for the Discord thread.
2502
2502
  // The session mismatch usually happens when the event buffer has