@agimon-ai/po-git 0.0.0-alpha.21 → 0.0.0-alpha.210

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.
Files changed (38) hide show
  1. package/LICENSE +110 -149
  2. package/README.md +91 -21
  3. package/dist/apiContracts.cjs +78 -12
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts +2 -2
  6. package/dist/apiContracts.d.mts.map +1 -1
  7. package/dist/apiContracts.mjs +78 -12
  8. package/dist/apiContracts.mjs.map +1 -1
  9. package/dist/extensions/native.mjs +2300 -548
  10. package/dist/extensions/native.mjs.map +1 -1
  11. package/dist/extensions/server.cjs +1578 -513
  12. package/dist/extensions/server.cjs.map +1 -1
  13. package/dist/extensions/server.d.mts.map +1 -1
  14. package/dist/extensions/server.mjs +1537 -472
  15. package/dist/extensions/server.mjs.map +1 -1
  16. package/dist/extensions/web.mjs +1791 -1376
  17. package/dist/extensions/web.mjs.map +1 -1
  18. package/dist/gitDependencies-D8bKxZSc.cjs +2690 -0
  19. package/dist/gitDependencies-D8bKxZSc.cjs.map +1 -0
  20. package/dist/gitDependencies-Delu4xip.mjs +2432 -0
  21. package/dist/gitDependencies-Delu4xip.mjs.map +1 -0
  22. package/dist/index.cjs +13 -22
  23. package/dist/index.d.mts +266 -14
  24. package/dist/index.d.mts.map +1 -1
  25. package/dist/index.mjs +3 -22
  26. package/dist/po-runtime-identity.json +1 -0
  27. package/llms.txt +3 -3
  28. package/locales/vi.json +325 -0
  29. package/locales/zh-CN.json +325 -0
  30. package/package.json +115 -22
  31. package/src/prompts/codemode-how-to-git/SKILL.md +137 -0
  32. package/dist/index.cjs.map +0 -1
  33. package/dist/index.mjs.map +0 -1
  34. package/dist/worktreeOperations-Cd8Q12L4.mjs +0 -1064
  35. package/dist/worktreeOperations-Cd8Q12L4.mjs.map +0 -1
  36. package/dist/worktreeOperations-Dxs3txKL.cjs +0 -1220
  37. package/dist/worktreeOperations-Dxs3txKL.cjs.map +0 -1
  38. package/src/prompts/po-use-git/SKILL.md +0 -87
