Skip to content

fix: read PRIOMPT_TOKEN and re-sync the vendored proto - #11

Merged
sujal-maheshwari2004 merged 1 commit into
mainfrom
fix/7-priompt-token-proto
Oct 18, 2026
Merged

sujal-maheshwari2004 merged 1 commit into
mainfrom
fix/7-priompt-token-proto

Conversation

@sujal-maheshwari2004

Copy link
Copy Markdown
Contributor

What was wrong

  • PromptClient ignored PRIOMPT_TOKEN. The priompt CLI, promptctl and the web UI all send it as the client's bearer token, and the CLI and web UI prefer it over the token in PRIOMPT_URL. So a setup the docs describe (export PRIOMPT_TOKEN=… plus a host) failed with UNAUTHENTICATED from Node.
  • The vendored proto/priompt/v1/prompt.proto still had the old go_package = "priomptproto/gen/priompt/v1;priomptv1".

Fix

  • The token is now resolved in this order: explicit token, then PRIOMPT_TOKEN, then the token in url/PRIOMPT_URL. This matches priompt's authCtx and the web UI. README updated.
  • npm run sync-proto from priompt/proto main (e7dce07). The only difference is go_package → github.com/priompt/proto/gen/priompt/v1;priomptv1. No message or RPC changes.
  • Adds npm test (node --test) with test/token.test.js, and CI runs it.

Test evidence

Before the fix (main):

✖ PRIOMPT_TOKEN is sent as the bearer token
✖ PRIOMPT_TOKEN wins over the token in PRIOMPT_URL
✖ vendored proto carries the published go_package
ℹ pass 3
ℹ fail 3

After:

$ npm test
✔ PRIOMPT_TOKEN is sent as the bearer token
✔ PRIOMPT_TOKEN wins over the token in PRIOMPT_URL
✔ an explicit token wins over PRIOMPT_TOKEN
✔ the token in PRIOMPT_URL is used when PRIOMPT_TOKEN is unset
✔ no token configured sends no authorization header
✔ vendored proto carries the published go_package
ℹ pass 6
ℹ fail 0

Real run against priompt v0.7.2 serve -tokens-file (token admintok), PRIOMPT_TOKEN=admintok, new PromptClient({ host: "127.0.0.1:48443" }).get("priompt://acme/onboarding/welcome"):

== main
error 16 invalid or missing token
== this branch
ok f6f5fe93d4fb "Hi {name}, welcome aboard to {org}! …
== this branch, PRIOMPT_URL=priompt://bogus@127.0.0.1:48443 PRIOMPT_TOKEN=admintok
ok f6f5fe93d4fb

The re-synced proto loads (node -e "new (require('./client.js').PromptClient)({host:'localhost:1'})").

Overlap with #9 / #10

Both add the same npm test script and CI line. A trial merge of this branch with #9 alone, or with #10 alone, is clean.

Fixes #7

🤖 Generated with Claude Code

The client ignored PRIOMPT_TOKEN, which the CLI and docs treat as the
client credential. The token is now, in order: the explicit token,
PRIOMPT_TOKEN, then the token in the url / PRIOMPT_URL, matching the
priompt CLI and the web UI.

Re-sync proto/priompt/v1/prompt.proto from priompt/proto main (e7dce07);
the only change is the go_package path.

Adds an npm test suite (node:test) and runs it in CI.

Fixes #7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sujal-maheshwari2004
sujal-maheshwari2004 merged commit 290a6c2 into main Oct 18, 2026
1 check passed
@sujal-maheshwari2004
sujal-maheshwari2004 deleted the fix/7-priompt-token-proto branch October 18, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read PRIOMPT_TOKEN and regenerate stale vendored proto

1 participant