ft-scout 9.5.2 → 9.5.5

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.
@@ -14,6 +14,7 @@ import { TaskStateManager } from '../engine/agentState.js';
14
14
  import { ApprovalManager } from '../engine/safety.js';
15
15
  import { AgentExecutionLoop } from '../engine/agentEngine.js';
16
16
  import { getMCPManager, MCPTelemetry } from '../mcp/index.js';
17
+ import { loadSupportTickets, createSupportTicket, getSupportTicket, addTicketMessage, updateTicketStatus, collectSanitizedDiagnostics, getPresetFaqs, } from '../utils/support.js';
17
18
  let activeAgentLoop = null;
18
19
  const serverStateManager = new TaskStateManager(process.cwd());
19
20
  const DEFAULT_PORT = 9120;
@@ -1054,6 +1055,138 @@ export function startDashboardServer(port = DEFAULT_PORT) {
1054
1055
  return;
1055
1056
  }
1056
1057
  }
1058
+ // ---------------------------------------------------------
1059
+ // Help & Support API Endpoints
1060
+ // ---------------------------------------------------------
1061
+ // GET /api/support/tickets - List all support tickets
1062
+ if (pathname === '/api/support/tickets' && req.method === 'GET') {
1063
+ const tickets = loadSupportTickets();
1064
+ res.writeHead(200);
1065
+ res.end(JSON.stringify({ success: true, tickets }));
1066
+ return;
1067
+ }
1068
+ // POST /api/support/tickets - Submit a new support ticket
1069
+ if (pathname === '/api/support/tickets' && req.method === 'POST') {
1070
+ let body = '';
1071
+ req.on('data', chunk => body += chunk);
1072
+ req.on('end', () => {
1073
+ try {
1074
+ const data = JSON.parse(body || '{}');
1075
+ if (!data.subject || !data.description || !data.userEmail) {
1076
+ res.writeHead(400);
1077
+ res.end(JSON.stringify({
1078
+ success: false,
1079
+ error: 'Subject, description, and contact email are required to create a ticket.'
1080
+ }));
1081
+ return;
1082
+ }
1083
+ const ticket = createSupportTicket({
1084
+ subject: data.subject,
1085
+ description: data.description,
1086
+ userEmail: data.userEmail,
1087
+ userName: data.userName,
1088
+ category: data.category,
1089
+ priority: data.priority,
1090
+ attachDiagnostics: data.attachDiagnostics !== false,
1091
+ });
1092
+ res.writeHead(201);
1093
+ res.end(JSON.stringify({ success: true, ticket }));
1094
+ }
1095
+ catch (err) {
1096
+ res.writeHead(400);
1097
+ res.end(JSON.stringify({ success: false, error: err.message || 'Failed to create support ticket' }));
1098
+ }
1099
+ });
1100
+ return;
1101
+ }
1102
+ // GET /api/support/faqs - Knowledge base & FAQ items
1103
+ if (pathname === '/api/support/faqs' && req.method === 'GET') {
1104
+ const faqs = getPresetFaqs();
1105
+ res.writeHead(200);
1106
+ res.end(JSON.stringify({ success: true, faqs }));
1107
+ return;
1108
+ }
1109
+ // GET /api/support/diagnostics - Sanitized diagnostic bundle
1110
+ if (pathname === '/api/support/diagnostics' && req.method === 'GET') {
1111
+ const diagnostics = collectSanitizedDiagnostics();
1112
+ res.writeHead(200);
1113
+ res.end(JSON.stringify({ success: true, diagnostics }));
1114
+ return;
1115
+ }
1116
+ // GET /api/support/tickets/:id
1117
+ const ticketIdMatch = pathname.match(/^\/api\/support\/tickets\/([a-zA-Z0-9_\-]+)$/);
1118
+ if (ticketIdMatch && req.method === 'GET') {
1119
+ const ticketId = ticketIdMatch[1];
1120
+ const ticket = getSupportTicket(ticketId);
1121
+ if (!ticket) {
1122
+ res.writeHead(404);
1123
+ res.end(JSON.stringify({ success: false, error: 'Ticket not found' }));
1124
+ return;
1125
+ }
1126
+ res.writeHead(200);
1127
+ res.end(JSON.stringify({ success: true, ticket }));
1128
+ return;
1129
+ }
1130
+ // POST /api/support/tickets/:id/message - Add reply to ticket
1131
+ const ticketMessageMatch = pathname.match(/^\/api\/support\/tickets\/([a-zA-Z0-9_\-]+)\/message$/);
1132
+ if (ticketMessageMatch && req.method === 'POST') {
1133
+ const ticketId = ticketMessageMatch[1];
1134
+ let body = '';
1135
+ req.on('data', chunk => body += chunk);
1136
+ req.on('end', () => {
1137
+ try {
1138
+ const data = JSON.parse(body || '{}');
1139
+ if (!data.message || !data.message.trim()) {
1140
+ res.writeHead(400);
1141
+ res.end(JSON.stringify({ success: false, error: 'Message cannot be empty.' }));
1142
+ return;
1143
+ }
1144
+ const updated = addTicketMessage(ticketId, data.message, data.sender || 'user', data.senderName);
1145
+ if (!updated) {
1146
+ res.writeHead(404);
1147
+ res.end(JSON.stringify({ success: false, error: 'Ticket not found.' }));
1148
+ return;
1149
+ }
1150
+ res.writeHead(200);
1151
+ res.end(JSON.stringify({ success: true, ticket: updated }));
1152
+ }
1153
+ catch (err) {
1154
+ res.writeHead(400);
1155
+ res.end(JSON.stringify({ success: false, error: err.message || 'Failed to add message.' }));
1156
+ }
1157
+ });
1158
+ return;
1159
+ }
1160
+ // POST /api/support/tickets/:id/status - Update ticket status
1161
+ const ticketStatusMatch = pathname.match(/^\/api\/support\/tickets\/([a-zA-Z0-9_\-]+)\/status$/);
1162
+ if (ticketStatusMatch && req.method === 'POST') {
1163
+ const ticketId = ticketStatusMatch[1];
1164
+ let body = '';
1165
+ req.on('data', chunk => body += chunk);
1166
+ req.on('end', () => {
1167
+ try {
1168
+ const data = JSON.parse(body || '{}');
1169
+ if (!data.status) {
1170
+ res.writeHead(400);
1171
+ res.end(JSON.stringify({ success: false, error: 'Status is required.' }));
1172
+ return;
1173
+ }
1174
+ const updated = updateTicketStatus(ticketId, data.status);
1175
+ if (!updated) {
1176
+ res.writeHead(404);
1177
+ res.end(JSON.stringify({ success: false, error: 'Ticket not found.' }));
1178
+ return;
1179
+ }
1180
+ res.writeHead(200);
1181
+ res.end(JSON.stringify({ success: true, ticket: updated }));
1182
+ }
1183
+ catch (err) {
1184
+ res.writeHead(400);
1185
+ res.end(JSON.stringify({ success: false, error: err.message || 'Failed to update status.' }));
1186
+ }
1187
+ });
1188
+ return;
1189
+ }
1057
1190
  res.writeHead(404);
