agent-tower 0.5.2-beta.2 → 0.5.2-beta.4
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.
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +22 -2
- package/dist/app.js.map +1 -1
- package/dist/app.test.js +67 -0
- package/dist/app.test.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/core/container.d.ts +2 -0
- package/dist/core/container.d.ts.map +1 -1
- package/dist/core/container.js +9 -1
- package/dist/core/container.js.map +1 -1
- package/dist/core/event-bus.d.ts +2 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/executors/__tests__/base.executor.test.d.ts +2 -0
- package/dist/executors/__tests__/base.executor.test.d.ts.map +1 -0
- package/dist/executors/__tests__/base.executor.test.js +264 -0
- package/dist/executors/__tests__/base.executor.test.js.map +1 -0
- package/dist/executors/__tests__/codex.executor.test.js +18 -1
- package/dist/executors/__tests__/codex.executor.test.js.map +1 -1
- package/dist/executors/base.executor.d.ts.map +1 -1
- package/dist/executors/base.executor.js +61 -33
- package/dist/executors/base.executor.js.map +1 -1
- package/dist/executors/codex.executor.d.ts.map +1 -1
- package/dist/executors/codex.executor.js +3 -4
- package/dist/executors/codex.executor.js.map +1 -1
- package/dist/executors/execution-env.d.ts +7 -1
- package/dist/executors/execution-env.d.ts.map +1 -1
- package/dist/executors/execution-env.js +41 -2
- package/dist/executors/execution-env.js.map +1 -1
- package/dist/git/git-cli.d.ts +5 -3
- package/dist/git/git-cli.d.ts.map +1 -1
- package/dist/git/git-cli.js +3 -1
- package/dist/git/git-cli.js.map +1 -1
- package/dist/git/worktree.manager.js +1 -1
- package/dist/git/worktree.manager.js.map +1 -1
- package/dist/git/worktree.manager.test.js +69 -0
- package/dist/git/worktree.manager.test.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/http-client.d.ts +1 -0
- package/dist/mcp/http-client.d.ts.map +1 -1
- package/dist/mcp/http-client.js +3 -0
- package/dist/mcp/http-client.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +27 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/types.d.ts +6 -6
- package/dist/routes/__tests__/tasks.test.js +179 -0
- package/dist/routes/__tests__/tasks.test.js.map +1 -1
- package/dist/routes/git.d.ts.map +1 -1
- package/dist/routes/git.js +41 -1
- package/dist/routes/git.js.map +1 -1
- package/dist/routes/tasks.d.ts.map +1 -1
- package/dist/routes/tasks.js +10 -2
- package/dist/routes/tasks.js.map +1 -1
- package/dist/routes/team-runs.d.ts.map +1 -1
- package/dist/routes/team-runs.js +9 -0
- package/dist/routes/team-runs.js.map +1 -1
- package/dist/services/__tests__/project.service.test.js +85 -1
- package/dist/services/__tests__/project.service.test.js.map +1 -1
- package/dist/services/__tests__/session-manager.team-run.test.js +84 -1
- package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
- package/dist/services/__tests__/task.service.test.js +190 -0
- package/dist/services/__tests__/task.service.test.js.map +1 -1
- package/dist/services/__tests__/team-reconciler.service.test.js +122 -2
- package/dist/services/__tests__/team-reconciler.service.test.js.map +1 -1
- package/dist/services/__tests__/team-run.service.test.js +105 -1
- package/dist/services/__tests__/team-run.service.test.js.map +1 -1
- package/dist/services/__tests__/team-scheduler.service.test.js +46 -5
- package/dist/services/__tests__/team-scheduler.service.test.js.map +1 -1
- package/dist/services/__tests__/workspace-git-watcher.service.test.d.ts +2 -0
- package/dist/services/__tests__/workspace-git-watcher.service.test.d.ts.map +1 -0
- package/dist/services/__tests__/workspace-git-watcher.service.test.js +287 -0
- package/dist/services/__tests__/workspace-git-watcher.service.test.js.map +1 -0
- package/dist/services/__tests__/workspace.service.test.js +43 -1
- package/dist/services/__tests__/workspace.service.test.js.map +1 -1
- package/dist/services/project.service.d.ts +28 -24
- package/dist/services/project.service.d.ts.map +1 -1
- package/dist/services/project.service.js +11 -0
- package/dist/services/project.service.js.map +1 -1
- package/dist/services/session-manager.d.ts +44 -43
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +19 -3
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/task-cleanup.service.d.ts +3 -1
- package/dist/services/task-cleanup.service.d.ts.map +1 -1
- package/dist/services/task-cleanup.service.js +6 -1
- package/dist/services/task-cleanup.service.js.map +1 -1
- package/dist/services/task.service.d.ts +96 -65
- package/dist/services/task.service.d.ts.map +1 -1
- package/dist/services/task.service.js +208 -15
- package/dist/services/task.service.js.map +1 -1
- package/dist/services/team-run.service.d.ts +3 -0
- package/dist/services/team-run.service.d.ts.map +1 -1
- package/dist/services/team-run.service.js +77 -16
- package/dist/services/team-run.service.js.map +1 -1
- package/dist/services/team-scheduler.service.d.ts.map +1 -1
- package/dist/services/team-scheduler.service.js +16 -4
- package/dist/services/team-scheduler.service.js.map +1 -1
- package/dist/services/workspace-git-watcher.service.d.ts +67 -0
- package/dist/services/workspace-git-watcher.service.d.ts.map +1 -0
- package/dist/services/workspace-git-watcher.service.js +413 -0
- package/dist/services/workspace-git-watcher.service.js.map +1 -0
- package/dist/services/workspace.service.d.ts +99 -108
- package/dist/services/workspace.service.d.ts.map +1 -1
- package/dist/services/workspace.service.js +43 -6
- package/dist/services/workspace.service.js.map +1 -1
- package/dist/socket/events.d.ts +1 -1
- package/dist/socket/events.d.ts.map +1 -1
- package/dist/socket/events.js.map +1 -1
- package/dist/socket/index.d.ts.map +1 -1
- package/dist/socket/index.js +12 -0
- package/dist/socket/index.js.map +1 -1
- package/dist/socket/socket-gateway.d.ts.map +1 -1
- package/dist/socket/socket-gateway.js +5 -1
- package/dist/socket/socket-gateway.js.map +1 -1
- package/dist/web/assets/AgentDemoPage-BIMA7LtG.js +1 -0
- package/dist/web/assets/{DemoPage-PD8AX5pI.js → DemoPage-Ck0jATn9.js} +3 -3
- package/dist/web/assets/GeneralSettingsPage-C5KUTpFg.js +1 -0
- package/dist/web/assets/{MemberAvatar-BDXmryjB.js → MemberAvatar-CKkPlE4w.js} +1 -1
- package/dist/web/assets/NotificationSettingsPage-Dl2nJ6Kj.js +1 -0
- package/dist/web/assets/ProfileSettingsPage-D_YQBJqm.js +3 -0
- package/dist/web/assets/ProjectKanbanPage-D2_609qP.js +89 -0
- package/dist/web/assets/ProjectSettingsPage-DpewUnnG.js +2 -0
- package/dist/web/assets/ProviderSettingsPage-BbruFhJJ.js +54 -0
- package/dist/web/assets/SettingsMasterDetail-zGxTmEVL.js +1 -0
- package/dist/web/assets/TeamSettingsPage-B3dBegBu.js +1 -0
- package/dist/web/assets/arrow-left-DTTqavaj.js +1 -0
- package/dist/web/assets/check-N8co_7vS.js +1 -0
- package/dist/web/assets/chevron-down-CXD7aP1s.js +1 -0
- package/dist/web/assets/chevron-right-DSp9sZpx.js +1 -0
- package/dist/web/assets/{chevron-up-BEHjZ-SB.js → chevron-up-DAXQrjEz.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-6FHTyCN2.js → code-block-OCS4YCEC-Cwwrn6vr.js} +1 -1
- package/dist/web/assets/{confirm-dialog-B_wk_zqm.js → confirm-dialog-DnHo_qsz.js} +1 -1
- package/dist/web/assets/folder-picker-TUuS8jPV.js +1 -0
- package/dist/web/assets/index-JZcaQb4r.css +1 -0
- package/dist/web/assets/index-X6FFd4Oy.js +13 -0
- package/dist/web/assets/input-CWSScfQB.js +1 -0
- package/dist/web/assets/layers-DMovMRW4.js +1 -0
- package/dist/web/assets/loader-circle-CvnvXNY6.js +1 -0
- package/dist/web/assets/{mermaid-NOHMQCX5-fubZbKyF.js → mermaid-NOHMQCX5-CmO9pIR-.js} +4 -4
- package/dist/web/assets/message-square-tazyMedo.js +1 -0
- package/dist/web/assets/modal-D9LZcnXe.js +1 -0
- package/dist/web/assets/{pencil-uRBgB4qA.js → pencil-Cfcl8xtO.js} +1 -1
- package/dist/web/assets/rotate-ccw-BCxAIasK.js +1 -0
- package/dist/web/assets/{select-BMlH2AuL.js → select-wCJbdjbF.js} +1 -1
- package/dist/web/assets/switch-BpVaaZIq.js +1 -0
- package/dist/web/assets/textarea-CqAqQ-DJ.js +1 -0
- package/dist/web/assets/{upload-B-Mpvu9j.js → upload-Doc6mqhw.js} +1 -1
- package/dist/web/assets/{use-profiles-D6cZwU1R.js → use-profiles-CLbwBXdL.js} +1 -1
- package/dist/web/assets/{use-providers-DVP6emIi.js → use-providers-C8Rfahov.js} +1 -1
- package/dist/web/favicon.ico +0 -0
- package/dist/web/index.html +4 -4
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +10 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/socket/events.js +1 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.d.ts +21 -0
- package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
- package/node_modules/@prisma/client/.prisma/client/edge.js +2 -2
- package/node_modules/@prisma/client/.prisma/client/index.js +2 -2
- package/package.json +1 -1
- package/dist/web/assets/AgentDemoPage-Co63rtls.js +0 -1
- package/dist/web/assets/GeneralSettingsPage-C5eiEeTZ.js +0 -1
- package/dist/web/assets/NotificationSettingsPage-BjjPan2M.js +0 -1
- package/dist/web/assets/ProfileSettingsPage-BRpeNq6u.js +0 -3
- package/dist/web/assets/ProjectKanbanPage-DUUu2EYy.js +0 -89
- package/dist/web/assets/ProjectSettingsPage-avctMKfk.js +0 -2
- package/dist/web/assets/ProviderSettingsPage-BIUYN2e0.js +0 -54
- package/dist/web/assets/SettingsSection-pLJ3msrT.js +0 -1
- package/dist/web/assets/TeamSettingsPage-BjKW9nT8.js +0 -1
- package/dist/web/assets/arrow-left-lFz8nyZM.js +0 -1
- package/dist/web/assets/button-BUA8P726.js +0 -1
- package/dist/web/assets/check-BYuuXc71.js +0 -1
- package/dist/web/assets/chevron-down-B931AgE2.js +0 -1
- package/dist/web/assets/chevron-right-F9i4wey6.js +0 -1
- package/dist/web/assets/circle-check-C7xXtl8B.js +0 -1
- package/dist/web/assets/folder-picker-BEHS3b2Q.js +0 -1
- package/dist/web/assets/index-DEQhT5sD.css +0 -1
- package/dist/web/assets/index-RxbHMWXV.js +0 -13
- package/dist/web/assets/loader-circle-stJcjnm-.js +0 -1
- package/dist/web/assets/message-square-C8lb-TDo.js +0 -1
- package/dist/web/assets/modal-UGrjU63G.js +0 -1
- package/dist/web/assets/rotate-ccw-CWaMrTz4.js +0 -1
|
@@ -20,64 +20,65 @@ export declare class WorkspaceService {
|
|
|
20
20
|
private static readonly dedicatedWorkspaceClaims;
|
|
21
21
|
private sessionService;
|
|
22
22
|
private eventBus;
|
|
23
|
+
private workspaceGitWatcher;
|
|
23
24
|
constructor(lockService?: TeamLockService);
|
|
25
|
+
private refreshGitWatcher;
|
|
26
|
+
private unwatchGitWorkspace;
|
|
24
27
|
private getBaseBranch;
|
|
25
28
|
findById(id: string): Promise<({
|
|
26
29
|
task: {
|
|
27
30
|
project: {
|
|
31
|
+
id: string;
|
|
28
32
|
name: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
description: string | null;
|
|
35
|
+
updatedAt: Date;
|
|
29
36
|
repoDeletedAt: Date | null;
|
|
30
37
|
archivedAt: Date | null;
|
|
31
|
-
repoRemoteUrl: string | null;
|
|
32
|
-
id: string;
|
|
33
|
-
description: string | null;
|
|
34
38
|
repoPath: string;
|
|
39
|
+
repoRemoteUrl: string | null;
|
|
35
40
|
mainBranch: string;
|
|
36
41
|
copyFiles: string | null;
|
|
37
42
|
setupScript: string | null;
|
|
38
43
|
quickCommands: string | null;
|
|
39
|
-
createdAt: Date;
|
|
40
|
-
updatedAt: Date;
|
|
41
44
|
};
|
|
42
45
|
} & {
|
|
43
46
|
id: string;
|
|
44
|
-
description: string | null;
|
|
45
47
|
createdAt: Date;
|
|
46
|
-
updatedAt: Date;
|
|
47
|
-
deletedAt: Date | null;
|
|
48
|
-
title: string;
|
|
49
48
|
status: string;
|
|
49
|
+
description: string | null;
|
|
50
50
|
priority: number;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
title: string;
|
|
51
53
|
position: number;
|
|
52
54
|
projectId: string;
|
|
55
|
+
deletedAt: Date | null;
|
|
53
56
|
};
|
|
54
57
|
sessions: {
|
|
58
|
+
agentType: string;
|
|
55
59
|
id: string;
|
|
56
60
|
createdAt: Date;
|
|
57
|
-
updatedAt: Date;
|
|
58
61
|
status: string;
|
|
62
|
+
updatedAt: Date;
|
|
59
63
|
workspaceId: string;
|
|
60
|
-
agentType: string;
|
|
61
64
|
variant: string;
|
|
62
65
|
providerId: string | null;
|
|
63
|
-
prompt: string;
|
|
64
66
|
purpose: string;
|
|
65
|
-
logSnapshot: string | null;
|
|
66
67
|
tokenUsage: string | null;
|
|
67
68
|
}[];
|
|
68
69
|
} & {
|
|
69
70
|
id: string;
|
|
70
71
|
createdAt: Date;
|
|
71
|
-
updatedAt: Date;
|
|
72
72
|
status: string;
|
|
73
73
|
taskId: string;
|
|
74
|
+
updatedAt: Date;
|
|
75
|
+
branchName: string;
|
|
76
|
+
worktreePath: string;
|
|
77
|
+
workingDir: string;
|
|
74
78
|
parentWorkspaceId: string | null;
|
|
75
79
|
ownerMemberId: string | null;
|
|
76
|
-
branchName: string;
|
|
77
80
|
baseBranch: string | null;
|
|
78
|
-
worktreePath: string;
|
|
79
81
|
workspaceKind: string;
|
|
80
|
-
workingDir: string;
|
|
81
82
|
commitMessage: string | null;
|
|
82
83
|
previewTarget: string | null;
|
|
83
84
|
hibernatedAt: Date | null;
|
|
@@ -87,32 +88,30 @@ export declare class WorkspaceService {
|
|
|
87
88
|
*/
|
|
88
89
|
findByTaskId(taskId: string): Promise<({
|
|
89
90
|
sessions: {
|
|
91
|
+
agentType: string;
|
|
90
92
|
id: string;
|
|
91
93
|
createdAt: Date;
|
|
92
|
-
updatedAt: Date;
|
|
93
94
|
status: string;
|
|
95
|
+
updatedAt: Date;
|
|
94
96
|
workspaceId: string;
|
|
95
|
-
agentType: string;
|
|
96
97
|
variant: string;
|
|
97
98
|
providerId: string | null;
|
|
98
|
-
prompt: string;
|
|
99
99
|
purpose: string;
|
|
100
|
-
logSnapshot: string | null;
|
|
101
100
|
tokenUsage: string | null;
|
|
102
101
|
}[];
|
|
103
102
|
} & {
|
|
104
103
|
id: string;
|
|
105
104
|
createdAt: Date;
|
|
106
|
-
updatedAt: Date;
|
|
107
105
|
status: string;
|
|
108
106
|
taskId: string;
|
|
107
|
+
updatedAt: Date;
|
|
108
|
+
branchName: string;
|
|
109
|
+
worktreePath: string;
|
|
110
|
+
workingDir: string;
|
|
109
111
|
parentWorkspaceId: string | null;
|
|
110
112
|
ownerMemberId: string | null;
|
|
111
|
-
branchName: string;
|
|
112
113
|
baseBranch: string | null;
|
|
113
|
-
worktreePath: string;
|
|
114
114
|
workspaceKind: string;
|
|
115
|
-
workingDir: string;
|
|
116
115
|
commitMessage: string | null;
|
|
117
116
|
previewTarget: string | null;
|
|
118
117
|
hibernatedAt: Date | null;
|
|
@@ -129,59 +128,57 @@ export declare class WorkspaceService {
|
|
|
129
128
|
create(taskId: string, branchNameOrOptions?: string | CreateWorkspaceOptions): Promise<{
|
|
130
129
|
task: {
|
|
131
130
|
project: {
|
|
131
|
+
id: string;
|
|
132
132
|
name: string;
|
|
133
|
+
createdAt: Date;
|
|
134
|
+
description: string | null;
|
|
135
|
+
updatedAt: Date;
|
|
133
136
|
repoDeletedAt: Date | null;
|
|
134
137
|
archivedAt: Date | null;
|
|
135
|
-
repoRemoteUrl: string | null;
|
|
136
|
-
id: string;
|
|
137
|
-
description: string | null;
|
|
138
138
|
repoPath: string;
|
|
139
|
+
repoRemoteUrl: string | null;
|
|
139
140
|
mainBranch: string;
|
|
140
141
|
copyFiles: string | null;
|
|
141
142
|
setupScript: string | null;
|
|
142
143
|
quickCommands: string | null;
|
|
143
|
-
createdAt: Date;
|
|
144
|
-
updatedAt: Date;
|
|
145
144
|
};
|
|
146
145
|
} & {
|
|
147
146
|
id: string;
|
|
148
|
-
description: string | null;
|
|
149
147
|
createdAt: Date;
|
|
150
|
-
updatedAt: Date;
|
|
151
|
-
deletedAt: Date | null;
|
|
152
|
-
title: string;
|
|
153
148
|
status: string;
|
|
149
|
+
description: string | null;
|
|
154
150
|
priority: number;
|
|
151
|
+
updatedAt: Date;
|
|
152
|
+
title: string;
|
|
155
153
|
position: number;
|
|
156
154
|
projectId: string;
|
|
155
|
+
deletedAt: Date | null;
|
|
157
156
|
};
|
|
158
157
|
sessions: {
|
|
158
|
+
agentType: string;
|
|
159
159
|
id: string;
|
|
160
160
|
createdAt: Date;
|
|
161
|
-
updatedAt: Date;
|
|
162
161
|
status: string;
|
|
162
|
+
updatedAt: Date;
|
|
163
163
|
workspaceId: string;
|
|
164
|
-
agentType: string;
|
|
165
164
|
variant: string;
|
|
166
165
|
providerId: string | null;
|
|
167
|
-
prompt: string;
|
|
168
166
|
purpose: string;
|
|
169
|
-
logSnapshot: string | null;
|
|
170
167
|
tokenUsage: string | null;
|
|
171
168
|
}[];
|
|
172
169
|
} & {
|
|
173
170
|
id: string;
|
|
174
171
|
createdAt: Date;
|
|
175
|
-
updatedAt: Date;
|
|
176
172
|
status: string;
|
|
177
173
|
taskId: string;
|
|
174
|
+
updatedAt: Date;
|
|
175
|
+
branchName: string;
|
|
176
|
+
worktreePath: string;
|
|
177
|
+
workingDir: string;
|
|
178
178
|
parentWorkspaceId: string | null;
|
|
179
179
|
ownerMemberId: string | null;
|
|
180
|
-
branchName: string;
|
|
181
180
|
baseBranch: string | null;
|
|
182
|
-
worktreePath: string;
|
|
183
181
|
workspaceKind: string;
|
|
184
|
-
workingDir: string;
|
|
185
182
|
commitMessage: string | null;
|
|
186
183
|
previewTarget: string | null;
|
|
187
184
|
hibernatedAt: Date | null;
|
|
@@ -190,59 +187,57 @@ export declare class WorkspaceService {
|
|
|
190
187
|
getOrCreateMainWorkspace(teamRunId: string): Promise<{
|
|
191
188
|
task: {
|
|
192
189
|
project: {
|
|
190
|
+
id: string;
|
|
193
191
|
name: string;
|
|
192
|
+
createdAt: Date;
|
|
193
|
+
description: string | null;
|
|
194
|
+
updatedAt: Date;
|
|
194
195
|
repoDeletedAt: Date | null;
|
|
195
196
|
archivedAt: Date | null;
|
|
196
|
-
repoRemoteUrl: string | null;
|
|
197
|
-
id: string;
|
|
198
|
-
description: string | null;
|
|
199
197
|
repoPath: string;
|
|
198
|
+
repoRemoteUrl: string | null;
|
|
200
199
|
mainBranch: string;
|
|
201
200
|
copyFiles: string | null;
|
|
202
201
|
setupScript: string | null;
|
|
203
202
|
quickCommands: string | null;
|
|
204
|
-
createdAt: Date;
|
|
205
|
-
updatedAt: Date;
|
|
206
203
|
};
|
|
207
204
|
} & {
|
|
208
205
|
id: string;
|
|
209
|
-
description: string | null;
|
|
210
206
|
createdAt: Date;
|
|
211
|
-
updatedAt: Date;
|
|
212
|
-
deletedAt: Date | null;
|
|
213
|
-
title: string;
|
|
214
207
|
status: string;
|
|
208
|
+
description: string | null;
|
|
215
209
|
priority: number;
|
|
210
|
+
updatedAt: Date;
|
|
211
|
+
title: string;
|
|
216
212
|
position: number;
|
|
217
213
|
projectId: string;
|
|
214
|
+
deletedAt: Date | null;
|
|
218
215
|
};
|
|
219
216
|
sessions: {
|
|
217
|
+
agentType: string;
|
|
220
218
|
id: string;
|
|
221
219
|
createdAt: Date;
|
|
222
|
-
updatedAt: Date;
|
|
223
220
|
status: string;
|
|
221
|
+
updatedAt: Date;
|
|
224
222
|
workspaceId: string;
|
|
225
|
-
agentType: string;
|
|
226
223
|
variant: string;
|
|
227
224
|
providerId: string | null;
|
|
228
|
-
prompt: string;
|
|
229
225
|
purpose: string;
|
|
230
|
-
logSnapshot: string | null;
|
|
231
226
|
tokenUsage: string | null;
|
|
232
227
|
}[];
|
|
233
228
|
} & {
|
|
234
229
|
id: string;
|
|
235
230
|
createdAt: Date;
|
|
236
|
-
updatedAt: Date;
|
|
237
231
|
status: string;
|
|
238
232
|
taskId: string;
|
|
233
|
+
updatedAt: Date;
|
|
234
|
+
branchName: string;
|
|
235
|
+
worktreePath: string;
|
|
236
|
+
workingDir: string;
|
|
239
237
|
parentWorkspaceId: string | null;
|
|
240
238
|
ownerMemberId: string | null;
|
|
241
|
-
branchName: string;
|
|
242
239
|
baseBranch: string | null;
|
|
243
|
-
worktreePath: string;
|
|
244
240
|
workspaceKind: string;
|
|
245
|
-
workingDir: string;
|
|
246
241
|
commitMessage: string | null;
|
|
247
242
|
previewTarget: string | null;
|
|
248
243
|
hibernatedAt: Date | null;
|
|
@@ -250,59 +245,57 @@ export declare class WorkspaceService {
|
|
|
250
245
|
getOrCreateDedicatedWorkspace(teamRunId: string, memberId: string): Promise<{
|
|
251
246
|
task: {
|
|
252
247
|
project: {
|
|
248
|
+
id: string;
|
|
253
249
|
name: string;
|
|
250
|
+
createdAt: Date;
|
|
251
|
+
description: string | null;
|
|
252
|
+
updatedAt: Date;
|
|
254
253
|
repoDeletedAt: Date | null;
|
|
255
254
|
archivedAt: Date | null;
|
|
256
|
-
repoRemoteUrl: string | null;
|
|
257
|
-
id: string;
|
|
258
|
-
description: string | null;
|
|
259
255
|
repoPath: string;
|
|
256
|
+
repoRemoteUrl: string | null;
|
|
260
257
|
mainBranch: string;
|
|
261
258
|
copyFiles: string | null;
|
|
262
259
|
setupScript: string | null;
|
|
263
260
|
quickCommands: string | null;
|
|
264
|
-
createdAt: Date;
|
|
265
|
-
updatedAt: Date;
|
|
266
261
|
};
|
|
267
262
|
} & {
|
|
268
263
|
id: string;
|
|
269
|
-
description: string | null;
|
|
270
264
|
createdAt: Date;
|
|
271
|
-
updatedAt: Date;
|
|
272
|
-
deletedAt: Date | null;
|
|
273
|
-
title: string;
|
|
274
265
|
status: string;
|
|
266
|
+
description: string | null;
|
|
275
267
|
priority: number;
|
|
268
|
+
updatedAt: Date;
|
|
269
|
+
title: string;
|
|
276
270
|
position: number;
|
|
277
271
|
projectId: string;
|
|
272
|
+
deletedAt: Date | null;
|
|
278
273
|
};
|
|
279
274
|
sessions: {
|
|
275
|
+
agentType: string;
|
|
280
276
|
id: string;
|
|
281
277
|
createdAt: Date;
|
|
282
|
-
updatedAt: Date;
|
|
283
278
|
status: string;
|
|
279
|
+
updatedAt: Date;
|
|
284
280
|
workspaceId: string;
|
|
285
|
-
agentType: string;
|
|
286
281
|
variant: string;
|
|
287
282
|
providerId: string | null;
|
|
288
|
-
prompt: string;
|
|
289
283
|
purpose: string;
|
|
290
|
-
logSnapshot: string | null;
|
|
291
284
|
tokenUsage: string | null;
|
|
292
285
|
}[];
|
|
293
286
|
} & {
|
|
294
287
|
id: string;
|
|
295
288
|
createdAt: Date;
|
|
296
|
-
updatedAt: Date;
|
|
297
289
|
status: string;
|
|
298
290
|
taskId: string;
|
|
291
|
+
updatedAt: Date;
|
|
292
|
+
branchName: string;
|
|
293
|
+
worktreePath: string;
|
|
294
|
+
workingDir: string;
|
|
299
295
|
parentWorkspaceId: string | null;
|
|
300
296
|
ownerMemberId: string | null;
|
|
301
|
-
branchName: string;
|
|
302
297
|
baseBranch: string | null;
|
|
303
|
-
worktreePath: string;
|
|
304
298
|
workspaceKind: string;
|
|
305
|
-
workingDir: string;
|
|
306
299
|
commitMessage: string | null;
|
|
307
300
|
previewTarget: string | null;
|
|
308
301
|
hibernatedAt: Date | null;
|
|
@@ -350,39 +343,39 @@ export declare class WorkspaceService {
|
|
|
350
343
|
archive(id: string): Promise<{
|
|
351
344
|
task: {
|
|
352
345
|
project: {
|
|
346
|
+
id: string;
|
|
353
347
|
name: string;
|
|
348
|
+
createdAt: Date;
|
|
349
|
+
description: string | null;
|
|
350
|
+
updatedAt: Date;
|
|
354
351
|
repoDeletedAt: Date | null;
|
|
355
352
|
archivedAt: Date | null;
|
|
356
|
-
repoRemoteUrl: string | null;
|
|
357
|
-
id: string;
|
|
358
|
-
description: string | null;
|
|
359
353
|
repoPath: string;
|
|
354
|
+
repoRemoteUrl: string | null;
|
|
360
355
|
mainBranch: string;
|
|
361
356
|
copyFiles: string | null;
|
|
362
357
|
setupScript: string | null;
|
|
363
358
|
quickCommands: string | null;
|
|
364
|
-
createdAt: Date;
|
|
365
|
-
updatedAt: Date;
|
|
366
359
|
};
|
|
367
360
|
} & {
|
|
368
361
|
id: string;
|
|
369
|
-
description: string | null;
|
|
370
362
|
createdAt: Date;
|
|
371
|
-
updatedAt: Date;
|
|
372
|
-
deletedAt: Date | null;
|
|
373
|
-
title: string;
|
|
374
363
|
status: string;
|
|
364
|
+
description: string | null;
|
|
375
365
|
priority: number;
|
|
366
|
+
updatedAt: Date;
|
|
367
|
+
title: string;
|
|
376
368
|
position: number;
|
|
377
369
|
projectId: string;
|
|
370
|
+
deletedAt: Date | null;
|
|
378
371
|
};
|
|
379
372
|
sessions: {
|
|
373
|
+
agentType: string;
|
|
380
374
|
id: string;
|
|
381
375
|
createdAt: Date;
|
|
382
|
-
updatedAt: Date;
|
|
383
376
|
status: string;
|
|
377
|
+
updatedAt: Date;
|
|
384
378
|
workspaceId: string;
|
|
385
|
-
agentType: string;
|
|
386
379
|
variant: string;
|
|
387
380
|
providerId: string | null;
|
|
388
381
|
prompt: string;
|
|
@@ -393,16 +386,16 @@ export declare class WorkspaceService {
|
|
|
393
386
|
} & {
|
|
394
387
|
id: string;
|
|
395
388
|
createdAt: Date;
|
|
396
|
-
updatedAt: Date;
|
|
397
389
|
status: string;
|
|
398
390
|
taskId: string;
|
|
391
|
+
updatedAt: Date;
|
|
392
|
+
branchName: string;
|
|
393
|
+
worktreePath: string;
|
|
394
|
+
workingDir: string;
|
|
399
395
|
parentWorkspaceId: string | null;
|
|
400
396
|
ownerMemberId: string | null;
|
|
401
|
-
branchName: string;
|
|
402
397
|
baseBranch: string | null;
|
|
403
|
-
worktreePath: string;
|
|
404
398
|
workspaceKind: string;
|
|
405
|
-
workingDir: string;
|
|
406
399
|
commitMessage: string | null;
|
|
407
400
|
previewTarget: string | null;
|
|
408
401
|
hibernatedAt: Date | null;
|
|
@@ -418,59 +411,57 @@ export declare class WorkspaceService {
|
|
|
418
411
|
reactivate(id: string): Promise<{
|
|
419
412
|
task: {
|
|
420
413
|
project: {
|
|
414
|
+
id: string;
|
|
421
415
|
name: string;
|
|
416
|
+
createdAt: Date;
|
|
417
|
+
description: string | null;
|
|
418
|
+
updatedAt: Date;
|
|
422
419
|
repoDeletedAt: Date | null;
|
|
423
420
|
archivedAt: Date | null;
|
|
424
|
-
repoRemoteUrl: string | null;
|
|
425
|
-
id: string;
|
|
426
|
-
description: string | null;
|
|
427
421
|
repoPath: string;
|
|
422
|
+
repoRemoteUrl: string | null;
|
|
428
423
|
mainBranch: string;
|
|
429
424
|
copyFiles: string | null;
|
|
430
425
|
setupScript: string | null;
|
|
431
426
|
quickCommands: string | null;
|
|
432
|
-
createdAt: Date;
|
|
433
|
-
updatedAt: Date;
|
|
434
427
|
};
|
|
435
428
|
} & {
|
|
436
429
|
id: string;
|
|
437
|
-
description: string | null;
|
|
438
430
|
createdAt: Date;
|
|
439
|
-
updatedAt: Date;
|
|
440
|
-
deletedAt: Date | null;
|
|
441
|
-
title: string;
|
|
442
431
|
status: string;
|
|
432
|
+
description: string | null;
|
|
443
433
|
priority: number;
|
|
434
|
+
updatedAt: Date;
|
|
435
|
+
title: string;
|
|
444
436
|
position: number;
|
|
445
437
|
projectId: string;
|
|
438
|
+
deletedAt: Date | null;
|
|
446
439
|
};
|
|
447
440
|
sessions: {
|
|
441
|
+
agentType: string;
|
|
448
442
|
id: string;
|
|
449
443
|
createdAt: Date;
|
|
450
|
-
updatedAt: Date;
|
|
451
444
|
status: string;
|
|
445
|
+
updatedAt: Date;
|
|
452
446
|
workspaceId: string;
|
|
453
|
-
agentType: string;
|
|
454
447
|
variant: string;
|
|
455
448
|
providerId: string | null;
|
|
456
|
-
prompt: string;
|
|
457
449
|
purpose: string;
|
|
458
|
-
logSnapshot: string | null;
|
|
459
450
|
tokenUsage: string | null;
|
|
460
451
|
}[];
|
|
461
452
|
} & {
|
|
462
453
|
id: string;
|
|
463
454
|
createdAt: Date;
|
|
464
|
-
updatedAt: Date;
|
|
465
455
|
status: string;
|
|
466
456
|
taskId: string;
|
|
457
|
+
updatedAt: Date;
|
|
458
|
+
branchName: string;
|
|
459
|
+
worktreePath: string;
|
|
460
|
+
workingDir: string;
|
|
467
461
|
parentWorkspaceId: string | null;
|
|
468
462
|
ownerMemberId: string | null;
|
|
469
|
-
branchName: string;
|
|
470
463
|
baseBranch: string | null;
|
|
471
|
-
worktreePath: string;
|
|
472
464
|
workspaceKind: string;
|
|
473
|
-
workingDir: string;
|
|
474
465
|
commitMessage: string | null;
|
|
475
466
|
previewTarget: string | null;
|
|
476
467
|
hibernatedAt: Date | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.service.d.ts","sourceRoot":"","sources":["../../src/services/workspace.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA8D,MAAM,mBAAmB,CAAC;AAM9G,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace.service.d.ts","sourceRoot":"","sources":["../../src/services/workspace.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,7 +3,7 @@ import { WorkspaceKind, WorkspaceStatus, TaskStatus, SessionStatus, SessionPurpo
|
|
|
3
3
|
import { WorktreeManager } from '../git/worktree.manager.js';
|
|
4
4
|
import { execGit, MergeConflictError } from '../git/git-cli.js';
|
|
5
5
|
import { NotFoundError, ServiceError } from '../errors.js';
|
|
6
|
-
import { getSessionManager, getEventBus } from '../core/container.js';
|
|
6
|
+
import { getSessionManager, getEventBus, getWorkspaceGitWatcherService } from '../core/container.js';
|
|
7
7
|
import { copyProjectFiles } from './copy-files.service.js';
|
|
8
8
|
import { defaultTeamLockService } from './team-lock.service.js';
|
|
9
9
|
import { exec } from 'node:child_process';
|
|
@@ -18,8 +18,22 @@ const DEFAULT_IDLE_THRESHOLD_HOURS = 24;
|
|
|
18
18
|
const WORKSPACE_READY_RETRY_COUNT = 20;
|
|
19
19
|
const WORKSPACE_READY_RETRY_DELAY_MS = 50;
|
|
20
20
|
const execAsync = promisify(exec);
|
|
21
|
-
/** 过滤条件:只返回用户可见的 CHAT session */
|
|
22
|
-
const visibleSessionsFilter = {
|
|
21
|
+
/** 过滤条件:只返回用户可见的 CHAT session,且不在 workspace 热路径携带 prompt/logSnapshot。 */
|
|
22
|
+
const visibleSessionsFilter = {
|
|
23
|
+
where: { purpose: { not: SessionPurpose.COMMIT_MSG } },
|
|
24
|
+
select: {
|
|
25
|
+
id: true,
|
|
26
|
+
workspaceId: true,
|
|
27
|
+
agentType: true,
|
|
28
|
+
variant: true,
|
|
29
|
+
providerId: true,
|
|
30
|
+
status: true,
|
|
31
|
+
purpose: true,
|
|
32
|
+
tokenUsage: true,
|
|
33
|
+
createdAt: true,
|
|
34
|
+
updatedAt: true,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
23
37
|
const activeSessionStatuses = [SessionStatus.PENDING, SessionStatus.RUNNING];
|
|
24
38
|
const finalChildWorkspaceStatuses = [WorkspaceStatus.MERGED, WorkspaceStatus.ABANDONED];
|
|
25
39
|
function normalizeCreateOptions(input) {
|
|
@@ -83,9 +97,18 @@ export class WorkspaceService {
|
|
|
83
97
|
static dedicatedWorkspaceClaims = new Map();
|
|
84
98
|
sessionService = getSessionManager();
|
|
85
99
|
eventBus = getEventBus();
|
|
100
|
+
workspaceGitWatcher = getWorkspaceGitWatcherService();
|
|
86
101
|
constructor(lockService = defaultTeamLockService) {
|
|
87
102
|
this.lockService = lockService;
|
|
88
103
|
}
|
|
104
|
+
refreshGitWatcher(workspaceId) {
|
|
105
|
+
this.workspaceGitWatcher.refreshWorkspace(workspaceId).catch((error) => {
|
|
106
|
+
console.warn(`[WorkspaceService] failed to refresh git watcher for workspace ${workspaceId}:`, error instanceof Error ? error.message : error);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
unwatchGitWorkspace(workspaceId) {
|
|
110
|
+
this.workspaceGitWatcher.unwatchWorkspace(workspaceId);
|
|
111
|
+
}
|
|
89
112
|
getBaseBranch(workspace) {
|
|
90
113
|
return workspace.baseBranch || workspace.task.project.mainBranch;
|
|
91
114
|
}
|
|
@@ -213,6 +236,7 @@ export class WorkspaceService {
|
|
|
213
236
|
where: { id: workspace.id },
|
|
214
237
|
include: { sessions: true, task: { include: { project: true } } },
|
|
215
238
|
});
|
|
239
|
+
this.refreshGitWatcher(updated.id);
|
|
216
240
|
return updated;
|
|
217
241
|
}
|
|
218
242
|
catch (err) {
|
|
@@ -434,10 +458,12 @@ export class WorkspaceService {
|
|
|
434
458
|
.then(() => true)
|
|
435
459
|
.catch(() => false);
|
|
436
460
|
if (gitFileExists) {
|
|
437
|
-
|
|
461
|
+
const active = await prisma.workspace.findUniqueOrThrow({
|
|
438
462
|
where: { id: workspace.id },
|
|
439
463
|
include: { sessions: visibleSessionsFilter, task: { include: { project: true } } },
|
|
440
464
|
});
|
|
465
|
+
this.refreshGitWatcher(active.id);
|
|
466
|
+
return active;
|
|
441
467
|
}
|
|
442
468
|
}
|
|
443
469
|
return this.restoreInactiveWorkspace(workspace);
|
|
@@ -462,10 +488,12 @@ export class WorkspaceService {
|
|
|
462
488
|
}
|
|
463
489
|
this.runCopyFiles(workspace.task.project.repoPath, worktreePath, workspace.task.project.copyFiles);
|
|
464
490
|
this.fireSetupScript(workspace.id, workspace.taskId, worktreePath, workspace.task.project.setupScript);
|
|
465
|
-
|
|
491
|
+
const restored = await prisma.workspace.findUniqueOrThrow({
|
|
466
492
|
where: { id: workspace.id },
|
|
467
493
|
include: { sessions: visibleSessionsFilter, task: { include: { project: true } } },
|
|
468
494
|
});
|
|
495
|
+
this.refreshGitWatcher(restored.id);
|
|
496
|
+
return restored;
|
|
469
497
|
}
|
|
470
498
|
// ── Delete ───────────────────────────────────────────────────────────────────
|
|
471
499
|
/**
|
|
@@ -498,6 +526,7 @@ export class WorkspaceService {
|
|
|
498
526
|
// 忽略停止失败
|
|
499
527
|
}
|
|
500
528
|
}
|
|
529
|
+
this.unwatchGitWorkspace(id);
|
|
501
530
|
if (isWorktreeWorkspace(workspace) && workspace.worktreePath) {
|
|
502
531
|
// 清理 worktree
|
|
503
532
|
try {
|
|
@@ -638,6 +667,8 @@ export class WorkspaceService {
|
|
|
638
667
|
where: { id: workspace.id },
|
|
639
668
|
data: { status: WorkspaceStatus.MERGED },
|
|
640
669
|
});
|
|
670
|
+
this.unwatchGitWorkspace(workspace.id);
|
|
671
|
+
this.refreshGitWatcher(parentWorkspace.id);
|
|
641
672
|
return sha;
|
|
642
673
|
}
|
|
643
674
|
async mergeRootWorkspaceToMain(workspace, commitMessage) {
|
|
@@ -662,6 +693,7 @@ export class WorkspaceService {
|
|
|
662
693
|
where: { id: workspace.id },
|
|
663
694
|
data: { status: WorkspaceStatus.MERGED },
|
|
664
695
|
});
|
|
696
|
+
this.unwatchGitWorkspace(workspace.id);
|
|
665
697
|
const advanceableStatuses = [TaskStatus.IN_PROGRESS, TaskStatus.IN_REVIEW];
|
|
666
698
|
if (advanceableStatuses.includes(workspace.task.status)) {
|
|
667
699
|
await prisma.task.update({
|
|
@@ -751,11 +783,13 @@ export class WorkspaceService {
|
|
|
751
783
|
// 忽略停止失败
|
|
752
784
|
}
|
|
753
785
|
}
|
|
754
|
-
|
|
786
|
+
const archived = await prisma.workspace.update({
|
|
755
787
|
where: { id },
|
|
756
788
|
data: { status: WorkspaceStatus.ABANDONED },
|
|
757
789
|
include: { sessions: true, task: { include: { project: true } } },
|
|
758
790
|
});
|
|
791
|
+
this.unwatchGitWorkspace(id);
|
|
792
|
+
return archived;
|
|
759
793
|
}
|
|
760
794
|
// ── Hibernate / Reactivate ───────────────────────────────────────────────────
|
|
761
795
|
/**
|
|
@@ -781,6 +815,7 @@ export class WorkspaceService {
|
|
|
781
815
|
if (hasActiveSessions) {
|
|
782
816
|
throw new ServiceError('Cannot hibernate workspace with active sessions', 'WORKSPACE_HAS_ACTIVE_SESSIONS', 409);
|
|
783
817
|
}
|
|
818
|
+
this.unwatchGitWorkspace(id);
|
|
784
819
|
// Auto-commit any dirty changes before removing worktree
|
|
785
820
|
if (workspace.worktreePath) {
|
|
786
821
|
const worktreeExists = await fs.access(workspace.worktreePath).then(() => true).catch(() => false);
|
|
@@ -848,6 +883,7 @@ export class WorkspaceService {
|
|
|
848
883
|
where: { id },
|
|
849
884
|
include: { sessions: visibleSessionsFilter, task: { include: { project: true } } },
|
|
850
885
|
});
|
|
886
|
+
this.refreshGitWatcher(updated.id);
|
|
851
887
|
console.log(`[WorkspaceService] Workspace ${id} reactivated at ${worktreePath}`);
|
|
852
888
|
return updated;
|
|
853
889
|
}
|
|
@@ -953,6 +989,7 @@ export class WorkspaceService {
|
|
|
953
989
|
let cleaned = 0;
|
|
954
990
|
for (const workspace of workspaces) {
|
|
955
991
|
try {
|
|
992
|
+
this.unwatchGitWorkspace(workspace.id);
|
|
956
993
|
if (isMainDirectoryWorkspace(workspace)) {
|
|
957
994
|
await prisma.workspace.delete({ where: { id: workspace.id } });
|
|
958
995
|
cleaned++;
|