package/LICENSE CHANGED
@@ -1,149 +1,110 @@
1
- License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
- "Business Source License" is a trademark of MariaDB Corporation Ab.
3
-
4
- Parameters
5
-
6
- Licensor: Agimon Pty Ltd
7
- Licensed Work: Po, the software in the Po source repository and the
8
- packages released from it, in each version released by
9
- the Licensor.
10
- The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
- Material identified as third-party in the "Third-party
12
- components" section at the end of this file or in a
13
- NOTICE file, and any package or directory whose own
14
- license file grants a different license, is not part of
15
- the Licensed Work and remains under its own license.
16
- Additional Use Grant: You may make production use of the Licensed Work if
17
- your use is Eligible Use. "Eligible Use" is production use that falls
18
- within at least one of the following:
19
-
20
- (a) Personal Use. Use by an individual for their own personal purposes,
21
- and not on behalf of, or for the benefit of, an employer, client, or
22
- other Organization. Use by an individual in the course of employment
23
- or engagement by an Organization is use by that Organization.
24
-
25
- (b) Small Organization Use. Use by or on behalf of an Organization whose
26
- Annual Revenue is less than USD 1,000,000.
27
-
28
- (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
- Revenue, by (i) an Organization registered or recognized as a
30
- non-profit or charitable organization under the laws of its
31
- jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
- college, or university, for teaching, learning, or academic research;
33
- or (iii) a publicly funded research institution, for its research.
34
-
35
- (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
- service provider, regardless of its own Annual Revenue, solely to
37
- build, deploy, host, operate, or support the Licensed Work for a client
38
- whose own use would be Eligible Use under (a), (b), or (c). A service
39
- provider's use for its own purposes is Eligible Use only if the service
40
- provider itself qualifies under (b) or (c).
41
-
42
-
43
- Hosted services. Offering the Licensed Work to third parties as a hosted
44
- or managed service whose primary value is the Licensed Work is Eligible
45
- Use only if each such third party's own use would be Eligible Use.
46
-
47
- Definitions. "Organization" means any company, partnership, sole
48
- proprietorship, trust, association, government body, or other entity, and
49
- includes an individual acting in a business or professional capacity.
50
- "Affiliate" means any entity that directly or indirectly controls, is
51
- controlled by, or is under common control with an Organization, where
52
- "control" means ownership of more than 50% of the voting interests of an
53
- entity or the power to direct its management and policies by contract or
54
- otherwise. "Annual Revenue" means the total gross revenue of an
55
- Organization and all of its Affiliates combined, from all sources and
56
- whether or not related to the Licensed Work, for its most recently
57
- completed fiscal year, or, if it has not completed a fiscal year, for the
58
- twelve months before the use (or since its formation, if shorter),
59
- converted into US dollars at the average exchange rate for that period.
60
- Proceeds of equity or debt financing are not revenue.
61
-
62
- Threshold. If an Organization stops qualifying under (b), its existing
63
- production use remains Eligible Use for 90 days after it stops
64
- qualifying, after which it must obtain a commercial license or stop
65
- production use. Use that was Eligible Use when it occurred never requires
66
- a commercial license after the fact.
67
- Change Date: Four years from the date a version of the Licensed Work
68
- is first publicly released by the Licensor.
69
- Change License: Apache License, Version 2.0
70
-
71
- For information about alternative licensing arrangements for the Licensed
72
- Work, please visit: https://agimon.ai/licensing
73
-
74
- Notice
75
-
76
- The Business Source License (this document, or the "License") is not an Open
77
- Source license. However, the Licensed Work will eventually be made available
78
- under an Open Source License, as stated in this License.
79
-
80
- -----------------------------------------------------------------------------
81
-
82
- Business Source License 1.1
83
-
84
- Terms
85
-
86
- The Licensor hereby grants you the right to copy, modify, create derivative
87
- works, redistribute, and make non-production use of the Licensed Work. The
88
- Licensor may make an Additional Use Grant, above, permitting limited
89
- production use.
90
-
91
- Effective on the Change Date, or the fourth anniversary of the first publicly
92
- available distribution of a specific version of the Licensed Work under this
93
- License, whichever comes first, the Licensor hereby grants you rights under
94
- the terms of the Change License, and the rights granted in the paragraph
95
- above terminate.
96
-
97
- If your use of the Licensed Work does not comply with the requirements
98
- currently in effect as described in this License, you must purchase a
99
- commercial license from the Licensor, its affiliated entities, or authorized
100
- resellers, or you must refrain from using the Licensed Work.
101
-
102
- All copies of the original and modified Licensed Work, and derivative works
103
- of the Licensed Work, are subject to this License. This License applies
104
- separately for each version of the Licensed Work and the Change Date may vary
105
- for each version of the Licensed Work released by Licensor.
106
-
107
- You must conspicuously display this License on each original or modified copy
108
- of the Licensed Work. If you receive the Licensed Work in original or
109
- modified form from a third party, the terms and conditions set forth in this
110
- License apply to your use of that work.
111
-
112
- Any use of the Licensed Work in violation of this License will automatically
113
- terminate your rights under this License for the current and all other
114
- versions of the Licensed Work.
115
-
116
- This License does not grant you any right in any trademark or logo of
117
- Licensor or its affiliates (provided that you may use a trademark or logo of
118
- Licensor as expressly required by this License).
119
-
120
- TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
- AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
- EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
- TITLE.
125
-
126
- MariaDB hereby grants you permission to use this License’s text to license
127
- your works, and to refer to it using the trademark “Business Source License”,
128
- as long as you comply with the Covenants of Licensor below.
129
-
130
- Covenants of Licensor
131
-
132
- In consideration of the right to use this License’s text and the “Business
133
- Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
- other recipients of the licensed work to be provided by Licensor:
135
-
136
- 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
- or a license that is compatible with GPL Version 2.0 or a later version,
138
- where “compatible” means that software provided under the Change License can
139
- be included in a program with software provided under GPL Version 2.0 or a
140
- later version. Licensor may specify additional Change Licenses without
141
- limitation.
142
-
143
- 2. To either: (a) specify an additional grant of rights to use that does not
144
- impose any additional restriction on the right granted in this License, as
145
- the Additional Use Grant; or (b) insert the text “None”.
146
-
147
- 3. To specify a Change Date.
148
-
149
- 4. Not to modify this License in any other way.
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Agimon Pty Ltd
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @agimon-ai/po-git
2
2
 
3
- Git worktree sessions for Po: spawn an isolated worktree with its own session and manage it from the parent
3
+ Git worktree sessions for Po: spawn an isolated worktree with its own session and manage it from the parent.
4
4
 
5
5
  This package is a composable [Po](https://www.npmjs.com/package/@agimon-ai/po) subsystem. Select it through the native distribution configuration.
6
6
 
@@ -11,11 +11,11 @@ This package is a composable [Po](https://www.npmjs.com/package/@agimon-ai/po) s
11
11
 
12
12
  ## Install
13
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 plugins; there is no standalone Pi entry.
14
+ Add `@agimon-ai/po-git` to a selected layer in `.po/presets.yaml`, then run `po sync`. Native metadata selects its server and browser plugins; there is no standalone Pi entry.
15
15
 
16
16
  ## Use
17
17
 
18
- Use the browser worktree controls or the native worktree tool.
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,6 +27,91 @@ 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
+
49
+ ### Worktree setup
50
+
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:
52
+
53
+ ```yaml
54
+ setup:
55
+ - pnpm install --frozen-lockfile
56
+ - pnpm build
57
+ ```
58
+
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.
114
+
30
115
  ## Package behavior
31
116
 
32
117
  ### Review this session's changes
@@ -53,31 +138,16 @@ The setup lives outside every repository in `~/.po/git/credentials.json` (folder
53
138
 
54
139
  ## Help
55
140
 
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.
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`.
65
142
 
66
143
  ## Development
67
144
 
68
145
  ```bash
69
- pnpm build
70
- pnpm typecheck
71
- pnpm test
72
- pnpm lint
73
- pnpm exec vibe-lint check .
74
- npm pack --dry-run
146
+ pnpm exec nx run-many -t lint typecheck build test -p @agimon-ai/po-git
75
147
  ```
76
148
 
77
149
  Maintained by [Agimon](https://agimon.ai/about).
78
150
 
79
151
  ## License
80
152
 
81
- Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
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.
153
+ Functional Source License 1.1, MIT Future License (FSL-1.1-MIT): free for any purpose except a Competing Use; each version converts to MIT two years after release. See [LICENSE](LICENSE).
@@ -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 RecordSchema = typebox.Type.Object({
13
- version: typebox.Type.Literal(1),
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,9 +26,35 @@ 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
- const ErrorTargetSchema = typebox.Type.Union([typebox.Type.Object({ action: typebox.Type.Literal("create") }), typebox.Type.Object({
54
+ const ErrorTargetSchema = typebox.Type.Union([typebox.Type.Object({
55
+ action: typebox.Type.Literal("create"),
56
+ riftMissing: O(typebox.Type.Literal(true))
57
+ }), typebox.Type.Object({
30
58
  action: typebox.Type.Literal("close"),
31
59
  id: S
32
60
  })]);
@@ -171,7 +199,7 @@ const query = [{
171
199
  const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
172
200
  version: 1,
173
201
  dynamic: [],
174
- http: ["global", "workspace"].flatMap((scope) => [
202
+ http: ["host", "workspace"].flatMap((scope) => [
175
203
  {
176
204
  id: "git.list",
177
205
  scope,
@@ -184,7 +212,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
184
212
  ...item,
185
213
  required: item.name === "repositoryId"
186
214
  })),
187
- responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktrees: typebox.Type.Array(RecordSchema) }))
215
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktrees: typebox.Type.Array(WorktreeRecordSchema) }))
188
216
  },
189
217
  {
190
218
  id: "git.create",
@@ -201,10 +229,12 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
201
229
  schema: typebox.Type.Object({
202
230
  branch: typebox.Type.String({ minLength: 1 }),
203
231
  baseRef: O(S),
204
- name: O(S)
232
+ name: O(S),
233
+ sparseProfile: O(SparseProfileSchema),
234
+ selection: O(SelectionSchema)
205
235
  })
206
236
  },
207
- responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: RecordSchema }), 201)
237
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: WorktreeRecordSchema }), 201)
208
238
  },
209
239
  {
210
240
  id: "git.close",
@@ -220,7 +250,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
220
250
  required: false,
221
251
  schema: B
222
252
  }],
223
- responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: RecordSchema }))
253
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ worktree: WorktreeRecordSchema }))
224
254
  },
225
255
  ...scope === "workspace" ? [
226
256
  {
@@ -272,6 +302,8 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
272
302
  repository: B,
273
303
  current: O(S),
274
304
  defaultBase: O(S),
305
+ sparseProfiles: O(typebox.Type.Array(S)),
306
+ defaultSparseProfile: O(S),
275
307
  local: typebox.Type.Array(typebox.Type.Object({
276
308
  name: S,
277
309
  checkedOutAt: O(S)
@@ -282,6 +314,36 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
282
314
  }))
283
315
  }))
284
316
  },
317
+ {
318
+ id: "git.branches.delete",
319
+ scope,
320
+ basePath: "git",
321
+ path: "/branches",
322
+ method: "DELETE",
323
+ authentication: "owner",
324
+ description: "Safely delete a local branch that is not checked out. Never force-deletes unmerged work.",
325
+ body: {
326
+ required: true,
327
+ contentType: "application/json",
328
+ schema: typebox.Type.Object({ branch: S })
329
+ },
330
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ deleted: B }))
331
+ },
332
+ {
333
+ id: "git.branches.open",
334
+ scope,
335
+ basePath: "git",
336
+ path: "/branches/open",
337
+ method: "POST",
338
+ authentication: "owner",
339
+ description: "Open the branch checkout in Finder. Local callers only, no client-supplied path.",
340
+ body: {
341
+ required: true,
342
+ contentType: "application/json",
343
+ schema: typebox.Type.Object({ branch: S })
344
+ },
345
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ opened: B }))
346
+ },
285
347
  {
286
348
  id: "git.sessions.create",
287
349
  scope,
@@ -297,12 +359,16 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
297
359
  mode: typebox.Type.Literal("existing-branch"),
298
360
  branch: S,
299
361
  remote: O(S),
300
- name: O(S)
362
+ name: O(S),
363
+ sparseProfile: O(SparseProfileSchema),
364
+ selection: O(SelectionSchema)
301
365
  }), typebox.Type.Object({
302
366
  mode: typebox.Type.Literal("new-branch"),
303
367
  branch: S,
304
368
  baseRef: O(S),
305
- name: O(S)
369
+ name: O(S),
370
+ sparseProfile: O(SparseProfileSchema),
371
+ selection: O(SelectionSchema)
306
372
  })])
307
373
  },
308
374
  responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
@@ -311,7 +377,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
311
377
  }), 201)
312
378
  }
313
379
  ] : [],
314
- ...scope === "global" ? [{
380
+ ...scope === "host" ? [{
315
381
  id: "git.review.summary",
316
382
  scope: "session",
317
383
  basePath: "git",
@@ -337,7 +403,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
337
403
  responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ReviewFileSchema)
338
404
  }] : []
339
405
  ]),
340
- sockets: ["global", "workspace"].flatMap((scope) => [
406
+ sockets: ["host", "workspace"].flatMap((scope) => [
341
407
  {
342
408
  id: "git.changes.channel",
343
409
  scope,