From 679ded50c9ef5a3296463bde1c291712074e7a8d Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 7 May 2026 13:39:08 +0800 Subject: [PATCH] chore(sqlc): regenerate models for migration 0006 sqlc reads all migrations into every package's schema, so the addition of acp_* tables and workspaces.active_main_session_id in migration 0006 propagates type definitions and SELECT column lists across all sub-packages. No code logic changes. --- internal/audit/sqlc/models.go | 73 +++++++++++++++++++---- internal/chat/sqlc/models.go | 73 +++++++++++++++++++---- internal/infra/notify/sqlc/models.go | 73 +++++++++++++++++++---- internal/jobs/sqlc/models.go | 73 +++++++++++++++++++---- internal/project/sqlc/models.go | 73 +++++++++++++++++++---- internal/user/sqlc/models.go | 73 +++++++++++++++++++---- internal/workspace/sqlc/models.go | 73 +++++++++++++++++++---- internal/workspace/sqlc/workspaces.sql.go | 18 ++++-- 8 files changed, 432 insertions(+), 97 deletions(-) diff --git a/internal/audit/sqlc/models.go b/internal/audit/sqlc/models.go index e0536c9..ad381f8 100644 --- a/internal/audit/sqlc/models.go +++ b/internal/audit/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/chat/sqlc/models.go b/internal/chat/sqlc/models.go index 6ca1603..178756a 100644 --- a/internal/chat/sqlc/models.go +++ b/internal/chat/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/infra/notify/sqlc/models.go b/internal/infra/notify/sqlc/models.go index 43e6937..6d20bf9 100644 --- a/internal/infra/notify/sqlc/models.go +++ b/internal/infra/notify/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/jobs/sqlc/models.go b/internal/jobs/sqlc/models.go index 4a84f0c..aa9b877 100644 --- a/internal/jobs/sqlc/models.go +++ b/internal/jobs/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/project/sqlc/models.go b/internal/project/sqlc/models.go index e140465..235d1e3 100644 --- a/internal/project/sqlc/models.go +++ b/internal/project/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/user/sqlc/models.go b/internal/user/sqlc/models.go index 6996188..ee3222f 100644 --- a/internal/user/sqlc/models.go +++ b/internal/user/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/workspace/sqlc/models.go b/internal/workspace/sqlc/models.go index 00dca3b..d8595e0 100644 --- a/internal/workspace/sqlc/models.go +++ b/internal/workspace/sqlc/models.go @@ -10,6 +10,52 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type AcpAgentKind struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + BinaryPath string `json:"binary_path"` + Args []string `json:"args"` + EncryptedEnv []byte `json:"encrypted_env"` + Enabled bool `json:"enabled"` + CreatedBy pgtype.UUID `json:"created_by"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type AcpEvent struct { + ID int64 `json:"id"` + SessionID pgtype.UUID `json:"session_id"` + Direction string `json:"direction"` + RpcKind string `json:"rpc_kind"` + Method *string `json:"method"` + Payload []byte `json:"payload"` + PayloadSize int32 `json:"payload_size"` + Truncated bool `json:"truncated"` + CreatedAt pgtype.Timestamptz `json:"created_at"` +} + +type AcpSession struct { + ID pgtype.UUID `json:"id"` + WorkspaceID pgtype.UUID `json:"workspace_id"` + ProjectID pgtype.UUID `json:"project_id"` + AgentKindID pgtype.UUID `json:"agent_kind_id"` + UserID pgtype.UUID `json:"user_id"` + IssueID pgtype.UUID `json:"issue_id"` + RequirementID pgtype.UUID `json:"requirement_id"` + AgentSessionID *string `json:"agent_session_id"` + Branch string `json:"branch"` + CwdPath string `json:"cwd_path"` + IsMainWorktree bool `json:"is_main_worktree"` + Status string `json:"status"` + Pid *int32 `json:"pid"` + ExitCode *int32 `json:"exit_code"` + LastError *string `json:"last_error"` + StartedAt pgtype.Timestamptz `json:"started_at"` + EndedAt pgtype.Timestamptz `json:"ended_at"` +} + type AuditLog struct { ID int64 `json:"id"` UserID pgtype.UUID `json:"user_id"` @@ -220,19 +266,20 @@ type UserSession struct { } type Workspace struct { - ID pgtype.UUID `json:"id"` - ProjectID pgtype.UUID `json:"project_id"` - Slug string `json:"slug"` - Name string `json:"name"` - Description string `json:"description"` - GitRemoteUrl string `json:"git_remote_url"` - DefaultBranch string `json:"default_branch"` - MainPath string `json:"main_path"` - SyncStatus string `json:"sync_status"` - LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` - LastSyncError *string `json:"last_sync_error"` - CreatedAt pgtype.Timestamptz `json:"created_at"` - UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ID pgtype.UUID `json:"id"` + ProjectID pgtype.UUID `json:"project_id"` + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + GitRemoteUrl string `json:"git_remote_url"` + DefaultBranch string `json:"default_branch"` + MainPath string `json:"main_path"` + SyncStatus string `json:"sync_status"` + LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"` + LastSyncError *string `json:"last_sync_error"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"` } type WorkspaceWorktree struct { diff --git a/internal/workspace/sqlc/workspaces.sql.go b/internal/workspace/sqlc/workspaces.sql.go index 0a587a3..b795a88 100644 --- a/internal/workspace/sqlc/workspaces.sql.go +++ b/internal/workspace/sqlc/workspaces.sql.go @@ -16,7 +16,7 @@ INSERT INTO workspaces ( id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status ) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) -RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at +RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id ` type CreateWorkspaceParams struct { @@ -58,6 +58,7 @@ func (q *Queries) CreateWorkspace(ctx context.Context, arg CreateWorkspaceParams &i.LastSyncError, &i.CreatedAt, &i.UpdatedAt, + &i.ActiveMainSessionID, ) return i, err } @@ -72,7 +73,7 @@ func (q *Queries) DeleteWorkspace(ctx context.Context, id pgtype.UUID) error { } const getWorkspaceByID = `-- name: GetWorkspaceByID :one -SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at FROM workspaces WHERE id = $1 +SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id FROM workspaces WHERE id = $1 ` func (q *Queries) GetWorkspaceByID(ctx context.Context, id pgtype.UUID) (Workspace, error) { @@ -92,12 +93,13 @@ func (q *Queries) GetWorkspaceByID(ctx context.Context, id pgtype.UUID) (Workspa &i.LastSyncError, &i.CreatedAt, &i.UpdatedAt, + &i.ActiveMainSessionID, ) return i, err } const getWorkspaceBySlug = `-- name: GetWorkspaceBySlug :one -SELECT w.id, w.project_id, w.slug, w.name, w.description, w.git_remote_url, w.default_branch, w.main_path, w.sync_status, w.last_synced_at, w.last_sync_error, w.created_at, w.updated_at FROM workspaces w +SELECT w.id, w.project_id, w.slug, w.name, w.description, w.git_remote_url, w.default_branch, w.main_path, w.sync_status, w.last_synced_at, w.last_sync_error, w.created_at, w.updated_at, w.active_main_session_id FROM workspaces w JOIN projects p ON p.id = w.project_id WHERE p.slug = $1 AND w.slug = $2 ` @@ -124,6 +126,7 @@ func (q *Queries) GetWorkspaceBySlug(ctx context.Context, arg GetWorkspaceBySlug &i.LastSyncError, &i.CreatedAt, &i.UpdatedAt, + &i.ActiveMainSessionID, ) return i, err } @@ -170,7 +173,7 @@ func (q *Queries) ListFetchTargets(ctx context.Context) ([]ListFetchTargetsRow, } const listWorkspacesByProject = `-- name: ListWorkspacesByProject :many -SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at FROM workspaces WHERE project_id = $1 +SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id FROM workspaces WHERE project_id = $1 ORDER BY created_at DESC ` @@ -197,6 +200,7 @@ func (q *Queries) ListWorkspacesByProject(ctx context.Context, projectID pgtype. &i.LastSyncError, &i.CreatedAt, &i.UpdatedAt, + &i.ActiveMainSessionID, ); err != nil { return nil, err } @@ -279,7 +283,7 @@ const updateWorkspaceCore = `-- name: UpdateWorkspaceCore :one UPDATE workspaces SET name = $2, description = $3, default_branch = $4, updated_at = now() WHERE id = $1 -RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at +RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id ` type UpdateWorkspaceCoreParams struct { @@ -311,6 +315,7 @@ func (q *Queries) UpdateWorkspaceCore(ctx context.Context, arg UpdateWorkspaceCo &i.LastSyncError, &i.CreatedAt, &i.UpdatedAt, + &i.ActiveMainSessionID, ) return i, err } @@ -322,7 +327,7 @@ SET sync_status = $2, last_sync_error = $4, updated_at = now() WHERE id = $1 -RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at +RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id ` type UpdateWorkspaceSyncStatusParams struct { @@ -354,6 +359,7 @@ func (q *Queries) UpdateWorkspaceSyncStatus(ctx context.Context, arg UpdateWorks &i.LastSyncError, &i.CreatedAt, &i.UpdatedAt, + &i.ActiveMainSessionID, ) return i, err }