@intentic/sandbox-contract 1.375.0 → 1.377.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/contracts/access-profiles.contract.d.ts.map +1 -1
  2. package/dist/contracts/access-profiles.contract.js +3 -1
  3. package/dist/contracts/access-profiles.contract.js.map +1 -1
  4. package/dist/contracts/accounts.contract.d.ts +4 -0
  5. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  6. package/dist/contracts/accounts.contract.js +6 -5
  7. package/dist/contracts/accounts.contract.js.map +1 -1
  8. package/dist/contracts/agent.contract.d.ts +4 -0
  9. package/dist/contracts/agent.contract.d.ts.map +1 -1
  10. package/dist/contracts/agents.contract.d.ts +76 -0
  11. package/dist/contracts/agents.contract.d.ts.map +1 -1
  12. package/dist/contracts/areas.contract.d.ts.map +1 -1
  13. package/dist/contracts/areas.contract.js +3 -1
  14. package/dist/contracts/areas.contract.js.map +1 -1
  15. package/dist/contracts/compliance.contract.js +1 -1
  16. package/dist/contracts/compliance.contract.js.map +1 -1
  17. package/dist/contracts/git.contract.d.ts +10 -0
  18. package/dist/contracts/git.contract.d.ts.map +1 -1
  19. package/dist/contracts/git.contract.js +11 -2
  20. package/dist/contracts/git.contract.js.map +1 -1
  21. package/dist/contracts/panels.contract.d.ts +1 -0
  22. package/dist/contracts/panels.contract.d.ts.map +1 -1
  23. package/dist/contracts/ports.contract.js +1 -1
  24. package/dist/contracts/ports.contract.js.map +1 -1
  25. package/dist/contracts/privacy.contract.d.ts.map +1 -1
  26. package/dist/contracts/privacy.contract.js +6 -5
  27. package/dist/contracts/privacy.contract.js.map +1 -1
  28. package/dist/contracts/runner.contract.d.ts +123 -123
  29. package/dist/contracts/runs.contract.d.ts +2 -1
  30. package/dist/contracts/runs.contract.d.ts.map +1 -1
  31. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  32. package/dist/contracts/secrets.contract.js +4 -3
  33. package/dist/contracts/secrets.contract.js.map +1 -1
  34. package/dist/contracts/settings.contract.js +1 -1
  35. package/dist/contracts/settings.contract.js.map +1 -1
  36. package/dist/contracts/system.contract.d.ts +24 -0
  37. package/dist/contracts/system.contract.d.ts.map +1 -1
  38. package/dist/contracts/workspace.contract.d.ts +17 -0
  39. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  40. package/dist/events/system-events.d.ts +16 -0
  41. package/dist/events/system-events.d.ts.map +1 -1
  42. package/dist/formats/archives.d.ts.map +1 -0
  43. package/dist/formats/archives.js.map +1 -0
  44. package/dist/formats/packed-formats.d.ts.map +1 -0
  45. package/dist/formats/packed-formats.js.map +1 -0
  46. package/dist/ids/conversation-ids.d.ts +4 -0
  47. package/dist/ids/conversation-ids.d.ts.map +1 -1
  48. package/dist/ids/conversation-ids.js +1 -0
  49. package/dist/ids/conversation-ids.js.map +1 -1
  50. package/dist/index.d.ts +168 -31
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/models/account-moves.d.ts +8 -0
  53. package/dist/models/account-moves.d.ts.map +1 -0
  54. package/dist/models/account-moves.js +3 -0
  55. package/dist/models/account-moves.js.map +1 -0
  56. package/dist/policy/command-classes.d.ts.map +1 -1
  57. package/dist/policy/command-classes.js +1 -1
  58. package/dist/policy/command-classes.js.map +1 -1
  59. package/dist/protocol/member-reach.d.ts +2 -1
  60. package/dist/protocol/member-reach.d.ts.map +1 -1
  61. package/dist/protocol/member-reach.js +5 -1
  62. package/dist/protocol/member-reach.js.map +1 -1
  63. package/dist/protocol/raw/raw-json-routes.d.ts +37 -0
  64. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  65. package/dist/protocol/raw/raw-routes.d.ts +10 -4
  66. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  67. package/dist/protocol/raw/raw-routes.js +9 -9
  68. package/dist/protocol/raw/raw-routes.js.map +1 -1
  69. package/dist/protocol/route-meta.d.ts +3 -0
  70. package/dist/protocol/route-meta.d.ts.map +1 -1
  71. package/dist/protocol/route-meta.js +1 -0
  72. package/dist/protocol/route-meta.js.map +1 -1
  73. package/dist/schemas/agent.d.ts +8 -0
  74. package/dist/schemas/agent.d.ts.map +1 -1
  75. package/dist/schemas/agent.js +4 -1
  76. package/dist/schemas/agent.js.map +1 -1
  77. package/dist/schemas/agents-list.d.ts +8 -0
  78. package/dist/schemas/agents-list.d.ts.map +1 -1
  79. package/dist/schemas/agents.d.ts +12 -0
  80. package/dist/schemas/agents.d.ts.map +1 -1
  81. package/dist/schemas/agents.js +4 -1
  82. package/dist/schemas/agents.js.map +1 -1
  83. package/dist/schemas/conversation-links.d.ts +9 -0
  84. package/dist/schemas/conversation-links.d.ts.map +1 -1
  85. package/dist/schemas/conversation-links.js +13 -0
  86. package/dist/schemas/conversation-links.js.map +1 -1
  87. package/dist/schemas/git/git.d.ts +3 -0
  88. package/dist/schemas/git/git.d.ts.map +1 -1
  89. package/dist/schemas/git/git.js +2 -1
  90. package/dist/schemas/git/git.js.map +1 -1
  91. package/dist/schemas/git/index-run.d.ts +1 -0
  92. package/dist/schemas/git/index-run.d.ts.map +1 -1
  93. package/dist/schemas/members.d.ts +60 -1
  94. package/dist/schemas/members.d.ts.map +1 -1
  95. package/dist/schemas/members.js +42 -5
  96. package/dist/schemas/members.js.map +1 -1
  97. package/dist/schemas/panels.d.ts +2 -0
  98. package/dist/schemas/panels.d.ts.map +1 -1
  99. package/dist/schemas/panels.js +4 -0
  100. package/dist/schemas/panels.js.map +1 -1
  101. package/dist/schemas/providers/account-sharing.d.ts +2 -0
  102. package/dist/schemas/providers/account-sharing.d.ts.map +1 -1
  103. package/dist/schemas/providers/provider-oauth.d.ts +4 -0
  104. package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
  105. package/dist/schemas/providers/provider-oauth.js +4 -0
  106. package/dist/schemas/providers/provider-oauth.js.map +1 -1
  107. package/dist/schemas/run-targets.d.ts +11 -4
  108. package/dist/schemas/run-targets.d.ts.map +1 -1
  109. package/dist/schemas/run-targets.js +8 -2
  110. package/dist/schemas/run-targets.js.map +1 -1
  111. package/dist/schemas/shared.d.ts +7 -0
  112. package/dist/schemas/shared.d.ts.map +1 -1
  113. package/dist/schemas/shared.js +13 -0
  114. package/dist/schemas/shared.js.map +1 -1
  115. package/dist/schemas/workspace/workspace-repos.d.ts +2 -0
  116. package/dist/schemas/workspace/workspace-repos.d.ts.map +1 -1
  117. package/dist/schemas/workspace/workspace-repos.js +2 -1
  118. package/dist/schemas/workspace/workspace-repos.js.map +1 -1
  119. package/dist/schemas/workspace/workspace-tree.d.ts +16 -0
  120. package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
  121. package/dist/schemas/workspace/workspace-tree.js +4 -0
  122. package/dist/schemas/workspace/workspace-tree.js.map +1 -1
  123. package/dist/text/git-branch-switch.d.ts +2 -0
  124. package/dist/text/git-branch-switch.d.ts.map +1 -0
  125. package/dist/text/git-branch-switch.js +7 -0
  126. package/dist/text/git-branch-switch.js.map +1 -0
  127. package/package.json +5 -5
  128. package/src/contracts/access-profiles.contract.ts +3 -1
  129. package/src/contracts/accounts.contract.ts +9 -5
  130. package/src/contracts/areas.contract.ts +3 -1
  131. package/src/contracts/compliance.contract.ts +1 -1
  132. package/src/contracts/git.contract.ts +12 -2
  133. package/src/contracts/ports.contract.ts +1 -1
  134. package/src/contracts/privacy.contract.ts +10 -8
  135. package/src/contracts/secrets.contract.ts +6 -3
  136. package/src/contracts/settings.contract.ts +1 -1
  137. package/src/ids/conversation-ids.ts +4 -0
  138. package/src/models/account-moves.test.ts +24 -0
  139. package/src/models/account-moves.ts +26 -0
  140. package/src/policy/command-classes.ts +1 -4
  141. package/src/policy/tests/command-classes.test.ts +23 -0
  142. package/src/protocol/member-reach.test.ts +61 -4
  143. package/src/protocol/member-reach.ts +12 -4
  144. package/src/protocol/raw/raw-routes.ts +19 -16
  145. package/src/protocol/route-meta.ts +5 -0
  146. package/src/schemas/agent.ts +4 -1
  147. package/src/schemas/agents.ts +11 -3
  148. package/src/schemas/conversation-links.ts +25 -0
  149. package/src/schemas/git/git.ts +2 -2
  150. package/src/schemas/members.test.ts +53 -1
  151. package/src/schemas/members.ts +93 -11
  152. package/src/schemas/panels.ts +7 -0
  153. package/src/schemas/providers/provider-oauth.ts +6 -0
  154. package/src/schemas/run-targets.ts +35 -7
  155. package/src/schemas/shared.ts +21 -0
  156. package/src/schemas/workspace/workspace-repos.ts +5 -3
  157. package/src/schemas/workspace/workspace-tree.ts +8 -0
  158. package/src/text/git-branch-switch.ts +16 -0
  159. package/dist/text/archives.d.ts.map +0 -1
  160. package/dist/text/archives.js.map +0 -1
  161. package/dist/text/packed-formats.d.ts.map +0 -1
  162. package/dist/text/packed-formats.js.map +0 -1
  163. /package/dist/{text → formats}/archives.d.ts +0 -0
  164. /package/dist/{text → formats}/archives.js +0 -0
  165. /package/dist/{text → formats}/packed-formats.d.ts +0 -0
  166. /package/dist/{text → formats}/packed-formats.js +0 -0
  167. /package/src/{text → formats}/archives.test.ts +0 -0
  168. /package/src/{text → formats}/archives.ts +0 -0
  169. /package/src/{text → formats}/packed-formats.ts +0 -0
