@agimon-ai/po-git 0.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/apiContracts.cjs +387 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +382 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/server.cjs +2122 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +2114 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +2785 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +145 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/worktreeOperations-CaqwGsD_.mjs +1065 -0
- package/dist/worktreeOperations-CaqwGsD_.mjs.map +1 -0
- package/dist/worktreeOperations-MgIVDDu3.cjs +1221 -0
- package/dist/worktreeOperations-MgIVDDu3.cjs.map +1 -0
- package/llms.txt +15 -0
- package/package.json +135 -0
- package/src/prompts/po-use-git/SKILL.md +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vuong Ngo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @agimon-ai/po-git
|
|
2
|
+
|
|
3
|
+
Git worktree sessions for Po: spawn an isolated worktree with its own session and manage it from the parent
|
|
4
|
+
|
|
5
|
+
This package is a composable [Po](https://www.npmjs.com/package/@agimon-ai/po) subsystem. Select it through the native distribution configuration.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js 24 or newer
|
|
10
|
+
- A Po native server host
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Add `@agimon-ai/po-git` to a selected layer in `.po/modes.yaml`, then run `po sync`. Native metadata selects its server and browser facets; there is no standalone Pi entry.
|
|
15
|
+
|
|
16
|
+
## Use
|
|
17
|
+
|
|
18
|
+
Use the browser worktree controls or the native worktree tool.
|
|
19
|
+
|
|
20
|
+
### New-session dialog
|
|
21
|
+
|
|
22
|
+
In the web cockpit, po-git replaces the new-session dialog for a git workspace. It offers three choices:
|
|
23
|
+
|
|
24
|
+
- **Existing branch**: a worktree session on a local branch, or on a remote-only branch (a local tracking branch is created). Branches already checked out elsewhere are disabled.
|
|
25
|
+
- **New branch**: a worktree session on a new branch from a base, preselected to the repository's default branch.
|
|
26
|
+
- **No branch**: a plain session in the workspace folder.
|
|
27
|
+
|
|
28
|
+
Worktree sessions opened here start at the top level of the session rail, with no parent. A workspace that is not a git checkout offers the plain session only. For remote devices, creating a worktree session needs the same passkey step-up as any new session.
|
|
29
|
+
|
|
30
|
+
## Package behavior
|
|
31
|
+
|
|
32
|
+
### Review this session's changes
|
|
33
|
+
|
|
34
|
+
The `# git` group in the activity dock shows the focused checkout's branch and `+added -removed`, followed by its worktrees. Regular and worktree sessions use the same diff row, even when they have no child worktrees. The row opens review (`g d`); the group heading opens worktrees (`g w`). The counts measure this session's checkout against its base, the way a pull request counts it: every commit since the branch left its base, plus staged, unstaged and untracked work. The base is the worktree's recorded base when the session owns one, then the remote's default branch (`origin/HEAD`, `origin/main`, `origin/master`), then the branch's upstream; with none of those only uncommitted work counts. The count refreshes after every tool call and settled turn; nothing polls.
|
|
35
|
+
|
|
36
|
+
The lane opens the review tab: changed files grouped by folder on the left, every diff stacked on the right. Select lines, or click a line number, to write a comment under that line; a comment on a removed line points at the old file. Comments queue on the tab, and **send review** hands them to the agent as one message, queued behind a running turn rather than dropped.
|
|
37
|
+
|
|
38
|
+
### Pull, push and rebase
|
|
39
|
+
|
|
40
|
+
The review tab's header runs them by hand, one at a time per session:
|
|
41
|
+
|
|
42
|
+
- **pull** fetches, then rebases local commits onto the upstream.
|
|
43
|
+
- **rebase** fetches the base's remote, then rebases onto the base.
|
|
44
|
+
- **push** sets the upstream on a first push. A push the remote rejects after a rebase asks first, then forces with `--force-with-lease --force-if-includes`, which git refuses if the remote holds commits this branch never fetched and integrated.
|
|
45
|
+
|
|
46
|
+
Pull and rebase refuse uncommitted changes. A rebase that stops on conflicts stays paused and lists the files, with **ask agent to resolve** and **abort rebase**.
|
|
47
|
+
|
|
48
|
+
### Remote auth, per workspace
|
|
49
|
+
|
|
50
|
+
Settings, then repository, then **git remote**, sets how one workspace's sessions reach the remote when you pull, push or rebase from the cockpit: this machine's own git (the default), an SSH key path (blank uses your ssh config and ssh-agent), or an HTTPS username and token for one host. Worktree sessions use their workspace's setup.
|
|
51
|
+
|
|
52
|
+
The setup lives outside every repository in `~/.po/git/credentials.json` (folder `0700`, file `0600`). The token is write-only: the page shows only that one is saved. It goes into the environment of one `git fetch` or `git push` at a time, only for the host it was entered for, with git's credential helper list emptied first so the macOS keychain never stores it. The agent's own git commands never see these credentials. Saving from a remote device needs passkey step-up. An unknown SSH host is refused: trust it once with `ssh -T git@<host>` in a terminal.
|
|
53
|
+
|
|
54
|
+
## Help
|
|
55
|
+
|
|
56
|
+
The native server root registers `po-use-git` as a skill resource and the package index as Help-gated context. Guidance stays published under `src/prompts` and is not exported or copied into `dist`.
|
|
57
|
+
|
|
58
|
+
## Public API
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { DefaultGitExtensionService } from '@agimon-ai/po-git';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The service layer is host-neutral. The native session server root owns worktree operations, resources, hooks, and message-inbox disposal. Browser routes own presentation. Public symbols are forwarded through flat `src/exports` files.
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm build
|
|
70
|
+
pnpm typecheck
|
|
71
|
+
pnpm test
|
|
72
|
+
pnpm lint
|
|
73
|
+
pnpm exec vibe-lint check .
|
|
74
|
+
npm pack --dry-run
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Maintained by [Agimon](https://agimon.ai/about).
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|
|
82
|
+
|
|
83
|
+
Native routed declarations own commands, APIs, resources, hooks, and tools. Services own worktree operations and filesystem persistence. Session delivery is consumed through the fixed Session service; no terminal compatibility entry is published.
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let typebox = require("typebox");
|
|
7
|
+
//#region src/schemas/apiContracts.ts
|
|
8
|
+
const S = typebox.Type.String();
|
|
9
|
+
const B = typebox.Type.Boolean();
|
|
10
|
+
const O = typebox.Type.Optional;
|
|
11
|
+
const literals = (values) => typebox.Type.Union(values.map((value) => typebox.Type.Literal(value)));
|
|
12
|
+
const RecordSchema = typebox.Type.Object({
|
|
13
|
+
version: typebox.Type.Literal(1),
|
|
14
|
+
id: S,
|
|
15
|
+
branch: S,
|
|
16
|
+
baseRef: S,
|
|
17
|
+
path: S,
|
|
18
|
+
repositoryRoot: S,
|
|
19
|
+
sessionId: S,
|
|
20
|
+
parentSessionId: typebox.Type.Optional(S),
|
|
21
|
+
status: literals([
|
|
22
|
+
"spawning",
|
|
23
|
+
"running",
|
|
24
|
+
"closing",
|
|
25
|
+
"orphaned"
|
|
26
|
+
]),
|
|
27
|
+
createdAt: S
|
|
28
|
+
});
|
|
29
|
+
const ErrorTargetSchema = typebox.Type.Union([typebox.Type.Object({ action: typebox.Type.Literal("create") }), typebox.Type.Object({
|
|
30
|
+
action: typebox.Type.Literal("close"),
|
|
31
|
+
id: S
|
|
32
|
+
})]);
|
|
33
|
+
const WorktreesPayloadSchema = typebox.Type.Object({
|
|
34
|
+
worktrees: typebox.Type.Array(typebox.Type.Object({
|
|
35
|
+
id: S,
|
|
36
|
+
branch: S,
|
|
37
|
+
path: S,
|
|
38
|
+
sessionId: typebox.Type.Union([S, typebox.Type.Null()]),
|
|
39
|
+
orphaned: B,
|
|
40
|
+
unowned: B
|
|
41
|
+
})),
|
|
42
|
+
pending: O(S),
|
|
43
|
+
error: O(S),
|
|
44
|
+
errorTarget: O(ErrorTargetSchema)
|
|
45
|
+
});
|
|
46
|
+
const WorktreesCommandSchema = typebox.Type.Union([typebox.Type.Object({
|
|
47
|
+
action: typebox.Type.Literal("create"),
|
|
48
|
+
branch: S,
|
|
49
|
+
baseRef: O(S),
|
|
50
|
+
reservationId: O(typebox.Type.String({
|
|
51
|
+
minLength: 1,
|
|
52
|
+
pattern: "^[A-Za-z0-9_-]+$"
|
|
53
|
+
}))
|
|
54
|
+
}), typebox.Type.Object({
|
|
55
|
+
action: typebox.Type.Literal("close"),
|
|
56
|
+
id: S,
|
|
57
|
+
force: O(B)
|
|
58
|
+
})]);
|
|
59
|
+
const N = typebox.Type.Integer({ minimum: 0 });
|
|
60
|
+
const ChangesSchema = typebox.Type.Object({
|
|
61
|
+
branch: O(S),
|
|
62
|
+
base: O(S),
|
|
63
|
+
added: N,
|
|
64
|
+
removed: N,
|
|
65
|
+
files: N,
|
|
66
|
+
truncated: O(B),
|
|
67
|
+
upstream: O(typebox.Type.Object({
|
|
68
|
+
ref: S,
|
|
69
|
+
ahead: N,
|
|
70
|
+
behind: N
|
|
71
|
+
})),
|
|
72
|
+
rebase: O(typebox.Type.Object({ conflicts: typebox.Type.Array(S) }))
|
|
73
|
+
});
|
|
74
|
+
const SyncErrorTargetSchema = typebox.Type.Union([typebox.Type.Object({ action: literals([
|
|
75
|
+
"pull",
|
|
76
|
+
"rebase",
|
|
77
|
+
"abort-rebase"
|
|
78
|
+
]) }), typebox.Type.Object({
|
|
79
|
+
action: typebox.Type.Literal("push"),
|
|
80
|
+
forceRequired: O(typebox.Type.Literal(true))
|
|
81
|
+
})]);
|
|
82
|
+
const GitChangesPayloadSchema = typebox.Type.Object({
|
|
83
|
+
changes: O(ChangesSchema),
|
|
84
|
+
pending: O(S),
|
|
85
|
+
error: O(S),
|
|
86
|
+
errorTarget: O(SyncErrorTargetSchema)
|
|
87
|
+
});
|
|
88
|
+
const GitChangesCommandSchema = typebox.Type.Union([typebox.Type.Object({ action: literals([
|
|
89
|
+
"pull",
|
|
90
|
+
"rebase",
|
|
91
|
+
"abort-rebase"
|
|
92
|
+
]) }), typebox.Type.Object({
|
|
93
|
+
action: typebox.Type.Literal("push"),
|
|
94
|
+
force: O(typebox.Type.Literal(true))
|
|
95
|
+
})]);
|
|
96
|
+
const AuthViewSchema = typebox.Type.Object({
|
|
97
|
+
method: literals([
|
|
98
|
+
"none",
|
|
99
|
+
"ssh",
|
|
100
|
+
"https"
|
|
101
|
+
]),
|
|
102
|
+
ssh: O(typebox.Type.Object({ keyPath: O(S) })),
|
|
103
|
+
https: O(typebox.Type.Object({
|
|
104
|
+
host: S,
|
|
105
|
+
username: S,
|
|
106
|
+
hasToken: B
|
|
107
|
+
}))
|
|
108
|
+
});
|
|
109
|
+
const AuthSaveSchema = typebox.Type.Union([
|
|
110
|
+
typebox.Type.Object({ method: typebox.Type.Literal("none") }),
|
|
111
|
+
typebox.Type.Object({
|
|
112
|
+
method: typebox.Type.Literal("ssh"),
|
|
113
|
+
keyPath: O(S)
|
|
114
|
+
}),
|
|
115
|
+
typebox.Type.Object({
|
|
116
|
+
method: typebox.Type.Literal("https"),
|
|
117
|
+
host: S,
|
|
118
|
+
username: S,
|
|
119
|
+
token: O(typebox.Type.String({ writeOnly: true }))
|
|
120
|
+
})
|
|
121
|
+
]);
|
|
122
|
+
const DiffRowSchema = typebox.Type.Object({
|
|
123
|
+
marker: literals([
|
|
124
|
+
"+",
|
|
125
|
+
"-",
|
|
126
|
+
" "
|
|
127
|
+
]),
|
|
128
|
+
line: N,
|
|
129
|
+
content: S
|
|
130
|
+
});
|
|
131
|
+
const ReviewSummarySchema = typebox.Type.Object({
|
|
132
|
+
repository: B,
|
|
133
|
+
branch: O(S),
|
|
134
|
+
base: O(S),
|
|
135
|
+
mergeBase: O(S),
|
|
136
|
+
truncated: O(B),
|
|
137
|
+
files: typebox.Type.Array(typebox.Type.Object({
|
|
138
|
+
path: S,
|
|
139
|
+
status: literals([
|
|
140
|
+
"added",
|
|
141
|
+
"modified",
|
|
142
|
+
"deleted",
|
|
143
|
+
"untracked",
|
|
144
|
+
"conflicted"
|
|
145
|
+
]),
|
|
146
|
+
added: N,
|
|
147
|
+
removed: N,
|
|
148
|
+
binary: O(B)
|
|
149
|
+
}))
|
|
150
|
+
});
|
|
151
|
+
const ReviewFileSchema = typebox.Type.Object({
|
|
152
|
+
path: S,
|
|
153
|
+
hunks: typebox.Type.Array(typebox.Type.Object({
|
|
154
|
+
start: N,
|
|
155
|
+
rows: typebox.Type.Array(DiffRowSchema)
|
|
156
|
+
})),
|
|
157
|
+
binary: O(typebox.Type.Literal(true)),
|
|
158
|
+
tooLarge: O(typebox.Type.Literal(true))
|
|
159
|
+
});
|
|
160
|
+
const query = [{
|
|
161
|
+
name: "repositoryId",
|
|
162
|
+
in: "query",
|
|
163
|
+
required: true,
|
|
164
|
+
schema: S
|
|
165
|
+
}, {
|
|
166
|
+
name: "sessionId",
|
|
167
|
+
in: "query",
|
|
168
|
+
required: true,
|
|
169
|
+
schema: S
|
|
170
|
+
}];
|
|
171
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
172
|
+
version: 1,
|
|
173
|
+
dynamic: [],
|
|
174
|
+
http: ["global", "workspace"].flatMap((scope) => [
|
|
175
|
+
{
|
|
176
|
+
id: "git.list",
|
|
177
|
+
scope,
|
|
178
|
+
basePath: "git",
|
|
179
|
+
path: "/worktrees",
|
|
180
|
+
method: "GET",
|
|
181
|
+
authentication: "owner",
|
|
182
|
+
description: "List admitted repository worktrees.",
|
|
183
|
+
parameters: query.map((item) => ({
|
|
184
|
+
...item,
|
|
185
|
+
required: item.name === "repositoryId"
|
|
186
|
+
})),
|
|
187
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktrees: typebox.Type.Array(RecordSchema) }))
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "git.create",
|
|
191
|
+
scope,
|
|
192
|
+
basePath: "git",
|
|
193
|
+
path: "/worktrees",
|
|
194
|
+
method: "POST",
|
|
195
|
+
authentication: "owner",
|
|
196
|
+
description: "Create a worktree and session.",
|
|
197
|
+
parameters: query,
|
|
198
|
+
body: {
|
|
199
|
+
required: true,
|
|
200
|
+
contentType: "application/json",
|
|
201
|
+
schema: typebox.Type.Object({
|
|
202
|
+
branch: typebox.Type.String({ minLength: 1 }),
|
|
203
|
+
baseRef: O(S),
|
|
204
|
+
name: O(S)
|
|
205
|
+
})
|
|
206
|
+
},
|
|
207
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: RecordSchema }), 201)
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "git.close",
|
|
211
|
+
scope,
|
|
212
|
+
basePath: "git",
|
|
213
|
+
path: "/worktrees/{id}",
|
|
214
|
+
method: "DELETE",
|
|
215
|
+
authentication: "owner",
|
|
216
|
+
description: "Close a worktree.",
|
|
217
|
+
parameters: [...query, {
|
|
218
|
+
name: "force",
|
|
219
|
+
in: "query",
|
|
220
|
+
required: false,
|
|
221
|
+
schema: B
|
|
222
|
+
}],
|
|
223
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: RecordSchema }))
|
|
224
|
+
},
|
|
225
|
+
...scope === "workspace" ? [
|
|
226
|
+
{
|
|
227
|
+
id: "git.auth.read",
|
|
228
|
+
scope,
|
|
229
|
+
basePath: "git",
|
|
230
|
+
path: "/auth",
|
|
231
|
+
method: "GET",
|
|
232
|
+
authentication: "owner",
|
|
233
|
+
description: "Read a workspace's remote auth for manual sync. The token is never returned.",
|
|
234
|
+
parameters: [{
|
|
235
|
+
name: "repositoryId",
|
|
236
|
+
in: "query",
|
|
237
|
+
required: true,
|
|
238
|
+
schema: S
|
|
239
|
+
}],
|
|
240
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(AuthViewSchema)
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: "git.auth.save",
|
|
244
|
+
scope,
|
|
245
|
+
basePath: "git",
|
|
246
|
+
path: "/auth",
|
|
247
|
+
method: "PUT",
|
|
248
|
+
authentication: "owner",
|
|
249
|
+
description: "Replace a workspace's remote auth. Passkey step-up gated for remote devices.",
|
|
250
|
+
parameters: [{
|
|
251
|
+
name: "repositoryId",
|
|
252
|
+
in: "query",
|
|
253
|
+
required: true,
|
|
254
|
+
schema: S
|
|
255
|
+
}],
|
|
256
|
+
body: {
|
|
257
|
+
required: true,
|
|
258
|
+
contentType: "application/json",
|
|
259
|
+
schema: AuthSaveSchema
|
|
260
|
+
},
|
|
261
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(AuthViewSchema)
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: "git.branches",
|
|
265
|
+
scope,
|
|
266
|
+
basePath: "git",
|
|
267
|
+
path: "/branches",
|
|
268
|
+
method: "GET",
|
|
269
|
+
authentication: "owner",
|
|
270
|
+
description: "List the workspace branches for the new-session dialog.",
|
|
271
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
|
|
272
|
+
repository: B,
|
|
273
|
+
current: O(S),
|
|
274
|
+
defaultBase: O(S),
|
|
275
|
+
local: typebox.Type.Array(typebox.Type.Object({
|
|
276
|
+
name: S,
|
|
277
|
+
checkedOutAt: O(S)
|
|
278
|
+
})),
|
|
279
|
+
remote: typebox.Type.Array(typebox.Type.Object({
|
|
280
|
+
remote: S,
|
|
281
|
+
name: S
|
|
282
|
+
}))
|
|
283
|
+
}))
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: "git.sessions.create",
|
|
287
|
+
scope,
|
|
288
|
+
basePath: "git",
|
|
289
|
+
path: "/sessions",
|
|
290
|
+
method: "POST",
|
|
291
|
+
authentication: "owner",
|
|
292
|
+
description: "Start a top-level worktree session on an existing or new branch.",
|
|
293
|
+
body: {
|
|
294
|
+
required: true,
|
|
295
|
+
contentType: "application/json",
|
|
296
|
+
schema: typebox.Type.Union([typebox.Type.Object({
|
|
297
|
+
mode: typebox.Type.Literal("existing-branch"),
|
|
298
|
+
branch: S,
|
|
299
|
+
remote: O(S),
|
|
300
|
+
name: O(S)
|
|
301
|
+
}), typebox.Type.Object({
|
|
302
|
+
mode: typebox.Type.Literal("new-branch"),
|
|
303
|
+
branch: S,
|
|
304
|
+
baseRef: O(S),
|
|
305
|
+
name: O(S)
|
|
306
|
+
})])
|
|
307
|
+
},
|
|
308
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
|
|
309
|
+
sessionId: S,
|
|
310
|
+
worktreeId: S
|
|
311
|
+
}), 201)
|
|
312
|
+
}
|
|
313
|
+
] : [],
|
|
314
|
+
...scope === "global" ? [{
|
|
315
|
+
id: "git.review.summary",
|
|
316
|
+
scope: "session",
|
|
317
|
+
basePath: "git",
|
|
318
|
+
path: "/review",
|
|
319
|
+
method: "GET",
|
|
320
|
+
authentication: "owner",
|
|
321
|
+
description: "List the files the session's checkout changed against its base.",
|
|
322
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ReviewSummarySchema)
|
|
323
|
+
}, {
|
|
324
|
+
id: "git.review.file",
|
|
325
|
+
scope: "session",
|
|
326
|
+
basePath: "git",
|
|
327
|
+
path: "/review/file",
|
|
328
|
+
method: "GET",
|
|
329
|
+
authentication: "owner",
|
|
330
|
+
description: "One changed file's hunks; the path must be in the session's change set.",
|
|
331
|
+
parameters: [{
|
|
332
|
+
name: "path",
|
|
333
|
+
in: "query",
|
|
334
|
+
required: true,
|
|
335
|
+
schema: typebox.Type.String({ minLength: 1 })
|
|
336
|
+
}],
|
|
337
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ReviewFileSchema)
|
|
338
|
+
}] : []
|
|
339
|
+
]),
|
|
340
|
+
sockets: ["global", "workspace"].flatMap((scope) => [
|
|
341
|
+
{
|
|
342
|
+
id: "git.changes.channel",
|
|
343
|
+
scope,
|
|
344
|
+
service: "po.hub.v1",
|
|
345
|
+
member: "git_changes",
|
|
346
|
+
kind: "channel",
|
|
347
|
+
direction: "server-to-client",
|
|
348
|
+
description: "The session's change against its base, and manual sync state.",
|
|
349
|
+
input: GitChangesPayloadSchema
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: "git.changes.command",
|
|
353
|
+
scope,
|
|
354
|
+
service: "po.hub.v1",
|
|
355
|
+
member: "git_changes",
|
|
356
|
+
kind: "channel",
|
|
357
|
+
direction: "client-to-server",
|
|
358
|
+
description: "Manual pull, push, rebase or abort-rebase for the session.",
|
|
359
|
+
input: GitChangesCommandSchema
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
id: "git.channel",
|
|
363
|
+
scope,
|
|
364
|
+
service: "po.hub.v1",
|
|
365
|
+
member: "git_worktrees",
|
|
366
|
+
kind: "channel",
|
|
367
|
+
direction: "server-to-client",
|
|
368
|
+
description: "Worktree channel payload.",
|
|
369
|
+
input: WorktreesPayloadSchema
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: "git.command",
|
|
373
|
+
scope,
|
|
374
|
+
service: "po.hub.v1",
|
|
375
|
+
member: "git_worktrees",
|
|
376
|
+
kind: "channel",
|
|
377
|
+
direction: "client-to-server",
|
|
378
|
+
description: "Worktree channel command payload.",
|
|
379
|
+
input: WorktreesCommandSchema
|
|
380
|
+
}
|
|
381
|
+
])
|
|
382
|
+
});
|
|
383
|
+
//#endregion
|
|
384
|
+
exports.apiContracts = apiContracts;
|
|
385
|
+
exports.default = apiContracts;
|
|
386
|
+
|
|
387
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract","jsonApiResponses"],"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,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,QAAQ;AACvB,MAAM,IAAIA,QAAAA,KAAK;AACf,MAAM,YAA8B,WAAgBA,QAAAA,KAAK,MAAM,OAAO,KAAK,UAAUA,QAAAA,KAAK,QAAQ,KAAK,CAAC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CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAsGa"}
|