@intentic/sandbox-contract 1.376.0 → 1.378.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/contracts/access-profiles.contract.d.ts.map +1 -1
- package/dist/contracts/access-profiles.contract.js +3 -1
- package/dist/contracts/access-profiles.contract.js.map +1 -1
- package/dist/contracts/accounts.contract.d.ts +4 -0
- package/dist/contracts/accounts.contract.d.ts.map +1 -1
- package/dist/contracts/accounts.contract.js +6 -5
- package/dist/contracts/accounts.contract.js.map +1 -1
- package/dist/contracts/agent.contract.d.ts +4 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +76 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/areas.contract.d.ts.map +1 -1
- package/dist/contracts/areas.contract.js +3 -1
- package/dist/contracts/areas.contract.js.map +1 -1
- package/dist/contracts/compliance.contract.js +1 -1
- package/dist/contracts/compliance.contract.js.map +1 -1
- package/dist/contracts/diff.contract.d.ts +9 -0
- package/dist/contracts/diff.contract.d.ts.map +1 -1
- package/dist/contracts/git.contract.d.ts +372 -1
- package/dist/contracts/git.contract.d.ts.map +1 -1
- package/dist/contracts/git.contract.js +47 -17
- package/dist/contracts/git.contract.js.map +1 -1
- package/dist/contracts/ports.contract.js +1 -1
- package/dist/contracts/ports.contract.js.map +1 -1
- package/dist/contracts/privacy.contract.d.ts.map +1 -1
- package/dist/contracts/privacy.contract.js +6 -5
- package/dist/contracts/privacy.contract.js.map +1 -1
- package/dist/contracts/runner.contract.d.ts +123 -123
- package/dist/contracts/secrets.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.js +4 -3
- package/dist/contracts/secrets.contract.js.map +1 -1
- package/dist/contracts/settings.contract.js +1 -1
- package/dist/contracts/settings.contract.js.map +1 -1
- package/dist/contracts/system.contract.d.ts +54 -30
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +46 -0
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +2 -2
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/system-events.d.ts +16 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/index.d.ts +535 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/policy/command-classes.d.ts.map +1 -1
- package/dist/policy/command-classes.js +1 -1
- package/dist/policy/command-classes.js.map +1 -1
- package/dist/protocol/member-reach.d.ts +2 -1
- package/dist/protocol/member-reach.d.ts.map +1 -1
- package/dist/protocol/member-reach.js +5 -1
- package/dist/protocol/member-reach.js.map +1 -1
- package/dist/protocol/raw/raw-json-routes.d.ts +37 -0
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +10 -4
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +9 -9
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/protocol/route-meta.d.ts +3 -0
- package/dist/protocol/route-meta.d.ts.map +1 -1
- package/dist/protocol/route-meta.js +1 -0
- package/dist/protocol/route-meta.js.map +1 -1
- package/dist/schemas/agent.d.ts +8 -0
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +4 -1
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents-list.d.ts +8 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +12 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +4 -1
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/conversation-links.d.ts +9 -0
- package/dist/schemas/conversation-links.d.ts.map +1 -1
- package/dist/schemas/conversation-links.js +13 -0
- package/dist/schemas/conversation-links.js.map +1 -1
- package/dist/schemas/diff.d.ts +9 -0
- package/dist/schemas/diff.d.ts.map +1 -1
- package/dist/schemas/diff.js +2 -0
- package/dist/schemas/diff.js.map +1 -1
- package/dist/schemas/git/branch-landings.d.ts +27 -0
- package/dist/schemas/git/branch-landings.d.ts.map +1 -0
- package/dist/schemas/git/branch-landings.js +20 -0
- package/dist/schemas/git/branch-landings.js.map +1 -0
- package/dist/schemas/git/git-history.d.ts +80 -0
- package/dist/schemas/git/git-history.d.ts.map +1 -1
- package/dist/schemas/git/git-history.js +17 -17
- package/dist/schemas/git/git-history.js.map +1 -1
- package/dist/schemas/git/git-view.d.ts +32 -0
- package/dist/schemas/git/git-view.d.ts.map +1 -0
- package/dist/schemas/git/git-view.js +19 -0
- package/dist/schemas/git/git-view.js.map +1 -0
- package/dist/schemas/git/git.d.ts +48 -0
- package/dist/schemas/git/git.d.ts.map +1 -1
- package/dist/schemas/git/git.js +12 -10
- package/dist/schemas/git/git.js.map +1 -1
- package/dist/schemas/git/index-run.d.ts +6 -0
- package/dist/schemas/git/index-run.d.ts.map +1 -1
- package/dist/schemas/git/index-run.js +2 -2
- package/dist/schemas/git/index-run.js.map +1 -1
- package/dist/schemas/members.d.ts +60 -1
- package/dist/schemas/members.d.ts.map +1 -1
- package/dist/schemas/members.js +42 -5
- package/dist/schemas/members.js.map +1 -1
- package/dist/schemas/providers/account-sharing.d.ts +2 -0
- package/dist/schemas/providers/account-sharing.d.ts.map +1 -1
- package/dist/schemas/providers/provider-oauth.d.ts +4 -0
- package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/providers/provider-oauth.js +4 -0
- package/dist/schemas/providers/provider-oauth.js.map +1 -1
- package/dist/schemas/shared.d.ts +7 -0
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/schemas/shared.js +13 -0
- package/dist/schemas/shared.js.map +1 -1
- package/dist/schemas/workspace/workspace-tree.d.ts +31 -0
- package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-tree.js +7 -3
- package/dist/schemas/workspace/workspace-tree.js.map +1 -1
- package/dist/text/git-branch-switch.d.ts +2 -0
- package/dist/text/git-branch-switch.d.ts.map +1 -0
- package/dist/text/git-branch-switch.js +7 -0
- package/dist/text/git-branch-switch.js.map +1 -0
- package/package.json +5 -5
- package/src/contracts/access-profiles.contract.ts +3 -1
- package/src/contracts/accounts.contract.ts +9 -5
- package/src/contracts/areas.contract.ts +3 -1
- package/src/contracts/compliance.contract.ts +1 -1
- package/src/contracts/git.contract.ts +50 -17
- package/src/contracts/ports.contract.ts +1 -1
- package/src/contracts/privacy.contract.ts +10 -8
- package/src/contracts/secrets.contract.ts +6 -3
- package/src/contracts/settings.contract.ts +1 -1
- package/src/contracts/workspace.contract.ts +2 -2
- package/src/policy/command-classes.ts +1 -4
- package/src/policy/tests/command-classes.test.ts +23 -0
- package/src/protocol/member-reach.test.ts +61 -4
- package/src/protocol/member-reach.ts +12 -4
- package/src/protocol/raw/raw-routes.ts +19 -16
- package/src/protocol/route-meta.ts +5 -0
- package/src/schemas/agent.ts +4 -1
- package/src/schemas/agents.ts +7 -1
- package/src/schemas/conversation-links.ts +25 -0
- package/src/schemas/diff.ts +2 -0
- package/src/schemas/git/branch-landings.ts +25 -0
- package/src/schemas/git/git-history.ts +17 -17
- package/src/schemas/git/git-view.ts +22 -0
- package/src/schemas/git/git.ts +13 -13
- package/src/schemas/git/index-run.ts +2 -2
- package/src/schemas/members.test.ts +53 -1
- package/src/schemas/members.ts +93 -11
- package/src/schemas/providers/provider-oauth.ts +6 -0
- package/src/schemas/shared.ts +21 -0
- package/src/schemas/workspace/workspace-tree.ts +11 -3
- package/src/text/git-branch-switch.ts +16 -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
|
|
20
|
-
//
|
|
21
|
-
//
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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:
|
|
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:
|
|
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: "
|
|
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" })
|
|
@@ -245,7 +245,7 @@ export const workspaceContract = {
|
|
|
245
245
|
"Removes one entry and everything under it. It goes to the trash rather than being erased, and the answer carries the id that brings it back through the restore call for a day. The path travels in the body rather than the address, the same as every other write in this group.",
|
|
246
246
|
})
|
|
247
247
|
.meta({ floor: "writer" })
|
|
248
|
-
.input(WorkspaceFileQuerySchema)
|
|
248
|
+
.input(WorkspaceFileQuerySchema.extend({ view: WorkspaceScopeSchema.optional() }))
|
|
249
249
|
.output(WorkspaceDeletedSchema),
|
|
250
250
|
restore: procedure
|
|
251
251
|
.route({
|
|
@@ -287,7 +287,7 @@ export const workspaceContract = {
|
|
|
287
287
|
"Unpacks a zip or tar already in the workspace into a new folder beside it, named after the archive. An archive that is one folder of its own name lands as that folder rather than as it twice, and a .gz, .bz2, .xz or .zst holding a single file lands as that file. Nothing is ever written over: the answer says where it landed. Formats with no tool here, such as .7z and .rar, are refused.",
|
|
288
288
|
})
|
|
289
289
|
.meta({ floor: "writer" })
|
|
290
|
-
.input(WorkspaceFileQuerySchema)
|
|
290
|
+
.input(WorkspaceFileQuerySchema.extend({ view: WorkspaceScopeSchema.optional() }))
|
|
291
291
|
.output(WorkspaceExtractSchema),
|
|
292
292
|
// An imported project lacks node_modules/.venv; until this says ready, its type checks and tests can mislead.
|
|
293
293
|
setup: procedure
|
|
@@ -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
|
|
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
|
|
90
|
-
expect(routeFloor("POST", "/system/passkeys/policy")).toBe("
|
|
91
|
-
expect(routeFloor("POST", "/system/passkeys/recovery")).toBe("
|
|
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
|
|
11
|
-
//
|
|
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
|
|
69
|
-
|
|
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
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
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
|
|
96
|
-
//
|
|
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: "
|
|
99
|
-
"DELETE /members/requests": {
|
|
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
|
|
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",
|
package/src/schemas/agent.ts
CHANGED
|
@@ -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
|
})
|
package/src/schemas/agents.ts
CHANGED
|
@@ -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";
|
|
@@ -398,6 +400,8 @@ export const AgentSummarySchema = z.object({
|
|
|
398
400
|
fresh: FreshSessionSchema.optional().describe(
|
|
399
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.",
|
|
400
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),
|
|
401
405
|
// Latched on the opening turn (ids/conversation-ids.ts homeConversationId). Rides the summary because it decides who
|
|
402
406
|
// may see the row at all (auth/fleet-scope.ts visibleTo): its owner, and the sandbox's owner.
|
|
403
407
|
home: z
|
|
@@ -524,7 +528,9 @@ export const AgentSummarySchema = z.object({
|
|
|
524
528
|
code: z
|
|
525
529
|
.string()
|
|
526
530
|
.optional()
|
|
527
|
-
.describe(
|
|
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
|
+
),
|
|
528
534
|
at: z.number().describe("When it failed, in milliseconds."),
|
|
529
535
|
})
|
|
530
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.";
|
package/src/schemas/diff.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EncodedGitViewSchema } from "./git/git-view.js";
|
|
1
2
|
// diff: one side of a file diff named by its source, for the routes that answer with something other than the text
|
|
2
3
|
// diff itself (bytes on /diff/raw, derived text on /diff/derived).
|
|
3
4
|
import { z } from "zod";
|
|
@@ -12,6 +13,7 @@ export const DiffSourceQuerySchema = z.discriminatedUnion("source", [
|
|
|
12
13
|
z
|
|
13
14
|
.object({
|
|
14
15
|
source: z.literal("working"),
|
|
16
|
+
view: EncodedGitViewSchema.optional(),
|
|
15
17
|
repo,
|
|
16
18
|
side: GitDiffSideSchema.describe("Which git side the row came from; a half-staged file is two different diffs."),
|
|
17
19
|
path,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ConversationIdSchema } from "../agent.js";
|
|
3
|
+
import { RepoBranchSchema } from "../shared.js";
|
|
4
|
+
|
|
5
|
+
const CommitShaSchema = z.string().regex(/^[0-9a-f]{40,64}$/);
|
|
6
|
+
|
|
7
|
+
export const BranchLandingsQuerySchema = RepoBranchSchema.extend({
|
|
8
|
+
before: CommitShaSchema.optional().describe("Continue before this landing from the previous page."),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const BranchLandingSchema = z.object({
|
|
12
|
+
sha: CommitShaSchema.describe("The landing commit, whose first parent is the state before this landing."),
|
|
13
|
+
short: z.string().describe("Its abbreviated hash."),
|
|
14
|
+
subject: z.string().describe("What the landing did."),
|
|
15
|
+
at: z.number().describe("When it was committed, in milliseconds."),
|
|
16
|
+
agent: ConversationIdSchema.describe("The session named by the commit's Conversation-Id trailer."),
|
|
17
|
+
});
|
|
18
|
+
export type BranchLanding = z.infer<typeof BranchLandingSchema>;
|
|
19
|
+
|
|
20
|
+
export const BranchLandingsSchema = z.object({
|
|
21
|
+
mainBranch: z.string().describe("The main line excluded from this branch's landings."),
|
|
22
|
+
commits: z.array(BranchLandingSchema).describe("Session commits on this branch's first-parent history, newest first, excluding the main line."),
|
|
23
|
+
next: CommitShaSchema.optional().describe("Continue before this commit. Absent on the last page."),
|
|
24
|
+
});
|
|
25
|
+
export type BranchLandings = z.infer<typeof BranchLandingsSchema>;
|