VoidBot/packages/core/src/context-builder.ts

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-04-24 13:17:00 +01:00
import {
type Actor,
type ContextBundle,
type GuildContext,
type InteractionMemoryProfile,
2026-04-24 13:17:00 +01:00
type RetrievalResult,
type SituationalSocialRead,
type SourceGroundingHint,
2026-04-24 13:17:00 +01:00
type SourceMessage,
type StylePack,
type VoidSelfStateContext,
2026-04-24 13:17:00 +01:00
} from "@voidbot/shared";
export interface BuildContextInput {
prompt: string;
actor: Actor;
guildContext: GuildContext;
recentMessages?: SourceMessage[];
retrieval?: RetrievalResult[];
interactionMemory?: InteractionMemoryProfile;
situationalSocialRead?: SituationalSocialRead;
sourceGrounding?: SourceGroundingHint;
2026-04-24 13:17:00 +01:00
stylePack?: StylePack;
voidSelfState?: VoidSelfStateContext;
2026-04-24 13:17:00 +01:00
}
export class ContextBuilder {
public build(input: BuildContextInput): ContextBundle {
return {
prompt: input.prompt,
actor: input.actor,
guildContext: input.guildContext,
recentMessages: input.recentMessages ?? [],
retrieval: input.retrieval ?? [],
interactionMemory: input.interactionMemory,
situationalSocialRead: input.situationalSocialRead,
sourceGrounding: input.sourceGrounding,
2026-04-24 13:17:00 +01:00
stylePack: input.stylePack,
voidSelfState: input.voidSelfState,
2026-04-24 13:17:00 +01:00
createdAt: new Date().toISOString(),
};
}
}