@agimon-ai/po-git 0.0.0-alpha.195 → 0.0.0-alpha.197
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 +77 -4
- package/dist/apiContracts.cjs +41 -8
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +41 -8
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/native.mjs +241 -181
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +1222 -453
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +1169 -400
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +417 -322
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{worktreeOperations-BEk4VEj3.cjs → gitDependencies-BnNuImZi.cjs} +1432 -170
- package/dist/gitDependencies-BnNuImZi.cjs.map +1 -0
- package/dist/{worktreeOperations-hT6N8oSr.mjs → gitDependencies-DYe8D0VS.mjs} +1373 -183
- package/dist/gitDependencies-DYe8D0VS.mjs.map +1 -0
- package/dist/index.cjs +13 -22
- package/dist/index.d.mts +261 -13
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -22
- package/dist/po-runtime-identity.json +1 -1
- package/llms.txt +3 -3
- package/package.json +12 -8
- package/src/prompts/codemode-how-to-git/SKILL.md +52 -10
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/worktreeOperations-BEk4VEj3.cjs.map +0 -1
- package/dist/worktreeOperations-hT6N8oSr.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Add `@agimon-ai/po-git` to a selected layer in `.po/presets.yaml`, then run `po
|
|
|
15
15
|
|
|
16
16
|
## Use
|
|
17
17
|
|
|
18
|
-
Use the browser worktree controls
|
|
18
|
+
Use the browser worktree controls or an agent session. In code mode, `worktrees` returns structured records; call `discover({ namespace: 'worktrees' })` for the installed signatures. Without code mode, use `run_worktree`. The [worktree guide](./src/prompts/codemode-how-to-git/SKILL.md) covers ownership, message delivery and when to refuse cleanup.
|
|
19
19
|
|
|
20
20
|
### New-session dialog
|
|
21
21
|
|
|
@@ -27,9 +27,28 @@ In the web cockpit, po-git replaces the new-session dialog for a git workspace.
|
|
|
27
27
|
|
|
28
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
29
|
|
|
30
|
+
### Sparse checkouts
|
|
31
|
+
|
|
32
|
+
To offer partial checkouts, add a `sparse` block to `.po/worktree.yaml`. Without a sparse policy or profile, existing Git and Rift worktrees need no changes.
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
sparse:
|
|
36
|
+
profilePattern: profiles/{profile}.json
|
|
37
|
+
baseFolders: [.po, docs]
|
|
38
|
+
excludeFolders: [vendor]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Commit `profiles/web.json` containing, for example, `{ "includeFolders": ["apps/web"] }`. Po reads profiles from Git at the selected ref, not from uncommitted files. The `web` checkout includes `apps/web` and the base folders. `full` is reserved for a complete checkout. Paths are repository-relative; exclusions limit the cone, not access to the Git object store.
|
|
42
|
+
|
|
43
|
+
Before the first sparse create, explicitly enable per-worktree Git config in the main repository. With the `sparo` binary from `@agimon-ai/po-sparo`, run `sparo --policy policy.json init --repo .`, where `policy.json` contains the three fields of the `sparse` block as a JSON object. This backs up shared Git config before changing it. Po does not run it for you.
|
|
44
|
+
|
|
45
|
+
`metadata.git.sparseProfile` sets the workspace checkout profile; `metadata.git.extraFolders` adds folders. Older workspaces can keep `metadata.sparo.profile` and `extraFolders` until they switch. Po uses `metadata.sparo` only if `metadata.git` is absent. The launcher's `selection.profile` chooses the session profile, not its files.
|
|
46
|
+
|
|
47
|
+
Plugins can inject the workspace service `po/git-engine`. Its contract and portable factory come from the MIT utility `@agimon-ai/po-sparo`; operations take an explicit policy, admitted environment and cancellation signal.
|
|
48
|
+
|
|
30
49
|
### Worktree setup
|
|
31
50
|
|
|
32
|
-
A new worktree has no `node_modules` or builds.
|
|
51
|
+
A new worktree has no `node_modules` or builds. For an ordinary Git or Rift checkout, put the commands that prepare it in `.po/worktree.yaml` at the repository root:
|
|
33
52
|
|
|
34
53
|
```yaml
|
|
35
54
|
setup:
|
|
@@ -37,7 +56,61 @@ setup:
|
|
|
37
56
|
- pnpm build
|
|
38
57
|
```
|
|
39
58
|
|
|
40
|
-
|
|
59
|
+
For an engine-managed checkout (a named sparse profile or `full`), po-git runs `sparo install .` with the validated policy before the configured commands. Omit the example's `pnpm install` in that case. Without `setup`, neither install nor setup runs. Workflow launches skip this runner and own their preparation.
|
|
60
|
+
|
|
61
|
+
Setup runs in the child's `worktree-setup` runner, with a wake on exit. `setupStage: started` confirms the runner accepted the command, not that the build passed. For `failed` or `unconfirmed`, inspect the child and runner logs before deciding what to do. The checkout stays in place, even if Runner is missing. Do not spawn it again to retry setup. A malformed configuration is refused before any checkout is created.
|
|
62
|
+
|
|
63
|
+
### Isolated repository workflows
|
|
64
|
+
|
|
65
|
+
Use `worktrees.startWorkflow({ key, attemptId, inputs })` to launch a repository workflow in its own checkout. The [worktree guide](./src/prompts/codemode-how-to-git/SKILL.md#isolated-workflow-runs) covers selecting a definition, retrying an attempt and checking its admission. The workflow gets the base remote, branch and commit plus its working branch as `PO_GIT_BASE_REMOTE`, `PO_GIT_BASE_BRANCH`, `PO_GIT_BASE_SHA` and `PO_GIT_BRANCH`. The corresponding `SPARO_*` names remain available for existing workflows.
|
|
66
|
+
|
|
67
|
+
### Import an existing Sparo registry
|
|
68
|
+
|
|
69
|
+
This is a **one-time operator action**, not startup behavior. On the same host as the checkouts, stop the old `po-sparo` provider, keep both providers stopped and back up the `sparo` and `git` directories under the effective Po home. Do not move checkout directories. Use the public `importSparoWorktrees` export once per repository, with the repository's absolute root, the admitted home directory and the same explicit `PO_HOME` if it was overridden.
|
|
70
|
+
|
|
71
|
+
For a local Node operator, the following adapter uses an absolute, trusted Git executable and the supplied string-valued environment, not the operator shell's credentials. Pass `sourceProviderStopped: true` **only after** stopping the provider; the import cannot stop it for you.
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import { execFileSync } from 'node:child_process';
|
|
75
|
+
|
|
76
|
+
import { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';
|
|
77
|
+
import { importSparoWorktrees } from '@agimon-ai/po-git';
|
|
78
|
+
|
|
79
|
+
async function importStoppedRepository({
|
|
80
|
+
repositoryRoot,
|
|
81
|
+
homeDirectory,
|
|
82
|
+
environment,
|
|
83
|
+
gitExecutable,
|
|
84
|
+
sourceProviderStopped,
|
|
85
|
+
}) {
|
|
86
|
+
const git = (cwd, ...args) =>
|
|
87
|
+
execFileSync(gitExecutable, ['-C', cwd, ...args], {
|
|
88
|
+
env: environment,
|
|
89
|
+
encoding: 'utf8',
|
|
90
|
+
timeout: 30_000,
|
|
91
|
+
});
|
|
92
|
+
return importSparoWorktrees({
|
|
93
|
+
repositoryRoot,
|
|
94
|
+
homeDirectory,
|
|
95
|
+
environment,
|
|
96
|
+
sourceProviderStopped,
|
|
97
|
+
fs: createNodePlatform({ homeDirectory }).env(repositoryRoot),
|
|
98
|
+
git: {
|
|
99
|
+
async listWorktreePaths(cwd) {
|
|
100
|
+
return git(cwd, 'worktree', 'list', '--porcelain', '-z')
|
|
101
|
+
.split('\0')
|
|
102
|
+
.filter((field) => field.startsWith('worktree '))
|
|
103
|
+
.map((field) => field.slice('worktree '.length));
|
|
104
|
+
},
|
|
105
|
+
async currentBranch(cwd) {
|
|
106
|
+
return git(cwd, 'symbolic-ref', '--quiet', '--short', 'HEAD').trimEnd();
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Check `status`, `imported`, `duplicates`, `source` and `destination` before enabling po-git alone. `already-imported` means the completion marker exists; a rerun does not resurrect closed checkouts. `source-absent` imports nothing. A collision, malformed registry, wrong branch or unverifiable checkout (including Rift) refuses the import. Reconcile the evidence rather than forcing it. The old registry, worktree files and per-checkout engine state stay in place. If either provider has written since the backup, do not restore it over newer records.
|
|
41
114
|
|
|
42
115
|
## Package behavior
|
|
43
116
|
|
|
@@ -65,7 +138,7 @@ The setup lives outside every repository in `~/.po/git/credentials.json` (folder
|
|
|
65
138
|
|
|
66
139
|
## Help
|
|
67
140
|
|
|
68
|
-
The
|
|
141
|
+
The session registers `codemode-how-to-git` as a skill. The guide ships under `src/prompts`, indexed by `llms.txt`; it is not bundled into `dist`.
|
|
69
142
|
|
|
70
143
|
## Development
|
|
71
144
|
|
package/dist/apiContracts.cjs
CHANGED
|
@@ -8,9 +8,11 @@ let typebox = require("typebox");
|
|
|
8
8
|
const S = typebox.Type.String();
|
|
9
9
|
const B = typebox.Type.Boolean();
|
|
10
10
|
const O = typebox.Type.Optional;
|
|
11
|
+
const SparseProfileSchema = typebox.Type.String({ pattern: "^[A-Za-z0-9][A-Za-z0-9_-]*$" });
|
|
12
|
+
const SelectionSchema = typebox.Type.Object({ profile: typebox.Type.Union([S, typebox.Type.Null()]) });
|
|
11
13
|
const literals = (values) => typebox.Type.Union(values.map((value) => typebox.Type.Literal(value)));
|
|
12
|
-
const
|
|
13
|
-
version: typebox.Type.Literal(
|
|
14
|
+
const WorktreeRecordSchema = typebox.Type.Object({
|
|
15
|
+
version: typebox.Type.Literal(2),
|
|
14
16
|
id: S,
|
|
15
17
|
branch: S,
|
|
16
18
|
baseRef: S,
|
|
@@ -24,6 +26,29 @@ const RecordSchema = typebox.Type.Object({
|
|
|
24
26
|
"closing",
|
|
25
27
|
"orphaned"
|
|
26
28
|
]),
|
|
29
|
+
setupStage: O(literals([
|
|
30
|
+
"none",
|
|
31
|
+
"started",
|
|
32
|
+
"failed",
|
|
33
|
+
"unconfirmed"
|
|
34
|
+
])),
|
|
35
|
+
backend: O(typebox.Type.Literal("rift")),
|
|
36
|
+
sparseProfile: O(SparseProfileSchema),
|
|
37
|
+
extraFolders: O(typebox.Type.Array(S)),
|
|
38
|
+
sparseFingerprint: O(S),
|
|
39
|
+
baseCommit: O(S),
|
|
40
|
+
workflow: O(typebox.Type.Object({
|
|
41
|
+
attemptId: S,
|
|
42
|
+
fingerprint: S,
|
|
43
|
+
state: literals([
|
|
44
|
+
"spawned",
|
|
45
|
+
"admitted",
|
|
46
|
+
"retained"
|
|
47
|
+
]),
|
|
48
|
+
admissionId: O(S),
|
|
49
|
+
runId: O(S),
|
|
50
|
+
reason: O(S)
|
|
51
|
+
})),
|
|
27
52
|
createdAt: S
|
|
28
53
|
});
|
|
29
54
|
const ErrorTargetSchema = typebox.Type.Union([typebox.Type.Object({
|
|
@@ -187,7 +212,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
|
187
212
|
...item,
|
|
188
213
|
required: item.name === "repositoryId"
|
|
189
214
|
})),
|
|
190
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktrees: typebox.Type.Array(
|
|
215
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktrees: typebox.Type.Array(WorktreeRecordSchema) }))
|
|
191
216
|
},
|
|
192
217
|
{
|
|
193
218
|
id: "git.create",
|
|
@@ -204,10 +229,12 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
|
204
229
|
schema: typebox.Type.Object({
|
|
205
230
|
branch: typebox.Type.String({ minLength: 1 }),
|
|
206
231
|
baseRef: O(S),
|
|
207
|
-
name: O(S)
|
|
232
|
+
name: O(S),
|
|
233
|
+
sparseProfile: O(SparseProfileSchema),
|
|
234
|
+
selection: O(SelectionSchema)
|
|
208
235
|
})
|
|
209
236
|
},
|
|
210
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree:
|
|
237
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: WorktreeRecordSchema }), 201)
|
|
211
238
|
},
|
|
212
239
|
{
|
|
213
240
|
id: "git.close",
|
|
@@ -223,7 +250,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
|
223
250
|
required: false,
|
|
224
251
|
schema: B
|
|
225
252
|
}],
|
|
226
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree:
|
|
253
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: WorktreeRecordSchema }))
|
|
227
254
|
},
|
|
228
255
|
...scope === "workspace" ? [
|
|
229
256
|
{
|
|
@@ -275,6 +302,8 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
|
275
302
|
repository: B,
|
|
276
303
|
current: O(S),
|
|
277
304
|
defaultBase: O(S),
|
|
305
|
+
sparseProfiles: O(typebox.Type.Array(S)),
|
|
306
|
+
defaultSparseProfile: O(S),
|
|
278
307
|
local: typebox.Type.Array(typebox.Type.Object({
|
|
279
308
|
name: S,
|
|
280
309
|
checkedOutAt: O(S)
|
|
@@ -330,12 +359,16 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
|
330
359
|
mode: typebox.Type.Literal("existing-branch"),
|
|
331
360
|
branch: S,
|
|
332
361
|
remote: O(S),
|
|
333
|
-
name: O(S)
|
|
362
|
+
name: O(S),
|
|
363
|
+
sparseProfile: O(SparseProfileSchema),
|
|
364
|
+
selection: O(SelectionSchema)
|
|
334
365
|
}), typebox.Type.Object({
|
|
335
366
|
mode: typebox.Type.Literal("new-branch"),
|
|
336
367
|
branch: S,
|
|
337
368
|
baseRef: O(S),
|
|
338
|
-
name: O(S)
|
|
369
|
+
name: O(S),
|
|
370
|
+
sparseProfile: O(SparseProfileSchema),
|
|
371
|
+
selection: O(SelectionSchema)
|
|
339
372
|
})])
|
|
340
373
|
},
|
|
341
374
|
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
|
|
@@ -1 +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'), riftMissing: O(Type.Literal(true)) }),\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: (['host', '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.branches.delete',\n scope,\n basePath: 'git',\n path: '/branches',\n method: 'DELETE' as const,\n authentication: 'owner' as const,\n description: 'Safely delete a local branch that is not checked out. Never force-deletes unmerged work.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ deleted: B })),\n },\n {\n id: 'git.branches.open',\n scope,\n basePath: 'git',\n path: '/branches/open',\n method: 'POST' as const,\n authentication: 'owner' as const,\n description: 'Open the branch checkout in Finder. Local callers only, no client-supplied path.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ opened: B })),\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 host entries.\n ...(scope === 'host'\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: (['host', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.changes.channel',\n scope,\n service: 'po.hub',\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',\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',\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',\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,CAAC;AACzG,MAAM,eAAeA,QAAAA,KAAK,OAAO;CAC/B,SAASA,QAAAA,KAAK,QAAQ,CAAC;CACvB,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,MAAM;CACN,gBAAgB;CAChB,WAAW;CACX,iBAAiBA,QAAAA,KAAK,SAAS,CAAC;CAChC,QAAQ,SAAS;EAAC;EAAY;EAAW;EAAW;CAAU,CAAC;CAC/D,WAAW;AACb,CAAC;AACD,MAAM,oBAAoBA,QAAAA,KAAK,MAAM,CACnCA,QAAAA,KAAK,OAAO;CAAE,QAAQA,QAAAA,KAAK,QAAQ,QAAQ;CAAG,aAAa,EAAEA,QAAAA,KAAK,QAAQ,IAAI,CAAC;AAAE,CAAC,GAClFA,QAAAA,KAAK,OAA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ACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;CACF,CAAC;AACH,CAAC"}
|
|
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 SparseProfileSchema = Type.String({ pattern: '^[A-Za-z0-9][A-Za-z0-9_-]*$' });\nconst SelectionSchema = Type.Object({ profile: Type.Union([S, Type.Null()]) });\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nexport const WorktreeRecordSchema = Type.Object({\n version: Type.Literal(2),\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 setupStage: O(literals(['none', 'started', 'failed', 'unconfirmed'])),\n backend: O(Type.Literal('rift')),\n sparseProfile: O(SparseProfileSchema),\n extraFolders: O(Type.Array(S)),\n sparseFingerprint: O(S),\n baseCommit: O(S),\n workflow: O(\n Type.Object({\n attemptId: S,\n fingerprint: S,\n state: literals(['spawned', 'admitted', 'retained']),\n admissionId: O(S),\n runId: O(S),\n reason: O(S),\n }),\n ),\n createdAt: S,\n});\nconst ErrorTargetSchema = Type.Union([\n Type.Object({ action: Type.Literal('create'), riftMissing: O(Type.Literal(true)) }),\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: (['host', '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(WorktreeRecordSchema) })),\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({\n branch: Type.String({ minLength: 1 }),\n baseRef: O(S),\n name: O(S),\n sparseProfile: O(SparseProfileSchema),\n selection: O(SelectionSchema),\n }),\n },\n responses: jsonApiResponses(Type.Object({ worktree: WorktreeRecordSchema }), 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: WorktreeRecordSchema })),\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 sparseProfiles: O(Type.Array(S)),\n defaultSparseProfile: 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.branches.delete',\n scope,\n basePath: 'git',\n path: '/branches',\n method: 'DELETE' as const,\n authentication: 'owner' as const,\n description: 'Safely delete a local branch that is not checked out. Never force-deletes unmerged work.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ deleted: B })),\n },\n {\n id: 'git.branches.open',\n scope,\n basePath: 'git',\n path: '/branches/open',\n method: 'POST' as const,\n authentication: 'owner' as const,\n description: 'Open the branch checkout in Finder. Local callers only, no client-supplied path.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ opened: B })),\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({\n mode: Type.Literal('existing-branch'),\n branch: S,\n remote: O(S),\n name: O(S),\n sparseProfile: O(SparseProfileSchema),\n selection: O(SelectionSchema),\n }),\n Type.Object({\n mode: Type.Literal('new-branch'),\n branch: S,\n baseRef: O(S),\n name: O(S),\n sparseProfile: O(SparseProfileSchema),\n selection: O(SelectionSchema),\n }),\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 host entries.\n ...(scope === 'host'\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: (['host', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.changes.channel',\n scope,\n service: 'po.hub',\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',\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',\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',\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,Q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,SAAS,UAAU;EAC3D;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;CACF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAwHa"}
|
package/dist/apiContracts.mjs
CHANGED
|
@@ -4,9 +4,11 @@ import { Type } from "typebox";
|
|
|
4
4
|
const S = Type.String();
|
|
5
5
|
const B = Type.Boolean();
|
|
6
6
|
const O = Type.Optional;
|
|
7
|
+
const SparseProfileSchema = Type.String({ pattern: "^[A-Za-z0-9][A-Za-z0-9_-]*$" });
|
|
8
|
+
const SelectionSchema = Type.Object({ profile: Type.Union([S, Type.Null()]) });
|
|
7
9
|
const literals = (values) => Type.Union(values.map((value) => Type.Literal(value)));
|
|
8
|
-
const
|
|
9
|
-
version: Type.Literal(
|
|
10
|
+
const WorktreeRecordSchema = Type.Object({
|
|
11
|
+
version: Type.Literal(2),
|
|
10
12
|
id: S,
|
|
11
13
|
branch: S,
|
|
12
14
|
baseRef: S,
|
|
@@ -20,6 +22,29 @@ const RecordSchema = Type.Object({
|
|
|
20
22
|
"closing",
|
|
21
23
|
"orphaned"
|
|
22
24
|
]),
|
|
25
|
+
setupStage: O(literals([
|
|
26
|
+
"none",
|
|
27
|
+
"started",
|
|
28
|
+
"failed",
|
|
29
|
+
"unconfirmed"
|
|
30
|
+
])),
|
|
31
|
+
backend: O(Type.Literal("rift")),
|
|
32
|
+
sparseProfile: O(SparseProfileSchema),
|
|
33
|
+
extraFolders: O(Type.Array(S)),
|
|
34
|
+
sparseFingerprint: O(S),
|
|
35
|
+
baseCommit: O(S),
|
|
36
|
+
workflow: O(Type.Object({
|
|
37
|
+
attemptId: S,
|
|
38
|
+
fingerprint: S,
|
|
39
|
+
state: literals([
|
|
40
|
+
"spawned",
|
|
41
|
+
"admitted",
|
|
42
|
+
"retained"
|
|
43
|
+
]),
|
|
44
|
+
admissionId: O(S),
|
|
45
|
+
runId: O(S),
|
|
46
|
+
reason: O(S)
|
|
47
|
+
})),
|
|
23
48
|
createdAt: S
|
|
24
49
|
});
|
|
25
50
|
const ErrorTargetSchema = Type.Union([Type.Object({
|
|
@@ -183,7 +208,7 @@ const apiContracts = defineApiContract({
|
|
|
183
208
|
...item,
|
|
184
209
|
required: item.name === "repositoryId"
|
|
185
210
|
})),
|
|
186
|
-
responses: jsonApiResponses(Type.Object({ worktrees: Type.Array(
|
|
211
|
+
responses: jsonApiResponses(Type.Object({ worktrees: Type.Array(WorktreeRecordSchema) }))
|
|
187
212
|
},
|
|
188
213
|
{
|
|
189
214
|
id: "git.create",
|
|
@@ -200,10 +225,12 @@ const apiContracts = defineApiContract({
|
|
|
200
225
|
schema: Type.Object({
|
|
201
226
|
branch: Type.String({ minLength: 1 }),
|
|
202
227
|
baseRef: O(S),
|
|
203
|
-
name: O(S)
|
|
228
|
+
name: O(S),
|
|
229
|
+
sparseProfile: O(SparseProfileSchema),
|
|
230
|
+
selection: O(SelectionSchema)
|
|
204
231
|
})
|
|
205
232
|
},
|
|
206
|
-
responses: jsonApiResponses(Type.Object({ worktree:
|
|
233
|
+
responses: jsonApiResponses(Type.Object({ worktree: WorktreeRecordSchema }), 201)
|
|
207
234
|
},
|
|
208
235
|
{
|
|
209
236
|
id: "git.close",
|
|
@@ -219,7 +246,7 @@ const apiContracts = defineApiContract({
|
|
|
219
246
|
required: false,
|
|
220
247
|
schema: B
|
|
221
248
|
}],
|
|
222
|
-
responses: jsonApiResponses(Type.Object({ worktree:
|
|
249
|
+
responses: jsonApiResponses(Type.Object({ worktree: WorktreeRecordSchema }))
|
|
223
250
|
},
|
|
224
251
|
...scope === "workspace" ? [
|
|
225
252
|
{
|
|
@@ -271,6 +298,8 @@ const apiContracts = defineApiContract({
|
|
|
271
298
|
repository: B,
|
|
272
299
|
current: O(S),
|
|
273
300
|
defaultBase: O(S),
|
|
301
|
+
sparseProfiles: O(Type.Array(S)),
|
|
302
|
+
defaultSparseProfile: O(S),
|
|
274
303
|
local: Type.Array(Type.Object({
|
|
275
304
|
name: S,
|
|
276
305
|
checkedOutAt: O(S)
|
|
@@ -326,12 +355,16 @@ const apiContracts = defineApiContract({
|
|
|
326
355
|
mode: Type.Literal("existing-branch"),
|
|
327
356
|
branch: S,
|
|
328
357
|
remote: O(S),
|
|
329
|
-
name: O(S)
|
|
358
|
+
name: O(S),
|
|
359
|
+
sparseProfile: O(SparseProfileSchema),
|
|
360
|
+
selection: O(SelectionSchema)
|
|
330
361
|
}), Type.Object({
|
|
331
362
|
mode: Type.Literal("new-branch"),
|
|
332
363
|
branch: S,
|
|
333
364
|
baseRef: O(S),
|
|
334
|
-
name: O(S)
|
|
365
|
+
name: O(S),
|
|
366
|
+
sparseProfile: O(SparseProfileSchema),
|
|
367
|
+
selection: O(SelectionSchema)
|
|
335
368
|
})])
|
|
336
369
|
},
|
|
337
370
|
responses: jsonApiResponses(Type.Object({
|
|
@@ -1 +1 @@
|
|
|
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'), riftMissing: O(Type.Literal(true)) }),\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: (['host', '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.branches.delete',\n scope,\n basePath: 'git',\n path: '/branches',\n method: 'DELETE' as const,\n authentication: 'owner' as const,\n description: 'Safely delete a local branch that is not checked out. Never force-deletes unmerged work.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ deleted: B })),\n },\n {\n id: 'git.branches.open',\n scope,\n basePath: 'git',\n path: '/branches/open',\n method: 'POST' as const,\n authentication: 'owner' as const,\n description: 'Open the branch checkout in Finder. Local callers only, no client-supplied path.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ opened: B })),\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 host entries.\n ...(scope === 'host'\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: (['host', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.changes.channel',\n scope,\n service: 'po.hub',\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',\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',\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',\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;CAAE,QAAQ,KAAK,QAAQ,QAAQ;CAAG,aAAa,EAAE,KAAK,QAAQ,IAAI,CAAC;AAAE,CAAC,GAClF,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,EAAE,CAAC;CACZ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a;GACb,OAAO;EACT;CACF,CAAC;AACH,CAAC"}
|
|
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 SparseProfileSchema = Type.String({ pattern: '^[A-Za-z0-9][A-Za-z0-9_-]*$' });\nconst SelectionSchema = Type.Object({ profile: Type.Union([S, Type.Null()]) });\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nexport const WorktreeRecordSchema = Type.Object({\n version: Type.Literal(2),\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 setupStage: O(literals(['none', 'started', 'failed', 'unconfirmed'])),\n backend: O(Type.Literal('rift')),\n sparseProfile: O(SparseProfileSchema),\n extraFolders: O(Type.Array(S)),\n sparseFingerprint: O(S),\n baseCommit: O(S),\n workflow: O(\n Type.Object({\n attemptId: S,\n fingerprint: S,\n state: literals(['spawned', 'admitted', 'retained']),\n admissionId: O(S),\n runId: O(S),\n reason: O(S),\n }),\n ),\n createdAt: S,\n});\nconst ErrorTargetSchema = Type.Union([\n Type.Object({ action: Type.Literal('create'), riftMissing: O(Type.Literal(true)) }),\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: (['host', '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(WorktreeRecordSchema) })),\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({\n branch: Type.String({ minLength: 1 }),\n baseRef: O(S),\n name: O(S),\n sparseProfile: O(SparseProfileSchema),\n selection: O(SelectionSchema),\n }),\n },\n responses: jsonApiResponses(Type.Object({ worktree: WorktreeRecordSchema }), 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: WorktreeRecordSchema })),\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 sparseProfiles: O(Type.Array(S)),\n defaultSparseProfile: 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.branches.delete',\n scope,\n basePath: 'git',\n path: '/branches',\n method: 'DELETE' as const,\n authentication: 'owner' as const,\n description: 'Safely delete a local branch that is not checked out. Never force-deletes unmerged work.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ deleted: B })),\n },\n {\n id: 'git.branches.open',\n scope,\n basePath: 'git',\n path: '/branches/open',\n method: 'POST' as const,\n authentication: 'owner' as const,\n description: 'Open the branch checkout in Finder. Local callers only, no client-supplied path.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ branch: S }) },\n responses: jsonApiResponses(Type.Object({ opened: B })),\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({\n mode: Type.Literal('existing-branch'),\n branch: S,\n remote: O(S),\n name: O(S),\n sparseProfile: O(SparseProfileSchema),\n selection: O(SelectionSchema),\n }),\n Type.Object({\n mode: Type.Literal('new-branch'),\n branch: S,\n baseRef: O(S),\n name: O(S),\n sparseProfile: O(SparseProfileSchema),\n selection: O(SelectionSchema),\n }),\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 host entries.\n ...(scope === 'host'\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: (['host', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.changes.channel',\n scope,\n service: 'po.hub',\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',\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',\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',\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,sBAAsB,KAAK,OAAO,EAAE,SAAS,8BAA8B,CAAC;AAClF,MAAM,kBAAkB,KAAK,OAAO,EAAE,SAAS,KAAK,MAA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