-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcontracts.ts
More file actions
344 lines (298 loc) · 9.07 KB
/
contracts.ts
File metadata and controls
344 lines (298 loc) · 9.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
export type ProjectStatus = "running" | "stopped" | "unknown"
export type AgentProvider = "codex" | "opencode" | "claude" | "custom"
export type AgentStatus = "starting" | "running" | "stopping" | "stopped" | "exited" | "failed"
export type ProjectSummary = {
readonly id: string
readonly displayName: string
readonly repoUrl: string
readonly repoRef: string
readonly status: ProjectStatus
readonly statusLabel: string
}
export type ProjectDetails = ProjectSummary & {
readonly containerName: string
readonly serviceName: string
readonly sshUser: string
readonly sshPort: number
readonly targetDir: string
readonly projectDir: string
readonly sshCommand: string
readonly envGlobalPath: string
readonly envProjectPath: string
readonly codexAuthPath: string
readonly codexHome: string
}
export type CreateProjectRequest = {
readonly repoUrl?: string | undefined
readonly repoRef?: string | undefined
readonly targetDir?: string | undefined
readonly sshPort?: string | undefined
readonly sshUser?: string | undefined
readonly containerName?: string | undefined
readonly serviceName?: string | undefined
readonly volumeName?: string | undefined
readonly secretsRoot?: string | undefined
readonly authorizedKeysPath?: string | undefined
readonly envGlobalPath?: string | undefined
readonly envProjectPath?: string | undefined
readonly codexAuthPath?: string | undefined
readonly codexHome?: string | undefined
readonly cpuLimit?: string | undefined
readonly ramLimit?: string | undefined
readonly dockerNetworkMode?: string | undefined
readonly dockerSharedNetworkName?: string | undefined
readonly enableMcpPlaywright?: boolean | undefined
readonly outDir?: string | undefined
readonly gitTokenLabel?: string | undefined
readonly codexTokenLabel?: string | undefined
readonly claudeTokenLabel?: string | undefined
readonly agentAutoMode?: string | undefined
readonly up?: boolean | undefined
readonly openSsh?: boolean | undefined
readonly force?: boolean | undefined
readonly forceEnv?: boolean | undefined
}
export type AgentEnvVar = {
readonly key: string
readonly value: string
}
export type CreateAgentRequest = {
readonly provider: AgentProvider
readonly command?: string | undefined
readonly args?: ReadonlyArray<string> | undefined
readonly cwd?: string | undefined
readonly env?: ReadonlyArray<AgentEnvVar> | undefined
readonly label?: string | undefined
}
export type AgentSession = {
readonly id: string
readonly projectId: string
readonly provider: AgentProvider
readonly label: string
readonly command: string
readonly containerName: string
readonly status: AgentStatus
readonly source: string
readonly pidFile: string
readonly hostPid: number | null
readonly startedAt: string
readonly updatedAt: string
readonly stoppedAt?: string | undefined
readonly exitCode?: number | undefined
readonly signal?: string | undefined
}
export type AgentLogLine = {
readonly at: string
readonly stream: "stdout" | "stderr"
readonly line: string
}
export type AgentAttachInfo = {
readonly projectId: string
readonly agentId: string
readonly containerName: string
readonly pidFile: string
readonly inspectCommand: string
readonly shellCommand: string
}
export type ForgeFedTicket = {
readonly id: string
readonly attributedTo: string
readonly summary: string
readonly content: string
readonly mediaType?: string | undefined
readonly source?: string | undefined
readonly published?: string | undefined
readonly updated?: string | undefined
readonly url?: string | undefined
}
export type FederationIssueStatus = "offered" | "accepted" | "rejected"
export type FederationIssueRecord = {
readonly issueId: string
readonly offerId?: string | undefined
readonly tracker?: string | undefined
readonly status: FederationIssueStatus
readonly receivedAt: string
readonly ticket: ForgeFedTicket
}
export type CreateFollowRequest = {
readonly actor?: string | undefined
readonly object: string
readonly domain?: string | undefined
readonly inbox?: string | undefined
readonly to?: ReadonlyArray<string> | undefined
readonly capability?: string | undefined
}
export type FollowStatus = "pending" | "accepted" | "rejected"
export type ActivityPubFollowActivity = {
readonly "@context": string | ReadonlyArray<string>
readonly id: string
readonly type: "Follow"
readonly actor: string
readonly object: string
readonly to?: ReadonlyArray<string> | undefined
readonly capability?: string | undefined
}
export type ActivityPubPerson = {
readonly "@context": "https://www.w3.org/ns/activitystreams"
readonly type: "Person"
readonly id: string
readonly name: string
readonly preferredUsername: string
readonly summary: string
readonly inbox: string
readonly outbox: string
readonly followers: string
readonly following: string
readonly liked: string
}
export type ActivityPubOrderedCollection = {
readonly "@context": "https://www.w3.org/ns/activitystreams"
readonly type: "OrderedCollection"
readonly id: string
readonly totalItems: number
readonly orderedItems: ReadonlyArray<unknown>
}
export type FollowSubscription = {
readonly id: string
readonly activityId: string
readonly actor: string
readonly object: string
readonly inbox?: string | undefined
readonly to: ReadonlyArray<string>
readonly capability?: string | undefined
status: FollowStatus
readonly createdAt: string
updatedAt: string
readonly activity: ActivityPubFollowActivity
}
export type FollowSubscriptionCreated = {
readonly subscription: FollowSubscription
readonly activity: ActivityPubFollowActivity
}
export type FederationInboxResult =
| {
readonly kind: "issue.offer"
readonly issue: FederationIssueRecord
}
| {
readonly kind: "issue.ticket"
readonly issue: FederationIssueRecord
}
| {
readonly kind: "follow.accept"
readonly subscription: FollowSubscription
}
| {
readonly kind: "follow.reject"
readonly subscription: FollowSubscription
}
export type ApiEventType =
| "snapshot"
| "project.created"
| "project.deleted"
| "project.deployment.status"
| "project.deployment.log"
| "agent.started"
| "agent.output"
| "agent.exited"
| "agent.stopped"
| "agent.error"
export type ApiEvent = {
readonly seq: number
readonly projectId: string
readonly type: ApiEventType
readonly at: string
readonly payload: unknown
}
// Auth
export type AuthStatusResponse = { readonly message: string }
export type AuthGithubLoginRequest = {
readonly label?: string | null | undefined
readonly token?: string | null | undefined
readonly scopes?: string | null | undefined
readonly envGlobalPath: string
}
export type AuthGithubStatusRequest = {
readonly envGlobalPath: string
}
export type AuthGithubLogoutRequest = {
readonly label?: string | null | undefined
readonly envGlobalPath: string
}
export type AuthCodexLoginRequest = {
readonly label?: string | null | undefined
readonly codexAuthPath: string
}
export type AuthCodexStatusRequest = {
readonly label?: string | null | undefined
readonly codexAuthPath: string
}
export type AuthCodexLogoutRequest = {
readonly label?: string | null | undefined
readonly codexAuthPath: string
}
export type AuthClaudeLoginRequest = {
readonly label?: string | null | undefined
readonly claudeAuthPath: string
}
export type AuthClaudeStatusRequest = {
readonly label?: string | null | undefined
readonly claudeAuthPath: string
}
export type AuthClaudeLogoutRequest = {
readonly label?: string | null | undefined
readonly claudeAuthPath: string
}
// State
export type StateInitRequest = {
readonly repoUrl: string
readonly repoRef?: string | undefined
}
export type StateCommitRequest = {
readonly message: string
}
export type StateSyncRequest = {
readonly message?: string | null | undefined
}
export type StatePathResponse = { readonly path: string }
export type StateOutputResponse = { readonly output: string }
// Scrap
export type ScrapExportRequest = {
readonly projectDir: string
readonly archivePath?: string | undefined
}
export type ScrapImportRequest = {
readonly projectDir: string
readonly archivePath: string
readonly wipe?: boolean | undefined
}
// Sessions
export type SessionsListRequest = {
readonly projectDir: string
readonly includeDefault?: boolean | undefined
}
export type SessionsKillRequest = {
readonly projectDir: string
readonly pid: number
}
export type SessionsLogsRequest = {
readonly projectDir: string
readonly pid: number
readonly lines?: number | undefined
}
export type SessionsOutput = { readonly output: string }
// MCP Playwright
export type McpPlaywrightUpRequest = {
readonly projectDir: string
readonly runUp?: boolean | undefined
}
// Apply (project config)
export type ApplyRequest = {
readonly runUp?: boolean | undefined
readonly gitTokenLabel?: string | undefined
readonly codexTokenLabel?: string | undefined
readonly claudeTokenLabel?: string | undefined
readonly cpuLimit?: string | undefined
readonly ramLimit?: string | undefined
readonly enableMcpPlaywright?: boolean | undefined
}