import type { MountedMastraCode } from '@mastra/code-sdk'; import { MastraWorker } from '@mastra/core/worker'; import type { WorkerDeps } from '@mastra/core/worker'; import type { IntegrationStorageHandle } from '../../../storage/domains/integrations/base.js'; import type { GitLabWebhookDispatchIntegration } from '../../gitlab/webhook-dispatch.js'; import { processGitLabWebhook } from '../../gitlab/webhook.js'; import type { ParsedGitLabWebhook } from '../../gitlab/webhook.js'; import type { PlatformApiClient } from '../api-client.js'; type PlatformGitLabEventWorkerSettings = { version: 1; connections: Record; }; export type PlatformGitLabEventStorage = IntegrationStorageHandle, PlatformGitLabEventWorkerSettings, Record>; /** One row of the Platform integration event log. */ export interface IntegrationEventEntry { id: string; timestamp: number; integrationId: string; eventType: string; sourceEventId: string | null; payload: unknown; } export interface PlatformGitLabEventConnection { id: string; status: 'active' | 'needs_reauth'; } export type PlatformGitLabEventDispatchIntegration = GitLabWebhookDispatchIntegration; export interface PlatformGitLabEventWorkerConfig { client: PlatformApiClient; controller: MountedMastraCode['controller']; gitlab: PlatformGitLabEventDispatchIntegration; storage: PlatformGitLabEventStorage; /** Platform connections to tail; only `active` ones are polled. */ listConnections: () => Promise; ingestFactoryEvent?: (event: ParsedGitLabWebhook) => Promise; intervalMs?: number; now?: () => number; process?: typeof processGitLabWebhook; } /** * Tails the Platform event log for every active GitLab connection and feeds * each stored webhook body through the same ingress the direct * `/web/gitlab/webhook` route uses. A Platform-managed connection has no * project webhook pointing at Factory, so this is how issue, note, merge * request and push events reach the rules engine and subscribed sessions. * * One replica polls at a time (lease). Each connection keeps its own cursor, * persisted only after a whole page has been processed, so a crash mid-page * replays the page rather than losing it; replay handling in the rules ingress * and the delivery-id dedupe keys make that safe. */ export declare class PlatformGitLabEventWorker extends MastraWorker { #private; readonly name = "platform-gitlab-events"; constructor(config: PlatformGitLabEventWorkerConfig); init(deps: WorkerDeps): Promise; start(): Promise; stop(): Promise; get isRunning(): boolean; } export {}; //# sourceMappingURL=event-worker.d.ts.map