@@ -16,9 +16,10 @@ import {
16
16
  } from "../schemas/privacy.js";
17
17
  import { OkSchema } from "../schemas/shared.js";
18
18
 
19
- // The privacy shield's policy, its log, and the datasets taught to it. The policy is the owner's alone: it is stored
20
- // off the workspace (an agent could otherwise turn off the shield it is held to), and only the owner may change it.
21
- // Teaching values only ever masks more, so the agent's CLI may do it; forgetting them is the owner's.
19
+ // The privacy shield's policy, its log, and the datasets taught to it. The policy is stored off the workspace (an agent
20
+ // could otherwise turn off the shield it is held to), and only a person changes it: the owner, Full access, or someone
21
+ // given the Privacy shield (members.ts `ManageRightSchema`), who also read masked values back. Teaching values only ever
22
+ // masks more, so the agent's CLI may do it; forgetting them is a person's call too.
22
23
  export const privacyContract = {
23
24
  status: procedure
24
25
  .route({
@@ -38,7 +39,7 @@ export const privacyContract = {
38
39
  description:
39
40
  "Replaces the policy whole. Turning the shield on puts every turn that starts from then on, whose runtime can be shielded, behind the gateway, and refuses the turns that cannot be shielded on an untrusted provider; a turn already running keeps the route it started with. A change to what is masked or trusted holds from the next model request.",
40
41
  })
41
- .meta({ floor: "owner", control: "never", panel: false })
42
+ .meta({ floor: "maintainer", right: "privacy", control: "never", panel: false })
42
43
  .input(PrivacyShieldPolicySchema)
43
44
  .output(OkSchema),
44
45
  log: procedure
@@ -58,7 +59,7 @@ export const privacyContract = {
58
59
  description:
59
60
  "The value each token stands for, from the vault, so the owner can check what the shield masked and spot a value it should have left alone. Only the owner may ask; a token the vault never gave out is left out.",
60
61
  })
61
- .meta({ floor: "owner", control: "never", panel: false })
62
+ .meta({ floor: "maintainer", right: "privacy", control: "never", panel: false })
62
63
  .input(PrivacyRevealSchema)
63
64
  .output(z.record(z.string(), z.string())),
64
65
  image: procedure
@@ -69,7 +70,7 @@ export const privacyContract = {
69
70
  description:
70
71
  "The picture as it was and as the shield painted it before it left, for a log entry's image replacement. The picture before holds the personal data, so only the owner may ask. Only the most recent images are kept; an older one answers not found.",
71
72
  })
