import { FactoryStorageDomain } from '@mastra/core/storage'; import type { CollectionSchema } from '@mastra/core/storage'; export declare class SourceControlConnectionNotFoundError extends Error { constructor(); } export declare const SOURCE_CONTROL_SCHEMAS: CollectionSchema[]; export type SourceControlProviderMetadata = Record; export interface SourceControlInstallation { id: string; integrationId: string; orgId: string; connectedByUserId: string; externalId: string; accountName: string | null; accountType: string | null; providerMetadata: SourceControlProviderMetadata; createdAt: Date; } export interface UpsertSourceControlInstallationInput { orgId: string; connectedByUserId: string; externalId: string; accountName?: string | null; accountType?: string | null; providerMetadata?: SourceControlProviderMetadata; } export interface SourceControlRepository { id: string; installationId: string; externalId: string; slug: string; defaultBranch: string; providerMetadata: SourceControlProviderMetadata; createdAt: Date; updatedAt: Date; } export interface UpsertSourceControlRepositoryInput { installationId: string; externalId: string; slug: string; defaultBranch: string; providerMetadata?: SourceControlProviderMetadata; } export interface ProjectSourceControlConnection { id: string; factoryProjectId: string; integrationId: string; installationId: string; createdByUserId: string; createdAt: Date; } export interface CreateProjectSourceControlConnectionInput { orgId: string; factoryProjectId: string; installationId: string; createdByUserId: string; } export interface ProjectRepository { id: string; connectionId: string; repositoryId: string; createdByUserId: string; branch: string | null; sandboxProvider: string; sandboxWorkdir: string; setupCommand: string | null; teardownCommand: string | null; createdAt: Date; updatedAt: Date; } export interface ExternalRepositoryProjectTarget { orgId: string; factoryProjectId: string; projectRepository: ProjectRepository; } /** External id pair identifying a repository linked to a factory project. */ export interface ConfiguredExternalRepositoryKey { installationExternalId: string; repositoryExternalId: string; } export interface LinkProjectRepositoryInput { orgId: string; connectionId: string; repositoryId: string; createdByUserId: string; branch?: string | null; sandboxProvider: string; sandboxWorkdir: string; setupCommand?: string | null; teardownCommand?: string | null; } export interface UpdateProjectRepositoryInput { branch?: string | null; sandboxProvider?: string; sandboxWorkdir?: string; setupCommand?: string | null; teardownCommand?: string | null; } /** * Who can open a session: 'org' sessions are visible to every member of the * owning organization, 'private' sessions only to their owner. Stored at * creation; rows created before the column existed read as 'org'. */ export type SourceControlSessionVisibility = 'org' | 'private'; export interface SourceControlSession { id: string; sessionId: string; projectRepositoryId: string; orgId: string; userId: string; branch: string; title: string | null; visibility: SourceControlSessionVisibility; baseBranch: string; sandboxId: string | null; sandboxWorkdir: string | null; materializedAt: Date | null; /** When the first user message reached the session's agent. Write-once. */ firstMessageAt: Date | null; /** When the agent's first successful sandbox exec finished. Write-once. */ firstMeaningfulExecAt: Date | null; createdAt: Date; updatedAt: Date; } export interface CreateSourceControlSessionInput { sessionId: string; projectRepositoryId: string; orgId: string; userId: string; branch: string; title?: string | null; /** Defaults to 'org' when omitted, matching how NULL rows are read. */ visibility?: SourceControlSessionVisibility; baseBranch: string; } export interface SourceControlStorageHandle { readonly integrationId: string; readonly installations: { list(args: { orgId: string; }): Promise; get(args: { orgId: string; id: string; }): Promise; findByExternalId(args: { orgId: string; externalId: string; }): Promise; upsert(args: UpsertSourceControlInstallationInput): Promise; delete(args: { orgId: string; id: string; }): Promise; }; readonly repositories: { list(args: { orgId: string; installationId: string; }): Promise; get(args: { orgId: string; id: string; }): Promise; findByExternalId(args: { orgId: string; externalId: string; }): Promise; findBySlug(args: { orgId: string; installationId: string; slug: string; }): Promise; upsert(args: { orgId: string; input: UpsertSourceControlRepositoryInput; }): Promise; /** * Migrate a repository and its dependent connections to a new installation. * Used when a GitHub App is reinstalled with a new installation ID on the same account. * Returns the repository under the new installation (either migrated or existing). */ migrateInstallation(args: { orgId: string; id: string; newInstallationId: string; }): Promise; }; readonly connections: { list(args: { orgId: string; factoryProjectId: string; }): Promise; get(args: { orgId: string; id: string; }): Promise; create(args: CreateProjectSourceControlConnectionInput): Promise; delete(args: { orgId: string; id: string; }): Promise; }; readonly projectRepositories: { list(args: { orgId: string; connectionId: string; }): Promise; listByExternalRepository(args: { installationExternalId: string; repositoryExternalId: string; }): Promise; /** * Distinct external (installation, repository) id pairs linked to any * factory project. Lets sweeps scope work to configured repositories * without probing every repository an installation can see. */ listConfiguredExternalKeys(): Promise; get(args: { orgId: string; id: string; }): Promise; link(args: LinkProjectRepositoryInput): Promise; update(args: { orgId: string; id: string; input: UpdateProjectRepositoryInput; }): Promise; unlink(args: { orgId: string; id: string; }): Promise; }; readonly sessions: { /** * Viewer-aware listing: every org-visible session for the repository * (regardless of owner) plus the viewer's own private sessions. */ list(args: { projectRepositoryId: string; viewerUserId: string; }): Promise; /** * System-level listing of every session for the repository regardless of * visibility. For internal flows only (session retirement, repository * teardown); never expose directly to a viewer. */ listByProjectRepository(args: { projectRepositoryId: string; }): Promise; getBySessionId(sessionId: string): Promise; /** Overwrite the session's display title. Keyed by the controller-facing `sessionId`. */ rename(args: { sessionId: string; title: string; }): Promise; getForBranch(args: { projectRepositoryId: string; userId: string; branch: string; }): Promise; create(input: CreateSourceControlSessionInput): Promise; setSandbox(args: { id: string; sandboxId: string | null; sandboxWorkdir: string; }): Promise; /** * Record when the session's workspace was first materialized. Write-once: * the guarded update only lands while the column is still NULL, so resumes * (Railway idle-reap, checkpoint restore, sandbox recreate) do not overwrite * the initial-materialize baseline that `materialize_s = materialized_at - * created_at` depends on. */ markMaterialized(args: { id: string; }): Promise; /** * Record when the session's agent received its first user message. * Write-once: the guarded update only lands while the column is still * NULL, so retries and process restarts are no-ops. Keyed by the * controller-facing `sessionId` (not the row id) because the caller — * the session observer — only knows the controller resourceId. */ markFirstMessage(args: { sessionId: string; }): Promise; /** * Record when the session's agent completed its first successful sandbox * exec (TTFME anchor). Same write-once contract as `markFirstMessage`: * guarded on the column being NULL, keyed by the controller-facing * `sessionId`. */ markFirstMeaningfulExec(args: { sessionId: string; }): Promise; delete(id: string): Promise; }; } export declare class SourceControlStorage extends FactoryStorageDomain { constructor(); init(): Promise; dangerouslyClearAll(): Promise; forIntegration(integrationId: string): SourceControlStorageHandle; } //# sourceMappingURL=base.d.ts.map