1058
1191
  res.end(JSON.stringify({ error: 'API route not found' }));
1059
1192
  return;
@@ -1072,6 +1205,9 @@ export function startDashboardServer(port = DEFAULT_PORT) {
1072
1205
  else if (pathname === '/admin' || pathname === '/admin/') {
1073
1206
  filePath = path.join(webDir, 'admin.html');
1074
1207
  }
1208
+ else if (pathname === '/support' || pathname === '/support/' || pathname === '/help' || pathname === '/help/') {
1209
+ filePath = path.join(webDir, 'support.html');
1210
+ }
1075
1211
  else {
1076
1212
  let targetFile = pathname === '/' ? 'index.html' : pathname.replace(/^\//, '');
1077
1213
  filePath = path.join(webDir, targetFile);
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- export function renderBranding(version = '9.5.2') {
2
+ export function renderBranding(version = '9.5.5') {
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' +
@@ -58,7 +58,7 @@ export interface TaskCompletedUIParams {
58
58
  }
59
59
  /**
60
60
  * Renders Claude Code-style Step Banner:
61
- * ╭── ● Step 2/10 ── Scout Operating ──────────── ⏱ 1.2s • 3,250 tok • PRO ─╮
61
+ * ╭── ● Step 2 ── Scout Operating ──────────── ⏱ 1.2s • 3,250 tok • PRO ─╮
62
62
  */
63
63
  export declare function renderStepHeader(telemetry: StepTelemetry): void;
64
64
  /**
@@ -98,4 +98,34 @@ export declare function renderToolResult(params: ToolResultUIParams): void;
98
98
  * ╰────────────────────────────────────────────────────────────────────────╯
99
99
  */
100
100
  export declare function renderTaskCompletedCard(params: TaskCompletedUIParams): void;
101
+ export interface TeamSwarmCardParams {
102
+ objective: string;
103
+ architectSummary?: string | undefined;
104
+ coderSummary?: string | undefined;
105
+ testerSummary?: string | undefined;
106
+ modifiedFiles: string[];
107
+ totalSteps: number;
108
+ durationMs: number;
109
+ tier?: string | undefined;
110
+ }
111
+ /**
112
+ * Renders Claude Code-style Multi-Agent Swarm Collaborative Completion Card (Grok Bot Relay)
113
+ */
114
+ export declare function renderTeamSwarmCard(params: TeamSwarmCardParams): void;
115
+ export interface CrossAppSwarmCardParams {
116
+ objective: string;
117
+ sourceApp?: string | undefined;
118
+ targetApp?: string | undefined;
119
+ researcherSummary?: string | undefined;
120
+ operatorSummary?: string | undefined;
121
+ verifierSummary?: string | undefined;
122
+ modifiedFiles: string[];
123
+ totalSteps: number;
124
+ durationMs: number;
125
+ tier?: string | undefined;
126
+ }
127
+ /**
128
+ * Renders Claude Code-style Cross-App Multi-Agent Swarm Collaborative Completion Card (Strawberry-style)
129
+ */
130
+ export declare function renderCrossAppSwarmCard(params: CrossAppSwarmCardParams): void;
101
131
  //# sourceMappingURL=claudeUI.d.ts.map
@@ -10,14 +10,12 @@ function hr(char = '─', len) {
10
10
  }
11
11
  /**
12
12
  * Renders Claude Code-style Step Banner:
13
- * ╭── ● Step 2/10 ── Scout Operating ──────────── ⏱ 1.2s • 3,250 tok • PRO ─╮
13
+ * ╭── ● Step 2 ── Scout Operating ──────────── ⏱ 1.2s • 3,250 tok • PRO ─╮
14
14
  */
15
15
  export function renderStepHeader(telemetry) {
16
16
  const width = getTerminalWidth();
17
17
  const elapsedSecs = ((Date.now() - telemetry.startTimeMs) / 1000).toFixed(1);
18
- const stepsText = Number.isFinite(telemetry.maxSteps)
19
- ? `Step ${telemetry.step}/${telemetry.maxSteps}`
20
- : `Step ${telemetry.step}`;
18
+ const stepsText = `Step ${telemetry.step}`;
21
19
  const stepBadge = chalk.bold.cyan(`● ${stepsText}`);
22
20
  const statusText = chalk.dim('Scout Operating');
23
21
  const timeText = chalk.dim(`⏱ ${elapsedSecs}s`);
@@ -401,4 +399,140 @@ export function renderTaskCompletedCard(params) {
401
399
  console.log(chalk.cyan('╰' + '─'.repeat(width) + '╯'));
402
400
  console.log();
403
401
  }
402
+ /**
403
+ * Renders Claude Code-style Multi-Agent Swarm Collaborative Completion Card (Grok Bot Relay)
404
+ */
405
+ export function renderTeamSwarmCard(params) {
406
+ const width = Math.min(getTerminalWidth(), 88);
407
+ const stripAnsi = (str) => str.replace(/\u001B\[\d+m/g, '');
408
+ const padLine = (content, visibleLen) => {
409
+ const spaces = Math.max(0, width - 4 - visibleLen);
410
+ return `${chalk.magenta('│')} ${content}${' '.repeat(spaces)} ${chalk.magenta('│')}`;
411
+ };
412
+ console.log();
413
+ console.log(chalk.magenta('╭' + '─'.repeat(width) + '╮'));
414
+ const header = `${chalk.bold.yellow('🚀')} ${chalk.bold.white('MULTI-AGENT SWARM COMPLETED (TEAM RELAY)')}`;
415
+ console.log(padLine(header, stripAnsi(header).length));
416
+ console.log(chalk.magenta('├' + '─'.repeat(width) + '┤'));
417
+ const objText = `${chalk.bold.cyan('🎯 Objective:')} ${chalk.white(params.objective.slice(0, width - 20))}`;
418
+ console.log(padLine(objText, stripAnsi(objText).length));
419
+ console.log(padLine('', 0));
420
+ if (params.architectSummary) {
421
+ const archTitle = `${chalk.bold.cyan('🏛️ Architect Plan:')}`;
422
+ console.log(padLine(archTitle, stripAnsi(archTitle).length));
423
+ const line = params.architectSummary.split('\n')[0] || 'Architecture plan drafted.';
424
+ const archLine = ` ${chalk.dim(line.slice(0, width - 15))}`;
425
+ console.log(padLine(archLine, stripAnsi(archLine).length));
426
+ }
427
+ if (params.coderSummary) {
428
+ const coderTitle = `${chalk.bold.green('💻 Coder Implementation:')}`;
429
+ console.log(padLine(coderTitle, stripAnsi(coderTitle).length));
430
+ const line = params.coderSummary.split('\n')[0] || 'Changes implemented.';
431
+ const coderLine = ` ${chalk.dim(line.slice(0, width - 15))}`;
432
+ console.log(padLine(coderLine, stripAnsi(coderLine).length));
433
+ }
434
+ if (params.testerSummary) {
435
+ const testTitle = `${chalk.bold.yellow('🧪 Tester Verification:')}`;
436
+ console.log(padLine(testTitle, stripAnsi(testTitle).length));
437
+ const line = params.testerSummary.split('\n')[0] || 'Verification complete.';
438
+ const testLine = ` ${chalk.dim(line.slice(0, width - 15))}`;
439
+ console.log(padLine(testLine, stripAnsi(testLine).length));
440
+ }
441
+ console.log(padLine('', 0));
442
+ const filesTitle = `${chalk.bold.blue('📁 Modified Files')} (${params.modifiedFiles.length}):`;
443
+ console.log(padLine(filesTitle, stripAnsi(filesTitle).length));
444
+ if (params.modifiedFiles.length === 0) {
445
+ const noFiles = chalk.dim(' (No files modified)');
446
+ console.log(padLine(noFiles, stripAnsi(noFiles).length));
447
+ }
448
+ else {
449
+ for (const file of params.modifiedFiles.slice(0, 5)) {
450
+ const fileLine = ` ${chalk.green('•')} ${chalk.cyan(file)}`;
451
+ console.log(padLine(fileLine, stripAnsi(fileLine).length));
452
+ }
453
+ if (params.modifiedFiles.length > 5) {
454
+ const moreFiles = chalk.dim(` ... and ${params.modifiedFiles.length - 5} more files`);
455
+ console.log(padLine(moreFiles, stripAnsi(moreFiles).length));
456
+ }
457
+ }
458
+ console.log(padLine('', 0));
459
+ const durationSec = (params.durationMs / 1000).toFixed(1);
460
+ const metrics = `⏱ ${chalk.yellow(`${durationSec}s`)} • Steps: ${chalk.yellow(params.totalSteps)} • Relay: Architect ➔ Coder ➔ Tester`;
461
+ console.log(padLine(metrics, stripAnsi(metrics).length));
462
+ const tier = (params.tier || 'pro').toUpperCase();
463
+ const tierLine = `🛡️ Tier: ${chalk.bold.magenta(tier)} (Multi-Agent Swarm Swappable)`;
464
+ console.log(padLine(tierLine, stripAnsi(tierLine).length));
465
+ console.log(chalk.magenta('╰' + '─'.repeat(width) + '╯'));
466
+ console.log();
467
+ }
468
+ /**
469
+ * Renders Claude Code-style Cross-App Multi-Agent Swarm Collaborative Completion Card (Strawberry-style)
470
+ */
471
+ export function renderCrossAppSwarmCard(params) {
472
+ const width = Math.min(getTerminalWidth(), 88);
473
+ const stripAnsi = (str) => str.replace(/\u001B\[\d+m/g, '');
474
+ const padLine = (content, visibleLen) => {
475
+ const spaces = Math.max(0, width - 4 - visibleLen);
476
+ return `${chalk.cyan('│')} ${content}${' '.repeat(spaces)} ${chalk.cyan('│')}`;
477
+ };
478
+ console.log();
479
+ console.log(chalk.cyan('╭' + '─'.repeat(width) + '╮'));
480
+ const header = `${chalk.bold.yellow('🌐')} ${chalk.bold.white('CROSS-APP MULTI-AGENT SWARM (STRAWBERRY RELAY)')}`;
481
+ console.log(padLine(header, stripAnsi(header).length));
482
+ console.log(chalk.cyan('├' + '─'.repeat(width) + '┤'));
483
+ const objText = `${chalk.bold.cyan('🎯 Objective:')} ${chalk.white(params.objective.slice(0, width - 20))}`;
484
+ console.log(padLine(objText, stripAnsi(objText).length));
485
+ const source = params.sourceApp || 'Browser';
486
+ const target = params.targetApp || 'VS Code';
487
+ const flowText = `${chalk.bold.yellow('🔄 Flow:')} ${chalk.blue(source)} ➔ ${chalk.dim('Data Pipe')} ➔ ${chalk.green(target)} ➔ ${chalk.yellow('Verifier')}`;
488
+ console.log(padLine(flowText, stripAnsi(flowText).length));
489
+ console.log(padLine('', 0));
490
+ if (params.researcherSummary) {
491
+ const title = `${chalk.bold.blue(`🌐 Researcher (${source}):`)}`;
492
+ console.log(padLine(title, stripAnsi(title).length));
493
+ const line = params.researcherSummary.split('\n')[0] || 'Extracted data from source.';
494
+ const subLine = ` ${chalk.dim(line.slice(0, width - 15))}`;
495
+ console.log(padLine(subLine, stripAnsi(subLine).length));
496
+ }
497
+ if (params.operatorSummary) {
498
+ const title = `${chalk.bold.green(`💻 Operator (${target}):`)}`;
499
+ console.log(padLine(title, stripAnsi(title).length));
500
+ const line = params.operatorSummary.split('\n')[0] || 'Injected changes into target.';
501
+ const subLine = ` ${chalk.dim(line.slice(0, width - 15))}`;
502
+ console.log(padLine(subLine, stripAnsi(subLine).length));
503
+ }
504
+ if (params.verifierSummary) {
505
+ const title = `${chalk.bold.yellow('🧪 Verifier:')}`;
506
+ console.log(padLine(title, stripAnsi(title).length));
507
+ const line = params.verifierSummary.split('\n')[0] || 'Verification completed.';
508
+ const subLine = ` ${chalk.dim(line.slice(0, width - 15))}`;
509
+ console.log(padLine(subLine, stripAnsi(subLine).length));
510
+ }
511
+ console.log(padLine('', 0));
512
+ const filesTitle = `${chalk.bold.blue('📁 Modified Files')} (${params.modifiedFiles.length}):`;
513
+ console.log(padLine(filesTitle, stripAnsi(filesTitle).length));
514
+ if (params.modifiedFiles.length === 0) {
515
+ const noFiles = chalk.dim(' (No files modified)');
516
+ console.log(padLine(noFiles, stripAnsi(noFiles).length));
517
+ }
518
+ else {
519
+ for (const file of params.modifiedFiles.slice(0, 5)) {
520
+ const fileLine = ` ${chalk.green('•')} ${chalk.cyan(file)}`;
521
+ console.log(padLine(fileLine, stripAnsi(fileLine).length));
522
+ }
523
+ if (params.modifiedFiles.length > 5) {
524
+ const moreFiles = chalk.dim(` ... and ${params.modifiedFiles.length - 5} more files`);
525
+ console.log(padLine(moreFiles, stripAnsi(moreFiles).length));
526
+ }
527
+ }
528
+ console.log(padLine('', 0));
529
+ const durationSec = (params.durationMs / 1000).toFixed(1);
530
+ const metrics = `⏱ ${chalk.yellow(`${durationSec}s`)} • Steps: ${chalk.yellow(params.totalSteps)} • Apps: ${chalk.blue(source)} ➔ ${chalk.green(target)}`;
531
+ console.log(padLine(metrics, stripAnsi(metrics).length));
532
+ const tier = (params.tier || 'pro').toUpperCase();
533
+ const tierLine = `🛡️ Tier: ${chalk.bold.magenta(tier)} (Cross-App Multi-Agent Swarm)`;
534
+ console.log(padLine(tierLine, stripAnsi(tierLine).length));
535
+ console.log(chalk.cyan('╰' + '─'.repeat(width) + '╯'));
536
+ console.log();
537
+ }
404
538
  //# sourceMappingURL=claudeUI.js.map
@@ -14,7 +14,6 @@ export const DEFAULT_PRICING_CONFIG = {
14
14
  credits: 100,
15
15
  description: 'Essential tools for individual developer workflow & onboarding',
16
16
  features: [
17
- 'Unlimited execution steps (No step limits)',
18
17
  '100 AI credits / month',
19
18
  'Full Scout CLI core features',
20
19
  'Workspace rules (.scoutrules / SCOUT.md)',
@@ -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.2';
108
+ const version = '9.5.5';
109
109
  let localIp = '127.0.0.1';
110
110
  try {
111
111
  const nets = os.networkInterfaces();
@@ -15,7 +15,11 @@ export interface AgentSessionRecord {
15
15
  * Load all recorded agent sessions from disk.
16
16
  * Sorted by timestamp descending (newest first).
17
17
  */
18
- export declare function loadAgentSessions(limit?: number): AgentSessionRecord[];
18
+ export declare function loadAgentSessions(limit?: number, includeInternal?: boolean): AgentSessionRecord[];
19
+ /**
20
+ * Retrieves the most recent real user goal (excluding mock test sessions and internal subagents).
21
+ */
22
+ export declare function getLastUserGoal(): string | null;
19
23
  /**
20
24
  * Save a new agent session record to disk.
21
25
  * Keeps history intact, prepending the latest session.
@@ -18,7 +18,7 @@ function ensureFtDir() {
18
18
  * Load all recorded agent sessions from disk.
19
19
  * Sorted by timestamp descending (newest first).
20
20
  */
21
- export function loadAgentSessions(limit = 10) {
21
+ export function loadAgentSessions(limit = 10, includeInternal = false) {
22
22
  ensureFtDir();
23
23
  if (!fs.existsSync(SESSIONS_FILE))
24
24
  return [];
@@ -27,19 +27,52 @@ export function loadAgentSessions(limit = 10) {
27
27
  const sessions = JSON.parse(raw);
28
28
  if (!Array.isArray(sessions))
29
29
  return [];
30
- return sessions.slice(0, limit);
30
+ if (includeInternal)
31
+ return sessions.slice(0, limit);
32
+ const filtered = sessions.filter(s => {
33
+ const g = (s.goal || '').trim();
34
+ return !g.startsWith('Test Goal') && !g.startsWith('[SPECIALIST ROLE DIRECTIVE');
35
+ });
36
+ return filtered.slice(0, limit);
31
37
  }
32
38
  catch {
33
39
  return [];
34
40
  }
35
41
  }
42
+ /**
43
+ * Retrieves the most recent real user goal (excluding mock test sessions and internal subagents).
44
+ */
45
+ export function getLastUserGoal() {
46
+ const sessions = loadAgentSessions(50);
47
+ for (const session of sessions) {
48
+ const goal = (session.goal || '').trim();
49
+ if (goal &&
50
+ !goal.startsWith('Test Goal') &&
51
+ !goal.startsWith('[SPECIALIST ROLE DIRECTIVE') &&
52
+ !goal.startsWith('mock')) {
53
+ return goal;
54
+ }
55
+ }
56
+ return null;
57
+ }
36
58
  /**
37
59
  * Save a new agent session record to disk.
38
60
  * Keeps history intact, prepending the latest session.
39
61
  */
40
62
  export function saveAgentSession(session) {
41
63
  ensureFtDir();
42
- const existing = loadAgentSessions(50);
64
+ // Prevent internal subagent directives from polluting the main session log
65
+ if (session.goal && session.goal.startsWith('[SPECIALIST ROLE DIRECTIVE')) {
66
+ return {
67
+ id: session.id || `subagent-${Date.now()}`,
68
+ timestamp: session.timestamp || new Date().toISOString(),
69
+ goal: session.goal,
70
+ summary: session.summary,
71
+ modifiedFiles: session.modifiedFiles || [],
72
+ keyHighlights: session.keyHighlights || [],
73
+ };
74
+ }
75
+ const existing = loadAgentSessions(50, true);
43
76
  const newRecord = {
44
77
  id: session.id || `session-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
45
78
  timestamp: session.timestamp || new Date().toISOString(),
@@ -0,0 +1,63 @@
1
+ export interface SupportTicketMessage {
2
+ id: string;
3
+ sender: 'user' | 'support' | 'system';
4
+ senderName?: string | undefined;
5
+ message: string;
6
+ timestamp: string;
7
+ }
8
+ export interface SystemDiagnosticsInfo {
9
+ scoutVersion: string;
10
+ nodeVersion: string;
11
+ platform: string;
12
+ osRelease: string;
13
+ arch: string;
14
+ currentTier: string;
15
+ activeModel: string;
16
+ byokEnabled: boolean;
17
+ totalCredits: number;
18
+ usedCredits: number;
19
+ activeTaskCount: number;
20
+ lastErrorSnippet?: string | undefined;
21
+ }
22
+ export type TicketCategory = 'agent_automation' | 'billing_quota' | 'cli_crash' | 'mcp_integration' | 'feature_request' | 'other';
23
+ export type TicketPriority = 'low' | 'medium' | 'high' | 'urgent';
24
+ export type TicketStatus = 'open' | 'in_progress' | 'resolved' | 'closed';
25
+ export interface SupportTicket {
26
+ id: string;
27
+ userEmail: string;
28
+ userName?: string | undefined;
29
+ subject: string;
30
+ category: TicketCategory;
31
+ priority: TicketPriority;
32
+ status: TicketStatus;
33
+ description: string;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ diagnostics?: SystemDiagnosticsInfo | undefined;
37
+ messages: SupportTicketMessage[];
38
+ }
39
+ export interface FAQItem {
40
+ id: string;
41
+ category: string;
42
+ question: string;
43
+ answer: string;
44
+ tags: string[];
45
+ }
46
+ export declare function loadSupportTickets(): SupportTicket[];
47
+ export declare function saveSupportTickets(tickets: SupportTicket[]): void;
48
+ export declare function generateTicketId(): string;
49
+ export declare function collectSanitizedDiagnostics(): SystemDiagnosticsInfo;
50
+ export declare function createSupportTicket(params: {
51
+ subject: string;
52
+ description: string;
53
+ userEmail: string;
54
+ userName?: string;
55
+ category?: TicketCategory;
56
+ priority?: TicketPriority;
57
+ attachDiagnostics?: boolean;
58
+ }): SupportTicket;
59
+ export declare function getSupportTicket(id: string): SupportTicket | null;
60
+ export declare function addTicketMessage(ticketId: string, messageContent: string, sender?: 'user' | 'support' | 'system', senderName?: string): SupportTicket | null;
61
+ export declare function updateTicketStatus(ticketId: string, status: TicketStatus): SupportTicket | null;
62
+ export declare function getPresetFaqs(): FAQItem[];
63
+ //# sourceMappingURL=support.d.ts.map