@mastra/factory 0.2.2-alpha.0 → 0.2.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/auth.d.ts +2 -2
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +22 -2
  5. package/dist/auth.js.map +1 -1
  6. package/dist/factory.d.ts.map +1 -1
  7. package/dist/factory.js +411 -244
  8. package/dist/factory.js.map +1 -1
  9. package/dist/index.js +411 -244
  10. package/dist/index.js.map +1 -1
  11. package/dist/integrations/github/integration.js +85 -37
  12. package/dist/integrations/github/integration.js.map +1 -1
  13. package/dist/integrations/github/routes.d.ts.map +1 -1
  14. package/dist/integrations/github/routes.js +85 -37
  15. package/dist/integrations/github/routes.js.map +1 -1
  16. package/dist/integrations/github/sandbox.d.ts +2 -0
  17. package/dist/integrations/github/sandbox.d.ts.map +1 -1
  18. package/dist/integrations/github/sandbox.js +28 -8
  19. package/dist/integrations/github/sandbox.js.map +1 -1
  20. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  21. package/dist/integrations/platform/github/integration.js +119 -39
  22. package/dist/integrations/platform/github/integration.js.map +1 -1
  23. package/dist/routes/config.d.ts.map +1 -1
  24. package/dist/routes/config.js +1 -4
  25. package/dist/routes/config.js.map +1 -1
  26. package/dist/routes/surface.js +1 -4
  27. package/dist/routes/surface.js.map +1 -1
  28. package/dist/routes/work-items.js.map +1 -1
  29. package/dist/rules/binding-context.js.map +1 -1
  30. package/dist/rules/dispatcher.d.ts.map +1 -1
  31. package/dist/rules/dispatcher.js +7 -1
  32. package/dist/rules/dispatcher.js.map +1 -1
  33. package/dist/rules/processor.js.map +1 -1
  34. package/dist/rules/tools.js.map +1 -1
  35. package/dist/spa-static.d.ts.map +1 -1
  36. package/dist/spa-static.js +1 -0
  37. package/dist/spa-static.js.map +1 -1
  38. package/dist/storage/domains/source-control/base.d.ts +9 -0
  39. package/dist/storage/domains/source-control/base.d.ts.map +1 -1
  40. package/dist/storage/domains/source-control/base.js +4 -0
  41. package/dist/storage/domains/source-control/base.js.map +1 -1
  42. package/dist/storage/domains/source-control/inmemory.d.ts +4 -0
  43. package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
  44. package/dist/storage/domains/source-control/inmemory.js +4 -0
  45. package/dist/storage/domains/source-control/inmemory.js.map +1 -1
  46. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  47. package/dist/storage/domains/work-items/base.js +20 -4
  48. package/dist/storage/domains/work-items/base.js.map +1 -1
  49. package/dist/storage/domains/work-items/metrics.js.map +1 -1
  50. package/dist/timing.d.ts +15 -0
  51. package/dist/timing.d.ts.map +1 -0
  52. package/dist/timing.js +27 -0
  53. package/dist/timing.js.map +1 -0
  54. package/dist/workspace.d.ts +2 -3
  55. package/dist/workspace.d.ts.map +1 -1
  56. package/dist/workspace.js +104 -65
  57. package/dist/workspace.js.map +1 -1
  58. package/factory-skills/factory-review/SKILL.md +9 -2
  59. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/storage/domains/source-control/base.ts"],"sourcesContent":["import { FactoryStorageDomain, UniqueViolationError } from '@mastra/core/storage';\nimport type { CollectionSchema, FactoryStorageOps } from '@mastra/core/storage';\n\nconst FACTORY_PROJECTS = 'factory_projects';\nconst INSTALLATIONS = 'source_control_installations';\nconst REPOSITORIES = 'source_control_repositories';\nconst CONNECTIONS = 'factory_project_source_control_connections';\nconst PROJECT_REPOSITORIES = 'factory_project_repositories';\nconst SANDBOXES = 'source_control_project_repository_sandboxes';\nconst WORKTREES = 'source_control_worktrees';\nconst SESSIONS = 'source_control_sessions';\n\nexport const SOURCE_CONTROL_SCHEMAS: CollectionSchema[] = [\n {\n name: INSTALLATIONS,\n columns: {\n id: { type: 'uuid-pk' },\n integration_id: { type: 'text' },\n org_id: { type: 'text' },\n connected_by_user_id: { type: 'text' },\n external_id: { type: 'text' },\n account_name: { type: 'text', nullable: true },\n account_type: { type: 'text', nullable: true },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_installations_integration_org_external_unique',\n columns: ['integration_id', 'org_id', 'external_id'],\n },\n ],\n },\n {\n name: REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n installation_id: { type: 'text' },\n external_id: { type: 'text' },\n slug: { type: 'text' },\n default_branch: { type: 'text', default: 'main' },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_repositories_installation_external_unique',\n columns: ['installation_id', 'external_id'],\n },\n ],\n indexes: [\n {\n name: 'source_control_repositories_installation_slug_idx',\n columns: ['installation_id', 'slug'],\n },\n ],\n },\n {\n name: CONNECTIONS,\n columns: {\n id: { type: 'uuid-pk' },\n factory_project_id: { type: 'text' },\n integration_id: { type: 'text' },\n installation_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_source_control_connections_project_integration_installation_unique',\n columns: ['factory_project_id', 'integration_id', 'installation_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_source_control_connections_project_idx',\n columns: ['factory_project_id'],\n },\n ],\n },\n {\n name: PROJECT_REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n connection_id: { type: 'text' },\n repository_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n branch: { type: 'text', nullable: true },\n sandbox_provider: { type: 'text' },\n sandbox_workdir: { type: 'text' },\n setup_command: { type: 'text', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_repositories_connection_repository_unique',\n columns: ['connection_id', 'repository_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_repositories_connection_idx',\n columns: ['connection_id'],\n },\n ],\n },\n {\n name: SANDBOXES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text' },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_project_repository_sandboxes_link_user_unique',\n columns: ['project_repository_id', 'user_id'],\n },\n ],\n },\n {\n name: WORKTREES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n worktree_path: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_worktrees_project_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n {\n name: SESSIONS,\n columns: {\n id: { type: 'uuid-pk' },\n session_id: { type: 'text' },\n project_repository_id: { type: 'text' },\n org_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text', nullable: true },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n { name: 'source_control_sessions_session_id_unique', columns: ['session_id'] },\n {\n name: 'source_control_sessions_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n];\n\nexport type SourceControlProviderMetadata = Record<string, unknown>;\n\nexport interface SourceControlInstallation {\n id: string;\n integrationId: string;\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName: string | null;\n accountType: string | null;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlInstallationInput {\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName?: string | null;\n accountType?: string | null;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface SourceControlRepository {\n id: string;\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface UpsertSourceControlRepositoryInput {\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface ProjectSourceControlConnection {\n id: string;\n factoryProjectId: string;\n integrationId: string;\n installationId: string;\n createdByUserId: string;\n createdAt: Date;\n}\n\nexport interface CreateProjectSourceControlConnectionInput {\n orgId: string;\n factoryProjectId: string;\n installationId: string;\n createdByUserId: string;\n}\n\nexport interface ProjectRepository {\n id: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand: string | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface ExternalRepositoryProjectTarget {\n orgId: string;\n factoryProjectId: string;\n projectRepository: ProjectRepository;\n}\n\nexport interface LinkProjectRepositoryInput {\n orgId: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch?: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand?: string | null;\n}\n\nexport interface UpdateProjectRepositoryInput {\n branch?: string | null;\n sandboxProvider?: string;\n sandboxWorkdir?: string;\n setupCommand?: string | null;\n}\n\nexport interface ProjectRepositorySandbox {\n id: string;\n projectRepositoryId: string;\n userId: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n materializedAt: Date | null;\n createdAt: Date;\n}\n\nexport interface SourceControlWorktree {\n id: string;\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlWorktreeInput {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n}\n\nexport interface SourceControlSession {\n id: string;\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n sandboxId: string | null;\n sandboxWorkdir: string | null;\n materializedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface CreateSourceControlSessionInput {\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n}\n\nexport interface SourceControlStorageHandle {\n readonly integrationId: string;\n readonly installations: {\n list(args: { orgId: string }): Promise<SourceControlInstallation[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlInstallation | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlInstallation | null>;\n upsert(args: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly repositories: {\n list(args: { orgId: string; installationId: string }): Promise<SourceControlRepository[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlRepository | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlRepository | null>;\n findBySlug(args: { orgId: string; installationId: string; slug: string }): Promise<SourceControlRepository | null>;\n upsert(args: { orgId: string; input: UpsertSourceControlRepositoryInput }): Promise<SourceControlRepository>;\n };\n readonly connections: {\n list(args: { orgId: string; factoryProjectId: string }): Promise<ProjectSourceControlConnection[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null>;\n create(args: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly projectRepositories: {\n list(args: { orgId: string; connectionId: string }): Promise<ProjectRepository[]>;\n listByExternalRepository(args: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectRepository | null>;\n link(args: LinkProjectRepositoryInput): Promise<ProjectRepository>;\n update(args: { orgId: string; id: string; input: UpdateProjectRepositoryInput }): Promise<ProjectRepository | null>;\n unlink(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly sandboxes: {\n getOrCreate(args: { projectRepository: ProjectRepository; userId: string }): Promise<ProjectRepositorySandbox>;\n getById(args: { id: string }): Promise<ProjectRepositorySandbox | null>;\n setSandboxId(args: { id: string; sandboxId: string }): Promise<void>;\n clearBinding(args: { id: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n };\n readonly worktrees: {\n upsert(args: UpsertSourceControlWorktreeInput): Promise<void>;\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlWorktree[]>;\n get(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<SourceControlWorktree | null>;\n findByPath(args: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null>;\n delete(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<void>;\n };\n readonly sessions: {\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlSession[]>;\n getBySessionId(sessionId: string): Promise<SourceControlSession | null>;\n getForBranch(args: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null>;\n create(input: CreateSourceControlSessionInput): Promise<SourceControlSession>;\n setSandbox(args: { id: string; sandboxId: string | null; sandboxWorkdir: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n delete(id: string): Promise<void>;\n };\n}\n\ninterface InstallationDbRow extends Record<string, unknown> {\n id: string;\n integration_id: string;\n org_id: string;\n connected_by_user_id: string;\n external_id: string;\n account_name: string | null;\n account_type: string | null;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n}\n\ninterface RepositoryDbRow extends Record<string, unknown> {\n id: string;\n installation_id: string;\n external_id: string;\n slug: string;\n default_branch: string;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface ConnectionDbRow extends Record<string, unknown> {\n id: string;\n factory_project_id: string;\n integration_id: string;\n installation_id: string;\n created_by_user_id: string;\n created_at: Date;\n}\n\ninterface ProjectRepositoryDbRow extends Record<string, unknown> {\n id: string;\n connection_id: string;\n repository_id: string;\n created_by_user_id: string;\n branch: string | null;\n sandbox_provider: string;\n sandbox_workdir: string;\n setup_command: string | null;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface SandboxDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n sandbox_id: string | null;\n sandbox_workdir: string;\n materialized_at: Date | null;\n created_at: Date;\n}\n\ninterface WorktreeDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n worktree_path: string;\n created_at: Date;\n}\n\ninterface SessionDbRow extends Record<string, unknown> {\n id: string;\n session_id: string;\n project_repository_id: string;\n org_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n sandbox_id: string | null;\n sandbox_workdir: string | null;\n materialized_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nfunction toInstallation(row: InstallationDbRow): SourceControlInstallation {\n return {\n id: row.id,\n integrationId: row.integration_id,\n orgId: row.org_id,\n connectedByUserId: row.connected_by_user_id,\n externalId: row.external_id,\n accountName: row.account_name,\n accountType: row.account_type,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n };\n}\n\nfunction toRepository(row: RepositoryDbRow): SourceControlRepository {\n return {\n id: row.id,\n installationId: row.installation_id,\n externalId: row.external_id,\n slug: row.slug,\n defaultBranch: row.default_branch,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toConnection(row: ConnectionDbRow): ProjectSourceControlConnection {\n return {\n id: row.id,\n factoryProjectId: row.factory_project_id,\n integrationId: row.integration_id,\n installationId: row.installation_id,\n createdByUserId: row.created_by_user_id,\n createdAt: row.created_at,\n };\n}\n\nfunction toProjectRepository(row: ProjectRepositoryDbRow): ProjectRepository {\n return {\n id: row.id,\n connectionId: row.connection_id,\n repositoryId: row.repository_id,\n createdByUserId: row.created_by_user_id,\n branch: row.branch,\n sandboxProvider: row.sandbox_provider,\n sandboxWorkdir: row.sandbox_workdir,\n setupCommand: row.setup_command,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toSandbox(row: SandboxDbRow): ProjectRepositorySandbox {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n };\n}\n\nfunction toWorktree(row: WorktreeDbRow): SourceControlWorktree {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n worktreePath: row.worktree_path,\n createdAt: row.created_at,\n };\n}\n\nfunction toSession(row: SessionDbRow): SourceControlSession {\n return {\n id: row.id,\n sessionId: row.session_id,\n projectRepositoryId: row.project_repository_id,\n orgId: row.org_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nexport class SourceControlStorage extends FactoryStorageDomain {\n constructor() {\n super('source-control');\n }\n\n async init(): Promise<void> {\n await this.ensureCollections(SOURCE_CONTROL_SCHEMAS);\n }\n\n async dangerouslyClearAll(): Promise<void> {\n await this.ops.deleteMany(SESSIONS, {});\n await this.ops.deleteMany(WORKTREES, {});\n await this.ops.deleteMany(SANDBOXES, {});\n await this.ops.deleteMany(PROJECT_REPOSITORIES, {});\n await this.ops.deleteMany(CONNECTIONS, {});\n await this.ops.deleteMany(REPOSITORIES, {});\n await this.ops.deleteMany(INSTALLATIONS, {});\n }\n\n forIntegration(integrationId: string): SourceControlStorageHandle {\n if (!integrationId.trim()) throw new Error('[SourceControlStorage] integrationId must not be empty.');\n const db = (): FactoryStorageOps => this.ops;\n\n const getInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation | null> => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n id: args.id,\n integration_id: integrationId,\n org_id: args.orgId,\n });\n return row ? toInstallation(row) : null;\n };\n\n const requireInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation> => {\n const installation = await getInstallation(args);\n if (!installation)\n throw new Error('Source-control installation not found for this organization and integration.');\n return installation;\n };\n\n const getRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { id: args.id });\n if (!row || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toRepository(row);\n };\n\n const requireRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository> => {\n const repository = await getRepository(args);\n if (!repository) throw new Error('Source-control repository not found for this organization and integration.');\n return repository;\n };\n\n const getConnection = async (args: {\n orgId: string;\n id: string;\n }): Promise<ProjectSourceControlConnection | null> => {\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, { id: args.id, integration_id: integrationId });\n if (!row) return null;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: row.factory_project_id,\n org_id: args.orgId,\n });\n if (!project || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toConnection(row);\n };\n\n const requireConnection = async (args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection> => {\n const connection = await getConnection(args);\n if (!connection)\n throw new Error('Project source-control connection not found for this organization and integration.');\n return connection;\n };\n\n const getProjectRepository = async (args: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id: args.id });\n if (!row || !(await getConnection({ orgId: args.orgId, id: row.connection_id }))) return null;\n return toProjectRepository(row);\n };\n\n const getProjectRepositoryById = async (id: string): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id });\n if (!row) return null;\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: row.connection_id,\n integration_id: integrationId,\n });\n return connection ? toProjectRepository(row) : null;\n };\n\n const requireProjectRepositoryById = async (id: string): Promise<ProjectRepository> => {\n const projectRepository = await getProjectRepositoryById(id);\n if (!projectRepository) throw new Error('Project repository not found for this integration.');\n return projectRepository;\n };\n\n const getSandbox = async (id: string): Promise<ProjectRepositorySandbox | null> => {\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, { id });\n if (!row || !(await getProjectRepositoryById(row.project_repository_id))) return null;\n return toSandbox(row);\n };\n\n const requireSandbox = async (id: string): Promise<ProjectRepositorySandbox> => {\n const sandbox = await getSandbox(id);\n if (!sandbox) throw new Error('Project-repository sandbox not found for this integration.');\n return sandbox;\n };\n\n return {\n integrationId,\n installations: {\n list: async ({ orgId }) =>\n (\n await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n })\n ).map(toInstallation),\n get: getInstallation,\n findByExternalId: async ({ orgId, externalId }) => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n external_id: externalId,\n });\n return row ? toInstallation(row) : null;\n },\n upsert: async input => {\n const row = await db().upsertOne<InstallationDbRow>(\n INSTALLATIONS,\n ['integration_id', 'org_id', 'external_id'],\n {\n integration_id: integrationId,\n org_id: input.orgId,\n connected_by_user_id: input.connectedByUserId,\n external_id: input.externalId,\n account_name: input.accountName ?? null,\n account_type: input.accountType ?? null,\n provider_metadata: input.providerMetadata ?? {},\n created_at: new Date(),\n },\n );\n return toInstallation(row);\n },\n delete: async ({ orgId, id }) => {\n const installation = await getInstallation({ orgId, id });\n if (!installation) return false;\n await db().deleteMany(INSTALLATIONS, { id, integration_id: integrationId, org_id: orgId });\n return true;\n },\n },\n repositories: {\n list: async ({ orgId, installationId }) => {\n await requireInstallation({ orgId, id: installationId });\n return (await db().findMany<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId })).map(\n toRepository,\n );\n },\n get: getRepository,\n findByExternalId: async ({ orgId, externalId }) => {\n const rows = await db().findMany<RepositoryDbRow>(REPOSITORIES, { external_id: externalId });\n for (const row of rows) {\n if (await getInstallation({ orgId, id: row.installation_id })) return toRepository(row);\n }\n return null;\n },\n findBySlug: async ({ orgId, installationId, slug }) => {\n await requireInstallation({ orgId, id: installationId });\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId, slug });\n return row ? toRepository(row) : null;\n },\n upsert: async ({ orgId, input }) => {\n await requireInstallation({ orgId, id: input.installationId });\n const now = new Date();\n const row = await db().upsertOne<RepositoryDbRow>(REPOSITORIES, ['installation_id', 'external_id'], {\n installation_id: input.installationId,\n external_id: input.externalId,\n slug: input.slug,\n default_branch: input.defaultBranch,\n provider_metadata: input.providerMetadata ?? {},\n created_at: now,\n updated_at: now,\n });\n return toRepository(row);\n },\n },\n connections: {\n list: async ({ orgId, factoryProjectId }) => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: factoryProjectId,\n org_id: orgId,\n });\n if (!project) return [];\n return (\n await db().findMany<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: factoryProjectId,\n integration_id: integrationId,\n })\n ).map(toConnection);\n },\n get: getConnection,\n create: async input => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: input.factoryProjectId,\n org_id: input.orgId,\n });\n if (!project) throw new Error('Factory project not found for this organization.');\n await requireInstallation({ orgId: input.orgId, id: input.installationId });\n try {\n const row = await db().insertOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n created_by_user_id: input.createdByUserId,\n created_at: new Date(),\n });\n return toConnection(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n });\n if (!row) throw error;\n return toConnection(row);\n }\n },\n delete: async ({ orgId, id }) => {\n const connection = await getConnection({ orgId, id });\n if (!connection) return false;\n const projectRepositories = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n connection_id: id,\n });\n for (const projectRepository of projectRepositories) {\n await db().deleteMany(SESSIONS, { project_repository_id: projectRepository.id });\n await db().deleteMany(WORKTREES, { project_repository_id: projectRepository.id });\n await db().deleteMany(SANDBOXES, { project_repository_id: projectRepository.id });\n }\n await db().deleteMany(PROJECT_REPOSITORIES, { connection_id: id });\n await db().deleteMany(CONNECTIONS, { id, integration_id: integrationId });\n return true;\n },\n },\n projectRepositories: {\n list: async ({ orgId, connectionId }) => {\n await requireConnection({ orgId, id: connectionId });\n return (\n await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { connection_id: connectionId })\n ).map(toProjectRepository);\n },\n listByExternalRepository: async ({ installationExternalId, repositoryExternalId }) => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n const installations = await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n external_id: installationExternalId,\n });\n for (const installation of installations) {\n const repository = await db().findOne<RepositoryDbRow>(REPOSITORIES, {\n installation_id: installation.id,\n external_id: repositoryExternalId,\n });\n if (!repository) continue;\n const links = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n repository_id: repository.id,\n });\n for (const link of links) {\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: link.connection_id,\n integration_id: integrationId,\n installation_id: installation.id,\n });\n if (!connection) continue;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: connection.factory_project_id,\n org_id: installation.org_id,\n });\n if (!project) continue;\n targets.push({\n orgId: installation.org_id,\n factoryProjectId: connection.factory_project_id,\n projectRepository: toProjectRepository(link),\n });\n }\n }\n return targets;\n },\n get: getProjectRepository,\n link: async input => {\n const connection = await requireConnection({ orgId: input.orgId, id: input.connectionId });\n const repository = await requireRepository({ orgId: input.orgId, id: input.repositoryId });\n if (repository.installationId !== connection.installationId) {\n throw new Error('Repository does not belong to the connection installation.');\n }\n const now = new Date();\n const row = await db().upsertOne<ProjectRepositoryDbRow>(\n PROJECT_REPOSITORIES,\n ['connection_id', 'repository_id'],\n {\n connection_id: input.connectionId,\n repository_id: input.repositoryId,\n created_by_user_id: input.createdByUserId,\n branch: input.branch ?? null,\n sandbox_provider: input.sandboxProvider,\n sandbox_workdir: input.sandboxWorkdir,\n setup_command: input.setupCommand ?? null,\n created_at: now,\n updated_at: now,\n },\n );\n return toProjectRepository(row);\n },\n update: async ({ orgId, id, input }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return null;\n const patch: Record<string, unknown> = { updated_at: new Date() };\n if (input.branch !== undefined) patch.branch = input.branch;\n if (input.sandboxProvider !== undefined) patch.sandbox_provider = input.sandboxProvider;\n if (input.sandboxWorkdir !== undefined) patch.sandbox_workdir = input.sandboxWorkdir;\n if (input.setupCommand !== undefined) patch.setup_command = input.setupCommand;\n await db().updateMany(PROJECT_REPOSITORIES, { id }, patch);\n return getProjectRepository({ orgId, id });\n },\n unlink: async ({ orgId, id }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return false;\n await db().deleteMany(SESSIONS, { project_repository_id: id });\n await db().deleteMany(WORKTREES, { project_repository_id: id });\n await db().deleteMany(SANDBOXES, { project_repository_id: id });\n await db().deleteMany(PROJECT_REPOSITORIES, { id });\n return true;\n },\n },\n sandboxes: {\n getOrCreate: async ({ projectRepository, userId }) => {\n await requireProjectRepositoryById(projectRepository.id);\n const where = { project_repository_id: projectRepository.id, user_id: userId };\n const existing = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (existing) return toSandbox(existing);\n try {\n const row = await db().insertOne<SandboxDbRow>(SANDBOXES, {\n ...where,\n sandbox_id: null,\n sandbox_workdir: projectRepository.sandboxWorkdir,\n materialized_at: null,\n created_at: new Date(),\n });\n return toSandbox(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (!row) throw error;\n return toSandbox(row);\n }\n },\n getById: ({ id }) => getSandbox(id),\n setSandboxId: async ({ id, sandboxId }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: sandboxId });\n },\n clearBinding: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: null, materialized_at: null });\n },\n markMaterialized: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { materialized_at: new Date() });\n },\n },\n worktrees: {\n upsert: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n await db().upsertOne<WorktreeDbRow>(WORKTREES, ['project_repository_id', 'user_id', 'branch'], {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n worktree_path: input.worktreePath,\n created_at: new Date(),\n });\n },\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n const rows = await db().findMany<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n });\n return rows.map(toWorktree);\n },\n get: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toWorktree(row) : null;\n },\n findByPath: async ({ projectRepositoryId, userId, worktreePath }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n worktree_path: worktreePath,\n });\n return row ? toWorktree(row) : null;\n },\n delete: async ({ projectRepositoryId, userId, branch }) => {\n await requireProjectRepositoryById(projectRepositoryId);\n await db().deleteMany(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n },\n },\n sessions: {\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n return (\n await db().findMany<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n })\n ).map(toSession);\n },\n getBySessionId: async sessionId => {\n const row = await db().findOne<SessionDbRow>(SESSIONS, { session_id: sessionId });\n return row && (await getProjectRepositoryById(row.project_repository_id)) ? toSession(row) : null;\n },\n getForBranch: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toSession(row) : null;\n },\n create: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n const existing = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (existing) return toSession(existing);\n const now = new Date();\n try {\n const row = await db().insertOne<SessionDbRow>(SESSIONS, {\n session_id: input.sessionId,\n project_repository_id: input.projectRepositoryId,\n org_id: input.orgId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n sandbox_id: null,\n sandbox_workdir: null,\n materialized_at: null,\n created_at: now,\n updated_at: now,\n });\n return toSession(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (!row) throw error;\n return toSession(row);\n }\n },\n setSandbox: async ({ id, sandboxId, sandboxWorkdir }) => {\n await db().updateMany(\n SESSIONS,\n { id },\n { sandbox_id: sandboxId, sandbox_workdir: sandboxWorkdir, updated_at: new Date() },\n );\n },\n markMaterialized: async ({ id }) => {\n await db().updateMany(SESSIONS, { id }, { materialized_at: new Date(), updated_at: new Date() });\n },\n delete: async id => {\n await db().deleteMany(SESSIONS, { id });\n },\n },\n };\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Y,MAAM;AAAA,cAClB,uBAAuB,MAAM;AAAA,cAC7B,QAAQ,MAAM;AAAA,cACd,SAAS,MAAM;AAAA,cACf,QAAQ,MAAM;AAAA,cACd,aAAa,MAAM;AAAA,cACnB,YAAY;AAAA,cACZ,iBAAiB;AAAA,cACjB,iBAAiB;AAAA,cACjB,YAAY;AAAA,cACZ,YAAY;AAAA,YACd,CAAC;AACD,mBAAO,UAAU,GAAG;AAAA,UACtB,SAAS,OAAO;AACd,gBAAI,EAAE,iBAAiB,sBAAuB,OAAM;AACpD,kBAAM,MAAM,MAAM,GAAG,EAAE,QAAsB,UAAU;AAAA,cACrD,uBAAuB,MAAM;AAAA,cAC7B,SAAS,MAAM;AAAA,cACf,QAAQ,MAAM;AAAA,YAChB,CAAC;AACD,gBAAI,CAAC,IAAK,OAAM;AAChB,mBAAO,UAAU,GAAG;AAAA,UACtB;AAAA,QACF;AAAA,QACA,YAAY,OAAO,EAAE,IAAI,WAAW,eAAe,MAAM;AACvD,gBAAM,GAAG,EAAE;AAAA,YACT;AAAA,YACA,EAAE,GAAG;AAAA,YACL,EAAE,YAAY,WAAW,iBAAiB,gBAAgB,YAAY,oBAAI,KAAK,EAAE;AAAA,UACnF;AAAA,QACF;AAAA,QACA,kBAAkB,OAAO,EAAE,GAAG,MAAM;AAClC,gBAAM,GAAG,EAAE,WAAW,UAAU,EAAE,GAAG,GAAG,EAAE,iBAAiB,oBAAI,KAAK,GAAG,YAAY,oBAAI,KAAK,EAAE,CAAC;AAAA,QACjG;AAAA,QACA,QAAQ,OAAM,OAAM;AAClB,gBAAM,GAAG,EAAE,WAAW,UAAU,EAAE,GAAG,CAAC;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/storage/domains/source-control/base.ts"],"sourcesContent":["import { FactoryStorageDomain, UniqueViolationError } from '@mastra/core/storage';\nimport type { CollectionSchema, FactoryStorageOps } from '@mastra/core/storage';\n\nconst FACTORY_PROJECTS = 'factory_projects';\nconst INSTALLATIONS = 'source_control_installations';\nconst REPOSITORIES = 'source_control_repositories';\nconst CONNECTIONS = 'factory_project_source_control_connections';\nconst PROJECT_REPOSITORIES = 'factory_project_repositories';\nconst SANDBOXES = 'source_control_project_repository_sandboxes';\nconst WORKTREES = 'source_control_worktrees';\nconst SESSIONS = 'source_control_sessions';\n\nexport const SOURCE_CONTROL_SCHEMAS: CollectionSchema[] = [\n {\n name: INSTALLATIONS,\n columns: {\n id: { type: 'uuid-pk' },\n integration_id: { type: 'text' },\n org_id: { type: 'text' },\n connected_by_user_id: { type: 'text' },\n external_id: { type: 'text' },\n account_name: { type: 'text', nullable: true },\n account_type: { type: 'text', nullable: true },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_installations_integration_org_external_unique',\n columns: ['integration_id', 'org_id', 'external_id'],\n },\n ],\n },\n {\n name: REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n installation_id: { type: 'text' },\n external_id: { type: 'text' },\n slug: { type: 'text' },\n default_branch: { type: 'text', default: 'main' },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_repositories_installation_external_unique',\n columns: ['installation_id', 'external_id'],\n },\n ],\n indexes: [\n {\n name: 'source_control_repositories_installation_slug_idx',\n columns: ['installation_id', 'slug'],\n },\n ],\n },\n {\n name: CONNECTIONS,\n columns: {\n id: { type: 'uuid-pk' },\n factory_project_id: { type: 'text' },\n integration_id: { type: 'text' },\n installation_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_source_control_connections_project_integration_installation_unique',\n columns: ['factory_project_id', 'integration_id', 'installation_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_source_control_connections_project_idx',\n columns: ['factory_project_id'],\n },\n ],\n },\n {\n name: PROJECT_REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n connection_id: { type: 'text' },\n repository_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n branch: { type: 'text', nullable: true },\n sandbox_provider: { type: 'text' },\n sandbox_workdir: { type: 'text' },\n setup_command: { type: 'text', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_repositories_connection_repository_unique',\n columns: ['connection_id', 'repository_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_repositories_connection_idx',\n columns: ['connection_id'],\n },\n ],\n },\n {\n name: SANDBOXES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text' },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_project_repository_sandboxes_link_user_unique',\n columns: ['project_repository_id', 'user_id'],\n },\n ],\n },\n {\n name: WORKTREES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n worktree_path: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_worktrees_project_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n {\n name: SESSIONS,\n columns: {\n id: { type: 'uuid-pk' },\n session_id: { type: 'text' },\n project_repository_id: { type: 'text' },\n org_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text', nullable: true },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n { name: 'source_control_sessions_session_id_unique', columns: ['session_id'] },\n {\n name: 'source_control_sessions_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n];\n\nexport type SourceControlProviderMetadata = Record<string, unknown>;\n\nexport interface SourceControlInstallation {\n id: string;\n integrationId: string;\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName: string | null;\n accountType: string | null;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlInstallationInput {\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName?: string | null;\n accountType?: string | null;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface SourceControlRepository {\n id: string;\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface UpsertSourceControlRepositoryInput {\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface ProjectSourceControlConnection {\n id: string;\n factoryProjectId: string;\n integrationId: string;\n installationId: string;\n createdByUserId: string;\n createdAt: Date;\n}\n\nexport interface CreateProjectSourceControlConnectionInput {\n orgId: string;\n factoryProjectId: string;\n installationId: string;\n createdByUserId: string;\n}\n\nexport interface ProjectRepository {\n id: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand: string | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface ExternalRepositoryProjectTarget {\n orgId: string;\n factoryProjectId: string;\n projectRepository: ProjectRepository;\n}\n\nexport interface LinkProjectRepositoryInput {\n orgId: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch?: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand?: string | null;\n}\n\nexport interface UpdateProjectRepositoryInput {\n branch?: string | null;\n sandboxProvider?: string;\n sandboxWorkdir?: string;\n setupCommand?: string | null;\n}\n\nexport interface ProjectRepositorySandbox {\n id: string;\n projectRepositoryId: string;\n userId: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n materializedAt: Date | null;\n createdAt: Date;\n}\n\nexport interface SourceControlWorktree {\n id: string;\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlWorktreeInput {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n}\n\nexport interface SourceControlSession {\n id: string;\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n sandboxId: string | null;\n sandboxWorkdir: string | null;\n materializedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface CreateSourceControlSessionInput {\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n}\n\nexport interface SourceControlStorageHandle {\n readonly integrationId: string;\n readonly installations: {\n list(args: { orgId: string }): Promise<SourceControlInstallation[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlInstallation | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlInstallation | null>;\n upsert(args: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly repositories: {\n list(args: { orgId: string; installationId: string }): Promise<SourceControlRepository[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlRepository | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlRepository | null>;\n findBySlug(args: { orgId: string; installationId: string; slug: string }): Promise<SourceControlRepository | null>;\n upsert(args: { orgId: string; input: UpsertSourceControlRepositoryInput }): Promise<SourceControlRepository>;\n };\n readonly connections: {\n list(args: { orgId: string; factoryProjectId: string }): Promise<ProjectSourceControlConnection[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null>;\n create(args: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly projectRepositories: {\n list(args: { orgId: string; connectionId: string }): Promise<ProjectRepository[]>;\n listByExternalRepository(args: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectRepository | null>;\n link(args: LinkProjectRepositoryInput): Promise<ProjectRepository>;\n update(args: { orgId: string; id: string; input: UpdateProjectRepositoryInput }): Promise<ProjectRepository | null>;\n unlink(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly sandboxes: {\n getOrCreate(args: { projectRepository: ProjectRepository; userId: string }): Promise<ProjectRepositorySandbox>;\n getById(args: { id: string }): Promise<ProjectRepositorySandbox | null>;\n /**\n * Point the binding at a new workdir and clear `materializedAt` — a moved\n * workdir means the checkout must be re-cloned. Used to heal bindings whose\n * inherited workdir went stale (e.g. the sandbox provider changed).\n */\n setWorkdir(args: { id: string; sandboxWorkdir: string }): Promise<void>;\n setSandboxId(args: { id: string; sandboxId: string }): Promise<void>;\n clearBinding(args: { id: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n };\n readonly worktrees: {\n upsert(args: UpsertSourceControlWorktreeInput): Promise<void>;\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlWorktree[]>;\n get(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<SourceControlWorktree | null>;\n findByPath(args: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null>;\n delete(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<void>;\n };\n readonly sessions: {\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlSession[]>;\n getBySessionId(sessionId: string): Promise<SourceControlSession | null>;\n getForBranch(args: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null>;\n create(input: CreateSourceControlSessionInput): Promise<SourceControlSession>;\n setSandbox(args: { id: string; sandboxId: string | null; sandboxWorkdir: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n delete(id: string): Promise<void>;\n };\n}\n\ninterface InstallationDbRow extends Record<string, unknown> {\n id: string;\n integration_id: string;\n org_id: string;\n connected_by_user_id: string;\n external_id: string;\n account_name: string | null;\n account_type: string | null;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n}\n\ninterface RepositoryDbRow extends Record<string, unknown> {\n id: string;\n installation_id: string;\n external_id: string;\n slug: string;\n default_branch: string;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface ConnectionDbRow extends Record<string, unknown> {\n id: string;\n factory_project_id: string;\n integration_id: string;\n installation_id: string;\n created_by_user_id: string;\n created_at: Date;\n}\n\ninterface ProjectRepositoryDbRow extends Record<string, unknown> {\n id: string;\n connection_id: string;\n repository_id: string;\n created_by_user_id: string;\n branch: string | null;\n sandbox_provider: string;\n sandbox_workdir: string;\n setup_command: string | null;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface SandboxDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n sandbox_id: string | null;\n sandbox_workdir: string;\n materialized_at: Date | null;\n created_at: Date;\n}\n\ninterface WorktreeDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n worktree_path: string;\n created_at: Date;\n}\n\ninterface SessionDbRow extends Record<string, unknown> {\n id: string;\n session_id: string;\n project_repository_id: string;\n org_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n sandbox_id: string | null;\n sandbox_workdir: string | null;\n materialized_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nfunction toInstallation(row: InstallationDbRow): SourceControlInstallation {\n return {\n id: row.id,\n integrationId: row.integration_id,\n orgId: row.org_id,\n connectedByUserId: row.connected_by_user_id,\n externalId: row.external_id,\n accountName: row.account_name,\n accountType: row.account_type,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n };\n}\n\nfunction toRepository(row: RepositoryDbRow): SourceControlRepository {\n return {\n id: row.id,\n installationId: row.installation_id,\n externalId: row.external_id,\n slug: row.slug,\n defaultBranch: row.default_branch,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toConnection(row: ConnectionDbRow): ProjectSourceControlConnection {\n return {\n id: row.id,\n factoryProjectId: row.factory_project_id,\n integrationId: row.integration_id,\n installationId: row.installation_id,\n createdByUserId: row.created_by_user_id,\n createdAt: row.created_at,\n };\n}\n\nfunction toProjectRepository(row: ProjectRepositoryDbRow): ProjectRepository {\n return {\n id: row.id,\n connectionId: row.connection_id,\n repositoryId: row.repository_id,\n createdByUserId: row.created_by_user_id,\n branch: row.branch,\n sandboxProvider: row.sandbox_provider,\n sandboxWorkdir: row.sandbox_workdir,\n setupCommand: row.setup_command,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toSandbox(row: SandboxDbRow): ProjectRepositorySandbox {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n };\n}\n\nfunction toWorktree(row: WorktreeDbRow): SourceControlWorktree {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n worktreePath: row.worktree_path,\n createdAt: row.created_at,\n };\n}\n\nfunction toSession(row: SessionDbRow): SourceControlSession {\n return {\n id: row.id,\n sessionId: row.session_id,\n projectRepositoryId: row.project_repository_id,\n orgId: row.org_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nexport class SourceControlStorage extends FactoryStorageDomain {\n constructor() {\n super('source-control');\n }\n\n async init(): Promise<void> {\n await this.ensureCollections(SOURCE_CONTROL_SCHEMAS);\n }\n\n async dangerouslyClearAll(): Promise<void> {\n await this.ops.deleteMany(SESSIONS, {});\n await this.ops.deleteMany(WORKTREES, {});\n await this.ops.deleteMany(SANDBOXES, {});\n await this.ops.deleteMany(PROJECT_REPOSITORIES, {});\n await this.ops.deleteMany(CONNECTIONS, {});\n await this.ops.deleteMany(REPOSITORIES, {});\n await this.ops.deleteMany(INSTALLATIONS, {});\n }\n\n forIntegration(integrationId: string): SourceControlStorageHandle {\n if (!integrationId.trim()) throw new Error('[SourceControlStorage] integrationId must not be empty.');\n const db = (): FactoryStorageOps => this.ops;\n\n const getInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation | null> => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n id: args.id,\n integration_id: integrationId,\n org_id: args.orgId,\n });\n return row ? toInstallation(row) : null;\n };\n\n const requireInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation> => {\n const installation = await getInstallation(args);\n if (!installation)\n throw new Error('Source-control installation not found for this organization and integration.');\n return installation;\n };\n\n const getRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { id: args.id });\n if (!row || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toRepository(row);\n };\n\n const requireRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository> => {\n const repository = await getRepository(args);\n if (!repository) throw new Error('Source-control repository not found for this organization and integration.');\n return repository;\n };\n\n const getConnection = async (args: {\n orgId: string;\n id: string;\n }): Promise<ProjectSourceControlConnection | null> => {\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, { id: args.id, integration_id: integrationId });\n if (!row) return null;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: row.factory_project_id,\n org_id: args.orgId,\n });\n if (!project || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toConnection(row);\n };\n\n const requireConnection = async (args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection> => {\n const connection = await getConnection(args);\n if (!connection)\n throw new Error('Project source-control connection not found for this organization and integration.');\n return connection;\n };\n\n const getProjectRepository = async (args: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id: args.id });\n if (!row || !(await getConnection({ orgId: args.orgId, id: row.connection_id }))) return null;\n return toProjectRepository(row);\n };\n\n const getProjectRepositoryById = async (id: string): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id });\n if (!row) return null;\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: row.connection_id,\n integration_id: integrationId,\n });\n return connection ? toProjectRepository(row) : null;\n };\n\n const requireProjectRepositoryById = async (id: string): Promise<ProjectRepository> => {\n const projectRepository = await getProjectRepositoryById(id);\n if (!projectRepository) throw new Error('Project repository not found for this integration.');\n return projectRepository;\n };\n\n const getSandbox = async (id: string): Promise<ProjectRepositorySandbox | null> => {\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, { id });\n if (!row || !(await getProjectRepositoryById(row.project_repository_id))) return null;\n return toSandbox(row);\n };\n\n const requireSandbox = async (id: string): Promise<ProjectRepositorySandbox> => {\n const sandbox = await getSandbox(id);\n if (!sandbox) throw new Error('Project-repository sandbox not found for this integration.');\n return sandbox;\n };\n\n return {\n integrationId,\n installations: {\n list: async ({ orgId }) =>\n (\n await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n })\n ).map(toInstallation),\n get: getInstallation,\n findByExternalId: async ({ orgId, externalId }) => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n external_id: externalId,\n });\n return row ? toInstallation(row) : null;\n },\n upsert: async input => {\n const row = await db().upsertOne<InstallationDbRow>(\n INSTALLATIONS,\n ['integration_id', 'org_id', 'external_id'],\n {\n integration_id: integrationId,\n org_id: input.orgId,\n connected_by_user_id: input.connectedByUserId,\n external_id: input.externalId,\n account_name: input.accountName ?? null,\n account_type: input.accountType ?? null,\n provider_metadata: input.providerMetadata ?? {},\n created_at: new Date(),\n },\n );\n return toInstallation(row);\n },\n delete: async ({ orgId, id }) => {\n const installation = await getInstallation({ orgId, id });\n if (!installation) return false;\n await db().deleteMany(INSTALLATIONS, { id, integration_id: integrationId, org_id: orgId });\n return true;\n },\n },\n repositories: {\n list: async ({ orgId, installationId }) => {\n await requireInstallation({ orgId, id: installationId });\n return (await db().findMany<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId })).map(\n toRepository,\n );\n },\n get: getRepository,\n findByExternalId: async ({ orgId, externalId }) => {\n const rows = await db().findMany<RepositoryDbRow>(REPOSITORIES, { external_id: externalId });\n for (const row of rows) {\n if (await getInstallation({ orgId, id: row.installation_id })) return toRepository(row);\n }\n return null;\n },\n findBySlug: async ({ orgId, installationId, slug }) => {\n await requireInstallation({ orgId, id: installationId });\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId, slug });\n return row ? toRepository(row) : null;\n },\n upsert: async ({ orgId, input }) => {\n await requireInstallation({ orgId, id: input.installationId });\n const now = new Date();\n const row = await db().upsertOne<RepositoryDbRow>(REPOSITORIES, ['installation_id', 'external_id'], {\n installation_id: input.installationId,\n external_id: input.externalId,\n slug: input.slug,\n default_branch: input.defaultBranch,\n provider_metadata: input.providerMetadata ?? {},\n created_at: now,\n updated_at: now,\n });\n return toRepository(row);\n },\n },\n connections: {\n list: async ({ orgId, factoryProjectId }) => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: factoryProjectId,\n org_id: orgId,\n });\n if (!project) return [];\n return (\n await db().findMany<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: factoryProjectId,\n integration_id: integrationId,\n })\n ).map(toConnection);\n },\n get: getConnection,\n create: async input => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: input.factoryProjectId,\n org_id: input.orgId,\n });\n if (!project) throw new Error('Factory project not found for this organization.');\n await requireInstallation({ orgId: input.orgId, id: input.installationId });\n try {\n const row = await db().insertOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n created_by_user_id: input.createdByUserId,\n created_at: new Date(),\n });\n return toConnection(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n });\n if (!row) throw error;\n return toConnection(row);\n }\n },\n delete: async ({ orgId, id }) => {\n const connection = await getConnection({ orgId, id });\n if (!connection) return false;\n const projectRepositories = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n connection_id: id,\n });\n for (const projectRepository of projectRepositories) {\n await db().deleteMany(SESSIONS, { project_repository_id: projectRepository.id });\n await db().deleteMany(WORKTREES, { project_repository_id: projectRepository.id });\n await db().deleteMany(SANDBOXES, { project_repository_id: projectRepository.id });\n }\n await db().deleteMany(PROJECT_REPOSITORIES, { connection_id: id });\n await db().deleteMany(CONNECTIONS, { id, integration_id: integrationId });\n return true;\n },\n },\n projectRepositories: {\n list: async ({ orgId, connectionId }) => {\n await requireConnection({ orgId, id: connectionId });\n return (\n await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { connection_id: connectionId })\n ).map(toProjectRepository);\n },\n listByExternalRepository: async ({ installationExternalId, repositoryExternalId }) => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n const installations = await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n external_id: installationExternalId,\n });\n for (const installation of installations) {\n const repository = await db().findOne<RepositoryDbRow>(REPOSITORIES, {\n installation_id: installation.id,\n external_id: repositoryExternalId,\n });\n if (!repository) continue;\n const links = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n repository_id: repository.id,\n });\n for (const link of links) {\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: link.connection_id,\n integration_id: integrationId,\n installation_id: installation.id,\n });\n if (!connection) continue;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: connection.factory_project_id,\n org_id: installation.org_id,\n });\n if (!project) continue;\n targets.push({\n orgId: installation.org_id,\n factoryProjectId: connection.factory_project_id,\n projectRepository: toProjectRepository(link),\n });\n }\n }\n return targets;\n },\n get: getProjectRepository,\n link: async input => {\n const connection = await requireConnection({ orgId: input.orgId, id: input.connectionId });\n const repository = await requireRepository({ orgId: input.orgId, id: input.repositoryId });\n if (repository.installationId !== connection.installationId) {\n throw new Error('Repository does not belong to the connection installation.');\n }\n const now = new Date();\n const row = await db().upsertOne<ProjectRepositoryDbRow>(\n PROJECT_REPOSITORIES,\n ['connection_id', 'repository_id'],\n {\n connection_id: input.connectionId,\n repository_id: input.repositoryId,\n created_by_user_id: input.createdByUserId,\n branch: input.branch ?? null,\n sandbox_provider: input.sandboxProvider,\n sandbox_workdir: input.sandboxWorkdir,\n setup_command: input.setupCommand ?? null,\n created_at: now,\n updated_at: now,\n },\n );\n return toProjectRepository(row);\n },\n update: async ({ orgId, id, input }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return null;\n const patch: Record<string, unknown> = { updated_at: new Date() };\n if (input.branch !== undefined) patch.branch = input.branch;\n if (input.sandboxProvider !== undefined) patch.sandbox_provider = input.sandboxProvider;\n if (input.sandboxWorkdir !== undefined) patch.sandbox_workdir = input.sandboxWorkdir;\n if (input.setupCommand !== undefined) patch.setup_command = input.setupCommand;\n await db().updateMany(PROJECT_REPOSITORIES, { id }, patch);\n return getProjectRepository({ orgId, id });\n },\n unlink: async ({ orgId, id }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return false;\n await db().deleteMany(SESSIONS, { project_repository_id: id });\n await db().deleteMany(WORKTREES, { project_repository_id: id });\n await db().deleteMany(SANDBOXES, { project_repository_id: id });\n await db().deleteMany(PROJECT_REPOSITORIES, { id });\n return true;\n },\n },\n sandboxes: {\n getOrCreate: async ({ projectRepository, userId }) => {\n await requireProjectRepositoryById(projectRepository.id);\n const where = { project_repository_id: projectRepository.id, user_id: userId };\n const existing = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (existing) return toSandbox(existing);\n try {\n const row = await db().insertOne<SandboxDbRow>(SANDBOXES, {\n ...where,\n sandbox_id: null,\n sandbox_workdir: projectRepository.sandboxWorkdir,\n materialized_at: null,\n created_at: new Date(),\n });\n return toSandbox(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (!row) throw error;\n return toSandbox(row);\n }\n },\n getById: ({ id }) => getSandbox(id),\n setWorkdir: async ({ id, sandboxWorkdir }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_workdir: sandboxWorkdir, materialized_at: null });\n },\n setSandboxId: async ({ id, sandboxId }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: sandboxId });\n },\n clearBinding: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: null, materialized_at: null });\n },\n markMaterialized: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { materialized_at: new Date() });\n },\n },\n worktrees: {\n upsert: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n await db().upsertOne<WorktreeDbRow>(WORKTREES, ['project_repository_id', 'user_id', 'branch'], {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n worktree_path: input.worktreePath,\n created_at: new Date(),\n });\n },\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n const rows = await db().findMany<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n });\n return rows.map(toWorktree);\n },\n get: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toWorktree(row) : null;\n },\n findByPath: async ({ projectRepositoryId, userId, worktreePath }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n worktree_path: worktreePath,\n });\n return row ? toWorktree(row) : null;\n },\n delete: async ({ projectRepositoryId, userId, branch }) => {\n await requireProjectRepositoryById(projectRepositoryId);\n await db().deleteMany(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n },\n },\n sessions: {\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n return (\n await db().findMany<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n })\n ).map(toSession);\n },\n getBySessionId: async sessionId => {\n const row = await db().findOne<SessionDbRow>(SESSIONS, { session_id: sessionId });\n return row && (await getProjectRepositoryById(row.project_repository_id)) ? toSession(row) : null;\n },\n getForBranch: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toSession(row) : null;\n },\n create: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n const existing = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (existing) return toSession(existing);\n const now = new Date();\n try {\n const row = await db().insertOne<SessionDbRow>(SESSIONS, {\n session_id: input.sessionId,\n project_repository_id: input.projectRepositoryId,\n org_id: input.orgId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n sandbox_id: null,\n sandbox_workdir: null,\n materialized_at: null,\n created_at: now,\n updated_at: now,\n });\n return toSession(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (!row) throw error;\n return toSession(row);\n }\n },\n setSandbox: async ({ id, sandboxId, sandboxWorkdir }) => {\n await db().updateMany(\n SESSIONS,\n { id },\n { sandbox_id: sandboxId, sandbox_workdir: sandboxWorkdir, updated_at: new Date() },\n );\n },\n markMaterialized: async ({ id }) => {\n await db().updateMany(SESSIONS, { id }, { materialized_at: new Date(), updated_at: new Date() });\n },\n delete: async id => {\n await db().deleteMany(SESSIONS, { id });\n },\n },\n };\n }\n}\n"],"mappings":";AAAA,SAAS,sBAAsB,4BAA4B;AAG3D,IAAM,mBAAmB;AACzB,IAAM,gBAAgB;AACtB,IAAM,eAAe;AACrB,IAAM,cAAc;AACpB,IAAM,uBAAuB;AAC7B,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,WAAW;AAEV,IAAM,yBAA6C;AAAA,EACxD;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,MACP,IAAI,EAAE,MAAM,UAAU;AAAA,MACtB,gBAAgB,EAAE,MAAM,OAAO;AAAA,MAC/B,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,sBAAsB,EAAE,MAAM,OAAO;AAAA,MACrC,aAAa,EAAE,MAAM,OAAO;AAAA,MAC5B,cAAc,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA,MAC7C,cAAc,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA,M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AAU;AAAA,cACrD,uBAAuB,MAAM;AAAA,cAC7B,SAAS,MAAM;AAAA,cACf,QAAQ,MAAM;AAAA,YAChB,CAAC;AACD,gBAAI,CAAC,IAAK,OAAM;AAChB,mBAAO,UAAU,GAAG;AAAA,UACtB;AAAA,QACF;AAAA,QACA,YAAY,OAAO,EAAE,IAAI,WAAW,eAAe,MAAM;AACvD,gBAAM,GAAG,EAAE;AAAA,YACT;AAAA,YACA,EAAE,GAAG;AAAA,YACL,EAAE,YAAY,WAAW,iBAAiB,gBAAgB,YAAY,oBAAI,KAAK,EAAE;AAAA,UACnF;AAAA,QACF;AAAA,QACA,kBAAkB,OAAO,EAAE,GAAG,MAAM;AAClC,gBAAM,GAAG,EAAE,WAAW,UAAU,EAAE,GAAG,GAAG,EAAE,iBAAiB,oBAAI,KAAK,GAAG,YAAY,oBAAI,KAAK,EAAE,CAAC;AAAA,QACjG;AAAA,QACA,QAAQ,OAAM,OAAM;AAClB,gBAAM,GAAG,EAAE,WAAW,UAAU,EAAE,GAAG,CAAC;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -99,6 +99,10 @@ export declare class SourceControlStorageInMemory implements SourceControlStorag
