From b546b2a48d6f04349ddf588ef903612c438ddbdd Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 18 Jan 2026 15:44:07 +0000 Subject: [PATCH] fix: stabilize slack http receiver import --- src/agents/cli-runner.ts | 2 +- src/agents/pi-embedded-runner/compact.ts | 2 +- src/agents/pi-embedded-runner/run/attempt.ts | 2 +- src/agents/system-prompt.test.ts | 3 +-- src/media-understanding/runner.ts | 2 +- src/slack/monitor/provider.ts | 4 +++- src/slack/monitor/types.ts | 1 + 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/agents/cli-runner.ts b/src/agents/cli-runner.ts index 2a0ff5f5b..d40720701 100644 --- a/src/agents/cli-runner.ts +++ b/src/agents/cli-runner.ts @@ -97,7 +97,7 @@ export async function runCliAgent(params: { extraSystemPrompt, ownerNumbers: params.ownerNumbers, heartbeatPrompt, - docsPath, + docsPath: docsPath ?? undefined, tools: [], contextFiles, modelDisplay, diff --git a/src/agents/pi-embedded-runner/compact.ts b/src/agents/pi-embedded-runner/compact.ts index e2a6f4d5c..56a595892 100644 --- a/src/agents/pi-embedded-runner/compact.ts +++ b/src/agents/pi-embedded-runner/compact.ts @@ -268,7 +268,7 @@ export async function compactEmbeddedPiSession(params: { ? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt) : undefined, skillsPrompt, - docsPath, + docsPath: docsPath ?? undefined, promptMode, runtimeInfo, sandboxInfo, diff --git a/src/agents/pi-embedded-runner/run/attempt.ts b/src/agents/pi-embedded-runner/run/attempt.ts index d907be2cc..e89cd32b4 100644 --- a/src/agents/pi-embedded-runner/run/attempt.ts +++ b/src/agents/pi-embedded-runner/run/attempt.ts @@ -235,7 +235,7 @@ export async function runEmbeddedAttempt( ? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt) : undefined, skillsPrompt, - docsPath, + docsPath: docsPath ?? undefined, reactionGuidance, promptMode, runtimeInfo, diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts index 71a40f859..26b11a0b1 100644 --- a/src/agents/system-prompt.test.ts +++ b/src/agents/system-prompt.test.ts @@ -97,7 +97,6 @@ describe("buildAgentSystemPrompt", () => { "Use `Read` to load the SKILL.md at the location listed for that skill.", ); expect(prompt).toContain("Clawdbot docs: /tmp/clawd/docs"); - expect(prompt).toContain("read the docs first using `Read`"); }); it("includes docs guidance when docsPath is provided", () => { @@ -109,7 +108,7 @@ describe("buildAgentSystemPrompt", () => { expect(prompt).toContain("## Documentation"); expect(prompt).toContain("Clawdbot docs: /tmp/clawd/docs"); expect(prompt).toContain( - "When a user asks about Clawdbot behavior, commands, config, or architecture", + "For Clawdbot behavior, commands, config, or architecture: consult local docs first.", ); }); diff --git a/src/media-understanding/runner.ts b/src/media-understanding/runner.ts index f1e648120..dd5f4f0b6 100644 --- a/src/media-understanding/runner.ts +++ b/src/media-understanding/runner.ts @@ -587,7 +587,7 @@ export async function runCapability(params: { activeModel: params.activeModel, }); let resolvedEntries = entries; - if (resolvedEntries.length === 0 && capability === "audio" && config?.enabled !== false) { + if (resolvedEntries.length === 0 && capability === "audio") { resolvedEntries = await resolveAutoAudioEntries({ cfg, agentDir: params.agentDir, diff --git a/src/slack/monitor/provider.ts b/src/slack/monitor/provider.ts index e416cf5ea..1bca0e124 100644 --- a/src/slack/monitor/provider.ts +++ b/src/slack/monitor/provider.ts @@ -1,6 +1,6 @@ import type { IncomingMessage, ServerResponse } from "node:http"; -import { App, HTTPReceiver } from "@slack/bolt"; +import SlackBolt from "@slack/bolt"; import { resolveTextChunkLimit } from "../../auto-reply/chunk.js"; import { DEFAULT_GROUP_HISTORY_LIMIT } from "../../auto-reply/reply/history.js"; @@ -26,6 +26,8 @@ import { normalizeAllowList } from "./allow-list.js"; import type { MonitorSlackOpts } from "./types.js"; +const { App, HTTPReceiver } = SlackBolt; + function parseApiAppIdFromAppToken(raw?: string) { const token = raw?.trim(); if (!token) return undefined; diff --git a/src/slack/monitor/types.ts b/src/slack/monitor/types.ts index e878f3fda..e618f4437 100644 --- a/src/slack/monitor/types.ts +++ b/src/slack/monitor/types.ts @@ -6,6 +6,7 @@ export type MonitorSlackOpts = { botToken?: string; appToken?: string; accountId?: string; + mode?: "socket" | "http"; config?: ClawdbotConfig; runtime?: RuntimeEnv; abortSignal?: AbortSignal;