refactor: extract PER_REQUEST_TIMEOUT_MS to shared types (#1196)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES 2026-03-18 11:20:04 -06:00 committed by GitHub
parent 45247b7dd2
commit f99189d410
5 changed files with 8 additions and 8 deletions

View file

@ -2,11 +2,11 @@
* Remote Questions Discord adapter
*/
import type { ChannelAdapter, RemotePrompt, RemoteDispatchResult, RemoteAnswer, RemotePromptRef } from "./types.js";
import { PER_REQUEST_TIMEOUT_MS, type ChannelAdapter, type RemotePrompt, type RemoteDispatchResult, type RemoteAnswer, type RemotePromptRef } from "./types.js";
import { formatForDiscord, parseDiscordResponse, DISCORD_NUMBER_EMOJIS } from "./format.js";
const DISCORD_API = "https://discord.com/api/v10";
const PER_REQUEST_TIMEOUT_MS = 15_000;
export class DiscordAdapter implements ChannelAdapter {
readonly name = "discord" as const;
private botUserId: string | null = null;

View file

@ -9,8 +9,7 @@
import { resolveRemoteConfig } from "./config.js";
import type { ResolvedConfig } from "./config.js";
const PER_REQUEST_TIMEOUT_MS = 15_000;
import { PER_REQUEST_TIMEOUT_MS } from "./types.js";
/**
* Send a one-way notification to the configured remote channel.

View file

@ -2,11 +2,10 @@
* Remote Questions Slack adapter
*/
import type { ChannelAdapter, RemotePrompt, RemoteDispatchResult, RemoteAnswer, RemotePromptRef } from "./types.js";
import { PER_REQUEST_TIMEOUT_MS, type ChannelAdapter, type RemotePrompt, type RemoteDispatchResult, type RemoteAnswer, type RemotePromptRef } from "./types.js";
import { formatForSlack, parseSlackReply, parseSlackReactionResponse, SLACK_NUMBER_REACTION_NAMES } from "./format.js";
const SLACK_API = "https://slack.com/api";
const PER_REQUEST_TIMEOUT_MS = 15_000;
const SLACK_ACK_REACTION = "white_check_mark";
export class SlackAdapter implements ChannelAdapter {

View file

@ -2,11 +2,10 @@
* Remote Questions Telegram adapter
*/
import type { ChannelAdapter, RemotePrompt, RemoteDispatchResult, RemoteAnswer, RemotePromptRef } from "./types.js";
import { PER_REQUEST_TIMEOUT_MS, type ChannelAdapter, type RemotePrompt, type RemoteDispatchResult, type RemoteAnswer, type RemotePromptRef } from "./types.js";
import { formatForTelegram, parseTelegramResponse } from "./format.js";
const TELEGRAM_API = "https://api.telegram.org";
const PER_REQUEST_TIMEOUT_MS = 15_000;
export class TelegramAdapter implements ChannelAdapter {
readonly name = "telegram" as const;

View file

@ -2,6 +2,9 @@
* Remote Questions shared types
*/
/** Timeout applied to every outbound HTTP request across all channel adapters. */
export const PER_REQUEST_TIMEOUT_MS = 15_000;
export type RemoteChannel = "slack" | "discord" | "telegram";
export interface RemoteQuestionOption {