diff --git a/pkgs/by-name/pi/pi-coding-agent/package.nix b/pkgs/by-name/pi/pi-coding-agent/package.nix index 1433c9a3dc9d..0adaeba4297f 100644 --- a/pkgs/by-name/pi/pi-coding-agent/package.nix +++ b/pkgs/by-name/pi/pi-coding-agent/package.nix @@ -2,6 +2,7 @@ lib, buildNpmPackage, fetchFromGitHub, + fetchurl, nix-update-script, versionCheckHook, writableTmpDirAsHomeHook, @@ -12,16 +13,34 @@ }: buildNpmPackage (finalAttrs: { pname = "pi-coding-agent"; - version = "0.80.10"; + version = "0.81.0"; src = fetchFromGitHub { owner = "earendil-works"; repo = "pi"; tag = "v${finalAttrs.version}"; - hash = "sha256-Vs/ndHYzFyfN4CjPV2zMYblLXe9IuM13UrPJI1VsZEQ="; + hash = "sha256-/TIYea6baa0vlz2G5wUv1aOknjEdo8zoo7eZI0Afjmk="; }; - npmDepsHash = "sha256-XGvDNH+eilsgc0Z7ITqbitB/9RVc+WuDfCcr1pibNqk="; + npmDepsHash = "sha256-i0RwHPWBD06nh7FCM5F3R4kTOkH+7ulLFwIIDdH0vH0="; + + # The provider model catalog (packages/ai/src/providers/data/) is generated by + # a network fetch (models.dev plus provider APIs) and is gitignored upstream, + # so it is absent from the source tarball. Restore it from the matching + # published @earendil-works/pi-ai npm package, which ships the hydrated catalog + # under dist/providers/data/. Bump this hash alongside version. + modelData = fetchurl { + url = "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-${finalAttrs.version}.tgz"; + hash = "sha256-YuCrwc/6xDHQkcvI6I7u/LTEKLx40nAuxSvPXe/h/1o="; + }; + + preConfigure = '' + mkdir -p packages/ai/src/providers/data + tar --extract --gzip --file=${finalAttrs.modelData} \ + --directory=packages/ai/src/providers/data \ + --strip-components=4 \ + package/dist/providers/data + ''; npmWorkspace = "packages/coding-agent"; @@ -34,8 +53,8 @@ buildNpmPackage (finalAttrs: { # Build workspace dependencies in order, then the coding-agent. # We invoke tsgo directly for workspace deps to skip pi-ai's - # generate-models script which requires network access - # (models.generated.ts is committed to the repo). + # generate-models script, which requires network access; the model + # catalog it would produce is supplied via modelData above. buildPhase = '' runHook preBuild @@ -96,7 +115,12 @@ buildNpmPackage (finalAttrs: { versionCheckProgram = "${placeholder "out"}/bin/pi"; versionCheckProgramArg = "--version"; - passthru.updateScript = nix-update-script { }; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--custom-dep" + "modelData" + ]; + }; meta = { description = "Coding agent CLI with read, bash, edit, write tools and session management";