72
- .meta({ floor: "owner", control: "never", panel: false })
73
+ .meta({ floor: "maintainer", right: "privacy", control: "never", panel: false })
73
74
  .input(z.object({ id: z.string().regex(PRIVACY_IMAGE_ID) }))
74
75
  .output(PrivacyImagePairSchema),
75
76
  dictionary: procedure
@@ -91,6 +92,7 @@ export const privacyContract = {
91
92
  description:
92
93
  "What the shield would mask in the text with the policy as saved (every detector, the name lists, the owner's own rules, the values the vault knows) and what found each. Nothing is given a token or kept, whatever the switch says.",
93
94
  })
95
+ .meta({ right: "privacy" })
94
96
  .input(z.object({ text: z.string().max(PRIVACY_PREVIEW_MAX) }))
95
97
  .output(PrivacyPreviewSchema),
96
98
  sources: procedure
@@ -110,7 +112,7 @@ export const privacyContract = {
110
112
  description:
111
113
  "Each value is masked wherever it appears from now on, in every form it is written, whether or not the detectors would have found it. Teaching only ever masks more, so the agent may do it.",
112
114
  })
113
- .meta({ agent: true })
115
+ .meta({ agent: true, right: "privacy" })
114
116
  .input(
115
117
  z.object({
116
118
  source: z.string().min(1).max(200).describe("Where the values came from: a file and its column, a table."),
@@ -126,7 +128,7 @@ export const privacyContract = {
126
128
  description:
127
129
  "Stops matching the values taught from one source. Tokens already given to them still resolve, so earlier conversations keep reading right.",
128
130
  })
129
- .meta({ floor: "owner", control: "never", panel: false })
131
+ .meta({ floor: "maintainer", right: "privacy", control: "never", panel: false })
130
132
  .input(z.object({ source: z.string().min(1).max(200) }))
131
133
  .output(z.object({ forgotten: z.number().int() })),
132
134
  };
@@ -30,7 +30,10 @@ import { SandboxNeedsSchema, SandboxPasswordsActivitySchema, SandboxPasswordsSch
30
30
  import { OkSchema } from "../schemas/shared.js";
31
31
 
32
32
  // Credentials are the operating tier's, reads included: maintainer is the highest revokable grant, and no token's.
33
- const secretRoute = procedure.meta({ floor: "maintainer", control: "never" });
33
+ const secretRoute = procedure.meta({ floor: "maintainer", control: "never", right: "secrets" });
34
+ // The two that act on the owner's own computers (their keyrings, the window that has focus there): Secrets given to
35
+ // someone does not reach them, and the handlers hold them to the owner.
36
+ const ownerKeyringRoute = procedure.meta({ floor: "maintainer", control: "never" });
34
37
 
35
38
  // User-supplied secrets, in the gitignored desired-state/.env once DevOps is active and the sandbox's own store before
36
39
  // it; `apply` reloads them, no restart. `inventory` aggregates every store (never values) and always answers. `reveal` alone
@@ -177,7 +180,7 @@ export const secretsContract = {
177
180
  .output(SecretProgramGuardSetResultSchema),
178
181
  // The owner's own Type into…, never the agent's: it types into whatever has focus, which only a person at that
179
182
  // computer can aim.
180
- typeInto: secretRoute
183
+ typeInto: ownerKeyringRoute
181
184
  .route({
182
185
  method: "POST",
183
186
  path: "/secrets/type-into",
@@ -197,7 +200,7 @@ export const secretsContract = {
197
200
  "Every connected computer with a keyring this sandbox can reach: whether it answers and is unlocked, how many of its entries are shared here, and whom it is paired with. Names and counts only, never values.",
198
201
  })
199
202
  .output(SandboxKeyringsSchema),
200
- keyringPair: secretRoute
203
+ keyringPair: ownerKeyringRoute
201
204
  .route({
202
205
  method: "POST",
203
206
  path: "/secrets/keyrings/pair",
@@ -33,7 +33,7 @@ export const settingsContract = {
33
33
  .output(AgentDomainPolicySchema),
34
34
  setAgentDomain: procedure
35
35
  .route({ method: "POST", path: "/settings/agent-domain", summary: "Choose the agent execution domain" })
36
- .meta({ floor: "owner", panel: false, control: "never" })
36
+ .meta({ floor: "maintainer", panel: false, control: "never" })
37
37
  .input(AgentDomainPolicySchema)
38
38
  .output(OkSchema),
39
39
  aiLiteracy: procedure.route({ method: "GET", path: "/settings/ai-literacy/{locale}", summary: "Read the AI literacy notice and your confirmation" })
@@ -166,6 +166,10 @@ const repoSlug = (repo: string): string =>
166
166
  .slice(0, REPO_SLUG_MAX)
167
167
  .replace(/^-+|-+$/g, "") || "repo";
168
168
  export const ciFixConversationId = (repo: string, runId: number): string => `${CI_FIX_PREFIX}${repoSlug(repo)}-${runId}`;
169
+ // The title a CI fix conversation opens with: the daemon names it so (ci-fix.ts), and the board's card standing in for it
170
+ // while the press is out (Pipelines, `chat.launchAgent`) wears the same words, so the one hands over to the other unchanged.
171
+ export const ciFixTitle = (run: { readonly title?: string | undefined; readonly repo: string }): string =>
172
+ `Fix CI: ${run.title ?? run.repo}`.slice(0, CONVERSATION_TITLE_MAX);
169
173
 
170
174
  // FNV-1a, not a cryptographic hash: nothing here is secret, the only requirement is the same failure yields the same
171
175
  // seven characters in every browser and in node. The one spelling: what a failing main owes is named by it too (a
@@ -0,0 +1,24 @@
1
+ import type { AccountState } from "../schemas/providers/plan-limits.js";
2
+ import { moveDestination } from "./account-moves.js";
3
+
4
+ const entry = (id: string, state: AccountState, flapping?: boolean) => ({ id, state, flapping });
5
+ const SPENT: AccountState = { kind: "spent" };
6
+ const UNREAD: AccountState = { kind: "unknown" };
7
+ const SEATLESS: AccountState = { kind: "blocked", fix: "admin", reason: "no seat" };
8
+
9
+ test("proven room wins wherever the provider publishes an allowance, and nothing else does", () => {
10
+ expect(moveDestination([entry("unread", UNREAD), entry("low", { kind: "ready", room: 5 }), entry("high", { kind: "ready", room: 60 })], true)?.id).toBe("high");
11
+ expect(moveDestination([entry("unread", UNREAD), entry("spent", SPENT)], true)).toBeUndefined();
12
+ });
13
+
14
+ // The 2026-10-29 sandbox: a Devin account refused for its weekly quota, two connected beside it that nothing had refused.
15
+ test("a provider that publishes no allowance moves onto an account nothing has refused", () => {
16
+ expect(moveDestination([entry("spent", SPENT), entry("second", UNREAD), entry("third", UNREAD)], false)?.id).toBe("second");
17
+ expect(moveDestination([entry("flapping", UNREAD, true), entry("steady", UNREAD)], false)?.id).toBe("steady");
18
+ });
19
+
20
+ test("never onto a spent, blocked or at-the-line account, whatever the provider publishes", () => {
21
+ for (const readable of [true, false]) {
22
+ expect(moveDestination([entry("spent", SPENT), entry("seatless", SEATLESS), entry("line", { kind: "ready", room: 0 })], readable)).toBeUndefined();
23
+ }
24
+ });
@@ -0,0 +1,26 @@
1
+ import type { AccountState } from "../schemas/providers/plan-limits.js";
2
+ import { preferredAccount, roomiestAccount } from "./plan-pools.js";
3
+
4
+ /* WHERE A TURN GOES OFF AN ACCOUNT THAT CANNOT SERVE IT, for every provider whose accounts a turn can name. Read by the
5
+ daemon's limit move (sibling-account.ts) and its move off a blocked account (blocked-account.ts), and by the editor's
6
+ offer to continue elsewhere (limitFallback.ts) and its reading of where a turn will run (servingAccount.ts), so the four
7
+ never disagree.
8
+
9
+ Proven room comes first. A provider that publishes no allowance (Devin, Cursor, the minted keys, a vendor CLI's
10
+ sign-in) never proves room, so there a move may also land on an account nothing has refused, since a refusal is the
11
+ only thing that marks one spent. Before this, a Devin turn refused on a spent account was held for a press, with two
12
+ accounts beside it that nothing had refused (2026-10-29). The turn cannot bounce back and forth: by the time the next
13
+ move is read, the account it just left is on file as spent. */
14
+
15
+ interface MovableAccount {
16
+ readonly state: AccountState;
17
+ readonly flapping?: boolean | undefined;
18
+ }
19
+
20
+ /**
21
+ * The account a turn moves to among `others` (the account it leaves already left out). That is the roomiest with proven
22
+ * room, else, where `readable` is false (the provider publishes no allowance), the steadiest unmeasured one. Ties keep the
23
+ * caller's order. Undefined: nowhere to go.
24
+ */
25
+ export const moveDestination = <T extends MovableAccount>(others: readonly T[], readable: boolean): T | undefined =>
26
+ roomiestAccount(others) ?? (readable ? undefined : preferredAccount(others.filter((entry) => entry.state.kind === "unknown")));
@@ -2,6 +2,7 @@ import { HISTORY_ROOT, WORKSPACE_ROOT } from "@intentic/constants";
2
2
  import { type CommandClass, CommandClassSchema, type CommandLocus } from "../schemas/command-admission.js";
3
3
  import { SECRET_REFERENCE } from "../schemas/needs.js";
4
4
  import { inertRegions, isLive } from "../text/shell-regions.js";
5
+ import { GIT_BRANCH_SWITCH } from "../text/git-branch-switch.js";
5
6
 
6
7
  // Classifies a shell command, shared by the sandbox gate and the machine agent's shell tool so they can't drift on what
7
8
  // a class means. A match now only means a judge should look, not a verdict, so tables should be over-inclusive, except
@@ -68,10 +69,6 @@ const GIT_DESTRUCTIVE = [
68
69
  /\bgit\s+filter-branch\b/,
69
70
  ];
70
71
 
71
- // `switch` exists only to move HEAD, so every form of it counts. `checkout` is two commands wearing one name: with
72
- // `-- <path>` or a bare `.` it restores files and moves nothing, and those are the common ones, so they are cut out.
73
- const GIT_BRANCH_SWITCH = [/\bgit\s+switch\b/, /\bgit\s+checkout\b(?![^|;&]*\s--\s)(?![^|;&]*\s\.(?:\s|$))/];
74
-
75
72
  // The credential is IN the command, not in a file; there is nothing for a filesystem to fact-check here.
76
73
  const SECRET_REFERENCES = [SECRET_REFERENCE];
77
74
 
@@ -655,6 +655,29 @@ describe("git.branch-switch", () => {
655
655
  test("the card points at the verb, not the whole line", () => {
656
656
  expect(marked("cd repo && git switch main && pnpm build", "git.branch-switch")).toEqual(["git switch"]);
657
657
  });
658
+
659
+ // Naming the directory, or setting a config, on the way to the verb is the same move.
660
+ test("git's own options before the verb are read through", () => {
661
+ for (const command of [
662
+ "git -C /work checkout feature",
663
+ "git -C intentic switch -c topic",
664
+ "git -c core.hooksPath=x checkout --detach",
665
+ "git --git-dir=/history/gits/root --work-tree=/work checkout feature",
666
+ ]) {
667
+ expect(shared(command), command).toContain("git.branch-switch");
668
+ }
669
+ expect(marked("git -C /work switch main", "git.branch-switch")).toEqual(["git -C /work switch"]);
670
+ });
671
+
672
+ test("setting HEAD through plumbing is a switch, reading it is not", () => {
673
+ expect(shared("git symbolic-ref HEAD refs/heads/feature")).toContain("git.branch-switch");
674
+ expect(shared("git symbolic-ref -m why HEAD refs/heads/feature")).toContain("git.branch-switch");
675
+ expect(shared("git symbolic-ref --short HEAD")).not.toContain("git.branch-switch");
676
+ expect(shared("git -C /work checkout -- src/app.ts")).not.toContain("git.branch-switch");
677
+ // A separator with no path after it restores nothing: git switches all the same.
678
+ expect(shared("git checkout feature --")).toContain("git.branch-switch");
679
+ expect(shared("git checkout feature -- && pnpm build")).toContain("git.branch-switch");
680
+ });
658
681
  });
659
682
 
660
683
  describe("Windows' own shells", () => {
@@ -15,7 +15,7 @@ describe("routeFloor", () => {
15
15
  expect(routeFloor("POST", "/system/presence")).toBe("viewer");
16
16
  expect(routeFloor("POST", "/workspace/media-ticket")).toBe("viewer");
17
17
  expect(routeFloor("DELETE", "/members/self")).toBe("viewer");
18
- // One's own passkeys are identity, like staying signed in; the handler holds another member's to the owner.
18
+ // One's own passkeys are identity, like staying signed in; the handler holds another member's to whoever runs people.
19
19
  expect(routeFloor("GET", "/system/passkeys")).toBe("viewer");
20
20
  expect(routeFloor("POST", "/system/passkeys/register/options")).toBe("viewer");
21
21
  expect(routeFloor("POST", "/system/passkeys/register")).toBe("viewer");
@@ -86,9 +86,66 @@ describe("routeFloor", () => {
86
86
  expect(routeFloor("POST", "/no/such/route")).toBe("maintainer");
87
87
  expect(routeFloor("POST", "/members")).toBe("maintainer");
88
88
  expect(routeFloor("POST", "/system/sessions/revoke")).toBe("maintainer");
89
- // The require-passkey switch and its recovery codes keep the mutation default under their ownership gate.
90
- expect(routeFloor("POST", "/system/passkeys/policy")).toBe("maintainer");
91
- expect(routeFloor("POST", "/system/passkeys/recovery")).toBe("maintainer");
89
+ // The require-passkey switch and its recovery codes are the owner's own door, and are floored there.
90
+ expect(routeFloor("POST", "/system/passkeys/policy")).toBe("owner");
91
+ expect(routeFloor("POST", "/system/passkeys/recovery")).toBe("owner");
92
+ expect(routeFloor("POST", "/platform/relink")).toBe("owner");
93
+ });
94
+ });
95
+
96
+ describe("memberRefusal for a person given part of the sandbox", () => {
97
+ const collaborator = { role: "collaborator" as const, agents: "run" as const };
98
+
99
+ test("People & access opens the roster, its requests, areas, profiles and the preview guard, and nothing else", () => {
100
+ const people = { ...collaborator, manages: ["people" as const] };
101
+ for (const [method, path] of [
102
+ ["GET", "/members"],
103
+ ["POST", "/members"],
104
+ ["DELETE", "/members"],
105
+ ["GET", "/members/requests"],
106
+ ["DELETE", "/members/requests"],
107
+ ["POST", "/areas"],
108
+ ["DELETE", "/areas/docs"],
109
+ ["GET", "/access/profiles"],
110
+ ["POST", "/access/profiles"],
111
+ ["POST", "/previews/guard"],
112
+ ] as const) {
113
+ expect(memberRefusal(people, method, path)).toBeUndefined();
114
+ expect(memberRefusal(collaborator, method, path)).toMatchObject({ floor: "maintainer", reason: "floor" });
115
+ }
116
+ expect(memberRefusal(people, "PUT", "/secrets/gates/GITHUB_TOKEN")).toMatchObject({ floor: "maintainer" });
117
+ expect(memberRefusal(people, "POST", "/privacy/shield")).toMatchObject({ floor: "maintainer" });
118
+ });
119
+
120
+ test("Secrets opens the Secrets page whole but never the owner's own keyrings", () => {
121
+ const secrets = { ...collaborator, manages: ["secrets" as const] };
122
+ expect(memberRefusal(secrets, "GET", "/secrets/inventory")).toBeUndefined();
123
+ expect(memberRefusal(secrets, "PUT", "/secrets/gates/GITHUB_TOKEN")).toBeUndefined();
124
+ expect(memberRefusal(secrets, "PUT", "/secrets/hosts/GITHUB_TOKEN")).toBeUndefined();
125
+ expect(memberRefusal(secrets, "PUT", "/secrets/policy/gh")).toBeUndefined();
126
+ expect(memberRefusal(secrets, "POST", "/secrets/type-into")).toMatchObject({ floor: "maintainer" });
127
+ expect(memberRefusal(secrets, "POST", "/secrets/keyrings/pair")).toMatchObject({ floor: "maintainer" });
128
+ });
129
+
130
+ test("the privacy shield and AI accounts of one's own each open their own routes", () => {
131
+ const privacy = { ...collaborator, manages: ["privacy" as const] };
132
+ expect(memberRefusal(privacy, "POST", "/privacy/shield")).toBeUndefined();
133
+ expect(memberRefusal(privacy, "POST", "/privacy/reveal")).toBeUndefined();
134
+ expect(memberRefusal(privacy, "POST", "/privacy/known/forget")).toBeUndefined();
135
+ const own = { ...collaborator, manages: ["ownAccounts" as const] };
136
+ expect(memberRefusal(own, "POST", "/accounts/claude/login/start")).toBeUndefined();
137
+ expect(memberRefusal(own, "POST", "/accounts/claude/disconnect")).toBeUndefined();
138
+ expect(memberRefusal(collaborator, "POST", "/accounts/claude/login/start")).toMatchObject({ floor: "maintainer" });
139
+ });
140
+
141
+ test("Full access reaches what the owner ran alone before, short of the owner's own door", () => {
142
+ const maintainer = { role: "maintainer" as const };
143
+ expect(memberRefusal(maintainer, "GET", "/members")).toBeUndefined();
144
+ expect(memberRefusal(maintainer, "POST", "/privacy/reveal")).toBeUndefined();
145
+ expect(memberRefusal(maintainer, "POST", "/settings/agent-domain")).toBeUndefined();
146
+ expect(memberRefusal(maintainer, "POST", "/system/enroll/code")).toBeUndefined();
147
+ expect(memberRefusal(maintainer, "POST", "/system/passkeys/policy")).toMatchObject({ floor: "owner" });
148
+ expect(memberRefusal(maintainer, "POST", "/platform/relink")).toMatchObject({ floor: "owner" });
92
149
  });
93
150
  });
94
151
 
@@ -1,4 +1,4 @@
1
- import type { AgentAccess } from "../schemas/members.js";
1
+ import type { AgentAccess, ManageRight } from "../schemas/members.js";
2
2
  import { type MemberRole, roleAtLeast } from "../schemas/shared.js";
3
3
  import { defaultFloor } from "./route-meta.js";
4
4
  import { isAttachmentPath } from "../state/workspace-state.js";
@@ -7,8 +7,9 @@ import { sandboxRouteFor } from "../index.js";
7
7
  // Role floors: the minimum trust tier each route demands, read from the route's own RouteMeta (route-meta.ts). One
8
8
  // function for both sides: the daemon's bearer middleware refuses with it right after the caller's role resolves, and
9
9
  // the editor asks it before sending, so a request the daemon would refuse is never sent and the two cannot disagree.
10
- // A floor, not the whole answer: operating routes still keep their own in-route maintainer gates; membership stays
11
- // owner-only.
10
+ // A floor, not the whole answer: operating routes still keep their own in-route gates (members.ts `holdsRight`,
11
+ // `peopleChangeRefusal`). A route that runs one part of the sandbox names it (`right`), and a person given that part
12
+ // clears its floor whatever their tier.
12
13
 
13
14
  // `target` is the upload's `?path=`, written by the caller: isAttachmentPath folds `..` first, so a traversal out of
14
15
  // the attachments dir never buys an attachment's floor.
@@ -34,6 +35,7 @@ export const memberRefusal = (
34
35
  readonly areas?: readonly string[] | undefined;
35
36
  readonly agents?: AgentAccess | undefined;
36
37
  readonly lands?: true | undefined;
38
+ readonly manages?: readonly ManageRight[] | undefined;
37
39
  },
38
40
  method: string,
39
41
  path: string,
@@ -45,7 +47,7 @@ export const memberRefusal = (
45
47
  : { error: "not open to a guest member", floor: "viewer", reason: "guest" };
46
48
  }
47
49
  const floor = routeFloor(method, path, target);
48
- if (!roleAtLeast(caller.role, floor)) {
50
+ if (!roleAtLeast(caller.role, floor) && !givenRight(caller, method, path)) {
49
51
  return { error: `${floor} access required`, floor, reason: "floor" };
50
52
  }
51
53
  // The collaborator floor is driving agents. A person who edits files by hand without running agents holds the
@@ -53,6 +55,12 @@ export const memberRefusal = (
53
55
  return floor === "collaborator" && caller.agents === "off" ? { error: "running agents is not on for you here", floor, reason: "agents-off" } : undefined;
54
56
  };
55
57
 
58
+ // Whether the caller was given the part of the sandbox this route runs (route-meta.ts `right`).
59
+ const givenRight = (caller: { readonly manages?: readonly ManageRight[] | undefined }, method: string, path: string): boolean => {
60
+ const right = sandboxRouteFor(method, path)?.meta.right;
61
+ return right !== undefined && (caller.manages?.includes(right) ?? false);
62
+ };
63
+
56
64
  // Whether a guest member may reach this request at all: a route on the guest's list, or an upload into the attachments
57
65
  // that ride with its own message. A route added later is closed to a guest until it says otherwise.
58
66
  export const guestReach = (method: string, path: string, target?: string): boolean => {
@@ -65,8 +65,9 @@ export const RAW_ROUTES = {
65
65
  "GET /system/desktop-view": { auth: "door", beforeBoot: true, control: "never" },
66
66
  // Deploy-target enrollment, gated by the connect token.
67
67
  "POST /enroll": { auth: "door", control: "never" },
68
- // A server-connect code for the owner's command: its single-use enroll token stands in for the connect token.
69
- "POST /system/enroll/code": { floor: "owner", control: "never" },
68
+ // A server-connect code for the command that connects a server: its single-use enroll token stands in for the connect
69
+ // token. Anybody who operates the sandbox may connect a server to it.
70
+ "POST /system/enroll/code": { control: "never" },
70
71
  // An event automation's webhook, gated by the automation's own token.
71
72
  "POST /automations/{id}/fire": { auth: "door" },
72
73
  // The release gate a pipeline runner waits on, gated by the workflow's minted gate token.
@@ -84,21 +85,22 @@ export const RAW_ROUTES = {
84
85
  "GET /intake/{id}/config": { auth: "door", embedded: true },
85
86
  "GET /intake/{id}/challenge": { auth: "door", embedded: true },
86
87
  "POST /intake/{id}/report": { auth: "door", embedded: true },
87
- // The roster is ownership's to read and change; giving up one's own grant is every tier's. Reading it is floored at
88
- // the owner here as well as in its handler (members.routes.ts), so the editor knows before asking.
89
- "GET /members": { floor: "owner", control: "never" },
90
- "POST /members": { control: "never" },
91
- "DELETE /members": { control: "never" },
88
+ // The roster is for whoever runs people and access (Full access, or the People & access right) to read and change;
89
+ // giving up one's own grant is every tier's. Reading it is floored here as well as in its handler (members.routes.ts),
90
+ // so the editor knows before asking; what someone below Full access may change is the handler's (peopleChangeRefusal).
91
+ "GET /members": { floor: "maintainer", right: "people", control: "never" },
92
+ "POST /members": { right: "people", control: "never" },
93
+ "DELETE /members": { right: "people", control: "never" },
92
94
  "DELETE /members/self": { floor: "viewer", guest: true, control: "never" },
93
95
  // What one's own grant allows, read by the editor to offer only what will be taken.
94
96
  "GET /members/self": { floor: "viewer", guest: true, control: "never" },
95
- // Asking the owner for more access is every member's, a guest's included, from wherever they were refused; reading
96
- // and dismissing the requests is the owner's, beside the roster they are answered on (schemas/members.ts).
97
+ // Asking for more access is every member's, a guest's included, from wherever they were refused; reading and
98
+ // dismissing the requests is for whoever runs people and access, beside the roster they are answered on.
97
99
  "POST /members/requests": { floor: "viewer", guest: true, control: "never" },
98
- "GET /members/requests": { floor: "owner", control: "never" },
99
- "DELETE /members/requests": { floor: "owner", control: "never" },
100
+ "GET /members/requests": { floor: "maintainer", right: "people", control: "never" },
101
+ "DELETE /members/requests": { right: "people", control: "never" },
100
102
  // The owner's Reconnect: register with the platform now, having it adopt the sandbox first when it holds no record.
101
- "POST /platform/relink": { control: "never" },
103
+ "POST /platform/relink": { floor: "owner", control: "never" },
102
104
  "GET /environment": {},
103
105
  "GET /environment/contents": {},
104
106
  "POST /environment/approve": {},
@@ -282,16 +284,17 @@ export const RAW_ROUTES = {
282
284
  "POST /system/control/tokens": { control: "never" },
283
285
  "GET /system/control/tokens": { floor: "maintainer", control: "never" },
284
286
  "DELETE /system/control/tokens/{id}": { control: "never" },
285
- // One's own passkeys are identity, like staying signed in; the policy and recovery codes are ownership's.
287
+ // One's own passkeys are identity, like staying signed in; the policy and recovery codes are the owner's own door, so
288
+ // they stay ownership's whoever else runs the sandbox.
286
289
  "GET /system/passkeys": { guest: true, control: "never" },
287
290
  "POST /system/passkeys/register/options": { floor: "viewer", guest: true, enrolment: true, control: "never" },
288
291
  "POST /system/passkeys/register": { floor: "viewer", guest: true, enrolment: true, control: "never" },
289
292
  // The assertion has no bearer yet, since it is how one is minted.
290
293
  "POST /system/passkeys/assert/options": { auth: "door", beforeBoot: true, control: "never" },
291
294
  "POST /system/passkeys/assert": { auth: "door", beforeBoot: true, control: "never" },
292
- "POST /system/passkeys/policy": { control: "never" },
293
- "POST /system/passkeys/recovery": { control: "never" },
294
- // One's own passkey; the handler holds another member's to the owner.
295
+ "POST /system/passkeys/policy": { floor: "owner", control: "never" },
296
+ "POST /system/passkeys/recovery": { floor: "owner", control: "never" },
297
+ // One's own passkey; the handler holds another member's to whoever runs people and access, and the owner's to the owner.
295
298
  "DELETE /system/passkeys/{id}": { floor: "viewer", guest: true, control: "never" },
296
299
  // Checks its own bearer, since the require-passkey policy would otherwise hold out the owner it exists for.
297
300
  "POST /system/session/recover": { auth: "door", beforeBoot: true, control: "never" },
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import type { ManageRight } from "../schemas/members.js";
2
3
  import type { MemberRole } from "../schemas/shared.js";
3
4
 
4
5
  // Every route's policy, declared beside it: how a request authenticates, which member tier and which machine
@@ -21,6 +22,9 @@ export interface RouteMeta {
21
22
  readonly stream?: true;
22
23
  // The lowest member role that may call it. Absent: viewer for a read (GET, HEAD), maintainer for anything else.
23
24
  readonly floor?: MemberRole;
25
+ // The part of the sandbox it runs (members.ts `ManageRightSchema`): a person below the floor who was given that part
26
+ // reaches it too. The handler holds anything finer (members.ts `peopleChangeRefusal`).
27
+ readonly right?: ManageRight;
24
28
  // On a guest member's allowlist, which is the whole of what a guest reaches.
25
29
  readonly guest?: true;
26
30
  // Beyond the guest list, for a home-only member (members.ts `agents: "home"`) whose work lands by itself
@@ -61,6 +65,7 @@ const ACCESS = {
61
65
  beforeBoot: (meta) => meta.beforeBoot === true,
62
66
  stream: (meta) => meta.stream === true,
63
67
  floor: (meta, method) => meta.floor ?? defaultFloor(method),
68
+ right: (meta) => meta.right ?? "none",
64
69
  guest: (meta) => meta.guest === true,
65
70
  home: (meta) => meta.home ?? "none",
66
71
  attachmentFloor: (meta) => meta.attachmentFloor ?? "none",
@@ -7,7 +7,8 @@ import { NATIVE_PROVIDERS } from "../models/provider-specs.js";
7
7
  import { AgentPlacementSchema } from "../protocol/doors/runner-protocol.js";
8
8
  import { MENTION_LIMIT } from "../text/mentions.js";
9
9
  import { entryId } from "./internal.js";
10
- import { FRESH_OF_DESCRIPTION, FreshOfSchema, freshOfIssues } from "./conversation-links.js";
10
+ import { FRESH_OF_DESCRIPTION, FreshOfSchema, FROM_BRANCH_DESCRIPTION, freshOfIssues, fromBranchIssues } from "./conversation-links.js";
11
+ import { RepoBranchSchema } from "./shared.js";
11
12
  // Agent runtimes the daemon can serve: native providers have dedicated adapters, `endpoint/<id>` names an installed
12
13
  // endpoint capability, anything else is an ACP agent capability id. A bare string, not an enum, so an unknown id is a
13
14
  // clean error, not a contract change.
@@ -202,6 +203,7 @@ const AgentTurnFieldsSchema = z.object({
202
203
  forkOf: ForkOfSchema.optional().describe("Where this conversation was cut from, on its first turn only. Only the client knows this, so only the client can say it."),
203
204
  // A fresh session's origin, on its first turn only; requires an isolated conversationId the registry has never seen.
204
205
  freshOf: FreshOfSchema.optional().describe(FRESH_OF_DESCRIPTION),
206
+ fromBranch: RepoBranchSchema.optional().describe(FROM_BRANCH_DESCRIPTION),
205
207
  // The browser sends the chosen model per turn; the provider token is the sandbox's own stored credential.
206
208
  model: z.string().optional().describe("Which model to use. Leave it out for the provider's default."),
207
209
  // Audience only, never model routing: `runRole` is what fills a model in. A run somebody pressed and is
@@ -312,6 +314,7 @@ export const AgentTurnSchema = AgentTurnFieldsSchema
312
314
  message: 'forkOf.files "then" requires isolated',
313
315
  })
314
316
  .superRefine(freshOfIssues)
317
+ .superRefine(fromBranchIssues)
315
318
  .refine((turn) => turn.sendAt === undefined || turn.sendAfter === undefined, {
316
319
  message: "sendAt and sendAfter are two different holds: name one",
317
320
  })
@@ -3,6 +3,8 @@ import { LandingDeliverySchema } from "./project-delivery.js";
3
3
  import { AgentNextSchema } from "./agent-next.js";
4
4
  import { z } from "zod";
5
5
  import { AgentHarnessSchema, AgentOriginSchema, AgentProviderSchema, ConversationQueueSchema, ForkedFromSchema, FreshSessionSchema } from "./agent.js";
6
+ import { FROM_BRANCHES_DESCRIPTION } from "./conversation-links.js";
7
+ import { RepoBranchSchema } from "./shared.js";
6
8
  import { LoopStateSchema } from "./loops.js";
7
9
  import { LimitPolicySchema, RetryPolicySchema, RoomPolicySchema, TurnBreakPolicySchema, TurnBreakSchema } from "./turn-break.js";
8
10
  import { KeepWarmSchema } from "./keep-warm.js";
@@ -26,8 +28,10 @@ export { AgentReactionSchema, ReactorSchema, SessionOwnerSchema, type AgentReact
26
28
  // nothing is left half-done
27
29
  // `stopped` is its own value, never `error` (a deliberate stop is not a failure) or `interrupted` (which allows an
28
30
  // automatic re-run)
29
- // resuming: the turn was killed by something the daemon is already undoing (a credential re-mint, an outage backoff);
30
- // never persisted, since a daemon restart forgets the resume and the turn's own last-written ending becomes true again
31
+ // resuming: the turn was killed by something the daemon is already undoing (a credential re-mint, an outage backoff),
32
+ // or the sandbox has a turn of its own on its way to the conversation that has not begun yet (a child's report, a watch
33
+ // that fired, a held turn's re-run, words let go behind a turn that ended); never persisted, since a daemon restart
34
+ // forgets the resume and the turn's own last-written ending becomes true again
31
35
  export const AgentStatusSchema = z.enum([
32
36
  "idle",
33
37
  "running",
@@ -396,6 +400,8 @@ export const AgentSummarySchema = z.object({
396
400
  fresh: FreshSessionSchema.optional().describe(
397
401
  "Set on a conversation started on another conversation's work without its messages (a code review, a test pass, a person's own ask): which one, for what, and when. Absent for every other conversation.",
398
402
  ),
403
+ // Latched by the opening compose (placement.branches): the repositories it works on a branch of, which its land commits onto.
404
+ branches: z.array(RepoBranchSchema).optional().describe(FROM_BRANCHES_DESCRIPTION),
399
405
  // Latched on the opening turn (ids/conversation-ids.ts homeConversationId). Rides the summary because it decides who
400
406
  // may see the row at all (auth/fleet-scope.ts visibleTo): its owner, and the sandbox's owner.
401
407
  home: z
@@ -522,7 +528,9 @@ export const AgentSummarySchema = z.object({
522
528
  code: z
523
529
  .string()
524
530
  .optional()
525
- .describe("Which kind of failure it was, when the sandbox could tell: unlinked when its copy lost its link to the workspace. Absent otherwise."),
531
+ .describe(
532
+ "Which kind of failure it was, when the sandbox could tell: unlinked when its copy lost its link to the workspace, off_main_line when the shared workspace was moved off its main line and the work waits until it is back. Absent otherwise.",
533
+ ),
526
534
  at: z.number().describe("When it failed, in milliseconds."),
527
535
  })
528
536
  .optional()
@@ -65,3 +65,28 @@ export const freshOfIssues = (
65
65
  ctx.addIssue({ code: "custom", message: "a conversation cannot start fresh on its own work" });
66
66
  }
67
67
  };
68
+
69
+ // A conversation started from a branch of one repository rather than from the main line: cut from the branch's tip there,
70
+ // kept on it, and its finished work committed onto it, while the shared checkout never leaves its main line. Latched by
71
+ // the opening turn as the placement's `branches`.
72
+ export const FROM_BRANCH_DESCRIPTION =
73
+ "Start this conversation from a branch of one repository instead of the main line: its copy of that repository is cut from the branch's tip, kept on it, and its finished work is committed onto that branch rather than landed in the shared workspace. First turn only, only on a private copy here, and never together with `freshOf` or `forkOf`.";
74
+
75
+ // The turn's own rules for `fromBranch`: a new private copy of its own here, one start at a time.
76
+ export const fromBranchIssues = (
77
+ turn: { readonly fromBranch?: unknown; readonly conversationId?: string | undefined; readonly isolated?: boolean | undefined; readonly forkOf?: unknown; readonly freshOf?: unknown },
78
+ ctx: z.RefinementCtx,
79
+ ): void => {
80
+ if (turn.fromBranch === undefined) {
81
+ return;
82
+ }
83
+ if (turn.conversationId === undefined || turn.isolated !== true) {
84
+ ctx.addIssue({ code: "custom", message: "fromBranch requires an isolated conversationId" });
85
+ }
86
+ if (turn.forkOf !== undefined || turn.freshOf !== undefined) {
87
+ ctx.addIssue({ code: "custom", message: "fromBranch is a start of its own: not together with forkOf or freshOf" });
88
+ }
89
+ };
90
+
91
+ export const FROM_BRANCHES_DESCRIPTION =
92
+ "The branches this conversation was started from, one per repository it works on a branch of: its copy of each is kept on that branch, and its land commits onto it instead of reaching the shared workspace. Absent for a conversation on the main line.";
@@ -3,7 +3,7 @@ import { AgentProviderSchema } from "../agent.js";
3
3
  import { LandConflictSchema, LandedMessageSchema } from "../agents.js";
4
4
  import { CommandRunSchema } from "../ci.js";
5
5
  import { RefNameSchema } from "../internal.js";
6
- import { RepoParamSchema } from "../shared.js";
6
+ import { MainBranchSchema, RepoParamSchema } from "../shared.js";
7
7
 
8
8
  // Which of the working tree's diffs a row is about; a path can be both staged and edited again, so a side is never
9
9
  // defaulted.
@@ -293,8 +293,8 @@ export const IGNORED_OUTPUTS_LISTED = 200;
293
293
  export const RepoChangesSchema = z.object({
294
294
  // The {repo} param the per-repo git routes accept: "root" or a repo id (its root-relative dir).
295
295
  repo: z.string(),
296
- // Absent on an unborn HEAD (initialized, never committed).
297
296
  branch: z.string().optional().describe("The checked-out branch. Absent in a repository that has no commits yet."),
297
+ mainBranch: MainBranchSchema,
298
298
  // Staging a conflicted path (`git add`) is how you tell git it is resolved.
299
299
  conflicted: z
300
300
  .array(GitChangeSchema)