Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/backend/src/gateway/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as broadcast from './broadcast.js'
import { openTerminal } from './terminal.js'

const HEARTBEAT_INTERVAL_MS = 30_000
const MAX_PAYLOAD_BYTES = 16 * 1024 * 1024 // 16 MB — enough for base64-encoded 10 MB images

function setupHeartbeat(wss: WebSocketServer) {
const heartbeat = setInterval(() => {
Expand All @@ -31,7 +32,7 @@ function markAlive(ws: WebSocket) {
// ── Client Gateway (/ws/client) — runs on its own port ────────────────

export function setupClientGateway(server: Server) {
const wss = new WebSocketServer({ server })
const wss = new WebSocketServer({ server, maxPayload: MAX_PAYLOAD_BYTES })
const clientRpc = createRpcDispatcher(clientHandlers)
setupHeartbeat(wss)

Expand Down Expand Up @@ -73,7 +74,7 @@ export function setupClientGateway(server: Server) {
// ── Agent Gateway (/ws/agent + terminal) — runs on its own port ───────

export function setupAgentGateway(server: Server) {
const wss = new WebSocketServer({ server })
const wss = new WebSocketServer({ server, maxPayload: MAX_PAYLOAD_BYTES })
const agentRpc = createRpcDispatcher(agentHandlers)
setupHeartbeat(wss)

Expand Down
15 changes: 14 additions & 1 deletion packages/backend/src/slack/slack-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,20 @@ export async function sendImageToSlack(
channelId: string,
): Promise<void> {
if (!webClient) throw new Error('Slack is not connected')
await uploadImageToSlack(imageUrl, alt, channelId)

if (!imageUrl.startsWith('/media/')) {
throw new Error(`Only local /media/ URLs are supported, got: ${imageUrl}`)
}

const filename = basename(imageUrl)
const filePath = join(MEDIA_DIR, filename)
const fileData = readFileSync(filePath)
await webClient.filesUploadV2({
channel_id: channelId,
file: fileData,
filename,
title: alt,
})
}

// ── Sync / Unsync ──────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/layout/settings-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ export class SettingsView extends LitElement {
},
oauth_config: {
scopes: {
bot: ['channels:history', 'channels:manage', 'channels:read', 'chat:write', 'chat:write.customize', 'users:read', 'app_mentions:read'],
bot: ['channels:history', 'channels:manage', 'channels:read', 'chat:write', 'chat:write.customize', 'files:write', 'users:read', 'app_mentions:read'],
},
},
settings: {
Expand Down
Loading