refactor: trim extension internal type exports

This commit is contained in:
Peter Steinberger
2026-05-01 13:59:52 +01:00
parent 3a24a25f4b
commit 3b75898bee
14 changed files with 19 additions and 71 deletions

View File

@@ -1,22 +1,9 @@
import type { CoreConfig } from "../../types.js";
import {
MATRIX_ANNOTATION_RELATION_TYPE,
MATRIX_REACTION_EVENT_TYPE,
type MatrixReactionEventContent,
} from "../reaction-common.js";
import { MATRIX_REACTION_EVENT_TYPE } from "../reaction-common.js";
import type { MatrixClient, MessageEventContent } from "../sdk.js";
export type { MatrixRawEvent } from "../sdk.js";
export type { MatrixReactionSummary } from "../reaction-common.js";
export const MsgType = {
Text: "m.text",
} as const;
export const RelationType = {
Replace: "m.replace",
Annotation: MATRIX_ANNOTATION_RELATION_TYPE,
} as const;
export const EventType = {
RoomMessage: "m.room.message",
RoomPinnedEvents: "m.room.pinned_events",
@@ -35,16 +22,10 @@ export type RoomMessageEventContent = MessageEventContent & {
};
};
export type ReactionEventContent = MatrixReactionEventContent;
export type RoomPinnedEventsEventContent = {
pinned: string[];
};
export type RoomTopicEventContent = {
topic?: string;
};
export type MatrixActionClientOpts = {
client?: MatrixClient;
cfg?: CoreConfig;

View File

@@ -1,9 +1,5 @@
import type { CoreConfig } from "../../types.js";
import {
MATRIX_ANNOTATION_RELATION_TYPE,
MATRIX_REACTION_EVENT_TYPE,
type MatrixReactionEventContent,
} from "../reaction-common.js";
import { MATRIX_ANNOTATION_RELATION_TYPE, MATRIX_REACTION_EVENT_TYPE } from "../reaction-common.js";
import type {
DimensionalFileInfo,
EncryptedFile,
@@ -79,8 +75,6 @@ export type MatrixMediaContent = MessageEventContent &
export type MatrixOutboundContent = MatrixTextContent | MatrixMediaContent;
export type ReactionEventContent = MatrixReactionEventContent;
export type MatrixSendResult = {
messageId: string;
roomId: string;

View File

@@ -15,7 +15,7 @@ import { buildBlockedInboundContext } from "./stub-contexts.js";
// ─────────────────────────── Types ───────────────────────────
export interface AccessStageAllow {
interface AccessStageAllow {
kind: "allow";
isGroupChat: boolean;
peerId: string;
@@ -25,12 +25,12 @@ export interface AccessStageAllow {
access: QQBotAccessResult;
}
export interface AccessStageBlock {
interface AccessStageBlock {
kind: "block";
context: InboundContext;
}
export type AccessStageResult = AccessStageAllow | AccessStageBlock;
type AccessStageResult = AccessStageAllow | AccessStageBlock;
// ─────────────────────────── Stage ───────────────────────────

View File

@@ -26,7 +26,7 @@ import type { QueuedMessage } from "../message-queue.js";
// ─────────────────────────── buildUserMessage ───────────────────────────
export interface BuildUserMessageInput {
interface BuildUserMessageInput {
event: QueuedMessage;
userContent: string;
quotePart: string;
@@ -69,7 +69,7 @@ export function buildUserMessage(input: BuildUserMessageInput): string {
// ─────────────────────────── buildAgentBody ───────────────────────────
export interface BuildAgentBodyInput {
interface BuildAgentBodyInput {
event: QueuedMessage;
userContent: string;
userMessage: string;

View File

@@ -18,7 +18,7 @@ import type { QueuedMention, QueuedMessage } from "../message-queue.js";
// ─────────────────────────── Types ───────────────────────────
/** Input for {@link buildUserContent}. */
export interface ContentStageInput {
interface ContentStageInput {
event: QueuedMessage;
/** `attachmentInfo` from the attachment stage — appended verbatim. */
attachmentInfo: string;
@@ -27,7 +27,7 @@ export interface ContentStageInput {
}
/** Output of {@link buildUserContent}. */
export interface ContentStageOutput {
interface ContentStageOutput {
/** `parseFaceTags(event.content)`. */
parsedContent: string;
/** Full user-visible content (parsed + voice + attachments + mention cleanup). */

View File

@@ -13,7 +13,7 @@ import type { QueuedMessage } from "../message-queue.js";
// ─────────────────────────── Envelope body ───────────────────────────
export interface BuildBodyInput {
interface BuildBodyInput {
event: QueuedMessage;
deps: InboundPipelineDeps;
userContent: string;
@@ -49,7 +49,7 @@ export function buildQuotePart(replyTo?: ReplyToInfo): string {
: `[Quoted message begins]\nOriginal content unavailable\n[Quoted message ends]\n`;
}
export interface BuildDynamicCtxInput {
interface BuildDynamicCtxInput {
imageUrls: string[];
uniqueVoicePaths: string[];
uniqueVoiceUrls: string[];
@@ -94,7 +94,7 @@ export function buildGroupSystemPrompt(
// ─────────────────────────── Media classification ───────────────────────────
export interface MediaClassification {
interface MediaClassification {
localMediaPaths: string[];
localMediaTypes: string[];
remoteMediaUrls: string[];

View File

@@ -27,20 +27,20 @@ import { isMergedTurn, type QueuedMessage } from "../message-queue.js";
// ─────────────────────────── Types ───────────────────────────
export interface GroupGatePass {
interface GroupGatePass {
kind: "pass";
groupInfo: InboundGroupInfo;
}
export interface GroupGateSkip {
interface GroupGateSkip {
kind: "skip";
groupInfo: InboundGroupInfo;
skipReason: NonNullable<import("../inbound-context.js").InboundContext["skipReason"]>;
}
export type GroupGateStageResult = GroupGatePass | GroupGateSkip;
type GroupGateStageResult = GroupGatePass | GroupGateSkip;
export interface GroupGateStageInput {
interface GroupGateStageInput {
event: QueuedMessage;
deps: InboundPipelineDeps;
accountId: string;

View File

@@ -15,4 +15,4 @@ export * from "./envelope-stage.js";
export * from "./group-gate-stage.js";
export * from "./quote-stage.js";
export * from "./refidx-stage.js";
export * from "./stub-contexts.js";
export { buildSkippedInboundContext } from "./stub-contexts.js";

View File

@@ -23,7 +23,7 @@ interface BaseStubFields {
}
/** Build an {@link InboundContext} with all non-routing fields cleared. */
export function emptyInboundContext(fields: BaseStubFields): InboundContext {
function emptyInboundContext(fields: BaseStubFields): InboundContext {
return {
event: fields.event,
route: fields.route,

View File

@@ -139,13 +139,6 @@ export interface UploadPrepareResponse {
retry_timeout?: number;
}
/** Complete upload response. */
export interface MediaUploadResponse {
file_uuid: string;
file_info: string;
ttl: number;
}
/** File hash information for upload_prepare. */
export interface UploadPrepareHashes {
/** Whole-file MD5 (hex). */

View File

@@ -62,7 +62,7 @@ type InteractionSelectionFields = {
routedChannelId?: string;
};
export type InteractionSummary = InteractionSelectionFields & {
type InteractionSummary = InteractionSelectionFields & {
interactionType?: "block_action" | "view_submission" | "view_closed";
actionId: string;
userId?: string;

View File

@@ -86,13 +86,4 @@ export type SlackMessageDeletedEvent = {
event_ts?: string;
};
export type SlackThreadBroadcastEvent = {
type: "message";
subtype: "thread_broadcast";
channel?: string;
user?: string;
message?: { ts?: string; user?: string; bot_id?: string };
event_ts?: string;
};
export type { SlackFile, SlackMessageEvent };

View File

@@ -5,13 +5,6 @@ export type DeliveryProgress = {
hasDelivered: boolean;
};
export function createDeliveryProgress(): DeliveryProgress {
return {
hasReplied: false,
hasDelivered: false,
};
}
export function resolveReplyToForSend(params: {
replyToId?: number;
replyToMode: ReplyToMode;

View File

@@ -22,10 +22,6 @@ export type TelegramContext = {
getFile: TelegramGetFile;
};
export type TelegramSyntheticContextSource = Pick<TelegramContext, "me"> & {
getFile?: TelegramGetFile;
};
/** Telegram sticker metadata for context enrichment and caching. */
export interface StickerMetadata {
/** Emoji associated with the sticker. */