@pmate/cli 0.45.1 → 0.45.2
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/dist/index.js +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -132,11 +132,16 @@ function saveLoginSession(session, requestedApp = DEFAULT_APP_ID) {
|
|
|
132
132
|
}
|
|
133
133
|
function readRequiredSession(options) {
|
|
134
134
|
const { sessionPath, store } = loadSessionStoreWithPath();
|
|
135
|
-
const
|
|
135
|
+
const boundApp = process.env.PMATE_SESSION_APP?.trim();
|
|
136
|
+
if (process.env.PMATE_EXPECTED_ACCOUNT_ID && !process.env.PMATE_SESSION_FILE?.trim()) throw new Error("Agent CLI requires a dedicated session file");
|
|
137
|
+
if (boundApp && options?.app && options.app !== boundApp) throw new Error("Agent CLI application differs from its bound session");
|
|
138
|
+
const resolvedApp = boundApp ? assertValidAppRef(boundApp) : resolveReadApp(store, options);
|
|
136
139
|
const session = store.sessions[resolvedApp];
|
|
137
140
|
if (!session) {
|
|
138
141
|
throw new Error(buildMissingSessionMessage(sessionPath, resolvedApp));
|
|
139
142
|
}
|
|
143
|
+
if (process.env.PMATE_EXPECTED_ACCOUNT_ID && session.accountId !== process.env.PMATE_EXPECTED_ACCOUNT_ID) throw new Error("Agent CLI Account mismatch");
|
|
144
|
+
if (process.env.PMATE_EXPECTED_PROFILE_ID && session.profileId !== process.env.PMATE_EXPECTED_PROFILE_ID) throw new Error("Agent CLI Profile mismatch");
|
|
140
145
|
const token = session.token?.trim();
|
|
141
146
|
if (!token) {
|
|
142
147
|
throw new Error(
|