99
99
  getById: ({ id }: {
100
100
  id: string;
101
101
  }) => Promise<ProjectRepositorySandbox | null>;
102
+ setWorkdir: ({ id, sandboxWorkdir }: {
103
+ id: string;
104
+ sandboxWorkdir: string;
105
+ }) => Promise<void>;
102
106
  setSandboxId: ({ id, sandboxId }: {
103
107
  id: string;
104
108
  sandboxId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"inmemory.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yCAAyC,EACzC,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,E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+BAA+B,KAAG,OAAO,CAAC,oBAAoB,CAAC;yDAoBlF;YACD,EAAE,EAAE,MAAM,CAAC;YACX,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;YACzB,cAAc,EAAE,MAAM,CAAC;SACxB;mCAIgC;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE;qBAI5B,MAAM;MAGzB;CACH"}
@@ -242,6 +242,10 @@ var SourceControlStorageInMemory = class {
242
242
  return created;
243
243
  },
244
244
  getById: async ({ id }) => this.sandboxesRows.find((row) => row.id === id) ?? null,
245
+ setWorkdir: async ({ id, sandboxWorkdir }) => {
246
+ const row = this.sandboxesRows.find((candidate) => candidate.id === id);
247
+ if (row) Object.assign(row, { sandboxWorkdir, materializedAt: null });
248
+ },
245
249
  setSandboxId: async ({ id, sandboxId }) => {
246
250
  const row = this.sandboxesRows.find((candidate) => candidate.id === id);
247
251
  if (row) row.sandboxId = sandboxId;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type {\n CreateProjectSourceControlConnectionInput,\n CreateSourceControlSessionInput,\n ExternalRepositoryProjectTarget,\n LinkProjectRepositoryInput,\n ProjectRepository,\n ProjectRepositorySandbox,\n ProjectSourceControlConnection,\n SourceControlInstallation,\n SourceControlRepository,\n SourceControlSession,\n SourceControlStorageHandle,\n SourceControlWorktree,\n UpdateProjectRepositoryInput,\n UpsertSourceControlInstallationInput,\n UpsertSourceControlRepositoryInput,\n UpsertSourceControlWorktreeInput,\n} from './base.js';\n\n/** In-memory provider-scoped source-control handle for route tests. */\nexport class SourceControlStorageInMemory implements SourceControlStorageHandle {\n readonly integrationId: string;\n installationsRows: SourceControlInstallation[] = [];\n repositoriesRows: SourceControlRepository[] = [];\n connectionsRows: ProjectSourceControlConnection[] = [];\n projectRepositoriesRows: ProjectRepository[] = [];\n sandboxesRows: ProjectRepositorySandbox[] = [];\n worktreesRows: SourceControlWorktree[] = [];\n sessionsRows: SourceControlSession[] = [];\n\n constructor(integrationId = 'github') {\n this.integrationId = integrationId;\n }\n\n readonly installations = {\n list: async ({ orgId }: { orgId: string }): Promise<SourceControlInstallation[]> =>\n this.installationsRows.filter(row => row.orgId === orgId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.id === id) ?? null,\n findByExternalId: async ({\n orgId,\n externalId,\n }: {\n orgId: string;\n externalId: string;\n }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.externalId === externalId) ?? null,\n upsert: async (input: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation> => {\n const existing = this.installationsRows.find(\n row => row.orgId === input.orgId && row.externalId === input.externalId,\n );\n if (existing) {\n Object.assign(existing, {\n connectedByUserId: input.connectedByUserId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n });\n return existing;\n }\n const created: SourceControlInstallation = {\n id: randomUUID(),\n integrationId: this.integrationId,\n orgId: input.orgId,\n connectedByUserId: input.connectedByUserId,\n externalId: input.externalId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: new Date(),\n };\n this.installationsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n const index = this.installationsRows.findIndex(row => row.orgId === orgId && row.id === id);\n if (index < 0) return false;\n this.installationsRows.splice(index, 1);\n return true;\n },\n };\n\n readonly repositories = {\n list: async ({ orgId, installationId }: { orgId: string; installationId: string }) => {\n const installation = await this.installations.get({ orgId, id: installationId });\n return installation ? this.repositoriesRows.filter(row => row.installationId === installationId) : [];\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = this.repositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n findByExternalId: async ({\n orgId,\n installationId,\n externalId,\n }: {\n orgId: string;\n installationId: string;\n externalId: string;\n }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.externalId === externalId) ?? null;\n },\n findBySlug: async ({ orgId, installationId, slug }: { orgId: string; installationId: string; slug: string }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.slug === slug) ?? null;\n },\n upsert: async ({\n orgId,\n input,\n }: {\n orgId: string;\n input: UpsertSourceControlRepositoryInput;\n }): Promise<SourceControlRepository> => {\n if (!(await this.installations.get({ orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.repositoriesRows.find(\n row => row.installationId === input.installationId && row.externalId === input.externalId,\n );\n const now = new Date();\n if (existing) {\n Object.assign(existing, {\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n updatedAt: now,\n });\n return existing;\n }\n const created: SourceControlRepository = {\n id: randomUUID(),\n installationId: input.installationId,\n externalId: input.externalId,\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: now,\n updatedAt: now,\n };\n this.repositoriesRows.push(created);\n return created;\n },\n };\n\n readonly connections = {\n list: async ({ factoryProjectId }: { orgId: string; factoryProjectId: string }) =>\n this.connectionsRows.filter(row => row.factoryProjectId === factoryProjectId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null> => {\n const row = this.connectionsRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n create: async (input: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection> => {\n if (!(await this.installations.get({ orgId: input.orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.connectionsRows.find(\n row =>\n row.factoryProjectId === input.factoryProjectId &&\n row.integrationId === this.integrationId &&\n row.installationId === input.installationId,\n );\n if (existing) return existing;\n const created: ProjectSourceControlConnection = {\n id: randomUUID(),\n factoryProjectId: input.factoryProjectId,\n integrationId: this.integrationId,\n installationId: input.installationId,\n createdByUserId: input.createdByUserId,\n createdAt: new Date(),\n };\n this.connectionsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.connections.get({ orgId, id }))) return false;\n this.connectionsRows.splice(0, this.connectionsRows.length, ...this.connectionsRows.filter(row => row.id !== id));\n return true;\n },\n };\n\n readonly projectRepositories = {\n list: async ({ orgId, connectionId }: { orgId: string; connectionId: string }) =>\n (await this.connections.get({ orgId, id: connectionId }))\n ? this.projectRepositoriesRows.filter(row => row.connectionId === connectionId)\n : [],\n listByExternalRepository: async ({\n installationExternalId,\n repositoryExternalId,\n }: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]> => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n for (const installation of this.installationsRows.filter(row => row.externalId === installationExternalId)) {\n const repository = this.repositoriesRows.find(\n row => row.installationId === installation.id && row.externalId === repositoryExternalId,\n );\n if (!repository) continue;\n for (const projectRepository of this.projectRepositoriesRows.filter(\n row => row.repositoryId === repository.id,\n )) {\n const connection = this.connectionsRows.find(\n row =>\n row.id === projectRepository.connectionId &&\n row.installationId === installation.id &&\n row.integrationId === this.integrationId,\n );\n if (!connection) continue;\n targets.push({\n orgId: installation.orgId,\n factoryProjectId: connection.factoryProjectId,\n projectRepository,\n });\n }\n }\n return targets;\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = this.projectRepositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.connections.get({ orgId, id: row.connectionId })) ? row : null;\n },\n link: async (input: LinkProjectRepositoryInput): Promise<ProjectRepository> => {\n const connection = await this.connections.get({ orgId: input.orgId, id: input.connectionId });\n const repository = await this.repositories.get({ orgId: input.orgId, id: input.repositoryId });\n if (!connection || !repository || repository.installationId !== connection.installationId) {\n throw new Error('Source-control connection or repository not found');\n }\n const existing = this.projectRepositoriesRows.find(\n row => row.connectionId === input.connectionId && row.repositoryId === input.repositoryId,\n );\n if (existing) return existing;\n const now = new Date();\n const created: ProjectRepository = {\n id: randomUUID(),\n connectionId: input.connectionId,\n repositoryId: input.repositoryId,\n createdByUserId: input.createdByUserId,\n branch: input.branch ?? null,\n sandboxProvider: input.sandboxProvider,\n sandboxWorkdir: input.sandboxWorkdir,\n setupCommand: input.setupCommand ?? null,\n createdAt: now,\n updatedAt: now,\n };\n this.projectRepositoriesRows.push(created);\n return created;\n },\n update: async ({\n orgId,\n id,\n input,\n }: {\n orgId: string;\n id: string;\n input: UpdateProjectRepositoryInput;\n }): Promise<ProjectRepository | null> => {\n const row = await this.projectRepositories.get({ orgId, id });\n if (!row) return null;\n Object.assign(row, input, { updatedAt: new Date() });\n return row;\n },\n unlink: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.projectRepositories.get({ orgId, id }))) return false;\n this.projectRepositoriesRows.splice(\n 0,\n this.projectRepositoriesRows.length,\n ...this.projectRepositoriesRows.filter(row => row.id !== id),\n );\n return true;\n },\n };\n\n readonly sandboxes = {\n getOrCreate: async ({\n projectRepository,\n userId,\n }: {\n projectRepository: ProjectRepository;\n userId: string;\n }): Promise<ProjectRepositorySandbox> => {\n const existing = this.sandboxesRows.find(\n row => row.projectRepositoryId === projectRepository.id && row.userId === userId,\n );\n if (existing) return existing;\n const created: ProjectRepositorySandbox = {\n id: randomUUID(),\n projectRepositoryId: projectRepository.id,\n userId,\n sandboxId: null,\n sandboxWorkdir: projectRepository.sandboxWorkdir,\n materializedAt: null,\n createdAt: new Date(),\n };\n this.sandboxesRows.push(created);\n return created;\n },\n getById: async ({ id }: { id: string }): Promise<ProjectRepositorySandbox | null> =>\n this.sandboxesRows.find(row => row.id === id) ?? null,\n setSandboxId: async ({ id, sandboxId }: { id: string; sandboxId: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.sandboxId = sandboxId;\n },\n clearBinding: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId: null, materializedAt: null });\n },\n markMaterialized: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.materializedAt = new Date();\n },\n };\n\n readonly worktrees = {\n upsert: async (input: UpsertSourceControlWorktreeInput): Promise<void> => {\n const existing = this.worktreesRows.find(\n row =>\n row.projectRepositoryId === input.projectRepositoryId &&\n row.userId === input.userId &&\n row.branch === input.branch,\n );\n if (existing) {\n existing.baseBranch = input.baseBranch;\n existing.worktreePath = input.worktreePath;\n return;\n }\n this.worktreesRows.push({ id: randomUUID(), createdAt: new Date(), ...input });\n },\n list: async ({\n projectRepositoryId,\n userId,\n }: {\n projectRepositoryId: string;\n userId: string;\n }): Promise<SourceControlWorktree[]> =>\n this.worktreesRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n get: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n findByPath: async ({\n projectRepositoryId,\n userId,\n worktreePath,\n }: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row =>\n row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.worktreePath === worktreePath,\n ) ?? null,\n delete: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<void> => {\n this.worktreesRows.splice(\n 0,\n this.worktreesRows.length,\n ...this.worktreesRows.filter(\n row => !(row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch),\n ),\n );\n },\n };\n\n readonly sessions = {\n list: async ({ projectRepositoryId, userId }: { projectRepositoryId: string; userId: string }) =>\n this.sessionsRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n getBySessionId: async (sessionId: string): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(row => row.sessionId === sessionId) ?? null,\n getForBranch: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n create: async (input: CreateSourceControlSessionInput): Promise<SourceControlSession> => {\n const existing = await this.sessions.getForBranch(input);\n if (existing) return existing;\n const now = new Date();\n const session: SourceControlSession = {\n id: randomUUID(),\n ...input,\n sandboxId: null,\n sandboxWorkdir: null,\n materializedAt: null,\n createdAt: now,\n updatedAt: now,\n };\n this.sessionsRows.push(session);\n return session;\n },\n setSandbox: async ({\n id,\n sandboxId,\n sandboxWorkdir,\n }: {\n id: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId, sandboxWorkdir, updatedAt: new Date() });\n },\n markMaterialized: async ({ id }: { id: string }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { materializedAt: new Date(), updatedAt: new Date() });\n },\n delete: async (id: string) => {\n this.sessionsRows.splice(0, this.sessionsRows.length, ...this.sessionsRows.filter(row => row.id !== id));\n },\n };\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAsBpB,IAAM,+BAAN,MAAyE;AAAA,EACrE;AAAA,EACT,oBAAiD,CAAC;AAAA,EAClD,mBAA8C,CAAC;AAAA,EAC/C,kBAAoD,CAAC;AAAA,EACrD,0BAA+C,CAAC;AAAA,EAChD,gBAA4C,CAAC;AAAA,EAC7C,gBAAyC,CAAC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K,EAAE,WAAW,gBAAgB,WAAW,oBAAI,KAAK,EAAE,CAAC;AAAA,IAClF;AAAA,IACA,kBAAkB,OAAO,EAAE,GAAG,MAAsB;AAClD,YAAM,MAAM,KAAK,aAAa,KAAK,eAAa,UAAU,OAAO,EAAE;AACnE,UAAI,IAAK,QAAO,OAAO,KAAK,EAAE,gBAAgB,oBAAI,KAAK,GAAG,WAAW,oBAAI,KAAK,EAAE,CAAC;AAAA,IACnF;AAAA,IACA,QAAQ,OAAO,OAAe;AAC5B,WAAK,aAAa,OAAO,GAAG,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,OAAO,SAAO,IAAI,OAAO,EAAE,CAAC;AAAA,IACzG;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type {\n CreateProjectSourceControlConnectionInput,\n CreateSourceControlSessionInput,\n ExternalRepositoryProjectTarget,\n LinkProjectRepositoryInput,\n ProjectRepository,\n ProjectRepositorySandbox,\n ProjectSourceControlConnection,\n SourceControlInstallation,\n SourceControlRepository,\n SourceControlSession,\n SourceControlStorageHandle,\n SourceControlWorktree,\n UpdateProjectRepositoryInput,\n UpsertSourceControlInstallationInput,\n UpsertSourceControlRepositoryInput,\n UpsertSourceControlWorktreeInput,\n} from './base.js';\n\n/** In-memory provider-scoped source-control handle for route tests. */\nexport class SourceControlStorageInMemory implements SourceControlStorageHandle {\n readonly integrationId: string;\n installationsRows: SourceControlInstallation[] = [];\n repositoriesRows: SourceControlRepository[] = [];\n connectionsRows: ProjectSourceControlConnection[] = [];\n projectRepositoriesRows: ProjectRepository[] = [];\n sandboxesRows: ProjectRepositorySandbox[] = [];\n worktreesRows: SourceControlWorktree[] = [];\n sessionsRows: SourceControlSession[] = [];\n\n constructor(integrationId = 'github') {\n this.integrationId = integrationId;\n }\n\n readonly installations = {\n list: async ({ orgId }: { orgId: string }): Promise<SourceControlInstallation[]> =>\n this.installationsRows.filter(row => row.orgId === orgId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.id === id) ?? null,\n findByExternalId: async ({\n orgId,\n externalId,\n }: {\n orgId: string;\n externalId: string;\n }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.externalId === externalId) ?? null,\n upsert: async (input: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation> => {\n const existing = this.installationsRows.find(\n row => row.orgId === input.orgId && row.externalId === input.externalId,\n );\n if (existing) {\n Object.assign(existing, {\n connectedByUserId: input.connectedByUserId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n });\n return existing;\n }\n const created: SourceControlInstallation = {\n id: randomUUID(),\n integrationId: this.integrationId,\n orgId: input.orgId,\n connectedByUserId: input.connectedByUserId,\n externalId: input.externalId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: new Date(),\n };\n this.installationsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n const index = this.installationsRows.findIndex(row => row.orgId === orgId && row.id === id);\n if (index < 0) return false;\n this.installationsRows.splice(index, 1);\n return true;\n },\n };\n\n readonly repositories = {\n list: async ({ orgId, installationId }: { orgId: string; installationId: string }) => {\n const installation = await this.installations.get({ orgId, id: installationId });\n return installation ? this.repositoriesRows.filter(row => row.installationId === installationId) : [];\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = this.repositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n findByExternalId: async ({\n orgId,\n installationId,\n externalId,\n }: {\n orgId: string;\n installationId: string;\n externalId: string;\n }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.externalId === externalId) ?? null;\n },\n findBySlug: async ({ orgId, installationId, slug }: { orgId: string; installationId: string; slug: string }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.slug === slug) ?? null;\n },\n upsert: async ({\n orgId,\n input,\n }: {\n orgId: string;\n input: UpsertSourceControlRepositoryInput;\n }): Promise<SourceControlRepository> => {\n if (!(await this.installations.get({ orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.repositoriesRows.find(\n row => row.installationId === input.installationId && row.externalId === input.externalId,\n );\n const now = new Date();\n if (existing) {\n Object.assign(existing, {\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n updatedAt: now,\n });\n return existing;\n }\n const created: SourceControlRepository = {\n id: randomUUID(),\n installationId: input.installationId,\n externalId: input.externalId,\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: now,\n updatedAt: now,\n };\n this.repositoriesRows.push(created);\n return created;\n },\n };\n\n readonly connections = {\n list: async ({ factoryProjectId }: { orgId: string; factoryProjectId: string }) =>\n this.connectionsRows.filter(row => row.factoryProjectId === factoryProjectId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null> => {\n const row = this.connectionsRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n create: async (input: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection> => {\n if (!(await this.installations.get({ orgId: input.orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.connectionsRows.find(\n row =>\n row.factoryProjectId === input.factoryProjectId &&\n row.integrationId === this.integrationId &&\n row.installationId === input.installationId,\n );\n if (existing) return existing;\n const created: ProjectSourceControlConnection = {\n id: randomUUID(),\n factoryProjectId: input.factoryProjectId,\n integrationId: this.integrationId,\n installationId: input.installationId,\n createdByUserId: input.createdByUserId,\n createdAt: new Date(),\n };\n this.connectionsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.connections.get({ orgId, id }))) return false;\n this.connectionsRows.splice(0, this.connectionsRows.length, ...this.connectionsRows.filter(row => row.id !== id));\n return true;\n },\n };\n\n readonly projectRepositories = {\n list: async ({ orgId, connectionId }: { orgId: string; connectionId: string }) =>\n (await this.connections.get({ orgId, id: connectionId }))\n ? this.projectRepositoriesRows.filter(row => row.connectionId === connectionId)\n : [],\n listByExternalRepository: async ({\n installationExternalId,\n repositoryExternalId,\n }: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]> => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n for (const installation of this.installationsRows.filter(row => row.externalId === installationExternalId)) {\n const repository = this.repositoriesRows.find(\n row => row.installationId === installation.id && row.externalId === repositoryExternalId,\n );\n if (!repository) continue;\n for (const projectRepository of this.projectRepositoriesRows.filter(\n row => row.repositoryId === repository.id,\n )) {\n const connection = this.connectionsRows.find(\n row =>\n row.id === projectRepository.connectionId &&\n row.installationId === installation.id &&\n row.integrationId === this.integrationId,\n );\n if (!connection) continue;\n targets.push({\n orgId: installation.orgId,\n factoryProjectId: connection.factoryProjectId,\n projectRepository,\n });\n }\n }\n return targets;\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = this.projectRepositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.connections.get({ orgId, id: row.connectionId })) ? row : null;\n },\n link: async (input: LinkProjectRepositoryInput): Promise<ProjectRepository> => {\n const connection = await this.connections.get({ orgId: input.orgId, id: input.connectionId });\n const repository = await this.repositories.get({ orgId: input.orgId, id: input.repositoryId });\n if (!connection || !repository || repository.installationId !== connection.installationId) {\n throw new Error('Source-control connection or repository not found');\n }\n const existing = this.projectRepositoriesRows.find(\n row => row.connectionId === input.connectionId && row.repositoryId === input.repositoryId,\n );\n if (existing) return existing;\n const now = new Date();\n const created: ProjectRepository = {\n id: randomUUID(),\n connectionId: input.connectionId,\n repositoryId: input.repositoryId,\n createdByUserId: input.createdByUserId,\n branch: input.branch ?? null,\n sandboxProvider: input.sandboxProvider,\n sandboxWorkdir: input.sandboxWorkdir,\n setupCommand: input.setupCommand ?? null,\n createdAt: now,\n updatedAt: now,\n };\n this.projectRepositoriesRows.push(created);\n return created;\n },\n update: async ({\n orgId,\n id,\n input,\n }: {\n orgId: string;\n id: string;\n input: UpdateProjectRepositoryInput;\n }): Promise<ProjectRepository | null> => {\n const row = await this.projectRepositories.get({ orgId, id });\n if (!row) return null;\n Object.assign(row, input, { updatedAt: new Date() });\n return row;\n },\n unlink: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.projectRepositories.get({ orgId, id }))) return false;\n this.projectRepositoriesRows.splice(\n 0,\n this.projectRepositoriesRows.length,\n ...this.projectRepositoriesRows.filter(row => row.id !== id),\n );\n return true;\n },\n };\n\n readonly sandboxes = {\n getOrCreate: async ({\n projectRepository,\n userId,\n }: {\n projectRepository: ProjectRepository;\n userId: string;\n }): Promise<ProjectRepositorySandbox> => {\n const existing = this.sandboxesRows.find(\n row => row.projectRepositoryId === projectRepository.id && row.userId === userId,\n );\n if (existing) return existing;\n const created: ProjectRepositorySandbox = {\n id: randomUUID(),\n projectRepositoryId: projectRepository.id,\n userId,\n sandboxId: null,\n sandboxWorkdir: projectRepository.sandboxWorkdir,\n materializedAt: null,\n createdAt: new Date(),\n };\n this.sandboxesRows.push(created);\n return created;\n },\n getById: async ({ id }: { id: string }): Promise<ProjectRepositorySandbox | null> =>\n this.sandboxesRows.find(row => row.id === id) ?? null,\n setWorkdir: async ({ id, sandboxWorkdir }: { id: string; sandboxWorkdir: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxWorkdir, materializedAt: null });\n },\n setSandboxId: async ({ id, sandboxId }: { id: string; sandboxId: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.sandboxId = sandboxId;\n },\n clearBinding: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId: null, materializedAt: null });\n },\n markMaterialized: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.materializedAt = new Date();\n },\n };\n\n readonly worktrees = {\n upsert: async (input: UpsertSourceControlWorktreeInput): Promise<void> => {\n const existing = this.worktreesRows.find(\n row =>\n row.projectRepositoryId === input.projectRepositoryId &&\n row.userId === input.userId &&\n row.branch === input.branch,\n );\n if (existing) {\n existing.baseBranch = input.baseBranch;\n existing.worktreePath = input.worktreePath;\n return;\n }\n this.worktreesRows.push({ id: randomUUID(), createdAt: new Date(), ...input });\n },\n list: async ({\n projectRepositoryId,\n userId,\n }: {\n projectRepositoryId: string;\n userId: string;\n }): Promise<SourceControlWorktree[]> =>\n this.worktreesRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n get: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n findByPath: async ({\n projectRepositoryId,\n userId,\n worktreePath,\n }: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row =>\n row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.worktreePath === worktreePath,\n ) ?? null,\n delete: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<void> => {\n this.worktreesRows.splice(\n 0,\n this.worktreesRows.length,\n ...this.worktreesRows.filter(\n row => !(row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch),\n ),\n );\n },\n };\n\n readonly sessions = {\n list: async ({ projectRepositoryId, userId }: { projectRepositoryId: string; userId: string }) =>\n this.sessionsRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n getBySessionId: async (sessionId: string): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(row => row.sessionId === sessionId) ?? null,\n getForBranch: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n create: async (input: CreateSourceControlSessionInput): Promise<SourceControlSession> => {\n const existing = await this.sessions.getForBranch(input);\n if (existing) return existing;\n const now = new Date();\n const session: SourceControlSession = {\n id: randomUUID(),\n ...input,\n sandboxId: null,\n sandboxWorkdir: null,\n materializedAt: null,\n createdAt: now,\n updatedAt: now,\n };\n this.sessionsRows.push(session);\n return session;\n },\n setSandbox: async ({\n id,\n sandboxId,\n sandboxWorkdir,\n }: {\n id: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId, sandboxWorkdir, updatedAt: new Date() });\n },\n markMaterialized: async ({ id }: { id: string }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { materializedAt: new Date(), updatedAt: new Date() });\n },\n delete: async (id: string) => {\n this.sessionsRows.splice(0, this.sessionsRows.length, ...this.sessionsRows.filter(row => row.id !== id));\n },\n };\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAsBpB,IAAM,+BAAN,MAAyE;AAAA,EACrE;AAAA,EACT,oBAAiD,CAAC;AAAA,EAClD,mBAA8C,CAAC;AAAA,EAC/C,kBAAoD,CAAC;AAAA,EACrD,0BAA+C,CAAC;AAAA,EAChD,gBAA4C,CAAC;AAAA,EAC7C,gB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AAK,OAAO;AAC9B,aAAO;AAAA,IACT;AAAA,IACA,YAAY,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,IACF,MAIM;AACJ,YAAM,MAAM,KAAK,aAAa,KAAK,eAAa,UAAU,OAAO,EAAE;AACnE,UAAI,IAAK,QAAO,OAAO,KAAK,EAAE,WAAW,gBAAgB,WAAW,oBAAI,KAAK,EAAE,CAAC;AAAA,IAClF;AAAA,IACA,kBAAkB,OAAO,EAAE,GAAG,MAAsB;AAClD,YAAM,MAAM,KAAK,aAAa,KAAK,eAAa,UAAU,OAAO,EAAE;AACnE,UAAI,IAAK,QAAO,OAAO,KAAK,EAAE,gBAAgB,oBAAI,KAAK,GAAG,WAAW,oBAAI,KAAK,EAAE,CAAC;AAAA,IACnF;AAAA,IACA,QAAQ,OAAO,OAAe;AAC5B,WAAK,aAAa,OAAO,GAAG,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,OAAO,SAAO,IAAI,OAAO,EAAE,CAAC;AAAA,IACzG;AAAA,EACF;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,oBAAoB,EAAwB,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,sBAAsB,CAAC;AAEhF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAanC,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAE7E;AAED,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,C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AAG,IAAI,CAAC;IAuBjE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAiBxF"}
@@ -234,7 +234,8 @@ var FACTORY_GOVERNANCE_SCHEMAS = [
234
234
  name: "factory_deferred_decisions_tenant_key_unique",
235
235
  columns: ["org_id", "factory_project_id", "idempotency_key"]
236
236
  }
237
- ]
237
+ ],
238
+ indexes: [{ name: "factory_deferred_decisions_claim_idx", columns: ["status", "created_at"] }]
238
239
  },
