premanmcp 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/shared.js +27 -3
- package/package.json +1 -1
package/bin/shared.js
CHANGED
|
@@ -322,12 +322,20 @@ export function pairedFrontendUrl(args) {
|
|
|
322
322
|
const backend = backendUrl(args);
|
|
323
323
|
const login = activeLogin(args);
|
|
324
324
|
const paired = String(login?.backend_url || "").replace(/\/+$/, "");
|
|
325
|
+
// A deployment we know the dashboard for decides it, ahead of anything
|
|
326
|
+
// stored. The stored value can be wrong about this and was: a login that
|
|
327
|
+
// changed backend inherited the previous dashboard, leaving a record naming
|
|
328
|
+
// production's API and a localhost dashboard. Trusting the record on the
|
|
329
|
+
// strength of the backends matching then made that permanent, because the
|
|
330
|
+
// mismatch it was meant to catch had already been written down. Someone
|
|
331
|
+
// genuinely running their own dashboard against this API still has
|
|
332
|
+
// `--frontend` and `PREMAN_FRONTEND`, which are checked above.
|
|
333
|
+
if (backend === DEFAULT_BACKEND) return DEFAULT_FRONTEND;
|
|
325
334
|
// Only while this invocation is talking to the deployment the key was minted
|
|
326
335
|
// against -- which is exactly the condition `frontendUrl`'s docstring names.
|
|
327
336
|
if (login?.frontend_url && paired && paired === backend) {
|
|
328
337
|
return String(login.frontend_url).replace(/\/+$/, "");
|
|
329
338
|
}
|
|
330
|
-
if (backend === DEFAULT_BACKEND) return DEFAULT_FRONTEND;
|
|
331
339
|
return "";
|
|
332
340
|
}
|
|
333
341
|
|
|
@@ -733,7 +741,15 @@ export async function authenticateTerminal(args) {
|
|
|
733
741
|
const creds = {
|
|
734
742
|
api_key: explicitKey,
|
|
735
743
|
backend_url: backendUrl(args),
|
|
736
|
-
|
|
744
|
+
// `pairedFrontendUrl`, not `frontendUrl`: the latter falls back to the
|
|
745
|
+
// PREVIOUS login's frontend, so signing into a different deployment
|
|
746
|
+
// inherited the old dashboard and stored a record naming one backend and
|
|
747
|
+
// a different backend's frontend. Measured: a login against production kept
|
|
748
|
+
// `http://localhost:8080`, and every run link printed afterwards named a
|
|
749
|
+
// dashboard the run had never been near. This resolver returns the
|
|
750
|
+
// dashboard for THIS backend or nothing, and an empty value still reads
|
|
751
|
+
// back as the default wherever prose needs one.
|
|
752
|
+
frontend_url: pairedFrontendUrl(args),
|
|
737
753
|
user_email: args.value("--email", ""),
|
|
738
754
|
device_name: os.hostname(),
|
|
739
755
|
created_at: new Date().toISOString(),
|
|
@@ -809,7 +825,15 @@ export async function authenticateTerminal(args) {
|
|
|
809
825
|
access_token: accessToken,
|
|
810
826
|
user: sessionUser,
|
|
811
827
|
backend_url: backendUrl(args),
|
|
812
|
-
|
|
828
|
+
// `pairedFrontendUrl`, not `frontendUrl`: the latter falls back to the
|
|
829
|
+
// PREVIOUS login's frontend, so signing into a different deployment
|
|
830
|
+
// inherited the old dashboard and stored a record naming one backend and
|
|
831
|
+
// a different backend's frontend. Measured: a login against production kept
|
|
832
|
+
// `http://localhost:8080`, and every run link printed afterwards named a
|
|
833
|
+
// dashboard the run had never been near. This resolver returns the
|
|
834
|
+
// dashboard for THIS backend or nothing, and an empty value still reads
|
|
835
|
+
// back as the default wherever prose needs one.
|
|
836
|
+
frontend_url: pairedFrontendUrl(args),
|
|
813
837
|
user_email: email,
|
|
814
838
|
device_name: os.hostname(),
|
|
815
839
|
created_at: new Date().toISOString(),
|