pm-orchestrator-runner 1.0.6 → 1.0.7

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.
@@ -110,6 +110,39 @@ export interface CommandResult {
110
110
  * Terminal states: complete | incomplete | error
111
111
  */
112
112
  export type TaskLogStatus = 'queued' | 'running' | 'complete' | 'incomplete' | 'error';
113
+ /**
114
+ * Task queue state - for non-blocking task execution
115
+ * QUEUED: Waiting to be executed
116
+ * RUNNING: Currently executing
117
+ * COMPLETE/INCOMPLETE/ERROR: Terminal states
118
+ */
119
+ export type TaskQueueState = 'QUEUED' | 'RUNNING' | 'COMPLETE' | 'INCOMPLETE' | 'ERROR';
120
+ /**
121
+ * Queued task structure for non-blocking execution
122
+ * Allows multiple tasks to be submitted while previous tasks are running
123
+ */
124
+ export interface QueuedTask {
125
+ /** Task ID (task-{timestamp}) */
126
+ id: string;
127
+ /** Task description / prompt */
128
+ description: string;
129
+ /** Current state */
130
+ state: TaskQueueState;
131
+ /** Timestamp when queued */
132
+ queuedAt: number;
133
+ /** Timestamp when started (null if not started) */
134
+ startedAt: number | null;
135
+ /** Timestamp when completed (null if not completed) */
136
+ completedAt: number | null;
137
+ /** Result status (set on completion) */
138
+ resultStatus?: string;
139
+ /** Error message (set on error) */
140
+ errorMessage?: string;
141
+ /** Files modified (set on completion) */
142
+ filesModified?: string[];
143
+ /** Response summary (set on completion) */
144
+ responseSummary?: string;
145
+ }
113
146
  /**
114
147
  * REPL session state - per spec 05_DATA_MODELS.md
115
148
  * Extended with current_task_id / last_task_id tracking
@@ -142,6 +175,8 @@ export declare class REPLInterface extends EventEmitter {
142
175
  private hasError;
143
176
  private hasIncompleteTasks;
144
177
  private sessionCompleted;
178
+ private taskQueue;
179
+ private isTaskWorkerRunning;
145
180
  private projectMode;
146
181
  private verificationRoot;
147
182
  private tempVerificationRoot;
@@ -245,10 +280,15 @@ export declare class REPLInterface extends EventEmitter {
245
280
  */
246
281
  private isExitTypo;
247
282
  /**
248
- * Process natural language input
283
+ * Process natural language input - NON-BLOCKING
249
284
  * Per spec 10_REPL_UX.md L117-118: Model selection is REPL-local
250
285
  * Model is read from .claude/repl.json and passed to executor via runner
251
286
  *
287
+ * Non-blocking design:
288
+ * - Creates task and adds to queue immediately
289
+ * - Returns control to input prompt right away
290
+ * - Background worker processes tasks asynchronously
291
+ *
252
292
  * Auto-start: In non-interactive mode, automatically start a session if none exists
253
293
  * This improves CLI usability for piped input and scripting
254
294
  *
@@ -258,6 +298,16 @@ export declare class REPLInterface extends EventEmitter {
258
298
  * - Never passes "exit" to Claude Code
259
299
  */
260
300
  private processNaturalLanguage;
301
+ /**
302
+ * Background task worker - processes queued tasks asynchronously
303
+ * Runs in background, allowing input to continue while tasks execute
304
+ */
305
+ private startTaskWorker;
306
+ /**
307
+ * Execute a single queued task
308
+ * Updates task state and prints results
309
+ */
310
+ private executeQueuedTask;
261
311
  /**
262
312
  * Handle clarification needed - prompt user interactively
263
313
  * Returns true if clarification was requested (and will be processed separately)
@@ -310,6 +360,8 @@ export declare class REPLInterface extends EventEmitter {
310
360
  private handleLogs;
311
361
  /**
312
362
  * Handle /tasks command
363
+ * Shows task queue with RUNNING/QUEUED/COMPLETE/ERROR/INCOMPLETE states
364
+ * Per redesign: proves non-blocking by showing multiple tasks simultaneously
313
365
  */
314
366
  private handleTasks;
315
367
  /**
@@ -334,6 +386,7 @@ export declare class REPLInterface extends EventEmitter {
334
386
  * Per spec 10_REPL_UX.md: Ensure clean exit with flushed output
335
387
  *
336
388
  * Guarantees:
389
+ * - Waits for running tasks to complete (task worker)
337
390
  * - Session state is persisted before exit
338
391
  * - All output is flushed before readline closes
339
392
  * - Double-completion is prevented via sessionCompleted flag
@@ -1 +1 @@
1
- {"version":3,"file":"repl-interface.d.ts","sourceRoot":"","sources":["../../src/repl/repl-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,C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;IA6I5B;;;OAGG;IACH,OAAO,CAAC,KAAK;IAIb;;;OAGG;YACW,WAAW;IAczB;;OAEG;IACH,OAAO,CAAC,UAAU;IAMlB;;;;;OAKG;IACG,wBAAwB,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IA4B/E;;;;;;OAMG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAMxC;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAoB3B;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,gBAAgB,IAAI,iBAAiB;IAIrC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,eAAe,IAAI,WAAW;IAI9B;;OAEG;IACH,SAAS,IAAI,OAAO;CAGrB"}
@@ -117,6 +117,9 @@ class REPLInterface extends events_1.EventEmitter {
117
117
  hasIncompleteTasks = false;
118
118
  // Session completion tracking (prevents double completion)
119
119
  sessionCompleted = false;
120
+ // Non-blocking task queue (allows input while tasks are running)
121
+ taskQueue = [];
122
+ isTaskWorkerRunning = false;
120
123
  // Project mode support (per spec 10_REPL_UX.md, Property 32, 33)
121
124
  projectMode;
122
125
  verificationRoot;
@@ -626,10 +629,15 @@ class REPLInterface extends events_1.EventEmitter {
626
629
  return trimmed === 'exit';
627
630
  }
628
631
  /**
629
- * Process natural language input
632
+ * Process natural language input - NON-BLOCKING
630
633
  * Per spec 10_REPL_UX.md L117-118: Model selection is REPL-local
631
634
  * Model is read from .claude/repl.json and passed to executor via runner
632
635
  *
636
+ * Non-blocking design:
637
+ * - Creates task and adds to queue immediately
638
+ * - Returns control to input prompt right away
639
+ * - Background worker processes tasks asynchronously
640
+ *
633
641
  * Auto-start: In non-interactive mode, automatically start a session if none exists
634
642
  * This improves CLI usability for piped input and scripting
635
643
  *
@@ -647,18 +655,15 @@ class REPLInterface extends events_1.EventEmitter {
647
655
  this.print('HINT: /exit');
648
656
  return;
649
657
  }
658
+ // Auto-start session for any natural language input (no /start required)
659
+ // Per redesign: natural language input = automatic task creation
650
660
  if (this.session.status !== 'running') {
651
- // In non-interactive mode, auto-start a session for better UX
652
- if (this.executionMode === 'non_interactive') {
653
- console.log('[DEBUG processNaturalLanguage] auto-starting session for non-interactive mode');
654
- const startResult = await this.handleStart([]);
655
- if (!startResult.success) {
656
- this.print('Failed to auto-start session: ' + (startResult.error?.message || 'Unknown error'));
657
- return;
658
- }
659
- }
660
- else {
661
- this.print('No active session. Use /start to begin, or /init to set up a new project.');
661
+ console.log('[DEBUG processNaturalLanguage] auto-starting session');
662
+ this.print('');
663
+ this.print('[Auto-starting session...]');
664
+ const startResult = await this.handleStart([]);
665
+ if (!startResult.success) {
666
+ this.print('Failed to auto-start session: ' + (startResult.error?.message || 'Unknown error'));
662
667
  return;
663
668
  }
664
669
  }
@@ -666,54 +671,150 @@ class REPLInterface extends events_1.EventEmitter {
666
671
  this.print('Runner not initialized. Use /start first.');
667
672
  return;
668
673
  }
669
- // Generate task ID and set current_task_id
674
+ // Generate task ID
670
675
  // Per spec 05_DATA_MODELS.md Property 38
671
676
  const taskId = 'task-' + Date.now();
672
- this.session.current_task_id = taskId;
673
- this.print('Processing task: ' + input);
677
+ // Create queued task
678
+ const queuedTask = {
679
+ id: taskId,
680
+ description: input,
681
+ state: 'QUEUED',
682
+ queuedAt: Date.now(),
683
+ startedAt: null,
684
+ completedAt: null,
685
+ };
686
+ // Add to task queue
687
+ this.taskQueue.push(queuedTask);
688
+ // Display task queued info (per redesign: visibility)
689
+ // Per user requirement: Provider/Mode/Auth must be shown at task start
690
+ this.print('');
691
+ this.print('--- Task Queued ---');
674
692
  this.print('Task ID: ' + taskId);
693
+ this.print('State: QUEUED');
694
+ // Show LLM layer info (Provider/Mode/Auth) - per redesign requirement
695
+ if (this.config.authMode === 'claude-code') {
696
+ this.print('Provider: Claude Code CLI (uses your Claude subscription, no API key required)');
697
+ }
698
+ else if (this.config.authMode === 'api-key') {
699
+ this.print('Provider: Anthropic API (API key configured)');
700
+ }
701
+ else {
702
+ this.print('Provider: ' + this.config.authMode);
703
+ }
704
+ // Show prompt summary (first 100 chars)
705
+ const promptSummary = input.length > 100 ? input.substring(0, 100) + '...' : input;
706
+ this.print('Prompt: ' + promptSummary);
707
+ this.print('-------------------');
708
+ this.print('');
709
+ this.print('(Input is not blocked - you can submit more tasks with /tasks to view status)');
710
+ this.print('');
711
+ // Start background worker if not running
712
+ // The worker runs asynchronously - we don't await it
713
+ if (!this.isTaskWorkerRunning) {
714
+ this.startTaskWorker();
715
+ }
716
+ console.log(`[DEBUG processNaturalLanguage] task queued, returning immediately`);
717
+ }
718
+ /**
719
+ * Background task worker - processes queued tasks asynchronously
720
+ * Runs in background, allowing input to continue while tasks execute
721
+ */
722
+ async startTaskWorker() {
723
+ if (this.isTaskWorkerRunning) {
724
+ return;
725
+ }
726
+ this.isTaskWorkerRunning = true;
727
+ console.log('[DEBUG startTaskWorker] worker started');
728
+ try {
729
+ while (this.running) {
730
+ // Find next QUEUED task
731
+ const nextTask = this.taskQueue.find(t => t.state === 'QUEUED');
732
+ if (!nextTask) {
733
+ // No more queued tasks - worker exits
734
+ break;
735
+ }
736
+ // Execute the task
737
+ await this.executeQueuedTask(nextTask);
738
+ }
739
+ }
740
+ finally {
741
+ this.isTaskWorkerRunning = false;
742
+ console.log('[DEBUG startTaskWorker] worker stopped');
743
+ }
744
+ }
745
+ /**
746
+ * Execute a single queued task
747
+ * Updates task state and prints results
748
+ */
749
+ async executeQueuedTask(task) {
750
+ console.log(`[DEBUG executeQueuedTask] starting task ${task.id}`);
751
+ // Update state to RUNNING
752
+ task.state = 'RUNNING';
753
+ task.startedAt = Date.now();
754
+ this.session.current_task_id = task.id;
755
+ // Print status update
675
756
  this.print('');
757
+ this.print('--- Task Started ---');
758
+ this.print('Task ID: ' + task.id);
759
+ this.print('State: RUNNING');
760
+ this.print('--------------------');
676
761
  try {
677
762
  // Per spec 10_REPL_UX.md L117-118: Get selected model from REPL config
678
- // Model is REPL-local, stored in .claude/repl.json
679
763
  let selectedModel;
680
764
  const modelResult = await this.modelCommand.getModel(this.session.projectPath);
681
765
  if (modelResult.success && modelResult.model && modelResult.model !== 'UNSET') {
682
766
  selectedModel = modelResult.model;
683
767
  }
684
- console.log(`[DEBUG processNaturalLanguage] calling runner.execute...`);
685
- // Create task from natural language input
686
- // CRITICAL: naturalLanguageTask must be set to trigger Claude Code execution
687
- // Without this, the task would only use fallback file creation patterns
768
+ console.log(`[DEBUG executeQueuedTask] calling runner.execute...`);
688
769
  const result = await this.session.runner.execute({
689
770
  tasks: [{
690
- id: taskId,
691
- description: input,
692
- naturalLanguageTask: input,
771
+ id: task.id,
772
+ description: task.description,
773
+ naturalLanguageTask: task.description,
693
774
  }],
694
775
  selectedModel,
695
776
  });
696
- console.log(`[DEBUG processNaturalLanguage] runner.execute returned, status=${result.overall_status}`);
697
- // Handle INCOMPLETE with clarification interactively
777
+ console.log(`[DEBUG executeQueuedTask] runner.execute returned, status=${result.overall_status}`);
778
+ // Update task state based on result
779
+ task.completedAt = Date.now();
780
+ task.resultStatus = result.overall_status;
781
+ task.filesModified = result.files_modified;
782
+ task.responseSummary = result.executor_output_summary;
783
+ switch (result.overall_status) {
784
+ case enums_1.OverallStatus.COMPLETE:
785
+ task.state = 'COMPLETE';
786
+ break;
787
+ case enums_1.OverallStatus.INCOMPLETE:
788
+ task.state = 'INCOMPLETE';
789
+ break;
790
+ case enums_1.OverallStatus.ERROR:
791
+ task.state = 'ERROR';
792
+ task.errorMessage = result.error?.message;
793
+ break;
794
+ default:
795
+ task.state = 'COMPLETE';
796
+ }
797
+ // Handle INCOMPLETE with clarification (but don't block)
698
798
  if (result.overall_status === enums_1.OverallStatus.INCOMPLETE &&
699
799
  result.incomplete_task_reasons &&
700
800
  result.incomplete_task_reasons.length > 0) {
701
- const clarificationNeeded = await this.handleClarificationNeeded(input, result.incomplete_task_reasons);
702
- if (clarificationNeeded) {
703
- // User provided clarification, will be processed in next input
704
- return;
705
- }
801
+ await this.handleClarificationNeeded(task.description, result.incomplete_task_reasons);
706
802
  }
707
803
  this.printExecutionResult(result);
708
804
  }
709
805
  catch (err) {
710
- console.log(`[DEBUG processNaturalLanguage] error: ${err.message}`);
711
- // Clear current_task_id on exception (fail-closed)
806
+ console.log(`[DEBUG executeQueuedTask] error: ${err.message}`);
807
+ task.state = 'ERROR';
808
+ task.completedAt = Date.now();
809
+ task.errorMessage = err.message;
810
+ this.printError(err);
811
+ }
812
+ finally {
813
+ // Clear current_task_id
712
814
  this.session.last_task_id = this.session.current_task_id;
713
815
  this.session.current_task_id = null;
714
- this.printError(err);
715
816
  }
716
- console.log(`[DEBUG processNaturalLanguage] done`);
817
+ console.log(`[DEBUG executeQueuedTask] task ${task.id} done, state=${task.state}`);
717
818
  }
718
819
  /**
719
820
  * Handle clarification needed - prompt user interactively
@@ -1063,7 +1164,8 @@ class REPLInterface extends events_1.EventEmitter {
1063
1164
  // /logs <task-id> [--full]
1064
1165
  const taskId = args[0];
1065
1166
  const full = args.includes('--full');
1066
- const result = await this.logsCommand.getTaskDetail(this.session.projectPath, taskId, full);
1167
+ // Per redesign: Pass sessionId for visibility fields
1168
+ const result = await this.logsCommand.getTaskDetail(this.session.projectPath, taskId, full, this.session.sessionId ?? undefined);
1067
1169
  if (result.success) {
1068
1170
  this.print(result.output || 'No log detail found.');
1069
1171
  return { success: true };
@@ -1076,10 +1178,78 @@ class REPLInterface extends events_1.EventEmitter {
1076
1178
  }
1077
1179
  /**
1078
1180
  * Handle /tasks command
1181
+ * Shows task queue with RUNNING/QUEUED/COMPLETE/ERROR/INCOMPLETE states
1182
+ * Per redesign: proves non-blocking by showing multiple tasks simultaneously
1079
1183
  */
1080
1184
  async handleTasks() {
1081
- const result = await this.statusCommands.getTasks();
1082
- this.print(result);
1185
+ this.print('');
1186
+ this.print('=== Task Queue ===');
1187
+ this.print('');
1188
+ if (this.taskQueue.length === 0) {
1189
+ this.print('No tasks in queue.');
1190
+ this.print('');
1191
+ // Also show legacy tasks from statusCommands if available
1192
+ const legacyResult = await this.statusCommands.getTasks();
1193
+ if (legacyResult && legacyResult.trim()) {
1194
+ this.print('--- Session Tasks ---');
1195
+ this.print(legacyResult);
1196
+ }
1197
+ return;
1198
+ }
1199
+ // Count by state
1200
+ const running = this.taskQueue.filter(t => t.state === 'RUNNING').length;
1201
+ const queued = this.taskQueue.filter(t => t.state === 'QUEUED').length;
1202
+ const complete = this.taskQueue.filter(t => t.state === 'COMPLETE').length;
1203
+ const incomplete = this.taskQueue.filter(t => t.state === 'INCOMPLETE').length;
1204
+ const error = this.taskQueue.filter(t => t.state === 'ERROR').length;
1205
+ this.print('Summary: ' + running + ' RUNNING, ' + queued + ' QUEUED, ' + complete + ' COMPLETE, ' + incomplete + ' INCOMPLETE, ' + error + ' ERROR');
1206
+ this.print('');
1207
+ // List all tasks with state
1208
+ for (const task of this.taskQueue) {
1209
+ const promptSummary = task.description.length > 50
1210
+ ? task.description.substring(0, 50) + '...'
1211
+ : task.description;
1212
+ let durationStr = '';
1213
+ if (task.startedAt) {
1214
+ const endTime = task.completedAt || Date.now();
1215
+ const durationMs = endTime - task.startedAt;
1216
+ durationStr = ' (' + (durationMs / 1000).toFixed(1) + 's)';
1217
+ }
1218
+ // State indicator with visual marker
1219
+ let stateMarker = '';
1220
+ switch (task.state) {
1221
+ case 'RUNNING':
1222
+ stateMarker = '[*]';
1223
+ break;
1224
+ case 'QUEUED':
1225
+ stateMarker = '[ ]';
1226
+ break;
1227
+ case 'COMPLETE':
1228
+ stateMarker = '[v]';
1229
+ break;
1230
+ case 'INCOMPLETE':
1231
+ stateMarker = '[!]';
1232
+ break;
1233
+ case 'ERROR':
1234
+ stateMarker = '[X]';
1235
+ break;
1236
+ }
1237
+ this.print(stateMarker + ' ' + task.id + ' | ' + task.state + durationStr);
1238
+ this.print(' ' + promptSummary);
1239
+ // Show error message if error
1240
+ if (task.state === 'ERROR' && task.errorMessage) {
1241
+ this.print(' Error: ' + task.errorMessage);
1242
+ }
1243
+ // Show files modified if complete
1244
+ if (task.state === 'COMPLETE' && task.filesModified && task.filesModified.length > 0) {
1245
+ this.print(' Files: ' + task.filesModified.slice(0, 3).join(', ') +
1246
+ (task.filesModified.length > 3 ? ' (+' + (task.filesModified.length - 3) + ' more)' : ''));
1247
+ }
1248
+ }
1249
+ this.print('');
1250
+ this.print('Use /logs <task-id> for details.');
1251
+ this.print('==================');
1252
+ this.print('');
1083
1253
  }
1084
1254
  /**
1085
1255
  * Handle /status command
@@ -1210,6 +1380,7 @@ class REPLInterface extends events_1.EventEmitter {
1210
1380
  * Per spec 10_REPL_UX.md: Ensure clean exit with flushed output
1211
1381
  *
1212
1382
  * Guarantees:
1383
+ * - Waits for running tasks to complete (task worker)
1213
1384
  * - Session state is persisted before exit
1214
1385
  * - All output is flushed before readline closes
1215
1386
  * - Double-completion is prevented via sessionCompleted flag
@@ -1223,6 +1394,18 @@ class REPLInterface extends events_1.EventEmitter {
1223
1394
  return;
1224
1395
  }
1225
1396
  this.sessionCompleted = true;
1397
+ // Wait for task worker to complete any running tasks
1398
+ if (this.isTaskWorkerRunning) {
1399
+ const runningTasks = this.taskQueue.filter(t => t.state === 'RUNNING');
1400
+ const queuedTasks = this.taskQueue.filter(t => t.state === 'QUEUED');
1401
+ if (runningTasks.length > 0 || queuedTasks.length > 0) {
1402
+ this.print('Waiting for ' + runningTasks.length + ' running and ' + queuedTasks.length + ' queued tasks to complete...');
1403
+ }
1404
+ while (this.isTaskWorkerRunning) {
1405
+ await new Promise(r => setTimeout(r, 100));
1406
+ }
1407
+ this.print('All tasks completed.');
1408
+ }
1226
1409
  this.print('Saving session state...');
1227
1410
  if (this.session.runner && this.session.sessionId) {
1228
1411
  try {
@@ -1337,6 +1520,15 @@ class REPLInterface extends events_1.EventEmitter {
1337
1520
  this.print('');
1338
1521
  this.print('--- Execution Result ---');
1339
1522
  this.print('Status: ' + result.overall_status);
1523
+ // Display executor mode (per redesign: visibility)
1524
+ if (result.executor_mode) {
1525
+ this.print('Executor: ' + result.executor_mode);
1526
+ }
1527
+ // Display duration (per redesign: visibility)
1528
+ if (result.duration_ms !== undefined && result.duration_ms > 0) {
1529
+ const seconds = (result.duration_ms / 1000).toFixed(1);
1530
+ this.print('Duration: ' + seconds + 's');
1531
+ }
1340
1532
  if (result.tasks_completed !== undefined) {
1341
1533
  this.print('Tasks: ' + result.tasks_completed + '/' + result.tasks_total + ' completed');
1342
1534
  // Track incomplete tasks for exit code (non-interactive mode)
@@ -1345,8 +1537,23 @@ class REPLInterface extends events_1.EventEmitter {
1345
1537
  this.updateExitCode();
1346
1538
  }
1347
1539
  }
1540
+ // Display files modified (per redesign: visibility)
1541
+ if (result.files_modified && result.files_modified.length > 0) {
1542
+ this.print('');
1543
+ this.print('Files Modified:');
1544
+ for (const file of result.files_modified) {
1545
+ this.print(' - ' + file);
1546
+ }
1547
+ }
1548
+ // Display executor output summary (per redesign: visibility)
1549
+ if (result.executor_output_summary) {
1550
+ this.print('');
1551
+ this.print('Response Summary:');
1552
+ this.print(' ' + result.executor_output_summary);
1553
+ }
1348
1554
  // Display error details when status is ERROR (critical for debugging fail-closed behavior)
1349
1555
  if (result.error) {
1556
+ this.print('');
1350
1557
  this.print('Error: ' + result.error.message);
1351
1558
  if (result.error.code) {
1352
1559
  this.print('Error Code: ' + result.error.code);
@@ -1357,6 +1564,7 @@ class REPLInterface extends events_1.EventEmitter {
1357
1564
  }
1358
1565
  // Display incomplete task reasons (helps identify why tasks failed)
1359
1566
  if (result.incomplete_task_reasons && result.incomplete_task_reasons.length > 0) {
1567
+ this.print('');
1360
1568
  this.print('Incomplete Tasks:');
1361
1569
  for (const reason of result.incomplete_task_reasons) {
1362
1570
  this.print(' - ' + reason.task_id + ': ' + reason.reason);
@@ -1374,6 +1582,16 @@ class REPLInterface extends events_1.EventEmitter {
1374
1582
  this.hasIncompleteTasks = true;
1375
1583
  this.updateExitCode();
1376
1584
  }
1585
+ // NO_EVIDENCE handling: show next action hint (per redesign requirement)
1586
+ // Per user requirement: NO_EVIDENCE should not complete silently
1587
+ if (result.overall_status === enums_1.OverallStatus.NO_EVIDENCE) {
1588
+ this.print('');
1589
+ this.print('HINT: No file changes were verified for this task.');
1590
+ this.print(' Possible next actions:');
1591
+ this.print(' - Check /logs for execution details');
1592
+ this.print(' - Retry with more specific instructions');
1593
+ this.print(' - Use /status to see current session state');
1594
+ }
1377
1595
  if (result.next_action !== undefined) {
1378
1596
  this.print('Next Action: ' + (result.next_action ? 'Yes' : 'No'));
1379
1597
  if (result.next_action_reason) {