18 Commits
Author SHA1 Message Date
AlexKucera 6e689cefe0 docs: soften the browser-headers note in Known limits
Keep the disclosure (portal-only browser-like UA/Origin/Referer) and the breakage risk; drop the speculative terms-of-use and account-flagging sentence, and stop saying the checkpoint rejects CLI clients, since hermes-cli gets through without spoofing.
2026-11-25 18:43:45 +01:00
AlexKucera ef136dbc30 docs: record the Nous Portal maintainer's OK to release
Teknium gave a verbal OK on 2026-11-25 (Nous Research Discord) to release the extension publicly. It is permission, not an endorsement, so the unofficial / not-affiliated label stays. Also drop a stale duplicate ADR 0003 bullet from docs/AGENTS.md.
2026-11-25 18:37:15 +01:00
AlexKucera b71363efb9 build: move release scripts and harden publish
publish.sh and test_npm_package.sh now live in scripts/ and cd to the
repo root, so they run from any directory. publish.sh polls npm until
the released version resolves: the first release ended inside the
registry's processing window, when a fresh install still gets the
0.0.0-stage placeholder. It also reopens an empty Unreleased section
after the rename and refuses an empty one before the version bump, so
a refused release leaves the tree clean.

test_npm_package.sh switches pi between the symlink checkout and
npm:pi-nous-portal. Only one may be installed: pi identifies npm
packages by name and local ones by path, so both register the provider
twice.
2026-11-25 16:51:36 +01:00
AlexKucera 21ec8029c5 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.
2026-11-25 16:27:42 +01:00
AlexKucera e534b27f94 release v0.1.0 v0.1.0 2026-11-25 16:15:56 +01:00
AlexKucera 1af3a1360e feat: make the package installable from npm
pi loads a package's extensions through the `pi` manifest or an
`extensions/` directory, so a root index.ts loaded nothing as a
package. Add "pi": { "extensions": ["./index.ts"] }, a files
whitelist that keeps tests and docs out of the tarball, and the
repository links the pi.dev/packages gallery shows.

Add publish.sh for releases: checks, tarball preview, changelog
heading, commit, tag, npm publish, push. No CI (ADR 0003).

Lead the README with pi install npm:pi-nous-portal, document the
release script, and label the package unofficial and
community-maintained. The README also gets a plainer voice.

The publish itself is still pending. Refs #3
2026-11-25 16:15:15 +01:00
AlexKucera 8829d3142c docs: add review and audit session logs
Record the architecture review unit (tier property, login clock) and
its two-round finish audit as session logs, register both in
docs/devlog/INDEX.md and the root AGENTS.md window, and carry the
round-1 corrections into the review log (exports, diff counts, which
tests use the fake clock).
2026-11-25 13:50:41 +01:00
AlexKucera 544af1eeea test: drive login poll loop with a fake clock
Give login an optional clock ({ now, sleep }) with the real timers as
the default, so the device-code poll loop can be tested without
wall-clock time. Neither t.mock.timers nor jiti aliasing reaches
node:timers/promises, so a seam is the only way in; auth.oauth.login
still passes only the interaction, so pi's interface is unchanged.

Six tests cover pending to slow_down to success, the interval fallback
and floor, the deadline cap, a non-retryable error and a non-OK device
code response. The token mock gives up after 100 polls: an
auto-advancing fake starves the event loop, so a sleep-less regression
would otherwise hang the suite with no test timeout able to fire.
2026-11-25 13:50:00 +01:00
AlexKucera cb5aecf815 refactor: carry catalog tier on the model
Move the catalog tier from the x-nous-catalog-tier request header to a
catalogTier property on each model. pi forwards only model.headers to
the provider and copies them into the request options, so a header
needed stripping on both the model and the options before every
request; that adapter leaked for two audit rounds. A property never
reaches the wire, survives pi's model store, and needs no wrapper, so
TIER_HEADER, untier and withoutTierHeader are deleted and pi's stream
passes through untouched.

Models stored by the previous version come back without the property
until the next interactive start rewrites the store; the CHANGELOG
tells the user to start pi once interactively after upgrading.
2026-11-25 13:49:58 +01:00
AlexKucera a1735049b7 docs: add session log for the five-round audit
Record the fresh-context audit of the Nous Portal provider as the
first entry in docs/devlog/ (rounds 1-5, the fixes in 00d50e1..04fa08f,
decisions, gotchas, open items) with its INDEX.md, and add the Session
Logs pointer window to the root AGENTS.md.

DOX pass: docs/AGENTS.md now owns docs/devlog/ (one log per unit of
work, INDEX.md is the source of truth, logs are append-only) and its
verification line covers the filename convention; tests/AGENTS.md
documents the drive() harness changes from rounds 4 and 5 (a deferred
refresh to simulate overlapping handlers, a Nous model for setModel
assertions, provider-level fetchModels via the registered provider).
2026-11-25 11:18:59 +01:00
AlexKucera 04fa08f0b7 test: address round-5 review findings
- provider fetchModels: pin that an empty live list keeps the last good
  list instead of the baseline.
- tokenRequest: pin the OAuth error mapping (error -> code,
  error_description -> message, body excerpt when absent).
- overlap test: give the session a Nous model so the setModel half of the
  supersede guard is asserted (exactly one switch, by the winner).
