主流程

This commit is contained in:
2026-06-10 17:53:09 +08:00
parent c6f239f424
commit b20435c027
66 changed files with 2779 additions and 1181 deletions
+13
View File
@@ -95,6 +95,7 @@ type Conversation struct {
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
RequirementID pgtype.UUID `json:"requirement_id"`
}
type GitCredential struct {
@@ -276,6 +277,18 @@ type Requirement struct {
WorkspaceID pgtype.UUID `json:"workspace_id"`
}
type RequirementArtifact struct {
ID pgtype.UUID `json:"id"`
RequirementID pgtype.UUID `json:"requirement_id"`
Phase string `json:"phase"`
Version int32 `json:"version"`
Content string `json:"content"`
Note string `json:"note"`
SourceMessageID *int64 `json:"source_message_id"`
CreatedBy pgtype.UUID `json:"created_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type User struct {
ID pgtype.UUID `json:"id"`
Email string `json:"email"`
+11 -4
View File
@@ -154,11 +154,12 @@ SELECT id, workspace_id, project_id, agent_kind_id, user_id,
branch, cwd_path, is_main_worktree, status,
pid, exit_code, last_error, started_at, ended_at
FROM acp_sessions
WHERE ($1::uuid IS NULL OR requirement_id = $1)
ORDER BY started_at DESC
`
func (q *Queries) ListAllSessions(ctx context.Context) ([]AcpSession, error) {
rows, err := q.db.Query(ctx, listAllSessions)
func (q *Queries) ListAllSessions(ctx context.Context, dollar_1 pgtype.UUID) ([]AcpSession, error) {
rows, err := q.db.Query(ctx, listAllSessions, dollar_1)
if err != nil {
return nil, err
}
@@ -202,11 +203,17 @@ SELECT id, workspace_id, project_id, agent_kind_id, user_id,
pid, exit_code, last_error, started_at, ended_at
FROM acp_sessions
WHERE user_id = $1
AND ($2::uuid IS NULL OR requirement_id = $2)
ORDER BY started_at DESC
`
func (q *Queries) ListSessionsByUser(ctx context.Context, userID pgtype.UUID) ([]AcpSession, error) {
rows, err := q.db.Query(ctx, listSessionsByUser, userID)
type ListSessionsByUserParams struct {
UserID pgtype.UUID `json:"user_id"`
Column2 pgtype.UUID `json:"column_2"`
}
func (q *Queries) ListSessionsByUser(ctx context.Context, arg ListSessionsByUserParams) ([]AcpSession, error) {
rows, err := q.db.Query(ctx, listSessionsByUser, arg.UserID, arg.Column2)
if err != nil {
return nil, err
}