@agimon-ai/po-git 0.0.0-alpha.0 → 0.0.0-stage
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/README.md +2 -82
- package/package.json +3 -132
- package/LICENSE +0 -21
- package/dist/apiContracts.cjs +0 -387
- package/dist/apiContracts.cjs.map +0 -1
- package/dist/apiContracts.d.mts +0 -53
- package/dist/apiContracts.d.mts.map +0 -1
- package/dist/apiContracts.mjs +0 -382
- package/dist/apiContracts.mjs.map +0 -1
- package/dist/extensions/server.cjs +0 -2122
- package/dist/extensions/server.cjs.map +0 -1
- package/dist/extensions/server.d.mts +0 -5
- package/dist/extensions/server.d.mts.map +0 -1
- package/dist/extensions/server.mjs +0 -2114
- package/dist/extensions/server.mjs.map +0 -1
- package/dist/extensions/web.mjs +0 -2785
- package/dist/extensions/web.mjs.map +0 -1
- package/dist/index.cjs +0 -24
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -145
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -22
- package/dist/index.mjs.map +0 -1
- package/dist/worktreeOperations-CaqwGsD_.mjs +0 -1065
- package/dist/worktreeOperations-CaqwGsD_.mjs.map +0 -1
- package/dist/worktreeOperations-MgIVDDu3.cjs +0 -1221
- package/dist/worktreeOperations-MgIVDDu3.cjs.map +0 -1
- package/llms.txt +0 -15
- package/src/prompts/po-use-git/SKILL.md +0 -87
package/dist/apiContracts.d.mts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Type } from "typebox";
|
|
2
|
-
//#region src/schemas/apiContracts.d.ts
|
|
3
|
-
export declare const apiContracts: {
|
|
4
|
-
version: 1;
|
|
5
|
-
protocols?: Record<string, string> | undefined;
|
|
6
|
-
schemas?: Record<string, boolean | object> | undefined;
|
|
7
|
-
http: {
|
|
8
|
-
id: string;
|
|
9
|
-
scope: "global" | "session" | "workspace";
|
|
10
|
-
basePath?: string | undefined;
|
|
11
|
-
path: string;
|
|
12
|
-
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
13
|
-
description: string;
|
|
14
|
-
availability?: string | undefined;
|
|
15
|
-
authentication: "device" | "none" | "owner";
|
|
16
|
-
parameters?: {
|
|
17
|
-
name: string;
|
|
18
|
-
in: "header" | "path" | "query";
|
|
19
|
-
required: boolean;
|
|
20
|
-
schema: boolean | object;
|
|
21
|
-
}[] | undefined;
|
|
22
|
-
body?: {
|
|
23
|
-
contentType: string;
|
|
24
|
-
contentTypes?: string[] | undefined;
|
|
25
|
-
required: boolean;
|
|
26
|
-
schema: boolean | object;
|
|
27
|
-
} | undefined;
|
|
28
|
-
responses: Record<string, {
|
|
29
|
-
description: string;
|
|
30
|
-
contentType?: string | undefined;
|
|
31
|
-
schema?: boolean | object | undefined;
|
|
32
|
-
events?: Record<string, boolean | object> | undefined;
|
|
33
|
-
}>;
|
|
34
|
-
}[];
|
|
35
|
-
sockets: {
|
|
36
|
-
id: string;
|
|
37
|
-
scope: "global" | "session" | "workspace";
|
|
38
|
-
description: string;
|
|
39
|
-
availability?: string | undefined;
|
|
40
|
-
service: string;
|
|
41
|
-
member: string;
|
|
42
|
-
direction: "client-to-server" | "server-to-client";
|
|
43
|
-
kind: "channel" | "method" | "state";
|
|
44
|
-
input: boolean | object;
|
|
45
|
-
output?: boolean | object | undefined;
|
|
46
|
-
errors?: boolean | object | undefined;
|
|
47
|
-
}[];
|
|
48
|
-
dynamic: string[];
|
|
49
|
-
gaps?: string[] | undefined;
|
|
50
|
-
};
|
|
51
|
-
//#endregion
|
|
52
|
-
export { apiContracts as default };
|
|
53
|
-
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAsGa"}
|
package/dist/apiContracts.mjs
DELETED
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import { defineApiContract, jsonApiResponses } from "@agimon-ai/po-core/apiContracts";
|
|
2
|
-
import { Type } from "typebox";
|
|
3
|
-
//#region src/schemas/apiContracts.ts
|
|
4
|
-
const S = Type.String();
|
|
5
|
-
const B = Type.Boolean();
|
|
6
|
-
const O = Type.Optional;
|
|
7
|
-
const literals = (values) => Type.Union(values.map((value) => Type.Literal(value)));
|
|
8
|
-
const RecordSchema = Type.Object({
|
|
9
|
-
version: Type.Literal(1),
|
|
10
|
-
id: S,
|
|
11
|
-
branch: S,
|
|
12
|
-
baseRef: S,
|
|
13
|
-
path: S,
|
|
14
|
-
repositoryRoot: S,
|
|
15
|
-
sessionId: S,
|
|
16
|
-
parentSessionId: Type.Optional(S),
|
|
17
|
-
status: literals([
|
|
18
|
-
"spawning",
|
|
19
|
-
"running",
|
|
20
|
-
"closing",
|
|
21
|
-
"orphaned"
|
|
22
|
-
]),
|
|
23
|
-
createdAt: S
|
|
24
|
-
});
|
|
25
|
-
const ErrorTargetSchema = Type.Union([Type.Object({ action: Type.Literal("create") }), Type.Object({
|
|
26
|
-
action: Type.Literal("close"),
|
|
27
|
-
id: S
|
|
28
|
-
})]);
|
|
29
|
-
const WorktreesPayloadSchema = Type.Object({
|
|
30
|
-
worktrees: Type.Array(Type.Object({
|
|
31
|
-
id: S,
|
|
32
|
-
branch: S,
|
|
33
|
-
path: S,
|
|
34
|
-
sessionId: Type.Union([S, Type.Null()]),
|
|
35
|
-
orphaned: B,
|
|
36
|
-
unowned: B
|
|
37
|
-
})),
|
|
38
|
-
pending: O(S),
|
|
39
|
-
error: O(S),
|
|
40
|
-
errorTarget: O(ErrorTargetSchema)
|
|
41
|
-
});
|
|
42
|
-
const WorktreesCommandSchema = Type.Union([Type.Object({
|
|
43
|
-
action: Type.Literal("create"),
|
|
44
|
-
branch: S,
|
|
45
|
-
baseRef: O(S),
|
|
46
|
-
reservationId: O(Type.String({
|
|
47
|
-
minLength: 1,
|
|
48
|
-
pattern: "^[A-Za-z0-9_-]+$"
|
|
49
|
-
}))
|
|
50
|
-
}), Type.Object({
|
|
51
|
-
action: Type.Literal("close"),
|
|
52
|
-
id: S,
|
|
53
|
-
force: O(B)
|
|
54
|
-
})]);
|
|
55
|
-
const N = Type.Integer({ minimum: 0 });
|
|
56
|
-
const ChangesSchema = Type.Object({
|
|
57
|
-
branch: O(S),
|
|
58
|
-
base: O(S),
|
|
59
|
-
added: N,
|
|
60
|
-
removed: N,
|
|
61
|
-
files: N,
|
|
62
|
-
truncated: O(B),
|
|
63
|
-
upstream: O(Type.Object({
|
|
64
|
-
ref: S,
|
|
65
|
-
ahead: N,
|
|
66
|
-
behind: N
|
|
67
|
-
})),
|
|
68
|
-
rebase: O(Type.Object({ conflicts: Type.Array(S) }))
|
|
69
|
-
});
|
|
70
|
-
const SyncErrorTargetSchema = Type.Union([Type.Object({ action: literals([
|
|
71
|
-
"pull",
|
|
72
|
-
"rebase",
|
|
73
|
-
"abort-rebase"
|
|
74
|
-
]) }), Type.Object({
|
|
75
|
-
action: Type.Literal("push"),
|
|
76
|
-
forceRequired: O(Type.Literal(true))
|
|
77
|
-
})]);
|
|
78
|
-
const GitChangesPayloadSchema = Type.Object({
|
|
79
|
-
changes: O(ChangesSchema),
|
|
80
|
-
pending: O(S),
|
|
81
|
-
error: O(S),
|
|
82
|
-
errorTarget: O(SyncErrorTargetSchema)
|
|
83
|
-
});
|
|
84
|
-
const GitChangesCommandSchema = Type.Union([Type.Object({ action: literals([
|
|
85
|
-
"pull",
|
|
86
|
-
"rebase",
|
|
87
|
-
"abort-rebase"
|
|
88
|
-
]) }), Type.Object({
|
|
89
|
-
action: Type.Literal("push"),
|
|
90
|
-
force: O(Type.Literal(true))
|
|
91
|
-
})]);
|
|
92
|
-
const AuthViewSchema = Type.Object({
|
|
93
|
-
method: literals([
|
|
94
|
-
"none",
|
|
95
|
-
"ssh",
|
|
96
|
-
"https"
|
|
97
|
-
]),
|
|
98
|
-
ssh: O(Type.Object({ keyPath: O(S) })),
|
|
99
|
-
https: O(Type.Object({
|
|
100
|
-
host: S,
|
|
101
|
-
username: S,
|
|
102
|
-
hasToken: B
|
|
103
|
-
}))
|
|
104
|
-
});
|
|
105
|
-
const AuthSaveSchema = Type.Union([
|
|
106
|
-
Type.Object({ method: Type.Literal("none") }),
|
|
107
|
-
Type.Object({
|
|
108
|
-
method: Type.Literal("ssh"),
|
|
109
|
-
keyPath: O(S)
|
|
110
|
-
}),
|
|
111
|
-
Type.Object({
|
|
112
|
-
method: Type.Literal("https"),
|
|
113
|
-
host: S,
|
|
114
|
-
username: S,
|
|
115
|
-
token: O(Type.String({ writeOnly: true }))
|
|
116
|
-
})
|
|
117
|
-
]);
|
|
118
|
-
const DiffRowSchema = Type.Object({
|
|
119
|
-
marker: literals([
|
|
120
|
-
"+",
|
|
121
|
-
"-",
|
|
122
|
-
" "
|
|
123
|
-
]),
|
|
124
|
-
line: N,
|
|
125
|
-
content: S
|
|
126
|
-
});
|
|
127
|
-
const ReviewSummarySchema = Type.Object({
|
|
128
|
-
repository: B,
|
|
129
|
-
branch: O(S),
|
|
130
|
-
base: O(S),
|
|
131
|
-
mergeBase: O(S),
|
|
132
|
-
truncated: O(B),
|
|
133
|
-
files: Type.Array(Type.Object({
|
|
134
|
-
path: S,
|
|
135
|
-
status: literals([
|
|
136
|
-
"added",
|
|
137
|
-
"modified",
|
|
138
|
-
"deleted",
|
|
139
|
-
"untracked",
|
|
140
|
-
"conflicted"
|
|
141
|
-
]),
|
|
142
|
-
added: N,
|
|
143
|
-
removed: N,
|
|
144
|
-
binary: O(B)
|
|
145
|
-
}))
|
|
146
|
-
});
|
|
147
|
-
const ReviewFileSchema = Type.Object({
|
|
148
|
-
path: S,
|
|
149
|
-
hunks: Type.Array(Type.Object({
|
|
150
|
-
start: N,
|
|
151
|
-
rows: Type.Array(DiffRowSchema)
|
|
152
|
-
})),
|
|
153
|
-
binary: O(Type.Literal(true)),
|
|
154
|
-
tooLarge: O(Type.Literal(true))
|
|
155
|
-
});
|
|
156
|
-
const query = [{
|
|
157
|
-
name: "repositoryId",
|
|
158
|
-
in: "query",
|
|
159
|
-
required: true,
|
|
160
|
-
schema: S
|
|
161
|
-
}, {
|
|
162
|
-
name: "sessionId",
|
|
163
|
-
in: "query",
|
|
164
|
-
required: true,
|
|
165
|
-
schema: S
|
|
166
|
-
}];
|
|
167
|
-
const apiContracts = defineApiContract({
|
|
168
|
-
version: 1,
|
|
169
|
-
dynamic: [],
|
|
170
|
-
http: ["global", "workspace"].flatMap((scope) => [
|
|
171
|
-
{
|
|
172
|
-
id: "git.list",
|
|
173
|
-
scope,
|
|
174
|
-
basePath: "git",
|
|
175
|
-
path: "/worktrees",
|
|
176
|
-
method: "GET",
|
|
177
|
-
authentication: "owner",
|
|
178
|
-
description: "List admitted repository worktrees.",
|
|
179
|
-
parameters: query.map((item) => ({
|
|
180
|
-
...item,
|
|
181
|
-
required: item.name === "repositoryId"
|
|
182
|
-
})),
|
|
183
|
-
responses: jsonApiResponses(Type.Object({ worktrees: Type.Array(RecordSchema) }))
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
id: "git.create",
|
|
187
|
-
scope,
|
|
188
|
-
basePath: "git",
|
|
189
|
-
path: "/worktrees",
|
|
190
|
-
method: "POST",
|
|
191
|
-
authentication: "owner",
|
|
192
|
-
description: "Create a worktree and session.",
|
|
193
|
-
parameters: query,
|
|
194
|
-
body: {
|
|
195
|
-
required: true,
|
|
196
|
-
contentType: "application/json",
|
|
197
|
-
schema: Type.Object({
|
|
198
|
-
branch: Type.String({ minLength: 1 }),
|
|
199
|
-
baseRef: O(S),
|
|
200
|
-
name: O(S)
|
|
201
|
-
})
|
|
202
|
-
},
|
|
203
|
-
responses: jsonApiResponses(Type.Object({ worktree: RecordSchema }), 201)
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: "git.close",
|
|
207
|
-
scope,
|
|
208
|
-
basePath: "git",
|
|
209
|
-
path: "/worktrees/{id}",
|
|
210
|
-
method: "DELETE",
|
|
211
|
-
authentication: "owner",
|
|
212
|
-
description: "Close a worktree.",
|
|
213
|
-
parameters: [...query, {
|
|
214
|
-
name: "force",
|
|
215
|
-
in: "query",
|
|
216
|
-
required: false,
|
|
217
|
-
schema: B
|
|
218
|
-
}],
|
|
219
|
-
responses: jsonApiResponses(Type.Object({ worktree: RecordSchema }))
|
|
220
|
-
},
|
|
221
|
-
...scope === "workspace" ? [
|
|
222
|
-
{
|
|
223
|
-
id: "git.auth.read",
|
|
224
|
-
scope,
|
|
225
|
-
basePath: "git",
|
|
226
|
-
path: "/auth",
|
|
227
|
-
method: "GET",
|
|
228
|
-
authentication: "owner",
|
|
229
|
-
description: "Read a workspace's remote auth for manual sync. The token is never returned.",
|
|
230
|
-
parameters: [{
|
|
231
|
-
name: "repositoryId",
|
|
232
|
-
in: "query",
|
|
233
|
-
required: true,
|
|
234
|
-
schema: S
|
|
235
|
-
}],
|
|
236
|
-
responses: jsonApiResponses(AuthViewSchema)
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
id: "git.auth.save",
|
|
240
|
-
scope,
|
|
241
|
-
basePath: "git",
|
|
242
|
-
path: "/auth",
|
|
243
|
-
method: "PUT",
|
|
244
|
-
authentication: "owner",
|
|
245
|
-
description: "Replace a workspace's remote auth. Passkey step-up gated for remote devices.",
|
|
246
|
-
parameters: [{
|
|
247
|
-
name: "repositoryId",
|
|
248
|
-
in: "query",
|
|
249
|
-
required: true,
|
|
250
|
-
schema: S
|
|
251
|
-
}],
|
|
252
|
-
body: {
|
|
253
|
-
required: true,
|
|
254
|
-
contentType: "application/json",
|
|
255
|
-
schema: AuthSaveSchema
|
|
256
|
-
},
|
|
257
|
-
responses: jsonApiResponses(AuthViewSchema)
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
id: "git.branches",
|
|
261
|
-
scope,
|
|
262
|
-
basePath: "git",
|
|
263
|
-
path: "/branches",
|
|
264
|
-
method: "GET",
|
|
265
|
-
authentication: "owner",
|
|
266
|
-
description: "List the workspace branches for the new-session dialog.",
|
|
267
|
-
responses: jsonApiResponses(Type.Object({
|
|
268
|
-
repository: B,
|
|
269
|
-
current: O(S),
|
|
270
|
-
defaultBase: O(S),
|
|
271
|
-
local: Type.Array(Type.Object({
|
|
272
|
-
name: S,
|
|
273
|
-
checkedOutAt: O(S)
|
|
274
|
-
})),
|
|
275
|
-
remote: Type.Array(Type.Object({
|
|
276
|
-
remote: S,
|
|
277
|
-
name: S
|
|
278
|
-
}))
|
|
279
|
-
}))
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
id: "git.sessions.create",
|
|
283
|
-
scope,
|
|
284
|
-
basePath: "git",
|
|
285
|
-
path: "/sessions",
|
|
286
|
-
method: "POST",
|
|
287
|
-
authentication: "owner",
|
|
288
|
-
description: "Start a top-level worktree session on an existing or new branch.",
|
|
289
|
-
body: {
|
|
290
|
-
required: true,
|
|
291
|
-
contentType: "application/json",
|
|
292
|
-
schema: Type.Union([Type.Object({
|
|
293
|
-
mode: Type.Literal("existing-branch"),
|
|
294
|
-
branch: S,
|
|
295
|
-
remote: O(S),
|
|
296
|
-
name: O(S)
|
|
297
|
-
}), Type.Object({
|
|
298
|
-
mode: Type.Literal("new-branch"),
|
|
299
|
-
branch: S,
|
|
300
|
-
baseRef: O(S),
|
|
301
|
-
name: O(S)
|
|
302
|
-
})])
|
|
303
|
-
},
|
|
304
|
-
responses: jsonApiResponses(Type.Object({
|
|
305
|
-
sessionId: S,
|
|
306
|
-
worktreeId: S
|
|
307
|
-
}), 201)
|
|
308
|
-
}
|
|
309
|
-
] : [],
|
|
310
|
-
...scope === "global" ? [{
|
|
311
|
-
id: "git.review.summary",
|
|
312
|
-
scope: "session",
|
|
313
|
-
basePath: "git",
|
|
314
|
-
path: "/review",
|
|
315
|
-
method: "GET",
|
|
316
|
-
authentication: "owner",
|
|
317
|
-
description: "List the files the session's checkout changed against its base.",
|
|
318
|
-
responses: jsonApiResponses(ReviewSummarySchema)
|
|
319
|
-
}, {
|
|
320
|
-
id: "git.review.file",
|
|
321
|
-
scope: "session",
|
|
322
|
-
basePath: "git",
|
|
323
|
-
path: "/review/file",
|
|
324
|
-
method: "GET",
|
|
325
|
-
authentication: "owner",
|
|
326
|
-
description: "One changed file's hunks; the path must be in the session's change set.",
|
|
327
|
-
parameters: [{
|
|
328
|
-
name: "path",
|
|
329
|
-
in: "query",
|
|
330
|
-
required: true,
|
|
331
|
-
schema: Type.String({ minLength: 1 })
|
|
332
|
-
}],
|
|
333
|
-
responses: jsonApiResponses(ReviewFileSchema)
|
|
334
|
-
}] : []
|
|
335
|
-
]),
|
|
336
|
-
sockets: ["global", "workspace"].flatMap((scope) => [
|
|
337
|
-
{
|
|
338
|
-
id: "git.changes.channel",
|
|
339
|
-
scope,
|
|
340
|
-
service: "po.hub.v1",
|
|
341
|
-
member: "git_changes",
|
|
342
|
-
kind: "channel",
|
|
343
|
-
direction: "server-to-client",
|
|
344
|
-
description: "The session's change against its base, and manual sync state.",
|
|
345
|
-
input: GitChangesPayloadSchema
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
id: "git.changes.command",
|
|
349
|
-
scope,
|
|
350
|
-
service: "po.hub.v1",
|
|
351
|
-
member: "git_changes",
|
|
352
|
-
kind: "channel",
|
|
353
|
-
direction: "client-to-server",
|
|
354
|
-
description: "Manual pull, push, rebase or abort-rebase for the session.",
|
|
355
|
-
input: GitChangesCommandSchema
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
id: "git.channel",
|
|
359
|
-
scope,
|
|
360
|
-
service: "po.hub.v1",
|
|
361
|
-
member: "git_worktrees",
|
|
362
|
-
kind: "channel",
|
|
363
|
-
direction: "server-to-client",
|
|
364
|
-
description: "Worktree channel payload.",
|
|
365
|
-
input: WorktreesPayloadSchema
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
id: "git.command",
|
|
369
|
-
scope,
|
|
370
|
-
service: "po.hub.v1",
|
|
371
|
-
member: "git_worktrees",
|
|
372
|
-
kind: "channel",
|
|
373
|
-
direction: "client-to-server",
|
|
374
|
-
description: "Worktree channel command payload.",
|
|
375
|
-
input: WorktreesCommandSchema
|
|
376
|
-
}
|
|
377
|
-
])
|
|
378
|
-
});
|
|
379
|
-
//#endregion
|
|
380
|
-
export { apiContracts, apiContracts as default };
|
|
381
|
-
|
|
382
|
-
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst RecordSchema = Type.Object({\n version: Type.Literal(1),\n id: S,\n branch: S,\n baseRef: S,\n path: S,\n repositoryRoot: S,\n sessionId: S,\n parentSessionId: Type.Optional(S),\n status: literals(['spawning', 'running', 'closing', 'orphaned']),\n createdAt: S,\n});\nconst ErrorTargetSchema = Type.Union([\n Type.Object({ action: Type.Literal('create') }),\n Type.Object({ action: Type.Literal('close'), id: S }),\n]);\nexport const WorktreesPayloadSchema = Type.Object({\n worktrees: Type.Array(\n Type.Object({ id: S, branch: S, path: S, sessionId: Type.Union([S, Type.Null()]), orphaned: B, unowned: B }),\n ),\n pending: O(S),\n error: O(S),\n errorTarget: O(ErrorTargetSchema),\n});\nexport const WorktreesCommandSchema = Type.Union([\n Type.Object({\n action: Type.Literal('create'),\n branch: S,\n baseRef: O(S),\n reservationId: O(Type.String({ minLength: 1, pattern: '^[A-Za-z0-9_-]+$' })),\n }),\n Type.Object({ action: Type.Literal('close'), id: S, force: O(B) }),\n]);\nconst N = Type.Integer({ minimum: 0 });\nconst ChangesSchema = Type.Object({\n branch: O(S),\n base: O(S),\n added: N,\n removed: N,\n files: N,\n truncated: O(B),\n upstream: O(Type.Object({ ref: S, ahead: N, behind: N })),\n rebase: O(Type.Object({ conflicts: Type.Array(S) })),\n});\nconst SyncErrorTargetSchema = Type.Union([\n Type.Object({ action: literals(['pull', 'rebase', 'abort-rebase']) }),\n Type.Object({ action: Type.Literal('push'), forceRequired: O(Type.Literal(true)) }),\n]);\nexport const GitChangesPayloadSchema = Type.Object({\n changes: O(ChangesSchema),\n pending: O(S),\n error: O(S),\n errorTarget: O(SyncErrorTargetSchema),\n});\nexport const GitChangesCommandSchema = Type.Union([\n Type.Object({ action: literals(['pull', 'rebase', 'abort-rebase']) }),\n Type.Object({ action: Type.Literal('push'), force: O(Type.Literal(true)) }),\n]);\nconst AuthViewSchema = Type.Object({\n method: literals(['none', 'ssh', 'https']),\n ssh: O(Type.Object({ keyPath: O(S) })),\n https: O(Type.Object({ host: S, username: S, hasToken: B })),\n});\nconst AuthSaveSchema = Type.Union([\n Type.Object({ method: Type.Literal('none') }),\n Type.Object({ method: Type.Literal('ssh'), keyPath: O(S) }),\n Type.Object({ method: Type.Literal('https'), host: S, username: S, token: O(Type.String({ writeOnly: true })) }),\n]);\nconst DiffRowSchema = Type.Object({ marker: literals(['+', '-', ' ']), line: N, content: S });\nconst ReviewSummarySchema = Type.Object({\n repository: B,\n branch: O(S),\n base: O(S),\n mergeBase: O(S),\n truncated: O(B),\n files: Type.Array(\n Type.Object({\n path: S,\n status: literals(['added', 'modified', 'deleted', 'untracked', 'conflicted']),\n added: N,\n removed: N,\n binary: O(B),\n }),\n ),\n});\nconst ReviewFileSchema = Type.Object({\n path: S,\n hunks: Type.Array(Type.Object({ start: N, rows: Type.Array(DiffRowSchema) })),\n binary: O(Type.Literal(true)),\n tooLarge: O(Type.Literal(true)),\n});\nconst query = [\n { name: 'repositoryId', in: 'query' as const, required: true, schema: S },\n { name: 'sessionId', in: 'query' as const, required: true, schema: S },\n];\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.list',\n scope,\n basePath: 'git',\n path: '/worktrees',\n method: 'GET',\n authentication: 'owner',\n description: 'List admitted repository worktrees.',\n parameters: query.map((item) => ({ ...item, required: item.name === 'repositoryId' })),\n responses: jsonApiResponses(Type.Object({ worktrees: Type.Array(RecordSchema) })),\n },\n {\n id: 'git.create',\n scope,\n basePath: 'git',\n path: '/worktrees',\n method: 'POST',\n authentication: 'owner',\n description: 'Create a worktree and session.',\n parameters: query,\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({ branch: Type.String({ minLength: 1 }), baseRef: O(S), name: O(S) }),\n },\n responses: jsonApiResponses(Type.Object({ worktree: RecordSchema }), 201),\n },\n {\n id: 'git.close',\n scope,\n basePath: 'git',\n path: '/worktrees/{id}',\n method: 'DELETE',\n authentication: 'owner',\n description: 'Close a worktree.',\n parameters: [...query, { name: 'force', in: 'query', required: false, schema: B }],\n responses: jsonApiResponses(Type.Object({ worktree: RecordSchema })),\n },\n // The new-session dialog's routes and a workspace's remote auth exist only on a workspace mount.\n ...(scope === 'workspace'\n ? [\n {\n id: 'git.auth.read',\n scope,\n basePath: 'git',\n path: '/auth',\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: \"Read a workspace's remote auth for manual sync. The token is never returned.\",\n parameters: [{ name: 'repositoryId', in: 'query' as const, required: true, schema: S }],\n responses: jsonApiResponses(AuthViewSchema),\n },\n {\n id: 'git.auth.save',\n scope,\n basePath: 'git',\n path: '/auth',\n method: 'PUT' as const,\n authentication: 'owner' as const,\n description: \"Replace a workspace's remote auth. Passkey step-up gated for remote devices.\",\n parameters: [{ name: 'repositoryId', in: 'query' as const, required: true, schema: S }],\n body: { required: true, contentType: 'application/json', schema: AuthSaveSchema },\n responses: jsonApiResponses(AuthViewSchema),\n },\n {\n id: 'git.branches',\n scope,\n basePath: 'git',\n path: '/branches',\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: 'List the workspace branches for the new-session dialog.',\n responses: jsonApiResponses(\n Type.Object({\n repository: B,\n current: O(S),\n defaultBase: O(S),\n local: Type.Array(Type.Object({ name: S, checkedOutAt: O(S) })),\n remote: Type.Array(Type.Object({ remote: S, name: S })),\n }),\n ),\n },\n {\n id: 'git.sessions.create',\n scope,\n basePath: 'git',\n path: '/sessions',\n method: 'POST' as const,\n authentication: 'owner' as const,\n description: 'Start a top-level worktree session on an existing or new branch.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Union([\n Type.Object({ mode: Type.Literal('existing-branch'), branch: S, remote: O(S), name: O(S) }),\n Type.Object({ mode: Type.Literal('new-branch'), branch: S, baseRef: O(S), name: O(S) }),\n ]),\n },\n responses: jsonApiResponses(Type.Object({ sessionId: S, worktreeId: S }), 201),\n },\n ]\n : []),\n // The review routes exist only on a session mount; listed once, beside the global entries.\n ...(scope === 'global'\n ? [\n {\n id: 'git.review.summary',\n scope: 'session' as const,\n basePath: 'git',\n path: '/review',\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: \"List the files the session's checkout changed against its base.\",\n responses: jsonApiResponses(ReviewSummarySchema),\n },\n {\n id: 'git.review.file',\n scope: 'session' as const,\n basePath: 'git',\n path: '/review/file',\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: \"One changed file's hunks; the path must be in the session's change set.\",\n parameters: [{ name: 'path', in: 'query' as const, required: true, schema: Type.String({ minLength: 1 }) }],\n responses: jsonApiResponses(ReviewFileSchema),\n },\n ]\n : []),\n ]),\n sockets: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.changes.channel',\n scope,\n service: 'po.hub.v1',\n member: 'git_changes',\n kind: 'channel',\n direction: 'server-to-client',\n description: \"The session's change against its base, and manual sync state.\",\n input: GitChangesPayloadSchema,\n },\n {\n id: 'git.changes.command',\n scope,\n service: 'po.hub.v1',\n member: 'git_changes',\n kind: 'channel',\n direction: 'client-to-server',\n description: 'Manual pull, push, rebase or abort-rebase for the session.',\n input: GitChangesCommandSchema,\n },\n {\n id: 'git.channel',\n scope,\n service: 'po.hub.v1',\n member: 'git_worktrees',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Worktree channel payload.',\n input: WorktreesPayloadSchema,\n },\n {\n id: 'git.command',\n scope,\n service: 'po.hub.v1',\n member: 'git_worktrees',\n kind: 'channel',\n direction: 'client-to-server',\n description: 'Worktree channel command payload.',\n input: WorktreesCommandSchema,\n },\n ]),\n});\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,IAAI,KAAK,OAAO;AACtB,MAAM,IAAI,KAAK,QAAQ;AACvB,MAAM,IAAI,KAAK;AACf,MAAM,YAA8B,WAAgB,KAAK,MAAM,OAAO,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC;AACzG,MAAM,eAAe,KAAK,OAAO;CAC/B,SAAS,KAAK,QAAQ,CAAC;CACvB,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,MAAM;CACN,gBAAgB;CAChB,WAAW;CACX,iBAAiB,KAAK,SAAS,CAAC;CAChC,QAAQ,SAAS;EAAC;EAAY;EAAW;EAAW;CAAU,CAAC;CAC/D,WAAW;AACb,CAAC;AACD,MAAM,oBAAoB,KAAK,MAAM,CACnC,KAAK,OAAO,EAAE,QAAQ,KAAK,QAAQ,QAAQ,EAAE,CAAC,GAC9C,KAAK,OAAO;CAAE,QAAQ,KAAK,QAAQ,OAAO;CAAG,IAAI;AAAE,CAAC,CACtD,CAAC;AACD,MAAa,yBAAyB,KAAK,OAAO;CAChD,WAAW,KAAK,MACd,KAAK,OAAO;EAAE,IAAI;EAAG,QAAQ;EAAG,MAAM;EAAG,WAAW,KAAK,MAAM,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC;EAAG,UAAU;EAAG,SAAS;CAAE,CAAC,CAC7G;CACA,SAAS,EAAE,CAAC;CACZ,OAAO,EAAE,CAAC;CACV,aAAa,EAAE,iBAAiB;AAClC,CAAC;AACD,MAAa,yBAAyB,KAAK,MAAM,CAC/C,KAAK,OAAO;CACV,QAAQ,KAAK,QAAQ,QAAQ;CAC7B,QAAQ;CACR,SAAS,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