typeclaw 0.36.3 → 0.36.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typeclaw",
3
- "version": "0.36.3",
3
+ "version": "0.36.4",
4
4
  "homepage": "https://github.com/typeclaw/typeclaw#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/typeclaw/typeclaw/issues"
@@ -48,7 +48,7 @@
48
48
  "@mariozechner/pi-tui": "^0.67.3",
49
49
  "@modelcontextprotocol/sdk": "^1.29.0",
50
50
  "@mozilla/readability": "^0.6.0",
51
- "agent-messenger": "2.19.3",
51
+ "agent-messenger": "2.19.4",
52
52
  "cheerio": "^1.2.0",
53
53
  "citty": "^0.2.2",
54
54
  "cron-parser": "^5.5.0",
@@ -14,6 +14,7 @@ export type SlackInboundAppMentionEvent = SlackSocketModeAppMentionEvent
14
14
  export type InboundDropReason =
15
15
  | 'self_author' // event.user === botUserId; we never route our own messages back to ourselves
16
16
  | 'no_user' // event has no `user` field (e.g. system messages: channel_join, message_changed)
17
+ | 'slack_system_message' // non-replyable Slack message subtype events (e.g. channel_topic)
17
18
  | 'empty_text' // event has neither text nor files — nothing for the agent to act on
18
19
  | 'pre_connect' // bot identity is not known yet, so mention/self/reply classification cannot be trusted
19
20
 
@@ -62,6 +63,10 @@ export function classifyInbound(
62
63
  return { kind: 'drop', reason: 'no_user' }
63
64
  }
64
65
 
66
+ if (!isRouteableSlackMessageSubtype(event.subtype)) {
67
+ return { kind: 'drop', reason: 'slack_system_message' }
68
+ }
69
+
65
70
  const rawText = event.text ?? ''
66
71
  const { text, attachments } = splitInbound(event)
67
72
  const slackAttachments = Array.isArray(event.attachments) ? event.attachments : undefined
@@ -156,6 +161,10 @@ export function classifyInbound(
156
161
  }
157
162
  }
158
163
 
164
+ export function isRouteableSlackMessageSubtype(subtype: string | undefined): boolean {
165
+ return subtype === undefined || subtype === 'bot_message' || subtype === 'file_share' || subtype === 'me_message'
166
+ }
167
+
159
168
  // Slack encodes user mentions inline as `<@U…>` (or `<@W…>` for some org
160
169
  // accounts, and `<@U…|fallback>` when the client supplied a label). Pull
161
170
  // every distinct id out of the text — duplicates collapse so the caller
@@ -38,6 +38,7 @@ import {
38
38
  classifyInbound,
39
39
  describeSlackFile,
40
40
  type InboundDropReason,
41
+ isRouteableSlackMessageSubtype,
41
42
  renderPlaceholder,
42
43
  type SlackInboundAppMentionEvent,
43
44
  type SlackInboundMessageEvent,
@@ -694,7 +695,7 @@ export function createSlackHistoryCallback(deps: {
694
695
  }
695
696
 
696
697
  const botUserId = botUserIdRef()
697
- const rawMessages = raw.messages ?? []
698
+ const rawMessages = (raw.messages ?? []).filter((message) => isRouteableSlackMessageSubtype(message.subtype))
698
699
  const mapped = rawMessages.map((m) => mapSlackMessage(m, botUserId))
699
700
  // History payloads carry no profile, so mapSlackMessage echoes the raw
700
701
  // id into authorName; resolve it here so prompts show display names.
@@ -1316,6 +1317,7 @@ function dropHint(reason: InboundDropReason): string {
1316
1317
  case 'no_user':
1317
1318
  case 'pre_connect':
1318
1319
  case 'self_author':
1320
+ case 'slack_system_message':
1319
1321
  return ''
1320
1322
  }
1321
1323
  }