ft-scout 9.5.8 → 9.5.9
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/bin/src/commands/signup.js +0 -9
- package/bin/src/engine/browser/actions/actionEngine.js +1 -1
- package/bin/src/engine/browser/observer/browserObserver.js +1 -1
- package/bin/src/index.js +4 -4
- package/bin/src/mcp/client.js +1 -1
- package/bin/src/server/server.js +222 -1
- package/bin/src/utils/branding.js +1 -1
- package/bin/src/utils/qrBridge.js +1 -1
- package/bin/src/utils/support.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@ import chalk from 'chalk';
|
|
|
3
3
|
import { safeNote } from '../utils/markdown.js';
|
|
4
4
|
import { saveAuthConfig } from '../utils/auth.js';
|
|
5
5
|
import { firebaseSignUp, FIREBASE_TENANT_ID } from '../utils/firebaseAuth.js';
|
|
6
|
-
import { dispatchAmbientWelcomeEmail } from '../utils/email.js';
|
|
7
6
|
export async function handleSignup(options) {
|
|
8
7
|
let name = options?.name?.trim();
|
|
9
8
|
let email = options?.email?.trim();
|
|
@@ -93,14 +92,6 @@ export async function handleSignup(options) {
|
|
|
93
92
|
user: authRes.user,
|
|
94
93
|
loggedInAt: new Date().toISOString(),
|
|
95
94
|
});
|
|
96
|
-
// Dispatch Welcome Email asynchronously
|
|
97
|
-
await dispatchAmbientWelcomeEmail({
|
|
98
|
-
name,
|
|
99
|
-
email,
|
|
100
|
-
userId: authRes.user.id,
|
|
101
|
-
idToken: authRes.token,
|
|
102
|
-
tenantId: FIREBASE_TENANT_ID,
|
|
103
|
-
});
|
|
104
95
|
s.stop(chalk.green(` ${isHoloseneMode ? 'Holosene' : 'FrontTerrain'} account registered successfully!`));
|
|
105
96
|
safeNote(`${chalk.bold.green('Account Created for ' + name + '!')}\n\n` +
|
|
106
97
|
`Account Email: ${chalk.bold.cyan(email)}\n` +
|
|
@@ -73,7 +73,7 @@ export class BrowserActionEngine {
|
|
|
73
73
|
else if (cleanUrl.startsWith('http')) {
|
|
74
74
|
try {
|
|
75
75
|
const res = await fetch(cleanUrl, {
|
|
76
|
-
headers: { 'User-Agent': 'Scout-ActionEngine/9.5.
|
|
76
|
+
headers: { 'User-Agent': 'Scout-ActionEngine/9.5.9' },
|
|
77
77
|
signal: AbortSignal.timeout(15000),
|
|
78
78
|
});
|
|
79
79
|
if (res.ok) {
|
|
@@ -20,7 +20,7 @@ export class BrowserObserver {
|
|
|
20
20
|
if (!html && url.startsWith('http')) {
|
|
21
21
|
try {
|
|
22
22
|
const res = await fetch(url, {
|
|
23
|
-
headers: { 'User-Agent': 'Scout-BrowserObserver/9.5.
|
|
23
|
+
headers: { 'User-Agent': 'Scout-BrowserObserver/9.5.9' },
|
|
24
24
|
signal: AbortSignal.timeout(10000),
|
|
25
25
|
});
|
|
26
26
|
if (res.ok) {
|
package/bin/src/index.js
CHANGED
|
@@ -40,13 +40,13 @@ program
|
|
|
40
40
|
.name('scout')
|
|
41
41
|
.alias('ft')
|
|
42
42
|
.description('FrontTerrain The Onboarding Co-Pilot for New Codebases')
|
|
43
|
-
.version('9.5.
|
|
43
|
+
.version('9.5.9');
|
|
44
44
|
// Header UI on execution with FrontTerrain proprietary logo & version auto-checker
|
|
45
45
|
program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
46
|
-
intro(renderBranding('9.5.
|
|
46
|
+
intro(renderBranding('9.5.9'));
|
|
47
47
|
const cmdName = actionCommand ? actionCommand.name() : '';
|
|
48
48
|
if (cmdName !== 'upgrade') {
|
|
49
|
-
await checkForUpdates('9.5.
|
|
49
|
+
await checkForUpdates('9.5.9');
|
|
50
50
|
}
|
|
51
51
|
// Auth Guard: enforce authentication for all commands except login, signup, upgrade, help, dashboard, auth, status, plan, mcp, switch, accounts, support, replay
|
|
52
52
|
const EXEMPT_COMMANDS = ['login', 'signin', 'signup', 'register', 'upgrade', 'help', 'dashboard', 'web-ui', 'gui', 'auth', 'status', 'quota', 'usage', 'credits', 'plan', 'pricing', 'subscribe', 'mcp', 'switch', 'accounts', 'account', 'support', 'ticket', 'helpdesk', 'replay', 'trace'];
|
|
@@ -267,7 +267,7 @@ program
|
|
|
267
267
|
.command('upgrade')
|
|
268
268
|
.description('Check for updates and auto-upgrade Scout to the latest version')
|
|
269
269
|
.action(async () => {
|
|
270
|
-
await checkForUpdates('9.5.
|
|
270
|
+
await checkForUpdates('9.5.9', true);
|
|
271
271
|
outro(chalk.cyan('Upgrade check complete.'));
|
|
272
272
|
});
|
|
273
273
|
program
|
package/bin/src/mcp/client.js
CHANGED
package/bin/src/server/server.js
CHANGED
|
@@ -15,6 +15,7 @@ import { ApprovalManager } from '../engine/safety.js';
|
|
|
15
15
|
import { AgentExecutionLoop } from '../engine/agentEngine.js';
|
|
16
16
|
import { getMCPManager, MCPTelemetry } from '../mcp/index.js';
|
|
17
17
|
import { loadSupportTickets, createSupportTicket, getSupportTicket, addTicketMessage, updateTicketStatus, collectSanitizedDiagnostics, getPresetFaqs, } from '../utils/support.js';
|
|
18
|
+
import { firebaseSignUp, FIREBASE_TENANT_ID, FIREBASE_API_KEY, FIREBASE_PROJECT_ID } from '../utils/firebaseAuth.js';
|
|
18
19
|
let activeAgentLoop = null;
|
|
19
20
|
const serverStateManager = new TaskStateManager(process.cwd());
|
|
20
21
|
const DEFAULT_PORT = 9120;
|
|
@@ -1226,13 +1227,233 @@ export function startDashboardServer(port = DEFAULT_PORT) {
|
|
|
1226
1227
|
});
|
|
1227
1228
|
return;
|
|
1228
1229
|
}
|
|
1230
|
+
// POST /api/prelaunch/register - Pre-launch VIP Waitlist & 1,000 Token Voucher
|
|
1231
|
+
if (pathname === '/api/prelaunch/register' && req.method === 'POST') {
|
|
1232
|
+
let body = '';
|
|
1233
|
+
req.on('data', chunk => body += chunk);
|
|
1234
|
+
req.on('end', async () => {
|
|
1235
|
+
try {
|
|
1236
|
+
const data = JSON.parse(body || '{}');
|
|
1237
|
+
if (!data.name || !data.email) {
|
|
1238
|
+
res.writeHead(400);
|
|
1239
|
+
res.end(JSON.stringify({ success: false, error: 'Name and email are required.' }));
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
const normalizedEmail = data.email.toLowerCase().trim();
|
|
1243
|
+
const ftDir = path.join(process.cwd(), '.ft');
|
|
1244
|
+
if (!fs.existsSync(ftDir)) {
|
|
1245
|
+
fs.mkdirSync(ftDir, { recursive: true });
|
|
1246
|
+
}
|
|
1247
|
+
const regFile = path.join(ftDir, 'prelaunch_registrations.json');
|
|
1248
|
+
let registrations = [];
|
|
1249
|
+
if (fs.existsSync(regFile)) {
|
|
1250
|
+
try {
|
|
1251
|
+
registrations = JSON.parse(fs.readFileSync(regFile, 'utf-8'));
|
|
1252
|
+
}
|
|
1253
|
+
catch { }
|
|
1254
|
+
}
|
|
1255
|
+
const existing = registrations.find((r) => r.email && r.email.toLowerCase().trim() === normalizedEmail);
|
|
1256
|
+
if (existing) {
|
|
1257
|
+
res.writeHead(200);
|
|
1258
|
+
res.end(JSON.stringify({
|
|
1259
|
+
success: true,
|
|
1260
|
+
alreadyRegistered: true,
|
|
1261
|
+
message: 'Email is already registered. Returning existing VIP pass.',
|
|
1262
|
+
name: existing.name,
|
|
1263
|
+
email: existing.email,
|
|
1264
|
+
role: existing.role || 'creator',
|
|
1265
|
+
voucherCode: existing.voucherCode,
|
|
1266
|
+
tenantId: existing.tenantId || FIREBASE_TENANT_ID,
|
|
1267
|
+
tenantUid: existing.tenantUid || 'Cloud Verified',
|
|
1268
|
+
baseTokens: existing.baseTokens || 1000,
|
|
1269
|
+
bonusTokens: existing.bonusTokens || 0,
|
|
1270
|
+
tokensGranted: existing.tokensGranted || (1000 + (existing.bonusTokens || 0)),
|
|
1271
|
+
referralCount: existing.referralCount || 0,
|
|
1272
|
+
waitlistRank: existing.waitlistRank || 428,
|
|
1273
|
+
registeredAt: existing.registeredAt,
|
|
1274
|
+
}));
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
const cleanName = data.name.replace(/[^a-zA-Z0-9]/g, '').slice(0, 4).toUpperCase() || 'VIP';
|
|
1278
|
+
const randomSuffix = Math.random().toString(36).substring(2, 6).toUpperCase();
|
|
1279
|
+
const voucherCode = data.voucherCode || `ENGLERT-${cleanName}-${randomSuffix}`;
|
|
1280
|
+
const waitlistRank = 428 + registrations.length + 1;
|
|
1281
|
+
// 1. Direct Cloud Provisioning in Scout Identity Platform Tenant (ft-scout-auth-gc2v5)
|
|
1282
|
+
let tenantUid = null;
|
|
1283
|
+
try {
|
|
1284
|
+
const authResult = await firebaseSignUp(data.name, normalizedEmail, `ScoutVIP@${voucherCode}!2026`);
|
|
1285
|
+
tenantUid = authResult?.user?.id || null;
|
|
1286
|
+
}
|
|
1287
|
+
catch (authErr) {
|
|
1288
|
+
if (authErr?.message?.includes('already exists') || authErr?.message?.includes('EMAIL_EXISTS')) {
|
|
1289
|
+
// User already exists in the tenant
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
// 2. Handle Referrer Bonus (+500 ENGLERT Tokens for the referrer)
|
|
1293
|
+
let referrerAwarded = false;
|
|
1294
|
+
let referredByCode = null;
|
|
1295
|
+
let awardedReferrer = null;
|
|
1296
|
+
if (data.refCode) {
|
|
1297
|
+
const cleanRef = data.refCode.toString().trim().toUpperCase();
|
|
1298
|
+
const referrer = registrations.find((r) => r.voucherCode && r.voucherCode.toUpperCase() === cleanRef);
|
|
1299
|
+
if (referrer && referrer.email.toLowerCase() !== normalizedEmail) {
|
|
1300
|
+
referrer.referralCount = (referrer.referralCount || 0) + 1;
|
|
1301
|
+
referrer.bonusTokens = (referrer.bonusTokens || 0) + 500;
|
|
1302
|
+
referrer.tokensGranted = (referrer.tokensGranted || 1000) + 500;
|
|
1303
|
+
referrer.lastReferralAt = new Date().toISOString();
|
|
1304
|
+
referrerAwarded = true;
|
|
1305
|
+
referredByCode = referrer.voucherCode;
|
|
1306
|
+
awardedReferrer = referrer;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
const newEntry = {
|
|
1310
|
+
name: data.name,
|
|
1311
|
+
email: normalizedEmail,
|
|
1312
|
+
role: data.role || 'creator',
|
|
1313
|
+
refCode: data.refCode || null,
|
|
1314
|
+
referredBy: referredByCode,
|
|
1315
|
+
voucherCode,
|
|
1316
|
+
tenantId: FIREBASE_TENANT_ID,
|
|
1317
|
+
tenantUid,
|
|
1318
|
+
waitlistRank,
|
|
1319
|
+
tokensGranted: 1000,
|
|
1320
|
+
bonusTokens: 0,
|
|
1321
|
+
referralCount: 0,
|
|
1322
|
+
registeredAt: new Date().toISOString(),
|
|
1323
|
+
cloudTenantVerified: true,
|
|
1324
|
+
};
|
|
1325
|
+
// 3. Direct write to Cloud Firestore collection 'prelaunch_registrations'
|
|
1326
|
+
try {
|
|
1327
|
+
const safeDocId = `doc_${normalizedEmail.replace(/[^a-zA-Z0-9]/g, '_')}`;
|
|
1328
|
+
const firestoreUrl = `https://firestore.googleapis.com/v1/projects/${FIREBASE_PROJECT_ID}/databases/(default)/documents/prelaunch_registrations/${safeDocId}?key=${FIREBASE_API_KEY}`;
|
|
1329
|
+
await fetch(firestoreUrl, {
|
|
1330
|
+
method: 'PATCH',
|
|
1331
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1332
|
+
body: JSON.stringify({
|
|
1333
|
+
fields: {
|
|
1334
|
+
name: { stringValue: data.name },
|
|
1335
|
+
email: { stringValue: normalizedEmail },
|
|
1336
|
+
role: { stringValue: data.role || 'creator' },
|
|
1337
|
+
voucherCode: { stringValue: voucherCode },
|
|
1338
|
+
tenantId: { stringValue: FIREBASE_TENANT_ID },
|
|
1339
|
+
tenantUid: { stringValue: tenantUid || '' },
|
|
1340
|
+
baseTokens: { integerValue: '1000' },
|
|
1341
|
+
bonusTokens: { integerValue: '0' },
|
|
1342
|
+
tokensGranted: { integerValue: '1000' },
|
|
1343
|
+
referralCount: { integerValue: '0' },
|
|
1344
|
+
refCode: { stringValue: data.refCode || '' },
|
|
1345
|
+
registeredAt: { stringValue: newEntry.registeredAt },
|
|
1346
|
+
cloudSynced: { booleanValue: true }
|
|
1347
|
+
}
|
|
1348
|
+
})
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
catch { }
|
|
1352
|
+
// 4. Update Referrer in Cloud Firestore if awarded
|
|
1353
|
+
if (referrerAwarded && awardedReferrer) {
|
|
1354
|
+
try {
|
|
1355
|
+
const refDocId = `doc_${awardedReferrer.email.replace(/[^a-zA-Z0-9]/g, '_').toLowerCase()}`;
|
|
1356
|
+
const refFirestoreUrl = `https://firestore.googleapis.com/v1/projects/${FIREBASE_PROJECT_ID}/databases/(default)/documents/prelaunch_registrations/${refDocId}?key=${FIREBASE_API_KEY}`;
|
|
1357
|
+
await fetch(refFirestoreUrl, {
|
|
1358
|
+
method: 'PATCH',
|
|
1359
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1360
|
+
body: JSON.stringify({
|
|
1361
|
+
fields: {
|
|
1362
|
+
name: { stringValue: awardedReferrer.name },
|
|
1363
|
+
email: { stringValue: awardedReferrer.email },
|
|
1364
|
+
voucherCode: { stringValue: awardedReferrer.voucherCode },
|
|
1365
|
+
tokensGranted: { integerValue: String(awardedReferrer.tokensGranted) },
|
|
1366
|
+
bonusTokens: { integerValue: String(awardedReferrer.bonusTokens) },
|
|
1367
|
+
referralCount: { integerValue: String(awardedReferrer.referralCount) },
|
|
1368
|
+
lastReferralAt: { stringValue: awardedReferrer.lastReferralAt }
|
|
1369
|
+
}
|
|
1370
|
+
})
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
catch { }
|
|
1374
|
+
}
|
|
1375
|
+
// 5. Update local cache
|
|
1376
|
+
registrations.push(newEntry);
|
|
1377
|
+
fs.writeFileSync(regFile, JSON.stringify(registrations, null, 2), 'utf-8');
|
|
1378
|
+
res.writeHead(201);
|
|
1379
|
+
res.end(JSON.stringify({
|
|
1380
|
+
success: true,
|
|
1381
|
+
voucherCode,
|
|
1382
|
+
tenantId: FIREBASE_TENANT_ID,
|
|
1383
|
+
tenantUid,
|
|
1384
|
+
tokensGranted: 1000,
|
|
1385
|
+
bonusTokens: 0,
|
|
1386
|
+
referralCount: 0,
|
|
1387
|
+
referrerAwarded,
|
|
1388
|
+
waitlistRank,
|
|
1389
|
+
totalRegistrations: waitlistRank,
|
|
1390
|
+
}));
|
|
1391
|
+
}
|
|
1392
|
+
catch (err) {
|
|
1393
|
+
res.writeHead(400);
|
|
1394
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to process registration' }));
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
// GET /api/prelaunch/status - Live user token balance & referral count
|
|
1400
|
+
if (pathname === '/api/prelaunch/status' && req.method === 'GET') {
|
|
1401
|
+
const code = parsedUrl.searchParams.get('code') || '';
|
|
1402
|
+
const email = parsedUrl.searchParams.get('email') || '';
|
|
1403
|
+
const regFile = path.join(process.cwd(), '.ft', 'prelaunch_registrations.json');
|
|
1404
|
+
let registrations = [];
|
|
1405
|
+
if (fs.existsSync(regFile)) {
|
|
1406
|
+
try {
|
|
1407
|
+
registrations = JSON.parse(fs.readFileSync(regFile, 'utf-8'));
|
|
1408
|
+
}
|
|
1409
|
+
catch { }
|
|
1410
|
+
}
|
|
1411
|
+
const user = registrations.find((r) => (code && r.voucherCode && r.voucherCode.toUpperCase() === code.trim().toUpperCase()) ||
|
|
1412
|
+
(email && r.email && r.email.toLowerCase() === email.trim().toLowerCase()));
|
|
1413
|
+
if (!user) {
|
|
1414
|
+
res.writeHead(404);
|
|
1415
|
+
res.end(JSON.stringify({ success: false, error: 'Registration not found' }));
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
res.writeHead(200);
|
|
1419
|
+
res.end(JSON.stringify({
|
|
1420
|
+
success: true,
|
|
1421
|
+
name: user.name,
|
|
1422
|
+
voucherCode: user.voucherCode,
|
|
1423
|
+
waitlistRank: user.waitlistRank,
|
|
1424
|
+
baseTokens: 1000,
|
|
1425
|
+
bonusTokens: user.bonusTokens || 0,
|
|
1426
|
+
totalTokens: user.tokensGranted || (1000 + (user.bonusTokens || 0)),
|
|
1427
|
+
referralCount: user.referralCount || 0,
|
|
1428
|
+
registeredAt: user.registeredAt,
|
|
1429
|
+
}));
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
// GET /api/prelaunch/stats - Public Pre-launch counter
|
|
1433
|
+
if (pathname === '/api/prelaunch/stats' && req.method === 'GET') {
|
|
1434
|
+
const regFile = path.join(process.cwd(), '.ft', 'prelaunch_registrations.json');
|
|
1435
|
+
let count = 0;
|
|
1436
|
+
if (fs.existsSync(regFile)) {
|
|
1437
|
+
try {
|
|
1438
|
+
const list = JSON.parse(fs.readFileSync(regFile, 'utf-8'));
|
|
1439
|
+
count = Array.isArray(list) ? list.length : 0;
|
|
1440
|
+
}
|
|
1441
|
+
catch { }
|
|
1442
|
+
}
|
|
1443
|
+
res.writeHead(200);
|
|
1444
|
+
res.end(JSON.stringify({ success: true, count: 428 + count }));
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1229
1447
|
res.writeHead(404);
|
|
1230
1448
|
res.end(JSON.stringify({ error: 'API route not found' }));
|
|
1231
1449
|
return;
|
|
1232
1450
|
}
|
|
1233
1451
|
// Static File Server & Friendly URL Rewrites
|
|
1234
1452
|
let filePath;
|
|
1235
|
-
if (pathname === '/
|
|
1453
|
+
if (pathname === '/register' || pathname === '/register/' || pathname === '/prelaunch' || pathname === '/prelaunch/' || pathname === '/waitlist' || pathname === '/waitlist/') {
|
|
1454
|
+
filePath = path.join(webDir, 'register.html');
|
|
1455
|
+
}
|
|
1456
|
+
else if (pathname === '/plans' || pathname === '/plans/') {
|
|
1236
1457
|
filePath = path.join(webDir, 'paid_plans.html');
|
|
1237
1458
|
}
|
|
1238
1459
|
else if (pathname === '/auth' || pathname === '/auth/') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
export function renderBranding(version = '9.5.
|
|
2
|
+
export function renderBranding(version = '9.5.9') {
|
|
3
3
|
const logo = chalk.cyan.bold(' ███████╗████████╗') + ' ' + chalk.cyan.bold('███████╗ ██████╗ ██████╗ ██╗ ██╗████████╗') + '\n' +
|
|
4
4
|
chalk.cyan.bold(' ██╔════╝╚══██╔══╝') + ' ' + chalk.cyan.bold('██╔════╝ ██╔════╝██╔═══██╗ ██║ ██║╚══██╔══╝') + '\n' +
|
|
5
5
|
chalk.cyan.bold(' █████╗ ██║ ') + ' ' + chalk.cyan.bold(' ███████╗ ██║ ██║ ██║ ██║ ██║ ██║ ') + '\n' +
|
|
@@ -105,7 +105,7 @@ export async function startQrPairingSession() {
|
|
|
105
105
|
const pairingCode = `SCT-${rawNum}`;
|
|
106
106
|
const sessionId = `sct_sess_${Date.now().toString(36)}_${crypto.randomBytes(3).toString('hex')}`;
|
|
107
107
|
const hostName = os.hostname() || 'workstation.local';
|
|
108
|
-
const version = '9.5.
|
|
108
|
+
const version = '9.5.9';
|
|
109
109
|
let localIp = '127.0.0.1';
|
|
110
110
|
try {
|
|
111
111
|
const nets = os.networkInterfaces();
|
package/bin/src/utils/support.js
CHANGED