239
240
  {
240
241
  name: "factory_run_bindings",
@@ -251,7 +252,17 @@ var FACTORY_GOVERNANCE_SCHEMAS = [
251
252
  status: { type: "text" },
252
253
  created_at: { type: "timestamp" },
253
254
  revoked_at: { type: "timestamp", nullable: true }
254
- }
255
+ },
256
+ indexes: [
257
+ // Exact-address lookups run on every processor message; status filter is
258
+ // applied on top of the address columns.
259
+ {
260
+ name: "factory_run_bindings_session_idx",
261
+ columns: ["factory_project_id", "thread_id", "resource_id", "session_id"]
262
+ },
263
+ // Restart reconciler enumerates active bindings across all tenants.
264
+ { name: "factory_run_bindings_status_idx", columns: ["status"] }
265
+ ]
255
266
  },
256
267
  {
257
268
  name: "factory_tool_result_cursors",
@@ -288,7 +299,8 @@ var FACTORY_GOVERNANCE_SCHEMAS = [
288
299
  name: "factory_pending_starts_tenant_kickoff_unique",
289
300
  columns: ["org_id", "factory_project_id", "kickoff_key"]
290
301
  }
291
- ]
302
+ ],
303
+ indexes: [{ name: "factory_pending_starts_claim_idx", columns: ["status", "created_at"] }]
292
304
  }
293
305
  ];
294
306
  function toBinding(row) {
@@ -369,7 +381,11 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
369
381
  }
370
382
  async #claimLeases(table, input, map) {
371
383
  const claim = () => this.storage.withTransaction(async (ops) => {
372
- const candidates = await ops.findMany(table, {}, { orderBy: [["created_at", "asc"]] });
384
+ const candidates = await ops.findMany(
385
+ table,
386
+ { status: { in: ["pending", "retry", "leased"] } },
387
+ { orderBy: [["created_at", "asc"]], limit: Math.max(input.limit * 5, 50) }
388
+ );
373
389
  const claimed = [];
374
390
  for (const candidate of candidates) {
375
391
  if (claimed.length >= input.limit) break;