@evolinkai/cli 0.9.0 → 0.9.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/auth.mjs +10 -2
- package/src/network.mjs +1 -0
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ Final task/workflow budgets require authoritative server-side reservation and se
|
|
|
177
177
|
|
|
178
178
|
## Authentication and state
|
|
179
179
|
|
|
180
|
-
Login discovers Passport directly and uses a native public OAuth client, PKCE, a loopback callback and `mcp offline_access` on the existing Passport service. Dynamically registered clients currently appear as unverified on the consent page. Device-code login is not included in this release.
|
|
180
|
+
Login discovers Passport directly and uses a native public OAuth client, PKCE, a loopback callback and `mcp offline_access` on the existing Passport service. After the approval, the loopback callback hands the browser on to the EvoLink MCP page (`?login=cli`), where the site picks the language; the authorization code is never part of that URL. Dynamically registered clients currently appear as unverified on the consent page. Device-code login is not included in this release.
|
|
181
181
|
|
|
182
182
|
Tokens are stored only in the OS credential store. Linux requires a running Secret Service keyring; the CLI does not silently fall back to an in-memory kernel store or plaintext credential files. A one-command OAuth access token can be passed through stdin with `--token-stdin`, never as a command argument. `auth logout` revokes this session and preserves the account's shared MCP key.
|
|
183
183
|
|
package/package.json
CHANGED
package/src/auth.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { randomBytes, randomUUID } from 'node:crypto';
|
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { authorize, refresh, metadata } from './oauth.mjs';
|
|
5
5
|
import { hash } from './state.mjs';
|
|
6
|
-
import { authFetch, ISSUER, SERVER } from './network.mjs';
|
|
6
|
+
import { authFetch, ISSUER, SERVER, SITE } from './network.mjs';
|
|
7
7
|
import { CliError, requireThat } from './errors.mjs';
|
|
8
8
|
|
|
9
9
|
export class Vault {
|
|
@@ -82,6 +82,10 @@ export function openBrowser(url, onFailure = () => {}) {
|
|
|
82
82
|
child.unref();
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/** Where the browser goes once it has handed the authorization code to the CLI. The site picks the
|
|
86
|
+
* page language itself (its saved choice, then the browser language, English otherwise). */
|
|
87
|
+
export const LOGIN_LANDING_URL = `${SITE}/mcp?login=cli`;
|
|
88
|
+
|
|
85
89
|
export async function callbackListener({ state, issuer, timeout = 180_000, signal }) {
|
|
86
90
|
let settled = false;
|
|
87
91
|
let resolveCode, rejectCode;
|
|
@@ -105,12 +109,16 @@ export async function callbackListener({ state, issuer, timeout = 180_000, signa
|
|
|
105
109
|
const value = url.searchParams.get('code');
|
|
106
110
|
if (!value) { res.writeHead(400); res.end('Missing login code.'); return; }
|
|
107
111
|
settled = true;
|
|
112
|
+
// The browser has delivered the code. Hand it on to the EvoLink site, which confirms the
|
|
113
|
+
// approval in the right language; the code is not part of that URL. The English text
|
|
114
|
+
// below is only seen if the site cannot be reached.
|
|
108
115
|
const nonce = randomBytes(16).toString('base64url');
|
|
109
116
|
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
110
117
|
res.setHeader('Content-Security-Policy', `default-src 'none'; script-src 'nonce-${nonce}'; frame-ancestors 'none'; base-uri 'none'`);
|
|
111
118
|
res.writeHead(200);
|
|
112
|
-
res.end(`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>EvoLink approval received</title><script nonce="${nonce}">history.replaceState(null, '', '/oauth/callback');</script><h1>EvoLink approval received</h1><p>Return to your assistant to finish checking the connection.
|
|
119
|
+
res.end(`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="refresh" content="0;url=${LOGIN_LANDING_URL}"><title>EvoLink approval received</title><script nonce="${nonce}">history.replaceState(null, '', '/oauth/callback');location.replace('${LOGIN_LANDING_URL}');</script><h1>EvoLink approval received</h1><p>Return to your assistant to finish checking the connection. <a href="${LOGIN_LANDING_URL}">Continue to EvoLink</a></p></html>`);
|
|
113
120
|
resolveCode(value);
|
|
121
|
+
return;
|
|
114
122
|
});
|
|
115
123
|
await new Promise((resolve, reject) => { server.once('error', reject); server.listen(0, '127.0.0.1', resolve); });
|
|
116
124
|
const timer = setTimeout(() => { settled = true; rejectCode(new CliError('login_timeout', 'Login timed out. Start a new login and use its new browser link.', { recovery: 'evolink auth login', timeout_seconds: timeout / 1000 })); }, timeout);
|
package/src/network.mjs
CHANGED
|
@@ -9,6 +9,7 @@ export const SERVER = 'https://mcp.evolink.ai/mcp';
|
|
|
9
9
|
export const ISSUER = 'https://passport.evolink.ai';
|
|
10
10
|
export const API = 'https://api.evolink.ai';
|
|
11
11
|
export const FILES = 'https://files-api.evolink.ai';
|
|
12
|
+
export const SITE = 'https://evolink.ai';
|
|
12
13
|
export const USER_AGENT = `EvoLinkCLI/${CLI_VERSION}`;
|
|
13
14
|
export const loopback = url => url.protocol === 'http:' && ['127.0.0.1', '[::1]'].includes(url.hostname);
|
|
14
15
|
|