@intentic/sandbox-contract 1.272.0 → 1.273.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 (38) hide show
  1. package/dist/chores/chores.d.ts.map +1 -1
  2. package/dist/chores/chores.js +1 -1
  3. package/dist/chores/chores.js.map +1 -1
  4. package/dist/contracts/capabilities.contract.d.ts +15 -0
  5. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  6. package/dist/contracts/capabilities.contract.js +10 -0
  7. package/dist/contracts/capabilities.contract.js.map +1 -1
  8. package/dist/contracts/host.contract.d.ts +5 -0
  9. package/dist/contracts/host.contract.d.ts.map +1 -1
  10. package/dist/contracts/system.contract.d.ts +35 -30
  11. package/dist/contracts/system.contract.d.ts.map +1 -1
  12. package/dist/index.d.ts +21 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/policy/command-run.d.ts.map +1 -1
  17. package/dist/policy/command-run.js +2 -10
  18. package/dist/policy/command-run.js.map +1 -1
  19. package/dist/schemas/devices.d.ts +22 -2
  20. package/dist/schemas/devices.d.ts.map +1 -1
  21. package/dist/schemas/devices.js +41 -7
  22. package/dist/schemas/devices.js.map +1 -1
  23. package/dist/schemas/hosts.d.ts +21 -0
  24. package/dist/schemas/hosts.d.ts.map +1 -1
  25. package/dist/schemas/hosts.js +9 -0
  26. package/dist/schemas/hosts.js.map +1 -1
  27. package/dist/schemas/remote-refs.d.ts +28 -0
  28. package/dist/schemas/remote-refs.d.ts.map +1 -0
  29. package/dist/schemas/remote-refs.js +30 -0
  30. package/dist/schemas/remote-refs.js.map +1 -0
  31. package/package.json +5 -4
  32. package/src/chores/chores.ts +1 -2
  33. package/src/contracts/capabilities.contract.ts +12 -0
  34. package/src/index.ts +1 -0
  35. package/src/policy/command-run.ts +2 -12
  36. package/src/schemas/devices.ts +69 -18
  37. package/src/schemas/hosts.ts +21 -0
  38. package/src/schemas/remote-refs.ts +39 -0
@@ -3,6 +3,12 @@ import { z } from "zod";
3
3
  // Manifest says which machines are intended; this says which actually hold a socket now. Nothing persists across a
4
4
  // daemon restart except the enrollment itself, so a closed laptop reads offline within a heartbeat.
5
5
 
6
+ // Which WSL distro a Linux agent runs inside. Windows and every distro it hosts answer `hostname` with the same string
7
+ // while being separate filesystems running separate agents, so this is what keeps a distro apart from the install
8
+ // hosting it. `distro` is WSL's own name for it ("Arch", "Ubuntu-22.04"), empty when the distro won't say.
9
+ export const WslEnvironmentSchema = z.object({ distro: z.string() });
10
+ export type WslEnvironment = z.infer<typeof WslEnvironmentSchema>;
11
+
6
12
  // What a machine reports once at connect (`host.describe`), cached until it reconnects: the skill pack says how to
7
13
  // drive Windows, this says which Windows it is.
8
14
  export const HostFactsSchema = z.object({
@@ -18,8 +24,23 @@ export const HostFactsSchema = z.object({
18
24
  // Docker engine's size (WSL guest on Windows, Desktop VM on macOS, host on Linux); the ceiling a sandbox's share is
19
25
  // bounded by.
20
26
  engine: z.object({ memoryBytes: z.number(), cpus: z.number() }).optional(),
27
+ // OS hostname: the key that joins the doors of one physical machine. Reported by every agent that also reports
28
+ // `wsl`, so a hostname with no `wsl` beside it is a native install; absent from an agent older than both.
29
+ hostname: z.string().optional(),
30
+ // Present only inside a WSL distro.
31
+ wsl: WslEnvironmentSchema.optional(),
32
+ // Windows only: the distros `wsl -l -q` lists, the names `run_command`'s `in: "wsl:<name>"` accepts.
33
+ wslDistros: z.array(z.string()).optional(),
21
34
  });
22
35
  export type HostFacts = z.infer<typeof HostFactsSchema>;
36
+
37
+ // One folder, two names. Windows sees a distro's files under a UNC share and a distro sees the Windows drives under
38
+ // /mnt, so a path handed across the boundary is translated here rather than by hand at every call site.
39
+ export const wslPathOf = (windowsPath: string): string | undefined => {
40
+ const drive = /^([A-Za-z]):[\\/](.*)$/.exec(windowsPath);
41
+ return drive === null ? undefined : `/mnt/${drive[1]?.toLowerCase()}/${(drive[2] ?? "").replaceAll("\\", "/")}`.replace(/\/$/, "");
42
+ };
43
+ export const windowsPathOf = (distro: string, linuxPath: string): string => `\\\\wsl.localhost\\${distro}${linuxPath.replaceAll("/", "\\")}`;
23
44
  export const HostSummarySchema = z.object({
24
45
  // The capability id, the machine's name, and the prefix of its tools (mcp__<id>__run_command).
25
46
  id: z.string(),
@@ -0,0 +1,39 @@
1
+ // What a git remote advertises right now: the versions an install form can pin to without anyone reading a sha off a
2
+ // web page. Answered from `git ls-remote`, so nothing is cloned and nothing is written.
3
+ import { z } from "zod";
4
+
5
+ // POST so a private repository's token never rides a URL or an access log, the same reasoning as the marketplace read.
6
+ export const RemoteRefsRequestSchema = z.object({
7
+ url: z.url().describe("The repository to ask. http(s) only: an ssh remote would stop on a host-key prompt nobody can answer."),
8
+ token: z
9
+ .string()
10
+ .min(1)
11
+ .optional()
12
+ .describe(
13
+ "A credential for a private one. Sent as a body rather than in the address, so it never lands in a log. A form editing a live connection has never been shown its token: it sends the VAULTED marker here and names the connection in `keeping`, so a private repository still answers without anyone retyping a key.",
14
+ ),
15
+ keeping: z
16
+ .string()
17
+ .min(1)
18
+ .optional()
19
+ .describe("Which connection a VAULTED token belongs to. Ignored when a real token is sent."),
20
+ });
21
+
22
+ export const RemoteRefSchema = z.object({
23
+ name: z.string().describe("The branch or tag as a person names it: `main`, `v1.4.0`."),
24
+ kind: z.enum(["branch", "tag"]),
25
+ sha: z
26
+ .string()
27
+ .regex(/^[0-9a-f]{40}$/)
28
+ .describe("The commit it points at. An annotated tag is peeled here, so this is always a commit, never a tag object."),
29
+ });
30
+ export type RemoteRef = z.infer<typeof RemoteRefSchema>;
31
+
32
+ export const RemoteRefsSchema = z.object({
33
+ defaultBranch: z
34
+ .string()
35
+ .optional()
36
+ .describe("The branch the remote advertises as HEAD, the one to offer first. Absent when the remote advertises no symref."),
37
+ refs: z.array(RemoteRefSchema).describe("Every branch the remote advertises, then every tag. Which to offer first is the reader's question, not this one's."),
38
+ });
39
+ export type RemoteRefs = z.infer<typeof RemoteRefsSchema>;