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 { GithubIssueReconciler } from '../../github/issue-reconciler.js'; import type { GithubReconcileRepositorySource } from '../../github/reconcile-worker.js'; import type { GithubPullRequestReconciler } from '../../github/rules.js'; import { dispatchGithubWebhook } from '../../github/webhook.js'; import type { GithubWebhookDispatchIntegration, ParsedGithubWebhook } from '../../github/webhook.js'; import type { PlatformApiClient } from '../api-client.js'; type EventCursor = { afterEventId: string; } | { afterTimestamp: number; }; type PlatformGithubEventWorkerSettings = { version: 1; repositories: Record; }; export type PlatformGithubEventStorage = IntegrationStorageHandle, PlatformGithubEventWorkerSettings, Record>; export type PlatformGithubEventDispatchIntegration = GithubWebhookDispatchIntegration; export interface PlatformGithubEventWorkerConfig { client: PlatformApiClient; controller: MountedMastraCode['controller']; github: PlatformGithubEventDispatchIntegration; storage: PlatformGithubEventStorage; /** * Source-control storage used to resolve the set of repositories the worker * should poll. The worker restricts itself to `(installation, repository)` * pairs linked to a factory project — the same set the reconciler uses — * so polling scales with Factory usage, not with the size of the underlying * GitHub org. */ sourceControl: GithubReconcileRepositorySource; ingestFactoryEvent?: (event: ParsedGithubWebhook) => Promise; reconcileFactoryState?: GithubPullRequestReconciler; reconcileIssuesFactoryState?: GithubIssueReconciler; /** When false the worker skips event tailing and only runs enabled reconciliation sweeps. */ pollEventsEnabled?: boolean; intervalMs?: number; /** Legacy shared reconciliation cadence. */ reconcileIntervalMs?: number; pullRequestReconcileIntervalMs?: number; issueReconcileIntervalMs?: number; now?: () => number; dispatch?: typeof dispatchGithubWebhook; } export declare class PlatformGithubEventWorker extends MastraWorker { #private; readonly name = "platform-github-events"; constructor(config: PlatformGithubEventWorkerConfig); init(deps: WorkerDeps): Promise; start(): Promise; stop(): Promise; get isRunning(): boolean; } export {}; //# sourceMappingURL=event-worker.d.ts.map