- README: drop the hard-coded live catalog counts (409 / 3 / 42); they
  are a 2026-11-25 snapshot that drifts silently. /model shows the live list.

No production-code change. Tests: 20 (was 18).
2026-11-25 11:00:37 +01:00
AlexKucera 78e89241a6 fix: address round-4 review findings
- apply(): if a newer invocation changed the catalog while this one
  awaited the model refresh, exit silently. The superseded invocation
  otherwise reported the second's catalog in its notice and could fire
  one extra setModel. Pinned with a deferred-refresh test.
- CITATION.cff: drop date-released while the CHANGELOG is [Unreleased]
  and no release tag exists; version stays 0.1.0.
- Tests: 18 (was 17).
2026-11-25 10:43:26 +01:00
AlexKucera 8d91094022 fix: address round-3 review findings
- Strip the catalog-tier header from request options too. pi copies
  model.headers into options.headers before calling the provider
  (pi-ai getAuth -> prepareRequest) and the client applies
  options.headers last, so the header still reached Nous on every
  free/promo request; the old test pinned the leak. Both sides pinned.
- Drop the 'Press Enter' prompt in OAuth login: it cleared pi's
  device-code confirm action (login-dialog showPrompt), so Enter opened
  nothing. pi's own dialog shows the code and opens the browser.
- Poll interval rejects non-finite values (Node clamps an overflowing
  setTimeout to 1 ms) and each sleep is capped at the deadline, matching
  pi-ai's poller.
- Tests: 17 (was 14). /nous-free back to full, /nous-catalog cycling,
  and startup restore of a saved catalog are covered.
- Docs: README says the live list overlays the baseline by id (baseline
  ids that vanish stay listed); AGENTS.md states both strips.
2026-11-25 10:28:25 +01:00
AlexKucera b9065d409c fix: address round-2 review findings
- apply(): only swap the current model when a Nous model was filtered
  out; a session on another provider is left alone, and the notice names
  the model actually in use instead of the first catalog hit.
- Device-code poll floors the interval at 1s and treats a non-numeric
  interval as absent, matching pi-ai's own poller; interval: 0 from the
  server no longer becomes a tight loop.
- Drop the provider's own context.publish: createProvider already
  persists and publishes the fetchModels return value with checkedAt;
  the extra publish was a second, timestamp-less write each refresh.
- tokenRequest tolerates a literal null error body (data.error would
  have thrown TypeError, masking the HTTP status).
- tsconfig: remove allowImportingTsExtensions and baseUrl, both inert.
- .editorconfig covers .mjs.
- Tests: 14 (was 8). tokenRequest is exported and its HTML/null error
  paths are pinned; the no-credential test now sets NOUS_API_KEY so it
  fails if an env fallback returns; the slash commands are driven
  through a recording pi (switch/notice semantics, and persist-before-
  mutate on a failed flag write). Stub returns a private mkdtemp dir.
- CHANGELOG: /nous-catalog entry states the switch semantics.
2026-11-25 10:09:06 +01:00
AlexKucera 00d50e10de fix: address round-1 review findings
- slow_down now sleeps (and waits longer) instead of re-polling at
  once; the interval cap that could lower a server interval is gone.
  The deadline already bounds the loop.
- Non-JSON error bodies from gateways and the Vercel checkpoint no
  longer surface as SyntaxError; the HTTP status is preserved.
- Drop the dead process.env.NOUS_API_KEY fallback in fetchModels:
  envApiKeyAuth already resolves it into the credential upstream.
- apply() persists the catalog flag before mutating memory, so a
  read-only agent dir cannot leave the two out of step.
- sleep() replaced with node:timers/promises; three unused exports
  removed; stale tags.user comment corrected; hermes filter explained.
- Tests: 8 (was 4). Pin tierOf, the tier header, and withoutTierHeader
  on both stream entry points; t.mock.method replaces hand-rolled fetch
  swaps; stub gains getAgentDir.
- Docs: README covers install lockfile flag, hermes row, browser-UA
  posture, and typecheck path pinning; AGENTS.md allowlist includes
  pi-coding-agent; tests/AGENTS.md contracts updated.
2026-11-25 09:48:55 +01:00
AlexKucera 8bbece7613 docs: install DOX framework and initialize the DOX tree
Appends the canonical DOX framework to the root AGENTS.md and creates
child docs for the two durable boundaries: docs/ (ADR numbering,
format and status rules) and tests/ (jiti aliasing to host-package
stubs, what the tests pin, the NOUS_API_KEY fallback gotcha).

tests/stubs/ gets no child doc on purpose: it is a single file whose
only contract is owned by tests/AGENTS.md.
2026-11-25 09:35:17 +01:00
AlexKucera 690fcdfe22 feat: Nous Portal provider with subscription OAuth and catalog filters
Registers the native nous-portal provider for pi. Nous retired
agent-key minting (410 session_key_minting_retired), which is where
both existing community extensions end their login. The inference API
accepts the OAuth access token directly, so toAuth hands it over and
no agent key is ever minted or stored.

- Device-code OAuth (subscription) and API-key login
- Live model discovery delegated to openai-completions streaming
- Offline baseline so pi -p and --list-models stay usable
- /nous-catalog cycles full, free and promo; /nous-free jumps to free
2026-11-25 09:29:52 +01:00
AlexKucera 40ac2c4b43 Initial commit 2026-11-25 08:46:13 +01:00