typeclaw 0.48.13 → 0.49.0
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 +5 -5
- package/scripts/dump-system-prompt.ts +52 -110
- package/src/agent/index.ts +144 -72
- package/src/agent/live-sessions.ts +2 -2
- package/src/agent/live-subagents.ts +1 -0
- package/src/agent/plugin-tools.ts +53 -11
- package/src/agent/prompt-cache-key.ts +42 -0
- package/src/agent/provider-error.ts +179 -10
- package/src/agent/restart-handoff/index.ts +7 -14
- package/src/agent/reviewer-activity.ts +68 -0
- package/src/agent/session-origin.ts +33 -0
- package/src/agent/subagents.ts +13 -1
- package/src/agent/system-prompt.ts +68 -202
- package/src/agent/todo/continuation-policy.ts +12 -4
- package/src/agent/tool-file-safety.ts +113 -14
- package/src/agent/tool-not-found-nudge.ts +1 -1
- package/src/agent/tools/channel-history-render.ts +2 -1
- package/src/agent/tools/channel-reply.ts +23 -5
- package/src/agent/tools/channel-send.ts +49 -7
- package/src/agent/tools/curl-impersonate.ts +11 -2
- package/src/agent/tools/post-github-review.ts +77 -15
- package/src/agent/tools/skip-response.ts +2 -2
- package/src/agent/tools/spawn-subagent.ts +163 -12
- package/src/agent/tools/subagent-output.ts +8 -0
- package/src/bundled-plugins/backup/README.md +10 -9
- package/src/bundled-plugins/backup/runner.ts +140 -58
- package/src/bundled-plugins/backup/subagents.ts +58 -26
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +34 -2
- package/src/bundled-plugins/github-cli-auth/granted-push.ts +135 -0
- package/src/bundled-plugins/github-cli-auth/index.ts +83 -11
- package/src/bundled-plugins/github-cli-auth/review-account.ts +23 -0
- package/src/bundled-plugins/github-cli-auth/review-checkout.ts +9 -2
- package/src/bundled-plugins/github-cli-auth/review-recorder.ts +45 -7
- package/src/bundled-plugins/operator/operator.ts +15 -4
- package/src/bundled-plugins/reviewer/skills/code-review.ts +1 -1
- package/src/bundled-plugins/security/index.ts +50 -2
- package/src/bundled-plugins/security/policies/git-exfil.ts +24 -12
- package/src/channels/adapters/discord-bot-reactions.ts +18 -0
- package/src/channels/adapters/discord-bot.ts +122 -67
- package/src/channels/adapters/discord-reactions.ts +18 -0
- package/src/channels/adapters/discord.ts +114 -8
- package/src/channels/adapters/github/inbound.ts +103 -8
- package/src/channels/adapters/github/index.ts +251 -19
- package/src/channels/adapters/github/last-alive.ts +27 -0
- package/src/channels/adapters/github/outbound.ts +54 -18
- package/src/channels/adapters/github/pending-review-store.ts +141 -0
- package/src/channels/adapters/github/permission-guidance.ts +1 -0
- package/src/channels/adapters/github/reactions.ts +100 -0
- package/src/channels/adapters/github/reconcile-cooldown-store.ts +197 -67
- package/src/channels/adapters/github/reconcile-open-prs.ts +418 -33
- package/src/channels/adapters/github/recovery.ts +106 -0
- package/src/channels/adapters/github/review-check.ts +510 -0
- package/src/channels/adapters/github/review-submitter.ts +34 -2
- package/src/channels/adapters/instagram.ts +32 -14
- package/src/channels/adapters/kakaotalk.ts +22 -7
- package/src/channels/adapters/line.ts +18 -3
- package/src/channels/adapters/outbound-account.ts +20 -0
- package/src/channels/adapters/own-reactions.ts +66 -0
- package/src/channels/adapters/recovery-correlation.ts +214 -0
- package/src/channels/adapters/slack-bot-classify.ts +18 -11
- package/src/channels/adapters/slack-bot-dedupe.ts +111 -28
- package/src/channels/adapters/slack-bot-reactions.ts +18 -0
- package/src/channels/adapters/slack-bot.ts +125 -57
- package/src/channels/adapters/slack-classify.ts +25 -4
- package/src/channels/adapters/slack-inbound-revision.ts +96 -0
- package/src/channels/adapters/slack-reactions.ts +18 -0
- package/src/channels/adapters/slack-thread-ts.ts +6 -0
- package/src/channels/adapters/slack.ts +48 -3
- package/src/channels/adapters/teams.ts +14 -4
- package/src/channels/adapters/telegram-bot.ts +56 -10
- package/src/channels/adapters/webex-bot.ts +12 -2
- package/src/channels/adapters/webex.ts +12 -2
- package/src/channels/background-handoff.ts +434 -0
- package/src/channels/background-obligations.ts +893 -0
- package/src/channels/continuity-types.ts +271 -0
- package/src/channels/github-review-check.ts +598 -0
- package/src/channels/github-review-turn-ledger.ts +102 -28
- package/src/channels/github-review-verdict-coordinator.ts +72 -12
- package/src/channels/github-token-bridge.ts +11 -5
- package/src/channels/inbound-journal.ts +1738 -0
- package/src/channels/index.ts +6 -1
- package/src/channels/manager.ts +17 -7
- package/src/channels/recovery-dispatcher.ts +264 -0
- package/src/channels/recovery-notice.ts +94 -0
- package/src/channels/recovery-outbox.ts +459 -0
- package/src/channels/router.ts +2539 -615
- package/src/channels/schema.ts +8 -1
- package/src/channels/subagent-completion-bridge.ts +17 -14
- package/src/channels/types.ts +121 -16
- package/src/channels/waiting-reactions.ts +664 -0
- package/src/cli/compose.ts +7 -4
- package/src/cli/hostd.ts +49 -3
- package/src/cli/inspect.ts +11 -14
- package/src/coding-agent/broker-body.ts +38 -0
- package/src/coding-agent/broker.ts +290 -0
- package/src/coding-agent/claude.ts +95 -0
- package/src/coding-agent/codex.ts +104 -0
- package/src/coding-agent/index.ts +506 -0
- package/src/coding-agent/omo-state.ts +69 -0
- package/src/coding-agent/omo-stream.ts +98 -0
- package/src/coding-agent/omo.ts +192 -0
- package/src/coding-agent/runner.ts +263 -0
- package/src/coding-agent/tool.ts +62 -0
- package/src/coding-agent/worktree.ts +355 -0
- package/src/compose/restart.ts +10 -3
- package/src/compose/start.ts +20 -3
- package/src/config/config.ts +10 -3
- package/src/config/providers.ts +12 -9
- package/src/container/exit-reason.ts +44 -0
- package/src/container/index.ts +5 -0
- package/src/container/log-archive.ts +51 -13
- package/src/container/memory-limit.ts +1 -1
- package/src/container/memory-oversubscription.ts +36 -6
- package/src/container/oom-events.ts +86 -0
- package/src/container/restart.ts +2 -0
- package/src/container/shared.ts +8 -1
- package/src/container/start.ts +25 -13
- package/src/container/stop.ts +6 -2
- package/src/container/tool-oom-priority.ts +32 -0
- package/src/cron/consumer.ts +10 -4
- package/src/cron/reloadable.ts +23 -2
- package/src/doctor/checks.ts +14 -2
- package/src/hostd/daemon.ts +20 -10
- package/src/hostd/spawn.ts +106 -5
- package/src/hostd/version.ts +20 -0
- package/src/hostd/watchdog.ts +241 -0
- package/src/init/dockerfile.ts +57 -592
- package/src/init/index.ts +2 -3
- package/src/mcp/client.ts +3 -1
- package/src/operations/classify-tool-outcome.ts +45 -1
- package/src/operations/incidents.ts +10 -5
- package/src/plugin/core-tool-names.ts +1 -1
- package/src/plugin/define.ts +1 -0
- package/src/plugin/index.ts +1 -0
- package/src/plugin/types.ts +6 -1
- package/src/run/background-handoff-boot.ts +86 -0
- package/src/run/index.ts +83 -83
- package/src/run/resource-sample.ts +19 -0
- package/src/sandbox/build.ts +4 -0
- package/src/sandbox/coding-agent.ts +214 -0
- package/src/sandbox/policy.ts +1 -0
- package/src/sandbox/runtime-private.ts +4 -1
- package/src/secrets/coding-agent-auth.ts +97 -0
- package/src/secrets/index.ts +0 -16
- package/src/server/command-runner.ts +6 -2
- package/src/server/index.ts +101 -40
- package/src/skills/typeclaw-channel-github/SKILL.md +7 -5
- package/src/skills/typeclaw-claude-code/SKILL.md +25 -260
- package/src/skills/typeclaw-claude-code/references/auth-flow.md +7 -23
- package/src/skills/typeclaw-claude-code/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-claude-code/references/results-and-worktrees.md +13 -0
- package/src/skills/typeclaw-codex-cli/SKILL.md +35 -270
- package/src/skills/typeclaw-codex-cli/references/auth-flow.md +13 -20
- package/src/skills/typeclaw-codex-cli/references/headless-sessions.md +26 -0
- package/src/skills/typeclaw-codex-cli/references/results-and-worktrees.md +28 -0
- package/src/skills/typeclaw-config/SKILL.md +21 -21
- package/src/skills/typeclaw-config/references/dockerfile.md +14 -13
- package/src/skills/typeclaw-cron/SKILL.md +1 -1
- package/src/skills/typeclaw-github-contributing/SKILL.md +2 -2
- package/src/skills/typeclaw-memory/SKILL.md +3 -3
- package/src/skills/typeclaw-omo-cli/SKILL.md +52 -0
- package/src/skills/typeclaw-omo-cli/references/auth-flow.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/results-and-worktrees.md +23 -0
- package/src/skills/typeclaw-plugins/SKILL.md +15 -15
- package/src/skills/typeclaw-skills/SKILL.md +19 -2
- package/src/skills/typeclaw-troubleshooting/SKILL.md +15 -2
- package/typeclaw.schema.json +12 -1
- package/src/secrets/claude-credentials-json.ts +0 -129
- package/src/secrets/codex-auth-json.ts +0 -102
- package/src/secrets/export-claude-credentials-file.ts +0 -270
- package/src/secrets/export-codex-auth-file.ts +0 -250
- package/src/skills/typeclaw-claude-code/references/stop-hook.md +0 -101
- package/src/skills/typeclaw-claude-code/references/tmux-driving.md +0 -243
- package/src/skills/typeclaw-codex-cli/references/stop-hook.md +0 -92
- package/src/skills/typeclaw-codex-cli/references/tmux-driving.md +0 -239
|
@@ -7,16 +7,20 @@ import type { InboundAttachment, InboundMessage } from '@/channels/types'
|
|
|
7
7
|
import { encodeSlackReactionRef } from './slack-bot-reactions'
|
|
8
8
|
import { hasSlackMessageShareAttachments } from './slack-bot-reference'
|
|
9
9
|
import { slackTsToMillis } from './slack-bot-time'
|
|
10
|
+
import { addressesSlackSelf, admitSlackInbound, type SlackInboundSource } from './slack-inbound-revision'
|
|
10
11
|
|
|
11
12
|
export type SlackInboundMessageEvent = SlackSocketModeMessageEvent
|
|
12
13
|
export type SlackInboundAppMentionEvent = SlackSocketModeAppMentionEvent
|
|
13
14
|
|
|
14
15
|
export type InboundDropReason =
|
|
15
16
|
| 'self_author' // event.user === botUserId; we never route our own messages back to ourselves
|
|
16
|
-
| 'no_user' // event has no `user` field (e.g. system messages: channel_join
|
|
17
|
+
| 'no_user' // event has no `user` field (e.g. system messages: channel_join)
|
|
17
18
|
| 'slack_system_message' // non-replyable Slack message subtype events (e.g. channel_topic)
|
|
18
19
|
| 'empty_text' // event has neither text nor files — nothing for the agent to act on
|
|
19
20
|
| 'pre_connect' // bot identity is not known yet, so mention/self/reply classification cannot be trusted
|
|
21
|
+
| 'unverified_edit' // edit without provable previous body / valid edit marker, or a flattened edited copy
|
|
22
|
+
| 'edit_without_new_mention' // edit that does not newly address the bot (typo fix, unchanged/removed mention)
|
|
23
|
+
| 'edited_control' // edit-derived command or claim code; edits are never control traffic
|
|
20
24
|
|
|
21
25
|
export type InboundClassification =
|
|
22
26
|
| { kind: 'drop'; reason: InboundDropReason }
|
|
@@ -34,6 +38,9 @@ export type SlackInboundContext = {
|
|
|
34
38
|
// alias-driven thread anchoring". The router's `computeSelfAliases`
|
|
35
39
|
// is the source of truth; the adapter just forwards it.
|
|
36
40
|
selfAliases?: readonly string[]
|
|
41
|
+
// Listener that delivered the event. Only an `app_mention` delivery may use
|
|
42
|
+
// its `edited` marker as a first-engagement fallback; omitted means 'message'.
|
|
43
|
+
source?: SlackInboundSource
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
// All decision logic for "should this Socket Mode message event be routed to
|
|
@@ -47,6 +54,10 @@ export function classifyInbound(
|
|
|
47
54
|
_config: ChannelAdapterConfig,
|
|
48
55
|
context: SlackInboundContext,
|
|
49
56
|
): InboundClassification {
|
|
57
|
+
// Edits are gated on the raw envelope before normalization drops its subtype.
|
|
58
|
+
const admission = admitSlackInbound(event, context.botUserId, context.source)
|
|
59
|
+
if (admission.kind === 'drop') return { kind: 'drop', reason: admission.reason }
|
|
60
|
+
event = admission.event
|
|
50
61
|
// Self-drop is the hard floor: never route our own messages back to
|
|
51
62
|
// ourselves. The check requires `botUserId` (post-auth.test); before that,
|
|
52
63
|
// fail closed below because mention, reply, and self classification all
|
|
@@ -55,7 +66,7 @@ export function classifyInbound(
|
|
|
55
66
|
return { kind: 'drop', reason: 'self_author' }
|
|
56
67
|
}
|
|
57
68
|
if (event.user === undefined || event.user === '') {
|
|
58
|
-
// System events (channel_join,
|
|
69
|
+
// System events (channel_join, …) have no `user`;
|
|
59
70
|
// they were also the ONLY way previously to flag bot_message subtype
|
|
60
71
|
// events with no user. Now that we accept peer bots, a `bot_message`
|
|
61
72
|
// subtype WITH a user (rare, but happens for legacy integrations) is
|
|
@@ -89,8 +100,7 @@ export function classifyInbound(
|
|
|
89
100
|
// both are an invitation to participate. Treating them identically also
|
|
90
101
|
// means the existing 'mention' trigger in typeclaw.json catches both
|
|
91
102
|
// without any new config surface.
|
|
92
|
-
const
|
|
93
|
-
const isBotMention = hasGroupMention || rawText.includes(`<@${context.botUserId}>`)
|
|
103
|
+
const isBotMention = addressesSlackSelf(rawText, context.botUserId)
|
|
94
104
|
// Top-level alias addressing (e.g. "Momo!" / "@Momo" by name) is engagement-equivalent
|
|
95
105
|
// to a `<@bot>` mention (see engagement.ts: alias is unconditional and
|
|
96
106
|
// ranks alongside explicit triggers). Anchor `thread` on the inbound
|
|
@@ -148,6 +158,10 @@ export function classifyInbound(
|
|
|
148
158
|
text,
|
|
149
159
|
...(attachments.length > 0 ? { attachments } : {}),
|
|
150
160
|
externalMessageId: event.ts,
|
|
161
|
+
accountIdentity: `slack-bot:${context.teamId}:${context.botUserId}`,
|
|
162
|
+
eventKind: 'message',
|
|
163
|
+
// One engagement per Slack message: edits never mint a new revision.
|
|
164
|
+
revision: 'original',
|
|
151
165
|
reactionRef: encodeSlackReactionRef({ channel: event.channel, ts: event.ts }),
|
|
152
166
|
authorId: event.user,
|
|
153
167
|
authorName: event.user,
|
|
@@ -172,13 +186,6 @@ export function isRouteableSlackMessageSubtype(subtype: string | undefined): boo
|
|
|
172
186
|
// can do a clean `includes()` check against the bot's own id.
|
|
173
187
|
const MENTION_PATTERN = /<@([UW][A-Z0-9]+)(?:\|[^>]*)?>/g
|
|
174
188
|
|
|
175
|
-
// Slack's group mention markup uses `!` (not `@`) and may carry an optional
|
|
176
|
-
// `|label` suffix, same as user mentions. We deliberately exclude the
|
|
177
|
-
// `<!subteam^ID>` form — engaging on every user-group ping would require
|
|
178
|
-
// knowing which subteams the bot is a member of, which is outside what
|
|
179
|
-
// Socket Mode events surface to us.
|
|
180
|
-
const GROUP_MENTION_PATTERN = /<!(?:here|channel|everyone)(?:\|[^>]*)?>/
|
|
181
|
-
|
|
182
189
|
function extractMentionedUserIds(text: string): string[] {
|
|
183
190
|
const seen = new Set<string>()
|
|
184
191
|
for (const match of text.matchAll(MENTION_PATTERN)) {
|
|
@@ -4,48 +4,131 @@ export const SLACK_DEDUPE_CAPACITY = 256
|
|
|
4
4
|
|
|
5
5
|
export type SlackDedupeMatch = 'client_msg_id' | 'channel_ts'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type DedupeEvent = Pick<SlackInboundMessageEvent, 'channel' | 'ts' | 'client_msg_id' | 'text'>
|
|
8
|
+
type DeliveryState = { text: string | undefined; mentioned: boolean }
|
|
9
|
+
type Delivery = DeliveryState & {
|
|
10
|
+
committed?: DeliveryState
|
|
11
|
+
pending: Set<DeliveryState>
|
|
12
|
+
mergedInto?: Delivery
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
export type SlackDedupeReservation = { commit: () => void; rollback: () => void }
|
|
16
|
+
|
|
12
17
|
export type SlackDedupe = {
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
// A suppressed delivery still associates its retry identities synchronously.
|
|
19
|
+
check: (event: DedupeEvent, isBotMention?: boolean) => SlackDedupeMatch | null
|
|
20
|
+
mark: (event: DedupeEvent, isBotMention?: boolean) => void
|
|
21
|
+
// Reserve before asynchronous enrichment; roll back if durable admission fails.
|
|
22
|
+
reserve: (event: DedupeEvent, isBotMention?: boolean) => SlackDedupeReservation
|
|
15
23
|
}
|
|
16
24
|
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// Slack's API contract — identical `client_msg_id`). `channel:ts` is the
|
|
22
|
-
// fallback because it is the only key available for events Slack does not
|
|
23
|
-
// stamp with `client_msg_id` (bot messages, system messages, and historically
|
|
24
|
-
// `app_mention` envelopes).
|
|
25
|
+
// Keep both retry identities: client_msg_id survives Slack resends with a fresh
|
|
26
|
+
// ts, while channel:ts also covers app_mention envelopes without client_msg_id.
|
|
27
|
+
// An identity may promote from observation to mention only on changed raw text.
|
|
28
|
+
// Once mentioned, further edits cannot re-engage it while either ring retains it.
|
|
25
29
|
export function createSlackDedupe(capacity: number = SLACK_DEDUPE_CAPACITY): SlackDedupe {
|
|
26
|
-
const tsRing = new
|
|
27
|
-
const clientMsgIdRing = new
|
|
30
|
+
const tsRing = new Map<string, Delivery>()
|
|
31
|
+
const clientMsgIdRing = new Map<string, Delivery>()
|
|
32
|
+
|
|
33
|
+
const canonical = (delivery: Delivery): Delivery => {
|
|
34
|
+
while (delivery.mergedInto !== undefined) delivery = delivery.mergedInto
|
|
35
|
+
return delivery
|
|
36
|
+
}
|
|
37
|
+
const combine = (previous: DeliveryState | undefined, next: DeliveryState): DeliveryState =>
|
|
38
|
+
previous === undefined || (next.mentioned && !previous.mentioned) ? { ...next } : previous
|
|
39
|
+
const refresh = (delivery: Delivery): void => {
|
|
40
|
+
let state = delivery.committed
|
|
41
|
+
for (const pending of delivery.pending) state = combine(state, pending)
|
|
42
|
+
if (state !== undefined) {
|
|
43
|
+
delivery.text = state.text
|
|
44
|
+
delivery.mentioned = state.mentioned
|
|
45
|
+
}
|
|
46
|
+
}
|
|
28
47
|
|
|
29
|
-
const remember = (ring:
|
|
30
|
-
if (ring.has(key))
|
|
31
|
-
|
|
32
|
-
const oldest = ring.values().next().value
|
|
48
|
+
const remember = (ring: Map<string, Delivery>, key: string, delivery: Delivery): void => {
|
|
49
|
+
if (!ring.has(key) && ring.size >= capacity) {
|
|
50
|
+
const oldest = ring.keys().next().value
|
|
33
51
|
if (oldest !== undefined) ring.delete(oldest)
|
|
34
52
|
}
|
|
35
|
-
ring.
|
|
53
|
+
ring.set(key, delivery)
|
|
54
|
+
}
|
|
55
|
+
const isDuplicate = (previous: Delivery | undefined, event: DedupeEvent, mentioned: boolean): boolean =>
|
|
56
|
+
previous !== undefined &&
|
|
57
|
+
!(
|
|
58
|
+
mentioned &&
|
|
59
|
+
!previous.mentioned &&
|
|
60
|
+
previous.text !== undefined &&
|
|
61
|
+
event.text !== undefined &&
|
|
62
|
+
previous.text !== event.text
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const associate = (event: DedupeEvent): Delivery => {
|
|
66
|
+
const key = `${event.channel}:${event.ts}`
|
|
67
|
+
const cmid = event.client_msg_id
|
|
68
|
+
const byTs = tsRing.get(key)
|
|
69
|
+
const byClient = cmid ? clientMsgIdRing.get(cmid) : undefined
|
|
70
|
+
const delivery: Delivery = byClient ??
|
|
71
|
+
byTs ?? { text: event.text, mentioned: false, pending: new Set<DeliveryState>() }
|
|
72
|
+
if (byTs !== undefined && byTs !== delivery) {
|
|
73
|
+
if (byTs.committed !== undefined) delivery.committed = combine(delivery.committed, byTs.committed)
|
|
74
|
+
for (const pending of byTs.pending) delivery.pending.add(pending)
|
|
75
|
+
byTs.mergedInto = delivery
|
|
76
|
+
refresh(delivery)
|
|
77
|
+
// Earlier resends can leave several timestamp aliases. Reconcile all of
|
|
78
|
+
// them, not only the two keys on this envelope. Scans are bounded by the
|
|
79
|
+
// ring capacities and needed only when two distinct records converge.
|
|
80
|
+
for (const [alias, previous] of tsRing) {
|
|
81
|
+
if (previous === byTs) tsRing.set(alias, delivery)
|
|
82
|
+
}
|
|
83
|
+
for (const [alias, previous] of clientMsgIdRing) {
|
|
84
|
+
if (previous === byTs) clientMsgIdRing.set(alias, delivery)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
remember(tsRing, key, delivery)
|
|
88
|
+
if (cmid) remember(clientMsgIdRing, cmid, delivery)
|
|
89
|
+
return delivery
|
|
36
90
|
}
|
|
37
91
|
|
|
38
92
|
return {
|
|
39
|
-
check: (event) => {
|
|
93
|
+
check: (event, mentioned = false) => {
|
|
40
94
|
const cmid = event.client_msg_id
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
95
|
+
const match =
|
|
96
|
+
cmid && isDuplicate(clientMsgIdRing.get(cmid), event, mentioned)
|
|
97
|
+
? 'client_msg_id'
|
|
98
|
+
: isDuplicate(tsRing.get(`${event.channel}:${event.ts}`), event, mentioned)
|
|
99
|
+
? 'channel_ts'
|
|
100
|
+
: null
|
|
101
|
+
if (match !== null) associate(event)
|
|
102
|
+
return match
|
|
44
103
|
},
|
|
45
|
-
mark: (event) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
104
|
+
mark: (event, mentioned = false) => {
|
|
105
|
+
const delivery = associate(event)
|
|
106
|
+
delivery.committed = combine(delivery.committed, { text: event.text, mentioned })
|
|
107
|
+
refresh(delivery)
|
|
108
|
+
},
|
|
109
|
+
reserve: (event, mentioned = false) => {
|
|
110
|
+
const original = associate(event)
|
|
111
|
+
const pending = { text: event.text, mentioned }
|
|
112
|
+
original.pending.add(pending)
|
|
113
|
+
refresh(original)
|
|
114
|
+
let settled = false
|
|
115
|
+
const finish = (commit: boolean): void => {
|
|
116
|
+
if (settled) return
|
|
117
|
+
settled = true
|
|
118
|
+
const delivery = canonical(original)
|
|
119
|
+
delivery.pending.delete(pending)
|
|
120
|
+
if (commit) delivery.committed = combine(delivery.committed, pending)
|
|
121
|
+
refresh(delivery)
|
|
122
|
+
if (delivery.committed !== undefined || delivery.pending.size > 0) return
|
|
123
|
+
// Suppressed retries can have acquired additional aliases while pending.
|
|
124
|
+
for (const [key, value] of tsRing) {
|
|
125
|
+
if (value === delivery) tsRing.delete(key)
|
|
126
|
+
}
|
|
127
|
+
for (const [key, value] of clientMsgIdRing) {
|
|
128
|
+
if (value === delivery) clientMsgIdRing.delete(key)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return { commit: () => finish(true), rollback: () => finish(false) }
|
|
49
132
|
},
|
|
50
133
|
}
|
|
51
134
|
}
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
} from '@/channels/types'
|
|
10
10
|
|
|
11
11
|
import { describeError } from '../describe-error'
|
|
12
|
+
import { createOwnReactionCallbacks } from './own-reactions'
|
|
12
13
|
|
|
13
14
|
// The reactable target on Slack: a message is addressed by its channel id plus
|
|
14
15
|
// the message `ts`. The classifier stamps this because `ts` is the inbound's
|
|
@@ -146,6 +147,7 @@ function classifySlackError(code: string | null): ReactionErrorCode {
|
|
|
146
147
|
return 'not-found'
|
|
147
148
|
case 'ratelimited':
|
|
148
149
|
case 'rate_limited':
|
|
150
|
+
case 'slack_webapi_rate_limited_error':
|
|
149
151
|
return 'rate-limited'
|
|
150
152
|
default:
|
|
151
153
|
return 'transient'
|
|
@@ -163,3 +165,19 @@ function parseRecord(value: string): Record<string, unknown> | null {
|
|
|
163
165
|
? (parsed as Record<string, unknown>)
|
|
164
166
|
: null
|
|
165
167
|
}
|
|
168
|
+
|
|
169
|
+
export function createSlackOwnReactionCallbacks(deps: {
|
|
170
|
+
client: Pick<SlackBotClient, 'removeReaction'>
|
|
171
|
+
identity: () => string | null | Promise<string | null>
|
|
172
|
+
}) {
|
|
173
|
+
return createOwnReactionCallbacks({
|
|
174
|
+
adapter: 'slack-bot',
|
|
175
|
+
identity: deps.identity,
|
|
176
|
+
decode: decodeSlackReactionRef,
|
|
177
|
+
encode: encodeSlackReactionRef,
|
|
178
|
+
emoji: normalizeEmoji,
|
|
179
|
+
remove: (target, emoji) => deps.client.removeReaction(target.channel, target.ts, emoji),
|
|
180
|
+
classify: (error) => classifySlackError(slackErrorCode(error)),
|
|
181
|
+
absent: (error) => slackErrorCode(error) === 'no_reaction',
|
|
182
|
+
})
|
|
183
|
+
}
|
|
@@ -42,6 +42,8 @@ import { chunkMarkdown } from '@/markdown'
|
|
|
42
42
|
|
|
43
43
|
import { describeError } from '../describe-error'
|
|
44
44
|
import { addSlackMentionHints } from './mention-hints'
|
|
45
|
+
import { withOutboundAccount } from './outbound-account'
|
|
46
|
+
import { createBotRecoveryCallbacks, sendBotRecovery } from './recovery-correlation'
|
|
45
47
|
import { downloadSlackAttachment, type SlackAttachmentFetch } from './slack-attachment-download'
|
|
46
48
|
import { createSlackAuthorResolver, type SlackAuthorResolver } from './slack-bot-author-resolver'
|
|
47
49
|
import { createSlackChannelResolver } from './slack-bot-channel-resolver'
|
|
@@ -54,13 +56,14 @@ import {
|
|
|
54
56
|
type SlackInboundAppMentionEvent,
|
|
55
57
|
type SlackInboundMessageEvent,
|
|
56
58
|
} from './slack-bot-classify'
|
|
57
|
-
import { createSlackDedupe } from './slack-bot-dedupe'
|
|
59
|
+
import { createSlackDedupe, type SlackDedupeReservation } from './slack-bot-dedupe'
|
|
58
60
|
import { createSlackEditMessageCallback } from './slack-bot-edit'
|
|
59
61
|
import {
|
|
60
62
|
createSlackReactionCallback,
|
|
61
63
|
createSlackRemoveReactionCallback,
|
|
62
64
|
encodeSlackReactionRef,
|
|
63
65
|
} from './slack-bot-reactions'
|
|
66
|
+
import { createSlackOwnReactionCallbacks } from './slack-bot-reactions'
|
|
64
67
|
import { enrichSlackReferenceContext } from './slack-bot-reference'
|
|
65
68
|
import {
|
|
66
69
|
buildSlashAckPayload,
|
|
@@ -72,6 +75,8 @@ import {
|
|
|
72
75
|
} from './slack-bot-slash-commands'
|
|
73
76
|
import { slackTsToMillis } from './slack-bot-time'
|
|
74
77
|
import { toSlackMrkdwn } from './slack-format'
|
|
78
|
+
import { admitSlackInbound, type SlackInboundSource } from './slack-inbound-revision'
|
|
79
|
+
import { invalidSlackThreadTs } from './slack-thread-ts'
|
|
75
80
|
|
|
76
81
|
// One slash command per logical agent gesture. Mirrors the discord-bot
|
|
77
82
|
// SLASH_COMMANDS constant so the cross-platform set stays consistent — when
|
|
@@ -250,7 +255,8 @@ export function createThreadCommandHandler(
|
|
|
250
255
|
// promote them to a message-shaped event for the shared classifier. The
|
|
251
256
|
// promoted event is classified as a regular channel message; the
|
|
252
257
|
// `<@BOT_USER_ID>` substring inside `text` is what makes the classifier
|
|
253
|
-
// mark it as a mention.
|
|
258
|
+
// mark it as a mention. `edited` is carried over because an app_mention for an
|
|
259
|
+
// edit lacks the previous body and must stay subject to the edit gate.
|
|
254
260
|
export function promoteAppMentionToMessage(event: SlackInboundAppMentionEvent): SlackInboundMessageEvent {
|
|
255
261
|
return {
|
|
256
262
|
type: 'message',
|
|
@@ -262,6 +268,7 @@ export function promoteAppMentionToMessage(event: SlackInboundAppMentionEvent):
|
|
|
262
268
|
...(event.thread_ts !== undefined ? { thread_ts: event.thread_ts } : {}),
|
|
263
269
|
...(event.event_ts !== undefined ? { event_ts: event.event_ts } : {}),
|
|
264
270
|
...(event.client_msg_id !== undefined ? { client_msg_id: event.client_msg_id } : {}),
|
|
271
|
+
...(event.edited !== undefined ? { edited: event.edited as SlackInboundMessageEvent['edited'] } : {}),
|
|
265
272
|
}
|
|
266
273
|
}
|
|
267
274
|
|
|
@@ -974,6 +981,8 @@ export function createOutboundCallback(deps: {
|
|
|
974
981
|
formatChannelTag: (workspace: string, chat: string) => Promise<string>
|
|
975
982
|
readFile?: (path: string) => Promise<Buffer>
|
|
976
983
|
typingTracker?: Pick<SlackTypingTracker, 'clearAfterSend'>
|
|
984
|
+
token?: string
|
|
985
|
+
fetchImpl?: typeof fetch
|
|
977
986
|
}): OutboundCallback {
|
|
978
987
|
const { client, logger, formatChannelTag, typingTracker } = deps
|
|
979
988
|
const readFile = deps.readFile ?? readAttachmentBuffer
|
|
@@ -981,11 +990,17 @@ export function createOutboundCallback(deps: {
|
|
|
981
990
|
if (msg.adapter !== 'slack-bot') {
|
|
982
991
|
return { ok: false, error: `unknown adapter: ${msg.adapter}` }
|
|
983
992
|
}
|
|
993
|
+
if (msg.sendOptions?.accounting === 'recovery') {
|
|
994
|
+
if (!deps.token) return { ok: false, error: 'recovery-token-unavailable' }
|
|
995
|
+
return sendBotRecovery('slack-bot', deps.token, msg, deps.fetchImpl)
|
|
996
|
+
}
|
|
984
997
|
const text = msg.text ?? ''
|
|
985
998
|
const attachments = msg.attachments ?? []
|
|
986
999
|
if (text === '' && attachments.length === 0) {
|
|
987
1000
|
return { ok: false, error: 'message has neither text nor attachments' }
|
|
988
1001
|
}
|
|
1002
|
+
const invalidThread = invalidSlackThreadTs(msg.thread)
|
|
1003
|
+
if (invalidThread !== null) return { ok: false, error: invalidThread }
|
|
989
1004
|
const tag = await formatChannelTag(msg.workspace, msg.chat)
|
|
990
1005
|
logger.info(
|
|
991
1006
|
`[slack-bot] outbound ${tag} text_len=${text.length} attachments=${attachments.length}${msg.thread ? ` thread=${msg.thread}` : ''}`,
|
|
@@ -999,8 +1014,14 @@ export function createOutboundCallback(deps: {
|
|
|
999
1014
|
try {
|
|
1000
1015
|
for (let i = 0; i < chunks.length; i++) {
|
|
1001
1016
|
const chunk = chunks[i]!
|
|
1002
|
-
const options: { thread_ts?: string; blocks?: unknown[] } = {
|
|
1017
|
+
const options: { thread_ts?: string; blocks?: unknown[]; unfurl_links?: boolean; unfurl_media?: boolean } = {
|
|
1018
|
+
blocks: [buildMarkdownBlock(chunk)],
|
|
1019
|
+
}
|
|
1003
1020
|
if (threadTs !== null) options.thread_ts = threadTs
|
|
1021
|
+
if (msg.link_previews === false) {
|
|
1022
|
+
options.unfurl_links = false
|
|
1023
|
+
options.unfurl_media = false
|
|
1024
|
+
}
|
|
1004
1025
|
const sent = await client.postMessage(msg.chat, chunk, options)
|
|
1005
1026
|
sentTs.push(sent.ts)
|
|
1006
1027
|
logger.info(
|
|
@@ -1150,6 +1171,11 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1150
1171
|
const logger = options.logger ?? consoleLogger
|
|
1151
1172
|
const client = options.createClient?.() ?? new SlackBotClient()
|
|
1152
1173
|
const fetchImpl = options.fetchImpl ?? fetch
|
|
1174
|
+
const recoveryCallbacks = createBotRecoveryCallbacks('slack-bot', options.token, fetchImpl, (workspace) =>
|
|
1175
|
+
botUserId !== null && teamId !== null && (workspace === undefined || workspace === '@dm' || workspace === teamId)
|
|
1176
|
+
? `slack-bot:${teamId}:${botUserId}`
|
|
1177
|
+
: undefined,
|
|
1178
|
+
)
|
|
1153
1179
|
let listener: SlackBotListener | null = null
|
|
1154
1180
|
let botUserId: string | null = null
|
|
1155
1181
|
let teamId: string | null = null
|
|
@@ -1205,17 +1231,29 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1205
1231
|
historyCallback,
|
|
1206
1232
|
})
|
|
1207
1233
|
|
|
1208
|
-
const outboundCallback =
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1234
|
+
const outboundCallback = withOutboundAccount(
|
|
1235
|
+
createOutboundCallback({
|
|
1236
|
+
client,
|
|
1237
|
+
token: options.token,
|
|
1238
|
+
fetchImpl,
|
|
1239
|
+
logger,
|
|
1240
|
+
formatChannelTag,
|
|
1241
|
+
typingTracker,
|
|
1242
|
+
}),
|
|
1243
|
+
(workspace) => recoveryCallbacks.cachedAccountIdentity?.(workspace),
|
|
1244
|
+
)
|
|
1214
1245
|
|
|
1215
1246
|
const fetchAttachmentCallback = createFetchAttachmentCallback({ client, logger, token: options.token })
|
|
1216
1247
|
|
|
1217
1248
|
const reactionCallback = createSlackReactionCallback({ client })
|
|
1218
1249
|
const removeReactionCallback = createSlackRemoveReactionCallback({ client })
|
|
1250
|
+
const ownReaction = createSlackOwnReactionCallbacks({
|
|
1251
|
+
client,
|
|
1252
|
+
identity: async () => {
|
|
1253
|
+
const self = await client.testAuth()
|
|
1254
|
+
return self.team_id && self.user_id ? `${self.team_id}:${self.user_id}` : null
|
|
1255
|
+
},
|
|
1256
|
+
})
|
|
1219
1257
|
const editMessageCallback = createSlackEditMessageCallback({ token: options.token, fetchImpl })
|
|
1220
1258
|
|
|
1221
1259
|
const dedupe = createSlackDedupe()
|
|
@@ -1245,29 +1283,52 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1245
1283
|
},
|
|
1246
1284
|
})
|
|
1247
1285
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
): Promise<void> => {
|
|
1286
|
+
// Gate raw edits before dedupe, commands and reference enrichment. `source`
|
|
1287
|
+
// is the listener that delivered the event: app_mention promotion rewrites
|
|
1288
|
+
// its type to 'message', so it cannot be recovered from the event itself.
|
|
1289
|
+
const handleMessageEvent = async (rawEvent: SlackInboundMessageEvent, source: SlackInboundSource): Promise<void> => {
|
|
1290
|
+
const inboundTeamId = teamId
|
|
1291
|
+
const inboundBotId = botUserId
|
|
1292
|
+
let admissionReservation: SlackDedupeReservation | undefined
|
|
1252
1293
|
inflightInbounds++
|
|
1253
1294
|
try {
|
|
1295
|
+
if (inboundTeamId === null) {
|
|
1296
|
+
logger.warn(`[slack-bot] dropped ts=${rawEvent.ts} reason=pre_connected (team_id unknown)`)
|
|
1297
|
+
return
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// A rejected edit must not reach `!cmd` interception: edited control
|
|
1301
|
+
// text would otherwise execute without a fresh, original gesture.
|
|
1302
|
+
const admission = admitSlackInbound(rawEvent, inboundBotId, source)
|
|
1303
|
+
if (admission.kind === 'drop') {
|
|
1304
|
+
logger.info(`[slack-bot] dropped ts=${rawEvent.ts} reason=${admission.reason} (source=${source})`)
|
|
1305
|
+
return
|
|
1306
|
+
}
|
|
1307
|
+
const event = admission.event
|
|
1254
1308
|
const text = event.text ?? ''
|
|
1255
1309
|
const userId = event.user ?? 'unknown'
|
|
1256
|
-
const inboundWorkspace = event.channel_type === 'im' ? '@dm' :
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
if (
|
|
1266
|
-
logger.
|
|
1310
|
+
const inboundWorkspace = event.channel_type === 'im' ? '@dm' : inboundTeamId
|
|
1311
|
+
const commandInput = {
|
|
1312
|
+
text,
|
|
1313
|
+
channel: event.channel,
|
|
1314
|
+
threadTs: event.thread_ts ?? null,
|
|
1315
|
+
isDm: event.channel_type === 'im',
|
|
1316
|
+
teamId: inboundTeamId,
|
|
1317
|
+
invokerId: userId,
|
|
1318
|
+
}
|
|
1319
|
+
if (admission.isEdit && parseThreadCommand(commandInput, SLACK_SLASH_COMMAND_NAMES).kind === 'parsed') {
|
|
1320
|
+
logger.info(`[slack-bot] dropped ts=${event.ts} reason=edited_control (source=${source})`)
|
|
1267
1321
|
return
|
|
1268
1322
|
}
|
|
1269
1323
|
|
|
1270
|
-
const
|
|
1324
|
+
const verdict = classifyInbound(rawEvent, options.configRef(), {
|
|
1325
|
+
teamId: inboundTeamId,
|
|
1326
|
+
botUserId: inboundBotId,
|
|
1327
|
+
source,
|
|
1328
|
+
...(options.selfAliasesRef ? { selfAliases: options.selfAliasesRef() } : {}),
|
|
1329
|
+
})
|
|
1330
|
+
const isBotMention = verdict.kind === 'route' && verdict.payload.isBotMention
|
|
1331
|
+
const dedupeMatch = dedupe.check(event, isBotMention)
|
|
1271
1332
|
if (dedupeMatch !== null) {
|
|
1272
1333
|
logger.info(
|
|
1273
1334
|
`[slack-bot] dropped ts=${event.ts} reason=duplicate_delivery (source=${source}, matched=${dedupeMatch})`,
|
|
@@ -1275,50 +1336,43 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1275
1336
|
return
|
|
1276
1337
|
}
|
|
1277
1338
|
|
|
1278
|
-
// Intercept `!cmd`
|
|
1279
|
-
//
|
|
1280
|
-
//
|
|
1281
|
-
//
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
// instant the command is recognised (before the router await), closing
|
|
1285
|
-
// the check→execute race for duplicate deliveries.
|
|
1286
|
-
if (event.user !== undefined && event.user !== '' && (botUserId === null || event.user !== botUserId)) {
|
|
1339
|
+
// Intercept `!cmd` before acting on the classifier verdict: commands are
|
|
1340
|
+
// control traffic, not agent messages. Retain self-author/userless floors.
|
|
1341
|
+
// The handler reserves synchronously before executing, and a consumed
|
|
1342
|
+
// command cannot later promote into a mention.
|
|
1343
|
+
if (event.user !== undefined && event.user !== '' && (inboundBotId === null || event.user !== inboundBotId)) {
|
|
1344
|
+
let commandReserved = false
|
|
1287
1345
|
const reserve = (): boolean => {
|
|
1288
|
-
if (dedupe.check(event) !== null) return false
|
|
1289
|
-
dedupe.mark(event)
|
|
1346
|
+
if (dedupe.check(event, isBotMention) !== null) return false
|
|
1347
|
+
dedupe.mark(event, true)
|
|
1348
|
+
commandReserved = true
|
|
1290
1349
|
return true
|
|
1291
1350
|
}
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
isDm: event.channel_type === 'im',
|
|
1298
|
-
teamId,
|
|
1299
|
-
invokerId: event.user,
|
|
1300
|
-
},
|
|
1301
|
-
reserve,
|
|
1302
|
-
)
|
|
1303
|
-
if (outcome.kind === 'executed') return
|
|
1304
|
-
if (outcome.kind === 'duplicate') {
|
|
1305
|
-
logger.info(`[slack-bot] dropped ts=${event.ts} reason=duplicate_delivery (thread-command race)`)
|
|
1351
|
+
const outcomePromise = handleThreadCommand(commandInput, reserve)
|
|
1352
|
+
// The handler reserves synchronously before its first await. Do not
|
|
1353
|
+
// await a non-command: regular delivery must reserve in this same tick.
|
|
1354
|
+
if (commandReserved) {
|
|
1355
|
+
await outcomePromise
|
|
1306
1356
|
return
|
|
1307
1357
|
}
|
|
1308
1358
|
}
|
|
1309
1359
|
|
|
1310
|
-
const verdict = classifyInbound(event, options.configRef(), {
|
|
1311
|
-
teamId,
|
|
1312
|
-
botUserId,
|
|
1313
|
-
...(options.selfAliasesRef ? { selfAliases: options.selfAliasesRef() } : {}),
|
|
1314
|
-
})
|
|
1315
1360
|
if (verdict.kind === 'drop') {
|
|
1316
1361
|
logger.info(`[slack-bot] dropped ts=${event.ts} reason=${verdict.reason}${dropHint(verdict.reason)}`)
|
|
1317
1362
|
return
|
|
1318
1363
|
}
|
|
1319
1364
|
|
|
1320
|
-
dedupe.
|
|
1321
|
-
const
|
|
1365
|
+
admissionReservation = dedupe.reserve(event, isBotMention)
|
|
1366
|
+
const [resolvedUserName, inboundTag] = await Promise.all([
|
|
1367
|
+
event.user !== undefined && event.user !== '' ? authorResolver.resolve(event.user) : Promise.resolve(userId),
|
|
1368
|
+
formatChannelTag(inboundWorkspace, event.channel),
|
|
1369
|
+
])
|
|
1370
|
+
logger.info(
|
|
1371
|
+
`[slack-bot] inbound source=${source} ts=${event.ts} user=${formatLabel(resolvedUserName, userId)} ${inboundTag} text_len=${text.length}`,
|
|
1372
|
+
)
|
|
1373
|
+
const hintedText = await addSlackMentionHints(verdict.payload.text, authorResolver.resolve, {
|
|
1374
|
+
botUserId: inboundBotId,
|
|
1375
|
+
})
|
|
1322
1376
|
const slackAttachments = Array.isArray(event.attachments) ? event.attachments : undefined
|
|
1323
1377
|
const referenceResult = await enrichSlackReferenceContext({
|
|
1324
1378
|
text: hintedText,
|
|
@@ -1340,7 +1394,9 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1340
1394
|
`[slack-bot] routed ts=${event.ts} ${routedTag} mention=${enriched.isBotMention} reply=${enriched.replyToBotMessageId !== null}`,
|
|
1341
1395
|
)
|
|
1342
1396
|
await options.router.route(enriched)
|
|
1397
|
+
admissionReservation.commit()
|
|
1343
1398
|
} catch (err) {
|
|
1399
|
+
admissionReservation?.rollback()
|
|
1344
1400
|
logger.error(`[slack-bot] handleInbound failed: ${describeError(err)}`)
|
|
1345
1401
|
} finally {
|
|
1346
1402
|
inflightInbounds--
|
|
@@ -1433,8 +1489,11 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1433
1489
|
})
|
|
1434
1490
|
|
|
1435
1491
|
options.router.registerOutbound('slack-bot', outboundCallback)
|
|
1492
|
+
options.router.registerRecoveryAdapter('slack-bot', recoveryCallbacks)
|
|
1436
1493
|
options.router.registerReaction('slack-bot', reactionCallback)
|
|
1437
1494
|
options.router.registerRemoveReaction('slack-bot', removeReactionCallback)
|
|
1495
|
+
options.router.registerPrepareOwnReaction('slack-bot', ownReaction.prepare)
|
|
1496
|
+
options.router.registerRemoveOwnReaction('slack-bot', ownReaction.remove)
|
|
1438
1497
|
options.router.registerTyping('slack-bot', typingCallback)
|
|
1439
1498
|
options.router.setTypingCapability('slack-bot', true)
|
|
1440
1499
|
options.router.registerChannelNameResolver('slack-bot', channelResolver)
|
|
@@ -1454,8 +1513,11 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1454
1513
|
// !started and would otherwise skip cleanup), mirroring the github
|
|
1455
1514
|
// adapter's rollback path.
|
|
1456
1515
|
options.router.unregisterOutbound('slack-bot', outboundCallback)
|
|
1516
|
+
options.router.unregisterRecoveryAdapter('slack-bot', recoveryCallbacks)
|
|
1457
1517
|
options.router.unregisterReaction('slack-bot', reactionCallback)
|
|
1458
1518
|
options.router.unregisterRemoveReaction('slack-bot', removeReactionCallback)
|
|
1519
|
+
options.router.unregisterPrepareOwnReaction('slack-bot', ownReaction.prepare)
|
|
1520
|
+
options.router.unregisterRemoveOwnReaction('slack-bot', ownReaction.remove)
|
|
1459
1521
|
options.router.unregisterTyping('slack-bot', typingCallback)
|
|
1460
1522
|
options.router.setTypingCapability('slack-bot', false)
|
|
1461
1523
|
options.router.unregisterChannelNameResolver('slack-bot', channelResolver)
|
|
@@ -1483,11 +1545,14 @@ export function createSlackBotAdapter(options: SlackBotAdapterOptions): SlackBot
|
|
|
1483
1545
|
options.router.unregisterOutbound('slack-bot', outboundCallback)
|
|
1484
1546
|
options.router.unregisterReaction('slack-bot', reactionCallback)
|
|
1485
1547
|
options.router.unregisterRemoveReaction('slack-bot', removeReactionCallback)
|
|
1548
|
+
options.router.unregisterPrepareOwnReaction('slack-bot', ownReaction.prepare)
|
|
1549
|
+
options.router.unregisterRemoveOwnReaction('slack-bot', ownReaction.remove)
|
|
1486
1550
|
options.router.unregisterTyping('slack-bot', typingCallback)
|
|
1487
1551
|
options.router.setTypingCapability('slack-bot', false)
|
|
1488
1552
|
options.router.unregisterChannelNameResolver('slack-bot', channelResolver)
|
|
1489
1553
|
options.router.unregisterSelfIdentity('slack-bot', selfIdentityResolver)
|
|
1490
1554
|
options.router.unregisterHistory('slack-bot', historyCallback)
|
|
1555
|
+
options.router.unregisterRecoveryAdapter('slack-bot', recoveryCallbacks)
|
|
1491
1556
|
options.router.unregisterMessageGet('slack-bot', messageGetCallback)
|
|
1492
1557
|
options.router.unregisterList('slack-bot', listCallback)
|
|
1493
1558
|
options.router.unregisterEditMessage('slack-bot', editMessageCallback)
|
|
@@ -1517,6 +1582,9 @@ function dropHint(reason: InboundDropReason): string {
|
|
|
1517
1582
|
case 'pre_connect':
|
|
1518
1583
|
case 'self_author':
|
|
1519
1584
|
case 'slack_system_message':
|
|
1585
|
+
case 'unverified_edit':
|
|
1586
|
+
case 'edit_without_new_mention':
|
|
1587
|
+
case 'edited_control':
|
|
1520
1588
|
return ''
|
|
1521
1589
|
}
|
|
1522
1590
|
}
|