oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package mac
2
3import (
4 "embed"
5 "encoding/json"
6)
7
8// SRTVersion is the pinned @anthropic-ai/sandbox-runtime. The installer
9// installs it privately with `npm ci` from this lockfile, so every
10// package srt brings is pinned by its integrity hash too.
11const SRTVersion = "0.0.81"
12
13//go:embed srt/package.json srt/package-lock.json
14var srtPackage embed.FS
15
16// SRTPackage is the package.json and package-lock.json the installer
17// writes into the private srt prefix before `npm ci`.
18func SRTPackage() (pkg, lock []byte) {
19 pkg, _ = srtPackage.ReadFile("srt/package.json")
20 lock, _ = srtPackage.ReadFile("srt/package-lock.json")
21 return pkg, lock
22}
23
24// SRTPinned reports whether the lockfile pins srt at SRTVersion with an
25// integrity hash.
26func SRTPinned() bool {
27 _, lock := SRTPackage()
28 var l struct {
29 Packages map[string]struct {
30 Version string `json:"version"`
31 Integrity string `json:"integrity"`
32 } `json:"packages"`
33 }
34 if json.Unmarshal(lock, &l) != nil {
35 return false
36 }
37 p := l.Packages["node_modules/@anthropic-ai/sandbox-runtime"]
38 return p.Version == SRTVersion && len(p.Integrity) > len("sha512-")
39}
40