@runflow-ai/cli 0.2.24 → 0.2.26
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/commands/agents/agents.command.js +5 -1
- package/dist/commands/agents/agents.command.js.map +1 -1
- package/dist/commands/agents/agents.service.js +15 -1
- package/dist/commands/agents/agents.service.js.map +1 -1
- package/dist/commands/create/code-generator.js +0 -3
- package/dist/commands/create/code-generator.js.map +1 -1
- package/dist/commands/doctor/doctor.command.d.ts +13 -0
- package/dist/commands/doctor/doctor.command.js +288 -0
- package/dist/commands/doctor/doctor.command.js.map +1 -0
- package/dist/commands/login/login.command.d.ts +3 -1
- package/dist/commands/login/login.command.js +99 -23
- package/dist/commands/login/login.command.js.map +1 -1
- package/dist/commands/profiles/profiles.command.js +3 -3
- package/dist/commands/profiles/profiles.command.js.map +1 -1
- package/dist/commands/switch/switch.command.d.ts +4 -1
- package/dist/commands/switch/switch.command.js +99 -21
- package/dist/commands/switch/switch.command.js.map +1 -1
- package/dist/commands/test/test.command.d.ts +6 -1
- package/dist/commands/test/test.command.js +137 -74
- package/dist/commands/test/test.command.js.map +1 -1
- package/dist/commands/whoami/whoami.command.d.ts +4 -0
- package/dist/commands/whoami/whoami.command.js +73 -0
- package/dist/commands/whoami/whoami.command.js.map +1 -0
- package/dist/common/api-client.d.ts +1 -0
- package/dist/common/api-client.js +80 -10
- package/dist/common/api-client.js.map +1 -1
- package/dist/common/auth0-login.d.ts +9 -0
- package/dist/common/auth0-login.js +215 -0
- package/dist/common/auth0-login.js.map +1 -0
- package/dist/common/config.d.ts +25 -5
- package/dist/common/config.js +53 -16
- package/dist/common/config.js.map +1 -1
- package/dist/common/help.d.ts +1 -1
- package/dist/common/help.js +9 -7
- package/dist/common/help.js.map +1 -1
- package/dist/common/token-refresh.d.ts +1 -0
- package/dist/common/token-refresh.js +35 -0
- package/dist/common/token-refresh.js.map +1 -0
- package/dist/common/ui.d.ts +6 -0
- package/dist/common/ui.js +27 -0
- package/dist/common/ui.js.map +1 -1
- package/dist/common/version-check.d.ts +1 -0
- package/dist/common/version-check.js +52 -0
- package/dist/common/version-check.js.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/package.json +14 -12
- package/scripts/postinstall.js +178 -0
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -8,26 +41,63 @@ exports.createApiClient = createApiClient;
|
|
|
8
41
|
exports.apiRequest = apiRequest;
|
|
9
42
|
const axios_1 = __importDefault(require("axios"));
|
|
10
43
|
const config_1 = require("./config");
|
|
44
|
+
const token_refresh_1 = require("./token-refresh");
|
|
11
45
|
const logger_1 = require("./logger");
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
function getCliVersion() {
|
|
49
|
+
try {
|
|
50
|
+
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
51
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
52
|
+
return packageJson.version;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return '0.0.0';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
12
58
|
class ApiClient {
|
|
13
59
|
constructor(apiOverride) {
|
|
14
|
-
const
|
|
15
|
-
this.config = config;
|
|
16
|
-
this.apiKey = apiKey;
|
|
17
|
-
this.apiUrl = (0, config_1.getApiUrl)(config, apiOverride);
|
|
60
|
+
const validated = (0, config_1.getValidatedConfig)();
|
|
61
|
+
this.config = validated.config;
|
|
62
|
+
this.apiKey = validated.apiKey;
|
|
63
|
+
this.apiUrl = (0, config_1.getApiUrl)(validated.config, apiOverride);
|
|
64
|
+
this.authMode = validated.authMode;
|
|
18
65
|
this.instance = axios_1.default.create({
|
|
19
66
|
baseURL: this.apiUrl,
|
|
20
67
|
timeout: 120000,
|
|
21
68
|
});
|
|
22
|
-
(0, logger_1.logDebug)(`ApiClient initialized with baseURL: ${this.apiUrl}`);
|
|
23
|
-
this.instance.interceptors.request.use((config) => {
|
|
69
|
+
(0, logger_1.logDebug)(`ApiClient initialized with baseURL: ${this.apiUrl}, authMode: ${this.authMode}`);
|
|
70
|
+
this.instance.interceptors.request.use(async (config) => {
|
|
24
71
|
config.headers = config.headers || {};
|
|
25
|
-
config.headers['x-
|
|
26
|
-
if (this.
|
|
27
|
-
|
|
72
|
+
config.headers['x-cli-version'] = getCliVersion();
|
|
73
|
+
if (this.authMode === 'jwt') {
|
|
74
|
+
const profile = (0, config_1.getCurrentProfile)();
|
|
75
|
+
let token = profile?.token;
|
|
76
|
+
if (profile && (0, config_1.isTokenExpired)(profile)) {
|
|
77
|
+
(0, logger_1.logDebug)('Token expired, attempting refresh...');
|
|
78
|
+
const newToken = await (0, token_refresh_1.refreshAccessToken)();
|
|
79
|
+
if (newToken) {
|
|
80
|
+
token = newToken;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
(0, logger_1.logDebug)('Token refresh failed, using expired token');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (token) {
|
|
87
|
+
config.headers['Authorization'] = `Bearer ${token}`;
|
|
88
|
+
}
|
|
89
|
+
if (this.config.tenantId && !config.skipTenantHeader) {
|
|
90
|
+
config.headers['x-tenant-id'] = this.config.tenantId;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
config.headers['x-api-key'] = this.apiKey;
|
|
95
|
+
if (this.config.tenantId && !config.skipTenantHeader) {
|
|
96
|
+
config.headers['x-runflow-tenant-id'] = this.config.tenantId;
|
|
97
|
+
}
|
|
28
98
|
}
|
|
29
99
|
(0, logger_1.logDebug)(`API Request: ${config.method?.toUpperCase()} ${config.baseURL}${config.url}`);
|
|
30
|
-
(0, logger_1.logDebug)(`
|
|
100
|
+
(0, logger_1.logDebug)(`Auth mode: ${this.authMode}`);
|
|
31
101
|
return config;
|
|
32
102
|
});
|
|
33
103
|
this.instance.interceptors.response.use((response) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/common/api-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/common/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkKA,0CAEC;AAGD,gCA2BC;AAlMD,kDAAgF;AAChF,qCAAuG;AACvG,mDAAqD;AACrD,qCAAoC;AACpC,2CAA6B;AAC7B,uCAAyB;AAczB,SAAS,aAAa;IACpB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACzE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;QACzE,OAAO,WAAW,CAAC,OAAO,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAa,SAAS;IAOpB,YAAY,WAAoB;QAC9B,MAAM,SAAS,GAAG,IAAA,2BAAkB,GAAE,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAA,kBAAS,EAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QAEnC,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC;YAC3B,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,uCAAuC,IAAI,CAAC,MAAM,eAAe,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAG3F,IAAI,CAAC,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O,WAAW,CAAC,IAAI,CAAC;QAC1B,KAAK,MAAM;YACT,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,IAAI,CAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAC7D,OAAO,YAAY,CAAC,IAAI,CAAC;QAC3B,KAAK,KAAK;YACR,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,GAAG,CAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAC3D,OAAO,WAAW,CAAC,IAAI,CAAC;QAC1B,KAAK,OAAO;YACV,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,KAAK,CAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAC/D,OAAO,aAAa,CAAC,IAAI,CAAC;QAC5B,KAAK,QAAQ;YACX,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,MAAM,CAAI,GAAG,EAAE,MAAM,CAAC,CAAC;YAC3D,OAAO,cAAc,CAAC,IAAI,CAAC;QAC7B;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Auth0Tokens {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken?: string;
|
|
4
|
+
idToken?: string;
|
|
5
|
+
expiresIn: number;
|
|
6
|
+
tokenType: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function auth0Login(): Promise<Auth0Tokens>;
|
|
9
|
+
export declare function decodeJwtPayload(token: string): Record<string, any>;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.auth0Login = auth0Login;
|
|
40
|
+
exports.decodeJwtPayload = decodeJwtPayload;
|
|
41
|
+
const crypto = __importStar(require("crypto"));
|
|
42
|
+
const http = __importStar(require("http"));
|
|
43
|
+
const url = __importStar(require("url"));
|
|
44
|
+
const child_process_1 = require("child_process");
|
|
45
|
+
const axios_1 = __importDefault(require("axios"));
|
|
46
|
+
const config_1 = require("./config");
|
|
47
|
+
const logger_1 = require("./logger");
|
|
48
|
+
function openBrowser(targetUrl) {
|
|
49
|
+
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
50
|
+
const args = process.platform === 'win32' ? ['/c', 'start', '', targetUrl] : [targetUrl];
|
|
51
|
+
const bin = process.platform === 'win32' ? 'cmd' : cmd;
|
|
52
|
+
(0, child_process_1.spawn)(bin, args, { detached: true, stdio: 'ignore' }).unref();
|
|
53
|
+
}
|
|
54
|
+
function generateCodeVerifier() {
|
|
55
|
+
return crypto.randomBytes(32).toString('base64url');
|
|
56
|
+
}
|
|
57
|
+
function generateCodeChallenge(verifier) {
|
|
58
|
+
return crypto.createHash('sha256').update(verifier).digest('base64url');
|
|
59
|
+
}
|
|
60
|
+
function generateState() {
|
|
61
|
+
return crypto.randomBytes(16).toString('hex');
|
|
62
|
+
}
|
|
63
|
+
async function findAvailablePort() {
|
|
64
|
+
for (const port of config_1.AUTH0_CONFIG.callbackPorts) {
|
|
65
|
+
try {
|
|
66
|
+
await new Promise((resolve, reject) => {
|
|
67
|
+
const server = http.createServer();
|
|
68
|
+
server.once('error', reject);
|
|
69
|
+
server.once('listening', () => {
|
|
70
|
+
server.close(() => resolve());
|
|
71
|
+
});
|
|
72
|
+
server.listen(port, '127.0.0.1');
|
|
73
|
+
});
|
|
74
|
+
return port;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
throw new Error('No available port found for callback server (tried 8630-8640)');
|
|
81
|
+
}
|
|
82
|
+
function startCallbackServer(port, expectedState) {
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
const timeout = setTimeout(() => {
|
|
85
|
+
server.close();
|
|
86
|
+
reject(new Error('Login timed out (5 minutes). Please try again.'));
|
|
87
|
+
}, 5 * 60 * 1000);
|
|
88
|
+
const server = http.createServer((req, res) => {
|
|
89
|
+
const parsedUrl = url.parse(req.url || '', true);
|
|
90
|
+
if (parsedUrl.pathname === '/callback') {
|
|
91
|
+
const code = parsedUrl.query.code;
|
|
92
|
+
const state = parsedUrl.query.state;
|
|
93
|
+
const error = parsedUrl.query.error;
|
|
94
|
+
const errorDescription = parsedUrl.query.error_description;
|
|
95
|
+
if (error) {
|
|
96
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
97
|
+
res.end(getErrorPage(errorDescription || error));
|
|
98
|
+
clearTimeout(timeout);
|
|
99
|
+
server.close();
|
|
100
|
+
reject(new Error(errorDescription || error));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (state !== expectedState) {
|
|
104
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
105
|
+
res.end(getErrorPage('Invalid state parameter. Possible CSRF attack.'));
|
|
106
|
+
clearTimeout(timeout);
|
|
107
|
+
server.close();
|
|
108
|
+
reject(new Error('Invalid state parameter'));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!code) {
|
|
112
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
113
|
+
res.end(getErrorPage('No authorization code received'));
|
|
114
|
+
clearTimeout(timeout);
|
|
115
|
+
server.close();
|
|
116
|
+
reject(new Error('No authorization code received'));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
120
|
+
res.end(getSuccessPage());
|
|
121
|
+
clearTimeout(timeout);
|
|
122
|
+
server.close();
|
|
123
|
+
resolve(code);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
res.writeHead(404);
|
|
127
|
+
res.end();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
server.listen(port, '127.0.0.1', () => {
|
|
131
|
+
(0, logger_1.logDebug)(`Callback server listening on http://127.0.0.1:${port}/callback`);
|
|
132
|
+
});
|
|
133
|
+
server.on('error', (err) => {
|
|
134
|
+
clearTimeout(timeout);
|
|
135
|
+
reject(err);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async function exchangeCodeForTokens(code, codeVerifier, redirectUri) {
|
|
140
|
+
const response = await axios_1.default.post(`${config_1.AUTH0_CONFIG.domain}/oauth/token`, {
|
|
141
|
+
grant_type: 'authorization_code',
|
|
142
|
+
client_id: config_1.AUTH0_CONFIG.clientId,
|
|
143
|
+
code,
|
|
144
|
+
code_verifier: codeVerifier,
|
|
145
|
+
redirect_uri: redirectUri,
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
accessToken: response.data.access_token,
|
|
149
|
+
refreshToken: response.data.refresh_token,
|
|
150
|
+
idToken: response.data.id_token,
|
|
151
|
+
expiresIn: response.data.expires_in,
|
|
152
|
+
tokenType: response.data.token_type,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async function auth0Login() {
|
|
156
|
+
const codeVerifier = generateCodeVerifier();
|
|
157
|
+
const codeChallenge = generateCodeChallenge(codeVerifier);
|
|
158
|
+
const state = generateState();
|
|
159
|
+
const port = await findAvailablePort();
|
|
160
|
+
const redirectUri = `http://localhost:${port}/callback`;
|
|
161
|
+
(0, logger_1.logDebug)(`Using callback: ${redirectUri}`);
|
|
162
|
+
const authUrl = new URL(`${config_1.AUTH0_CONFIG.domain}/authorize`);
|
|
163
|
+
authUrl.searchParams.set('response_type', 'code');
|
|
164
|
+
authUrl.searchParams.set('client_id', config_1.AUTH0_CONFIG.clientId);
|
|
165
|
+
authUrl.searchParams.set('redirect_uri', redirectUri);
|
|
166
|
+
authUrl.searchParams.set('scope', 'openid profile email offline_access');
|
|
167
|
+
authUrl.searchParams.set('audience', config_1.AUTH0_CONFIG.audience);
|
|
168
|
+
authUrl.searchParams.set('code_challenge', codeChallenge);
|
|
169
|
+
authUrl.searchParams.set('code_challenge_method', 'S256');
|
|
170
|
+
authUrl.searchParams.set('state', state);
|
|
171
|
+
const codePromise = startCallbackServer(port, state);
|
|
172
|
+
try {
|
|
173
|
+
openBrowser(authUrl.toString());
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
(0, logger_1.logError)(`Could not open browser. Please visit this URL manually:\n${authUrl.toString()}`);
|
|
177
|
+
}
|
|
178
|
+
const code = await codePromise;
|
|
179
|
+
const tokens = await exchangeCodeForTokens(code, codeVerifier, redirectUri);
|
|
180
|
+
return tokens;
|
|
181
|
+
}
|
|
182
|
+
function decodeJwtPayload(token) {
|
|
183
|
+
const parts = token.split('.');
|
|
184
|
+
if (parts.length !== 3) {
|
|
185
|
+
throw new Error('Invalid JWT format');
|
|
186
|
+
}
|
|
187
|
+
return JSON.parse(Buffer.from(parts[1], 'base64url').toString());
|
|
188
|
+
}
|
|
189
|
+
function getSuccessPage() {
|
|
190
|
+
return `<!DOCTYPE html>
|
|
191
|
+
<html>
|
|
192
|
+
<head><title>Runflow CLI - Login Successful</title></head>
|
|
193
|
+
<body style="font-family: -apple-system, system-ui, sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: #0a0a0a; color: #fafafa;">
|
|
194
|
+
<div style="text-align: center; max-width: 400px;">
|
|
195
|
+
<h1 style="color: #22c55e; font-size: 2rem;">Login successful!</h1>
|
|
196
|
+
<p style="color: #a1a1aa;">This window will close automatically...</p>
|
|
197
|
+
</div>
|
|
198
|
+
<script>setTimeout(function() { window.close(); }, 1500);</script>
|
|
199
|
+
</body>
|
|
200
|
+
</html>`;
|
|
201
|
+
}
|
|
202
|
+
function getErrorPage(message) {
|
|
203
|
+
return `<!DOCTYPE html>
|
|
204
|
+
<html>
|
|
205
|
+
<head><title>Runflow CLI - Login Failed</title></head>
|
|
206
|
+
<body style="font-family: -apple-system, system-ui, sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: #0a0a0a; color: #fafafa;">
|
|
207
|
+
<div style="text-align: center; max-width: 400px;">
|
|
208
|
+
<h1 style="color: #ef4444; font-size: 2rem;">Login failed</h1>
|
|
209
|
+
<p style="color: #a1a1aa;">${message}</p>
|
|
210
|
+
<p style="color: #71717a;">Please try again in the terminal.</p>
|
|
211
|
+
</div>
|
|
212
|
+
</body>
|
|
213
|
+
</html>`;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=auth0-login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth0-login.js","sourceRoot":"","sources":["../../src/common/auth0-login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqKA,gCAwCC;AAKD,4CAMC;AAxND,+CAAiC;AACjC,2CAA6B;AAC7B,yCAA2B;AAC3B,iDAAsC;AACtC,kDAA0B;AAC1B,qCAAwC;AACxC,qCAA8C;AAE9C,SAAS,WAAW,CAAC,SAAiB;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IACzG,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACzF,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACvD,IAAA,qBAAK,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;AAChE,CAAC;AAaD,SAAS,oBAAoB;IAC3B,OAAO,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACtD,CAAC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AO;;;;QAIhC,CAAC;AACT,CAAC"}
|
package/dist/common/config.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export declare const DEFAULT_API_URL = "https://api.runflow.ai/api/v1/runtime";
|
|
2
2
|
export interface ProfileConfig {
|
|
3
|
-
apiKey
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
refreshToken?: string;
|
|
6
|
+
tokenExpiresAt?: string;
|
|
7
|
+
email?: string;
|
|
4
8
|
api?: string;
|
|
5
9
|
tenantId?: string;
|
|
6
10
|
agentId?: string;
|
|
@@ -11,14 +15,29 @@ export interface MultiTenantConfig {
|
|
|
11
15
|
profiles: Record<string, ProfileConfig>;
|
|
12
16
|
}
|
|
13
17
|
export interface Config {
|
|
14
|
-
apiKey
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
token?: string;
|
|
20
|
+
refreshToken?: string;
|
|
21
|
+
tokenExpiresAt?: string;
|
|
22
|
+
email?: string;
|
|
15
23
|
api?: string;
|
|
16
24
|
tenantId?: string;
|
|
17
25
|
agentId?: string;
|
|
26
|
+
tenantName?: string;
|
|
18
27
|
}
|
|
28
|
+
export declare const AUTH0_CONFIG: {
|
|
29
|
+
readonly domain: "https://auth.runflow.ai";
|
|
30
|
+
readonly clientId: "U9oFy9oHiRC0doXj9OiV4ZWIlvJmYHHI";
|
|
31
|
+
readonly audience: "https://api.runflow.ai";
|
|
32
|
+
readonly callbackPorts: readonly [8630, 8631, 8632, 8633, 8634, 8635, 8636, 8637, 8638, 8639, 8640];
|
|
33
|
+
};
|
|
34
|
+
export declare function isTokenExpired(profile: ProfileConfig): boolean;
|
|
35
|
+
export declare function isJwtAuth(profile: ProfileConfig): boolean;
|
|
36
|
+
export declare function updateCurrentProfileToken(token: string, expiresAt: string): void;
|
|
19
37
|
export declare const ERROR_MESSAGES: {
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
38
|
+
readonly AUTH_REQUIRED: "Authentication required. Please login with: rf login";
|
|
39
|
+
readonly API_KEY_REQUIRED: "API key is required. Please login first with: rf login";
|
|
40
|
+
readonly TENANT_NOT_SELECTED: "No tenant configured. Please login again with: rf login";
|
|
22
41
|
readonly AGENT_NOT_SELECTED: "No agent selected. Please run: rf agents list";
|
|
23
42
|
readonly AGENT_NOT_DETECTED: string;
|
|
24
43
|
readonly DATA_REQUIRED: "Data parameter is required";
|
|
@@ -28,7 +47,7 @@ export declare const ERROR_MESSAGES: {
|
|
|
28
47
|
readonly REQUEST_FAILED: (error: string) => string;
|
|
29
48
|
readonly CONFIG_LOAD_FAILED: "Failed to load configuration";
|
|
30
49
|
readonly PROFILE_NOT_FOUND: (profile: string) => string;
|
|
31
|
-
readonly NO_PROFILES: "No profiles configured. Please login first: rf login
|
|
50
|
+
readonly NO_PROFILES: "No profiles configured. Please login first: rf login";
|
|
32
51
|
};
|
|
33
52
|
export declare function loadFullConfig(): MultiTenantConfig;
|
|
34
53
|
export declare function saveProfile(profileName: string, profileConfig: ProfileConfig): void;
|
|
@@ -47,4 +66,5 @@ export declare function getValidatedConfig(): {
|
|
|
47
66
|
config: Config;
|
|
48
67
|
apiUrl: string;
|
|
49
68
|
apiKey: string;
|
|
69
|
+
authMode: 'jwt' | 'apikey';
|
|
50
70
|
};
|
package/dist/common/config.js
CHANGED
|
@@ -33,7 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ERROR_MESSAGES = exports.DEFAULT_API_URL = void 0;
|
|
36
|
+
exports.ERROR_MESSAGES = exports.AUTH0_CONFIG = exports.DEFAULT_API_URL = void 0;
|
|
37
|
+
exports.isTokenExpired = isTokenExpired;
|
|
38
|
+
exports.isJwtAuth = isJwtAuth;
|
|
39
|
+
exports.updateCurrentProfileToken = updateCurrentProfileToken;
|
|
37
40
|
exports.loadFullConfig = loadFullConfig;
|
|
38
41
|
exports.saveProfile = saveProfile;
|
|
39
42
|
exports.getCurrentProfile = getCurrentProfile;
|
|
@@ -49,9 +52,34 @@ const os = __importStar(require("os"));
|
|
|
49
52
|
const path = __importStar(require("path"));
|
|
50
53
|
const YAML = __importStar(require("yaml"));
|
|
51
54
|
exports.DEFAULT_API_URL = 'https://api.runflow.ai/api/v1/runtime';
|
|
55
|
+
exports.AUTH0_CONFIG = {
|
|
56
|
+
domain: 'https://auth.runflow.ai',
|
|
57
|
+
clientId: 'U9oFy9oHiRC0doXj9OiV4ZWIlvJmYHHI',
|
|
58
|
+
audience: 'https://api.runflow.ai',
|
|
59
|
+
callbackPorts: [8630, 8631, 8632, 8633, 8634, 8635, 8636, 8637, 8638, 8639, 8640],
|
|
60
|
+
};
|
|
61
|
+
function isTokenExpired(profile) {
|
|
62
|
+
if (!profile.tokenExpiresAt)
|
|
63
|
+
return true;
|
|
64
|
+
const expiresAt = new Date(profile.tokenExpiresAt).getTime();
|
|
65
|
+
return Date.now() >= expiresAt - 60_000;
|
|
66
|
+
}
|
|
67
|
+
function isJwtAuth(profile) {
|
|
68
|
+
return !!profile.token;
|
|
69
|
+
}
|
|
70
|
+
function updateCurrentProfileToken(token, expiresAt) {
|
|
71
|
+
const fullConfig = loadFullConfig();
|
|
72
|
+
const currentProfileName = fullConfig.currentProfile;
|
|
73
|
+
if (currentProfileName && fullConfig.profiles[currentProfileName]) {
|
|
74
|
+
fullConfig.profiles[currentProfileName].token = token;
|
|
75
|
+
fullConfig.profiles[currentProfileName].tokenExpiresAt = expiresAt;
|
|
76
|
+
fs.writeFileSync(configFile(), YAML.stringify(fullConfig));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
52
79
|
exports.ERROR_MESSAGES = {
|
|
53
|
-
|
|
54
|
-
|
|
80
|
+
AUTH_REQUIRED: 'Authentication required. Please login with: rf login',
|
|
81
|
+
API_KEY_REQUIRED: 'API key is required. Please login first with: rf login',
|
|
82
|
+
TENANT_NOT_SELECTED: 'No tenant configured. Please login again with: rf login',
|
|
55
83
|
AGENT_NOT_SELECTED: 'No agent selected. Please run: rf agents list',
|
|
56
84
|
AGENT_NOT_DETECTED: 'No agent detected in current directory. Either:\n' +
|
|
57
85
|
' 1. Run from a cloned agent directory, or\n' +
|
|
@@ -63,7 +91,7 @@ exports.ERROR_MESSAGES = {
|
|
|
63
91
|
REQUEST_FAILED: (error) => `Request failed: ${error}`,
|
|
64
92
|
CONFIG_LOAD_FAILED: 'Failed to load configuration',
|
|
65
93
|
PROFILE_NOT_FOUND: (profile) => `Profile "${profile}" not found`,
|
|
66
|
-
NO_PROFILES: 'No profiles configured. Please login first: rf login
|
|
94
|
+
NO_PROFILES: 'No profiles configured. Please login first: rf login',
|
|
67
95
|
};
|
|
68
96
|
function configFile() {
|
|
69
97
|
return path.join(os.homedir(), '.runflowrc');
|
|
@@ -82,8 +110,8 @@ function loadFullConfig() {
|
|
|
82
110
|
api: parsed.api,
|
|
83
111
|
tenantId: parsed.tenantId,
|
|
84
112
|
agentId: parsed.agentId,
|
|
85
|
-
}
|
|
86
|
-
}
|
|
113
|
+
},
|
|
114
|
+
},
|
|
87
115
|
};
|
|
88
116
|
}
|
|
89
117
|
return parsed;
|
|
@@ -91,7 +119,7 @@ function loadFullConfig() {
|
|
|
91
119
|
catch {
|
|
92
120
|
return {
|
|
93
121
|
currentProfile: 'default',
|
|
94
|
-
profiles: {}
|
|
122
|
+
profiles: {},
|
|
95
123
|
};
|
|
96
124
|
}
|
|
97
125
|
}
|
|
@@ -134,7 +162,7 @@ function deleteProfile(profileName) {
|
|
|
134
162
|
}
|
|
135
163
|
const profileCount = Object.keys(fullConfig.profiles).length;
|
|
136
164
|
if (profileName === fullConfig.currentProfile && profileCount > 1) {
|
|
137
|
-
const otherProfile = Object.keys(fullConfig.profiles).find(p => p !== profileName);
|
|
165
|
+
const otherProfile = Object.keys(fullConfig.profiles).find((p) => p !== profileName);
|
|
138
166
|
if (otherProfile) {
|
|
139
167
|
fullConfig.currentProfile = otherProfile;
|
|
140
168
|
}
|
|
@@ -156,22 +184,31 @@ function loadConfig() {
|
|
|
156
184
|
return getCurrentProfile();
|
|
157
185
|
}
|
|
158
186
|
function getApiUrl(config, override) {
|
|
159
|
-
return override ||
|
|
160
|
-
process.env.RUNFLOW_API_URL ||
|
|
161
|
-
config?.api ||
|
|
162
|
-
exports.DEFAULT_API_URL;
|
|
187
|
+
return override || process.env.RUNFLOW_API_URL || config?.api || exports.DEFAULT_API_URL;
|
|
163
188
|
}
|
|
164
189
|
function getValidatedConfig() {
|
|
165
190
|
const config = loadConfig();
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
191
|
+
if (!config) {
|
|
192
|
+
throw new Error(exports.ERROR_MESSAGES.AUTH_REQUIRED);
|
|
193
|
+
}
|
|
194
|
+
if (config.token) {
|
|
195
|
+
const apiUrl = getApiUrl(config);
|
|
196
|
+
return {
|
|
197
|
+
config: config,
|
|
198
|
+
apiUrl,
|
|
199
|
+
apiKey: config.token,
|
|
200
|
+
authMode: 'jwt',
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (!config.apiKey) {
|
|
204
|
+
throw new Error(exports.ERROR_MESSAGES.AUTH_REQUIRED);
|
|
169
205
|
}
|
|
170
206
|
const apiUrl = getApiUrl(config);
|
|
171
207
|
return {
|
|
172
208
|
config: config,
|
|
173
209
|
apiUrl,
|
|
174
|
-
apiKey
|
|
210
|
+
apiKey: config.apiKey,
|
|
211
|
+
authMode: 'apikey',
|
|
175
212
|
};
|
|
176
213
|
}
|
|
177
214
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/common/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/common/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,wCAIC;A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,MAAM,EAAE,MAAM,CAAC,KAAK;YACpB,QAAQ,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;IAGD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,sBAAc,CAAC,aAAa,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEjC,OAAO;QACL,MAAM,EAAE,MAAgB;QACxB,MAAM;QACN,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC"}
|
package/dist/common/help.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COMMAND_TREE = "\nUsage: rf [options] [command]\n\n\uD83D\uDE80 Main Workflow:\n login Authenticate
|
|
1
|
+
export declare const COMMAND_TREE = "\nUsage: rf [options] [command]\n\n\uD83D\uDE80 Main Workflow:\n login Authenticate (opens browser)\n switch [tenant] Switch between tenants\n whoami Show current user and tenant info\n create Create a new agent project\n agents <action> Manage AI agents\n\n\uD83D\uDCCA Management:\n users <action> Manage team users\n profiles List all profiles/tenants\n\n\uD83D\uDEE0\uFE0F Developer Tools:\n prompts <action> Manage prompts and templates\n credentials <action> Manage API credentials\n\nQuick Start:\n 1. rf login (opens browser for Auth0 login)\n or: rf login\n 2. rf agents list\n 3. Select agent \u2192 clone \u2192 make changes \u2192 deploy\n\nOptions:\n --verbose Show detailed output\n --quiet Suppress output\n --version, -v Show version number\n --help, -h Show this help\n\nUse \"rf <command> --help\" for detailed information about each command.\n";
|
|
2
2
|
export declare function showTree(): void;
|
package/dist/common/help.js
CHANGED
|
@@ -6,21 +6,23 @@ exports.COMMAND_TREE = `
|
|
|
6
6
|
Usage: rf [options] [command]
|
|
7
7
|
|
|
8
8
|
🚀 Main Workflow:
|
|
9
|
-
login Authenticate
|
|
10
|
-
switch
|
|
11
|
-
|
|
9
|
+
login Authenticate (opens browser)
|
|
10
|
+
switch [tenant] Switch between tenants
|
|
11
|
+
whoami Show current user and tenant info
|
|
12
|
+
create Create a new agent project
|
|
12
13
|
agents <action> Manage AI agents
|
|
13
14
|
|
|
14
15
|
📊 Management:
|
|
15
|
-
users <action> Manage team users
|
|
16
|
+
users <action> Manage team users
|
|
16
17
|
profiles List all profiles/tenants
|
|
17
|
-
|
|
18
|
+
|
|
18
19
|
🛠️ Developer Tools:
|
|
19
20
|
prompts <action> Manage prompts and templates
|
|
20
21
|
credentials <action> Manage API credentials
|
|
21
22
|
|
|
22
23
|
Quick Start:
|
|
23
|
-
1. rf login
|
|
24
|
+
1. rf login (opens browser for Auth0 login)
|
|
25
|
+
or: rf login
|
|
24
26
|
2. rf agents list
|
|
25
27
|
3. Select agent → clone → make changes → deploy
|
|
26
28
|
|
|
@@ -29,7 +31,7 @@ Options:
|
|
|
29
31
|
--quiet Suppress output
|
|
30
32
|
--version, -v Show version number
|
|
31
33
|
--help, -h Show this help
|
|
32
|
-
|
|
34
|
+
|
|
33
35
|
Use "rf <command> --help" for detailed information about each command.
|
|
34
36
|
`;
|
|
35
37
|
function showTree() {
|
package/dist/common/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/common/help.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/common/help.ts"],"names":[],"mappings":";;;AAkCA,4BAGC;AApCY,QAAA,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B3B,CAAC;AAEF,SAAgB,QAAQ;IAEtB,OAAO,CAAC,GAAG,CAAC,oBAAY,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function refreshAccessToken(): Promise<string | null>;
|