@triedotdev/mcp 1.0.55 → 1.0.56

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.
@@ -2786,6 +2786,18 @@ var StreamingManager = class {
2786
2786
  issuesBySeverity: { critical: 0, serious: 0, moderate: 0, low: 0 }
2787
2787
  };
2788
2788
  }
2789
+ /**
2790
+ * Report watch status (directories, debounce, last change)
2791
+ */
2792
+ reportWatchStatus(status) {
2793
+ this.emit("watch_status", status);
2794
+ }
2795
+ /**
2796
+ * Report a specific file change when watching
2797
+ */
2798
+ reportWatchChange(file) {
2799
+ this.emit("watch_change", { file });
2800
+ }
2789
2801
  };
2790
2802
  function formatConsoleUpdate(update) {
2791
2803
  if (isInteractiveMode()) {
@@ -3173,7 +3185,17 @@ var InteractiveDashboard = class {
3173
3185
  lastUpdate: Date.now(),
3174
3186
  scanComplete: false,
3175
3187
  startTime: Date.now(),
3176
- activityLog: []
3188
+ activityLog: [],
3189
+ activityPage: 0,
3190
+ agentPage: 0,
3191
+ quietMode: false,
3192
+ alerts: { hasCritical: false },
3193
+ watch: {
3194
+ watching: false,
3195
+ directories: 0,
3196
+ recentChanges: []
3197
+ },
3198
+ agents: {}
3177
3199
  };
3178
3200
  }
3179
3201
  /**
@@ -3217,15 +3239,37 @@ var InteractiveDashboard = class {
3217
3239
  case "progress":
3218
3240
  const oldProgress = this.state.progress;
3219
3241
  this.state.progress = update.data;
3242
+ if (update.data.issuesBySeverity?.critical > 0) {
3243
+ this.state.alerts = { hasCritical: true, lastCriticalAt: update.timestamp };
3244
+ }
3220
3245
  if (update.data.currentFile && update.data.processedFiles % 10 === 0 && update.data.processedFiles !== oldProgress.processedFiles) {
3221
3246
  this.addActivity(`Scanned ${update.data.processedFiles}/${update.data.totalFiles} files`);
3222
3247
  }
3223
3248
  break;
3224
3249
  case "agent_start":
3225
3250
  this.addActivity(`[*] Agent started: ${update.data.agent}`);
3251
+ this.state.agents[update.data.agent] = {
3252
+ ...this.state.agents[update.data.agent] || { issues: 0, status: "queued" },
3253
+ status: "running",
3254
+ start: update.timestamp
3255
+ };
3226
3256
  break;
3227
3257
  case "agent_complete":
3228
3258
  this.addActivity(`[+] Agent complete: ${update.data.agent} (${update.data.issueCount} issues)`);
3259
+ {
3260
+ const prev = this.state.agents[update.data.agent];
3261
+ const start = prev?.start;
3262
+ const issues = update.data.issueCount ?? prev?.issues ?? 0;
3263
+ const durationMs = start !== void 0 ? update.timestamp - start : void 0;
3264
+ this.state.agents[update.data.agent] = {
3265
+ ...prev ?? { issues: 0, status: "queued" },
3266
+ status: "done",
3267
+ end: update.timestamp,
3268
+ ...start !== void 0 ? { start } : {},
3269
+ ...durationMs !== void 0 ? { durationMs } : {},
3270
+ issues
3271
+ };
3272
+ }
3229
3273
  break;
3230
3274
  case "issue_found":
3231
3275
  this.state.issues.push(update.data);
@@ -3233,6 +3277,15 @@ var InteractiveDashboard = class {
3233
3277
  const icon = update.data.severity === "critical" ? "[!]" : "[x]";
3234
3278
  const fileName = update.data.file?.split("/").pop() || "unknown";
3235
3279
  this.addActivity(`${icon} ${update.data.severity.toUpperCase()}: ${update.data.message?.slice(0, 40) || fileName}`);
3280
+ if (update.data.severity === "critical") {
3281
+ this.state.alerts = { hasCritical: true, lastCriticalAt: update.timestamp };
3282
+ }
3283
+ }
3284
+ if (update.data.agent) {
3285
+ const agentMeta = this.state.agents[update.data.agent];
3286
+ if (agentMeta) {
3287
+ agentMeta.issues += 1;
3288
+ }
3236
3289
  }
3237
3290
  break;
3238
3291
  case "scan_complete":
@@ -3244,6 +3297,22 @@ var InteractiveDashboard = class {
3244
3297
  const elapsed = ((Date.now() - this.state.startTime) / 1e3).toFixed(1);
3245
3298
  this.addActivity(`=== Scan complete - ${this.state.progress.totalIssues} issues in ${elapsed}s ===`);
3246
3299
  break;
3300
+ case "watch_status":
3301
+ this.state.watch = {
3302
+ watching: update.data.watching ?? this.state.watch.watching,
3303
+ directories: update.data.directories ?? this.state.watch.directories,
3304
+ debounceMs: update.data.debounceMs ?? this.state.watch.debounceMs,
3305
+ lastChange: update.data.lastChange ?? this.state.watch.lastChange,
3306
+ recentChanges: update.data.recentChanges ?? this.state.watch.recentChanges
3307
+ };
3308
+ break;
3309
+ case "watch_change":
3310
+ const entry = { file: update.data.file, time: new Date(update.timestamp).toLocaleTimeString("en-US", { hour12: false }) };
3311
+ this.state.watch.recentChanges.unshift(entry);
3312
+ this.state.watch.recentChanges = this.state.watch.recentChanges.slice(0, 5);
3313
+ this.state.watch.lastChange = entry.time;
3314
+ this.addActivity(`Change detected: ${update.data.file}`);
3315
+ break;
3247
3316
  }
3248
3317
  if (this.isActive) {
3249
3318
  this.render();
@@ -3269,9 +3338,11 @@ var InteractiveDashboard = class {
3269
3338
  this.switchView();
3270
3339
  break;
3271
3340
  case "up":
3341
+ case "k":
3272
3342
  this.navigateUp();
3273
3343
  break;
3274
3344
  case "down":
3345
+ case "j":
3275
3346
  this.navigateDown();
3276
3347
  break;
3277
3348
  case "enter":
@@ -3299,6 +3370,22 @@ var InteractiveDashboard = class {
3299
3370
  case "f":
3300
3371
  this.promptFilter();
3301
3372
  break;
3373
+ case "n":
3374
+ this.nextPage();
3375
+ break;
3376
+ case "p":
3377
+ this.prevPage();
3378
+ break;
3379
+ case "r":
3380
+ this.addActivity("Rerun requested (press q to exit and rerun command)");
3381
+ break;
3382
+ case "w":
3383
+ this.state.watch.watching = !this.state.watch.watching;
3384
+ this.addActivity(this.state.watch.watching ? "Watch resumed" : "Watch paused (visual only)");
3385
+ break;
3386
+ case "s":
3387
+ this.addActivity("Save report requested (not implemented in TUI)");
3388
+ break;
3302
3389
  case "h":
3303
3390
  case "?":
3304
3391
  this.showHelp();
@@ -3360,15 +3447,16 @@ var InteractiveDashboard = class {
3360
3447
  * Main render function
3361
3448
  */
3362
3449
  render() {
3363
- process.stdout.write("\x1B[2J\x1B[H\x1B[?25l");
3450
+ process.stdout.write("\x1B[2J\x1B[3J\x1B[H\x1B[?25l");
3364
3451
  const width = Math.min(80, process.stdout.columns || 80);
3452
+ const height = Math.max(24, process.stdout.rows || 40);
3365
3453
  this.renderHeader(width);
3366
3454
  if (!this.state.scanComplete) {
3367
- this.renderScanningView(width);
3455
+ this.renderScanningView(width, height);
3368
3456
  } else {
3369
3457
  switch (this.state.view) {
3370
3458
  case "overview":
3371
- this.renderOverview(width);
3459
+ this.renderOverview(width, height);
3372
3460
  break;
3373
3461
  case "issues":
3374
3462
  this.renderIssuesList(width);
@@ -3392,6 +3480,9 @@ var InteractiveDashboard = class {
3392
3480
  if (this.state.scanComplete) {
3393
3481
  status = "SCAN COMPLETE [OK]";
3394
3482
  }
3483
+ if (this.state.alerts.hasCritical) {
3484
+ status = `${status} | ALERT: CRITICAL`;
3485
+ }
3395
3486
  console.log("+" + this.line(width - 2) + "+");
3396
3487
  console.log("| TRIE GUARDIAN" + " ".repeat(width - 35 - status.length) + status + " " + time + " |");
3397
3488
  console.log("+" + this.line(width - 2) + "+");
@@ -3399,9 +3490,14 @@ var InteractiveDashboard = class {
3399
3490
  /**
3400
3491
  * Render scanning in progress view
3401
3492
  */
3402
- renderScanningView(width) {
3493
+ renderScanningView(width, height) {
3403
3494
  const { processedFiles, totalFiles, currentFile, activeAgents, completedAgents } = this.state.progress;
3404
3495
  const { issuesBySeverity } = this.state.progress;
3496
+ const baseTotal = 21;
3497
+ const variableBudget = Math.max(0, height - baseTotal);
3498
+ const agentRows = Math.max(1, Math.min(4, Math.floor(variableBudget / 2)));
3499
+ const remaining = Math.max(0, variableBudget - agentRows);
3500
+ const activityRows = Math.max(1, Math.min(10, remaining || 1));
3405
3501
  const percent = totalFiles > 0 ? Math.round(processedFiles / totalFiles * 100) : 0;
3406
3502
  const current = currentFile ? currentFile.split("/").pop() || "" : "";
3407
3503
  const progressBar = this.progressBar(processedFiles, totalFiles, 50);
@@ -3436,8 +3532,8 @@ var InteractiveDashboard = class {
3436
3532
  rightAgents.push(entry);
3437
3533
  }
3438
3534
  });
3439
- const maxRows = Math.max(leftAgents.length, rightAgents.length, 4);
3440
- for (let i = 0; i < maxRows && i < 4; i++) {
3535
+ const maxRows = Math.max(leftAgents.length, rightAgents.length, agentRows);
3536
+ for (let i = 0; i < maxRows && i < agentRows; i++) {
3441
3537
  const left = leftAgents[i] || " ".repeat(35);
3442
3538
  const right = rightAgents[i] || " ".repeat(35);
3443
3539
  console.log(`| ${left} ${right}`.slice(0, width - 1).padEnd(width - 1) + "|");
@@ -3450,14 +3546,24 @@ var InteractiveDashboard = class {
3450
3546
  console.log(`| [x] Serious ${issuesBySeverity.serious.toString().padStart(4)} [-] Low ${issuesBySeverity.low.toString().padStart(5)}`.padEnd(width - 1) + "|");
3451
3547
  console.log("|" + " ".repeat(width - 2) + "|");
3452
3548
  console.log("+" + this.line(width - 2) + "+");
3549
+ console.log("| WATCH STATUS" + " ".repeat(width - 17) + "|");
3550
+ console.log("| " + this.line(width - 6) + " |");
3551
+ const watchLine = this.state.watch.watching ? `Watching ${this.state.watch.directories} dirs${this.state.watch.debounceMs ? ` \u2022 debounce ${this.state.watch.debounceMs}ms` : ""}` : "Watch idle";
3552
+ console.log(`| ${watchLine}`.slice(0, width - 1).padEnd(width - 1) + "|");
3553
+ const lastChange = this.state.watch.lastChange ? `Last change: ${this.state.watch.lastChange}` : "Last change: --";
3554
+ console.log(`| ${lastChange}`.slice(0, width - 1).padEnd(width - 1) + "|");
3555
+ const recentChange = this.state.watch.recentChanges[0]?.file ? `Recent: ${this.state.watch.recentChanges[0].file}` : "";
3556
+ console.log(`| ${recentChange}`.slice(0, width - 1).padEnd(width - 1) + "|");
3557
+ console.log("+" + this.line(width - 2) + "+");
3453
3558
  console.log("| ACTIVITY LOG" + " ".repeat(width - 17) + "|");
3454
3559
  console.log("| " + this.line(width - 6) + " |");
3455
- const recentActivity = this.state.activityLog.slice(0, 6);
3560
+ const startIdx = this.state.activityPage * activityRows;
3561
+ const recentActivity = this.state.activityLog.slice(startIdx, startIdx + activityRows);
3456
3562
  for (const entry of recentActivity) {
3457
3563
  const line = `${entry.time} ${entry.message}`.slice(0, width - 6);
3458
3564
  console.log(`| ${line.padEnd(width - 4)}|`);
3459
3565
  }
3460
- for (let i = recentActivity.length; i < 6; i++) {
3566
+ for (let i = recentActivity.length; i < activityRows; i++) {
3461
3567
  console.log("|" + " ".repeat(width - 2) + "|");
3462
3568
  }
3463
3569
  }
@@ -3470,10 +3576,11 @@ var InteractiveDashboard = class {
3470
3576
  /**
3471
3577
  * Render overview with summary statistics
3472
3578
  */
3473
- renderOverview(width) {
3579
+ renderOverview(width, height) {
3474
3580
  const { issuesBySeverity, totalIssues, processedFiles } = this.state.progress;
3475
3581
  const { completedAgents } = this.state.progress;
3476
3582
  const elapsed = ((Date.now() - this.state.startTime) / 1e3).toFixed(1);
3583
+ const activityRows = Math.max(2, Math.min(8, Math.max(0, height - 26)));
3477
3584
  console.log("|" + " ".repeat(width - 2) + "|");
3478
3585
  console.log(`| ${processedFiles} files scanned in ${elapsed}s`.padEnd(width - 1) + "|");
3479
3586
  console.log(`| ${completedAgents.length} agents activated`.padEnd(width - 1) + "|");
@@ -3509,12 +3616,13 @@ var InteractiveDashboard = class {
3509
3616
  console.log("+" + this.line(width - 2) + "+");
3510
3617
  console.log("| ACTIVITY LOG" + " ".repeat(width - 17) + "|");
3511
3618
  console.log("| " + this.line(width - 6) + " |");
3512
- const recentActivity = this.state.activityLog.slice(0, 8);
3619
+ const startIdx = this.state.activityPage * activityRows;
3620
+ const recentActivity = this.state.activityLog.slice(startIdx, startIdx + activityRows);
3513
3621
  for (const entry of recentActivity) {
3514
3622
  const line = `${entry.time} ${entry.message}`.slice(0, width - 6);
3515
3623
  console.log(`| ${line.padEnd(width - 4)}|`);
3516
3624
  }
3517
- for (let i = recentActivity.length; i < 4; i++) {
3625
+ for (let i = recentActivity.length; i < activityRows; i++) {
3518
3626
  console.log("|" + " ".repeat(width - 2) + "|");
3519
3627
  }
3520
3628
  }
@@ -3563,22 +3671,46 @@ var InteractiveDashboard = class {
3563
3671
  * Render agents view
3564
3672
  */
3565
3673
  renderAgentsView(width) {
3566
- const { completedAgents, activeAgents } = this.state.progress;
3674
+ const agentEntries = Object.entries(this.state.agents).map(([name, meta]) => {
3675
+ return {
3676
+ name,
3677
+ status: meta.status,
3678
+ duration: meta.durationMs ? `${(meta.durationMs / 1e3).toFixed(1)}s` : "\u2014",
3679
+ issues: meta.issues ?? 0,
3680
+ start: meta.start,
3681
+ end: meta.end
3682
+ };
3683
+ });
3684
+ for (const name of this.state.progress.activeAgents) {
3685
+ if (!this.state.agents[name]) {
3686
+ agentEntries.push({ name, status: "running", duration: "\u2014", issues: 0, start: void 0, end: void 0 });
3687
+ }
3688
+ }
3689
+ for (const name of this.state.progress.completedAgents) {
3690
+ if (!this.state.agents[name]) {
3691
+ agentEntries.push({ name, status: "done", duration: "\u2014", issues: this.getAgentIssueCount(name), start: void 0, end: void 0 });
3692
+ }
3693
+ }
3694
+ const order = { running: 0, queued: 1, done: 2 };
3695
+ const sorted = agentEntries.sort((a, b) => {
3696
+ return order[a.status] - order[b.status] || a.name.localeCompare(b.name);
3697
+ });
3698
+ const pageSize = 6;
3699
+ const startIdx = this.state.agentPage * pageSize;
3700
+ const slice = sorted.slice(startIdx, startIdx + pageSize);
3567
3701
  console.log("| AGENTS STATUS" + " ".repeat(width - 18) + "|");
3568
3702
  console.log("+" + this.line(width - 2) + "+");
3569
- if (activeAgents.length > 0) {
3570
- console.log("| * ACTIVE AGENTS" + " ".repeat(width - 20) + "|");
3571
- for (const agent of activeAgents) {
3572
- console.log(`| - ${agent}`.padEnd(width - 1) + "|");
3573
- }
3574
- console.log("|" + " ".repeat(width - 2) + "|");
3703
+ console.log(`| Page ${this.state.agentPage + 1} / ${Math.max(1, Math.ceil(sorted.length / pageSize))}`.padEnd(width - 1) + "|");
3704
+ if (slice.length === 0) {
3705
+ console.log("| No agents yet".padEnd(width - 1) + "|");
3706
+ return;
3575
3707
  }
3576
- console.log("| + COMPLETED AGENTS" + " ".repeat(width - 23) + "|");
3577
- for (const agent of completedAgents) {
3578
- const agentIssues = this.state.issues.filter((i) => i.agent === agent);
3579
- const criticalCount = agentIssues.filter((i) => i.severity === "critical").length;
3580
- const statusText = criticalCount > 0 ? `${criticalCount} critical` : `${agentIssues.length} issues`;
3581
- console.log(`| - ${agent.padEnd(25)} ${statusText}`.padEnd(width - 1) + "|");
3708
+ console.log("| Name Status Issues Duration".padEnd(width - 1) + "|");
3709
+ console.log("| " + this.line(width - 6) + " |");
3710
+ for (const agent of slice) {
3711
+ const statusIcon = agent.status === "running" ? "*" : agent.status === "done" ? "+" : "o";
3712
+ const line = `| ${statusIcon} ${agent.name.padEnd(18)} ${agent.status.padEnd(9)} ${agent.issues.toString().padStart(6)} ${agent.duration.padEnd(8)}`;
3713
+ console.log(line.slice(0, width - 1).padEnd(width - 1) + "|");
3582
3714
  }
3583
3715
  }
3584
3716
  /**
@@ -3609,9 +3741,9 @@ var InteractiveDashboard = class {
3609
3741
  renderFooter(width) {
3610
3742
  console.log("+" + this.line(width - 2) + "+");
3611
3743
  if (!this.state.scanComplete) {
3612
- console.log(" [q] Quit [v] Verbose mode [Esc] Cancel scan");
3744
+ console.log(" [q] Quit [Tab] Views [j/k] Nav [n/p] Pages [w] Watch [r] Rerun");
3613
3745
  } else {
3614
- console.log(" [Tab] Switch view [up/down] Navigate [1-4] Filter [q] Quit");
3746
+ console.log(" [Tab] Views [j/k] Nav [n/p] Pages [1-4] Severity [f] Filter [w] Watch [r] Rerun [q] Quit");
3615
3747
  }
3616
3748
  }
3617
3749
  // Helper methods
@@ -3633,6 +3765,22 @@ var InteractiveDashboard = class {
3633
3765
  this.state.selectedIssue = Math.min(filteredIssues.length - 1, this.state.selectedIssue + 1);
3634
3766
  }
3635
3767
  }
3768
+ nextPage() {
3769
+ if (this.state.view === "agents") {
3770
+ const total = Math.max(1, Math.ceil(Object.keys(this.state.agents).length / 6));
3771
+ this.state.agentPage = Math.min(total - 1, this.state.agentPage + 1);
3772
+ } else {
3773
+ const total = Math.max(1, Math.ceil(this.state.activityLog.length / 6));
3774
+ this.state.activityPage = Math.min(total - 1, this.state.activityPage + 1);
3775
+ }
3776
+ }
3777
+ prevPage() {
3778
+ if (this.state.view === "agents") {
3779
+ this.state.agentPage = Math.max(0, this.state.agentPage - 1);
3780
+ } else {
3781
+ this.state.activityPage = Math.max(0, this.state.activityPage - 1);
3782
+ }
3783
+ }
3636
3784
  selectCurrent() {
3637
3785
  if (this.state.view === "issues") {
3638
3786
  const filteredIssues = this.getFilteredIssues();
@@ -5029,14 +5177,16 @@ var TrieScanTool = class {
5029
5177
  const maxConcurrency = args?.maxConcurrency ?? agentConfig?.maxConcurrency;
5030
5178
  const timeoutMs = args?.timeoutMs ?? agentConfig?.timeout ?? 12e4;
5031
5179
  const useWorkerThreads = args?.workers ?? true;
5032
- const streamingManager = streamingEnabled ? new StreamingManager() : void 0;
5033
- const dashboard = interactiveEnabled ? new InteractiveDashboard() : void 0;
5180
+ const streamingManager = streamingEnabled ? args?.streamingManager instanceof StreamingManager ? args.streamingManager : new StreamingManager() : void 0;
5181
+ const dashboard = interactiveEnabled ? args?.dashboard instanceof InteractiveDashboard ? args.dashboard : new InteractiveDashboard() : void 0;
5034
5182
  if (interactiveEnabled) {
5035
5183
  setInteractiveMode(true);
5036
5184
  }
5037
5185
  if (dashboard && streamingManager) {
5038
- streamingManager.subscribe((update) => dashboard.handleStreamUpdate(update));
5039
- await dashboard.start();
5186
+ if (!(args?.dashboard instanceof InteractiveDashboard)) {
5187
+ streamingManager.subscribe((update) => dashboard.handleStreamUpdate(update));
5188
+ await dashboard.start();
5189
+ }
5040
5190
  } else if (streamingManager) {
5041
5191
  streamingManager.subscribe((update) => {
5042
5192
  const line = formatConsoleUpdate(update);
@@ -5771,6 +5921,8 @@ ${issue.fix}
5771
5921
 
5772
5922
  export {
5773
5923
  loadConfig,
5924
+ StreamingManager,
5925
+ InteractiveDashboard,
5774
5926
  TrieScanTool
5775
5927
  };
5776
- //# sourceMappingURL=chunk-3NTILEEL.js.map
5928
+ //# sourceMappingURL=chunk-E2LWAVIW.js.map