package mac import ( "embed" "encoding/json" ) // SRTVersion is the pinned @anthropic-ai/sandbox-runtime. The installer // installs it privately with `npm ci` from this lockfile, so every // package srt brings is pinned by its integrity hash too. const SRTVersion = "0.0.81" //go:embed srt/package.json srt/package-lock.json var srtPackage embed.FS // SRTPackage is the package.json and package-lock.json the installer // writes into the private srt prefix before `npm ci`. func SRTPackage() (pkg, lock []byte) { pkg, _ = srtPackage.ReadFile("srt/package.json") lock, _ = srtPackage.ReadFile("srt/package-lock.json") return pkg, lock } // SRTPinned reports whether the lockfile pins srt at SRTVersion with an // integrity hash. func SRTPinned() bool { _, lock := SRTPackage() var l struct { Packages map[string]struct { Version string `json:"version"` Integrity string `json:"integrity"` } `json:"packages"` } if json.Unmarshal(lock, &l) != nil { return false } p := l.Packages["node_modules/@anthropic-ai/sandbox-runtime"] return p.Version == SRTVersion && len(p.Integrity) > len("sha512-") }