From 21ec8029c5f31c2dfc667bc48fd45002a1b4b6d6 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Wed, 25 Nov 2026 16:27:42 +0100 Subject: [PATCH] build: wait for npm to serve a released version npm answers with a placeholder version (0.0.0-stage) for about four minutes after `npm publish`. The first release ended the script in that window: a fresh install got the placeholder and loaded no extension, and the pi.dev/packages gallery returned 404. Poll the registry until the released version resolves, for at most ten minutes, so the script's exit means `pi install` works. Observed with pi-nous-portal 0.1.0, which became installable at 15:19:25 UTC and listed 8 models from a fresh agent dir. --- AGENTS.md | 2 +- README.md | 2 +- ...1125-issue03-publish-pi-nous-portal-to-npm_log.md | 4 ++++ publish.sh | 12 ++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 5d4fc06..9abfad5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,7 +26,7 @@ - **`pi -p` and `--list-models` never fetch live catalogs** (`allowModelNetwork` is hard-coded `false`). That is why the provider ships `BASELINE`; interactive startup overlays the live list. - **Tests load `index.ts` through jiti with the host packages aliased to `tests/stubs/pi-ai.mjs`.** Alias keys are longest-prefix first, so `pi-ai/compat` must precede `pi-ai` or the bare key swallows the subpath. - **Never blanket-inject `tags.user` into request bodies.** As of 2026-11-25 Nous free and discounted models return 500 when that field is present, and only `upstage/solar-mini4:free` requires it. `solar-mini4:free` is therefore left out of `BASELINE` on purpose. -- **Releases are local, through `publish.sh`.** No CI and no npm token: `npm publish` prompts for the 2FA code. The script renames the changelog's `## [Unreleased]` heading to the released version, so new entries always go under `## [Unreleased]`. +- **Releases are local, through `publish.sh`.** No CI and no npm token: `npm publish` prompts for the 2FA code. The script renames the changelog's `## [Unreleased]` heading to the released version, so new entries always go under `## [Unreleased]`. npm answers with a placeholder version (`0.0.0-stage`) for about four minutes after the publish; a fresh install in that window loads no models, and the script waits until the real version resolves. The pi.dev/packages gallery lags further behind. ## Catalog tiers diff --git a/README.md b/README.md index da11e70..de0cfd3 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Typechecking needs a local pi install. The `paths` in `tsconfig.json` point `@ea ./publish.sh patch # bump first; minor and major work too ``` -The script runs the checks, shows the tarball contents, moves the `Unreleased` section of the changelog under the new version, commits, tags, publishes to npm, and pushes. npm asks for your 2FA code during the publish. You need `npm login` with publish rights to the package first. +The script runs the checks, shows the tarball contents, moves the `Unreleased` section of the changelog under the new version, commits, tags, publishes to npm, and pushes. npm asks for your 2FA code during the publish. npm then takes a few minutes to serve the new version, and the script waits until it resolves. You need `npm login` with publish rights to the package first. ## License diff --git a/docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md b/docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md index d516f05..2f12be5 100644 --- a/docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md +++ b/docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md @@ -61,6 +61,10 @@ Verified before stopping: `npm run check` (25 tests pass), `shellcheck`, `npm pa - [ ] Confirm the package shows up on https://pi.dev/packages. - [ ] Close #3 once the listing is live. +## Update, 2026-11-25 15:26 UTC + +Published. `./publish.sh` ran with the 2FA prompt, pushed `release v0.1.0` (e534b27) and tag `v0.1.0`. npm answered with a placeholder version `0.0.0-stage` for about four minutes ("Your package is being processed and may take a few minutes to become available"). A fresh-agent-dir install in that window listed no Nous models. At 15:19:25 UTC `latest` became `0.1.0`, and `pi -e npm:pi-nous-portal@0.1.0 --list-models` in a fresh agent dir listed 8 `nous-portal` models with an empty stderr. `publish.sh` now waits until the registry serves the version. The pi.dev/packages gallery still returned 404 at 15:26 UTC, so issue #3 stays open until the listing is live. + --- *Log written by write-log skill* diff --git a/publish.sh b/publish.sh index 88e6f98..a35dae3 100755 --- a/publish.sh +++ b/publish.sh @@ -19,6 +19,7 @@ if [ -n "$bump" ]; then npm version "$bump" --no-git-tag-version fi version=$(node -p "require('./package.json').version") +name=$(node -p "require('./package.json').name") grep -qx '## \[Unreleased\]' CHANGELOG.md || { echo "CHANGELOG.md has no '## [Unreleased]' heading" >&2; exit 1; } @@ -32,3 +33,14 @@ git commit -am "release v$version" git tag -a "v$version" -m "v$version" npm publish git push origin main --follow-tags + +# npm answers with a placeholder for a few minutes before the version resolves. +tries=0 +until [ "$(npm view "$name@$version" version 2>/dev/null | tr -d "[:space:]'")" = "$version" ]; do + tries=$((tries + 1)) + if [ "$tries" -ge 40 ]; then + echo "npm still has not served $name@$version after 10 minutes. Check https://www.npmjs.com/package/$name" >&2 + break + fi + sleep 15 +done